chore(配置): 更新系统配置文件
- 更新入口文件main.tsx,集成主题色初始化 - 修改settings.json系统配置参数 - 优化应用启动流程
This commit is contained in:
parent
f2fc249d04
commit
dade1709f8
10
src/main.tsx
10
src/main.tsx
@ -14,6 +14,7 @@ import { GlobalContext } from './context';
|
|||||||
import Login from './pages/login';
|
import Login from './pages/login';
|
||||||
import checkLogin from './utils/checkLogin';
|
import checkLogin from './utils/checkLogin';
|
||||||
import changeTheme from './utils/changeTheme';
|
import changeTheme from './utils/changeTheme';
|
||||||
|
import initThemeColor from './utils/initThemeColor';
|
||||||
import useStorage from './utils/useStorage';
|
import useStorage from './utils/useStorage';
|
||||||
import './mock';
|
import './mock';
|
||||||
|
|
||||||
@ -59,6 +60,15 @@ function Index() {
|
|||||||
changeTheme(theme);
|
changeTheme(theme);
|
||||||
}, [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 = {
|
const contextValue = {
|
||||||
lang,
|
lang,
|
||||||
setLang,
|
setLang,
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
"colorWeek": false,
|
"colorWeek": false,
|
||||||
"navbar": true,
|
"navbar": true,
|
||||||
"menu": true,
|
"menu": true,
|
||||||
"footer": true,
|
"footer": false,
|
||||||
"themeColor": "#006266",
|
"themeColor": "#4834D4",
|
||||||
"menuWidth": 220
|
"menuWidth": 220
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user