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

87 lines
2.1 KiB

const api = require("../../../../utils/api")
Page({
/**
* 页面的初始数据
*/
data: {
pageIndex: 1,
pageSize: 10,
nodata: false,
loadMoreType: 'none',
loadMoreVisible: false,
enterpriselist: [],
quarterList: []
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
// this.getEnterpriseReportList()
},
onShow () {
this.setData({
enterpriselist: [],
pageIndex: 1
})
this.getEnterpriseReportList()
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
this.setData({
loadMoreVisible: true
})
if (this.data.loadMoreType === "loading") {
this.setData({
pageIndex: this.data.pageIndex + 1
})
this.getEnterpriseReportList()
}
},
getEnterpriseReportList () {
const para = {
pageIndex: this.data.pageIndex,
pageSize: this.data.pageSize
}
api.getEnterpriseReportList(para).then(res => {
console.log(res)
this.setData({
enterpriselist: [...this.data.enterpriselist,...res.data],
loadMoreType: res.data.length === this.data.pageSize ? 'loading' : 'none',
loadMoreVisible: res.data.length === this.data.pageSize ? false : true
})
if (this.data.enterpriselist.length == 0) {
this.setData({
nodata: true,
loadMoreType: 'none',
loadMoreVisible: false,
})
}
}).catch(err => {
this.setData({
enterpriselist: [],
nodata: true,
loadMoreType: 'none',
loadMoreVisible: false,
})
console.log(err)
})
},
// 跳转到信息详情
toApplyDetail (e) {
console.log('跳转详情', e.currentTarget.dataset.id)
wx.navigateTo({
url: `/subpages/oneKeyService/pages/companyInformationDetail/companyInformationDetail?id=${e.currentTarget.dataset.id}`
})
},
// 跳转编辑
toApply (e) {
wx.navigateTo({
url: `/subpages/oneKeyService/pages/companyInformation/companyInformation?id=${e.currentTarget.dataset.id}`
})
}
})