mirror of
https://github.com/jeecgboot/JeecgBoot.git
synced 2025-12-08 17:12:28 +08:00
默认主题配置不生效
This commit is contained in:
@ -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 {
|
||||||
|
|||||||
2
jeecgboot-vue3/types/config.d.ts
vendored
2
jeecgboot-vue3/types/config.d.ts
vendored
@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user