diff --git a/src/App.vue b/src/App.vue index 5621c7f..c1e4a9d 100644 --- a/src/App.vue +++ b/src/App.vue @@ -12,6 +12,7 @@ import BschIframe from "@/components/BschIframe.vue"; import SearchPanel from "@/components/SearchPanel.vue"; import UserInfoModal from "@/components/UserInfoModal.vue"; import LightPageModal from "@/components/LightPageModal.vue"; +import ThemePreview from "@/views/ThemePreview.vue"; import BaseApi from "@/api/BaseApi"; import { BschIframeType, IframePageParmas, RoleInfo, StateEnum } from "./types"; @@ -60,6 +61,7 @@ mittBus.on("openBschIframePage", async (params: IframePageParmas) => { try { const [r1, r2] = await Promise.all([p1, p2]); store.$state.userInfo = userinfo; + loadSchThemeDefault(); if (r1.length == 0) { store.$state.userRoleList = [ { @@ -86,6 +88,21 @@ mittBus.on("openBschIframePage", async (params: IframePageParmas) => { console.timeEnd("init"); })(); +/** 拉学校默认主题档写键(异步尽力而为:失败/404/空 → 不写、不报错、不阻塞登录流程) */ +function loadSchThemeDefault() { + BaseApi.getSchTheme() + .then((res: any) => { + if (res && res.themeState) { + try { + localStorage.setItem("yh-theme-sch-default", res.themeState); + } catch (e) { + /* 隐私模式写失败静默 */ + } + } + }) + .catch(() => undefined); +} + /**切换角色 */ async function switchRole() { await loadUserMenuBarList(); @@ -113,8 +130,9 @@ async function loadUserMenuBarList() { } else { findIndex = menuList.findIndex(x => x.url === route.path); } - // /msg、/settings 由后台「边栏设置」配置后即进入菜单表;未配置时也允许直达/刷新,不被弹回桌面 - if (findIndex === -1 && !["/msg", "/settings"].includes(route.path)) router.push({ name: "index" }); + // /msg、/settings 由后台「边栏设置」配置后即进入菜单表;未配置时也允许直达/刷新,不被弹回桌面。 + // /theme-preview 同理(预览页按 URL 参数挂档,不依赖菜单表与登录态) + if (findIndex === -1 && !["/msg", "/settings", "/theme-preview"].includes(route.path)) router.push({ name: "index" }); } const getRouterKey: (route: any) => string = route => { @@ -128,7 +146,11 @@ const mainStyle = computed(() => `background-image: url(${store.getCurWallPaperU