From 9259c2235e31708f954a3578bde3c6a7ab9753e8 Mon Sep 17 00:00:00 2001 From: houzhongjian <houzhongyi@126.com> Date: 星期一, 30 十二月 2024 15:51:40 +0800 Subject: [PATCH] 1、工作流相关组件更新 2、偶尔出现退出登录时路由报错的bug导致无法回到登录页面 3、全局配置文件修改,移除VITE_UPLOAD_URL配置等 --- src/store/modules/permission.ts | 12 +++++++----- 1 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/store/modules/permission.ts b/src/store/modules/permission.ts index 5e3287a..f32facc 100644 --- a/src/store/modules/permission.ts +++ b/src/store/modules/permission.ts @@ -3,9 +3,9 @@ import { cloneDeep } from 'lodash-es' import remainingRouter from '@/router/modules/remaining' import { flatMultiLevelRoutes, generateRoute } from '@/utils/routerHelper' -import { CACHE_KEY, useCache } from '@/hooks/web/useCache' +import {CACHE_KEY, useSessionCache} from '@/hooks/web/useCache' -const { wsCache } = useCache() +const { wsSessionCache } = useSessionCache() export interface PermissionState { routers: AppRouteRecordRaw[] @@ -35,15 +35,17 @@ return new Promise<void>(async (resolve) => { // 获得菜单列表,它在登录的时候,setUserInfoAction 方法中已经进行获取 let res: AppCustomRouteRecordRaw[] = [] - if (wsCache.get(CACHE_KEY.ROLE_ROUTERS)) { - res = wsCache.get(CACHE_KEY.ROLE_ROUTERS) as AppCustomRouteRecordRaw[] + const roleRouters = wsSessionCache.get(CACHE_KEY.ROLE_ROUTERS) + if (roleRouters) { + res = roleRouters as AppCustomRouteRecordRaw[] } const routerMap: AppRouteRecordRaw[] = generateRoute(res) // 动态路由,404一定要放到最后面 + // preschooler:vue-router@4以后已支持静态404路由,此处可不再追加 this.addRouters = routerMap.concat([ { path: '/:path(.*)*', - redirect: '/404', + component: () => import('@/views/Error/404.vue'), name: '404Page', meta: { hidden: true, -- Gitblit v1.9.3