请求处理
This commit is contained in:
@@ -11,12 +11,18 @@ axios.interceptors.request.use(function (config) {
|
||||
return Promise.reject(error);
|
||||
});
|
||||
|
||||
var showTimeOutTime = 0;
|
||||
// 添加响应拦截器
|
||||
axios.interceptors.response.use(function (response) {
|
||||
plus.nativeUI.closeWaiting();
|
||||
return response;
|
||||
}, function (error) {
|
||||
if (error.toString().indexOf('timeout') > -1) {
|
||||
plus.nativeUI.alert("请求超时");
|
||||
var curTime = new Date();
|
||||
if (curTime - showTimeOutTime > 5000) {
|
||||
plus.nativeUI.alert("请求超时");
|
||||
showTimeOutTime = new Date();
|
||||
}
|
||||
plus.nativeUI.closeWaiting();
|
||||
}else if(error=="Error: Network Error"){
|
||||
if(plus.webview.getWebviewById('error.html')==null){
|
||||
|
||||
Reference in New Issue
Block a user