|
@@ -69,15 +69,17 @@ export function requestData (options) {
|
|
|
if (options.showLoading) {
|
|
|
store.state.loading = false;
|
|
|
}
|
|
|
- if (response.code === 200) {
|
|
|
- options.success && options.success(resolve(response));
|
|
|
- } else {
|
|
|
+ if (response.code === 501) { // 用户类请求错误code (账号密码错误、用户锁定、token过期等)
|
|
|
localStorage.removeItem('authToken');
|
|
|
- Message.error((response.data && response.data.msg) || ("请求出错[" + response.data.code + "]"));
|
|
|
+ Message.error(response.data.msg);
|
|
|
setTimeout(() => {
|
|
|
- // window.location.reload();
|
|
|
+ window.location.reload();
|
|
|
// window.__STATICVUE__.$router.replace('/login');
|
|
|
}, 1000);
|
|
|
+ } else if (response.code === 200) { // 请求成功 code
|
|
|
+ options.success && options.success(resolve(response));
|
|
|
+ } else { // 其他code
|
|
|
+ Message.error((response.data && response.data.msg) || ("请求出错[" + response.data.code + "]"));
|
|
|
}
|
|
|
}).catch(error => {
|
|
|
if (options.showLoading) {
|