From 4eaf6d8835d4e9b204f13d012f13bbd8a94a21cc Mon Sep 17 00:00:00 2001
From: liukangdong <898885815@qq.com>
Date: 星期日, 21 七月 2024 22:52:37 +0800
Subject: [PATCH] lll

---
 wechat_jiaxuan/pages/homeId/index.js |   47 ++++++++++++++++++++++++++++-------------------
 1 files changed, 28 insertions(+), 19 deletions(-)

diff --git a/wechat_jiaxuan/pages/homeId/index.js b/wechat_jiaxuan/pages/homeId/index.js
index 7d96c8d..19d5dd9 100644
--- a/wechat_jiaxuan/pages/homeId/index.js
+++ b/wechat_jiaxuan/pages/homeId/index.js
@@ -8,6 +8,7 @@
     tagList: [],
     activeCate: '',
     dataList: [],
+    total: 0,
     pageNum: 1,
     pageSize: 10,
 
@@ -21,6 +22,33 @@
     this.setData({ code: options.code})
     this.getTabList()
     this.getList()
+  },
+  onReachBottom() {
+    console.log('瑙﹀簳浜嬩欢');
+    const { total, dataList, pageNum } = this.data
+    if(total > dataList.length){
+      this.setData({ pageNum: pageNum + 1 })
+      this.getList()
+    }else{
+      wx.showToast({
+        title: '鏆傛棤鏇村鏁版嵁',
+        icon: 'none'
+      })
+    }
+  },
+  getList(){
+    const { code, tagCodes, pageSize, pageNum } = this.data
+    pageZSZXContentList({
+      catalogCode: code,
+      tagCodes: tagCodes ? [tagCodes] : [],
+      pageSize,
+      pageNum
+    }).then(res => {
+      this.setData({
+        total: res.data.total,
+        dataList: [ ...this.data.dataList, ...res.data.records ]
+      })
+    })
   },
   itemClick(e) {
     const item = e.currentTarget.dataset.item
@@ -63,22 +91,6 @@
       
     })
   },
-  getList(){
-    const { code, tagCodes, pageSize, pageNum } = this.data
-    pageZSZXContentList({
-      catalogCode: code,
-      tagCodes: tagCodes ? [tagCodes] : [],
-      pageSize,
-      pageNum
-    }).then(res => {
-      this.setData({
-        dataList: [ ...this.data.dataList, ...res.data.records ]
-      })
-    })
-  },
-  onReachBottom() {
-
-  },
   onReady() {
 
   },
@@ -114,9 +126,6 @@
   /**
    * 椤甸潰涓婃媺瑙﹀簳浜嬩欢鐨勫鐞嗗嚱鏁�
    */
-  onReachBottom() {
-
-  },
 
   /**
    * 鐢ㄦ埛鐐瑰嚮鍙充笂瑙掑垎浜�

--
Gitblit v1.9.3