试题和试卷代码修改

main
hujunpeng 3 months ago
parent c5862c589d
commit 09876b72ee
  1. 11
      packages/examination/src/views/examPaper/examPaperAdd.tsx
  2. 20
      packages/examination/src/views/examPaper/examPaperList.tsx
  3. 14
      packages/examination/src/views/question/questionList.tsx

@ -206,7 +206,7 @@ class ExamPaperAdd extends Component<any, States> {
// 手动选题
handleOpenModal = () => {
const { questions, selectedQuestionList } = this.state;
this.formRef.current.validateFields(['industryId'])
this.formRef.current.validateFields(['industryId', 'questionCount'])
.then((values: any) => {
const industryId = values.industryId;
const questionCount = values.questionCount;
@ -313,7 +313,6 @@ class ExamPaperAdd extends Component<any, States> {
if (this.formRefSub.current) {
this.formRefSub.current.resetFields();
}
this.formRef.current.setFieldsValue({ questionCount : selectedQuestionList.length });
};
// 保存试卷
@ -367,7 +366,7 @@ class ExamPaperAdd extends Component<any, States> {
selectedRowKeys,
skipValidation,
questionCountSum,
total
selectedParams
} = this.state;
const changePage = (current: number, pageSize: number) => {
@ -695,7 +694,7 @@ class ExamPaperAdd extends Component<any, States> {
<div>
<h3 style={{fontWeight: 'bold'}}></h3>
<div style={{textAlign: 'right'}}>
{selectedQuestionList.length}/{total}
{selectedQuestionList.length}/{selectedParams.questionCount}
</div>
<Table
dataSource={selectedQuestionList}
@ -777,6 +776,10 @@ class ExamPaperAdd extends Component<any, States> {
item => !deselectedIds.includes(item.id)
);
if(finalSelectedQuestionList.length > selectedParams.questionCount){
message.warning('选择的问题数量超过了允许的最大题目数量');
return;
}
const selectedRowKeys = finalSelectedQuestionList.map(item => String(item.id));
this.setState({
selectedQuestionList: finalSelectedQuestionList,

@ -323,12 +323,20 @@ class ExamPaperList extends Component<any, States> {
width: 200,
render: (record: any) => [
<span className='mr10 link' onClick={() => {
this.props.history.push({
pathname: '/examPaperAdd',
state: {
id: String(record.id),
isEdit: "true"
}
Modal.confirm({
title: `确认修改`,
content: `是否修改试卷?`,
onOk: () => {
this.props.history.push({
pathname: '/examPaperAdd',
state: {
id: String(record.id),
isEdit: "true"
}
});
},
onCancel: () => {
},
});
}}></span>,
<span className='mr10 link' onClick={() => {

@ -266,9 +266,17 @@ class QuestionList extends Component<any, States> {
this.handleDeleteQuestion(record.id);
}}></span>,
<span className="mr10 link" onClick={() => {
this.props.history.push({
pathname: '/questionEdit',
state: { id: record.id }
Modal.confirm({
title: `确认修改`,
content: `是否修改试题?`,
onOk: () => {
this.props.history.push({
pathname: '/questionEdit',
state: { id: record.id }
});
},
onCancel: () => {
},
});
}}></span>
]

Loading…
Cancel
Save