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 | 74 ++++++++++++++++++++++++-------------
1 files changed, 48 insertions(+), 26 deletions(-)
diff --git a/wechat_staff/pages/userinfo/collect.js b/wechat_staff/pages/userinfo/collect.js
index 55c2bcd..6dada3a 100644
--- a/wechat_staff/pages/userinfo/collect.js
+++ b/wechat_staff/pages/userinfo/collect.js
@@ -14,15 +14,30 @@
pageNum: 1,
pageSize: 10,
},
- onLoad(options) {
+ 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 })
+ console.log('瑙﹀簳浜嬩欢')
+ const {
+ total,
+ dataList,
+ pageNum
+ } = this.data
+ if (total > dataList.length) {
+ this.setData({
+ pageNum: pageNum + 1
+ })
this.getList()
- }else{
+ } else {
wx.showToast({
title: '鏆傛棤鏇村鏁版嵁',
icon: 'none'
@@ -33,20 +48,24 @@
const activeTabs = e.currentTarget.dataset.val
this.setData({
activeTabs,
- dataList: [],total: 0,pageNum: 1
+ dataList: [],
+ total: 0,
+ pageNum: 1
})
this.getList()
},
handleDetail(e) {
const id = e.currentTarget.dataset.id
- const { activeTabs } = this.data
+ 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'
+ 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}`,
@@ -65,16 +84,16 @@
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
- })
- }
+ // 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
+ })
+ // }
}
})
},
@@ -89,8 +108,11 @@
/**
* 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鏄剧ず
*/
- onShow() {
- this.setData({pageNum:1})
+ onShow() {
+ this.setData({
+ pageNum: 1,
+ dataList: []
+ })
this.getList()
},
--
Gitblit v1.9.3