Browse Source

网络超时加载优化01

tags/2.2.9
海洋之声 6 years ago
parent
commit
441136ff37
3 changed files with 9 additions and 3 deletions
  1. +1
    -1
      app.json
  2. +7
    -0
      pages/index/index.js
  3. +1
    -2
      utils/HttpBasics.js

+ 1
- 1
app.json View File

@@ -65,7 +65,7 @@
"navigationBarTextStyle": "white" "navigationBarTextStyle": "white"
}, },
"networkTimeout": { "networkTimeout": {
"request": 10000,
"request": 1000,
"downloadFile": 10000 "downloadFile": 10000
}, },
"debug": false "debug": false

+ 7
- 0
pages/index/index.js View File

@@ -111,6 +111,13 @@ Page({
title: weapNote.firstpage.title title: weapNote.firstpage.title
}) })
}) })
.catch(err => {
console.log(err);
that.setData({
loading: false,
loadingtext: "网络异常,请检查您的网络设置"
})
});
}, },
onShow:function(){ onShow:function(){
this.setData({ this.setData({


+ 1
- 2
utils/HttpBasics.js View File

@@ -50,8 +50,7 @@ class HttpBasics {
fail: err => { fail: err => {
// wx.hideLoading(); // wx.hideLoading();
reject(err); reject(err);
},
complete: res => {}
}
}); });
}); });
} }


Loading…
Cancel
Save