|
|
@@ -1,29 +1,33 @@
|
|
|
<template>
|
|
|
- <div>
|
|
|
+ <div class="do-quiz">
|
|
|
<back-title>{{ quiz.name }}</back-title>
|
|
|
<form @submit.prevent="handleFormSubmit">
|
|
|
- <button>提交</button>
|
|
|
- <div :key="question.id" v-for="(question, index) in quiz.questions">
|
|
|
- <div>{{ index + 1 }}.</div>
|
|
|
- <markdown-section :raw="question.stem" />
|
|
|
- <div v-if="question.kind === QuestionKind.choice">
|
|
|
- <label :key="index" v-for="(item, index) in question.options">
|
|
|
- <input v-model="question.studentAnswer" type="radio" :value="index" />
|
|
|
- <markdown-section style="display: inline" :raw="item" />
|
|
|
- </label>
|
|
|
- </div>
|
|
|
- <div v-else-if="question.kind === QuestionKind.trueOrFalse">
|
|
|
- <label>
|
|
|
- <input v-model="question.studentAnswer" type="radio" :value="true" />
|
|
|
- √
|
|
|
- </label>
|
|
|
- <label>
|
|
|
- <input v-model="question.studentAnswer" type="radio" :value="false" />
|
|
|
- ×
|
|
|
- </label>
|
|
|
+ <c-button class="mb-16" theme="green" block>提交</c-button>
|
|
|
+ <div class="quiz-list mb-16" :key="question.id" v-for="(question, index) in quiz.questions">
|
|
|
+ <div class="quiz-list__index">{{ index + 1 }}.</div>
|
|
|
+ <div>
|
|
|
+ <markdown-section :raw="question.stem" />
|
|
|
+ <div v-if="question.kind === QuestionKind.choice">
|
|
|
+ <label class="option" :key="index" v-for="(item, index) in question.options">
|
|
|
+ <input v-model="question.studentAnswer" type="radio" :value="index" />
|
|
|
+ {{ index }}.
|
|
|
+ <markdown-section style="display: inline" :raw="item" />
|
|
|
+ </label>
|
|
|
+ </div>
|
|
|
+ <div v-else-if="question.kind === QuestionKind.trueOrFalse">
|
|
|
+ <label class="option">
|
|
|
+ <input v-model="question.studentAnswer" type="radio" :value="true" />
|
|
|
+ √
|
|
|
+ </label>
|
|
|
+ <label class="option">
|
|
|
+ <input v-model="question.studentAnswer" type="radio" :value="false" />
|
|
|
+ ×
|
|
|
+ </label>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
+
|
|
|
</div>
|
|
|
- <button>提交</button>
|
|
|
+ <c-button class="mb-16" theme="green" block>提交</c-button>
|
|
|
</form>
|
|
|
</div>
|
|
|
</template>
|
|
|
@@ -33,10 +37,11 @@ import { getQuizById, submitQuiz } from '@/server/quiz'
|
|
|
import { createDefaultQuiz } from '@/views/quiz/utils/default'
|
|
|
import QuestionKind from '@/server/enums/question-kind'
|
|
|
import MarkdownSection from '@/views/quiz/components/MarkdownSection'
|
|
|
+import CButton from '@/components/Basic/CButton'
|
|
|
|
|
|
export default {
|
|
|
name: 'StudentDoQuiz',
|
|
|
- components: { MarkdownSection, BackTitle },
|
|
|
+ components: { CButton, MarkdownSection, BackTitle },
|
|
|
data() {
|
|
|
return {
|
|
|
quiz: createDefaultQuiz(),
|
|
|
@@ -79,3 +84,28 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+ .do-quiz {
|
|
|
+ margin: 0 auto;
|
|
|
+ max-width: 1100px;
|
|
|
+ padding: 64px 24px;
|
|
|
+ }
|
|
|
+ .quiz-list{
|
|
|
+ display: flex;
|
|
|
+
|
|
|
+ &__index{
|
|
|
+ margin-right: 16px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .option{
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ margin-top: 8px;
|
|
|
+
|
|
|
+ input{
|
|
|
+ margin-right: 4px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+</style>
|