gaoluyang
5 天以前 c7566bba45e6f90594d36ec4b80ac4ff89f577ee
src/store/modules/user.js
@@ -15,6 +15,8 @@
      id: '',
      name: '',
      nickName: '',
      nameEn: '',
      userName: '',
      avatar: '',
      roles: [],
      permissions: []
@@ -24,10 +26,8 @@
      login(userInfo) {
        const username = userInfo.username.trim()
        const password = userInfo.password
        const code = userInfo.code
        const uuid = userInfo.uuid
        return new Promise((resolve, reject) => {
          login(username, password, code, uuid).then(res => {
          login(username, password).then(res => {
            setToken(res.token)
            this.token = res.token
            useLockStore().unlockScreen()
@@ -55,6 +55,8 @@
            this.id = user.userId
            this.name = user.userName
            this.nickName = user.nickName
            this.nameEn = user.nameEn
            this.userName = user.userName
            this.avatar = avatar
            cache.session.set('pwrChrtype', res.pwdChrtype)
            /* 初始密码提示 */
@@ -78,12 +80,18 @@
      // 退出系统
      logOut() {
        return new Promise((resolve, reject) => {
          logout(this.token).then(() => {
            this.token = ''
            this.roles = []
            this.permissions = []
            removeToken()
            resolve()
          logout(this.token).then((res) => {
            // 业务定制:后端返回跳转地址时走统一认证登出(如 SSO 单点退出),
            // 返回空则按常规前端登出处理
            if (res.data) {
              window.location.href = res.data
            } else {
              this.token = ''
              this.roles = []
              this.permissions = []
              removeToken()
              resolve()
            }
          }).catch(error => {
            reject(error)
          })