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.

66 lines
1.8 KiB

const app = getApp();
Page({
data: {
course: {},
show_classroom: new Date().getTime() < 1580820786606
},
enter_page({currentTarget:{dataset}}){
let time = new Date().getTime();
let url = dataset.url;
if ( time> 1577820786606){
wx.showModal({
title: '提示',
content: '该功能稳定性不佳已于2020年1月1日停用',
})
} else if (time > 1574320786656){
wx.showModal({
title: '提示',
content: '该功能稳定性不佳将于2020年1月1日停用按确认进入页面',
success: res=>{
if(res.confirm){
wx.navigateTo({
url: url,
})
}
}
})
}else{
wx.navigateTo({
url: url,
})
}
},
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);
},
onShow: function () {
app.client.get_course_info({course_id: this.course_id})
.then(res=>{
console.log(res);
this.setData({course: res.data});
});
},
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
}
}
}
})