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_staff/pages/userinfo/collect.js | 100 ++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 89 insertions(+), 11 deletions(-)
diff --git a/wechat_staff/pages/userinfo/collect.js b/wechat_staff/pages/userinfo/collect.js
index 633951c..6dada3a 100644
--- a/wechat_staff/pages/userinfo/collect.js
+++ b/wechat_staff/pages/userinfo/collect.js
@@ -1,24 +1,101 @@
-// pages/userinfo/collect.js
+import {
+ collectLikePage
+} from '../../api/index'
Page({
/**
* 椤甸潰鐨勫垵濮嬫暟鎹�
*/
data: {
- activeTabs: '0'
- },
+ activeTabs: 'product_intro',
+ dataList: [],
+ total: 0,
+ pageNum: 1,
+ pageSize: 10,
+ },
+ onLoad(options) { },
+ onPullDownRefresh: function () {
+ console.log('涓嬫媺鍒锋柊')
+ this.setData({
+ dataList: [],
+ pageNum: 1,
+ total: 0
+ })
+ wx.stopPullDownRefresh()
+ this.getList()
+ },
+ onReachBottom() {
+ console.log('瑙﹀簳浜嬩欢')
+ const {
+ total,
+ dataList,
+ pageNum
+ } = this.data
+ if (total > dataList.length) {
+ this.setData({
+ pageNum: pageNum + 1
+ })
+ this.getList()
+ } else {
+ wx.showToast({
+ title: '鏆傛棤鏇村鏁版嵁',
+ icon: 'none'
+ })
+ }
+ },
tabsChange(e) {
const activeTabs = e.currentTarget.dataset.val
- this.setData({ activeTabs })
+ this.setData({
+ activeTabs,
+ dataList: [],
+ total: 0,
+ pageNum: 1
+ })
+ this.getList()
},
handleDetail(e) {
+ const id = e.currentTarget.dataset.id
+ const {
+ activeTabs
+ } = this.data
+ let url = ''
+ if (activeTabs == 'product_intro') {
+ url = '/pages/detailDis/product'
+ } else if (activeTabs == 'whole_case') {
+ url = '/pages/detailDis/case'
+ } else {
+ url = '/pages/detailDis/realpic'
+ }
wx.navigateTo({
- url: '/pages/detailDis/product',
+ url: `${url}?id=${id}`,
})
},
- onLoad(options) {
-
+ getList() {
+ const {
+ pageSize,
+ pageNum,
+ activeTabs
+ } = this.data
+ collectLikePage({
+ businessCategory: 'collect',
+ businessType: activeTabs,
+ pageSize,
+ pageNum
+ }).then(res => {
+ if (res.data) {
+ // res.data.pageNum = res.data.pageNum <=0?1: res.data.pageNum
+ // if(pageNum == res.data.pageNum){
+ // if(pageNum == 1){
+ // this.setData({dataList:[],total:0})
+ // }
+ this.setData({
+ dataList: [...this.data.dataList, ...res.data.records || []],
+ total: res.data.total
+ })
+ // }
+ }
+ })
},
/**
@@ -32,7 +109,11 @@
* 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鏄剧ず
*/
onShow() {
-
+ this.setData({
+ pageNum: 1,
+ dataList: []
+ })
+ this.getList()
},
/**
@@ -59,9 +140,6 @@
/**
* 椤甸潰涓婃媺瑙﹀簳浜嬩欢鐨勫鐞嗗嚱鏁�
*/
- onReachBottom() {
-
- },
/**
* 鐢ㄦ埛鐐瑰嚮鍙充笂瑙掑垎浜�
--
Gitblit v1.9.3