parent
9b9053b5d4
commit
03e67f288a
@ -0,0 +1,56 @@
|
||||
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);
|
||||
})
|
||||
},
|
||||
})
|
@ -0,0 +1,6 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"send-to-course":"/components/modal/send-to-course/send-to-course"
|
||||
},
|
||||
"navigationBarTitleText": "发送至课堂"
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
<form bindsubmit="onSubmit">
|
||||
<view class="body">
|
||||
<scroll-view class="scroll-body" scroll-y="1">
|
||||
<checkbox-group name="shixun_ids" bindchange="onChange">
|
||||
<block wx:for="{{stages}}" wx:key="index">
|
||||
<view class="shixun-wrp" wx:for="{{item.shixuns}}" wx:key="id">
|
||||
<checkbox class="shixun-checkbox" color="#00b0f0" checked="{{selectAll}}" value="{{item.id}}">
|
||||
<view class="shixun-item">
|
||||
{{item.shixun_name}}
|
||||
</view>
|
||||
</checkbox>
|
||||
</view>
|
||||
</block>
|
||||
</checkbox-group>
|
||||
</scroll-view>
|
||||
<view class="operations">
|
||||
<view class="operation">
|
||||
<radio color="#00b0f0" checked="{{isSelectAll}}" bindtap="onTapSelectAll">全选</radio>
|
||||
</view>
|
||||
<button class="operation" form-type="submit">确认选用({{selectCount}})</button>
|
||||
</view>
|
||||
</view>
|
||||
</form>
|
||||
<send-to-course show="{{showSendDialog}}" open_type="redirectTo" subject_id="{{subject_id}}" shixun_ids="{{shixun_ids}}" />
|
@ -0,0 +1,44 @@
|
||||
.shixun-checkbox .wx-checkbox-input{
|
||||
flex: none;
|
||||
}
|
||||
.body{
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
}
|
||||
.scroll-body{
|
||||
flex: 1;
|
||||
height: 1px;
|
||||
flex-basis: 1px;
|
||||
|
||||
}
|
||||
.shixun-wrp{
|
||||
background: white;
|
||||
padding: 12px;
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
.shixun-item{
|
||||
padding-left: 8px;
|
||||
}
|
||||
.operations{
|
||||
display: flex;
|
||||
background: white;
|
||||
}
|
||||
.operation{
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
view.operation{
|
||||
display: flex;
|
||||
flex: 2;
|
||||
}
|
||||
button.operation{
|
||||
flex: 3;
|
||||
background: #00b0f0;
|
||||
color: white;
|
||||
border-radius: 0;
|
||||
}
|
||||
.weui-half-screen-dialog__hd__side .weui-icon-btn.weui-icon-btn_more{
|
||||
display: none;
|
||||
}
|
Loading…
Reference in new issue