|
@@ -33,6 +33,9 @@ service.interceptors.response.use(
|
|
//if(LoadingInstance){LoadingInstance.clear();}
|
|
//if(LoadingInstance){LoadingInstance.clear();}
|
|
if (res.status !== 200) {
|
|
if (res.status !== 200) {
|
|
//Toast('数据返回出错');
|
|
//Toast('数据返回出错');
|
|
|
|
+ if (res.status == 401) {
|
|
|
|
+ location.href = location.href.split('#')[0];
|
|
|
|
+ }
|
|
return Promise.reject('响应非200!');
|
|
return Promise.reject('响应非200!');
|
|
} else {
|
|
} else {
|
|
if (res.data.code != 0) {
|
|
if (res.data.code != 0) {
|
|
@@ -51,9 +54,11 @@ service.interceptors.response.use(
|
|
error => {
|
|
error => {
|
|
//if(LoadingInstance){LoadingInstance.clear();}
|
|
//if(LoadingInstance){LoadingInstance.clear();}
|
|
//Toast("网络错误");
|
|
//Toast("网络错误");
|
|
- if (/403/.test(error.toString()))
|
|
|
|
- window.parent ? (window.parent.location.href = '/') : (location.href = '/');
|
|
|
|
-
|
|
|
|
|
|
+ // if (/403/.test(error.toString()) || /401/.test(error.toString()))
|
|
|
|
+ // window.parent ? (window.parent.location.href = '/') : (location.href = '/');
|
|
|
|
+ const url = window.parent ? window.parent.location.href : location.href;
|
|
|
|
+ if (/403/.test(error.toString()) || /401/.test(error.toString()))
|
|
|
|
+ window.parent ? window.parent.location.href = url.split('#')[0] : location.href = url.split('#')[0];
|
|
return Promise.reject(error);
|
|
return Promise.reject(error);
|
|
}
|
|
}
|
|
);
|
|
);
|