Browse Source

fix: 路由调整

main
xuziqiang 5 months ago
parent
commit
689a349d96
  1. 2
      lib/saas/router/guard/permission-guard.ts
  2. 6
      lib/util/http/axios.ts

2
lib/saas/router/guard/permission-guard.ts

@ -32,7 +32,7 @@ export function createPermissionGuard(router: Router, whiteNameList: string[]) {
to.name && to.name &&
!whiteNameList.includes(to.name as string) !whiteNameList.includes(to.name as string)
) { ) {
NsMessage.error('登信息已过期,请重新登录!', 1); NsMessage.error('登信息已过期,请重新登录!', 1);
next({ name: 'login' }); next({ name: 'login' });
} else { } else {
// 存储用户信息 // 存储用户信息

6
lib/util/http/axios.ts

@ -78,7 +78,7 @@ export class NSAxios {
const errCodeMap = new Map([ const errCodeMap = new Map([
[13, ''], [13, ''],
[1, ''], [1, ''],
[3005, JSON.stringify(() => routerConfig.logout())], [3005, () => routerConfig.logout()],
]); ]);
// type closeType = (() => void) | undefined; // type closeType = (() => void) | undefined;
@ -88,10 +88,12 @@ export class NSAxios {
const code = res?.data?.retcode; const code = res?.data?.retcode;
const msg = res?.data?.msg; const msg = res?.data?.msg;
if (errCodeMap.has(code)) { if (errCodeMap.has(code)) {
console.log(errCodeMap.get(code));
NsMessage.error({ NsMessage.error({
content: msg, content: msg,
key: this.errorMsgKey, key: this.errorMsgKey,
onClose: errCodeMap.get(code) && JSON.parse(errCodeMap.get(code)!)(), onClose: errCodeMap.get(code) && errCodeMap.get(code)(),
}); });
return Promise.reject(res); return Promise.reject(res);
} }

Loading…
Cancel
Save