锦水居民端小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

133 lines
2.7 KiB

// subpages/heart/pages/myApplyList/myApplyList.js
const api = require("../../../../utils/api")
Page({
/**
* 页面的初始数据
*/
data: {
pageIndex: 1,
pageSize: 10,
nodata: false,
loadMoreType: 'none',
loadMoreVisible: false,
applylist: [
{
"id": "73290",
"actTitle": "洁美家园行动 组织开展以改善社区环境卫生",
"createdTime": "2020-10-22 15:20:00",
"actStatus": "0"
},
{
"id": "73291",
"actTitle": "组织开展以改善社区环境卫生为主内容的志愿活动,集中整治脏、乱、差现象",
"createdTime": "2020-10-22 15:20:00",
"actStatus": "1"
},
{
"id": "73292",
"actTitle": "便民服务中心志愿者",
"createdTime": "2020-10-22 15:20:00",
"actStatus": "2"
}
]
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
// this.getApplyList()
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
this.setData({
loadMoreVisible: true
})
if (this.data.loadMoreType === "loading") {
this.setData({
pageIndex: this.data.pageIndex + 1
})
this.getApplyList()
}
},
/**
* 用户点击右上角分享
*/
// onShareAppMessage: function () {
// }
getApplyList () {
const para = {
pageIndex: this.data.pageIndex,
pageSize: this.data.pageSize
}
api.applyRecord(para).then(res => {
console.log(res)
this.setData({
applylist: [...this.data.applylist,...res.data],
loadMoreType: res.data.length === this.data.pageSize ? 'loading' : 'none',
loadMoreVisible: res.data.length === this.data.pageSize ? false : true
})
if (this.data.applylist.length == 0) {
this.setData({
nodata: true,
loadMoreType: 'none',
loadMoreVisible: false,
})
}
}).catch(err => {
this.setData({
applylist: [],
nodata: true,
loadMoreType: 'none',
loadMoreVisible: false,
})
console.log(err)
})
},
//跳转到申请信息详情
toApplyDetail (e) {
console.log('toApplyDetail', e.currentTarget.dataset.id)
}
})