ycm %!s(int64=2) %!d(string=hai) anos
pai
achega
751298776b
Modificáronse 3 ficheiros con 53 adicións e 14 borrados
  1. 20 4
      pages/cabinet/index.js
  2. 19 4
      pages/servicePoint/point.js
  3. 14 6
      pages/signFor/signRecord.js

+ 20 - 4
pages/cabinet/index.js

@@ -12,6 +12,7 @@ Page({
         vtype:'北京',
         ktype:'0',
         inputValue:"",
+        pageindex: 1
     },
 
     /**
@@ -40,6 +41,14 @@ Page({
         })
        
     },
+    /**
+     * 页面上拉触底事件的处理函数
+     */
+    onReachBottom: function () {
+      this.setData({pageindex:this.data.pageindex+=1})
+      this.gettasklist()
+    },
+
     onClose() {
         this.setData({ show: false });
       },
@@ -62,22 +71,29 @@ Page({
             city_id:id,
             key:key,
             lng:lat,
-            lat:lng
+            lat:lng,
+            page: that.data.pageindex
           }, "get").then(function (res) {
             console.log(res);
             if (res.code != 200) {
                 wx.showLoading({
                     title: res.message.msg,
                   })
+                  that.setData({pageindex: that.data.pageindex -= 1})
                   setTimeout(function () {
                     wx.hideLoading();
                   }, 1000);
                   
             } else {
               wx.hideLoading();
-              that.setData({
-                taskInfo:res.message.data
-              })
+              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) {
               

+ 19 - 4
pages/servicePoint/point.js

@@ -12,6 +12,7 @@ Page({
         vtype:'北京',
         ktype:'0',
         keyword:"",
+        pageindex: 1
     },
 
     /**
@@ -27,6 +28,13 @@ Page({
      */
     onReady: function () {
        
+    },
+    /**
+     * 页面上拉触底事件的处理函数
+     */
+    onReachBottom: function () {
+      this.setData({pageindex:this.data.pageindex+=1})
+      this.gettasklist()
     },
     bindinput(e){
         this.setData({
@@ -62,22 +70,29 @@ Page({
             city_id:id,
             key:key,
             lng:lng,
-            lat:lat
+            lat:lat,
+            page: that.data.pageindex
           }, "get").then(function (res) {
             console.log(res);
             if (res.code != 200) {
                 wx.showLoading({
                     title: res.message.msg,
                   })
+                  that.setData({pageindex: that.data.pageindex -= 1})
                   setTimeout(function () {
                     wx.hideLoading();
                   }, 1000);
                   
             } else {
               wx.hideLoading();
-              that.setData({
-                taskInfo:res.message.data
-              })
+              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) {
               

+ 14 - 6
pages/signFor/signRecord.js

@@ -6,7 +6,8 @@ Page({
    * 页面的初始数据
    */
   data: {
-    content:[]
+    content:[],
+    pageindex: 1
   },
 
   /**
@@ -18,22 +19,28 @@ Page({
   getData:function(){
     var that=this
     app.api.useApi(app.globalData.baseAppUrl + "api/admin/SignFor", {
-      
+      page: that.data.pageindex
     }, "get").then(function (res) {
       console.log(res);
       if (res.code != 200) {
           wx.showLoading({
               title: '数据获取失败',
             })
+            that.setData({pageindex: that.data.pageindex -= 1})
             setTimeout(function () {
               wx.hideLoading();
             }, 1000);
             
       } else {
         wx.hideLoading();
-        that.setData({
-          content:res.message.data
-        })
+        if (that.data.pageindex == 1) {
+          that.setData({content: []})
+        }
+        if (res.message.data.length > 0) {
+          that.setData({content: that.data.content.concat(res.message.data)})
+        } else {
+          that.setData({pageindex: that.data.pageindex -= 1})
+        }
         
       }
     }).catch(function (err) {
@@ -81,7 +88,8 @@ Page({
    * 页面上拉触底事件的处理函数
    */
   onReachBottom: function () {
-
+    this.setData({pageindex:this.data.pageindex+=1})
+    this.getData()
   },
 
   /**