// pages/rzcxList/rzcxList.js const app = getApp() Page({ /** * 页面的初始数据 */ data: { loading: app.globalData.imgUrl + '/image/loading.svg', currentTab: 0, size: 10, size1: 10, size2: 10, content: '------加载中------', hasMoreData: true, createTime: '', dataSet: [] }, showList: function () { var userinfo = wx.getStorageSync("user"); var that = this; var id = userinfo.id var str; var sizeQty; wx.request({ url: app.globalData.url + '/api/entry/query?page=1&rows=' + that.data.size + '&type=' + 1 + '&userId=' + id, success: function (res) { console.log(res.data.rows) let dataSet = res.data.rows.map(({ createTime, ...e }) => ({ ...e, createTime: app.formatDate(createTime) })) console.log(dataSet) if (res.data.total < that.data.size) { that.setData({ dataSet: dataSet, hasMoreData: false, content: '------我是有底线的------' }) } else { that.setData({ dataSet: dataSet, hasMoreData: true, content: '------加载更多------', size: that.data.size + 10 }) } } }) }, businessSchedule: function (event) { var id = event.currentTarget.id; wx.navigateTo({ url: '../rzcx/rzcx?id=' + id + '&flag=wx' + '&disabled=' + true, }) }, onLoad: function () { this.showList() }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { if (this.data.hasMoreData) { this.showList(this.data.currentTab) this.setData({ content: '------加载更多------' }) } else { this.setData({ content: '------我是有底线的------' }) } }, })