From 269d711e17d2dffcf6e024a343f5249b6a85ebf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=93=E5=B9=B3=E8=89=BA?= <52643018@qq.com> Date: Fri, 24 Sep 2021 18:38:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=89=AB=E7=A0=81=E8=BD=AE?= =?UTF-8?q?=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/user/member/code.vue | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/pages/user/member/code.vue b/pages/user/member/code.vue index 53b34ca..a625966 100644 --- a/pages/user/member/code.vue +++ b/pages/user/member/code.vue @@ -63,7 +63,9 @@ centerInfo: {balance: 0}, show_code: false, show_code_count: 0, - show_count: 0 + show_count: 0, + is_scan_code: false, + first_http: 0 } }, onLoad(){ @@ -72,7 +74,14 @@ this.getIsSetPayPwd(); this.getMeInfo(); this.getUcenter(); - + }, + onShow(){ + this.show_count++; + if(this.show_count > 1){ + this.first_http = 0; + this.is_scan_code = false; + this.getIsSetPayPwd(); + } // 设置手机屏幕亮度 uni.getScreenBrightness({ success: (res) => { @@ -84,20 +93,16 @@ } }) }, - onShow(){ - this.show_count++; - if(this.show_count > 1){ - this.getIsSetPayPwd(); - } + onHide(){ + uni.setScreenBrightness({ + value: this.brightness + }) }, onUnload(){ if(this.timer){ clearInterval(this.timer); this.timer = null; } - uni.setScreenBrightness({ - value: this.brightness - }) }, methods: { // 获取用户是否设置了支付密码 @@ -187,10 +192,11 @@ }) } } + this.first_http++; this.$http.get({ api: 'api/offline/get_pay', data: { - refresh: 0 + refresh: this.first_http <= 1 ? 1 : 0 }, header: { Authorization: this.token @@ -219,7 +225,14 @@ url += `?clerk_id=${clerk_id}`; url += `&brand_id=${brand_id}`; url += `&amount=${amount}`; - this.$url(url); + if(this.timer){ + clearInterval(this.timer); + this.timer = null; + } + if(!this.is_scan_code){ + this.$url(url); + } + this.is_scan_code = true; } } if(!options.silence){