[新增]企业主页,企业活动
This commit is contained in:
130
pages/home/activeDetail/activeDetail.js
Normal file
130
pages/home/activeDetail/activeDetail.js
Normal file
@@ -0,0 +1,130 @@
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
acted: false, //已经报名true
|
||||
showBeSureActed: false, //显示确认弹窗
|
||||
indicatorDots: true,
|
||||
vertical: false,
|
||||
autoplay: false,
|
||||
interval: 2000,
|
||||
duration: 500,
|
||||
active_id: '', //活动id
|
||||
info: '', //详情信息
|
||||
loaded: false,
|
||||
showBeSigned:false,
|
||||
},
|
||||
onLoad(e) {
|
||||
this.setData({
|
||||
active_id: e.id
|
||||
})
|
||||
},
|
||||
onShow() {
|
||||
this.activesDetail(this.data.active_id);
|
||||
},
|
||||
|
||||
/**
|
||||
* 现在报名
|
||||
*/
|
||||
nowActed: function (e) {
|
||||
console.log()
|
||||
if (!e.currentTarget.dataset.acted) {
|
||||
this.setData({
|
||||
showBeSureActed: true,
|
||||
})
|
||||
} else {
|
||||
wx.showToast({
|
||||
icon: 'none',
|
||||
title: '已报名,等待活动开始',
|
||||
})
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 关闭弹窗
|
||||
*/
|
||||
close() {
|
||||
this.setData({
|
||||
showBeSureActed: false,
|
||||
showBeSigned:false,
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 确认报名
|
||||
*/
|
||||
beSure() {
|
||||
wx.login({
|
||||
success: res => {
|
||||
wx.$api.companyModule.activesEnroll(res.code, this.data.active_id).then(res => {
|
||||
if (Number(this.data.info.price) > 0) {
|
||||
var resss = JSON.parse(res);
|
||||
console.log('可支付')
|
||||
wx.requestPayment({
|
||||
timeStamp: resss.timeStamp,
|
||||
nonceStr: resss.nonceStr,
|
||||
package: resss.package,
|
||||
signType: 'MD5',
|
||||
paySign: resss.paySign,
|
||||
success: res => {
|
||||
this.close();
|
||||
wx.navigateTo({
|
||||
url: '/pages/home/activeSuccess/activeSuccess?cover=' + this.data.info.pictures[0],
|
||||
})
|
||||
},
|
||||
fail(res) {
|
||||
wx.showToast({
|
||||
title: '支付失败',
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
} else {
|
||||
console.log('不用支付')
|
||||
this.close();
|
||||
wx.navigateTo({
|
||||
url: '/pages/home/activeSuccess/activeSuccess?cover=' + this.data.info.pictures[0],
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 获取详情
|
||||
*/
|
||||
activesDetail() {
|
||||
wx.$api.companyModule.activesDetail(this.data.active_id).then(res => {
|
||||
var nodes = res.content.replace('<img', '<img style="max-width:100%;height:auto""');
|
||||
console.log(nodes);
|
||||
this.setData({
|
||||
info: res,
|
||||
content: nodes,
|
||||
loaded: true,
|
||||
})
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 立即签到接口
|
||||
*/
|
||||
signIn(e){
|
||||
this.setData({
|
||||
showBeSigned:true,
|
||||
active_id:e.currentTarget.dataset.id
|
||||
})
|
||||
},
|
||||
signed(e) {
|
||||
wx.$api.companyModule.signed(this.data.active_id).then(res => {
|
||||
console.log(res);
|
||||
var info=this.data.info;
|
||||
info.signed=2;
|
||||
this.setData({
|
||||
info:info
|
||||
})
|
||||
this.close();
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
})
|
||||
Reference in New Issue
Block a user