市北党建引领小程序初始化
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.
 

70 lines
1.5 KiB

import { listSearch } from "../../api/index"
Page({
/**
* 页面的初始数据
*/
data: {
pageNo:1,
pageSize: 10,
loadMoreType: "none",
loadMoreVisible: false,
isShowNoData: false,
unionBuildlist: []
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.setData({
agencyId: options.communityId,
loadMoreType: "loading",
loadMoreVisible: false
})
this.listSearch()
},
listSearch () {
const para = {
agencyId: this.data.agencyId,
pageNo: this.data.pageNo,
pageSize: this.data.pageSize
}
listSearch(para).then(res => {
this.setData({
loadMoreType: res.data.list.length === this.data.pageSize ? "loading" : "none",
unionBuildlist: this.data.unionBuildlist.concat(res.data.list)
})
if (this.data.unionBuildlist.length == 0) {
this.setData({
isShowNoData: true,
loadMoreVisible: false,
})
}
}).catch(err => {
console.log(err)
this.setData({
loadMoreType: "none",
unionBuildlist: []
})
})
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
this.setData({
loadMoreVisible: true
})
if (this.data.loadMoreType === "loading") {
this.data.pageNo += 1
this.listSearch()
}
},
// 查看详情
toDetail (e) {
wx.navigateTo({
url: `/subpages/unionBuild/pages/detail/detail?id=${e.currentTarget.dataset.id}`
})
}
})