// pages/course_detail/course_detail.js const app = getApp(); Page({ /** * 页面的初始数据 */ data: { course: {}, }, onLoad: function (options) { this.course_id = options.course_id; app.api("courses.top_banner")({ course_id: this.course_id }) .then(res => { console.log(res); this.setData({ course: res }); }); 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 () { }, onShareAppMessage: function (options) { let course = this.data.course; let next_week_time = new Date().getTime()+7*24*3600*1000; let current_user = app.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:"cloud://educoder.6564-educoder-1300855313/images/course_invite.png", title: "课堂邀请--"+course.name } } } })