From 92cf8fab8aa1a7fe79a9bf8578327fa4f10c566e Mon Sep 17 00:00:00 2001 From: "3371392206@qq.com" <3371392206@qq.com> Date: Sun, 30 Aug 2026 13:04:26 +0800 Subject: [PATCH] =?UTF-8?q?fix(ui):=20dashboard=20=E5=8A=A0=20loadSettings?= =?UTF-8?q?,=20CORS=20banner=20=E7=BB=88=E4=BA=8E=E4=B8=8D=E5=81=87?= =?UTF-8?q?=E9=98=B3=E6=80=A7=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bug FE-002: - /admin dashboard 顶部黄条"跨域 CORS 未配置"永远显示 - 原因: reloadAll() 没调 loadSettings, dashboard 上 settings.value 一直是 {} - banner 判断 `!settings.cors_configured` → undefined → falsy → 触发 - 只有手动进 settings tab 触发 loadSettings() 后才消失 - 刷新页面又出现(被用户当成"CORS 没生效") 修法: 一行。reloadAll() 加上 loadSettings(), mount 时一并加载, dashboard 上 settings 就有真值了, banner 判断正确。 diff: - const reloadAll = () => { loadOverview(); loadVoices(); }; + const reloadAll = () => { loadOverview(); loadVoices(); loadSettings(); }; 副作用: 无。 loadSettings 自带 try/catch, 即使 /api/settings 失败 也不影响 overview/voices 加载。 watch(tab) 仍会再调一次 loadSettings (idempotent, 覆盖 fresh 值)。 验证 (本机 + 你的报告复现): - 强刷 admin → mount 时 3 个 API 并行加载 - settings.value 填好, cors_configured = true - banner `v-if="settings && !settings.cors_configured && ..."` 评估为 false → 不显示 未 push(等你确认) 二进制: ~18MB → ~18MB (HTML 嵌入尺寸不变) --- router/admin.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/router/admin.html b/router/admin.html index f7f19c3..a56e1ca 100644 --- a/router/admin.html +++ b/router/admin.html @@ -953,7 +953,7 @@ toast('err', '保存 CORS 失败: ' + corsErr.value); } finally { savingCors.value = false; } }; - const reloadAll = () => { loadOverview(); loadVoices(); }; + const reloadAll = () => { loadOverview(); loadVoices(); loadSettings(); }; const saveSettings = async () => { settingsErr.value = '';