|
@@ -148,7 +148,7 @@
|
|
|
import { calcSum, deepCopy, objTypeOf, randomCode } from "@/plugins/utils";
|
|
|
import QuestionImportPaperEdit from "./QuestionImportPaperEdit.vue";
|
|
|
import UploadButton from "@/components/UploadButton.vue";
|
|
|
-import { isAnEmptyRichText } from "@/utils/utils";
|
|
|
+import { getRichTextAnswerPointCount, isAnEmptyRichText } from "@/utils/utils";
|
|
|
import {
|
|
|
questionImportPaperSave,
|
|
|
questionImportParseRichText,
|
|
@@ -674,8 +674,8 @@ export default {
|
|
|
|
|
|
// 选项
|
|
|
if (SELECT_QUESTION.includes(questionType)) {
|
|
|
- if (!question.quesOptions.length) {
|
|
|
- qErrInfo.push(`没有选项`);
|
|
|
+ if (question.quesOptions.length < 2) {
|
|
|
+ qErrInfo.push(`选项少于2个`);
|
|
|
}
|
|
|
if (
|
|
|
question.quesOptions.some((option) =>
|
|
@@ -699,11 +699,51 @@ export default {
|
|
|
qErrInfo = [];
|
|
|
}
|
|
|
|
|
|
+ // 完形填空
|
|
|
+ if (questionType === "READING_COMPREHENSION") {
|
|
|
+ const answerPointCount = getRichTextAnswerPointCount(quesBody);
|
|
|
+ if (answerPointCount !== question.subQuestions.length) {
|
|
|
+ errInfos.push(
|
|
|
+ `第${detail.number}大题题干答题点数量与选项数不匹配`
|
|
|
+ );
|
|
|
+ }
|
|
|
+ if (
|
|
|
+ question.subQuestions.some(
|
|
|
+ (q) => q.questionType !== "SINGLE_ANSWER_QUESTION"
|
|
|
+ )
|
|
|
+ ) {
|
|
|
+ errInfos.push(`第${detail.number}大题存在不是单选题的子题`);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 听力题
|
|
|
+ if (questionType === "LISTENING_QUESTION") {
|
|
|
+ if (
|
|
|
+ question.subQuestions.some(
|
|
|
+ (q) => q.questionType !== "SINGLE_ANSWER_QUESTION"
|
|
|
+ )
|
|
|
+ ) {
|
|
|
+ errInfos.push(`第${detail.number}大题存在不是单选题的子题`);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// 选词填空、段落匹配,单用模式时校验输入答案是否重复
|
|
|
if (
|
|
|
MATCHING_QUESTION.includes(questionType) &&
|
|
|
question.quesParam.matchingMode === 1
|
|
|
) {
|
|
|
+ // 选词填空
|
|
|
+ if (questionType === "BANKED_CLOZE") {
|
|
|
+ const answerPointCount = getRichTextAnswerPointCount(quesBody);
|
|
|
+ if (answerPointCount > question.quesOptions.length) {
|
|
|
+ errInfos.push(`第${detail.number}大题题干答题点数量超过选项数`);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (question.subQuestions.length > question.quesOptions.length) {
|
|
|
+ errInfos.push(`第${detail.number}大题小题数量超过选项数`);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
let selectedAnswer = [],
|
|
|
errorQuestionIndexs = [];
|
|
|
question.subQuestions.forEach((subq, sindex) => {
|
|
@@ -718,7 +758,7 @@ export default {
|
|
|
errInfos.push(
|
|
|
`第${
|
|
|
detail.number
|
|
|
- }大题${errorQuestionIndexs.join()}小题答案重复!`
|
|
|
+ }大题${errorQuestionIndexs.join()}小题答案重复`
|
|
|
);
|
|
|
}
|
|
|
}
|
|
@@ -737,11 +777,11 @@ export default {
|
|
|
qErrInfo.push(`没有题干`);
|
|
|
}
|
|
|
if (
|
|
|
- SELECT_QUESTION.includes(subq.subqType) &&
|
|
|
+ SELECT_QUESTION.includes(subq.questionType) &&
|
|
|
!MATCHING_QUESTION.includes(questionType)
|
|
|
) {
|
|
|
- if (!subq.quesOptions.length) {
|
|
|
- qErrInfo.push(`没有选项`);
|
|
|
+ if (subq.quesOptions.length < 2) {
|
|
|
+ qErrInfo.push(`选项少于2个`);
|
|
|
}
|
|
|
if (
|
|
|
subq.quesOptions.some((option) =>
|