feat:看板强制登出功能
This commit is contained in:
@@ -109,8 +109,42 @@ export default {
|
||||
this.show = false
|
||||
this.disabled = false
|
||||
this.$router.push('/produceScreen/1')
|
||||
}).catch(() => {
|
||||
}).catch(error => {
|
||||
this.disabled = false
|
||||
// 尝试从多个位置获取错误信息
|
||||
let errorMsg = ''
|
||||
if (error.response && error.response.data) {
|
||||
if (error.response.data.msg) {
|
||||
errorMsg = error.response.data.msg
|
||||
} else if (error.response.data.message) {
|
||||
errorMsg = error.response.data.message
|
||||
} else if (error.response.data.error) {
|
||||
errorMsg = error.response.data.error
|
||||
}
|
||||
} else if (error.message) {
|
||||
errorMsg = error.message
|
||||
}
|
||||
console.log('Extracted error message:', errorMsg)
|
||||
if (errorMsg === '当前设备工序已经登陆,无法继续选择') {
|
||||
this.$confirm('用户当前设备工序已经登陆,是否强制登出?', '确认操作', {
|
||||
confirmButtonText: '是',
|
||||
cancelButtonText: '否',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
// 用户确认,强制登出并重新登录
|
||||
crudProduceScreen.deviceInLogin({ device_code: this.value, force_logout: true }).then(res => {
|
||||
res.username = this.username
|
||||
this.$store.dispatch('addScreenData', JSON.stringify(res))
|
||||
this.show = false
|
||||
this.disabled = false
|
||||
this.$router.push('/produceScreen/1')
|
||||
}).catch(() => {
|
||||
// 强制登出登录失败
|
||||
})
|
||||
}).catch(() => {
|
||||
// 用户取消,不做任何操作
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user