Add files via upload

This commit is contained in:
公明
2026-06-23 16:53:32 +08:00
committed by GitHub
parent 6e9e43eec8
commit 7a3c67458c
3 changed files with 66 additions and 18 deletions
+18 -8
View File
@@ -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 {
+45 -5
View File
@@ -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 = `
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
<path d="M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2m3 0v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6h14zM10 11v6M14 11v6"
stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
`;
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 = [];
}
+3 -5
View File
@@ -3777,7 +3777,9 @@
<div class="modal-body batch-manage-body">
<div class="batch-conversations-table">
<div class="batch-table-header">
<div class="batch-table-col-checkbox"></div>
<div class="batch-table-col-checkbox">
<input type="checkbox" id="batch-select-all" onchange="toggleSelectAllBatch()" data-i18n="batchManageModal.selectAll" data-i18n-attr="title" title="全选" />
</div>
<div class="batch-table-col-name" data-i18n="batchManageModal.conversationName">对话名称</div>
<div class="batch-table-col-time" data-i18n="batchManageModal.lastTime">最近一次对话时间</div>
<div class="batch-table-col-action" data-i18n="batchManageModal.action">操作</div>
@@ -3786,10 +3788,6 @@
</div>
</div>
<div class="modal-footer batch-manage-footer">
<label class="select-all-checkbox">
<input type="checkbox" id="batch-select-all" onchange="toggleSelectAllBatch()" />
<span data-i18n="batchManageModal.selectAll">全选</span>
</label>
<div class="batch-footer-actions">
<button class="btn-secondary" onclick="closeBatchManageModal()" data-i18n="common.cancel">取消</button>
<button class="btn-primary" onclick="deleteSelectedConversations()" data-i18n="batchManageModal.deleteSelected">删除所选</button>