From e7a44b64dceb984b0bb243bfdcae73edb099e5f1 Mon Sep 17 00:00:00 2001 From: zhangxiao <898441624@qq.com> Date: 星期一, 26 八月 2024 21:04:49 +0800 Subject: [PATCH] agent --- src/store/modules/user/index.ts | 14 ++++++++------ 1 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/store/modules/user/index.ts b/src/store/modules/user/index.ts index 7bb51c3..56d90b8 100644 --- a/src/store/modules/user/index.ts +++ b/src/store/modules/user/index.ts @@ -71,17 +71,19 @@ const res = await userLogin(loginForm); setToken(res.data.access_token); + const userInfo = { avatar: res.data.avatar, - name: res.data.nickname, + name: res.data.userName, email: res.data.email, + role: res.data.roles[0].roleKey, }; - if(res.data.roles && res.data.roles.length>0) + this.name=res.data.userName + + if(res.data?.roles.length>0) this.resources=res.data.roles[0].resources; - else - this.resources=res.data.resources; - setUserInfo(JSON.stringify(userInfo)); - setUserResources(JSON.stringify(this.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