From 689a349d969d264b0d935e654eda90e5b60b78ab Mon Sep 17 00:00:00 2001 From: xuziqiang <1344691446@qq.com> Date: Tue, 11 Jun 2024 16:45:18 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=B7=AF=E7=94=B1=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/saas/router/guard/permission-guard.ts | 2 +- lib/util/http/axios.ts | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/saas/router/guard/permission-guard.ts b/lib/saas/router/guard/permission-guard.ts index 89f786d..5105adf 100644 --- a/lib/saas/router/guard/permission-guard.ts +++ b/lib/saas/router/guard/permission-guard.ts @@ -32,7 +32,7 @@ export function createPermissionGuard(router: Router, whiteNameList: string[]) { to.name && !whiteNameList.includes(to.name as string) ) { - NsMessage.error('登陆信息已过期,请重新登录!', 1); + NsMessage.error('登录信息已过期,请重新登录!', 1); next({ name: 'login' }); } else { // 存储用户信息 diff --git a/lib/util/http/axios.ts b/lib/util/http/axios.ts index e66a843..79aa7f9 100644 --- a/lib/util/http/axios.ts +++ b/lib/util/http/axios.ts @@ -78,7 +78,7 @@ export class NSAxios { const errCodeMap = new Map([ [13, ''], [1, ''], - [3005, JSON.stringify(() => routerConfig.logout())], + [3005, () => routerConfig.logout()], ]); // type closeType = (() => void) | undefined; @@ -88,10 +88,12 @@ export class NSAxios { const code = res?.data?.retcode; const msg = res?.data?.msg; if (errCodeMap.has(code)) { + console.log(errCodeMap.get(code)); + NsMessage.error({ content: msg, key: this.errorMsgKey, - onClose: errCodeMap.get(code) && JSON.parse(errCodeMap.get(code)!)(), + onClose: errCodeMap.get(code) && errCodeMap.get(code)(), }); return Promise.reject(res); }