ui(drawer): 删除 modal 显示会话标题;侧边栏行增加鼠标悬停高亮

This commit is contained in:
2026-09-03 22:24:01 +08:00
parent f0badd9d84
commit 495b72c5c3
2 changed files with 16 additions and 5 deletions
+5 -2
View File
@@ -475,10 +475,13 @@ footer { flex: none; padding: 8px 12px calc(10px + env(safe-area-inset-bottom, 0
z-index: 2;
}
@media (hover: hover) and (pointer: fine) {
.conv-wrap:hover .conv-del { display: flex; }
.conv-del:hover { color: #c0392b; background: #fdf3f2; border-color: #eac2bd; }
.conv-wrap:hover .conv-item:not(.active) { background: #f5f6f8; }
.conv-wrap:hover .conv-del { display: flex; }
.conv-del:hover { color: #c0392b; background: #fdf3f2; border-color: #eac2bd; }
}
.drawer-empty { padding: 24px 10px; font-size: 13px; color: var(--gray-light); text-align: center; }
/* 删除会话 modal 副标题:会话 ID 等二级说明,字号小、灰色 */
.confirm-sub { font-size: 12px; color: var(--gray); margin-top: 6px; }
/* 底部用户区 */
.drawer-user {
+11 -3
View File
@@ -711,8 +711,13 @@
// ---------- 会话打开 / 新建 / 状态栏(抽屉行 × 调 deleteSession; 默认含任务目录) ----------
async function deleteSession(id) {
if (!id) return;
if (!await confirmModal('删除会话', '确定删除会话 ' + id + ' ?', '删除', true,
{ checkbox: { label: '同时删除任务文件夹', default: true } })) return;
// 从已加载列表查出会话标题,让 modal 能显示「标题 + ID」方便核对
const s = (state.sessions || []).find(x => x.id === id);
const title = s ? (s.title || s.id) : id;
const body = '确定删除会话 <b>「' + esc(title) + '」</b> 吗?删除后无法恢复。' +
'<div class="confirm-sub">会话 ID:' + esc(id) + '</div>';
if (!await confirmModal('删除会话', body, '删除', true,
{ checkbox: { label: '同时删除任务文件夹', default: true }, bodyHtml: true })) return;
const delDir = state._confirmChecked ? 'true' : 'false';
try {
await req('DELETE', '/api/sessions/' + id + '?delete_dir=' + delDir);
@@ -1663,7 +1668,10 @@
return new Promise(resolve => {
_dlgResolve = resolve;
$('confirm-title').textContent = title || '请确认';
$('confirm-text').textContent = text || '';
// bodyHtml: 需要加粗/加附加说明时传 HTML 字符串;缺省仍走 textContent 防 XSS
const body = $('confirm-text');
if (opts && opts.bodyHtml) body.innerHTML = text || '';
else body.textContent = text || '';
const ok = $('confirm-ok-btn');
ok.textContent = okText || '确定';
ok.style.background = danger ? 'linear-gradient(135deg,#a3352a,#d2483c)' : '';