Commit 658b3bf3 by yuananting

feat:培训目的信息回显联调

parent 8eb4c61c
......@@ -2,7 +2,7 @@
* @Author: yuananting
* @Date: 2021-08-05 11:26:25
* @LastEditors: yuananting
* @LastEditTime: 2021-08-12 21:12:08
* @LastEditTime: 2021-08-13 10:57:19
* @Description: 个人学习详情-全部tab页
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
......@@ -94,9 +94,9 @@ function WholeData(props) {
stageCustomerList.map((item, index) => {
return (
<Panel header={renderStageInfo(item, index)} key={index}>
{/* {item.courseVOList.map((contentItem, contentIndex) => {
return renderContentInfo(contentItem, contentIndex, index);
})} */}
{item.contentVOList.map((contentItem, contentIndex) => {
return renderContentInfo(contentItem, contentIndex, index);
})}
</Panel>
);
})}
......
......@@ -2,7 +2,7 @@
* @Author: yuananting
* @Date: 2021-07-29 13:57:03
* @LastEditors: yuananting
* @LastEditTime: 2021-08-12 13:37:23
* @LastEditTime: 2021-08-13 15:11:56
* @Description: 任务中心-培训任务-新建页面
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
......@@ -20,6 +20,7 @@ import Upload from '@/core/upload';
import { randomString } from '@/domains/basic-domain/utils';
import TaskCenterService from '@/domains/task-center-domain/TaskCenterService';
import Bus from '@/core/bus';
import $ from 'jquery';
const defaultCover = 'https://image.xiaomaiketang.com/xm/rEAetaTEh3.png';
......@@ -34,6 +35,7 @@ const DEFAULT_BASIC_INFO = {
learnType: 'FREEDOM', // 学习模式,默认自由学习
assignList: [], // 指派列表-assignId assignType
introduce: null, // 培训目的
loadintroduce: false,
};
const DEFAULT_STAGE_LIST = [
......@@ -67,72 +69,96 @@ function AddTrainTask() {
useEffect(() => {
if (type === 'edit') {
TaskCenterService.getTrainingTaskDetail({
taskId,
}).then((res) => {
const {
result: {
taskName,
courseMediaVOS,
helpStoreUsers,
timeType,
startTime,
endTime,
learnType,
assignList,
percentCompleteLive,
percentCompletePicture,
percentCompleteVideo,
trainingStageList,
},
} = res;
const _assignList = assignList.map((item) => {
item.checkedId = item.assignId;
return item;
});
const coverInfo = courseMediaVOS.filter((item) => item.contentType === 'COVER')[0];
const coverUrl = coverInfo ? coverInfo.mediaUrl : defaultCover;
const coverId = coverInfo ? coverInfo.mediaContent : null;
const _helpStoreUserIds = helpStoreUsers.map((item) => {
item.checkedName = item.storeUserName;
item.checkedId = item.storeUserId;
return item;
});
initTaskData();
}
}, []);
const ITEM_BASIC_INFO = {
assignList: _assignList,
// 编辑回显数据详情
function initTaskData() {
TaskCenterService.getTrainingTaskDetail({
taskId,
}).then((res) => {
const {
result: {
taskName,
coverUrl,
coverId,
helpStoreUserIds: _helpStoreUserIds,
courseMediaVOS,
helpStoreUsers,
timeType,
startTime,
endTime,
learnType,
// introduce: null, // 培训目的
};
const ITEM_FINISH_STANDARD = {
assignList,
percentCompleteLive,
percentCompletePicture,
percentCompleteVideo,
};
trainingStageList,
},
} = res;
const _stageList = trainingStageList.map((item) => {
item.contentList = item.contentVOList;
item.type = 'text';
return item;
});
const _assignList = assignList.map((item) => {
item.checkedId = item.assignId;
return item;
});
const coverInfo = courseMediaVOS.filter((item) => item.contentType === 'COVER')[0];
const coverUrl = coverInfo ? coverInfo.mediaUrl : defaultCover;
const coverId = coverInfo ? coverInfo.mediaContent : null;
setBasicInfo(ITEM_BASIC_INFO);
setFinishStandard(ITEM_FINISH_STANDARD);
setStageList(_stageList);
const _helpStoreUserIds = helpStoreUsers.map((item) => {
item.checkedName = item.storeUserName;
item.checkedId = item.storeUserId;
return item;
});
}
}, []);
const ITEM_BASIC_INFO = {
assignList: _assignList,
taskName,
coverUrl,
coverId,
helpStoreUserIds: _helpStoreUserIds,
timeType,
startTime,
endTime,
learnType,
};
const _stageList = trainingStageList.map((item) => {
item.contentList = item.contentVOList;
item.type = 'text';
return item;
});
const introduceInfo = courseMediaVOS.filter((item) => item.contentType === 'INTRO')[0];
setBasicInfo({ ...basicInfoRef.current, ...ITEM_BASIC_INFO, loadintroduce: !introduceInfo });
setFinishStandard({
percentCompleteLive,
percentCompletePicture,
percentCompleteVideo,
});
setStageList(_stageList);
introduceInfo && getTextDetail('introduce', introduceInfo.mediaUrl);
});
}
// 获取培训目的内容
function getTextDetail(key, url) {
$.ajax({
data: {},
type: 'GET',
url,
contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
success: (res) => {
setBasicInfo({
...basicInfoRef.current,
[key]: res,
[`load${key}`]: true,
});
},
});
}
// 渲染底部操作按钮
function renderFooter() {
......@@ -169,6 +195,24 @@ function AddTrainTask() {
const { percentCompleteLive, percentCompletePicture, percentCompleteVideo } = finishStandard;
let _scheduleMediaRequests = [];
if (coverId) {
_scheduleMediaRequests.push({
contentType: 'COVER',
mediaContent: coverId,
mediaType: 'PICTURE',
});
}
if (introduceId) {
_scheduleMediaRequests.push({
contentType: 'INTRO',
mediaContent: introduceId,
mediaType: 'RESOURCE_ID',
});
}
const _stageList = stageList.map((item, index) => {
delete item.contentVOList;
delete item.check;
......@@ -196,16 +240,7 @@ function AddTrainTask() {
helpStoreUserIds: _helpStoreUserIds, // 协同者集合
issueState: issue, // 是否发布
learnType, // 学习模式
scheduleMediaRequests: coverId
? [
{
contentType: 'COVER',
mediaContent: coverId,
mediaType: 'PICTURE',
mediaUrl: coverUrl,
},
]
: [],
scheduleMediaRequests: _scheduleMediaRequests,
startTime,
storeId: User.getStoreId(),
taskName,
......@@ -262,14 +297,19 @@ function AddTrainTask() {
if (percentCompleteLive === '' || percentCompleteVideo === '' || percentCompletePicture === '') {
return message.warning('请输入完成标准');
}
Upload.uploadTextToOSS(
basicInfo.introduce,
`${randomString()}.txt`,
(introduceId) => {
submitRemote(introduceId, issue);
},
() => message.warning('上传培训目的失败')
);
if (basicInfo.introduce) {
Upload.uploadTextToOSS(
basicInfo.introduce,
`${randomString()}.txt`,
(introduceId) => {
submitRemote(introduceId, issue);
},
() => message.warning('上传培训目的失败')
);
} else {
submitRemote(null, issue);
}
}
// 返回、取消
......
......@@ -2,7 +2,7 @@
* @Author: yuananting
* @Date: 2021-07-29 14:32:24
* @LastEditors: yuananting
* @LastEditTime: 2021-08-12 15:51:24
* @LastEditTime: 2021-08-13 15:09:56
* @Description: 任务中心-培训任务-新建-基本信息
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
......@@ -28,8 +28,7 @@ function BasicInfo(props) {
const type = getParameterByName('type');
const { basicInfo, startCheck } = props;
const { taskName, coverUrl, helpStoreUserIds, timeType, startTime, endTime, learnType, assignList, introduce } = basicInfo;
console.log(assignList);
const { taskName, coverUrl, helpStoreUserIds, timeType, startTime, endTime, learnType, assignList, introduce, loadintroduce } = basicInfo;
const depAssignList = assignList.filter((item) => [0, 1].includes(item.depLevel));
const userAssignList = assignList.filter((item) => ![0, 1].includes(item.depLevel));
const [imageFile, setImageFile] = useState(null); // 需要被截取的图片
......@@ -242,9 +241,8 @@ function BasicInfo(props) {
</span>
}
required
// validateStatus={startCheck && assignList.length === 0 ? 'error' : ''}
// help={startCheck && assignList.length === 0 && '请选择培训时间'}>
>
validateStatus={startCheck && assignList.length === 0 ? 'error' : ''}
help={startCheck && assignList.length === 0 && '请选择培训时间'}>
<Button
style={{ display: 'block' }}
onClick={() => {
......@@ -324,18 +322,20 @@ function BasicInfo(props) {
)}
</FormItem>
<FormItem label='培训目的'>
<GraphicsEditor
maxLimit={1000}
id='intro'
isIntro={true}
placeholder='请输入培训目的'
detail={{
content: introduce,
}}
onChange={(val) => {
props.onChange('introduce', val);
}}
/>
{(type === 'add' || loadintroduce) && (
<GraphicsEditor
maxLimit={1000}
id='intro'
isIntro={true}
placeholder='请输入培训目的'
detail={{
content: introduce,
}}
onChange={(val) => {
props.onChange('introduce', val);
}}
/>
)}
</FormItem>
</Form>
{showSelectFileModal && (
......
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