xz_mini/pages/volunteer/volunteer.js
2020-06-23 19:14:44 +08:00

113 lines
2.2 KiB
JavaScript

// pages/volunteer/volunteer.js
Page({
/**
* 页面的初始数据
*/
data: {
indicatorDots: true,
autoplay: true,
baseUrl: 'http://192.168.0.111:8888/volunteer/',
imgUrl: 'http://192.168.0.111:8888/volunteer/route/file/downloadfile/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;
wx.request({
url: self.data.baseUrl + 'wxminiapp/volunteerservice/listpagevolunteerservicerelease',
success: function(res) {
if('200' == res.statusCode) {
// 将活动照片,拼接为可访问地址
for(var item of res.data.rows) {
if('' != item.photo) {
var photoArr = item.photo.split(",");
item.photo = self.data.imgUrl + photoArr[0];
}
}
self.setData({
serviceMap: res.data.rows
})
}
}
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.activityList();
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})