Procházet zdrojové kódy

perf(认证-登录): 1、登录信息缓存改为使用sessionStorage 2、登出移除角色权限信息

shizhongming před 2 roky
rodič
revize
8e343110ef
2 změnil soubory, kde provedl 4 přidání a 1 odebrání
  1. 1 1
      src/settings/projectSetting.ts
  2. 3 0
      src/store/modules/user.ts

+ 1 - 1
src/settings/projectSetting.ts

@@ -31,7 +31,7 @@ const setting: ProjectConfig = {
   permissionMode: PermissionModeEnum.BACK,
 
   // Permission-related cache is stored in sessionStorage or localStorage
-  permissionCacheType: CacheTypeEnum.LOCAL,
+  permissionCacheType: CacheTypeEnum.SESSION,
 
   // Session timeout processing
   sessionTimeoutProcessing: SessionTimeoutProcessingEnum.ROUTE_JUMP,

+ 3 - 0
src/store/modules/user.ts

@@ -157,8 +157,11 @@ export const useUserStore = defineStore({
         }
       }
       this.setToken(undefined);
+      this.setRoleList([]);
       this.setSessionTimeout(false);
       this.setUserInfo(null);
+      const permissionStore = usePermissionStore();
+      permissionStore.setPermCodeList([]);
       if (goLogin) {
         // 直接回登陆页
         router.replace(PageEnum.BASE_LOGIN);