From 1ed80595d1a999f5fae442bd83a2a7cce5d9dabe Mon Sep 17 00:00:00 2001
From: wupengfei <834520024@qq.com>
Date: 星期三, 06 八月 2025 17:01:21 +0800
Subject: [PATCH] feat: 字典
---
src/store/modules/permission.ts | 21 +++++++++++++--------
1 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/src/store/modules/permission.ts b/src/store/modules/permission.ts
index fa8e73a..5416c3d 100644
--- a/src/store/modules/permission.ts
+++ b/src/store/modules/permission.ts
@@ -4,6 +4,7 @@
import { constantRoutes, Route } from '@/router';
import { addAsyncRoutes, ascending } from '@/router/utils';
import * as menuServices from '@/services/api/menu';
+import { myClient } from '@/constants/query';
export interface PermissonState {
routes: Route[];
@@ -27,15 +28,19 @@
getModuleList() {
return new Promise<Route[]>(async (resolve, reject) => {
try {
- const res = await menuServices.getMenus(
- {
- userType: EnumUserType.Operation,
- clientType: EnumClientType.PcWeb,
+ const params: API.APIgetMenusParams = {
+ userType: EnumUserType.Operation,
+ clientType: EnumClientType.PcWeb,
+ };
+ const res = await myClient.fetchQuery({
+ queryKey: ['menuServices/getMenus', params],
+ queryFn: () => {
+ return menuServices.getMenus(params, {
+ showLoading: false,
+ });
},
- {
- showLoading: false,
- }
- );
+ staleTime: Infinity,
+ });
const accessedRoutes = ascending(addAsyncRoutes(formatModuleList(res))); // createAccessedRoutes(userMenuList, userInfo)
//@ts-ignore
accessedRoutes.push({ path: '/:pathMatch(.*)*', redirect: '/404', hidden: true });
--
Gitblit v1.9.1