From 26fb0b3e76f52212a2cef49a0bc0b94e7425880c Mon Sep 17 00:00:00 2001
From: liukangdong <898885815@qq.com>
Date: 星期一, 29 七月 2024 10:55:10 +0800
Subject: [PATCH] Merge branch 'master' of http://139.186.142.91:10010/r/productDev/zbomyoujia

---
 wechat_jiaxuan/pages/consult/consult.js |   62 +++++++++++++++++++------------
 1 files changed, 38 insertions(+), 24 deletions(-)

diff --git a/wechat_jiaxuan/pages/consult/consult.js b/wechat_jiaxuan/pages/consult/consult.js
index 4b2b005..618063a 100644
--- a/wechat_jiaxuan/pages/consult/consult.js
+++ b/wechat_jiaxuan/pages/consult/consult.js
@@ -1,4 +1,4 @@
-import { getZhongTaiProductNewsPage, getCatalogList, getCataLogTagList } from '../../api/index'
+import { getZhongTaiProductNewsPage, getCatalogList,actionDo } from '../../api/index'
 Page({
 
   /**
@@ -10,14 +10,35 @@
 
     catalogCode: '',
     tagCode: '',
-    search: '',
+    query: '',
     dataList: [],
     total: 0,
     pageNum: 1,
     pageSize: 10,
+
+    // height: 0,
+    // top: 0,
   },
   onLoad(options) {
     this.getCate()
+  },
+  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'
+      })
+    }
+  },
+  onPullDownRefresh: function () {
+    console.log('涓嬫媺鍒锋柊');
+    this.setData({ dataList: [], pageNum: 1, total: 0 })
+    this.getList()
   },
   getCate() {
     getCatalogList({catalogCode: 'product_info'}).then(res => {
@@ -41,12 +62,13 @@
   },
   itemClick(e) {
     const item = e.currentTarget.dataset.item
+    actionDo({actionType: 'view',id: item.id})
     if(item.contentType == 'link'){
       wx.navigateTo({
-        url: '/pages/webView/index?link=' + item.content,
+        url: '/pages/webView/index',
         success: function(res) {
           // 閫氳繃eventChannel鍚戣鎵撳紑椤甸潰浼犻�佹暟鎹�
-          res.eventChannel.emit('acceptDataFromOpenerPage', { link: item.openContent, title: item.title })
+          res.eventChannel.emit('acceptDataFromOpenerPage', { link: item.content, title: item.title })
         }
       })
     }else{
@@ -55,13 +77,20 @@
       })
     }    
   },
+  searchList() {
+    this.setData({ dataList: [], total: 0, pageNum: 1 })
+    this.getList()
+  },
   getList() {
-    const { pageNum, pageSize, catalogCode, tagCode, search } = this.data
+    const { pageNum, pageSize, catalogCode, tagCode, query } = this.data
     getZhongTaiProductNewsPage({
-      pageNum, pageSize, search, catalogCode: tagCode || catalogCode
+      pageNum, pageSize, query, catalogCode: tagCode || catalogCode
     }).then(res => {
       if(res.data){
-        this.setData({ dataList: res.data.records,total: res.data.records.total })
+        this.setData({ 
+          dataList: [ ...this.data.dataList, ...res.data.records ],
+          total: res.data.total
+        })
       }
       
     })
@@ -71,8 +100,7 @@
     this.setData({ catalogCode: code,secondCategory: [], tagCode: ''  })
     this.gettag()
     this.getList()
-    console.log('e', e.currentTarget.dataset);
-    console.log('catalogCode', this.data.catalogCode);
+    this.setData({ dataList: [], pageNum: 1 })
   },
   seCateClick(e) {
     const { code } = e.currentTarget.dataset
@@ -81,6 +109,7 @@
     }else{
       this.setData({ tagCode: code })
     }
+    this.setData({ dataList: [], pageNum: 1 })
     this.getList()
   },
   priviewFull(e){
@@ -112,21 +141,6 @@
   onUnload() {
 
   },
-
-  /**
-   * 椤甸潰鐩稿叧浜嬩欢澶勭悊鍑芥暟--鐩戝惉鐢ㄦ埛涓嬫媺鍔ㄤ綔
-   */
-  onPullDownRefresh() {
-
-  },
-
-  /**
-   * 椤甸潰涓婃媺瑙﹀簳浜嬩欢鐨勫鐞嗗嚱鏁�
-   */
-  onReachBottom() {
-
-  },
-
   /**
    * 鐢ㄦ埛鐐瑰嚮鍙充笂瑙掑垎浜�
    */

--
Gitblit v1.9.3