浏览代码

请求超时时长设置为30s

tags/2.2.9
海洋之声 6 年前
父节点
当前提交
81a46b9a5e
共有 2 个文件被更改,包括 9 次插入7 次删除
  1. +1
    -1
      app.json
  2. +8
    -6
      pages/index/index.js

+ 1
- 1
app.json 查看文件

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

+ 8
- 6
pages/index/index.js 查看文件

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


正在加载...
取消
保存