Commit 3de96d01 by zhangleyuan

feat:修改课程的数量限制

parent caba870f
......@@ -2,7 +2,7 @@
* @Author: zhangleyuan
* @Date: 2021-02-20 16:45:51
* @LastEditors: zhangleyuan
* @LastEditTime: 2021-03-09 19:54:25
* @LastEditTime: 2021-03-10 10:35:50
* @Description: 描述一下
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
......@@ -258,7 +258,7 @@ class TrainingTask extends React.Component {
taskName: '',
index:dataSource.length,
type:'input',
open:false,
open:true,
courseList:[
]
}
......
......@@ -53,14 +53,15 @@ class SelectOperatorModal extends React.Component {
videoTotalCount:0,
selectVideo:[], //弹窗内已选择的视频课程
currentVideoCourseListData:[], //页面中已关联的视频课程
activeKey:'video'
activeKey:'video',
currentTaskCourseData:this.props.data[this.props.selectedTaskIndex].courseList || []
}
}
componentDidMount() {
this.handleFetchLiveDataList();
this.handleFetchVideoDataList();
console.log('courseLisData',this.props.data)
}
// 获取直播课列表
......@@ -269,14 +270,14 @@ class SelectOperatorModal extends React.Component {
return columns;
}
selectLiveList = (record,selected) =>{
const {selectVideo,currentVideoCourseListData,currentLiveCourseListData,selectLive} = this.state;
const {selectVideo,currentTaskCourseData,selectLive} = this.state;
let _list = [];
if (selected || !_.find(selectLive, (item) => item.liveCourseId == record.liveCourseId)) {
_list = _.uniq(selectLive.concat([record]), false, (item) => item.liveCourseId);
} else {
_list = _.reject(selectLive, (item) => item.liveCourseId === record.liveCourseId);
}
if(_list.length + currentVideoCourseListData.length + currentLiveCourseListData.length + selectVideo.length> 20){
if(_list.length + currentTaskCourseData.length + selectVideo.length> 20){
message.warning('无法继续选择,一个任务最多关联20个课程');
return;
}
......@@ -284,14 +285,14 @@ class SelectOperatorModal extends React.Component {
}
selectVideoList = (record,selected) =>{
const {selectVideo,currentVideoCourseListData,currentLiveCourseListData,selectLive} = this.state;
const {selectVideo,currentTaskCourseData,selectLive} = this.state;
let _list = [];
if (selected || !_.find(selectVideo, (item) => item.id == record.id)) {
_list = _.uniq(selectVideo.concat([record]), false, (item) => item.id);
} else {
_list = _.reject(selectVideo, (item) => item.id === record.id);
}
if(_list.length + currentVideoCourseListData.length + currentLiveCourseListData.length + selectLive.length> 20){
if(_list.length + currentTaskCourseData.length + selectLive.length> 20){
message.warning('无法继续选择,一个任务最多关联20个课程');
return;
}
......@@ -325,7 +326,7 @@ class SelectOperatorModal extends React.Component {
}
render() {
const { visible } = this.props;
const { liveDataSource,liveSize,liveQuery,liveTotalCount,selectLive,currentLiveCourseListData,videoDataSource,videoSize,videoQuery,videoTotalCount,selectVideo,currentVideoCourseListData,activeKey} = this.state;
const { liveDataSource,liveSize,liveQuery,liveTotalCount,selectLive,videoDataSource,videoSize,videoQuery,videoTotalCount,selectVideo,currentTaskCourseData,activeKey} = this.state;
return (
<Modal
......@@ -369,7 +370,7 @@ class SelectOperatorModal extends React.Component {
<span>已选择{selectVideo.length + selectLive.length}</span>
<span onClick={this.clearSelectCourse}>清空</span>
</span>
<span>该任务已关联{currentVideoCourseListData.length + currentLiveCourseListData.length}个课程,可继续选择{20-(currentVideoCourseListData.length + currentLiveCourseListData.length )}</span>
<span>该任务已关联{currentTaskCourseData.length}个课程,可继续选择{20- currentTaskCourseData.length }</span>
</div>
<div>
<Table
......@@ -422,7 +423,7 @@ class SelectOperatorModal extends React.Component {
<span>已选择{selectVideo.length + selectLive.length}</span>
<span onClick={this.clearSelectCourse}>清空</span>
</span>
<span>该任务已关联{currentVideoCourseListData.length + currentLiveCourseListData.length}个课程,可继续选择{20-(currentVideoCourseListData.length + currentLiveCourseListData.length )}</span>
<span>该任务已关联{currentTaskCourseData.length}个课程,可继续选择{20- currentTaskCourseData.length }</span>
</div>
<div>
<Table
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment