This commit is contained in:
尹吉欢
2018-04-18 14:52:45 +08:00
parent a5f94b084e
commit ce0d47eaa2
2 changed files with 4 additions and 12 deletions
+1 -9
View File
@@ -11,7 +11,6 @@ axios.interceptors.request.use(function (config) {
return Promise.reject(error);
});
var showTimeOutTime = 0;
// 添加响应拦截器
axios.interceptors.response.use(function (response) {
try {
@@ -22,14 +21,7 @@ axios.interceptors.response.use(function (response) {
return response;
}, function (error) {
try {
if (error.toString().indexOf('timeout') > -1) {
var curTime = new Date();
if (curTime - showTimeOutTime > 5000) {
plus.nativeUI.alert("请求超时");
showTimeOutTime = new Date();
}
plus.nativeUI.closeWaiting();
}else if(error=="Error: Network Error"){
if(error=="Error: Network Error" || error.toString().indexOf('timeout') > -1){
if(plus.webview.getWebviewById('error.html')==null){
clicked('error.html',true,false,{},{},function(){
window.location.reload();