默认主题配置不生效

pull/8191/head
JEECG 2025-04-15 11:24:22 +08:00
parent 19fc610ef5
commit 7160ea32cb
3 changed files with 23 additions and 1 deletions

View File

@ -12,6 +12,7 @@ import {
} from '/@/enums/appEnum';
import { SIDE_BAR_BG_COLOR_LIST, HEADER_PRESET_BG_COLOR_LIST } from './designSetting';
import { primaryColor } from '../../build/config/themeConfig';
import { darkMode } from '/@/settings/designSetting';
// !
const setting: ProjectConfig = {
@ -43,6 +44,10 @@ const setting: ProjectConfig = {
//
themeColor: primaryColor,
// update-begin--author:liaozhiyang---date:20250414--forQQYUN-11956projectSetting
//
themeMode: darkMode,
// update-end--author:liaozhiyang---date:20250414--forQQYUN-11956projectSetting
//
grayMode: false,

View File

@ -12,6 +12,7 @@ import { darkMode } from '/@/settings/designSetting';
import { resetRouter } from '/@/router';
import { deepMerge } from '/@/utils';
import { getHideLayoutTypes } from '/@/utils/env';
import setting from '/@/settings/projectSetting';
interface AppState {
darkMode?: ThemeEnum;
@ -42,7 +43,20 @@ export const useAppStore = defineStore({
return this.pageLoading;
},
getDarkMode(): 'light' | 'dark' | string {
return this.darkMode || localStorage.getItem(APP_DARK_MODE_KEY_) || darkMode;
// liaozhiyang---date:20250411---forQQYUN-11956projectSetting
const getSettingTheme = () => {
const theme = setting.themeMode;
if (theme) {
if (theme == ThemeEnum.DARK) {
// index.htmlloading
localStorage.setItem(APP_DARK_MODE_KEY_, theme);
}
return theme;
}
return '';
};
// liaozhiyang---date:20250411---forQQYUN-11956projectSetting
return this.darkMode || localStorage.getItem(APP_DARK_MODE_KEY_) || getSettingTheme() || darkMode;
},
getBeforeMiniInfo(): BeforeMiniState {
@ -102,6 +116,7 @@ export const useAppStore = defineStore({
setDarkMode(mode: ThemeEnum): void {
this.darkMode = mode;
localStorage.setItem(APP_DARK_MODE_KEY_, mode);
this.setProjectConfig({ themeMode: mode });
},
setBeforeMiniInfo(state: BeforeMiniState): void {

View File

@ -104,6 +104,8 @@ export interface ProjectConfig {
colorWeak: boolean;
// Theme color
themeColor: string;
// Theme Mode
themeMode: string;
// The main interface is displayed in full screen, the menu is not displayed, and the top
fullContent: boolean;