From ae77c823047bd4adb3d6bd3fcde4261ecb481d29 Mon Sep 17 00:00:00 2001
From: RuoYi <yzz_ivy@163.com>
Date: Mon, 04 Dec 2023 16:45:53 +0800
Subject: [PATCH] update ry_config.sql
---
ruoyi-ui/src/store/modules/user.js | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/ruoyi-ui/src/store/modules/user.js b/ruoyi-ui/src/store/modules/user.js
index 84fd997..7c9b0c7 100644
--- a/ruoyi-ui/src/store/modules/user.js
+++ b/ruoyi-ui/src/store/modules/user.js
@@ -4,6 +4,7 @@
const user = {
state: {
token: getToken(),
+ id: '',
name: '',
avatar: '',
roles: [],
@@ -16,6 +17,9 @@
},
SET_EXPIRES_IN: (state, time) => {
state.expires_in = time
+ },
+ SET_ID: (state, id) => {
+ state.id = id
},
SET_NAME: (state, name) => {
state.name = name
@@ -55,15 +59,16 @@
// 获取用户信息
GetInfo({ commit, state }) {
return new Promise((resolve, reject) => {
- getInfo(state.token).then(res => {
+ getInfo().then(res => {
const user = res.user
- const avatar = user.avatar == "" ? require("@/assets/image/profile.jpg") : user.avatar;
+ const avatar = (user.avatar == "" || user.avatar == null) ? require("@/assets/images/profile.jpg") : user.avatar;
if (res.roles && res.roles.length > 0) { // 验证返回的roles是否是一个非空数组
commit('SET_ROLES', res.roles)
commit('SET_PERMISSIONS', res.permissions)
} else {
commit('SET_ROLES', ['ROLE_DEFAULT'])
}
+ commit('SET_ID', user.userId)
commit('SET_NAME', user.userName)
commit('SET_AVATAR', avatar)
resolve(res)
--
Gitblit v1.9.3