117 lines
2.7 KiB
JavaScript
117 lines
2.7 KiB
JavaScript
/**
|
|
* Web二雪
|
|
* 趁时光不老 努力活成自己想要成为的样子
|
|
*/
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
acted: false, //已经报名true
|
|
showBeSureActed: false, //显示确认弹窗
|
|
indicatorDots: true,
|
|
vertical: false,
|
|
autoplay: false,
|
|
interval: 2000,
|
|
duration: 500,
|
|
classificationId: 0, //默认为0
|
|
crowdfund_id: '', //项目筹集id
|
|
info: '', //详情
|
|
banners: [], //轮播图
|
|
},
|
|
|
|
onLoad(e) {
|
|
this.setData({
|
|
crowdfund_id: e.id,
|
|
})
|
|
this.getcrowdfundsDetail();
|
|
},
|
|
|
|
// 获取项目详情
|
|
getcrowdfundsDetail() {
|
|
wx.$api.companyModule.crowdfundsDetail(this.data.crowdfund_id).then(res => {
|
|
var k = [];
|
|
if (res.video_url) {
|
|
var parms = {};
|
|
parms.type = 'video'
|
|
parms.url = res.video_url;
|
|
k.push(parms)
|
|
}
|
|
if (res.pictures.length > 0) {
|
|
for (var i = 0; i < res.pictures.length; i++) {
|
|
var parms = {};
|
|
parms.type = 'image';
|
|
parms.url = res.pictures[i]
|
|
k.push(parms)
|
|
}
|
|
}
|
|
this.setData({
|
|
info: res,
|
|
banners: k
|
|
})
|
|
})
|
|
},
|
|
|
|
|
|
/**
|
|
* 点击分类
|
|
*/
|
|
classificationSelect(e) {
|
|
this.setData({
|
|
height: wx.getSystemInfoSync().windowHeight, // 获取屏幕高度
|
|
classificationId: e.target.dataset.id,
|
|
classificationIdNav: 'classificationIdNav' + e.target.dataset.id
|
|
})
|
|
},
|
|
|
|
/**
|
|
* 跳转到项目回报列表
|
|
*/
|
|
goDetail() {
|
|
var lists = JSON.stringify(this.data.info.items)
|
|
wx.navigateTo({
|
|
url: '/pages/home/projectReturn/projectReturn?lists=' + lists + '&crowdfund_id=' + this.data.crowdfund_id,
|
|
})
|
|
},
|
|
|
|
//关注项目授权
|
|
like: function () {
|
|
let that = this;
|
|
wx.requestSubscribeMessage({
|
|
tmplIds: ['CRqftSsSrDrUIoSl-7pU9el5_-F-vSAskx15umgd8Ow'],
|
|
success: res => {
|
|
if (res['CRqftSsSrDrUIoSl-7pU9el5_-F-vSAskx15umgd8Ow'] === 'accept') {
|
|
this.islike();
|
|
}
|
|
},
|
|
fail(res) {
|
|
console.log(res)
|
|
}
|
|
})
|
|
},
|
|
|
|
// 关注取消关注项目
|
|
islike() {
|
|
if (!this.data.info.isSubscribed) {
|
|
wx.$api.companyModule.crowdfundsLike(this.data.crowdfund_id).then(res => {
|
|
var info = this.data.info;
|
|
info.isSubscribed = true;
|
|
info.subscribes = res.subscribes
|
|
this.setData({
|
|
info: info
|
|
})
|
|
});
|
|
} else {
|
|
wx.$api.companyModule.crowdfundsUnLike(this.data.crowdfund_id).then(res => {
|
|
var info = this.data.info;
|
|
info.isSubscribed = false;
|
|
info.subscribes = res.subscribes
|
|
this.setData({
|
|
info: info
|
|
})
|
|
});
|
|
}
|
|
},
|
|
|
|
}) |