| | |
| | | getInfo() {
|
| | | return new Promise((resolve, reject) => {
|
| | | getInfo().then(res => {
|
| | | console.log('user',res)
|
| | | const user = res.user
|
| | | let avatar = user.avatar || ""
|
| | | if (!isHttp(avatar)) {
|
| | | avatar = (isEmpty(avatar)) ? defAva : import.meta.env.VITE_APP_BASE_API + 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
|
| | |
| | | this.id = user.userId
|
| | | this.name = user.userName
|
| | | this.avatar = avatar
|
| | | this.currentFactoryName = user.currentFactoryName
|
| | | this.nickName = user.nickName
|
| | | this.currentDeptId = user.tenantId
|
| | | resolve(res)
|
| | | }).catch(error => {
|
| | | reject(error)
|
| | |
| | | loginCheckFactory(userInfo) {
|
| | | const username = userInfo.username.trim()
|
| | | const password = userInfo.password
|
| | | const factoryId = userInfo.factoryId
|
| | | const factoryId = userInfo.currentFatoryId
|
| | | return new Promise((resolve, reject) => {
|
| | | loginCheckFactory(username, password, factoryId).then(res => {
|
| | | setToken(res.token)
|