// pages/familyEvent/familyEvent.js var app = getApp(); Page({ /** * 页面的初始数据 */ data: { familyEventList: [], page: 0,//当前页数 pageCount: 0,//总页数 //数据加载loading showLoading: false, }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { var that = this; that.setData({ showLoading: true, }); var config = wx.getStorageSync('config'); var location = wx.getStorageSync('location'); wx: wx.request({ url: app.url + 'ajax_get_family_event_list.php', data: { unionId: config.unionId, age: 4, province: location.province, city: location.city, district: location.district }, header: { 'content-type': 'application/json' }, method: 'GET', dataType: 'json', success: function (res) { console.log(res) if (res.statusCode == 200) { that.setData({ familyEventList: res.data.result.familyEventList }) } }, fail: function (res) { }, complete: function (res) { }, }) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { }, familyEventDetail() { wx.navigateTo({ url: '../familyEventDetail/familyEventDetail', }) }, loadMore() { if ((this.data.page + 1) < this.data.pageCount) { var pageIndex = this.data.page + 1 this.setData({ page: pageIndex }) } else { wx.showToast({ title: '没有更多内容啦。', icon: 'success', duration: 2000 }); } }, })