From dfb7a8a63e87390dc095e81b04f0404697246d9f Mon Sep 17 00:00:00 2001
From: 张涛 <“2538313560@qq.com”>
Date: 星期五, 22 十一月 2024 20:20:56 +0800
Subject: [PATCH] 增加跳转的接口

---
 src/store/modules/user/index.ts |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/src/store/modules/user/index.ts b/src/store/modules/user/index.ts
index e7ae4eb..22143e5 100644
--- a/src/store/modules/user/index.ts
+++ b/src/store/modules/user/index.ts
@@ -71,17 +71,28 @@
         const res = await userLogin(loginForm);
 
         setToken(res.data.access_token);
+       
         const userInfo = {
           avatar: res.data.avatar,
-          name: res.data.nickname,
+          name: res.data.loginName,
           email: res.data.email,
+          role: res.data.roles[0].roleKey,
         };
-        if(res.data.roles && res.data.roles.length>0)
-            this.resources=res.data.roles[0].resources;
+        this.name=res.data.userName
+     
+        if(res.data?.roles.length>0)
+          //閬嶅巻roles
+          for (const r of res.data.roles) {
+            if (!(this.resources)) {
+              this.resources = [];
+            }
+            this.resources = this.resources.concat(r.resources);
+          }
             setUserInfo(JSON.stringify(userInfo));
             setUserResources(JSON.stringify(this.resources))
         for (const r of this.resources) {
           if (r.menuType == 0) {
+            
             return r.component
           }
         }

--
Gitblit v1.8.0