Commit fe30365a by yuananting

fix:历史记录接口联调,已选课程过滤

parent 65495721
/*
* @Author: yuananting
* @Date: 2021-08-16 17:35:15
* @LastEditors: yuananting
* @LastEditTime: 2021-08-16 19:54:39
* @Description: 描述一下咯
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
import React, { useEffect, useState } from 'react';
import { withRouter } from "react-router-dom";
import RichText from '@/components/RichText'
import { withRouter } from 'react-router-dom';
import RichText from '@/components/RichText';
import ExpiredCourseList from '../../train-task/components/ExpiredCourseList';
import ENUM from '../../enum';
import './course.less'
import './course.less';
function CourseTable(props: any) {
const IndexText = ['一', '二', '三', '四', '五', '六', '七', '八', '九', '十']
const IndexText = ['一', '二', '三', '四', '五', '六', '七', '八', '九', '十'];
const [list, setList] = useState<any[]>([]);
useEffect(() => {
console.log(props.info, 'rtyuio')
setList(props.info.trainingStageList || [])
}, [props.info.trainingStageList])
console.log(props.info, 'rtyuio');
setList(props.info.trainingStageList || []);
}, [props.info.trainingStageList]);
return <div className="courseTabContent">
<div className="tips">
return (
<div className='courseTabContent'>
<div className='tips'>
{`培训目的:`}
<RichText url={props.info?.intro?.mediaUrl} />
</div>
<div className="coursecontent">
{
list?.map((item: any, index: number) => {
return <div className="task">
<div className="title" onClick={() => {
<div className='coursecontent'>
{list?.map((item: any, index: number) => {
return (
<div className='task'>
<div
className='title'
onClick={() => {
const _list = [...list];
_list[index].open = !_list[index].open;
setList(_list)
setList(_list);
}}>
{
item.open ? <span className="icon iconfont open">&#xe614;</span> : <span className="icon iconfont">&#xe614;</span>
}
{
`${IndexText[index]}、 `
}
{item.open ? <span className='icon iconfont open'>&#xe614;</span> : <span className='icon iconfont'>&#xe614;</span>}
{`${IndexText[index]}、 `}
{item.stageName}
</div>
{
item.open && <div className="taskItemList">
{
item.contentVOList.map((_item: any, _index: number) => {
return <div className={_index == item.contentVOList.length - 1 ? "item noBorder" : "item"}>
<div className="name">
{item.open && (
<div className='taskItemList'>
{item.contentVOList.map((_item: any, _index: number) => {
return (
<div className={_index == item.contentVOList.length - 1 ? 'item noBorder' : 'item'}>
<div className='name'>
<img className='type-option-icon' src={ENUM.LearningContentIcon[_item.courseType || _item.contentType]} />
<span style={{ marginRight: 4 }}> {`${index + 1}.${_index + 1}`}</span>
{
_item.contentName
}
{
(_item.courseType == 'LIVE') && <span className='desc'>{ENUM.courseStateShow[_item.courseState].title}</span>
}
{
_item.courseType == 'VOICE' && <span className='desc'>{`(共${_item.courseChapterNum}节)`}</span>
}
{_item.contentName}
{_item.courseType == 'LIVE' && <span className='desc'>{ENUM.courseStateShow[_item.courseState].title}</span>}
{_item.courseType == 'VOICE' && <span className='desc'>{`(共${_item.courseChapterNum}节)`}</span>}
</div>
</div>
})
}
);
})}
</div>
}
)}
</div>
})
}
);
})}
</div>
<div className="expired">
<div className="title">失效课程</div>
<div className='expired'>
<div className='title'>失效课程</div>
<div className="list">
<ExpiredCourseList expiredCourseList={list} />
<div className='list'>
<ExpiredCourseList />
</div>
</div>
</div>
);
}
export default withRouter(CourseTable)
\ No newline at end of file
export default withRouter(CourseTable);
......@@ -2,7 +2,7 @@
* @Author: yuananting
* @Date: 2021-07-29 13:57:03
* @LastEditors: yuananting
* @LastEditTime: 2021-08-16 17:03:17
* @LastEditTime: 2021-08-16 19:47:41
* @Description: 任务中心-培训任务-新建页面
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
......@@ -56,7 +56,6 @@ function AddTrainTask() {
const [percentCompleteLive, setPercentCompleteLive] = useState(80); // 完成百分比
const [percentCompleteVideo, setPercentCompleteVideo] = useState(80); // 完成百分比
const [percentCompletePicture, setPercentCompletePicture] = useState(80); // 完成百分比
const [expiredCourseList, setExpiredCourseList] = useState([]); // 失效课程
const [startCheck, setStartCheck] = useState(false); // 是否启动校验
const basicInfoRef = useRef(null);
......@@ -67,7 +66,6 @@ function AddTrainTask() {
useEffect(() => {
if (type === 'edit') {
initTaskData();
getTrainingCourseAutoCancel();
// 编辑回显数据详情
function initTaskData() {
......@@ -141,13 +139,6 @@ function AddTrainTask() {
introduceInfo && getTextDetail('introduce', introduceInfo);
});
}
// 获取培训任务失效的课程
function getTrainingCourseAutoCancel() {
TaskCenterService.getTrainingCourseAutoCancel({ taskId }).then((res) => {
setExpiredCourseList(res.result);
});
}
}
}, [taskId, type]);
......@@ -415,7 +406,6 @@ function AddTrainTask() {
<TrainContent
stageList={stageList}
basicInfo={basicInfo}
expiredCourseList={expiredCourseList}
startCheck={startCheck}
percentCompleteLive={percentCompleteLive}
percentCompleteVideo={percentCompleteVideo}
......
......@@ -2,44 +2,64 @@
* @Author: yuananting
* @Date: 2021-08-03 10:47:59
* @LastEditors: yuananting
* @LastEditTime: 2021-08-14 17:35:04
* @LastEditTime: 2021-08-16 19:48:44
* @Description: 编辑培训任务-失效课程
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
import React from 'react';
import React, { useState, useEffect } from 'react';
import { List, message, Modal } from 'antd';
import './ExpiredCourseList.less';
import ENUM from '../../enum';
import moment from 'moment';
import TaskCenterService from '@/domains/task-center-domain/TaskCenterService';
function ExpiredCourseList(props) {
function ExpiredCourseList() {
const taskId = window.getParameterByName('taskId');
const type = window.getParameterByName('type');
const [expiredCourseList, setExpiredCourseList] = useState([]); // 失效课程
useEffect(() => {
if (type === 'edit') {
getTrainingCourseAutoCancel();
}
}, []);
// 获取培训任务失效的课程
function getTrainingCourseAutoCancel() {
TaskCenterService.getTrainingCourseAutoCancel({ taskId }).then((res) => {
setExpiredCourseList(res.result);
});
}
// 移除未成功开课课程
function deLExpiredCourse(contentId) {
Modal.confirm({
content: '你确定要删除该数据内容吗?',
okText: '取消',
cancelText: '确定',
okText: '确定',
cancelText: '取消',
icon: <span className='icon iconfont default-confirm-icon'>&#xe6f4;</span>,
onOk: () => {
const params = {
taskId: window.getParameterByName('taskId'),
contentId: [contentId],
taskId,
contentIdList: [contentId],
};
TaskCenterService.deLExpiredCourse(params).then((res) => {
TaskCenterService.delTaskCancelContent(params).then((res) => {
message.success('删除成功');
getTrainingCourseAutoCancel();
});
},
});
}
return (
<div>
{expiredCourseList.length > 0 && (
<div className='expired-list-page'>
<div className='tip'>为了不影响学员学习,「未成功开课」的课程已从任务中移出,具体课程如下所示:</div>
<List
dataSource={props.expiredCourseList}
dataSource={expiredCourseList}
renderItem={(item) => (
<List.Item>
<div className='item-detail'>
......@@ -67,6 +87,8 @@ function ExpiredCourseList(props) {
)}
/>
</div>
)}
</div>
);
}
......
......@@ -2,7 +2,7 @@
* @Author: yuananting
* @Date: 2021-08-01 17:28:30
* @LastEditors: yuananting
* @LastEditTime: 2021-08-14 15:41:33
* @LastEditTime: 2021-08-16 19:53:06
* @Description: 新建培训任务-关联课程抽屉
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
......@@ -126,11 +126,13 @@ class RelatedCourseDrawer extends Component {
handleFetchVideoDataList = () => {
const { videoQuery, videoSize, videoDataSource, videoTotalCount, videoCourseDivision } = this.state;
const _data = [...this.props.data];
console.log('_data', _data);
let currentVideoCourseListData = [];
_data.map((item, index) => {
item.contentList.map((childItem, childIndex) => {
console.log('childItem', childItem);
if (childItem.courseType === 'VOICE') {
currentVideoCourseListData.push(childItem.courseId);
currentVideoCourseListData.push(childItem.contentId);
}
return childItem;
});
......@@ -168,7 +170,7 @@ class RelatedCourseDrawer extends Component {
_data.map((item, index) => {
item.contentList.map((childItem, childIndex) => {
if (childItem.courseType === 'PICTURE') {
currentPictureCourseListData.push(childItem.courseId);
currentPictureCourseListData.push(childItem.contentId);
}
return childItem;
});
......
......@@ -2,7 +2,7 @@
* @Author: yuananting
* @Date: 2021-07-30 16:33:58
* @LastEditors: yuananting
* @LastEditTime: 2021-08-16 17:06:01
* @LastEditTime: 2021-08-16 19:50:01
* @Description: 任务中心-培训任务-新建-培训内容
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
......@@ -58,7 +58,6 @@ class TrainContent extends Component {
showCourseDrawer: false,
showExamDrawer: false,
selectedStageIndex: 0,
expiredCourseList: props.expiredCourseList, // 失效课程
showStandardDetail: false, // 是否展开高级设置
};
}
......@@ -451,7 +450,6 @@ class TrainContent extends Component {
stageList,
showCourseDrawer,
showExamDrawer,
expiredCourseList,
showStandardDetail,
basicInfo,
selectedStageIndex,
......@@ -485,12 +483,9 @@ class TrainContent extends Component {
)}
{showExamDrawer && <RelatedExamDrawer basicInfo={basicInfo} stageList={stageList} onClose={this.onCloseExamDrawer} onSave={this.confirmCreateExam} />}
</div>
{window.getParameterByName('type') === 'edit' && expiredCourseList.length > 0 && (
<div className='expired-info__wrap'>
<div className='module-title'>失效课程</div>
<ExpiredCourseList expiredCourseList={expiredCourseList} />
</div>
)}
<ExpiredCourseList />
<div className='finish-standard__warp'>
<div
className='module-title'
......
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