From 7dc29ed74ebaa8a0e66f68264d9a13f95dc3af21 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期五, 02 八月 2024 11:09:06 +0800
Subject: [PATCH] aa

---
 wechat_staff/pages/userinfo/collect.js |   57 ++++++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 42 insertions(+), 15 deletions(-)

diff --git a/wechat_staff/pages/userinfo/collect.js b/wechat_staff/pages/userinfo/collect.js
index 2ff7453..7ba7ee3 100644
--- a/wechat_staff/pages/userinfo/collect.js
+++ b/wechat_staff/pages/userinfo/collect.js
@@ -14,16 +14,30 @@
     pageNum: 1,
     pageSize: 10,
   },
-  onLoad(options) {
+  onLoad(options) { },
+  onPullDownRefresh: function () {
+    console.log('涓嬫媺鍒锋柊')
+    this.setData({
+      dataList: [],
+      pageNum: 1,
+      total: 0
+    })
+    wx.stopPullDownRefresh()
     this.getList()
   },
   onReachBottom() {
-    console.log('瑙﹀簳浜嬩欢');
-    const { total, dataList, pageNum } = this.data
-    if(total > dataList.length){
-      this.setData({ pageNum: pageNum + 1 })
+    console.log('瑙﹀簳浜嬩欢')
+    const {
+      total,
+      dataList,
+      pageNum
+    } = this.data
+    if (total > dataList.length) {
+      this.setData({
+        pageNum: pageNum + 1
+      })
       this.getList()
-    }else{
+    } else {
       wx.showToast({
         title: '鏆傛棤鏇村鏁版嵁',
         icon: 'none'
@@ -34,20 +48,24 @@
     const activeTabs = e.currentTarget.dataset.val
     this.setData({
       activeTabs,
-      dataList: [],total: 0,pageNum: 1
+      dataList: [],
+      total: 0,
+      pageNum: 1
     })
     this.getList()
   },
   handleDetail(e) {
     const id = e.currentTarget.dataset.id
-    const { activeTabs } = this.data
+    const {
+      activeTabs
+    } = this.data
     let url = ''
-    if(activeTabs == 'product_intro'){
-        url =  '/pages/detailDis/product'
-    }else if(activeTabs == 'whole_case'){
-      url =  '/pages/detailDis/case'
-    }else{
-      url =  '/pages/detailDis/realpic'
+    if (activeTabs == 'product_intro') {
+      url = '/pages/detailDis/product'
+    } else if (activeTabs == 'whole_case') {
+      url = '/pages/detailDis/case'
+    } else {
+      url = '/pages/detailDis/realpic'
     }
     wx.navigateTo({
       url: `${url}?id=${id}`,
@@ -66,10 +84,16 @@
       pageNum
     }).then(res => {
       if (res.data) {
+        // res.data.pageNum =  res.data.pageNum <=0?1: res.data.pageNum
+        // if(pageNum == res.data.pageNum){
+        //   if(pageNum == 1){
+        //     this.setData({dataList:[],total:0})
+        //   }
         this.setData({
           dataList: [...this.data.dataList, ...res.data.records || []],
           total: res.data.total
         })
+        // } 
       }
     })
   },
@@ -85,7 +109,10 @@
    * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鏄剧ず
    */
   onShow() {
-
+    this.setData({
+      pageNum: 1
+    })
+    this.getList()
   },
 
   /**

--
Gitblit v1.9.3