Commit 40a9f8ba by zhangleyuan

feat:处理课程长度限制

parent 6f973d45
/* /*
* @Author: zhangleyuan * @Author: zhangleyuan
* @Date: 2020-11-27 15:06:31 * @Date: 2020-11-27 15:06:31
* @LastEditors: wufan * @LastEditors: zhangleyuan
* @LastEditTime: 2021-02-01 14:34:44 * @LastEditTime: 2021-03-09 14:22:10
* @Description: 描述一下 * @Description: 描述一下
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
...@@ -95,12 +95,14 @@ function PersonalInfoPage() { ...@@ -95,12 +95,14 @@ function PersonalInfoPage() {
phone: String(phone), phone: String(phone),
roleCodes: roleCodes, roleCodes: roleCodes,
avatar, avatar,
storeUserId: User.getStoreUserId() storeUserId: User.getStoreUserId(),
storeId:User.getStoreId()
} : { } : {
nickName, nickName,
roleCodes: roleCodes, roleCodes: roleCodes,
avatar, avatar,
storeUserId: User.getStoreUserId() storeUserId: User.getStoreUserId(),
storeId:User.getStoreId()
}; };
StoreService.editEmployee(params).then((res) => { StoreService.editEmployee(params).then((res) => {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: zhangleyuan * @Author: zhangleyuan
* @Date: 2021-02-20 16:45:51 * @Date: 2021-02-20 16:45:51
* @LastEditors: zhangleyuan * @LastEditors: zhangleyuan
* @LastEditTime: 2021-03-09 13:48:59 * @LastEditTime: 2021-03-09 13:55:00
* @Description: 描述一下 * @Description: 描述一下
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
...@@ -279,7 +279,7 @@ class BasicInfo extends React.Component{ ...@@ -279,7 +279,7 @@ class BasicInfo extends React.Component{
<span className="icon iconfont">&#xe865;</span> <span className="icon iconfont">&#xe865;</span>
<span>直播课单个课程,用户学习进度达到<Input type="number" width="40" value={percentCompleteLive} onChange={(e) => { this.props.onChange('percentCompleteLive', e.target.value) }}/>% 即视为“已完成”学习</span> <span>直播课单个课程,用户学习进度达到<Input type="number" width="40" value={percentCompleteLive} onChange={(e) => { this.props.onChange('percentCompleteLive', e.target.value) }}/>% 即视为“已完成”学习</span>
</div> </div>
<div> <div className="video-standard-info">
<span className="icon iconfont">&#xe864;</span> <span className="icon iconfont">&#xe864;</span>
<span>视频课单个课程,用户学习进度达到<Input type="number" width="40" value={percentCompleteVideo} onChange={(e) => { this.props.onChange('percentCompleteVideo', e.target.value) }} />%即视为“已完成”学习</span> <span>视频课单个课程,用户学习进度达到<Input type="number" width="40" value={percentCompleteVideo} onChange={(e) => { this.props.onChange('percentCompleteVideo', e.target.value) }} />%即视为“已完成”学习</span>
</div> </div>
......
...@@ -2,19 +2,20 @@ ...@@ -2,19 +2,20 @@
* @Author: zhangleyuan * @Author: zhangleyuan
* @Date: 2021-02-20 16:45:51 * @Date: 2021-02-20 16:45:51
* @LastEditors: zhangleyuan * @LastEditors: zhangleyuan
* @LastEditTime: 2021-03-09 13:42:05 * @LastEditTime: 2021-03-09 14:13:39
* @Description: 描述一下 * @Description: 描述一下
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
import React from 'react'; import React from 'react';
import { Table ,Button,Input,Form,Collapse} from 'antd'; import { Table ,Button,Input,Form,Collapse,Modal } from 'antd';
import { sortableContainer, sortableElement, sortableHandle} from 'react-sortable-hoc'; import { sortableContainer, sortableElement, sortableHandle} from 'react-sortable-hoc';
import { MenuOutlined } from '@ant-design/icons'; import { MenuOutlined } from '@ant-design/icons';
import arrayMove from 'array-move'; import arrayMove from 'array-move';
import RelatedCourseModal from '../modal/relatedCourseModal' import RelatedCourseModal from '../modal/relatedCourseModal'
import { withRouter } from 'react-router-dom'; import { withRouter } from 'react-router-dom';
import './TrainingTask.less'; import './TrainingTask.less';
const { Panel } = Collapse const { Panel } = Collapse;
const { confirm } = Modal;
const CourseType = { const CourseType = {
LIVE: { LIVE: {
text: "直播课" text: "直播课"
...@@ -306,15 +307,46 @@ class TrainingTask extends React.Component { ...@@ -306,15 +307,46 @@ class TrainingTask extends React.Component {
} }
} }
handleDeleteTask = (index)=>{ handleDeleteTask = (index)=>{
return confirm({
title: "删除任务",
content: "删除该任务会同步删除任务下的课程,是否仍要删除?",
icon: (
<span className="icon iconfont default-confirm-icon">&#xe839; </span>
),
okText: "删除",
okType: "danger",
cancelText: "取消",
onOk: () => {
this.handleConfirmDeleteTask(index);
},
});
}
handleConfirmDeleteTask = (index)=>{
const {dataSource}= this.state; const {dataSource}= this.state;
const newData=[...dataSource]; const newData=[...dataSource];
newData.splice(index,1); newData.splice(index,1);
this.setState({ this.setState({
dataSource:newData, dataSource:newData,
},()=>{this.props.onChange(newData);}) },()=>{this.props.onChange(newData);})
} }
handleDeleteCourse = (parentIndex,index)=>{ handleDeleteCourse = (parentIndex,index)=>{
return confirm({
title: "删除课程",
content: "确定删除该课程吗?",
icon: (
<span className="icon iconfont default-confirm-icon">&#xe839; </span>
),
okText: "删除",
okType: "danger",
cancelText: "取消",
onOk: () => {
this.handleConfirmDeleteCourse(parentIndex,index);
},
});
}
handleConfirmDeleteCourse = (parentIndex,index)=>{
const {dataSource}= this.state; const {dataSource}= this.state;
const newData=[...dataSource]; const newData=[...dataSource];
const selectData = [...newData[parentIndex].courseList] const selectData = [...newData[parentIndex].courseList]
...@@ -323,7 +355,6 @@ class TrainingTask extends React.Component { ...@@ -323,7 +355,6 @@ class TrainingTask extends React.Component {
this.setState({ this.setState({
dataSource:newData, dataSource:newData,
},()=>{this.props.onChange(newData);}) },()=>{this.props.onChange(newData);})
} }
showRelatedCourseModal = (index)=>{ showRelatedCourseModal = (index)=>{
this.setState({ this.setState({
...@@ -416,7 +447,15 @@ class TrainingTask extends React.Component { ...@@ -416,7 +447,15 @@ class TrainingTask extends React.Component {
</SortableCourseItem> </SortableCourseItem>
)} )}
</SortableCourseContainer> </SortableCourseContainer>
<div className="add-course-con"><span className="add-course-item" onClick={()=>{this.showRelatedCourseModal(index)}}><span>+</span><span>关联课程</span></span></div>
<div className="add-course-con">
{record.courseList.length>19?
<span className="add-course-btn-disabled" onClick={()=>{this.showRelatedCourseModal(index)}}><span>+</span><span>关联课程</span></span>
:
<span className="add-course-btn" onClick={()=>{this.showRelatedCourseModal(index)}}><span>+</span><span>关联课程</span></span>
}
</div>
</div> </div>
} }
</div> </div>
...@@ -514,7 +553,13 @@ class TrainingTask extends React.Component { ...@@ -514,7 +553,13 @@ class TrainingTask extends React.Component {
)} )}
</SortableTaskContainer> </SortableTaskContainer>
<div className="add-task-con"><span className="add-task-btn" onClick={()=>this.addTask()}><span>+</span><span>添加任务</span></span></div> <div className="add-task-con">
{dataSource.length > 9 ?
<span className="add-task-btn-disabled"><span>+</span><span>添加任务</span></span>
:
<span className="add-task-btn" onClick={()=>this.addTask()}><span>+</span><span>添加任务</span></span>
}
</div>
{ relatedCourseModalVisible && { relatedCourseModalVisible &&
<RelatedCourseModal <RelatedCourseModal
selectedTaskIndex={selectedTaskIndex} selectedTaskIndex={selectedTaskIndex}
......
...@@ -93,6 +93,11 @@ ...@@ -93,6 +93,11 @@
padding:16px 51px; padding:16px 51px;
color: #5289FA; color: #5289FA;
font-size:14px; font-size:14px;
.add-course-btn-disabled{
font-size:14px;
color:#ccc;
}
} }
} }
...@@ -103,6 +108,10 @@ ...@@ -103,6 +108,10 @@
border-radius: 2px; border-radius: 2px;
padding:16px; padding:16px;
margin-top:16px; margin-top:16px;
.add-task-btn-disabled{
color:#CCCCCC;
font-size:14px;
}
.add-task-btn{ .add-task-btn{
color: #5289FA; color: #5289FA;
font-size:14px; font-size:14px;
......
...@@ -262,7 +262,7 @@ class SelectOperatorModal extends React.Component { ...@@ -262,7 +262,7 @@ class SelectOperatorModal extends React.Component {
} else { } else {
_list = _.reject(selectLive, (item) => item.liveCourseId === record.liveCourseId); _list = _.reject(selectLive, (item) => item.liveCourseId === record.liveCourseId);
} }
if(_list.length + currentVideoCourseListData.length + currentLiveCourseListData.length + selectVideo> 20){ if(_list.length + currentVideoCourseListData.length + currentLiveCourseListData.length + selectVideo.length> 20){
message.warning('无法继续选择,一个任务最多关联20个课程'); message.warning('无法继续选择,一个任务最多关联20个课程');
return; return;
} }
...@@ -277,7 +277,7 @@ class SelectOperatorModal extends React.Component { ...@@ -277,7 +277,7 @@ class SelectOperatorModal extends React.Component {
} else { } else {
_list = _.reject(selectVideo, (item) => item.id === record.id); _list = _.reject(selectVideo, (item) => item.id === record.id);
} }
if(_list.length + currentVideoCourseListData.length + currentLiveCourseListData.length + selectLive> 20){ if(_list.length + currentVideoCourseListData.length + currentLiveCourseListData.length + selectLive.length> 20){
message.warning('无法继续选择,一个任务最多关联20个课程'); message.warning('无法继续选择,一个任务最多关联20个课程');
return; return;
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: wufan * @Author: wufan
* @Date: 2020-11-27 16:21:49 * @Date: 2020-11-27 16:21:49
* @LastEditors: zhangleyuan * @LastEditors: zhangleyuan
* @LastEditTime: 2021-03-02 13:40:27 * @LastEditTime: 2021-03-09 14:21:35
* @Description: Description * @Description: Description
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
...@@ -188,6 +188,7 @@ function AddEmployeeModal(props: AddEmployeeModalProps) { ...@@ -188,6 +188,7 @@ function AddEmployeeModal(props: AddEmployeeModalProps) {
roleCodes: [role], roleCodes: [role],
avatar, avatar,
storeUserId: storeUserId, storeUserId: storeUserId,
storeId:User.getStoreId()
}; };
console.log("params", params); console.log("params", params);
......
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