|
@@ -10,6 +10,12 @@
|
|
|
</div>
|
|
|
<div class="reset">
|
|
|
<i-button type="warning" size="large" @click="resetAnswer">重置答案</i-button>
|
|
|
+ <span v-if="question.rightAnswer">
|
|
|
+ <i-button type="info" size="large" @click="showAnswer">显示答案</i-button>
|
|
|
+ </span>
|
|
|
+ <div v-if="question.rightAnswer && isShowAnswer">
|
|
|
+ 正确答案:<div v-html="rightAnswerTransform" class="right-answer-section"></div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -25,7 +31,6 @@ const { mapMutations } = createNamespacedHelpers("examingHomeModule");
|
|
|
* 3. 输入框失去焦点,提交答案
|
|
|
* 4. 切换页面,this.studentAnswer从examQuestion获得数据
|
|
|
*
|
|
|
- * FIXME: question没有更新。。。。
|
|
|
* */
|
|
|
|
|
|
export default {
|
|
@@ -33,7 +38,8 @@ export default {
|
|
|
data() {
|
|
|
return {
|
|
|
studentAnswer: "",
|
|
|
- questionBody: ""
|
|
|
+ questionBody: "",
|
|
|
+ isShowAnswer: false
|
|
|
};
|
|
|
},
|
|
|
props: {
|
|
@@ -90,6 +96,9 @@ export default {
|
|
|
});
|
|
|
this.examQuestion.studentAnswer = null;
|
|
|
this.prepareData();
|
|
|
+ },
|
|
|
+ showAnswer() {
|
|
|
+ this.isShowAnswer = !this.isShowAnswer;
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
@@ -120,6 +129,22 @@ export default {
|
|
|
computed: {
|
|
|
isSyncState() {
|
|
|
return this.examQuestion.order == this.$route.params.order;
|
|
|
+ },
|
|
|
+ rightAnswerTransform() {
|
|
|
+ // if (
|
|
|
+ // this.question.rightAnswer &&
|
|
|
+ // !this.question.rightAnswer.join("").includes("##")
|
|
|
+ // ) {
|
|
|
+ // return this.question.rightAnswer;
|
|
|
+ // }
|
|
|
+ return (
|
|
|
+ this.question.rightAnswer &&
|
|
|
+ this.question.rightAnswer
|
|
|
+ .join("")
|
|
|
+ .split("##")
|
|
|
+ .map((v, i) => `${i + 1}、${v}<br>`)
|
|
|
+ .join("")
|
|
|
+ );
|
|
|
}
|
|
|
},
|
|
|
components: {
|
|
@@ -161,3 +186,9 @@ export default {
|
|
|
padding-right: 10px;
|
|
|
}
|
|
|
</style>
|
|
|
+
|
|
|
+<style>
|
|
|
+div.right-answer-section > p {
|
|
|
+ display: inline;
|
|
|
+}
|
|
|
+</style>
|