锦水居民端小程序
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.
 

67 lines
1.6 KiB

const api = require("../../utils/api")
Page({
data: {
pageIndex: 1,
pageSize: 10,
nodata: false,
loadMoreType: 'none',
loadMoreVisible: false,
allianceList: [], // 联盟列表
},
onLoad: function (options) {
this.setData({
pageIndex: 1,
dropbylist: []
})
this.getVolunteerUnionList()
},
onReachBottom: function () {
this.setData({
loadMoreVisible: true
})
if (this.data.loadMoreType === "loading") {
this.setData({
pageIndex: this.data.pageIndex + 1
})
this.getVolunteerUnionList()
}
},
// 前往联盟详情
toAllianceDetail (e) {
let id = e.currentTarget.dataset.id
wx.navigateTo({
url: `../allianceDetail/allianceDetail?id=${id}`
})
},
//
getVolunteerUnionList () {
const para = {
pageIndex: this.data.pageIndex,
pageSize: this.data.pageSize
}
api.getVolunteerUnionList(para).then(res => {
console.log(res)
this.setData({
allianceList: [...this.data.allianceList,...res.data],
loadMoreType: res.data.length === this.data.pageSize ? 'loading' : 'none',
loadMoreVisible: res.data.length === this.data.pageSize ? false : true,
nodata: false,
})
if (this.data.allianceList.length == 0) {
this.setData({
nodata: true,
loadMoreType: 'none',
loadMoreVisible: false,
})
}
}).catch(err => {
this.setData({
allianceList: [],
nodata: true,
loadMoreType: 'none',
loadMoreVisible: false,
})
console.log(err)
})
},
})