v2: 文件面板改为底部弹出浮层+遮罩,盖住输入区;scroll-bottom-btn位于面板下方
This commit is contained in:
@@ -61,18 +61,6 @@
|
||||
|
||||
<!-- ================= 底部输入区 ================= -->
|
||||
<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="input-shell">
|
||||
<textarea id="msg-input" placeholder="传送信息" rows="2" enterkeyhint="send"></textarea>
|
||||
@@ -120,6 +108,19 @@
|
||||
</div>
|
||||
</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="设置">
|
||||
<!-- 顶栏:左侧返回 + 中间标题 + 右侧操作按钮,风格与对话页 header 一致 -->
|
||||
@@ -1145,19 +1146,26 @@
|
||||
toast(state.deepThink ? '深度思考已开启(暂不影响后端)' : '深度思考已关闭');
|
||||
});
|
||||
|
||||
// ---------- 任务文件面板(点输入行中部的附件按钮展开;同步 index) ----------
|
||||
// ---------- 任务文件面板(底部浮层:点输入行中部的附件按钮展开,遮罩盖住输入区) ----------
|
||||
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);
|
||||
}
|
||||
function toggleFilesPanel() {
|
||||
const panel = $('files-panel');
|
||||
const open = panel.classList.contains('hidden');
|
||||
const open = !panel.classList.contains('open');
|
||||
if (open && !state.sessionId) { toast('先发送一条消息创建会话,再管理任务文件'); return; }
|
||||
setFilesPanel(open);
|
||||
if (open) loadFiles();
|
||||
}
|
||||
$('attach-btn').addEventListener('click', toggleFilesPanel);
|
||||
$('files-mask').addEventListener('click', () => setFilesPanel(false)); // 点遮罩收起
|
||||
|
||||
async function loadFiles() {
|
||||
if (!state.sessionId) return;
|
||||
@@ -1214,13 +1222,7 @@
|
||||
loadFiles();
|
||||
} 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() {
|
||||
const row = $('attach-chips');
|
||||
@@ -1274,6 +1276,7 @@
|
||||
if (!$('settings-page').classList.contains('hidden')) return true;
|
||||
if (!$('img-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)');
|
||||
}
|
||||
function reset() {
|
||||
|
||||
Reference in New Issue
Block a user