|
@@ -10,30 +10,9 @@
|
|
|
<div>上次得分:{{!isEmpty(answersInfo.score) ? answersInfo.score : '无提交历史'}}</div>
|
|
<div>上次得分:{{!isEmpty(answersInfo.score) ? answersInfo.score : '无提交历史'}}</div>
|
|
|
<div>最近提交:{{!isEmpty(answersInfo.submitAt) ? momentFromNow(answersInfo.submitAt) : '无提交历史'}}</div>
|
|
<div>最近提交:{{!isEmpty(answersInfo.submitAt) ? momentFromNow(answersInfo.submitAt) : '无提交历史'}}</div>
|
|
|
</div>
|
|
</div>
|
|
|
- <div class="quiz-list-item" :key="question.id" v-for="(question, index) in questions"
|
|
|
|
|
- :class="question.studentAnswer ? question.studentAnswer.correct === false ? 'wrong' : '' : ''">
|
|
|
|
|
- <div class="quiz-list-item__index">{{ index + 1 }}.</div>
|
|
|
|
|
- <div>
|
|
|
|
|
- <markdown-section class="quiz-list-item-title" :raw="question.stem"/>
|
|
|
|
|
- <div v-if="question.type === QuestionKind.choice && question.studentAnswer">
|
|
|
|
|
- <label class="option" :key="index" v-for="(item, index) in question.options">
|
|
|
|
|
- <input v-model="question.studentAnswer.answer" type="radio" :value="index"/>
|
|
|
|
|
- <b class="mr-8">{{ index }}.</b>
|
|
|
|
|
- <markdown-section style="display: inline" :raw="item"/>
|
|
|
|
|
- </label>
|
|
|
|
|
- </div>
|
|
|
|
|
- <div v-else-if="question.type === QuestionKind.trueOrFalse && question.studentAnswer">
|
|
|
|
|
- <label class="option">
|
|
|
|
|
- <input v-model="question.studentAnswer.answer" type="radio" :value="true"/>
|
|
|
|
|
- <c-icon>check</c-icon>
|
|
|
|
|
- </label>
|
|
|
|
|
- <label class="option">
|
|
|
|
|
- <input v-model="question.studentAnswer.answer" type="radio" :value="false"/>
|
|
|
|
|
- <c-icon>close</c-icon>
|
|
|
|
|
- </label>
|
|
|
|
|
- </div>
|
|
|
|
|
- </div>
|
|
|
|
|
- </div>
|
|
|
|
|
|
|
+ <template v-for="(question, index) in questions">
|
|
|
|
|
+ <do-quiz-question-card @choice="handleChoice" :key="question.id" :question-prop="question" :index="index"></do-quiz-question-card>
|
|
|
|
|
+ </template>
|
|
|
<div class="mt-24">
|
|
<div class="mt-24">
|
|
|
<c-button class="mb-16" theme="green" icon="check">提交答案</c-button>
|
|
<c-button class="mb-16" theme="green" icon="check">提交答案</c-button>
|
|
|
</div>
|
|
</div>
|
|
@@ -44,17 +23,19 @@
|
|
|
import BackTitle from '@/components/Basic/BackTitle'
|
|
import BackTitle from '@/components/Basic/BackTitle'
|
|
|
import { createDefaultQuiz } from '@/views/quiz/utils/default'
|
|
import { createDefaultQuiz } from '@/views/quiz/utils/default'
|
|
|
import QuestionKind from '@/enums/question-kind'
|
|
import QuestionKind from '@/enums/question-kind'
|
|
|
-import MarkdownSection from '@/views/quiz/components/MarkdownSection'
|
|
|
|
|
import CButton from '@/components/Basic/CButton'
|
|
import CButton from '@/components/Basic/CButton'
|
|
|
-import CIcon from '@/components/Basic/CIcon'
|
|
|
|
|
import { getOneQuiz, getOneQuizStudentAnswer, submitQuizStudentAnswer } from '@/server/quiz'
|
|
import { getOneQuiz, getOneQuizStudentAnswer, submitQuizStudentAnswer } from '@/server/quiz'
|
|
|
import { getQuestionsByQuiz } from '@/server/question'
|
|
import { getQuestionsByQuiz } from '@/server/question'
|
|
|
import momentFromNow from '@/utils/moment-from-now'
|
|
import momentFromNow from '@/utils/moment-from-now'
|
|
|
import { isEmpty } from '@/utils/types'
|
|
import { isEmpty } from '@/utils/types'
|
|
|
|
|
+import DoQuizQuestionCard from '@/views/quiz/components/DoQuizQuestionCard'
|
|
|
|
|
|
|
|
|
|
+/**
|
|
|
|
|
+ * 起止时间算法见同级目录下的readme
|
|
|
|
|
+ */
|
|
|
export default {
|
|
export default {
|
|
|
name: 'StudentDoQuiz',
|
|
name: 'StudentDoQuiz',
|
|
|
- components: { CIcon, CButton, MarkdownSection, BackTitle },
|
|
|
|
|
|
|
+ components: { DoQuizQuestionCard, CButton, BackTitle },
|
|
|
data () {
|
|
data () {
|
|
|
return {
|
|
return {
|
|
|
quiz: createDefaultQuiz(),
|
|
quiz: createDefaultQuiz(),
|
|
@@ -65,6 +46,12 @@ export default {
|
|
|
score: null,
|
|
score: null,
|
|
|
submitAt: null
|
|
submitAt: null
|
|
|
},
|
|
},
|
|
|
|
|
+
|
|
|
|
|
+ // 做题起止时间相关,时间为了方便加减采用毫秒表示
|
|
|
|
|
+ lastDate: new Date().valueOf(),
|
|
|
|
|
+ choiceDate: 0,
|
|
|
|
|
+ questionPointer: -1,
|
|
|
|
|
+
|
|
|
QuestionKind
|
|
QuestionKind
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
@@ -127,6 +114,9 @@ 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) })
|
|
|
},
|
|
},
|
|
|
|
|
+ handleChoice ({ questionId }) {
|
|
|
|
|
+ console.log(questionId)
|
|
|
|
|
+ },
|
|
|
momentFromNow,
|
|
momentFromNow,
|
|
|
isEmpty
|
|
isEmpty
|
|
|
}
|
|
}
|
|
@@ -154,33 +144,4 @@ export default {
|
|
|
.red {
|
|
.red {
|
|
|
color: $theme-red;
|
|
color: $theme-red;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
-.quiz-list-item {
|
|
|
|
|
- padding: 24px 8px;
|
|
|
|
|
- display: flex;
|
|
|
|
|
-
|
|
|
|
|
- &__index {
|
|
|
|
|
- margin-right: 16px;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- .option {
|
|
|
|
|
- display: flex;
|
|
|
|
|
- align-items: center;
|
|
|
|
|
- margin-top: 8px;
|
|
|
|
|
-
|
|
|
|
|
- input {
|
|
|
|
|
- margin-right: 12px;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-.wrong {
|
|
|
|
|
- .quiz-list-item__index {
|
|
|
|
|
- color: $theme-red;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- .quiz-list-item-title {
|
|
|
|
|
- color: $theme-red;
|
|
|
|
|
- }
|
|
|
|
|
-}
|
|
|
|
|
</style>
|
|
</style>
|