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.
85 lines
2.0 KiB
85 lines
2.0 KiB
// subpages/understandJs/pages/sclerotia/sclerotia.js
|
|
const api = require("../../../../utils/understandJs")
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
pageIndex: 1,
|
|
pageSize: 10,
|
|
sclerotialist: [],
|
|
nodata: false,
|
|
loadMoreType: "none",
|
|
loadMoreVisible: false,
|
|
dictType: '',
|
|
dictValue: '',
|
|
dictName: '',
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad: function (options) {
|
|
wx.setNavigationBarTitle({
|
|
title: options.dictName
|
|
})
|
|
this.setData({
|
|
dictName: options.dictName,
|
|
dictType: options.dictType,
|
|
dictValue: options.dictValue
|
|
})
|
|
this.getSclerotiaList()
|
|
},
|
|
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom: function () {
|
|
this.setData({
|
|
loadMoreVisible: true
|
|
})
|
|
if (this.data.loadMoreType === 'loading') {
|
|
this.setData({
|
|
pageIndex: this.data.pageIndex + 1,
|
|
pageSize: this.data.pageSize,
|
|
})
|
|
this.getSclerotiaList()
|
|
}
|
|
},
|
|
|
|
getSclerotiaList: function() {
|
|
let that = this
|
|
let para = {
|
|
pageIndex: this.data.pageIndex,
|
|
pageSize: this.data.pageSize,
|
|
noticeCategory: this.data.dictValue
|
|
}
|
|
api.noticelist(para).then(function(res) {
|
|
that.setData({
|
|
sclerotialist: that.data.sclerotialist.concat(res.data),
|
|
loadMoreType: res.data.length === that.data.pageSize ? 'loading' : 'none',
|
|
})
|
|
if (that.data.sclerotialist.length == 0) {
|
|
that.setData({
|
|
nodata: true,
|
|
loadMoreType: 'none',
|
|
loadMoreVisible: false
|
|
})
|
|
}
|
|
}).catch(() => {
|
|
that.setData({
|
|
nodata: true,
|
|
loadMoreType: "none",
|
|
loadMoreVisible: false,
|
|
sclerotialist: []
|
|
})
|
|
})
|
|
},
|
|
|
|
toDetail (e) {
|
|
wx.navigateTo({
|
|
url: `../noticeDetail/noticeDetail?modulename=${this.data.dictName}&modulecode=${this.data.dictType}&modulevalue=${this.data.dictValue}&id=${e.currentTarget.dataset.id}`
|
|
})
|
|
}
|
|
})
|