ycm 2 years ago
parent
commit
5c9c1e633b
1 changed files with 23 additions and 11 deletions
  1. 23 11
      pages/servicePoint/point.js

+ 23 - 11
pages/servicePoint/point.js

@@ -33,8 +33,8 @@ Page({
      * 页面上拉触底事件的处理函数
      */
     onReachBottom: function () {
-      this.setData({pageindex:this.data.pageindex+=1})
-      this.gettasklist()
+    //   this.setData({pageindex:this.data.pageindex+=1})
+    //   this.gettasklist()
     },
     bindinput(e){
         this.setData({
@@ -60,6 +60,15 @@ Page({
       })
         console.log(`当前值:${value}, 当前索引:${index}`);
       },
+    deWeightThree(arr){
+        let map = new Map();
+        for (let item of arr) {
+            if (!map.has(item.id)) {
+                map.set(item.id, item);
+            }
+        }
+        return [...map.values()];
+    },
     gettasklist(){
         var that=this
         var lng=wx.getStorageSync('longitude');
@@ -78,21 +87,24 @@ Page({
                 wx.showLoading({
                     title: res.message.msg,
                   })
-                  that.setData({pageindex: that.data.pageindex -= 1})
+                //   that.setData({pageindex: that.data.pageindex -= 1})
                   setTimeout(function () {
                     wx.hideLoading();
                   }, 1000);
                   
             } else {
               wx.hideLoading();
-              if (that.data.pageindex == 1) {
-                that.setData({taskInfo: []})
-              }
-              if (res.message.data.length > 0) {
-                that.setData({taskInfo: that.data.taskInfo.concat(res.message.data)})
-              } else {
-                that.setData({pageindex: that.data.pageindex -= 1})
-              }
+              let arrtask = that.deWeightThree(res.message.data)
+              
+              that.setData({taskInfo: arrtask})
+            //   if (that.data.pageindex == 1) {
+            //     that.setData({taskInfo: []})
+            //   }
+            //   if (res.message.data.length > 0) {
+            //     that.setData({taskInfo: that.data.taskInfo.concat(res.message.data)})
+            //   } else {
+            //     that.setData({pageindex: that.data.pageindex -= 1})
+            //   }
             }
           }).catch(function (err) {