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.
|
|
|
const app = getApp();
|
|
|
|
Page({
|
|
|
|
data: {
|
|
|
|
|
|
|
|
},
|
|
|
|
join_course: function(event) {
|
|
|
|
const { invite_code, identities } = this.data;
|
|
|
|
let data = { invite_code: invite_code, student: 1};
|
|
|
|
console.log(data);
|
|
|
|
console.log({ ...data });
|
|
|
|
app.api("courses.apply_to_join_course")({ ...data })
|
|
|
|
.then(res => {
|
|
|
|
console.log(res);
|
|
|
|
wx.redirectTo({
|
|
|
|
url: "../course/course?course_id=" + res.data.course_id
|
|
|
|
});
|
|
|
|
})
|
|
|
|
.catch(error => {
|
|
|
|
wx.showToast({
|
|
|
|
title: error.message,
|
|
|
|
icon: "none"
|
|
|
|
});
|
|
|
|
console.warn(error);
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
onLoad: function (options) {
|
|
|
|
console.log(options);
|
|
|
|
this.invite_code = options.invite_code;
|
|
|
|
this.deadline = options.deadline;
|
|
|
|
this.inviter = options.inviter;
|
|
|
|
this.course_name = options.course_name;
|
|
|
|
this.setData(options);
|
|
|
|
let current_time = new Date().getTime();
|
|
|
|
this.setData({current_time: current_time});
|
|
|
|
}
|
|
|
|
})
|