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.
|
|
|
import { getOfficialsList } from "../../utils/api"
|
|
|
|
Page({
|
|
|
|
/**
|
|
|
|
* 页面的初始数据
|
|
|
|
*/
|
|
|
|
data: {
|
|
|
|
partyGroupId: "",
|
|
|
|
gOfficialsList: [],
|
|
|
|
loadMoreVisible: false,
|
|
|
|
loadMoreType: "none",
|
|
|
|
preloadVisible: true,
|
|
|
|
pageNo: 1,
|
|
|
|
pageSize: 10
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面加载
|
|
|
|
*/
|
|
|
|
onLoad: function (options) {
|
|
|
|
this.data.partyGroupId = options.partyGroupId
|
|
|
|
this.getOfficialsList();
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
|
|
*/
|
|
|
|
onPullDownRefresh: function () {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 页面上拉触底事件的处理函数
|
|
|
|
*/
|
|
|
|
onReachBottom: function () {
|
|
|
|
this.setData({
|
|
|
|
loadMoreVisible: true
|
|
|
|
})
|
|
|
|
if (this.data.loadMoreType === "loading") {
|
|
|
|
this.setData({
|
|
|
|
pageNo: this.data.pageNo + 1
|
|
|
|
})
|
|
|
|
this.getOfficialsList()
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
// 官小带个长 列表
|
|
|
|
getOfficialsList () {
|
|
|
|
const para = {
|
|
|
|
pageIndex: this.data.pageNo,
|
|
|
|
pageSize: this.data.pageSize,
|
|
|
|
partyGroupId: this.data.partyGroupId
|
|
|
|
}
|
|
|
|
getOfficialsList(para).then(res => {
|
|
|
|
console.log("获取官小带个长列表", res)
|
|
|
|
this.setData({
|
|
|
|
gOfficialsList: [...this.data.gOfficialsList, ...res.data],
|
|
|
|
loadMoreType: res.data.length === this.data.pageSize ? "loading": "none",
|
|
|
|
preloadVisible: false
|
|
|
|
})
|
|
|
|
if (this.data.loadMoreType === "none" && this.data.gOfficialsList.length !== 0) {
|
|
|
|
this.setData({
|
|
|
|
loadMoreVisible: true
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}).catch(err => {
|
|
|
|
console.log(err)
|
|
|
|
this.setData({
|
|
|
|
gOfficialsList: [],
|
|
|
|
loadMoreType: "none",
|
|
|
|
preloadVisible: false
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
})
|