From b94b71d44d62802bb8093f64a202d0176fdade50 Mon Sep 17 00:00:00 2001
From: zhangwei <1504152376@qq.com>
Date: 星期二, 05 八月 2025 17:00:46 +0800
Subject: [PATCH] '一些更改'

---
 src/store/modules/user.ts |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts
index b4f62ea..fabcc62 100644
--- a/src/store/modules/user.ts
+++ b/src/store/modules/user.ts
@@ -38,7 +38,7 @@
     username: storageLocal().getItem<DataInfo<number>>(userKey)?.username ?? "",
     // 鏄电О
     nickname: storageLocal().getItem<DataInfo<number>>(userKey)?.nickname ?? "",
-    // 椤甸潰绾у埆鏉冮檺
+    // 褰撳墠瑙掕壊鍒楄〃
     exRoles: storageLocal().getItem<DataInfo<number>>(userKey)?.exRoles ?? [],
     // 鎸夐挳绾у埆鏉冮檺
     permissions:
@@ -51,7 +51,9 @@
     enterpriseInfo:
       storageLocal().getItem<CusExtendDto>("enterpriseInfo") ?? {},
     nowRole: storageLocal().getItem<nowRoleType>("nowRole") ?? {},
-    rolesList: storageLocal().getItem<DataInfo<number>>("rolesList") ?? []
+    rolesList: storageLocal().getItem<DataInfo<number>>("rolesList") ?? [],
+    // 椤甸潰绾у埆鏉冮檺
+    roles: storageLocal().getItem<DataInfo<number>>(userKey)?.roles ?? []
   }),
   actions: {
     /** 瀛樺偍澶村儚 */
@@ -67,15 +69,19 @@
       this.nickname = nickname;
     },
     /** 瀛樺偍鐢ㄦ埛瑙掕壊 */
-    SET_ROLES(exRoles: Array<string>) {
+    SET_EXROLES(exRoles: Array<string>) {
       this.exRoles = exRoles;
+    },
+    /** 瀛樺偍瑙掕壊 */
+    SET_ROLES(roles: Array<string>) {
+      this.roles = roles;
     },
     /** 瀛樺偍瑙掕壊褰撳墠瑙掕壊 */
     SET_NOW_ROLE(nowRole: nowRoleType) {
       this.nowRole = nowRole;
     },
     /** 瀛樺偍瑙掕壊鍒楄〃 */
-    SET_ROLES_LIST(rolesList: Array<string>) {
+    SET_EXROLES_LIST(rolesList: Array<string>) {
       this.rolesList = rolesList;
     },
     /** 瀛樺偍鎸夐挳绾у埆鏉冮檺 */
@@ -100,6 +106,7 @@
         getLogin(obj)
           .then(data => {
             if (data?.code == 200) {
+              data.result.roles = [obj.exRuleCode];
               setToken(data.result);
               this.getNowRole(obj.exRuleCode);
             }
@@ -144,6 +151,7 @@
         getChangeLogoInExRule(obj)
           .then(async data => {
             if (data?.code == 200) {
+              data.result.roles = [obj.ruleCode];
               setToken(data.result);
               this.getNowRole(obj.ruleCode);
               await this.getCusExtendInfo();
@@ -174,6 +182,7 @@
     logOut() {
       this.username = "";
       this.exRoles = [];
+      this.roles = [];
       this.permissions = [];
       removeToken();
       useMultiTagsStoreHook().handleTags("equal", [...routerArrays]);

--
Gitblit v1.9.1