|
@@ -425,11 +425,11 @@
|
|
<rich-text :text-json="quesOption.optionBody"></rich-text>
|
|
<rich-text :text-json="quesOption.optionBody"></rich-text>
|
|
</div>
|
|
</div>
|
|
<div v-if="!isNested(paperDetailUnit.questionType)">
|
|
<div v-if="!isNested(paperDetailUnit.questionType)">
|
|
- <div v-show="quesAnswerShow">
|
|
|
|
|
|
+ <div v-show="quesAnswerShow" class="paper-answer">
|
|
<span>答案:</span>
|
|
<span>答案:</span>
|
|
- <rich-text
|
|
|
|
- :text-json="paperDetailUnit.question.quesAnswer"
|
|
|
|
- ></rich-text>
|
|
|
|
|
|
+ <question-answer
|
|
|
|
+ :data="paperDetailUnit.question"
|
|
|
|
+ ></question-answer>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@@ -545,9 +545,9 @@
|
|
></rich-text>
|
|
></rich-text>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
- <div v-show="quesAnswerShow">
|
|
|
|
|
|
+ <div v-show="quesAnswerShow" class="paper-answer">
|
|
<span>答案:</span>
|
|
<span>答案:</span>
|
|
- <rich-text :text-json="subQuestion.quesAnswer"></rich-text>
|
|
|
|
|
|
+ <question-answer :data="subQuestion"></question-answer>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div v-show="quesTagShow" class="edit-property">
|
|
<div v-show="quesTagShow" class="edit-property">
|
|
@@ -841,7 +841,11 @@
|
|
</el-row>
|
|
</el-row>
|
|
<!-- end by weiwenhai -->
|
|
<!-- end by weiwenhai -->
|
|
<el-form-item label="题目">
|
|
<el-form-item label="题目">
|
|
- <v-editor v-model="quesModel.quesBody"></v-editor>
|
|
|
|
|
|
+ <v-editor
|
|
|
|
+ v-model="quesModel.quesBody"
|
|
|
|
+ :enable-answer-point="enableAnswerPoint"
|
|
|
|
+ @change="quesBodyChange"
|
|
|
|
+ ></v-editor>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item
|
|
<el-form-item
|
|
v-for="(quesOption, optIndex) in quesModel.quesOptions"
|
|
v-for="(quesOption, optIndex) in quesModel.quesOptions"
|
|
@@ -917,7 +921,7 @@
|
|
"
|
|
"
|
|
class="option-body"
|
|
class="option-body"
|
|
>
|
|
>
|
|
- <span v-html="quesOption.optionBody"></span>
|
|
|
|
|
|
+ <rich-text :text-json="quesOption.optionBody"></rich-text>
|
|
</div>
|
|
</div>
|
|
<div
|
|
<div
|
|
v-if="
|
|
v-if="
|
|
@@ -951,15 +955,34 @@
|
|
</el-button>
|
|
</el-button>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<!-- 答案 -->
|
|
<!-- 答案 -->
|
|
- <!-- 填空,简答 -->
|
|
|
|
- <div
|
|
|
|
- v-if="
|
|
|
|
- quesModel.questionType == 'TEXT_ANSWER_QUESTION' ||
|
|
|
|
- quesModel.questionType == 'FILL_BLANK_QUESTION'
|
|
|
|
- "
|
|
|
|
- >
|
|
|
|
- <el-form-item label="答案">
|
|
|
|
- <v-editor v-model="quesModel.quesAnswer"></v-editor>
|
|
|
|
|
|
+ <!-- 填空 -->
|
|
|
|
+ <div v-if="quesModel.questionType == 'FILL_BLANK_QUESTION'">
|
|
|
|
+ <el-form-item label="答案" prop="quesAnswer">
|
|
|
|
+ <div v-if="quesAnswer" class="option-list">
|
|
|
|
+ <div
|
|
|
|
+ v-for="(opt, index) of quesAnswer"
|
|
|
|
+ :key="index"
|
|
|
|
+ class="option-item"
|
|
|
|
+ >
|
|
|
|
+ <div class="option-item-info">
|
|
|
|
+ <span>({{ index + 1 }})</span>
|
|
|
|
+ </div>
|
|
|
|
+ <v-editor
|
|
|
|
+ :value="opt"
|
|
|
|
+ class="option-item-body"
|
|
|
|
+ @change="(val) => updateAnswerPoint(index, val)"
|
|
|
|
+ />
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </div>
|
|
|
|
+ <!-- 简答 -->
|
|
|
|
+ <div v-if="quesModel.questionType === 'TEXT_ANSWER_QUESTION'">
|
|
|
|
+ <el-form-item label="答案" prop="quesAnswer">
|
|
|
|
+ <v-editor
|
|
|
|
+ v-model="quesAnswer"
|
|
|
|
+ @change="textAnswerChange"
|
|
|
|
+ ></v-editor>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</div>
|
|
</div>
|
|
<!-- 单选或多选 -->
|
|
<!-- 单选或多选 -->
|
|
@@ -975,13 +998,17 @@
|
|
</div>
|
|
</div>
|
|
<!-- 判断 -->
|
|
<!-- 判断 -->
|
|
<div v-if="quesModel.questionType == 'BOOL_ANSWER_QUESTION'">
|
|
<div v-if="quesModel.questionType == 'BOOL_ANSWER_QUESTION'">
|
|
- <el-form-item label="答案" prop="quesAnswer">
|
|
|
|
- <el-select v-model="quesModel.quesAnswer" placeholder="请选择">
|
|
|
|
|
|
+ <el-form-item label="答案">
|
|
|
|
+ <el-select
|
|
|
|
+ v-model="quesAnswer"
|
|
|
|
+ placeholder="请选择"
|
|
|
|
+ @change="boolAnswerChange"
|
|
|
|
+ >
|
|
<el-option
|
|
<el-option
|
|
v-for="op in options"
|
|
v-for="op in options"
|
|
- :key="op"
|
|
|
|
- :label="op"
|
|
|
|
- :value="op"
|
|
|
|
|
|
+ :key="op.value"
|
|
|
|
+ :label="op.label"
|
|
|
|
+ :value="op.value"
|
|
>
|
|
>
|
|
</el-option>
|
|
</el-option>
|
|
</el-select>
|
|
</el-select>
|
|
@@ -1242,13 +1269,24 @@ export default {
|
|
questionTypes: QUESTION_TYPES,
|
|
questionTypes: QUESTION_TYPES,
|
|
questionType: "",
|
|
questionType: "",
|
|
quesModel: { quesProperties: [] },
|
|
quesModel: { quesProperties: [] },
|
|
|
|
+ quesAnswer: null,
|
|
|
|
+ prevAnswerPointCount: 0,
|
|
editpaperDetail: {},
|
|
editpaperDetail: {},
|
|
reduplicateQuestions: [],
|
|
reduplicateQuestions: [],
|
|
reduplicateGroup: [],
|
|
reduplicateGroup: [],
|
|
reduplicateQuesColor: [],
|
|
reduplicateQuesColor: [],
|
|
singleRightAnswer: "", //接收单选答案
|
|
singleRightAnswer: "", //接收单选答案
|
|
multipleRightAnswer: [], //接收多选答案
|
|
multipleRightAnswer: [], //接收多选答案
|
|
- options: ["正确", "错误"],
|
|
|
|
|
|
+ options: [
|
|
|
|
+ {
|
|
|
|
+ value: 0,
|
|
|
|
+ label: "错误",
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ value: 1,
|
|
|
|
+ label: "正确",
|
|
|
|
+ },
|
|
|
|
+ ],
|
|
duplicateLoading: false,
|
|
duplicateLoading: false,
|
|
dialogRadioFile: false,
|
|
dialogRadioFile: false,
|
|
dialogAnswerFile: false,
|
|
dialogAnswerFile: false,
|
|
@@ -1340,6 +1378,13 @@ export default {
|
|
}
|
|
}
|
|
return this.quesModel.quesAnswer;
|
|
return this.quesModel.quesAnswer;
|
|
},
|
|
},
|
|
|
|
+ enableAnswerPoint() {
|
|
|
|
+ return (
|
|
|
|
+ this.quesModel.questionType == "FILL_BLANK_QUESTION" ||
|
|
|
|
+ this.quesModel.questionType == "CLOZE" ||
|
|
|
|
+ this.quesModel.questionType == "BANKED_CLOZE"
|
|
|
|
+ );
|
|
|
|
+ },
|
|
},
|
|
},
|
|
created() {
|
|
created() {
|
|
let qt = sessionStorage.getItem("quesTagShow");
|
|
let qt = sessionStorage.getItem("quesTagShow");
|
|
@@ -1980,18 +2025,21 @@ export default {
|
|
this.quesModel.answerType = "DIVERSIFIED_TEXT";
|
|
this.quesModel.answerType = "DIVERSIFIED_TEXT";
|
|
}
|
|
}
|
|
|
|
|
|
- if (this.quesModel.questionType == "FILL_BLANK_QUESTION") {
|
|
|
|
- this.quesModel.quesBody = this.quesModel.quesBody.replace(
|
|
|
|
- /______/g,
|
|
|
|
- "###"
|
|
|
|
- );
|
|
|
|
- }
|
|
|
|
- if (this.isNested(this.quesModel.questionType)) {
|
|
|
|
- this.quesModel.quesBody = this.quesModel.quesBody.replace(
|
|
|
|
- /___([1-9][0-9]*)___/g,
|
|
|
|
- "##$1##"
|
|
|
|
- );
|
|
|
|
|
|
+ if (this.quesModel.questionType === "BOOL_ANSWER_QUESTION") {
|
|
|
|
+ this.quesAnswer = this.quesModel.quesAnswer === "true" ? 1 : 0;
|
|
|
|
+ } else if (this.quesModel.questionType === "TEXT_ANSWER_QUESTION") {
|
|
|
|
+ const answer = JSON.parse(this.quesModel.quesAnswer);
|
|
|
|
+ this.quesAnswer = answer[0];
|
|
|
|
+ } else if (this.quesModel.questionType == "FILL_BLANK_QUESTION") {
|
|
|
|
+ const answer = JSON.parse(this.quesModel.quesAnswer);
|
|
|
|
+ this.quesAnswer = answer;
|
|
|
|
+ } else {
|
|
|
|
+ this.quesAnswer = null;
|
|
}
|
|
}
|
|
|
|
+ this.prevAnswerPointCount = this.getAnswerPointCount(
|
|
|
|
+ this.quesModel.quesBody
|
|
|
|
+ );
|
|
|
|
+
|
|
this.assignAnswers(); //给singleRightAnswer或multipleRightAnswer赋值
|
|
this.assignAnswers(); //给singleRightAnswer或multipleRightAnswer赋值
|
|
this.openQuesDialog();
|
|
this.openQuesDialog();
|
|
},
|
|
},
|
|
@@ -2017,6 +2065,49 @@ export default {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
+ boolAnswerChange(val) {
|
|
|
|
+ this.quesModel.quesAnswer = val ? "true" : "false";
|
|
|
|
+ },
|
|
|
|
+ textAnswerChange(val) {
|
|
|
|
+ this.quesModel.quesAnswer = JSON.stringify([val]);
|
|
|
|
+ },
|
|
|
|
+ resetNumberAndSaveAnswerPoints(answer) {
|
|
|
|
+ this.quesAnswer = answer.map((element, index) => {
|
|
|
|
+ element.index = index + 1;
|
|
|
|
+ return element;
|
|
|
|
+ });
|
|
|
|
+ this.quesModel.quesAnswer = JSON.stringify(this.quesAnswer);
|
|
|
|
+ },
|
|
|
|
+ updateAnswerPoint(index, value) {
|
|
|
|
+ // console.log(index, this.question.answer[index]);
|
|
|
|
+ this.quesAnswer[index] = { ...value };
|
|
|
|
+ this.resetNumberAndSaveAnswerPoints(this.quesAnswer);
|
|
|
|
+ },
|
|
|
|
+ getAnswerPointCount(bodyJson) {
|
|
|
|
+ let count = 0;
|
|
|
|
+ bodyJson.sections.forEach((section) => {
|
|
|
|
+ section.blocks.forEach((block) => {
|
|
|
|
+ if (block.type === "cloze") count++;
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ return count;
|
|
|
|
+ },
|
|
|
|
+ quesBodyChange(quesBodyJson) {
|
|
|
|
+ this.quesModel.quesBody = quesBodyJson;
|
|
|
|
+
|
|
|
|
+ if (this.quesModel.questionType == "FILL_BLANK_QUESTION") {
|
|
|
|
+ let curPonitCount = this.getAnswerPointCount(quesBodyJson);
|
|
|
|
+ if (curPonitCount === this.prevAnswerPointCount) return;
|
|
|
|
+ this.prevAnswerPointCount = curPonitCount;
|
|
|
|
+
|
|
|
|
+ let newAnswer = [];
|
|
|
|
+ for (let i = 0; i < curPonitCount; i++) {
|
|
|
|
+ newAnswer.push(this.quesAnswer[i] || { sections: [] });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.resetNumberAndSaveAnswerPoints(newAnswer);
|
|
|
|
+ }
|
|
|
|
+ },
|
|
//打开修改试题编辑框
|
|
//打开修改试题编辑框
|
|
openQuesDialog() {
|
|
openQuesDialog() {
|
|
this.quesDialog = true;
|
|
this.quesDialog = true;
|
|
@@ -2218,6 +2309,16 @@ export default {
|
|
});
|
|
});
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
+ if (this.enableAnswerPoint) {
|
|
|
|
+ const pointCount = this.getAnswerPointCount(this.quesModel.quesBody);
|
|
|
|
+ if (!pointCount) {
|
|
|
|
+ this.$notify({
|
|
|
|
+ message: "请插入答题点",
|
|
|
|
+ type: "error",
|
|
|
|
+ });
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
if (this.paper.paperType == "GENERATE") {
|
|
if (this.paper.paperType == "GENERATE") {
|
|
this.$confirm(
|
|
this.$confirm(
|
|
"试题内容修改,会影响所有关联试卷,是否确定进行?",
|
|
"试题内容修改,会影响所有关联试卷,是否确定进行?",
|