75 lines
1.7 KiB
JavaScript
75 lines
1.7 KiB
JavaScript
/*
|
|
* 手太欠
|
|
* 愿这世界都如故事里一样 美好而动人~
|
|
*/
|
|
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
empowerId : '', //增收赋能id
|
|
id : '',
|
|
cover : '',
|
|
title : '',
|
|
subtitle : '',
|
|
price : '0.00',
|
|
semester : null,
|
|
count : {},
|
|
content : []
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad(options) {
|
|
this.setData({
|
|
empowerId: options.id
|
|
})
|
|
this.indexInfo(options.id)
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow() {},
|
|
|
|
/**
|
|
* 增收赋能-详情
|
|
*/
|
|
indexInfo(id) {
|
|
wx.$api.empower.info(id).then(res => {
|
|
console.log(res.data)
|
|
let { cover, title, subtitle, price, semester_current, count, content, id } = res.data;
|
|
this.setData({
|
|
id : id,
|
|
cover : cover,
|
|
title : title,
|
|
subtitle : subtitle,
|
|
price : price,
|
|
semester : semester_current,
|
|
count : count,
|
|
content : content.replace(/\<img/gi, '<img style="width:100%;height:auto"')
|
|
})
|
|
wx.setNavigationBarTitle({ title })
|
|
}).catch(err => {})
|
|
},
|
|
|
|
/**
|
|
* 增收赋能-立即购买
|
|
*/
|
|
onBuy(){
|
|
if(this.data.count.ing <= 0){
|
|
wx.showToast({
|
|
title: '暂无可报名学期',
|
|
icon : 'none'
|
|
})
|
|
return
|
|
}
|
|
|
|
wx.navigateTo({
|
|
url: "/pages/empower/empowerBuy/empowerBuy?id=" + this.data.id
|
|
})
|
|
}
|
|
}) |