feige
2024-08-21 f81e83fca9cfca4d5149450433d9650b9dd59197
ruoyi-ui/src/store/modules/user.js
@@ -6,6 +6,7 @@
    token: getToken(),
    name: '',
    avatar: '',
   clanId: '',
    roles: [],
    permissions: []
  },
@@ -25,7 +26,10 @@
    },
    SET_PERMISSIONS: (state, permissions) => {
      state.permissions = permissions
    }
    },
   SET_CLANID: (state, clanId) => {
     state.clanId = clanId
   },
  },
  actions: {
@@ -63,9 +67,14 @@
          if (res.roles && res.roles.length > 0) { // 验证返回的roles是否是一个非空数组
            commit('SET_ROLES', res.roles)
            commit('SET_PERMISSIONS', res.permissions)
          } else {
            commit('SET_ROLES', ['ROLE_DEFAULT'])
          }
       // console.log(res)
       // alert(res.user.clanId)
           commit('SET_CLANID', res.user.clanId)
          commit('SET_NAME', user.userName)
          commit('SET_AVATAR', avatar)
          resolve(res)