From 2b08f5948818994816b08dbe9ea9532286787e78 Mon Sep 17 00:00:00 2001 From: feige <791364011@qq.com> Date: 星期三, 21 五月 2025 21:33:10 +0800 Subject: [PATCH] 修改 --- ruoyi-ui/src/store/modules/user.js | 13 +++++++++++-- 1 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ruoyi-ui/src/store/modules/user.js b/ruoyi-ui/src/store/modules/user.js index 7428be4..ad92ec3 100644 --- a/ruoyi-ui/src/store/modules/user.js +++ b/ruoyi-ui/src/store/modules/user.js @@ -7,6 +7,7 @@ name: '', avatar: '', clanId: '', + userId: '', roles: [], permissions: [] }, @@ -18,6 +19,9 @@ SET_NAME: (state, name) => { state.name = name }, + SET_USERNAME: (state, uname) => { + state.userName = uname + }, SET_AVATAR: (state, avatar) => { state.avatar = avatar }, @@ -30,13 +34,16 @@ SET_CLANID: (state, clanId) => { state.clanId = clanId }, + SET_USERID: (state, userId) => { + state.userId = userId + }, }, actions: { // 鐧诲綍 Login({ commit }, userInfo) { - const username = userInfo.username.trim() + const nickname = userInfo.nickName.trim() const password = userInfo.password const code = userInfo.code @@ -44,7 +51,7 @@ const uuid = userInfo.uuid return new Promise((resolve, reject) => { - login(username, password, code, uuid).then(res => { + login(nickname, password, code, uuid).then(res => { setToken(res.data.token) @@ -74,8 +81,10 @@ } // console.log(res) // alert(res.user.clanId) + commit('SET_USERID', res.user.userId) commit('SET_CLANID', res.user.clanId) commit('SET_NAME', user.userName) + commit('SET_USERNAME', user.nickName) commit('SET_AVATAR', avatar) resolve(res) }).catch(error => { -- Gitblit v1.9.1