// pages/volunteers/volunteers.js var app = getApp(); Page({ /** * 页面的初始数据 */ data: { volunteerEventList:[], list1: [], list2: [], list3: [], list4: [], place:'', page: 0,//当前页数 pageCount: 0,//总页数 abilityPoint: 0,//能力分汇总 //数据加载loading showLoading: false, }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { var that=this; var config = wx.getStorageSync('config'); var location = wx.getStorageSync('location'); var place = location.province + location.city + location.district; this.setData({ place:place, showLoading: true, }) //检索志愿者活动列表 wx.request({ url: app.url + 'ajax_get_volunteer_top_dat.php', data: { unionId: config.unionId, province: location.province, city: location.city, district: location.district }, header: { 'content-type': 'application/json' }, method: 'GET', dataType: 'json', success: function (res) { if (res.statusCode == 200) { console.log(res) that.setData({ page: res.data.result.page, pageCount: res.data.result.pageCount, list1: res.data.result.volunteerEventList1, list2: res.data.result.volunteerEventList2, list3: res.data.result.volunteerEventList3, list4: res.data.result.volunteerEventList4, abilityPoint: res.data.result.abilityPoint }) } }, fail: function (res) { }, complete: function (res) { }, }) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { }, //志愿者排名1 rank1(){ wx.navigateTo({ url: '../volunteersRank1/volunteersRank1', }); }, //志愿者活动详情页面 volunteersEventDetail(e){ let eventId = e.currentTarget.dataset['id']; wx.navigateTo({ url: '../volunteersEventDetail/volunteersEventDetail?eventId=' + eventId, }) }, moreActivity(e){ var type = e.currentTarget.dataset['id']; wx.navigateTo({ url: '../otherActivity/otherActivity?type=' + type, }); } })