|
@@ -40,6 +40,7 @@
|
|
|
import { getPermissionList } from '/@/api/sys/menu';
|
|
import { getPermissionList } from '/@/api/sys/menu';
|
|
|
import { getSavedHomeStyle, saveHomeStyle } from '/@/utils/homeStyle';
|
|
import { getSavedHomeStyle, saveHomeStyle } from '/@/utils/homeStyle';
|
|
|
import type { HomeStyleOption } from '/@/utils/homeStyle';
|
|
import type { HomeStyleOption } from '/@/utils/homeStyle';
|
|
|
|
|
+ import projectSetting from '/@/settings/projectSetting';
|
|
|
|
|
|
|
|
const visible = ref(false);
|
|
const visible = ref(false);
|
|
|
const selectedId = ref<string>('');
|
|
const selectedId = ref<string>('');
|
|
@@ -51,6 +52,10 @@
|
|
|
const glob = useGlobSetting();
|
|
const glob = useGlobSetting();
|
|
|
const { setDarkMode } = useRootSetting();
|
|
const { setDarkMode } = useRootSetting();
|
|
|
|
|
|
|
|
|
|
+ function getSystemDefaultTheme(): ThemeEnum {
|
|
|
|
|
+ return (projectSetting.headerSetting?.theme as ThemeEnum) || ThemeEnum.VENT1;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/** 递归展平菜单树(兼容 children 嵌套) */
|
|
/** 递归展平菜单树(兼容 children 嵌套) */
|
|
|
function flattenMenu(nodes: any[], list: any[] = []): any[] {
|
|
function flattenMenu(nodes: any[], list: any[] = []): any[] {
|
|
|
nodes?.forEach((node) => {
|
|
nodes?.forEach((node) => {
|
|
@@ -164,7 +169,8 @@
|
|
|
const defaultOption = options.value.find((o) => o.route === glob.homePath);
|
|
const defaultOption = options.value.find((o) => o.route === glob.homePath);
|
|
|
saveHomeStyle(null);
|
|
saveHomeStyle(null);
|
|
|
selectedId.value = defaultOption?.id || '';
|
|
selectedId.value = defaultOption?.id || '';
|
|
|
- applyTheme(defaultOption ?? { theme: ThemeEnum.VENT1 });
|
|
|
|
|
|
|
+ // 系统默认首页未在可选列表中注册时,主题退回生效的项目配置,而不是写死 vent1
|
|
|
|
|
+ applyTheme(defaultOption || { theme: getSystemDefaultTheme() });
|
|
|
createMessage.success('已恢复默认首页风格,正在应用系统默认首页…');
|
|
createMessage.success('已恢复默认首页风格,正在应用系统默认首页…');
|
|
|
visible.value = false;
|
|
visible.value = false;
|
|
|
go(glob.homePath || PageEnum.BASE_HOME);
|
|
go(glob.homePath || PageEnum.BASE_HOME);
|