const app = getApp(); Page({ data: { selectCount: 0 }, onLoad: function (options) { let {subject_id} = options; this.setData({subject_id}); this.pullShixuns(); }, onChange(e){ let {detail:{value}} = e; this.setData({selectCount: value.length}); if(this.length>value.length) this.setData({isSelectAll: false}); else this.setData({isSelectAll: true}); }, onTapSelectAll(e){ let {detail} = e; let selectAll = !this.data.isSelectAll; let selectCount = selectAll?this.length:0; this.setData({isSelectAll: selectAll, selectAll, selectCount}); }, onSubmit(e){ let {detail:{value:{shixun_ids}}} = e; if(shixun_ids.length==0) return wx.showToast({ title: '请选择实训',icon:"none" }) shixun_ids = shixun_ids.map(i=>parseInt(i)); this.setData({shixun_ids, showSendDialog: true}); }, pullShixuns(){ let {subject_id} = this.data; let apiName = "paths.choose_course"; app.api(apiName)({subject_id}) .then(res=>{ let {stages} = res; this.setData({stages}); let length = 0; console.log(stages); for(var i=0;i{ global.realTimeLog.error(e, apiName + " fail to call"); app.showError(e); }) }, })