houwei 4 vuotta sitten
vanhempi
commit
d09cd41b68
1 muutettua tiedostoa jossa 10 lisäystä ja 6 poistoa
  1. 10 6
      pages/index/index.js

+ 10 - 6
pages/index/index.js

@@ -36,13 +36,13 @@ Page({
   },
   // 跳转活动详情页面
   goActive(e) {
-    if(e.currentTarget.dataset.activestatus != -1) {
+    if (e.currentTarget.dataset.activestatus != -1) {
       let id = e.currentTarget.dataset.id
       let openId = e.currentTarget.dataset.openid
       wx.navigateTo({
         url: '/pages/activeDetail/activeDetail?id=' + id + '&openId=' + openId,
       })
-    }else{
+    } else {
       wx.showModal({
         title: '活动已经结束啦',
         showCancel: false
@@ -59,14 +59,18 @@ Page({
     wx.request({
       url: app.globalData.publicUrl + '/wx/member/' + this.data.openid + '/actives',
       method: "get",
-      // data: {
-      //   activeStatus: 0
-      // },
       success: (res) => {
         console.log(res)
         if (res.data.code == 0) {
+          let deleteArr = []
+          for (let i = 0; i < res.data.actives.length; i++) {
+            if (res.data.actives[i].activeStatus == -1) {
+              deleteArr.push(res.data.actives[i])
+              res.data.actives.splice(i, 1);
+            }
+          }
           this.setData({
-            arr: res.data.actives
+            arr: res.data.actives.concat(deleteArr)
           })
         }
       },