From b46065a201c09ce69f111806f2bda4a5f476bc4e Mon Sep 17 00:00:00 2001
From: wlzboy <66905212@qq.com>
Date: 星期六, 18 十月 2025 17:20:22 +0800
Subject: [PATCH] fix:用户同步,机构同步
---
app/store/modules/user.js | 17 ++++++++++++++++-
1 files changed, 16 insertions(+), 1 deletions(-)
diff --git a/app/store/modules/user.js b/app/store/modules/user.js
index 79e8b98..cf7c109 100644
--- a/app/store/modules/user.js
+++ b/app/store/modules/user.js
@@ -10,15 +10,21 @@
const user = {
state: {
token: getToken(),
+ userId: storage.get(constant.userId),
name: storage.get(constant.name),
avatar: storage.get(constant.avatar),
roles: storage.get(constant.roles),
- permissions: storage.get(constant.permissions)
+ permissions: storage.get(constant.permissions),
+ deptId: storage.get(constant.deptId)
},
mutations: {
SET_TOKEN: (state, token) => {
state.token = token
+ },
+ SET_USER_ID: (state, userId) => {
+ state.userId = userId
+ storage.set(constant.userId, userId)
},
SET_NAME: (state, name) => {
state.name = name
@@ -35,6 +41,10 @@
SET_PERMISSIONS: (state, permissions) => {
state.permissions = permissions
storage.set(constant.permissions, permissions)
+ },
+ SET_DEPT_ID: (state, deptId) => {
+ state.deptId = deptId
+ storage.set(constant.deptId, deptId)
}
},
@@ -76,14 +86,19 @@
const user = res.user
const avatar = (user == null || user.avatar == "" || user.avatar == null) ? require("@/static/images/profile.jpg") : baseUrl + user.avatar
const username = (user == null || user.userName == "" || user.userName == null) ? "" : user.userName
+ const userId = (user == null || user.userId == null) ? null : user.userId
+ const deptId = (user == null || user.deptId == null) ? null : user.deptId
+
if (res.roles && res.roles.length > 0) {
commit('SET_ROLES', res.roles)
commit('SET_PERMISSIONS', res.permissions)
} else {
commit('SET_ROLES', ['ROLE_DEFAULT'])
}
+ commit('SET_USER_ID', userId)
commit('SET_NAME', username)
commit('SET_AVATAR', avatar)
+ commit('SET_DEPT_ID', deptId)
resolve(res)
}).catch(error => {
reject(error)
--
Gitblit v1.9.1