Files
income_payments_applet/pages/committee/committee.js
T
2021-10-26 14:04:29 +08:00

60 lines
1.2 KiB
JavaScript

import UserApi from '../../assets/js/http/userApi'
Page({
/**
* 页面的初始数据
*/
data: {
pageNo: 1,
pageSize: 10,
list: []
},
loadData(){
wx.showToast({
title: '加载中...',
icon: 'loading'
})
let params = {
pageNo: this.data.pageNo,
pageSize: this.data.pageSize,
// 创建时间倒叙排序
column:'createTime',
order:'desc'
}
UserApi.committeeList(params).then(res=>{
if(res.success){
if(res.result.records && res.result.records.length){
this.setData({
list: [...this.data.list, ...res.result.records]
})
}
}
}).catch(err => {
wx.showToast({
title: '加载失败',
icon: 'none',
duration: 2000
})
})
},
// 分标委详情页
detail(e){
wx.navigateTo({
url: `../committeeDetail/committeeDetail?id=${e.currentTarget.dataset.committee.id}&name=${e.currentTarget.dataset.committee.name}`,
})
},
onLoad: function () {
this.loadData()
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
this.data.pageNo++
this.loadData()
}
})