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

61 lines
1.5 KiB

2 years ago
const api = require('../../../../utils/home')
import { getTimestamp } from '../../../../utils/common'
Page({
data: {
pageNo: 1,
pageSize: 10,
timestamp: getTimestamp(),
issueLoadMoreVisible: false,
loadMoreType: 'loading',
noticeList: []
},
onLoad() {
this.getNoticeList()
},
onReachBottom() {
console.log('加载翻页')
this.setData({
issueLoadMoreVisible: true
})
if (this.data.loadMoreType === 'loading') {
this.setData({
pageNo: this.data.pageNo + 1,
pageSize: this.data.pageSize,
pageIndex: getTimestamp()
})
this.getNoticeList()
}
},
to_call: function (e) {
console.log('e', e.currentTarget.dataset.phone)
wx.makePhoneCall({
phoneNumber: e.currentTarget.dataset.phone
})
},
// 加载网格长管辖的网格列表
getNoticeList() {
let that = this
let para = {
pageIndex: this.data.pageNo,
pageSize: this.data.pageSize,
timestamp: getTimestamp()
}
api.getConsultion(para).then(res => {
that.setData({
noticeList: that.data.noticeList.concat(res.data),
loadMoreType: res.data.length === 10 ? 'loading' : 'none'
})
}).catch(err => {
console.log(err)
that.setData({
preloadVisible: false,
loadMoreType: 'none'
})
})
},
// toDetail (e) {
// console.log(e.currentTarget.dataset.id)
// wx.navigateTo({ url: '/subpages/home/pages/noticeDetail/noticeDetail?id='+e.currentTarget.dataset.id })
// }
})