From 1acd721f03f9d4b16bcf9ef57041ef08fec49ffd Mon Sep 17 00:00:00 2001 From: xiangpei <xiangpei@timesnew.cn> Date: 星期二, 18 六月 2024 14:43:34 +0800 Subject: [PATCH] 题目组件 --- src/api/exam.js | 8 ++ src/views/exam/exam/MarkPaper.vue | 4 src/components/question/DoQuestion.vue | 87 +++++++++++++++++++++++++++++ src/views/exam/exam/MarkPaperDetail.vue | 64 +++++++++++++++++++++ 4 files changed, 161 insertions(+), 2 deletions(-) diff --git a/src/api/exam.js b/src/api/exam.js index d1a7644..c1887ca 100644 --- a/src/api/exam.js +++ b/src/api/exam.js @@ -67,3 +67,11 @@ data: params }) } + +// 鏌ユ壘瀛︾敓鐨勭瓟鍗� +export const getStudentExam = (examId, userId) => { + return axios({ + url: '/api/admin/exam/' + examId + '/' + userId, + method: 'GET' + }) +} diff --git a/src/components/question/DoQuestion.vue b/src/components/question/DoQuestion.vue new file mode 100644 index 0000000..af357db --- /dev/null +++ b/src/components/question/DoQuestion.vue @@ -0,0 +1,87 @@ +<template> + <div style="line-height:1.8"> + <div v-if="qType==1" v-loading="qLoading"> + <div class="q-title" v-html="question.title"/> + <div class="q-content"> + <el-radio-group v-model="question.answer" @change="question.finished = true" > + <el-radio v-for="item in question.questionItemList" :key="item.prefix" :label="item.prefix" > + <span class="question-prefix">{{item.prefix}}.</span> + <span v-html="item.content" class="q-item-span-content"></span> + </el-radio> + </el-radio-group> + </div> + </div> + <div v-else-if="qType==2" v-loading="qLoading"> + <div class="q-title" v-html="question.title"/> + <div class="q-content"> + <el-checkbox-group v-model="question.answerList" @change="question.finished = true" > + <el-checkbox v-for="item in question.questionItemList" :label="item.prefix" :key="item.prefix" > + <span class="question-prefix">{{item.prefix}}.</span> + <span v-html="item.content" class="q-item-span-content"></span> + </el-checkbox> + </el-checkbox-group> + </div> + </div> + <div v-else-if="qType==3" v-loading="qLoading"> + <div class="q-title" v-html="question.title" style="display: inline;margin-right: 10px"/> + <span style="padding-right: 10px;">(</span> + <el-radio-group v-model="question.answer" @change="question.finished = true" > + <el-radio v-for="item in question.questionItemList" :key="item.prefix" :label="item.prefix" > + <span v-html="item.content" class="q-item-span-content"></span> + </el-radio> + </el-radio-group> + <span style="padding-left: 10px;">)</span> + </div> + <div v-else-if="qType==4" v-loading="qLoading"> + <div class="q-title" v-html="question.title"/> + <div> + <el-form-item :label="item.prefix" :key="item.prefix" v-for="item in question.questionItemList" label-width="50px" style="margin-top: 10px;margin-bottom: 10px;"> + <el-input v-model="question.answerList[item.prefix-1]" @change="question.finished = true" /> + </el-form-item> + </div> + </div> + <div v-else-if="qType === 5 || qType === 7 || qType === 8" v-loading="qLoading"> + <div class="q-title" v-html="question.title"/> + <div> + <el-input v-model="question.answer" type="textarea" rows="5" @change="question.finished = true"/> + </div> + </div> + <div v-else-if="qType==6" v-loading="qLoading"> + <div class="q-title" v-html="question.title"/> + <div class="q-content"> +<!-- todo 棰樺共琛屽鍔犻煶棰�--> + <el-radio-group v-model="question.answer" @change="question.finished = true" > + <el-radio v-for="item in question.questionItemList" :key="item.prefix" :label="item.prefix" > + <span class="question-prefix">{{item.prefix}}.</span> + <audio :src="item.content" class="q-item-span-content"></audio> + </el-radio> + </el-radio-group> + </div> + </div> + </div> + +</template> + +<script> +export default { + name: 'QuestionShow', + props: { + question: { + type: Object, + default: function () { + return {} + } + }, + qLoading: { + type: Boolean, + default: false + }, + qType: { + type: Number, + default: 0 + } + }, + methods: { + } +} +</script> diff --git a/src/views/exam/exam/MarkPaper.vue b/src/views/exam/exam/MarkPaper.vue index 3e8e8ac..4449396 100644 --- a/src/views/exam/exam/MarkPaper.vue +++ b/src/views/exam/exam/MarkPaper.vue @@ -117,11 +117,11 @@ } }, methods: { - statusFormatter(row) { + statusFormatter (row) { if (row.status === 'finish' || row.markPaperStatus === 'finish') { return '瀹屾垚' } else if (row.status === 'temp' || row.markPaperStatus === 'temp') { - return "鏈畬鎴�" + return '鏈畬鎴�' } }, markPaper (row) { diff --git a/src/views/exam/exam/MarkPaperDetail.vue b/src/views/exam/exam/MarkPaperDetail.vue new file mode 100644 index 0000000..8b8710f --- /dev/null +++ b/src/views/exam/exam/MarkPaperDetail.vue @@ -0,0 +1,64 @@ +<template> + <div> + <el-row style="text-align: center">xxx鑰冭瘯</el-row> + <el-row> + <div>xxx濮撳悕</div> + <div>xxx浜ゅ嵎鏃堕棿</div> + <div>xxx绛旈鏃堕棿</div> + </el-row> + <el-row class="paper-warp"> + <div v-for="(paper,index) in examInfo.paperQuestionList" :key="index" class="paperTitleWarp"> + <div class="paperTitle">{{ paper.title }}</div> + <div class="question-warp"> + <div v-for="(doQuestion, index) in paper.questionList" :key="index"> + <DoQuestion :question="doQuestion" :qType="paper.questionType" :qLoading="questionLoading"></DoQuestion> + </div> + </div> + </div> + </el-row> + </div> +</template> + +<script> +import DoQuestion from '@/components/question/DoQuestion' +import { getStudentExam } from '@/api/exam' + +export default { + name: 'MarkPaperDetail', + components: { DoQuestion }, + mounted () { + this.examInfo.examId = this.$route.query.examId + this.examInfo.examName = this.$route.query.examName + this.userId = this.$route.query.userId + if (this.examInfo.examId && this.userId) { + this.getStudentPaper() + } + }, + data () { + return { + userId: null, + questionLoading: false, + examInfo: { + examId: null, + examName: '', + doTime: 0, + paperQuestionList: [] + } + } + }, + methods: { + getStudentPaper () { + this.getStudentExam(this.examInfo.examId, this.userId).then(res => { + this.examInfo = res.data.data + }) + } + } +} +</script> + +<style scoped> +.question-warp { + margin-top: 50px; + +} +</style> -- Gitblit v1.8.0