|
@@ -3,6 +3,10 @@
|
|
<div class="sign-button">
|
|
<div class="sign-button">
|
|
<Icon :type="examQuestion.isSign ? 'ios-star':'ios-star-outline'" :style="{color: '#ffcc00'}" class="star" @click="toggleSign" />
|
|
<Icon :type="examQuestion.isSign ? 'ios-star':'ios-star-outline'" :style="{color: '#ffcc00'}" class="star" @click="toggleSign" />
|
|
</div>
|
|
</div>
|
|
|
|
+ <div v-if="parentQuestionBody" class="question-view">
|
|
|
|
+ <question-body :questionBody="parentQuestionBody" :examQuestionId="examQuestion.id" style="margin-bottom: 20px"></question-body>
|
|
|
|
+ <div class="hr" />
|
|
|
|
+ </div>
|
|
<template v-if="question.questionType === 'SINGLE_CHOICE'">
|
|
<template v-if="question.questionType === 'SINGLE_CHOICE'">
|
|
<single-question-view :question="question" :examQuestion="examQuestion" />
|
|
<single-question-view :question="question" :examQuestion="examQuestion" />
|
|
</template>
|
|
</template>
|
|
@@ -18,13 +22,11 @@
|
|
<template v-if="question.questionType === 'ESSAY'">
|
|
<template v-if="question.questionType === 'ESSAY'">
|
|
<text-question-view :question="question" :examQuestion="examQuestion" />
|
|
<text-question-view :question="question" :examQuestion="examQuestion" />
|
|
</template>
|
|
</template>
|
|
- <template v-if="examQuestion.parentQuestion">
|
|
|
|
- <nested-question-view :question="question" :examQuestion="examQuestion" />
|
|
|
|
- </template>
|
|
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
|
+import QuestionBody from "./QuestionBody";
|
|
import SingleQuestionView from "./SingleQuestionView";
|
|
import SingleQuestionView from "./SingleQuestionView";
|
|
import MultipleQuestionView from "./MultipleQuestionView";
|
|
import MultipleQuestionView from "./MultipleQuestionView";
|
|
import BooleanQuestionView from "./BooleanQuestionView";
|
|
import BooleanQuestionView from "./BooleanQuestionView";
|
|
@@ -38,6 +40,7 @@ export default {
|
|
name: "QuestionView",
|
|
name: "QuestionView",
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
|
|
+ parentQuestionBody: null,
|
|
question: null
|
|
question: null
|
|
};
|
|
};
|
|
},
|
|
},
|
|
@@ -74,19 +77,24 @@ export default {
|
|
return "__" + parseInt(b) + "__";
|
|
return "__" + parseInt(b) + "__";
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
+ // console.log(repQuestion);
|
|
};
|
|
};
|
|
const initQuestion = function(repQuestion) {
|
|
const initQuestion = function(repQuestion) {
|
|
if (
|
|
if (
|
|
- repQuestion.questionType === "SINGLE_ANSWER_QUESTION" ||
|
|
|
|
- repQuestion.questionType === "MULTIPLE_ANSWER_QUESTION"
|
|
|
|
|
|
+ repQuestion.questionType === "SINGLE_CHOICE" ||
|
|
|
|
+ repQuestion.questionType === "MULTIPLE_CHOICE"
|
|
) {
|
|
) {
|
|
- for (var i = 0, imax = repQuestion.options.length; i < imax; i++) {
|
|
|
|
|
|
+ for (
|
|
|
|
+ var i = 0, imax = repQuestion.questionOptionList.length;
|
|
|
|
+ i < imax;
|
|
|
|
+ i++
|
|
|
|
+ ) {
|
|
// repQuestion.options[i].content = $sce.trustAsHtml(
|
|
// repQuestion.options[i].content = $sce.trustAsHtml(
|
|
// repQuestion.options[i].content
|
|
// repQuestion.options[i].content
|
|
// );
|
|
// );
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if (repQuestion.questionType === "FILL_BLANK_QUESTION") {
|
|
|
|
|
|
+ if (repQuestion.questionType === "FILL_UP") {
|
|
if (repQuestion.answer && repQuestion.answer.indexOf("##") > -1) {
|
|
if (repQuestion.answer && repQuestion.answer.indexOf("##") > -1) {
|
|
//优先使用##
|
|
//优先使用##
|
|
repQuestion.answerList = repQuestion.answer.split("##");
|
|
repQuestion.answerList = repQuestion.answer.split("##");
|
|
@@ -101,26 +109,35 @@ export default {
|
|
//判断是否为套题
|
|
//判断是否为套题
|
|
if (question.body) {
|
|
if (question.body) {
|
|
transferWellNumberAndTrustInBody(question);
|
|
transferWellNumberAndTrustInBody(question);
|
|
- for (var j = 0, jmax = question.subQuestionList.length; j < jmax; j++) {
|
|
|
|
- initQuestion(question.subQuestionList[j]);
|
|
|
|
|
|
+ for (
|
|
|
|
+ var j = 0, jmax = question.questionUnitList.length;
|
|
|
|
+ j < jmax;
|
|
|
|
+ j++
|
|
|
|
+ ) {
|
|
|
|
+ initQuestion(question.questionUnitList[j]);
|
|
}
|
|
}
|
|
// 对子题进行排序
|
|
// 对子题进行排序
|
|
- if (question.subQuestionList && question.subQuestionList.length > 0) {
|
|
|
|
- question.subQuestionList.sort(function(a, b) {
|
|
|
|
- if (a.quesNumber > b.quesNumber) {
|
|
|
|
- return 1;
|
|
|
|
- } else if (a.quesNumber < b.quesNumber) {
|
|
|
|
- return -1;
|
|
|
|
- } else {
|
|
|
|
- return 0;
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
|
|
+ // if (question.questionUnitList && question.questionUnitList.length > 0) {
|
|
|
|
+ // question.questionUnitList.sort(function(a, b) {
|
|
|
|
+ // if (a.quesNumber > b.quesNumber) {
|
|
|
|
+ // return 1;
|
|
|
|
+ // } else if (a.quesNumber < b.quesNumber) {
|
|
|
|
+ // return -1;
|
|
|
|
+ // } else {
|
|
|
|
+ // return 0;
|
|
|
|
+ // }
|
|
|
|
+ // });
|
|
|
|
+ // }
|
|
|
|
+ this.parentQuestionBody = question.body;
|
|
} else {
|
|
} else {
|
|
- initQuestion(question.questionUnitList[0]);
|
|
|
|
|
|
+ this.parentQuestionBody = null;
|
|
|
|
+ initQuestion(
|
|
|
|
+ question.questionUnitList[this.examQuestion.subNumber - 1]
|
|
|
|
+ );
|
|
}
|
|
}
|
|
|
|
|
|
- this.question = question.questionUnitList[0];
|
|
|
|
|
|
+ this.question =
|
|
|
|
+ question.questionUnitList[this.examQuestion.subNumber - 1];
|
|
},
|
|
},
|
|
async toggleSign() {
|
|
async toggleSign() {
|
|
await this.$http.post(
|
|
await this.$http.post(
|
|
@@ -144,6 +161,7 @@ export default {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
components: {
|
|
components: {
|
|
|
|
+ QuestionBody,
|
|
SingleQuestionView,
|
|
SingleQuestionView,
|
|
MultipleQuestionView,
|
|
MultipleQuestionView,
|
|
BooleanQuestionView,
|
|
BooleanQuestionView,
|
|
@@ -166,4 +184,8 @@ export default {
|
|
.star:hover {
|
|
.star:hover {
|
|
cursor: pointer;
|
|
cursor: pointer;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+div.hr {
|
|
|
|
+ border-bottom: 1px dashed gray;
|
|
|
|
+}
|
|
</style>
|
|
</style>
|