From f5c803e09e10af90988194aa4a2199f5085a50fb Mon Sep 17 00:00:00 2001 From: houzhongjian <houzhongyi@126.com> Date: 星期四, 05 十二月 2024 16:58:40 +0800 Subject: [PATCH] 优化与平台的菜单对接,需要更新平台最新代码 --- src/store/modules/permission.ts | 9 ++++----- 1 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/store/modules/permission.ts b/src/store/modules/permission.ts index 5a42f14..e0eea07 100644 --- a/src/store/modules/permission.ts +++ b/src/store/modules/permission.ts @@ -3,10 +3,10 @@ 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' import Layout from "@/layout/Layout.vue"; -const { wsCache } = useCache() +const { wsSessionCache } = useSessionCache() export interface PermissionState { routers: AppRouteRecordRaw[] @@ -36,8 +36,8 @@ 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[] + if (wsSessionCache.get(CACHE_KEY.ROLE_ROUTERS)) { + res = wsSessionCache.get(CACHE_KEY.ROLE_ROUTERS) as AppCustomRouteRecordRaw[] } const routerMap: AppRouteRecordRaw[] = generateRoute(res) // 动态路由,404一定要放到最后面 @@ -53,7 +53,6 @@ } } ]) - console.log(this.addRouters) // 渲染菜单的所有路由 this.routers = cloneDeep(remainingRouter).concat(routerMap) resolve() -- Gitblit v1.9.3