From 00bf17838b496e6fcfed2e521f9c27f8f0e3e3c7 Mon Sep 17 00:00:00 2001
From: liukangdong <898885815@qq.com>
Date: 星期一, 05 八月 2024 18:38:20 +0800
Subject: [PATCH] ‘’

---
 wechat_staff/pages/consult/consult.js |   54 +++++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 49 insertions(+), 5 deletions(-)

diff --git a/wechat_staff/pages/consult/consult.js b/wechat_staff/pages/consult/consult.js
index d4ed9bb..0d760fe 100644
--- a/wechat_staff/pages/consult/consult.js
+++ b/wechat_staff/pages/consult/consult.js
@@ -1,4 +1,5 @@
 import { getZhongTaiProductNewsPage, getCatalogList,actionDo,refreshEnjoy } from '../../api/index'
+let touchDot = 0
 Page({
 
   /**
@@ -7,6 +8,8 @@
   data: {
     category: [],
     secondCategory: [],
+    showCate: true,
+    animationData: {},
 
     catalogCode: '',
     tagCode: '',
@@ -15,14 +18,19 @@
     total: 0,
     pageNum: 1,
     pageSize: 10,
+    scrollTop: 0
 
     // height: 0,
     // top: 0,
   },
   onLoad(options) {
     this.getCate()
+    this.animation = wx.createAnimation({
+      duration: 500,
+      timingFunction: 'ease',
+    });
   },
-  onReachBottom() {
+  bindscrolltolower() {
     console.log('瑙﹀簳浜嬩欢');
     const { total, dataList, pageNum } = this.data
     if(total > dataList.length){
@@ -58,6 +66,13 @@
   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',
@@ -112,10 +127,39 @@
   onReady() {
 
   },
-
-  /**
-   * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鏄剧ず
-   */
+  bindscrolltoupper() {
+    this.setData({ showCate: true })
+    this.fadeIn();
+  },
+  touchstart(e){
+    touchDot = e.detail.scrollTop;
+  },
+  touchmove(e) {
+    var touchMove = e.detail.scrollTop;
+    if(touchMove - touchDot > 60){
+      // this.setData({ showCate: false })
+      this.fadeOut();
+    }
+    if(touchDot - touchMove > 60){
+      this.fadeIn();
+      this.setData({ showCate: true })
+    }
+  },
+  fadeIn: function () {
+    this.animation.opacity(1).step();
+    this.setData({
+      animationData: this.animation.export()
+    });
+  },
+  fadeOut: function () {
+    this.animation.opacity(0).step();
+    this.setData({
+      animationData: this.animation.export()
+    });
+    setTimeout(() => {
+      this.setData({ showCate: false });
+    }, 500); // 鍔ㄧ敾鎸佺画鏃堕棿
+  },
   onShow() {
     refreshEnjoy(this) 
   },

--
Gitblit v1.9.3