|
@@ -7,17 +7,18 @@
|
|
|
提交次数:
|
|
提交次数:
|
|
|
<span :class="answersInfo.submitNumber === quiz.maxSubmitTime ? 'red' : null">{{answersInfo.submitNumber ? answersInfo.submitNumber : 0}} / {{quiz.maxSubmitTime}}</span>
|
|
<span :class="answersInfo.submitNumber === quiz.maxSubmitTime ? 'red' : null">{{answersInfo.submitNumber ? answersInfo.submitNumber : 0}} / {{quiz.maxSubmitTime}}</span>
|
|
|
</div>
|
|
</div>
|
|
|
- <div>上次得分:{{answersInfo.score ? answersInfo.score : '无提交历史'}}</div>
|
|
|
|
|
- <div>最近提交:{{submitAt ? momentFromNow(answersInfo.submitAt) : '无提交历史'}}</div>
|
|
|
|
|
|
|
+ <div>上次得分:{{!isEmpty(answersInfo.score) ? answersInfo.score : '无提交历史'}}</div>
|
|
|
|
|
+ <div>最近提交:{{!isEmpty(answersInfo.submitAt) ? momentFromNow(answersInfo.submitAt) : '无提交历史'}}</div>
|
|
|
</div>
|
|
</div>
|
|
|
- <div class="quiz-list mb-16" :key="question.id" v-for="(question, index) in questions">
|
|
|
|
|
- <div class="quiz-list__index">{{ index + 1 }}.</div>
|
|
|
|
|
|
|
+ <div class="quiz-list-item" :key="question.id" v-for="(question, index) in questions"
|
|
|
|
|
+ :class="question.studentAnswer.correct ? 'correct' : 'wrong'">
|
|
|
|
|
+ <div class="quiz-list-item__index">{{ index + 1 }}.</div>
|
|
|
<div>
|
|
<div>
|
|
|
- <markdown-section :raw="question.stem"/>
|
|
|
|
|
|
|
+ <markdown-section class="quiz-list-item-title" :raw="question.stem"/>
|
|
|
<div v-if="question.type === QuestionKind.choice">
|
|
<div v-if="question.type === QuestionKind.choice">
|
|
|
<label class="option" :key="index" v-for="(item, index) in question.options">
|
|
<label class="option" :key="index" v-for="(item, index) in question.options">
|
|
|
- <input v-model="question.studentAnswer" type="radio" :value="index"/>
|
|
|
|
|
- {{ index }}.
|
|
|
|
|
|
|
+ <input v-model="question.studentAnswer.answer" type="radio" :value="index"/>
|
|
|
|
|
+ <b class="mr-8">{{ index }}.</b>
|
|
|
<markdown-section style="display: inline" :raw="item"/>
|
|
<markdown-section style="display: inline" :raw="item"/>
|
|
|
</label>
|
|
</label>
|
|
|
</div>
|
|
</div>
|
|
@@ -33,7 +34,9 @@
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
- <c-button class="mb-16" theme="green" icon="check">提交答案</c-button>
|
|
|
|
|
|
|
+ <div class="mt-24">
|
|
|
|
|
+ <c-button class="mb-16" theme="green" icon="check">提交答案</c-button>
|
|
|
|
|
+ </div>
|
|
|
</form>
|
|
</form>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
@@ -47,6 +50,7 @@ import CIcon from '@/components/Basic/CIcon'
|
|
|
import { getOneQuiz, getOneQuizStudentAnswer, submitQuizStudentAnswer } from '@/server/quiz'
|
|
import { getOneQuiz, getOneQuizStudentAnswer, submitQuizStudentAnswer } from '@/server/quiz'
|
|
|
import { getQuestionsOfQuiz } from '@/server/question'
|
|
import { getQuestionsOfQuiz } from '@/server/question'
|
|
|
import momentFromNow from '@/utils/moment-from-now'
|
|
import momentFromNow from '@/utils/moment-from-now'
|
|
|
|
|
+import { isEmpty } from '@/utils/types'
|
|
|
|
|
|
|
|
export default {
|
|
export default {
|
|
|
name: 'StudentDoQuiz',
|
|
name: 'StudentDoQuiz',
|
|
@@ -97,7 +101,7 @@ export default {
|
|
|
let uncompleted = false
|
|
let uncompleted = false
|
|
|
this.questions.map(question => {
|
|
this.questions.map(question => {
|
|
|
if (question.studentAnswer) {
|
|
if (question.studentAnswer) {
|
|
|
- answers[question.id] = question.studentAnswer
|
|
|
|
|
|
|
+ answers[question.id] = question.studentAnswer.answer
|
|
|
} else {
|
|
} else {
|
|
|
this.$setErrorMessage('题目:"' + question.stem + '"尚未填写')
|
|
this.$setErrorMessage('题目:"' + question.stem + '"尚未填写')
|
|
|
uncompleted = true
|
|
uncompleted = true
|
|
@@ -111,13 +115,15 @@ export default {
|
|
|
this.$router.go(-1)
|
|
this.$router.go(-1)
|
|
|
}).catch(err => { this.$setErrorMessage(err.response.data.msg) })
|
|
}).catch(err => { this.$setErrorMessage(err.response.data.msg) })
|
|
|
},
|
|
},
|
|
|
- momentFromNow
|
|
|
|
|
|
|
+ momentFromNow,
|
|
|
|
|
+ isEmpty
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
<style lang="scss" scoped>
|
|
|
@import "~@/style/theme.scss";
|
|
@import "~@/style/theme.scss";
|
|
|
|
|
+
|
|
|
.do-quiz {
|
|
.do-quiz {
|
|
|
margin: 0 auto;
|
|
margin: 0 auto;
|
|
|
max-width: 800px;
|
|
max-width: 800px;
|
|
@@ -127,15 +133,18 @@ export default {
|
|
|
.info {
|
|
.info {
|
|
|
line-height: 1.6;
|
|
line-height: 1.6;
|
|
|
color: #7a8a9a;
|
|
color: #7a8a9a;
|
|
|
|
|
+ font-size: 14px;
|
|
|
margin-bottom: 24px;
|
|
margin-bottom: 24px;
|
|
|
background: #f7f7f7;
|
|
background: #f7f7f7;
|
|
|
padding: 8px 12px;
|
|
padding: 8px 12px;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
.red {
|
|
.red {
|
|
|
- color: $theme-red;
|
|
|
|
|
|
|
+ color: $theme-red;
|
|
|
}
|
|
}
|
|
|
-.quiz-list {
|
|
|
|
|
|
|
+
|
|
|
|
|
+.quiz-list-item {
|
|
|
|
|
+ padding: 24px 8px;
|
|
|
display: flex;
|
|
display: flex;
|
|
|
|
|
|
|
|
&__index {
|
|
&__index {
|
|
@@ -152,4 +161,13 @@ export default {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+.wrong {
|
|
|
|
|
+ .quiz-list-item__index {
|
|
|
|
|
+ color: $theme-red;
|
|
|
|
|
+ }
|
|
|
|
|
+ .quiz-list-item-title{
|
|
|
|
|
+ color: $theme-red;
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
</style>
|
|
</style>
|