From 1cee3a660c5f8e5f4290ae894c2898c4966a834d Mon Sep 17 00:00:00 2001
From: liukangdong <898885815@qq.com>
Date: 星期五, 02 八月 2024 18:33:33 +0800
Subject: [PATCH] ''

---
 wechat_staff/pages/consult/consult.js |   48 +++++++++++++++++++++++++++++++++++-------------
 1 files changed, 35 insertions(+), 13 deletions(-)

diff --git a/wechat_staff/pages/consult/consult.js b/wechat_staff/pages/consult/consult.js
index 5e74e3b..b1f84a0 100644
--- a/wechat_staff/pages/consult/consult.js
+++ b/wechat_staff/pages/consult/consult.js
@@ -1,4 +1,5 @@
-import { getZhongTaiProductNewsPage, getCatalogList,actionDo } from '../../api/index'
+import { getZhongTaiProductNewsPage, getCatalogList,actionDo,refreshEnjoy } from '../../api/index'
+let touchDot = 0
 Page({
 
   /**
@@ -7,6 +8,7 @@
   data: {
     category: [],
     secondCategory: [],
+    showCate: true,
 
     catalogCode: '',
     tagCode: '',
@@ -15,6 +17,7 @@
     total: 0,
     pageNum: 1,
     pageSize: 10,
+    scrollTop: 0
 
     // height: 0,
     // top: 0,
@@ -22,12 +25,12 @@
   onLoad(options) {
     this.getCate()
   },
-  onReachBottom() {
+  bindscrolltolower() {
     console.log('瑙﹀簳浜嬩欢');
     const { total, dataList, pageNum } = this.data
     if(total > dataList.length){
       this.setData({ pageNum: pageNum + 1 })
-      this.getList()
+      this.getList(false)
     }else{
       wx.showToast({
         title: '鏆傛棤鏇村鏁版嵁',
@@ -58,12 +61,20 @@
   itemClick(e) {
     const item = e.currentTarget.dataset.item
     actionDo({actionType: 'view',id: item.id})
+    const { dataList } = this.data
+    dataList.forEach(ite => {
+      if(item.id === ite.id){
+        ite.viewCount += 1
+      }
+    })
+    this.setData({ dataList })
     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 })
+          // 閫氳繃eventChannel鍚戣鎵撳紑椤甸潰浼犻�佹暟鎹� 
+          console.log(item)
+          res.eventChannel.emit('data',{link:item.content,title:item.title} );
         }
       })
     }else{
@@ -72,7 +83,7 @@
       })
     }    
   },
-  getList() {
+  getList(showCate = true) {
     const { pageNum, pageSize, catalogCode, tagCode, query } = this.data
     getZhongTaiProductNewsPage({
       pageNum, pageSize, query, catalogCode: tagCode || catalogCode
@@ -80,7 +91,8 @@
       if(res.data){
         this.setData({ 
           dataList: [ ...this.data.dataList, ...res.data.records ],
-          total: res.data.total
+          total: res.data.total,
+          showCate
         })
       }
       
@@ -111,12 +123,22 @@
   onReady() {
 
   },
-
-  /**
-   * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鏄剧ず
-   */
+  touchstart(e){
+    // touchDot = e.touches[0].pageY;
+    console.log('寮�濮�', e);
+  },
+  touchmove(e) {
+    // var touchMove = e.touches[0].pageY;
+    console.log('touchMove', e);
+    // if(touchDot - touchMove > 60){
+    //   this.setData({ showCate: false })
+    // }
+    // if(touchMove - touchDot > 60){
+    //   this.setData({ showCate: true })
+    // }
+  },
   onShow() {
-
+    refreshEnjoy(this) 
   },
 
   /**

--
Gitblit v1.9.3