mirror of https://github.com/jeecgboot/jeecg-boot
默认主题配置不生效
parent
19fc610ef5
commit
7160ea32cb
|
@ -12,6 +12,7 @@ import {
|
||||||
} from '/@/enums/appEnum';
|
} from '/@/enums/appEnum';
|
||||||
import { SIDE_BAR_BG_COLOR_LIST, HEADER_PRESET_BG_COLOR_LIST } from './designSetting';
|
import { SIDE_BAR_BG_COLOR_LIST, HEADER_PRESET_BG_COLOR_LIST } from './designSetting';
|
||||||
import { primaryColor } from '../../build/config/themeConfig';
|
import { primaryColor } from '../../build/config/themeConfig';
|
||||||
|
import { darkMode } from '/@/settings/designSetting';
|
||||||
|
|
||||||
// ! 改动后需要清空浏览器缓存
|
// ! 改动后需要清空浏览器缓存
|
||||||
const setting: ProjectConfig = {
|
const setting: ProjectConfig = {
|
||||||
|
@ -43,6 +44,10 @@ const setting: ProjectConfig = {
|
||||||
|
|
||||||
// 项目主题色
|
// 项目主题色
|
||||||
themeColor: primaryColor,
|
themeColor: primaryColor,
|
||||||
|
// update-begin--author:liaozhiyang---date:20250414--for:【QQYUN-11956】修复projectSetting中配置主题模式不生效
|
||||||
|
// 项目主题模式
|
||||||
|
themeMode: darkMode,
|
||||||
|
// update-end--author:liaozhiyang---date:20250414--for:【QQYUN-11956】修复projectSetting中配置主题模式不生效
|
||||||
|
|
||||||
// 网站灰色模式,用于可能悼念的日期开启
|
// 网站灰色模式,用于可能悼念的日期开启
|
||||||
grayMode: false,
|
grayMode: false,
|
||||||
|
|
|
@ -12,6 +12,7 @@ import { darkMode } from '/@/settings/designSetting';
|
||||||
import { resetRouter } from '/@/router';
|
import { resetRouter } from '/@/router';
|
||||||
import { deepMerge } from '/@/utils';
|
import { deepMerge } from '/@/utils';
|
||||||
import { getHideLayoutTypes } from '/@/utils/env';
|
import { getHideLayoutTypes } from '/@/utils/env';
|
||||||
|
import setting from '/@/settings/projectSetting';
|
||||||
|
|
||||||
interface AppState {
|
interface AppState {
|
||||||
darkMode?: ThemeEnum;
|
darkMode?: ThemeEnum;
|
||||||
|
@ -42,7 +43,20 @@ export const useAppStore = defineStore({
|
||||||
return this.pageLoading;
|
return this.pageLoading;
|
||||||
},
|
},
|
||||||
getDarkMode(): 'light' | 'dark' | string {
|
getDarkMode(): 'light' | 'dark' | string {
|
||||||
return this.darkMode || localStorage.getItem(APP_DARK_MODE_KEY_) || darkMode;
|
// liaozhiyang---date:20250411---for:【QQYUN-11956】修复projectSetting中配置主题模式不生效
|
||||||
|
const getSettingTheme = () => {
|
||||||
|
const theme = setting.themeMode;
|
||||||
|
if (theme) {
|
||||||
|
if (theme == ThemeEnum.DARK) {
|
||||||
|
// 为了index.html页面loading时是暗黑
|
||||||
|
localStorage.setItem(APP_DARK_MODE_KEY_, theme);
|
||||||
|
}
|
||||||
|
return theme;
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
};
|
||||||
|
// liaozhiyang---date:20250411---for:【QQYUN-11956】修复projectSetting中配置主题模式不生效
|
||||||
|
return this.darkMode || localStorage.getItem(APP_DARK_MODE_KEY_) || getSettingTheme() || darkMode;
|
||||||
},
|
},
|
||||||
|
|
||||||
getBeforeMiniInfo(): BeforeMiniState {
|
getBeforeMiniInfo(): BeforeMiniState {
|
||||||
|
@ -102,6 +116,7 @@ export const useAppStore = defineStore({
|
||||||
setDarkMode(mode: ThemeEnum): void {
|
setDarkMode(mode: ThemeEnum): void {
|
||||||
this.darkMode = mode;
|
this.darkMode = mode;
|
||||||
localStorage.setItem(APP_DARK_MODE_KEY_, mode);
|
localStorage.setItem(APP_DARK_MODE_KEY_, mode);
|
||||||
|
this.setProjectConfig({ themeMode: mode });
|
||||||
},
|
},
|
||||||
|
|
||||||
setBeforeMiniInfo(state: BeforeMiniState): void {
|
setBeforeMiniInfo(state: BeforeMiniState): void {
|
||||||
|
|
|
@ -104,6 +104,8 @@ export interface ProjectConfig {
|
||||||
colorWeak: boolean;
|
colorWeak: boolean;
|
||||||
// Theme color
|
// Theme color
|
||||||
themeColor: string;
|
themeColor: string;
|
||||||
|
// Theme Mode
|
||||||
|
themeMode: string;
|
||||||
|
|
||||||
// The main interface is displayed in full screen, the menu is not displayed, and the top
|
// The main interface is displayed in full screen, the menu is not displayed, and the top
|
||||||
fullContent: boolean;
|
fullContent: boolean;
|
||||||
|
|
Loading…
Reference in New Issue