ll
liukangdong
2024-08-27 2c08a98f7e85ec7c9376f27a7933e75e44d672f7
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: '',
@@ -49,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({
@@ -72,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],