YOUFANG1.0.3 app

This commit is contained in:
zongzhimin
2018-04-17 20:17:11 +08:00
parent 39689de0f2
commit 5fbafb8d1c
+25 -19
View File
@@ -14,26 +14,32 @@ axios.interceptors.request.use(function (config) {
var showTimeOutTime = 0; var showTimeOutTime = 0;
// 添加响应拦截器 // 添加响应拦截器
axios.interceptors.response.use(function (response) { axios.interceptors.response.use(function (response) {
plus.nativeUI.closeWaiting(); try {
plus.nativeUI.closeWaiting();
}catch(e){
}
return response; return response;
}, function (error) { }, function (error) {
if (error.toString().indexOf('timeout') > -1) { try {
var curTime = new Date(); if (error.toString().indexOf('timeout') > -1) {
if (curTime - showTimeOutTime > 5000) { var curTime = new Date();
plus.nativeUI.alert("请求超时"); if (curTime - showTimeOutTime > 5000) {
showTimeOutTime = new Date(); plus.nativeUI.alert("请求超时");
} showTimeOutTime = new Date();
plus.nativeUI.closeWaiting(); }
}else if(error=="Error: Network Error"){ plus.nativeUI.closeWaiting();
if(plus.webview.getWebviewById('error.html')==null){ }else if(error=="Error: Network Error"){
clicked('error.html',true,false,{},{},function(){ if(plus.webview.getWebviewById('error.html')==null){
window.location.reload(); clicked('error.html',true,false,{},{},function(){
}) window.location.reload();
}else{ })
$(".loadingBg").hide(); }else{
plus.nativeUI.closeWaiting(); $(".loadingBg").hide();
plus.webview.getWebviewById("error.html").show(); plus.nativeUI.closeWaiting();
} plus.webview.getWebviewById("error.html").show();
} }
}
}catch(e){}
return Promise.reject(error); return Promise.reject(error);
}); });