v2: 文件面板改为底部弹出浮层+遮罩,盖住输入区;scroll-bottom-btn位于面板下方
This commit is contained in:
@@ -36,6 +36,7 @@ input, textarea { font: inherit; color: inherit; border: 0; outline: none; backg
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
position: relative;
|
position: relative;
|
||||||
background: var(--page);
|
background: var(--page);
|
||||||
|
overflow: hidden; /* 裁掉底部浮层收起时滑出屏幕的部分 */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ================= 顶部导航栏 ================= */
|
/* ================= 顶部导航栏 ================= */
|
||||||
@@ -311,18 +312,30 @@ footer { flex: none; padding: 8px 12px calc(10px + env(safe-area-inset-bottom, 0
|
|||||||
}
|
}
|
||||||
.send-btn:active { opacity: 0.85; }
|
.send-btn:active { opacity: 0.85; }
|
||||||
|
|
||||||
/* ================= 任务文件面板(同步 index 的 files-panel;仅保留上传) ================= */
|
/* ================= 任务文件面板浮层(底部弹出:盖住输入区,背景遮罩;scroll-bottom-btn 在其下方) ================= */
|
||||||
.files-panel {
|
#files-mask {
|
||||||
flex: none; display: flex; flex-direction: column;
|
position: absolute; inset: 0; z-index: 44;
|
||||||
max-height: 45vh; overflow: hidden;
|
background: rgba(10, 14, 30, 0.38);
|
||||||
margin-bottom: 8px;
|
opacity: 0; pointer-events: none; transition: opacity .22s;
|
||||||
border: 1px solid var(--border); border-radius: 14px;
|
|
||||||
background: var(--page);
|
|
||||||
}
|
}
|
||||||
|
#files-mask.show { opacity: 1; pointer-events: auto; }
|
||||||
|
.files-panel {
|
||||||
|
position: absolute; left: 0; right: 0; bottom: 0; z-index: 45;
|
||||||
|
display: flex; flex-direction: column;
|
||||||
|
max-height: 62%;
|
||||||
|
background: var(--page);
|
||||||
|
border-radius: 16px 16px 0 0;
|
||||||
|
box-shadow: 0 -6px 24px rgba(20, 30, 70, 0.16);
|
||||||
|
transform: translateY(105%); transition: transform .25s ease; /* 收起时滑出屏幕 */
|
||||||
|
padding-bottom: env(safe-area-inset-bottom, 0px);
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
.files-panel.open { transform: translateY(0); }
|
||||||
.files-panel-header {
|
.files-panel-header {
|
||||||
flex: none; display: flex; align-items: center; justify-content: space-between;
|
flex: none; display: flex; align-items: center; justify-content: space-between;
|
||||||
padding: 9px 12px 9px 14px; font-size: 14px; font-weight: 600;
|
padding: 12px 14px; font-size: 14px; font-weight: 600;
|
||||||
border-bottom: 1px solid var(--border);
|
border-bottom: 1px solid var(--border);
|
||||||
|
background: var(--page);
|
||||||
}
|
}
|
||||||
.files-panel-header .file-upload {
|
.files-panel-header .file-upload {
|
||||||
width: 30px; height: 30px; border-radius: 50%;
|
width: 30px; height: 30px; border-radius: 50%;
|
||||||
|
|||||||
@@ -61,18 +61,6 @@
|
|||||||
|
|
||||||
<!-- ================= 底部输入区 ================= -->
|
<!-- ================= 底部输入区 ================= -->
|
||||||
<footer>
|
<footer>
|
||||||
<!-- 任务文件面板:点输入行中部的附件按钮展开(同步 index;标题右上仅保留上传图标) -->
|
|
||||||
<div class="files-panel hidden" id="files-panel">
|
|
||||||
<div class="files-panel-header">
|
|
||||||
<span>任务文件</span>
|
|
||||||
<label class="file-upload" title="上传文件">
|
|
||||||
<input type="file" id="file-input" multiple hidden>
|
|
||||||
<svg viewBox="0 0 24 24"><line x1="12" y1="5" x2="12" y2="19"></line><line x1="5" y1="12" x2="19" y2="12"></line></svg>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
<div class="files-list" id="files-list"></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="attach-chips hidden" id="attach-chips"></div>
|
<div class="attach-chips hidden" id="attach-chips"></div>
|
||||||
<div class="input-shell">
|
<div class="input-shell">
|
||||||
<textarea id="msg-input" placeholder="传送信息" rows="2" enterkeyhint="send"></textarea>
|
<textarea id="msg-input" placeholder="传送信息" rows="2" enterkeyhint="send"></textarea>
|
||||||
@@ -120,6 +108,19 @@
|
|||||||
</div>
|
</div>
|
||||||
</aside>
|
</aside>
|
||||||
|
|
||||||
|
<!-- ================= 任务文件面板(浮层:点输入行中部的附件按钮展开;盖住输入区+遮罩) ================= -->
|
||||||
|
<div id="files-mask" aria-hidden="true"></div>
|
||||||
|
<div class="files-panel" id="files-panel" aria-label="任务文件">
|
||||||
|
<div class="files-panel-header">
|
||||||
|
<span>任务文件</span>
|
||||||
|
<label class="file-upload" title="上传文件">
|
||||||
|
<input type="file" id="file-input" multiple hidden>
|
||||||
|
<svg viewBox="0 0 24 24"><line x1="12" y1="5" x2="12" y2="19"></line><line x1="5" y1="12" x2="19" y2="12"></line></svg>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="files-list" id="files-list"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- ================= 设置区(覆盖层;入口:侧边栏用户区) ================= -->
|
<!-- ================= 设置区(覆盖层;入口:侧边栏用户区) ================= -->
|
||||||
<section id="settings-page" class="hidden" aria-label="设置">
|
<section id="settings-page" class="hidden" aria-label="设置">
|
||||||
<!-- 顶栏:左侧返回 + 中间标题 + 右侧操作按钮,风格与对话页 header 一致 -->
|
<!-- 顶栏:左侧返回 + 中间标题 + 右侧操作按钮,风格与对话页 header 一致 -->
|
||||||
@@ -1145,19 +1146,26 @@
|
|||||||
toast(state.deepThink ? '深度思考已开启(暂不影响后端)' : '深度思考已关闭');
|
toast(state.deepThink ? '深度思考已开启(暂不影响后端)' : '深度思考已关闭');
|
||||||
});
|
});
|
||||||
|
|
||||||
// ---------- 任务文件面板(点输入行中部的附件按钮展开;同步 index) ----------
|
// ---------- 任务文件面板(底部浮层:点输入行中部的附件按钮展开,遮罩盖住输入区) ----------
|
||||||
function setFilesPanel(open) {
|
function setFilesPanel(open) {
|
||||||
$('files-panel').classList.toggle('hidden', !open);
|
const panel = $('files-panel');
|
||||||
|
if (open) {
|
||||||
|
loadFiles();
|
||||||
|
// 弹出面板时收起软键盘,避免顶起布局
|
||||||
|
if (document.activeElement && document.activeElement.blur) document.activeElement.blur();
|
||||||
|
}
|
||||||
|
panel.classList.toggle('open', open);
|
||||||
|
$('files-mask').classList.toggle('show', open);
|
||||||
$('attach-btn').classList.toggle('active', open);
|
$('attach-btn').classList.toggle('active', open);
|
||||||
}
|
}
|
||||||
function toggleFilesPanel() {
|
function toggleFilesPanel() {
|
||||||
const panel = $('files-panel');
|
const panel = $('files-panel');
|
||||||
const open = panel.classList.contains('hidden');
|
const open = !panel.classList.contains('open');
|
||||||
if (open && !state.sessionId) { toast('先发送一条消息创建会话,再管理任务文件'); return; }
|
if (open && !state.sessionId) { toast('先发送一条消息创建会话,再管理任务文件'); return; }
|
||||||
setFilesPanel(open);
|
setFilesPanel(open);
|
||||||
if (open) loadFiles();
|
|
||||||
}
|
}
|
||||||
$('attach-btn').addEventListener('click', toggleFilesPanel);
|
$('attach-btn').addEventListener('click', toggleFilesPanel);
|
||||||
|
$('files-mask').addEventListener('click', () => setFilesPanel(false)); // 点遮罩收起
|
||||||
|
|
||||||
async function loadFiles() {
|
async function loadFiles() {
|
||||||
if (!state.sessionId) return;
|
if (!state.sessionId) return;
|
||||||
@@ -1214,13 +1222,7 @@
|
|||||||
loadFiles();
|
loadFiles();
|
||||||
} catch (err) { toast('上传失败:' + err.message); }
|
} catch (err) { toast('上传失败:' + err.message); }
|
||||||
});
|
});
|
||||||
// 面板展开时点外部自动收起(与 index 一致)
|
|
||||||
document.addEventListener('click', e => {
|
|
||||||
const panel = $('files-panel');
|
|
||||||
if (panel.classList.contains('hidden')) return;
|
|
||||||
if (e.target.closest('#attach-btn')) return; // 附件按钮自身负责开合
|
|
||||||
if (!panel.contains(e.target)) setFilesPanel(false);
|
|
||||||
});
|
|
||||||
|
|
||||||
function renderAttachChips() {
|
function renderAttachChips() {
|
||||||
const row = $('attach-chips');
|
const row = $('attach-chips');
|
||||||
@@ -1274,6 +1276,7 @@
|
|||||||
if (!$('settings-page').classList.contains('hidden')) return true;
|
if (!$('settings-page').classList.contains('hidden')) return true;
|
||||||
if (!$('img-viewer').classList.contains('hidden')) return true;
|
if (!$('img-viewer').classList.contains('hidden')) return true;
|
||||||
if (!$('fs-viewer').classList.contains('hidden')) return true;
|
if (!$('fs-viewer').classList.contains('hidden')) return true;
|
||||||
|
if ($('files-panel').classList.contains('open')) return true; // 文件面板展开时不响应
|
||||||
return !!document.querySelector('.modal-overlay:not(.hidden)');
|
return !!document.querySelector('.modal-overlay:not(.hidden)');
|
||||||
}
|
}
|
||||||
function reset() {
|
function reset() {
|
||||||
|
|||||||
Reference in New Issue
Block a user