From 7f899b5f769d1646fa85d191263a9df563fa005c Mon Sep 17 00:00:00 2001
From: liukangdong <898885815@qq.com>
Date: 星期二, 23 七月 2024 14:22:45 +0800
Subject: [PATCH] ‘’
---
wechat_staff/pages/userinfo/collect.js | 80 ++++++++++++++++++++++++++++++++-------
1 files changed, 65 insertions(+), 15 deletions(-)
diff --git a/wechat_staff/pages/userinfo/collect.js b/wechat_staff/pages/userinfo/collect.js
index 633951c..2ff7453 100644
--- a/wechat_staff/pages/userinfo/collect.js
+++ b/wechat_staff/pages/userinfo/collect.js
@@ -1,24 +1,77 @@
-// pages/userinfo/collect.js
+import {
+ collectLikePage
+} from '../../api/index'
Page({
/**
* 椤甸潰鐨勫垵濮嬫暟鎹�
*/
data: {
- activeTabs: '0'
- },
+ activeTabs: 'product_intro',
- tabsChange(e) {
- const activeTabs = e.currentTarget.dataset.val
- this.setData({ activeTabs })
- },
- handleDetail(e) {
- wx.navigateTo({
- url: '/pages/detailDis/product',
- })
+ dataList: [],
+ total: 0,
+ pageNum: 1,
+ pageSize: 10,
},
onLoad(options) {
-
+ 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,
+ 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: `${url}?id=${id}`,
+ })
+ },
+ getList() {
+ const {
+ pageSize,
+ pageNum,
+ activeTabs
+ } = this.data
+ collectLikePage({
+ businessCategory: 'collect',
+ businessType: activeTabs,
+ pageSize,
+ pageNum
+ }).then(res => {
+ if (res.data) {
+ this.setData({
+ dataList: [...this.data.dataList, ...res.data.records || []],
+ total: res.data.total
+ })
+ }
+ })
},
/**
@@ -59,9 +112,6 @@
/**
* 椤甸潰涓婃媺瑙﹀簳浜嬩欢鐨勫鐞嗗嚱鏁�
*/
- onReachBottom() {
-
- },
/**
* 鐢ㄦ埛鐐瑰嚮鍙充笂瑙掑垎浜�
--
Gitblit v1.9.3