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 [item, setItem] = useState(props.paperInfo);
const itemRef = useRef({}) const itemRef = useRef({});
useEffect(() => { useEffect(() => {
itemRef.current = item itemRef.current = item;
}, [item]) }, [item]);
return <Modal return (
<Modal
maskClosable={false} maskClosable={false}
width={1080} width={1080}
title="选择试卷" title='选择试卷'
visible={true} visible={true}
centered={true} centered={true}
onOk={() => { onOk={() => {
if (Object.keys(itemRef.current).length < 2) {
// 培训任务中试卷对象默认长度为0,考试中试卷对象默认长度为1
return message.warning('请选择试卷');
}
props.onSelect(itemRef.current); props.onSelect(itemRef.current);
props.close(); props.close();
} }}
} onCancel={() => {
onCancel={() => { props.close() }} props.close();
> }}>
<PaperContent paperId={item.paperId} onSelect={(item: any) => { setItem(item) }} type='modal-select'></PaperContent> <PaperContent
paperId={item.paperId}
</Modal > onSelect={(item: any) => {
setItem(item);
}}
type='modal-select'></PaperContent>
</Modal>
);
} }
export default withRouter(SelectPaperModal); export default withRouter(SelectPaperModal);
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