锦水志愿者去哪小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

48 lines
1.5 KiB

const api = require("../../utils/api")
import util from "../../../../utils/util"
Page({
data: {
activeDetail: {},
activeDetailContent: '',
id: '',
actStartTime: '',
actEndTime: '',
imageList: [], // 精彩瞬间
},
onLoad: function (options) {
if (options.id) {
this.setData({
id: options.id
})
this.getVolunteerUnionActDetail(options.id)
}
},
// 获取
getVolunteerUnionActDetail (id) {
api.getVolunteerUnionActDetail(id).then(res => {
let startTime = res.data.actStartTime.replace(/-/g, '.')
let endTime = res.data.actEndTime.replace(/-/g, '.')
// let arr = res.data.images.sort(util.compare('imgSort'))
// console.log(arr)
let imageList = []
res.data.images.forEach(item => {
imageList.push(item.url)
})
this.setData({
activeDetail: res.data,
actStartTime: startTime.substring(0, startTime.length - 3),
actEndTime: endTime.substring(0, endTime.length - 3),
activeDetailContent: util.formatRichText(res.data.content),
imageList
})
}).catch(err => {
console.log(err)
})
},
preViewImage (e) {
wx.previewImage({
urls: this.data.imageList,
current: e.currentTarget.dataset.src
})
},
})