123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- // 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() {
- }
- })
|