// pages/volunteer/volunteer.js var app = getApp(); Page({ /** * 页面的初始数据 */ data: { indicatorDots: true, autoplay: true, serviceMap: [] }, goDetail: function (e) { var id = e.currentTarget.dataset.id; wx.navigateTo({ url: '../serviceActivityDetail/serviceActivityDetail?id=' + id }) }, goTeam: function () { wx.navigateTo({ url: '../volunteerTeam/volunteerTeam', }) }, goRegister: function () { wx.navigateTo({ url: '../volunteerRegister/volunteerRegister', }) }, newActivity: function () { wx.navigateTo({ url: '../newVolunteerActivity/newVolunteerActivity', }) }, /** * 获取志愿者活动列表 */ activityList: function() { var self = this; app.restAjax.get(app.restAjax.path(app.volunteerUrl + 'wxminiapp/volunteerservice/listpagevolunteerservicerelease', []), {}, null, function(code, data) { if('200' == code) { // 将活动照片,拼接为可访问地址 for(var item of data.rows) { if('' != item.photo) { var photoArr = item.photo.split(","); item.photo = app.volunteerUrl + 'route/file/downloadfile/true/' + photoArr[0]; } } self.setData({ serviceMap: data.rows }) } }, function() { }, function() { }) }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { this.activityList(); }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { } })