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.
56 lines
1.4 KiB
56 lines
1.4 KiB
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<stages.length;i++){
|
|
length+=stages[i].shixuns.length;
|
|
}
|
|
this.length = length;
|
|
}).catch(e=>{
|
|
global.realTimeLog.error(e, apiName + " fail to call");
|
|
app.showError(e);
|
|
})
|
|
},
|
|
}) |