diff --git a/manifest.json b/manifest.json index ac8d7df..5e14c85 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 3, "name": "渠道应用开发部知识库", - "version": "2.0.8", + "version": "2.0.9", "description": "通过关键词快速搜索内部文档", "permissions": ["storage"], "host_permissions": [ diff --git a/pages/upload-history.html b/pages/upload-history.html index d4a60e7..164de1e 100644 --- a/pages/upload-history.html +++ b/pages/upload-history.html @@ -65,12 +65,30 @@ .pagination button:hover:not(.active) { background: #dce4f7; } - .page-size { + + /* 新增:底部操作栏 */ + .bottom-bar { + display: flex; + justify-content: space-between; + align-items: center; margin-top: 10px; - text-align: right; font-size: 14px; } - .page-size select { + + .bottom-bar .left-actions button { + padding: 6px 12px; + background-color: #3662f4; + border: none; + color: white; + border-radius: 4px; + cursor: pointer; + } + + .bottom-bar .left-actions button:hover { + background-color: #d32f2f; + } + + .bottom-bar .right-select select { padding: 4px 8px; font-size: 14px; } @@ -79,10 +97,12 @@
| 文件名 | ++ | 文件名 | 上传时间 | 有效期 | 暂无记录 | `; + tr.innerHTML = `暂无记录 | `; tableBody.appendChild(tr); return; } - records.forEach(rec => { + records.forEach((rec) => { const tr = document.createElement("tr"); tr.innerHTML = ` -${rec.fileName} | -${rec.uploadTime} | -${rec.daysRemaining} | - `; ++ | ${rec.fileName} | +${rec.uploadTime} | +${rec.daysRemaining} | + `; tableBody.appendChild(tr); }); + + // 全选功能 + selectAllCheckbox.checked = false; + selectAllCheckbox.onclick = () => { + const checkboxes = document.querySelectorAll(".recordCheckbox"); + checkboxes.forEach(cb => cb.checked = selectAllCheckbox.checked); + }; } function renderPagination(totalCount, current, size) { @@ -59,6 +70,38 @@ function renderPagination(totalCount, current, size) { } } +deleteBtn.onclick = () => { + const selected = Array.from(document.querySelectorAll(".recordCheckbox:checked")); + if (!selected.length) { + alert("请选择要删除的记录"); + return; + } + + const recordIds = selected.map(cb => parseInt(cb.getAttribute("data-id"))); + + if (!confirm("删除后文件将无法访问或检索,是否确认删除?")) return; + + fetch(API_DELETE, { + method: "DELETE", + headers: { + "Content-Type": "application/json" + }, + body: JSON.stringify({ recordIds }) + }) + .then(res => { + if (!res.ok) throw new Error("删除失败"); + return res.json(); + }) + .then(() => { + alert("删除成功"); + loadUploadHistory(currentPage, pageSize); + }) + .catch(err => { + console.error("删除出错:", err); + alert("删除失败,请稍后重试"); + }); +}; + pageSizeSelect.addEventListener("change", () => { pageSize = parseInt(pageSizeSelect.value); currentPage = 1;
|---|