69 lines
1.5 KiB
JavaScript
69 lines
1.5 KiB
JavaScript
/*
|
|
* 手太欠
|
|
* 愿这世界都如故事里一样 美好而动人~
|
|
*/
|
|
|
|
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
activityData: [], //活动列表
|
|
page : {}, //下一页
|
|
lodingStats : false, //加载状态
|
|
activityId : '', //活动列表id
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad (options) {
|
|
this.setData({
|
|
activityId: options.categoryId
|
|
})
|
|
|
|
// 活动列表
|
|
this.listInfo();
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow () {},
|
|
|
|
/**
|
|
* 活动列表
|
|
*/
|
|
listInfo(page) {
|
|
wx.$api.teaIndex.activity(this.data.activityId, page).then(res=>{
|
|
let activityArr = this.data.activityData,
|
|
newData = []
|
|
if(page == 1 || page == undefined) activityArr = []
|
|
newData = activityArr.concat(res.data.data)
|
|
|
|
this.setData({
|
|
activityData: newData,
|
|
page : res.data.page,
|
|
lodingStats : false
|
|
})
|
|
wx.stopPullDownRefresh()
|
|
})
|
|
},
|
|
|
|
/**
|
|
* 上拉加载
|
|
*/
|
|
onReachBottom(){
|
|
this.setData({
|
|
lodingStats: true
|
|
})
|
|
let pageNumber = this.data.page.current
|
|
if(this.data.page.has_more){
|
|
pageNumber++
|
|
this.listInfo(pageNumber)
|
|
}
|
|
}
|
|
}) |