no message
Former-commit-id: 2fa068b68b43c3ff5fc6ba0be409f146c54bada9 Former-commit-id: 47a21c24b3293a94749b6d3dc7f64273e3c8a4e6 Former-commit-id: 70292108e4607f934f649e0e0ec824a67b14edc8
This commit is contained in:
@@ -31,7 +31,7 @@ Mock.mock('/login', 'post', ({url, type, body}) => {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
code: 500,
|
code: 401,
|
||||||
msg: '用户名或密码错误'
|
msg: '用户名或密码错误'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,6 +77,9 @@ export default {
|
|||||||
.then(res => {
|
.then(res => {
|
||||||
this.$log('登录结果', res)
|
this.$log('登录结果', res)
|
||||||
})
|
})
|
||||||
|
.catch(err => {
|
||||||
|
console.log(err)
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,17 @@
|
|||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
|
import { Message } from 'element-ui'
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
|
|
||||||
|
axios.interceptors.response.use(res => {
|
||||||
|
// 在这里对返回的数据进行处理
|
||||||
|
if (res.data.code !== 0) {
|
||||||
|
Message.error(res.data.msg)
|
||||||
|
return Promise.reject(res.data.msg)
|
||||||
|
} else {
|
||||||
|
return res.data.data
|
||||||
|
}
|
||||||
|
}, err => {
|
||||||
|
return Promise.reject(err)
|
||||||
|
})
|
||||||
|
|
||||||
Vue.prototype.$http = axios
|
Vue.prototype.$http = axios
|
||||||
|
|||||||
Reference in New Issue
Block a user