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.

84 lines
1.8 KiB

// pages/course_detail/course_detail.js
const app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
course: {},
},
onLoad: function (options) {
this.course_id = options.course_id;
this.setData({course_id: options.course_id})
if(options.course_name && options.course_name!="undefined"){
wx.setNavigationBarTitle({
title: options.course_name
})
}
console.log(this.data);
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
app.client.get_course_info({course_id: this.course_id})
.then(res=>{
console.log(res);
this.setData({course: res.data});
});
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function (options) {
let course = this.data.course;
let next_week_time = new Date().getTime()+7*24*3600*1000;
let current_user = app.client.current_user;
if(options.from=="button"){
return{
path: `/pages/course_invite/course_invite?course_id=${this.course_id}&invite_code=${course.invite_code}&deadline=${next_week_time}&course_name=${course.name}&inviter=${current_user.real_name}&avatar_url=https://www.educoder.net/images/${current_user.image_url}`,
imageUrl:"/images/invite.png",
title: "课堂邀请--"+course.name
}
}
}
})