feige
2025-04-15 02950a964bb0dcc202bd1f4ddd6c6fc4a92c8048
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 => {