lll
liukangdong
2024-07-21 4eaf6d8835d4e9b204f13d012f13bbd8a94a21cc
wechat_jiaxuan/pages/homeId/index.js
@@ -8,6 +8,7 @@
    tagList: [],
    activeCate: '',
    dataList: [],
    total: 0,
    pageNum: 1,
    pageSize: 10,
@@ -21,6 +22,33 @@
    this.setData({ code: options.code})
    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
@@ -63,22 +91,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 +126,6 @@
  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {
  },
  /**
   * 用户点击右上角分享