Commit dc7d7fd5 by yuananting

fix:培训计划编辑简介丢失问题

parent 19003b31
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: zhangleyuan * @Author: zhangleyuan
* @Date: 2021-02-20 16:13:39 * @Date: 2021-02-20 16:13:39
* @LastEditors: yuananting * @LastEditors: yuananting
* @LastEditTime: 2021-07-08 10:52:05 * @LastEditTime: 2021-07-18 13:33:22
* @Description: 描述一下 * @Description: 描述一下
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
...@@ -42,6 +42,7 @@ function AddPlan() { ...@@ -42,6 +42,7 @@ function AddPlan() {
const [hasGetDetail, setHasGetDetail] = useState(false); const [hasGetDetail, setHasGetDetail] = useState(false);
const [submitDisabled, setSubmitDisabled] = useState(false); const [submitDisabled, setSubmitDisabled] = useState(false);
const [editorTextLength, setEditorTextLength] = useState(0); const [editorTextLength, setEditorTextLength] = useState(0);
const [loadintroduce, setLoadintroduce] = useState(false);
useEffect(() => { useEffect(() => {
if (type === 'edit') { if (type === 'edit') {
...@@ -78,6 +79,7 @@ function AddPlan() { ...@@ -78,6 +79,7 @@ function AddPlan() {
let coverId; let coverId;
let coverUrl; let coverUrl;
let instro; let instro;
let hasIntro = false;
courseMediaVOS.map((item) => { courseMediaVOS.map((item) => {
switch (item.contentType) { switch (item.contentType) {
case 'COVER': case 'COVER':
...@@ -85,6 +87,7 @@ function AddPlan() { ...@@ -85,6 +87,7 @@ function AddPlan() {
coverUrl = item.mediaUrl; coverUrl = item.mediaUrl;
break; break;
case 'INTRO': case 'INTRO':
hasIntro = true;
instro = item.mediaContent; instro = item.mediaContent;
break; break;
default: default:
...@@ -114,6 +117,7 @@ function AddPlan() { ...@@ -114,6 +117,7 @@ function AddPlan() {
percentCompletePicture, percentCompletePicture,
}); });
setHasGetDetail(true); setHasGetDetail(true);
setLoadintroduce(hasIntro);
}); });
} }
function handleChangeBasicInfo(field, value, option) { function handleChangeBasicInfo(field, value, option) {
...@@ -282,7 +286,7 @@ function AddPlan() { ...@@ -282,7 +286,7 @@ function AddPlan() {
<div className='add-plan-page__form'> <div className='add-plan-page__form'>
<div className='basic-info__wrap'> <div className='basic-info__wrap'>
<div className='title'>基本信息</div> <div className='title'>基本信息</div>
<BasicInfo data={basicData} onChange={handleChangeBasicInfo} /> <BasicInfo data={{ ...basicData, loadintroduce, id}} onChange={handleChangeBasicInfo} />
</div> </div>
<div className='basic-info__wrap'> <div className='basic-info__wrap'>
<div className='title'>培训任务</div> <div className='title'>培训任务</div>
......
/* /*
* @Author: yuananting * @Author: yuananting
* @Date: 2021-07-05 10:48:08 * @Date: 2021-07-05 10:48:08
* @LastEditors: Please set LastEditors * @LastEditors: yuananting
* @LastEditTime: 2021-07-18 10:14:26 * @LastEditTime: 2021-07-18 13:32:16
* @Description: 描述一下咯 * @Description: 描述一下咯
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
...@@ -134,13 +134,13 @@ class BasicInfo extends React.Component { ...@@ -134,13 +134,13 @@ class BasicInfo extends React.Component {
}; };
changeIntro = (value) => { changeIntro = (value) => {
this.props.onChange('introduce', value); this.props.onChange('instro', value);
}; };
render() { render() {
const { operatorModalVisible, showSelectFileModal, visible, imageFile } = this.state; const { operatorModalVisible, showSelectFileModal, visible, imageFile } = this.state;
const { data } = this.props; const { data } = this.props;
const { planName, coverUrl, introduce, enableState, operateType, selectOperatorList, percentCompleteLive, percentCompleteVideo, percentCompletePicture } = const { planName, coverUrl, instro, enableState, operateType, selectOperatorList, percentCompleteLive, percentCompleteVideo, percentCompletePicture, loadintroduce, id } =
data; data;
// 当前是否使用的是默认图片 // 当前是否使用的是默认图片
const isDefaultCover = coverUrl === defaultCover; const isDefaultCover = coverUrl === defaultCover;
...@@ -183,25 +183,17 @@ class BasicInfo extends React.Component { ...@@ -183,25 +183,17 @@ class BasicInfo extends React.Component {
</div> </div>
<div className='introduction'> <div className='introduction'>
<span className='label'>简介:</span> <span className='label'>简介:</span>
{/* <TextArea {(!id || loadintroduce) && (<GraphicsEditor
placeholder='请输入培训计划简介'
maxLength={200}
style={{ width: '552px', height: '110px' }}
className='instro-textarea'
value={instro}
onChange={(e) => this.props.onChange('instro', e.target.value)}
/> */}
<GraphicsEditor
id='intro' id='intro'
isIntro={true} isIntro={true}
maxLimit={1000} maxLimit={1000}
detail={{ detail={{
content: introduce, content: instro,
}} }}
onChange={(val) => { onChange={(val) => {
this.changeIntro(val); this.changeIntro(val);
}} }}
/> />)}
</div> </div>
<div className='wether-use'> <div className='wether-use'>
<span className='label'>是否启用:</span> <span className='label'>是否启用:</span>
......
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