题库管理和试卷管理代码提交

main
hujunpeng 3 months ago
parent bafbcb4de3
commit e243768f7b
  1. 6
      packages/examination/src/views/examPaper/examPaperAdd.tsx
  2. 14
      packages/examination/src/views/examPaper/examPaperList.tsx
  3. 2
      packages/examination/src/views/examPaper/examPaperView.tsx
  4. 2
      packages/examination/src/views/question/questionEdit.tsx

@ -106,7 +106,7 @@ class ExamPaperAdd extends Component<any, States> {
const newQuestions: QuestionState[] = res.data.data.map((questionData: any) => { const newQuestions: QuestionState[] = res.data.data.map((questionData: any) => {
const options = questionData.options.split(','); const options = questionData.options.split(',');
const answerOptions = options.map((option: any) => { const answerOptions = options.map((option: any) => {
const [value, label] = option.split(':'); const [value, label] = option.split('.');
return { value, label }; return { value, label };
}); });
return { return {
@ -153,7 +153,7 @@ class ExamPaperAdd extends Component<any, States> {
const newQuestions: QuestionState[] = res.data.map((questionData: any) => { const newQuestions: QuestionState[] = res.data.map((questionData: any) => {
const options = questionData.options.split(','); const options = questionData.options.split(',');
const answerOptions = options.map((option: any) => { const answerOptions = options.map((option: any) => {
const [value, label] = option.split(':'); const [value, label] = option.split('.');
return { value, label }; return { value, label };
}); });
return { return {
@ -240,7 +240,7 @@ class ExamPaperAdd extends Component<any, States> {
const newQuestions: QuestionState[] = res.data.data.map((questionData: any) => { const newQuestions: QuestionState[] = res.data.data.map((questionData: any) => {
const options = questionData.options.split(','); const options = questionData.options.split(',');
const answerOptions = options.map((option: any) => { const answerOptions = options.map((option: any) => {
const [value, label] = option.split(':'); const [value, label] = option.split('.');
return { value, label }; return { value, label };
}); });
return { return {

@ -149,6 +149,10 @@ class ExamPaperList extends Component<any, States> {
const newStatus = paperStatus === 0? 1 : 0; const newStatus = paperStatus === 0? 1 : 0;
const newStatusText = paperStatus === 0? '启用' : '停用'; const newStatusText = paperStatus === 0? '启用' : '停用';
const idList = [id]; const idList = [id];
Modal.confirm({
title: `确认${newStatusText}`,
content: `你确定要${newStatusText}这个试卷吗?`,
onOk: () => {
upPaperStatus(idList, newStatus).then((res) => { upPaperStatus(idList, newStatus).then((res) => {
const success = res['success']; const success = res['success'];
if (success) { if (success) {
@ -164,6 +168,10 @@ class ExamPaperList extends Component<any, States> {
}).catch(() => { }).catch(() => {
message.error(`${newStatusText}时发生错误,请检查`); message.error(`${newStatusText}时发生错误,请检查`);
}); });
},
onCancel: () => {
},
});
}; };
// 批量更新试卷状态 // 批量更新试卷状态
@ -269,7 +277,11 @@ class ExamPaperList extends Component<any, States> {
dataIndex: 'examDuration', dataIndex: 'examDuration',
key: 'examDuration', key: 'examDuration',
align: 'center', align: 'center',
width: 120 width: 120,
render: (examDuration: any, record: any) => {
const unit = String(record.durationType) === '1'? '分(min)' : '时(h)';
return `${examDuration} ${unit}`;
}
}, },
{ {
title: '状态', title: '状态',

@ -73,7 +73,7 @@ class ExamPaperView extends Component<any, States> {
const newQuestions: QuestionState[] = res.data.data.map((questionData: any) => { const newQuestions: QuestionState[] = res.data.data.map((questionData: any) => {
const options = questionData.options.split(','); const options = questionData.options.split(',');
const answerOptions = options.map((option: any) => { const answerOptions = options.map((option: any) => {
const [value, label] = option.split(':'); const [value, label] = option.split('.');
return { value, label }; return { value, label };
}); });
return { return {

@ -61,7 +61,7 @@ class QuestionEdit extends Component<any, States> {
formValues['answer'] = res.data.answer; formValues['answer'] = res.data.answer;
const options = res.data.options.split(','); const options = res.data.options.split(',');
options.forEach((option: any) => { options.forEach((option: any) => {
const [key, value] = option.split(':'); const [key, value] = option.split('.');
formValues[`option${key}`] = value; formValues[`option${key}`] = value;
}); });
this.formRef.current.setFieldsValue(formValues); this.formRef.current.setFieldsValue(formValues);

Loading…
Cancel
Save