wkw 3 тижнів тому
батько
коміт
5faf3d350a

+ 6 - 5
pages/couponDetail/couponDetail.js

@@ -50,19 +50,20 @@ Page({
   // 轮询接口
   startPolling() {
     this.stopPolling();
-    this.data.timer = setInterval(() => {
-      this.checkCouponStatus('check');
+    this.data.timer = setTimeout(async () => {
+      await this.checkCouponStatus('check');
+      this.startPolling();
     }, 10000);
   },
   stopPolling() {
     if (this.data.timer) {
-      clearInterval(this.data.timer);
+      clearTimeout(this.data.timer);
       this.data.timer = null;
     }
   },
-  async checkCouponStatus() {
+  async checkCouponStatus(type) {
     const res = await queryCouponDetail(this.data.id, 1);
-    if (res.code === 200) {
+    if (res.code === 200 && type) {
       const { verify_status } = res.data;
       if (verify_status !== 0) {
         this.updateCouponInfo(res.data);

+ 1 - 1
pages/couponDetail/couponDetail.wxml

@@ -28,7 +28,7 @@
     <view class="store-box" bindtap="goPage">
       <view class="box-lf">
         <image class="store-img" src="/static/image/md.png" mode="aspectFit"/>
-        <view>适用门店</view>
+        <view>门店导航</view>
       </view>
       <view class="box-ri">
         <view>去查看{{couponInfo.stores}}家</view>

+ 3 - 3
pages/register/register.js

@@ -39,7 +39,7 @@ Page({
   async onLoad(){
     const res = await enrollDetail();
     if (res.code == 200 && res.data) {
-      let { phone, nickname, gender, race_number, competition_image } = res.data;
+      let { phone, nickname, gender, race_number, competition_image,competition_image_url } = res.data;
       this.setData({
         formData: {
           phone,
@@ -48,7 +48,7 @@ Page({
           competition_image,
           gender: gender == 0 ? '女' : '男',
         },
-        filePath:BASE_URL + competition_image,
+        filePath:competition_image_url,
         fileType:this.getFileType(competition_image),
         isEdit: true
       });
@@ -232,7 +232,7 @@ Page({
     const res = await enroll(payload);
     if (res.code === 200) {
       await FETCH_AND_FORMAT_USER_INFO();
-      if (!this.data.isEdit) {
+      if (!this.data.isEdit && res.data.length > 0) {
         this.setData({
           couponInfo: res.data[0],
           couponList:res.data,