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 | 75 +++++++++++++++++++++++++++++++++++--
1 files changed, 71 insertions(+), 4 deletions(-)
diff --git a/wechat_jiaxuan/components/disCase/index.js b/wechat_jiaxuan/components/disCase/index.js
index 695fc91..0f068a2 100644
--- a/wechat_jiaxuan/components/disCase/index.js
+++ b/wechat_jiaxuan/components/disCase/index.js
@@ -1,4 +1,6 @@
import { getCataLogTagList, getZhongTaiWholecasePage, actionDo } from '../../api/index'
+import { eventBus } from '../../utils/eventBus'
+let touchDot = 0
Component({
/**
* 缁勪欢鐨勫睘鎬у垪琛�
@@ -7,6 +9,10 @@
menuButtonInfo: Object
},
data: {
+ // 鍔ㄧ敾
+ showTouch: true,
+ animationData: {},
+
activeIndex: -1,
activeParam: [],
selParam: '',
@@ -22,10 +28,74 @@
sortType: '',
catalogCode: 'whole_case'
},
+ pageLifetimes: {
+ show: function() {
+ // 椤甸潰琚睍绀�
+ console.log('缁勪欢琚睍绀�');
+ eventBus.once('caseDeBack', (info) => {
+ 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 ++
+ }
+ })
+ this.setData({ dataList })
+ })
+ },
+ },
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({
@@ -35,9 +105,6 @@
this.setData({
cateList: res.data
})
- setTimeout(() => {
- this.getList()
- }, 300)
}
})
},
@@ -50,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