diff --git a/src/layout/components/UserInfo/src/UserInfo.vue b/src/layout/components/UserInfo/src/UserInfo.vue index d78a949a..ba9c036e 100644 --- a/src/layout/components/UserInfo/src/UserInfo.vue +++ b/src/layout/components/UserInfo/src/UserInfo.vue @@ -8,7 +8,7 @@ import { useUserStore } from '@/store/modules/user' import LockDialog from './components/LockDialog.vue' import LockPage from './components/LockPage.vue' import { useLockStore } from '@/store/modules/lock' - +import * as ConfigApi from '@/api/infra/config'//李晓东 defineOptions({ name: 'UserInfo' }) const { t } = useI18n() @@ -36,6 +36,7 @@ const lockScreen = () => { const loginOut = async () => { try { + const configdata= await ConfigApi.getConfigKey('url.loginOut')//李晓东 通过配置项取退出后重定向页面 原先定向首页 await ElMessageBox.confirm(t('common.loginOutMessage'), t('common.reminder'), { confirmButtonText: t('common.ok'), cancelButtonText: t('common.cancel'), @@ -43,7 +44,9 @@ const loginOut = async () => { }) await userStore.loginOut() tagsViewStore.delAllViews() - replace('/login?redirect=/index') + // replace('/login?redirect=/index') + replace(configdata) + } catch {} } const toProfile = async () => { diff --git a/src/permission.ts b/src/permission.ts index d538303b..6f4aa055 100644 --- a/src/permission.ts +++ b/src/permission.ts @@ -8,7 +8,7 @@ import { usePageLoading } from '@/hooks/web/usePageLoading' import { useDictStoreWithOut } from '@/store/modules/dict' import { useUserStoreWithOut } from '@/store/modules/user' import { usePermissionStoreWithOut } from '@/store/modules/permission' - +import * as ConfigApi from '@/api/infra/config'//李晓东 const { start, done } = useNProgress() const { loadStart, loadDone } = usePageLoading() @@ -94,7 +94,8 @@ router.beforeEach(async (to, from, next) => { if (whiteList.indexOf(to.path) !== -1) { next() } else { - next(`/login?redirect=${to.fullPath}`) // 否则全部重定向到登录页 + //next(`/login?redirect=/diagnosis/patientexamlistPathology`) + next(await ConfigApi.getConfigKey('url.loginOut')) //李晓东 // 否则全部重定向到登录页 病理需要 李晓东 临时解决办法 直接指向某个固定页面 /diagnosis/patientexamlistPathology 原先写法:next(`/login?redirect=${to.fullPath}`) } } }) diff --git a/src/store/modules/permission.ts b/src/store/modules/permission.ts index c590db74..a6c63a37 100644 --- a/src/store/modules/permission.ts +++ b/src/store/modules/permission.ts @@ -38,7 +38,7 @@ export const usePermissionStore = defineStore('permission', { if (wsCache.get(CACHE_KEY.ROLE_ROUTERS)) { res = wsCache.get(CACHE_KEY.ROLE_ROUTERS) as AppCustomRouteRecordRaw[] } - const routerMap: AppRouteRecordRaw[] = generateRoute(res) + const routerMap: AppRouteRecordRaw[] =await generateRoute(res) // 动态路由,404一定要放到最后面 // 李晓东 this.addRouters = routerMap.concat([ diff --git a/src/utils/routerHelper.ts b/src/utils/routerHelper.ts index f292751a..89901841 100644 --- a/src/utils/routerHelper.ts +++ b/src/utils/routerHelper.ts @@ -3,7 +3,7 @@ import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router' import { isUrl } from '@/utils/is' import { cloneDeep, omit } from 'lodash-es' import qs from 'qs' - +import * as ConfigApi from '@/api/infra/config'//李晓东 const modules = import.meta.glob('../views/**/*.{vue,tsx}') /** * 注册一个异步组件 @@ -61,9 +61,10 @@ export const getRawRoute = (route: RouteLocationNormalized): RouteLocationNormal } // 后端控制路由生成 -export const generateRoute = (routes: AppCustomRouteRecordRaw[]): AppRouteRecordRaw[] => { +export const generateRoute = async (routes: AppCustomRouteRecordRaw[]): Promise => { const res: AppRouteRecordRaw[] = [] const modulesRoutesKeys = Object.keys(modules) + const Title=await getTitle()//李晓东 for (const route of routes) { // 1. 生成 meta 菜单元数据 const meta = { @@ -74,7 +75,8 @@ export const generateRoute = (routes: AppCustomRouteRecordRaw[]): AppRouteRecord alwaysShow: route.children && route.children.length === 1 && - (route.alwaysShow !== undefined ? route.alwaysShow : true) + (route.alwaysShow !== undefined ? route.alwaysShow : true), + affix: route.name ===Title//李晓东 目前 写死是判断固定的菜单不可关闭 后面做成配置 } as any // 特殊逻辑:如果后端配置的 MenuDO.component 包含 ?,则表示需要传递参数 // 此时,我们需要解析参数,并且将参数放到 meta.query 中 @@ -141,7 +143,7 @@ export const generateRoute = (routes: AppCustomRouteRecordRaw[]): AppRouteRecord data.component = modules[modulesRoutesKeys[index]] } if (route.children) { - data.children = generateRoute(route.children) + data.children =await generateRoute(route.children) } } res.push(data as AppRouteRecordRaw) @@ -251,3 +253,16 @@ const toCamelCase = (str: string, upperCaseFirst: boolean) => { return str } + +async function getTitle() {//李晓东 + try { + // 等待 Promise 解析并获取值 + const title = await ConfigApi.getConfigKey('isclose'); + return title; // 返回标题 + } catch (error) { + console.error('Failed to get title:', error); + throw error; // 重新抛出错误,或者处理错误 + } +} + + diff --git a/src/views/Login/Login.vue b/src/views/Login/Login.vue index 98713e4b..83912141 100644 --- a/src/views/Login/Login.vue +++ b/src/views/Login/Login.vue @@ -32,7 +32,7 @@
- 医共体医学影像系统 + {{headTitle}} The Medical Community Medical Imaging Systems
@@ -93,7 +93,7 @@ import { useDesign } from '@/hooks/web/useDesign' import { useAppStore } from '@/store/modules/app' import { ThemeSwitch } from '@/layout/components/ThemeSwitch' import { LocaleDropdown } from '@/layout/components/LocaleDropdown' - +import * as ConfigApi from '@/api/infra/config'//李晓东 import { LoginForm, MobileForm, QrCodeForm, RegisterForm, SSOLoginVue } from './components' defineOptions({ name: 'Login' }) @@ -102,6 +102,13 @@ const { t } = useI18n() const appStore = useAppStore() const { getPrefixCls } = useDesign() const prefixCls = getPrefixCls('login') + +const headTitle = ref('医共体医学影像系统') +onMounted(async() => { + + headTitle.value= await ConfigApi.getConfigKey('headTitle')//李晓东 通过配置项取退出后重定向页面 原先定向首页= await ConfigApi.getConfigKey('url.loginOut')//李晓东 通过配置项取退出后重定向页面 原先定向首页 + console.log('系统名称'+headTitle.value) +})