From 2a01e8ca3d44840c1ad0d09c135eb8f408836974 Mon Sep 17 00:00:00 2001 From: Furrium Network Date: Tue, 11 Aug 2026 09:25:56 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=88=A0=E9=99=A4=E6=B0=94?= =?UTF-8?q?=E6=B3=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/admin.js | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/js/admin.js b/js/admin.js index cfd7089..2ef739e 100644 --- a/js/admin.js +++ b/js/admin.js @@ -451,7 +451,7 @@ function renderAdminSettings() { } // ============================================================ -// 🎨 自定义 CSS(独立标签页) +// 🎨 自定义 CSS(独立标签页)- 已改用 Toast 提示 // ============================================================ function renderAdminCustomCSS() { @@ -524,43 +524,37 @@ function renderAdminCustomCSS() { function handleCssFile(file) { if (file.name !== 'style.css') { - statusEl.textContent = '❌ 文件名必须是 style.css'; - statusEl.style.color = '#ef4444'; + showToast('文件名必须是 style.css', 'error'); selectedFile = null; fileInput.value = ''; return; } if (!file.type.includes('text/css') && !file.name.endsWith('.css')) { - statusEl.textContent = '❌ 请上传 CSS 文件'; - statusEl.style.color = '#ef4444'; + showToast('请上传 CSS 文件', 'error'); selectedFile = null; fileInput.value = ''; return; } selectedFile = file; - statusEl.textContent = '✅ 已选择: ' + file.name + ' (' + (file.size / 1024).toFixed(1) + ' KB)'; - statusEl.style.color = '#22c55e'; + showToast('已选择: ' + file.name + ' (' + (file.size / 1024).toFixed(1) + ' KB)', 'success'); } document.getElementById('customCssSaveBtn').addEventListener('click', function() { if (!selectedFile) { - statusEl.textContent = '⚠️ 请先选择 style.css 文件'; - statusEl.style.color = '#f59e0b'; + showToast('请先选择 style.css 文件', 'warning'); return; } showCustomCssWarningModal(async function() { try { await API.uploadCustomCSS(selectedFile); - statusEl.textContent = '✅ CSS 上传成功!刷新页面查看效果'; - statusEl.style.color = '#22c55e'; + showToast('CSS 上传成功!刷新页面查看效果', 'success'); selectedFile = null; fileInput.value = ''; dropText.textContent = '点击或拖拽上传 style.css'; loadCustomCSS(); } catch (err) { - statusEl.textContent = '❌ 上传失败:' + err.message; - statusEl.style.color = '#ef4444'; + showToast('上传失败:' + err.message, 'error'); } }); }); @@ -569,13 +563,11 @@ function renderAdminCustomCSS() { if (!confirm('确定要删除自定义 CSS 吗?将恢复默认样式。')) return; try { await API.deleteCustomCSS(); - statusEl.textContent = '✅ 已删除自定义 CSS'; - statusEl.style.color = '#22c55e'; + showToast('已删除自定义 CSS', 'success'); const link = document.getElementById('customCssLink'); if (link) link.remove(); } catch (err) { - statusEl.textContent = '❌ 删除失败:' + err.message; - statusEl.style.color = '#ef4444'; + showToast('删除失败:' + err.message, 'error'); } }); }