CN-1289 fix: 修复登录失败错误提示问题
This commit is contained in:
@@ -86,21 +86,17 @@ export default {
|
||||
localStorage.setItem(storageKey.userId, res.data.data.user.id)
|
||||
localStorage.setItem(storageKey.token, res.data.data.token)
|
||||
this.$i18n.locale = localStorage.getItem(storageKey.language)
|
||||
} else if (res.data.code === 518005) {
|
||||
this.$message.error(this.$t('Incorrect username or password'))
|
||||
this.loading = false
|
||||
this.blockOperation.query = false
|
||||
} else {
|
||||
this.$message.error('Unknown error')
|
||||
this.loading = false
|
||||
this.blockOperation.query = false
|
||||
}
|
||||
}
|
||||
).catch(e => {
|
||||
console.error(e)
|
||||
this.loading = false
|
||||
this.blockOperation.query = false
|
||||
this.$message.error(this.errorMsgHandler(e))
|
||||
if (_.get(e, 'response.data.code', 0) === 518005) {
|
||||
this.$message.error(this.$t('Incorrect username or password'))
|
||||
} else {
|
||||
this.$message.error(this.errorMsgHandler(e))
|
||||
}
|
||||
})
|
||||
},
|
||||
queryAppearance () {
|
||||
|
||||
@@ -266,8 +266,13 @@ export default {
|
||||
}
|
||||
}).catch((err) => {
|
||||
this.blockOperation.save = false
|
||||
let errMsg = err.response ? err.response : (err.message ? err.message : err.toString())
|
||||
this.$message.error(_.get(errMsg, 'data.message', []))
|
||||
if (_.get(err, 'response.data.code') === 511036) {
|
||||
// TODO 改成国际化
|
||||
this.$message.error('This login name is already in use')
|
||||
} else {
|
||||
const errMsg = err.response ? err.response : (err.message ? err.message : err.toString())
|
||||
this.$message.error(_.get(errMsg, 'data.message', []))
|
||||
}
|
||||
})
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -108,7 +108,6 @@ export default {
|
||||
changeStatus (status, id) {
|
||||
if (id) {
|
||||
axios.patch(api.knowledgeBaseEnable, { list: [{ knowledgeId: id, status: status }] }).then(response => {
|
||||
console.info(response)
|
||||
if (response.status === 200) {
|
||||
this.$message({ duration: 1000, type: 'success', message: this.$t('tip.saveSuccess') })
|
||||
} else {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import axios from 'axios'
|
||||
import { storageKey } from '@/utils/constants'
|
||||
import store from '@/store'
|
||||
import _ from 'lodash'
|
||||
|
||||
const CancelToken = axios.CancelToken
|
||||
|
||||
@@ -59,23 +60,18 @@ axios.interceptors.request.use(
|
||||
)
|
||||
axios.interceptors.response.use(
|
||||
response => {
|
||||
if (licenceErrorCode.indexOf(response.data.code) !== -1) {
|
||||
localStorage.removeItem(storageKey.token)
|
||||
window.location.href = '/'
|
||||
} else if (accountErrorCode.indexOf(response.data.code) !== -1) {
|
||||
localStorage.removeItem(storageKey.token)
|
||||
window.location.href = '/'
|
||||
}
|
||||
return response
|
||||
},
|
||||
error => {
|
||||
try {
|
||||
if (error.response && licenceErrorCode.indexOf(error.response.data.code) !== -1) {
|
||||
localStorage.removeItem(storageKey.token)
|
||||
window.location.href = '/'
|
||||
} else if (error.response && accountErrorCode.indexOf(error.response.data.code) !== -1) {
|
||||
localStorage.removeItem(storageKey.token)
|
||||
window.location.href = '/'
|
||||
if (_.get(error, 'response.config.url') !== '/sys/login') {
|
||||
if (error.response && licenceErrorCode.indexOf(error.response.data.code) !== -1) {
|
||||
localStorage.removeItem(storageKey.token)
|
||||
window.location.href = '/'
|
||||
} else if (error.response && accountErrorCode.indexOf(error.response.data.code) !== -1) {
|
||||
localStorage.removeItem(storageKey.token)
|
||||
window.location.href = '/'
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
|
||||
@@ -1073,7 +1073,6 @@ export default {
|
||||
if (n) {
|
||||
if (n.undo.length > 0) {
|
||||
document.getElementById('preStep').classList.remove('toolbar--unactivated')
|
||||
console.info(n, document.getElementById('preStep').classList)
|
||||
} else {
|
||||
document.getElementById('preStep').classList.add('toolbar--unactivated')
|
||||
}
|
||||
|
||||
@@ -298,7 +298,6 @@ export default {
|
||||
axios.get(`${this.url}/${u.id}`).then(response => {
|
||||
if (response.status === 200) {
|
||||
this.object = response.data.data.list[0]
|
||||
console.info(this.object)
|
||||
}
|
||||
}).catch(e => {
|
||||
console.error(e)
|
||||
|
||||
Reference in New Issue
Block a user