|
@@ -3,15 +3,16 @@
|
|
|
<div class="question-body" v-html="question.body"></div>
|
|
|
<div class="ops">
|
|
|
<div class="stu-answer"> {{stuAnswer}}</div>
|
|
|
- <i-button @click="resetQuestion(examQuestion.id)">重置</i-button>
|
|
|
<div class="score">({{question.questionScore}}分)</div>
|
|
|
</div>
|
|
|
<div v-for="(option, index) in question.options" :key="option.id" class="option" @click="toggleAnswer(index)">
|
|
|
- <input type="checkbox" name="question" value="optionName[index]" :checked="stuAnswer.includes(optionName[index])" />
|
|
|
- <span>{{optionName[index]}}: </span>
|
|
|
+ <input type="checkbox" name="question" value="optionName[index]" :checked="stuAnswer && stuAnswer.includes(optionName[index])" />
|
|
|
+ <span style="padding: 0 10px;">{{optionName[index]}}: </span>
|
|
|
<span class="question-options" v-html="option.content"></span>
|
|
|
</div>
|
|
|
-
|
|
|
+ <div class="reset">
|
|
|
+ <i-button type="warning" size="large" @click="resetQuestion(examQuestion.id)">重置答案</i-button>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -21,7 +22,6 @@ export default {
|
|
|
name: "MultipleQuestionView",
|
|
|
data() {
|
|
|
return {
|
|
|
- // question: null
|
|
|
optionName,
|
|
|
stuAnswer: this.examQuestion.stuAnswer || ""
|
|
|
};
|
|
@@ -33,7 +33,7 @@ export default {
|
|
|
methods: {
|
|
|
toggleAnswer: function(index) {
|
|
|
if (this.stuAnswer.includes(optionName[index])) {
|
|
|
- this.stuAnswer.replace(optionName[index], "");
|
|
|
+ this.stuAnswer = this.stuAnswer.replace(optionName[index], "");
|
|
|
} else {
|
|
|
this.stuAnswer = this.stuAnswer
|
|
|
.concat(optionName[index])
|
|
@@ -55,13 +55,23 @@ export default {
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
- watch: {}
|
|
|
+ watch: {
|
|
|
+ examQuestion: function() {
|
|
|
+ this.stuAnswer = this.examQuestion.stuAnswer;
|
|
|
+ }
|
|
|
+ }
|
|
|
};
|
|
|
</script>
|
|
|
|
|
|
<style scoped>
|
|
|
.question-view {
|
|
|
- display: block;
|
|
|
+ display: grid;
|
|
|
+ grid-row-gap: 10px;
|
|
|
+}
|
|
|
+
|
|
|
+.question-body {
|
|
|
+ font-size: 18px;
|
|
|
+ margin-bottom: 10px;
|
|
|
}
|
|
|
|
|
|
.ops {
|
|
@@ -72,6 +82,7 @@ export default {
|
|
|
.stu-answer {
|
|
|
width: 100px;
|
|
|
border-bottom: 1px solid black;
|
|
|
+ text-align: center;
|
|
|
}
|
|
|
|
|
|
.option {
|
|
@@ -79,6 +90,5 @@ export default {
|
|
|
}
|
|
|
.question-options {
|
|
|
text-align: left;
|
|
|
- padding-left: 10px;
|
|
|
}
|
|
|
</style>
|