const app = getApp(); Page({ data: { apply_size:0 }, onLoad: function (options) { let {course_id} = options; this.setData({course_id}); this.refresh(); this.pullCourse(); }, switchToTeacher(){ let {course_id} = this.data; app.api("courses.switch_to_teacher")({course_id}) .then(res=>{ console.log(res); this.refresh(); this.pullCourse(); }) }, pullCourse(){ let {course_id} = this.data; app.api("courses.top_banner")({course_id}) .then(res=>{ console.log(res); this.setData({course: res}); }) }, refresh(){ let {course_id} = this.data; app.api("courses.apply_teachers")({course_id}) .then(res=>{ this.setData(res); }).catch(e=>{ app.showError(e, 2200); }) }, onShow: function () { } })