|
|
@@ -10,8 +10,11 @@
|
|
|
<div>上次得分:{{!isEmpty(answersInfo.score) ? answersInfo.score : '无提交历史'}}</div>
|
|
|
<div>最近提交:{{!isEmpty(answersInfo.submitAt) ? momentFromNow(answersInfo.submitAt) : '无提交历史'}}</div>
|
|
|
</div>
|
|
|
+ <div v-if="answersInfo.submitNumber && answersInfo.score !== 100" class="wrong mb-12 wrong-tip">本标志为上次提交错题</div>
|
|
|
<template v-for="(question, index) in questions">
|
|
|
<do-quiz-question-card @choice="handleChoice" :key="question.id" :question-prop="question"
|
|
|
+ :marked-prop="interactiveMap ? interactiveMap[question.id].marked : false"
|
|
|
+ :rate-prop="interactiveMap ? interactiveMap[question.id].rate : 0"
|
|
|
:index="index"></do-quiz-question-card>
|
|
|
</template>
|
|
|
<div class="mt-24">
|
|
|
@@ -26,7 +29,7 @@ import { createDefaultQuiz } from '@/views/quiz/utils/default'
|
|
|
import QuestionKind from '@/enums/question-kind'
|
|
|
import CButton from '@/components/Basic/CButton'
|
|
|
import { getOneQuiz, getOneQuizStudentAnswer, submitQuizStudentAnswer } from '@/server/quiz'
|
|
|
-import { getQuestionsByQuiz } from '@/server/question'
|
|
|
+import { getInteractiveList, getQuestionsByQuiz } from '@/server/question'
|
|
|
import momentFromNow from '@/utils/moment-from-now'
|
|
|
import { isEmpty } from '@/utils/types'
|
|
|
import DoQuizQuestionCard from '@/views/quiz/components/DoQuizQuestionCard'
|
|
|
@@ -47,6 +50,7 @@ export default {
|
|
|
score: null,
|
|
|
submitAt: null
|
|
|
},
|
|
|
+ interactiveMap: null,
|
|
|
|
|
|
// 做题起止时间相关,时间为了方便加减采用毫秒表示
|
|
|
lastDate: new Date().valueOf(),
|
|
|
@@ -94,11 +98,25 @@ export default {
|
|
|
}).catch(err => {
|
|
|
this.$setErrorMessage(err.response.data.msg)
|
|
|
})
|
|
|
+ // 获取评分和是否收藏
|
|
|
+ getInteractiveList({
|
|
|
+ questionIdJoinByComma: this.questions.map(_ => _.id).join(',')
|
|
|
+ }).then(res => {
|
|
|
+ const tempMap = {}
|
|
|
+ res.forEach(item => {
|
|
|
+ tempMap[item.questionId] = { marked: item.collection, rate: item.rate }
|
|
|
+ })
|
|
|
+ this.interactiveMap = tempMap
|
|
|
+ }).catch(err => this.$setErrorMessage(err.response.data.msg))
|
|
|
}).catch(err => this.$setErrorMessage(err.response.data.msg))
|
|
|
},
|
|
|
handleFormSubmit () {
|
|
|
const { quizId } = this.$route.params
|
|
|
- this.questionPointer !== -1 && this.pushRecord({ questionId: this.questionPointer, startAt: this.lastDate, endAt: this.choiceDate })
|
|
|
+ this.questionPointer !== -1 && this.pushRecord({
|
|
|
+ questionId: this.questionPointer,
|
|
|
+ startAt: this.lastDate,
|
|
|
+ endAt: this.choiceDate
|
|
|
+ })
|
|
|
const answers = {}
|
|
|
let uncompleted = false
|
|
|
this.questions.map(question => {
|
|
|
@@ -189,7 +207,16 @@ export default {
|
|
|
.do-quiz-question-card:nth-child(2n) {
|
|
|
background-color: #f7f7f7;
|
|
|
}
|
|
|
+
|
|
|
.do-quiz-question-card:nth-child(2n + 1) {
|
|
|
background-color: #fff;
|
|
|
}
|
|
|
+
|
|
|
+.wrong {
|
|
|
+ border-left: 6px solid $theme-red;
|
|
|
+}
|
|
|
+
|
|
|
+.wrong-tip {
|
|
|
+ padding-left: 12px;
|
|
|
+}
|
|
|
</style>
|