Browse Source

优化扫码轮询

master
邓平艺 4 years ago
parent
commit
269d711e17
  1. 37
      pages/user/member/code.vue

37
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){

Loading…
Cancel
Save