diff --git a/web/static/css/style.css b/web/static/css/style.css index a40a3553..076075cd 100644 --- a/web/static/css/style.css +++ b/web/static/css/style.css @@ -11797,34 +11797,44 @@ tr.mcp-stats-tool-row[data-tool-name]:focus-visible { background: transparent; color: var(--text-muted); cursor: pointer; - border-radius: 4px; + border-radius: 6px; display: flex; align-items: center; justify-content: center; transition: all 0.2s ease; } +.batch-delete-btn svg { + width: 16px; + height: 16px; + transition: transform 0.2s ease; +} + .batch-delete-btn:hover { background: rgba(220, 53, 69, 0.1); color: var(--error-color); } +.batch-delete-btn:hover svg { + transform: scale(1.08); +} + +.batch-delete-btn:active { + background: rgba(220, 53, 69, 0.2); + transform: scale(0.95); +} + .batch-manage-footer { display: flex; align-items: center; - justify-content: space-between; + justify-content: flex-end; padding: 16px 24px; border-top: 1px solid var(--border-color); flex-shrink: 0; } -.select-all-checkbox { - display: flex; - align-items: center; - gap: 8px; +.batch-table-col-checkbox input[type="checkbox"] { cursor: pointer; - font-size: 0.875rem; - color: var(--text-primary); } .batch-footer-actions { diff --git a/web/static/js/chat.js b/web/static/js/chat.js index 4fec962d..6adb9a4e 100644 --- a/web/static/js/chat.js +++ b/web/static/js/chat.js @@ -7450,14 +7450,14 @@ async function showBatchManageModal() { updateBatchManageTitle(allConversationsForBatch.length); renderBatchConversations(); - openAppModal('batch-manage-modal'); + openAppModal('batch-manage-modal', { focus: false }); } catch (error) { console.error('加载对话列表失败:', error); // 错误时使用空数组,不显示错误提示(更友好的用户体验) allConversationsForBatch = []; updateBatchManageTitle(0); renderBatchConversations(); - openAppModal('batch-manage-modal'); + openAppModal('batch-manage-modal', { focus: false }); } } @@ -7517,6 +7517,7 @@ function renderBatchConversations(filtered = null) { checkbox.type = 'checkbox'; checkbox.className = 'batch-conversation-checkbox'; checkbox.dataset.conversationId = conv.id; + checkbox.addEventListener('change', syncSelectAllBatchCheckbox); const name = document.createElement('div'); name.className = 'batch-table-col-name'; @@ -7542,9 +7543,21 @@ function renderBatchConversations(filtered = null) { const action = document.createElement('div'); action.className = 'batch-table-col-action'; const deleteBtn = document.createElement('button'); + deleteBtn.type = 'button'; deleteBtn.className = 'batch-delete-btn'; - deleteBtn.innerHTML = '🗑️'; - deleteBtn.onclick = () => deleteConversation(conv.id); + deleteBtn.innerHTML = ` + + `; + const deleteLabel = typeof window.t === 'function' ? window.t('contextMenu.deleteConversation') : '删除此对话'; + deleteBtn.title = deleteLabel; + deleteBtn.setAttribute('aria-label', deleteLabel); + deleteBtn.onclick = (e) => { + e.stopPropagation(); + deleteConversation(conv.id); + }; action.appendChild(deleteBtn); row.appendChild(checkbox); @@ -7554,6 +7567,8 @@ function renderBatchConversations(filtered = null) { list.appendChild(row); }); + + syncSelectAllBatchCheckbox(); } // 筛选批量管理对话 @@ -7575,12 +7590,35 @@ function filterBatchConversations(query) { function toggleSelectAllBatch() { const selectAll = document.getElementById('batch-select-all'); const checkboxes = document.querySelectorAll('.batch-conversation-checkbox'); - + + if (selectAll) { + selectAll.indeterminate = false; + } checkboxes.forEach(cb => { cb.checked = selectAll.checked; }); } +function syncSelectAllBatchCheckbox() { + const selectAll = document.getElementById('batch-select-all'); + if (!selectAll) return; + + const checkboxes = document.querySelectorAll('.batch-conversation-checkbox'); + const total = checkboxes.length; + const checked = document.querySelectorAll('.batch-conversation-checkbox:checked').length; + + if (total === 0 || checked === 0) { + selectAll.checked = false; + selectAll.indeterminate = false; + } else if (checked === total) { + selectAll.checked = true; + selectAll.indeterminate = false; + } else { + selectAll.checked = false; + selectAll.indeterminate = true; + } +} + // 删除选中的对话 async function deleteSelectedConversations() { const checkboxes = document.querySelectorAll('.batch-conversation-checkbox:checked'); @@ -7604,6 +7642,7 @@ async function deleteSelectedConversations() { const selectAll = document.getElementById('batch-select-all'); if (selectAll) { selectAll.checked = false; + selectAll.indeterminate = false; } } catch (error) { console.error('删除失败:', error); @@ -7619,6 +7658,7 @@ function closeBatchManageModal() { const selectAll = document.getElementById('batch-select-all'); if (selectAll) { selectAll.checked = false; + selectAll.indeterminate = false; } allConversationsForBatch = []; } diff --git a/web/templates/index.html b/web/templates/index.html index 4e33e108..57c64eb8 100644 --- a/web/templates/index.html +++ b/web/templates/index.html @@ -3777,7 +3777,9 @@