Commit bed3f47f by yuananting

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

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