Commit bed3f47f by yuananting

fix:关联考试弹窗未选择试卷保存提示

parent 47cba295
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: yuananting * @Author: yuananting
* @Date: 2021-08-03 17:05:32 * @Date: 2021-08-03 17:05:32
* @LastEditors: yuananting * @LastEditors: yuananting
* @LastEditTime: 2021-08-17 10:55:01 * @LastEditTime: 2021-08-18 17:25:30
* @Description: 新建培训任务-关联考试抽屉 * @Description: 新建培训任务-关联考试抽屉
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
...@@ -313,7 +313,6 @@ function RelatedExamDrawer(props) { ...@@ -313,7 +313,6 @@ function RelatedExamDrawer(props) {
}); });
} }
}); });
console.log('newContentList', newContentList);
const existedPaperId = newContentList.filter((item) => { const existedPaperId = newContentList.filter((item) => {
return item.paperId === info.paperId; return item.paperId === info.paperId;
}); });
......
...@@ -2,43 +2,50 @@ ...@@ -2,43 +2,50 @@
* @Author: yuananting * @Author: yuananting
* @Date: 2021-06-16 10:14:37 * @Date: 2021-06-16 10:14:37
* @LastEditors: yuananting * @LastEditors: yuananting
* @LastEditTime: 2021-07-27 14:04:03 * @LastEditTime: 2021-08-18 17:40:48
* @Description: 描述一下咯 * @Description: 描述一下咯
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
import React, { useState, useRef, useEffect, useContext } from 'react' import React, { useState, useRef, useEffect } from 'react';
import { message, Modal } from 'antd'; import { message, Modal } from 'antd';
import { withRouter } from 'react-router-dom'; import { withRouter } from 'react-router-dom';
import PaperContent from '../paper-manage/PaperContent' import PaperContent from '../paper-manage/PaperContent';
import './AddExam.less'; import './AddExam.less';
import user from '@/common/js/user';
function SelectPaperModal(props: any) { function SelectPaperModal(props: any) {
const [item, setItem] = useState(props.paperInfo);
const itemRef = useRef({});
const [item, setItem] = useState(props.paperInfo); useEffect(() => {
const itemRef = useRef({}) itemRef.current = item;
}, [item]);
useEffect(() => { return (
itemRef.current = item <Modal
}, [item]) maskClosable={false}
width={1080}
return <Modal title='选择试卷'
maskClosable={false} visible={true}
width={1080} centered={true}
title="选择试卷" onOk={() => {
visible={true} if (Object.keys(itemRef.current).length < 2) {
centered={true} // 培训任务中试卷对象默认长度为0,考试中试卷对象默认长度为1
onOk={() => { return message.warning('请选择试卷');
props.onSelect(itemRef.current);
props.close();
}
} }
onCancel={() => { props.close() }} props.onSelect(itemRef.current);
> props.close();
<PaperContent paperId={item.paperId} onSelect={(item: any) => { setItem(item) }} type='modal-select'></PaperContent> }}
onCancel={() => {
</Modal > props.close();
}}>
<PaperContent
paperId={item.paperId}
onSelect={(item: any) => {
setItem(item);
}}
type='modal-select'></PaperContent>
</Modal>
);
} }
export default withRouter(SelectPaperModal);
export default withRouter(SelectPaperModal);
\ No newline at end of file
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