From ea02e5a43bec977729c919fee1e524f55ac2e834 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B5=B7=E6=B4=8B=E4=B9=8B=E5=A3=B0?= Date: Thu, 1 Nov 2018 11:37:18 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BD=91=E7=BB=9C=E8=B6=85=E6=97=B6=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.json | 2 +- components/gameentry/gentry.js | 4 +- components/questionnaire/questionnaire.js | 8 +++ pages/bannerdetail/index.js | 9 ++- pages/coupon/detail/index.js | 36 ++++++++-- pages/couponorder/detail/index.js | 26 ++++++- pages/couponorder/index/index.js | 10 ++- pages/edit/edit.js | 32 +++++---- pages/getphoneInfo/index.js | 20 +++++- pages/getuserinfo/index.js | 20 +++++- pages/index/coupons/index.js | 20 +++++- pages/index/index.js | 27 ++++--- pages/index/rushToBuy/index.js | 10 ++- pages/login/index.js | 7 ++ .../managelicenseplate/managelicenseplate.js | 8 +++ pages/order/detail/index.js | 29 ++++++-- pages/order/index/index.js | 10 ++- pages/orderquanma/index.js | 20 +++++- pages/passCar/choicecoupon/choicecoupon.js | 10 ++- pages/passCar/couponDetail/couponDetail.js | 10 ++- pages/passCar/couponList/couponList.js | 15 ++-- pages/passCar/passCar.js | 70 +++++++++++++++++-- pages/phoneinput/phoneinput.js | 18 +++-- pages/rushToBuy/index.js | 10 ++- pages/user/index.js | 10 ++- utils/HttpBasics.js | 8 +++ 26 files changed, 379 insertions(+), 70 deletions(-) diff --git a/app.json b/app.json index 13261ff..76230e0 100644 --- a/app.json +++ b/app.json @@ -65,7 +65,7 @@ "navigationBarTextStyle": "white" }, "networkTimeout": { - "request": 1000, + "request": 100, "downloadFile": 10000 }, "debug": false diff --git a/components/gameentry/gentry.js b/components/gameentry/gentry.js index a16efb9..ecfcca1 100644 --- a/components/gameentry/gentry.js +++ b/components/gameentry/gentry.js @@ -52,8 +52,8 @@ Component({ }); }else { wx.showToast({ - title: err.message, - image: "../../assets/img/fail.png", + title: err.errMsg, + icon: 'none', duration: 2000, mask: false }); diff --git a/components/questionnaire/questionnaire.js b/components/questionnaire/questionnaire.js index f79b50b..45c02cb 100644 --- a/components/questionnaire/questionnaire.js +++ b/components/questionnaire/questionnaire.js @@ -60,6 +60,14 @@ Component({ this.alphaClick(); this.queueClick(); }) + .catch(err => { + wx.showToast({ + title: err.errMsg, + icon: 'none', + duration: 2000, + mask: false + }); + }) // 子组件向父组件传值 // 传值到 coupon=>detail页面 var myEvent1 = "questions2"; diff --git a/pages/bannerdetail/index.js b/pages/bannerdetail/index.js index 9299dea..8c167ba 100644 --- a/pages/bannerdetail/index.js +++ b/pages/bannerdetail/index.js @@ -25,7 +25,14 @@ Page({ data: res.data }); console.log(that.data.data); - }); + }).catch(err => { + wx.showToast({ + title: err.errMsg, + icon: 'none', + duration: 2000, + mask: false + }); + }) }, gotoactdetail:function(){ let that = this; diff --git a/pages/coupon/detail/index.js b/pages/coupon/detail/index.js index ff50a99..b23c8ff 100644 --- a/pages/coupon/detail/index.js +++ b/pages/coupon/detail/index.js @@ -95,8 +95,13 @@ Page({ console.log(that.data.questionnaire); } }) - .catch(error=>{ - console.log(error) + .catch(err => { + wx.showToast({ + title: err.message, + image: "../../../assets/img/fail.png", + duration: 2000, + mask: false + }); }) } }, @@ -197,7 +202,14 @@ Page({ validDays: res.data.validDays }); } - }); + }).catch(err => { + wx.showToast({ + title: err.message, + image: "../../../assets/img/fail.png", + duration: 2000, + mask: false + }); + }) }, /** * 支付订单更新 @@ -217,8 +229,13 @@ Page({ console.log("payOrderUpdate then", res); }) .catch(err => { - console.log("payOrderUpdate catch", err); - }); + wx.showToast({ + title: err.message, + image: "../../../assets/img/fail.png", + duration: 2000, + mask: false + }); + }) }, /** * 发起支付 @@ -447,8 +464,13 @@ Page({ } }) .catch(err => { - console.log("ERR", err); - }); + wx.showToast({ + title: err.errMsg, + icon: 'none', + duration: 2000, + mask: false + }); + }) } }, onShareAppMessage: function (options) { diff --git a/pages/couponorder/detail/index.js b/pages/couponorder/detail/index.js index d040255..81bc47f 100644 --- a/pages/couponorder/detail/index.js +++ b/pages/couponorder/detail/index.js @@ -50,6 +50,14 @@ Page({ staticGamedata: res.data }) }) + .catch(err => { + wx.showToast({ + title: err.errMsg, + icon: 'none', + duration: 2000, + mask: false + }); + }) }, onLoad: function(options) { let that = this; @@ -101,7 +109,15 @@ Page({ updateDate: util.formatTime(that.data.data.updateDate, "yyyy-MM-dd hh:mm:ss"), createDate: util.formatTime(that.data.data.createDate, "yyyy-MM-dd hh:mm:ss") }); - }); + }) + .catch(err => { + wx.showToast({ + title: err.errMsg, + icon: 'none', + duration: 2000, + mask: false + }); + }) } }, 2000); @@ -127,6 +143,14 @@ Page({ util.barcode("barcode", options.quancode, 510, 100); util.qrcode("qrcode", options.quancode, 350, 350); }) + .catch(err => { + wx.showToast({ + title: err.errMsg, + icon: 'none', + duration: 2000, + mask: false + }); + }) }, phone: function() { let that = this; diff --git a/pages/couponorder/index/index.js b/pages/couponorder/index/index.js index 9dde69c..c0aeee5 100644 --- a/pages/couponorder/index/index.js +++ b/pages/couponorder/index/index.js @@ -102,7 +102,15 @@ Page({ that.setData({ list: tmpArr }) - }); + }) + .catch(err => { + wx.showToast({ + title: err.errMsg, + icon: 'none', + duration: 2000, + mask: false + }); + }) } else { that.setData({ loading: true, diff --git a/pages/edit/edit.js b/pages/edit/edit.js index 4773610..99cb6ed 100644 --- a/pages/edit/edit.js +++ b/pages/edit/edit.js @@ -118,19 +118,27 @@ Page({ birthdate: birthdate, } }) - .then(res => { - console.log(res); - wx.showModal({ - title: '提示', - content: '修改成功', - showCancel: false, - success: function (res) { - wx.switchTab({ - url: '/pages/user/index', - }) - } - }) + .then(res => { + console.log(res); + wx.showModal({ + title: '提示', + content: '修改成功', + showCancel: false, + success: function (res) { + wx.switchTab({ + url: '/pages/user/index', + }) + } }) + }) + .catch(err => { + wx.showToast({ + title: err.errMsg, + icon: 'none', + duration: 2000, + mask: false + }); + }) } }, radioChange: function (e) { diff --git a/pages/getphoneInfo/index.js b/pages/getphoneInfo/index.js index c1edabc..fdace69 100755 --- a/pages/getphoneInfo/index.js +++ b/pages/getphoneInfo/index.js @@ -39,7 +39,15 @@ Page({ wx.setNavigationBarTitle({ title: res.data.mallName }) - }); + }) + .catch(err => { + wx.showToast({ + title: err.message, + image: "../../assets/img/fail.png", + duration: 2000, + mask: false + }); + }) }, getPhoneNumber: function (e) { @@ -92,6 +100,14 @@ Page({ icon: "none" }); } - ); + ) + .catch(err => { + wx.showToast({ + title: err.errMsg, + icon: 'none', + duration: 2000, + mask: false + }); + }) } }); \ No newline at end of file diff --git a/pages/getuserinfo/index.js b/pages/getuserinfo/index.js index 77880d7..cfc115a 100755 --- a/pages/getuserinfo/index.js +++ b/pages/getuserinfo/index.js @@ -24,7 +24,15 @@ Page({ wx.setNavigationBarTitle({ title: res.data.mallName }) - }); + }) + .catch(err => { + wx.showToast({ + title: err.message, + image: "../../assets/img/fail.png", + duration: 2000, + mask: false + }); + }) }, bindGetUserInfo: function(e) { @@ -61,6 +69,14 @@ Page({ icon: "none" }); } - ); + ) + .catch(err => { + wx.showToast({ + title: err.errMsg, + icon: 'none', + duration: 2000, + mask: false + }); + }) } }); diff --git a/pages/index/coupons/index.js b/pages/index/coupons/index.js index e0962b7..7c32c4d 100644 --- a/pages/index/coupons/index.js +++ b/pages/index/coupons/index.js @@ -134,7 +134,15 @@ Component({ }) console.log(tmpArr); - }); + }) + .catch(err => { + wx.showToast({ + title: err.message, + image: "../../../assets/img/fail.png", + duration: 2000, + mask: false + }); + }) setTimeout(function () { that.setData({ loading: false, @@ -175,7 +183,15 @@ Component({ that.setData({ tabs: res.data.list }); - }); + }) + .catch(err => { + wx.showToast({ + title: err.errMsg, + icon: 'none', + duration: 2000, + mask: false + }); + }) }; if (app.globalData.token && app.globalData.token != null) { app.businessListCallback(app.globalData.token); diff --git a/pages/index/index.js b/pages/index/index.js index 3bc2a3e..a88e3d6 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -111,13 +111,19 @@ Page({ title: weapNote.firstpage.title }) }) - .catch(err => { - console.log(err); - that.setData({ - loading: false, - loadingtext: "网络异常,请检查您的网络设置" - }) + .catch(err => { + console.log(err); + that.setData({ + loading: false, + loadingtext: "网络异常,请检查您的网络设置" + }) + wx.showToast({ + title: err.errMsg, + icon: 'none', + duration: 2000, + mask: false }); + }); }, onShow:function(){ this.setData({ @@ -232,12 +238,10 @@ Page({ .catch(err => { console.log(err); if(err.errMsg=='request:fail timeout'){ - setTimeout(function(){ that.setData({ loading:false, loadingtext:"网络异常,请检查您的网络设置" }) - },3000) } if (err.code == 11004) { // 用户昵称未授权 @@ -245,6 +249,13 @@ Page({ url: "/pages/getuserinfo/index" }); } + // debugger + wx.showToast({ + title: err.errMsg, + icon:'none', + duration: 2000, + mask: false + }); }); } }); diff --git a/pages/index/rushToBuy/index.js b/pages/index/rushToBuy/index.js index b6dff9e..c6fe0aa 100644 --- a/pages/index/rushToBuy/index.js +++ b/pages/index/rushToBuy/index.js @@ -55,7 +55,15 @@ Component({ list: res.data.list, total:res.data.total }); - }); + }) + .catch(err => { + wx.showToast({ + title: err.errMsg, + icon: 'none', + duration: 2000, + mask: false + }); + }) }; if (app.globalData.token && app.globalData.token != null) { console.log("couponChannelList init 1"); diff --git a/pages/login/index.js b/pages/login/index.js index 8f08695..b452c0e 100644 --- a/pages/login/index.js +++ b/pages/login/index.js @@ -23,6 +23,13 @@ Page({ that.setData({ mallImgUrl: res.data.mallImgUrl }); + }).catch(err => { + wx.showToast({ + title: err.errMsg, + icon: 'none', + duration: 2000, + mask: false + }); }) } }); diff --git a/pages/managelicenseplate/managelicenseplate.js b/pages/managelicenseplate/managelicenseplate.js index 970cb1a..a38d6c7 100644 --- a/pages/managelicenseplate/managelicenseplate.js +++ b/pages/managelicenseplate/managelicenseplate.js @@ -19,6 +19,14 @@ Page({ carList: res.data }); }) + .catch(err => { + wx.showToast({ + title: err.message, + image: "../../assets/img/fail.png", + duration: 2000, + mask: false + }); + }) }, unbindCarBtn: function(e) { console.log(e); diff --git a/pages/order/detail/index.js b/pages/order/detail/index.js index 2676b3d..567cc0f 100644 --- a/pages/order/detail/index.js +++ b/pages/order/detail/index.js @@ -83,7 +83,15 @@ Page({ that.setData({ createDate: createDate }); - }); + }) + .catch(err => { + wx.showToast({ + title: err.message, + image: "../../../assets/img/fail.png", + duration: 2000, + mask: false + }); + }) }, gotogame: function () { let that=this; @@ -178,7 +186,15 @@ Page({ }, }); /// End payment -------- - }); + }) + .catch(err => { + wx.showToast({ + title: err.errMsg, + icon: 'none', + duration: 2000, + mask: false + }); + }) } else { // 免费券 that.payOrderUpdate(orderId, "0", 1) // 支付成功 @@ -207,8 +223,13 @@ Page({ console.log("payOrderUpdate then", res); }) .catch(err => { - console.log("payOrderUpdate catch", err); - }); + wx.showToast({ + title: err.errMsg, + icon: 'none', + duration: 2000, + mask: false + }); + }) }, /** diff --git a/pages/order/index/index.js b/pages/order/index/index.js index 328e592..57ce5d3 100644 --- a/pages/order/index/index.js +++ b/pages/order/index/index.js @@ -115,7 +115,15 @@ Page({ [createDate]: createDate1 }); } - }); + }) + .catch(err => { + wx.showToast({ + title: err.errMsg, + icon: 'none', + duration: 2000, + mask: false + }); + }) } else { console.log("加载完成allow_load设置成false"); diff --git a/pages/orderquanma/index.js b/pages/orderquanma/index.js index a279e5d..6c9720f 100644 --- a/pages/orderquanma/index.js +++ b/pages/orderquanma/index.js @@ -54,7 +54,15 @@ Page({ }); } - }); + }) + .catch(err => { + wx.showToast({ + title: err.message, + image: "../../assets/img/fail.png", + duration: 2000, + mask: false + }); + }) } }, 2000); @@ -73,7 +81,15 @@ Page({ that.setData({ couponorderstatus: res.data.CouponOrderStatus }); - }); + }) + .catch(err => { + wx.showToast({ + title: err.errMsg, + icon: 'none', + duration: 2000, + mask: false + }); + }) } /** * couponorderstatus diff --git a/pages/passCar/choicecoupon/choicecoupon.js b/pages/passCar/choicecoupon/choicecoupon.js index 7e3bdd2..82164e3 100644 --- a/pages/passCar/choicecoupon/choicecoupon.js +++ b/pages/passCar/choicecoupon/choicecoupon.js @@ -68,7 +68,15 @@ Page({ that.setData({ list: that.data.list }); - }); + }) + .catch(err => { + wx.showToast({ + title: err.errMsg, + icon: 'none', + duration: 2000, + mask: false + }); + }) } }, }); \ No newline at end of file diff --git a/pages/passCar/couponDetail/couponDetail.js b/pages/passCar/couponDetail/couponDetail.js index e3b5a04..54aae72 100644 --- a/pages/passCar/couponDetail/couponDetail.js +++ b/pages/passCar/couponDetail/couponDetail.js @@ -41,7 +41,15 @@ Page({ }); util.barcode("barcode", options.quancode, 510, 100); util.qrcode("qrcode", options.quancode, 350, 350); - }); + }) + .catch(err => { + wx.showToast({ + title: err.errMsg, + icon: 'none', + duration: 2000, + mask: false + }); + }) }, phone: function () { let that = this; diff --git a/pages/passCar/couponList/couponList.js b/pages/passCar/couponList/couponList.js index 9b78762..56e7e4f 100644 --- a/pages/passCar/couponList/couponList.js +++ b/pages/passCar/couponList/couponList.js @@ -75,7 +75,6 @@ Page({ "yyyy-MM-dd hh:mm:ss" ); }); - console.log("姐姐的订单列表"); setTimeout(function () { wx.hideLoading(); }, 1200); @@ -93,13 +92,20 @@ Page({ that.setData({ list: that.data.list }); - }); + }) + .catch(err => { + wx.showToast({ + title: err.errMsg, + icon: 'none', + duration: 2000, + mask: false + }); + }) } else { console.log("加载完成allow_load设置成false"); } }, handleChange({ detail }) { - console.log(detail); this.setData({ current: detail.key }); @@ -117,13 +123,10 @@ Page({ }, onReachBottom: function () { var that = this; - console.log(that.data.page); that.data.page++; - console.log(that.data.page); that.setData({ page: that.data.page }); - console.info("after++ " + that.data.page); that.getList(that.data.current_scroll, that.data.page); } }); diff --git a/pages/passCar/passCar.js b/pages/passCar/passCar.js index 6a04eb3..b869571 100644 --- a/pages/passCar/passCar.js +++ b/pages/passCar/passCar.js @@ -121,7 +121,15 @@ Page({ desc: weapNote.carpage.desc, title: weapNote.carpage.title }) - }); + }) + .catch(err => { + wx.showToast({ + title: err.errMsg, + icon: 'none', + duration: 2000, + mask: false + }); + }) // 登录 var scene = decodeURIComponent(options.scene); that.setData({ @@ -194,6 +202,13 @@ Page({ wx.redirectTo({ url: "/pages/getuserinfo/index" }); + }else{ + wx.showToast({ + title: err.errMsg, + icon: 'none', + duration: 2000, + mask: false + }); } }); } @@ -215,7 +230,15 @@ Page({ // 共同登录 that.userCarLogin(); } - }); + }) + .catch(err => { + wx.showToast({ + title: err.errMsg, + icon: 'none', + duration: 2000, + mask: false + }); + }) }, /** * 获取用户信息 @@ -318,7 +341,15 @@ Page({ that.setData({ couponList: res.data.list }); - }); + }) + .catch(err => { + wx.showToast({ + title: err.errMsg, + icon: 'none', + duration: 2000, + mask: false + }); + }) }, @@ -375,6 +406,13 @@ Page({ wx.redirectTo({ url: "/pages/phoneinput/phoneinput" }); + }else{ + wx.showToast({ + title: err.errMsg, + icon: 'none', + duration: 2000, + mask: false + }); } }) } @@ -436,8 +474,13 @@ Page({ park: res.data }) }) - .catch(error=>{ - console.log(error) + .catch(err => { + wx.showToast({ + title: err.errMsg, + icon: 'none', + duration: 2000, + mask: false + }); }) }, @@ -452,8 +495,13 @@ Page({ .then(res => { console.log(res); }) - .catch(error=>{ - console.log(error) + .catch(err => { + wx.showToast({ + title: err.errMsg, + icon: 'none', + duration: 2000, + mask: false + }); }) }, @@ -488,6 +536,14 @@ Page({ that.getStopFee(listCardNum); } }) + .catch(err => { + wx.showToast({ + title: err.errMsg, + icon: 'none', + duration: 2000, + mask: false + }); + }) }, /** diff --git a/pages/phoneinput/phoneinput.js b/pages/phoneinput/phoneinput.js index f8a081f..8ee5e16 100644 --- a/pages/phoneinput/phoneinput.js +++ b/pages/phoneinput/phoneinput.js @@ -53,10 +53,13 @@ Page({ }) } }) - .catch(error => { + .catch(err => { wx.showToast({ - title: error.data, - }) + title: err.errMsg, + icon: 'none', + duration: 2000, + mask: false + }); }) }, //计时器 @@ -102,10 +105,13 @@ Page({ }) } }) - .catch(error => { + .catch(err => { wx.showToast({ - title: '请输入有效手机号', - }) + title: err.errMsg, + icon: 'none', + duration: 2000, + mask: false + }); }) } } diff --git a/pages/rushToBuy/index.js b/pages/rushToBuy/index.js index b73bda8..c5dd7dd 100644 --- a/pages/rushToBuy/index.js +++ b/pages/rushToBuy/index.js @@ -91,7 +91,15 @@ Page({ } } - }); + }) + .catch(err => { + wx.showToast({ + title: err.errMsg, + icon: 'none', + duration: 2000, + mask: false + }); + }) } else { console.info("allow_load==false 已禁止加载"); that.setData({ diff --git a/pages/user/index.js b/pages/user/index.js index 2a86b2a..28532a5 100644 --- a/pages/user/index.js +++ b/pages/user/index.js @@ -114,7 +114,15 @@ Page({ score: res.data.score, levelName: res.data.levelName }) - }); + }) + .catch(err => { + wx.showToast({ + title: err.errMsg, + icon: 'none', + duration: 2000, + mask: false + }); + }) // that.getrun(); } }); \ No newline at end of file diff --git a/utils/HttpBasics.js b/utils/HttpBasics.js index 7b6342f..f8f6ec1 100644 --- a/utils/HttpBasics.js +++ b/utils/HttpBasics.js @@ -49,6 +49,9 @@ class HttpBasics { }, fail: err => { // wx.hideLoading(); + if (err.errMsg == 'request:fail timeout') { + err.errMsg = '请求超时,请检查您的网络设置!' + } reject(err); } }); @@ -75,7 +78,12 @@ class HttpBasics { this.responseMap(res, resolve, reject); }, fail: err => { + // debugger // wx.hideLoading(); + console.log(err) + if (err.errMsg=='request:fail timeout'){ + err.errMsg='请求超时,请检查您的网络设置!' + } reject(err); }, complete: res => {}