Przeglądaj źródła

请求超时时长设置为30s

tags/2.2.9
海洋之声 6 lat temu
rodzic
commit
81a46b9a5e
2 zmienionych plików z 9 dodań i 7 usunięć
  1. +1
    -1
      app.json
  2. +8
    -6
      pages/index/index.js

+ 1
- 1
app.json Wyświetl plik

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

+ 8
- 6
pages/index/index.js Wyświetl plik

@@ -113,10 +113,12 @@ Page({
}) })
.catch(err => { .catch(err => {
console.log(err); console.log(err);
that.setData({
loading: false,
loadingtext: "网络异常,请检查您的网络设置"
})
if (err.errMsg == '请求超时,请检查您的网络设置!') {
that.setData({
loading: false,
loadingtext: "请求超时,请检查您的网络设置!"
})
}
wx.showToast({ wx.showToast({
title: err.errMsg, title: err.errMsg,
icon: 'none', icon: 'none',
@@ -237,10 +239,10 @@ Page({
}) })
.catch(err => { .catch(err => {
console.log(err); console.log(err);
if(err.errMsg=='request:fail timeout'){
if (err.errMsg =='请求超时,请检查您的网络设置!'){
that.setData({ that.setData({
loading:false, loading:false,
loadingtext:"网络异常,请检查您的网络设置"
loadingtext:"请求超时,请检查您的网络设置!"
}) })
} }
if (err.code == 11004) { if (err.code == 11004) {


Ładowanie…
Anuluj
Zapisz