spring
2 天以前 261f2ed00235d47df3754291a4fdca9ba5cb8e7a
src/store/modules/user.js
@@ -52,13 +52,13 @@
      getInfo() {
        return new Promise((resolve, reject) => {
          getInfo().then(res => {
            res  = res.data
            const user = res.user || {}
            const data = res?.data ?? res
            const user = data.user || {}
            let avatar = user.avatar || ""
            avatar = import.meta.env.VITE_APP_BASE_API + '/profile/' + avatar
            if (res.roles && res.roles.length > 0) { // 验证返回的roles是否是一个非空数组
              this.roles = res.roles
              this.permissions = res.permissions
            if (data.roles && data.roles.length > 0) { // 验证返回的roles是否是一个非空数组
              this.roles = data.roles
              this.permissions = data.permissions
            } else {
              this.roles = ['ROLE_DEFAULT']
            }
@@ -70,8 +70,8 @@
            this.roleName = Array.isArray(user.roles) && user.roles.length > 0 ? (user.roles[0].roleName || '') : ''
            this.currentDeptId = user.tenantId || ''
            this.currentLoginTime = this.getCurrentTime()
            this.aiEnabled = Number(res.aiEnabled) === 1 ? 1 : 0
            resolve(res)
            this.aiEnabled = Number(data.aiEnabled) === 1 ? 1 : 0
            resolve(data)
          }).catch(error => {
            reject(error)
          })