Commit 658b3bf3 by yuananting

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

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