From dade1709f8c770a7ed70bc9b49ace40689a3cb7b Mon Sep 17 00:00:00 2001 From: gaoziman <2942894660@qq.com> Date: Thu, 6 Nov 2025 00:43:49 +0800 Subject: [PATCH] =?UTF-8?q?chore(=E9=85=8D=E7=BD=AE):=20=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 更新入口文件main.tsx,集成主题色初始化 - 修改settings.json系统配置参数 - 优化应用启动流程 --- src/main.tsx | 10 ++++++++++ src/settings.json | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main.tsx b/src/main.tsx index 1d2bbd0..f0ba4f3 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -14,6 +14,7 @@ import { GlobalContext } from './context'; import Login from './pages/login'; import checkLogin from './utils/checkLogin'; import changeTheme from './utils/changeTheme'; +import initThemeColor from './utils/initThemeColor'; import useStorage from './utils/useStorage'; import './mock'; @@ -59,6 +60,15 @@ function Index() { changeTheme(theme); }, [theme]); + // 初始化主题色 - 根据 settings.json 生成并注入完整的10个梯度色CSS变量 + useEffect(() => { + const settings = store.getState().settings; + if (settings && settings.themeColor) { + const isDark = theme === 'dark'; + initThemeColor(settings.themeColor, isDark); + } + }, [theme]); // 当明暗模式切换时,也需要重新生成梯度色 + const contextValue = { lang, setLang, diff --git a/src/settings.json b/src/settings.json index a23c068..340491d 100644 --- a/src/settings.json +++ b/src/settings.json @@ -2,7 +2,7 @@ "colorWeek": false, "navbar": true, "menu": true, - "footer": true, - "themeColor": "#006266", + "footer": false, + "themeColor": "#4834D4", "menuWidth": 220 }