From 31a48e3a3c7d4e37a05ef43fa4b65c84989cc353 Mon Sep 17 00:00:00 2001 From: yinbangzhong <zhongbangyin@126.com> Date: 星期四, 29 八月 2024 09:26:25 +0800 Subject: [PATCH] select role --- src/store/modules/user/index.ts | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/store/modules/user/index.ts b/src/store/modules/user/index.ts index e7ae4eb..56d90b8 100644 --- a/src/store/modules/user/index.ts +++ b/src/store/modules/user/index.ts @@ -71,12 +71,16 @@ 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; setUserInfo(JSON.stringify(userInfo)); setUserResources(JSON.stringify(this.resources)) -- Gitblit v1.8.0