From a75b18a4157ab486e0b51c438ac165ab3a08e3e0 Mon Sep 17 00:00:00 2001
From: k94314517 <8417338+k94314517@user.noreply.gitee.com>
Date: 星期四, 25 七月 2024 18:10:00 +0800
Subject: [PATCH] 代码提交
---
wechat_jiaxuan/pages/homeId/index.js | 50 ++++++++++++++++++++++++++++++--------------------
1 files changed, 30 insertions(+), 20 deletions(-)
diff --git a/wechat_jiaxuan/pages/homeId/index.js b/wechat_jiaxuan/pages/homeId/index.js
index 7d96c8d..95ecff5 100644
--- a/wechat_jiaxuan/pages/homeId/index.js
+++ b/wechat_jiaxuan/pages/homeId/index.js
@@ -1,4 +1,4 @@
-import { getCataLogTagList, pageZSZXContentList } from '../../api/index'
+import { getCataLogTagList, pageZSZXContentList, actionDo } from '../../api/index'
Page({
/**
@@ -8,6 +8,7 @@
tagList: [],
activeCate: '',
dataList: [],
+ total: 0,
pageNum: 1,
pageSize: 10,
@@ -22,9 +23,37 @@
this.getTabList()
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'
+ })
+ }
+ },
+ getList(){
+ const { code, tagCodes, pageSize, pageNum } = this.data
+ pageZSZXContentList({
+ catalogCode: code,
+ tagCodes: tagCodes ? [tagCodes] : [],
+ pageSize,
+ pageNum
+ }).then(res => {
+ this.setData({
+ total: res.data.total,
+ dataList: [ ...this.data.dataList, ...res.data.records ]
+ })
+ })
+ },
itemClick(e) {
const item = e.currentTarget.dataset.item
console.log('item', item);
+ actionDo({actionType: 'view',id: item.id})
if(item.contentType == 'video'){
wx.previewMedia({
sources: [{ url: item.content, type: 'video' }]
@@ -63,22 +92,6 @@
})
},
- getList(){
- const { code, tagCodes, pageSize, pageNum } = this.data
- pageZSZXContentList({
- catalogCode: code,
- tagCodes: tagCodes ? [tagCodes] : [],
- pageSize,
- pageNum
- }).then(res => {
- this.setData({
- dataList: [ ...this.data.dataList, ...res.data.records ]
- })
- })
- },
- onReachBottom() {
-
- },
onReady() {
},
@@ -114,9 +127,6 @@
/**
* 椤甸潰涓婃媺瑙﹀簳浜嬩欢鐨勫鐞嗗嚱鏁�
*/
- onReachBottom() {
-
- },
/**
* 鐢ㄦ埛鐐瑰嚮鍙充笂瑙掑垎浜�
--
Gitblit v1.9.3