From 2da083225417ef7007842b84e7276242faeb0e35 Mon Sep 17 00:00:00 2001
From: liukangdong <898885815@qq.com>
Date: 星期一, 05 八月 2024 16:18:58 +0800
Subject: [PATCH] lll

---
 wechat_staff/pages/consult/consult.js |   51 +++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 37 insertions(+), 14 deletions(-)

diff --git a/wechat_staff/pages/consult/consult.js b/wechat_staff/pages/consult/consult.js
index b1f84a0..0d760fe 100644
--- a/wechat_staff/pages/consult/consult.js
+++ b/wechat_staff/pages/consult/consult.js
@@ -9,6 +9,7 @@
     category: [],
     secondCategory: [],
     showCate: true,
+    animationData: {},
 
     catalogCode: '',
     tagCode: '',
@@ -24,13 +25,17 @@
   },
   onLoad(options) {
     this.getCate()
+    this.animation = wx.createAnimation({
+      duration: 500,
+      timingFunction: 'ease',
+    });
   },
   bindscrolltolower() {
     console.log('瑙﹀簳浜嬩欢');
     const { total, dataList, pageNum } = this.data
     if(total > dataList.length){
       this.setData({ pageNum: pageNum + 1 })
-      this.getList(false)
+      this.getList()
     }else{
       wx.showToast({
         title: '鏆傛棤鏇村鏁版嵁',
@@ -83,7 +88,7 @@
       })
     }    
   },
-  getList(showCate = true) {
+  getList() {
     const { pageNum, pageSize, catalogCode, tagCode, query } = this.data
     getZhongTaiProductNewsPage({
       pageNum, pageSize, query, catalogCode: tagCode || catalogCode
@@ -91,8 +96,7 @@
       if(res.data){
         this.setData({ 
           dataList: [ ...this.data.dataList, ...res.data.records ],
-          total: res.data.total,
-          showCate
+          total: res.data.total
         })
       }
       
@@ -123,19 +127,38 @@
   onReady() {
 
   },
+  bindscrolltoupper() {
+    this.setData({ showCate: true })
+    this.fadeIn();
+  },
   touchstart(e){
-    // touchDot = e.touches[0].pageY;
-    console.log('寮�濮�', e);
+    touchDot = e.detail.scrollTop;
   },
   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 })
-    // }
+    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