From ebc6e7ee67f13e7aa311e737dfcb4c5caed112ee Mon Sep 17 00:00:00 2001
From: liukangdong <898885815@qq.com>
Date: 星期四, 15 八月 2024 18:23:57 +0800
Subject: [PATCH] ll

---
 wechat_jiaxuan/components/disCase/index.js |   54 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 53 insertions(+), 1 deletions(-)

diff --git a/wechat_jiaxuan/components/disCase/index.js b/wechat_jiaxuan/components/disCase/index.js
index 01aa0be..0f068a2 100644
--- a/wechat_jiaxuan/components/disCase/index.js
+++ b/wechat_jiaxuan/components/disCase/index.js
@@ -1,5 +1,6 @@
 import { getCataLogTagList, getZhongTaiWholecasePage, actionDo } from '../../api/index'
 import { eventBus } from '../../utils/eventBus'
+let touchDot = 0
 Component({
   /**
    * 缁勪欢鐨勫睘鎬у垪琛�
@@ -8,6 +9,10 @@
     menuButtonInfo: Object
   },
   data: {
+    // 鍔ㄧ敾
+    showTouch: true,
+    animationData: {},
+
     activeIndex: -1,
     activeParam: [],
     selParam: '',
@@ -31,6 +36,13 @@
         const dataList = this.data.dataList
         dataList.forEach(item => {
           if(item.id === info.id){
+            if(item.isCollection != info.isCollection){
+              if(!item.isCollection){ 
+                item.collectCount = (item.collectCount || 0)+1
+              }else if(item.collectCount >0){
+                item.collectCount = (item.collectCount || 0)-1
+              }             
+            }
             item.isCollection = info.isCollection
             item.viewCount ++
           }
@@ -42,8 +54,48 @@
   attached() {
     this.getCatelist()
     this.getList()
+    this.animation = wx.createAnimation({
+      duration: 600,
+      timingFunction: 'ease',
+    });
   },
   methods: {
+    bindscrolltoupper() {
+      this.setData({ showTouch: true })
+      this.fadeIn();
+    },
+    touchstart(e){
+      touchDot = e.detail.scrollTop;
+    },
+    touchmove(e) {
+      var touchMove = e.detail.scrollTop;
+      if(touchMove - touchDot > 24){
+        touchDot = touchMove
+        this.fadeOut();
+      }
+      if(touchDot - touchMove > 24){
+        touchDot = touchMove
+        setTimeout(() => {
+          this.setData({ showTouch: true })
+          this.fadeIn();
+        }, 200)
+      }
+    },
+    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({ showTouch: false });
+      }, 200); // 鍔ㄧ敾鎸佺画鏃堕棿
+    },
     getCatelist() {
       const { catalogCode } = this.data
       getCataLogTagList({
@@ -65,7 +117,7 @@
       getZhongTaiWholecasePage({
         catalogCode, pageNum, pageSize, tagCodes, sortType, query
       }).then(res => {
-        if (res.data) {
+        if (res.data && res.data.records) {
           this.setData({
             total: res.data.total,
             dataList: [...this.data.dataList, ...res.data.records],

--
Gitblit v1.9.3