// pages/my/integral/integral.js const App = getApp() const util = require('../../../utils/util') Page({ /** * 页面的初始数据 */ data: { queryParams: { page: 1, limit: 10 }, list: [], page: { total: null, currPage: null, totalPage: null, }, nodata: util.nodata(), }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { console.log(options) this.setData({ memberId: options.id }) this.getIntegral(options.id) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady() { }, /** * 生命周期函数--监听页面显示 */ onShow() { }, getIntegral(id) { if (this.data.queryParams.page > 1) { if (this.data.page.currPage == this.data.page.totalPage) { wx.showToast({ icon: 'none', title: '没有更多哦~', }) return false } } wx.showLoading({ title: '努力加载中...', }) App._get('expert/pointsRecordPage', { ...this.data.queryParams, memberId: id || this.data.memberId }, res => { if (res.code === 0) { this.setData({ list: [...this.data.list, ...res.page.list], page: { total: res.page.totalCount, currPage: res.page.currPage, totalPage: res.page.totalPage } }) } }, err => {}, complete => { setTimeout(() => { wx.hideLoading() }, 500) }) }, /** * 生命周期函数--监听页面隐藏 */ onHide() { }, /** * 生命周期函数--监听页面卸载 */ onUnload() { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() { this.setData({ queryParams: { page: 1, limit: 10 }, list: [] }) this.getIntegral() setTimeout(() => { wx.stopPullDownRefresh() }, 300) }, /** * 页面上拉触底事件的处理函数 */ onReachBottom() { this.setData({ queryParams: { page: ++this.data.queryParams.page, limit: 10 } }) this.getIntegral() }, /** * 用户点击右上角分享 */ onShareAppMessage() { } })