| | |
| | | id: '', |
| | | name: '', |
| | | nickName: '', |
| | | nameEn: '', |
| | | userName: '', |
| | | avatar: '', |
| | | roles: [], |
| | | permissions: [] |
| | |
| | | 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() |
| | |
| | | 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) |
| | | /* 初始密码提示 */ |
| | |
| | | // 退出系统 |
| | | logOut() { |
| | | return new Promise((resolve, reject) => { |
| | | logout(this.token).then(() => { |
| | | 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) |
| | | }) |