| | |
| | | <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 class="paper-container"> |
| | | <div class="paper-card" v-loading="formLoading"> |
| | | <el-card style="height: 100vh"> |
| | | <el-row style="text-align: left; margin-bottom : 20px; font-size: 20px">语文考试</el-row> |
| | | <el-row> |
| | | <el-col class="info"> |
| | | <span class="exam-info">学员姓名:</span> |
| | | <span class="exam-info">{{ form.userName }}</span> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col class="info"> |
| | | <span class="exam-info">交卷时间:</span> |
| | | <span class="exam-info">{{ form.submitTime }}</span> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col class="info"> |
| | | <span class="exam-info">完成耗时:</span> |
| | | <span class="exam-info">{{ formattedDoTime }}</span> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col class="info"> |
| | | <span class="exam-info">得分:</span> |
| | | <span class="exam-info">{{ form.score + ' / ' + form.totalScore }}</span> |
| | | </el-col> |
| | | </el-row> |
| | | <el-divider></el-divider> |
| | | <el-row class="do-exam-title"> |
| | | <el-col :span="24"> |
| | | <span :key="item.itemOrder" v-for="item in form.navbar"> |
| | | <el-tag :type="questionDoRightTag(item.right)" class="do-exam-title-tag" |
| | | @click="goAnchor('#question-' + item.itemOrder)">{{ item.itemOrder }}</el-tag> |
| | | </span> |
| | | </el-col> |
| | | </el-row> |
| | | <el-divider></el-divider> |
| | | <div style="text-align: center"> |
| | | <el-button type="primary" style="width: 120px;height: 35px" @click="open">提交批改</el-button> |
| | | </div> |
| | | </div> |
| | | </el-row> |
| | | </el-card> |
| | | </div> |
| | | <div class="paper-form"> |
| | | <el-form :model="form" ref="form" v-loading="formLoading" label-width="100px"> |
| | | <el-row :key="index" v-for="(titleItem, index) in form.titleItems"> |
| | | <h3>{{ titleItem.title }}</h3> |
| | | <el-card class="exampaper-item-box" v-if="titleItem.questionList.length !== 0"> |
| | | <el-form-item :key="questionItem.itemOrder" :label="questionItem.itemOrder + '.'" |
| | | v-for="questionItem in titleItem.questionList" class="exam-question-item" |
| | | label-width="50px" :id="'question-' + questionItem.itemOrder"> |
| | | <MarkPaperShow :qType="questionItem.questionType" :question="questionItem" :answer="form.navbar"/> |
| | | </el-form-item> |
| | | </el-card> |
| | | </el-row> |
| | | </el-form> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import DoQuestion from '@/components/question/DoQuestion' |
| | | import { getStudentExam } from '@/api/exam' |
| | | import { getStudentExam, submitMark } from '@/api/exam' |
| | | import MarkPaperShow from '@/views/exam/exam/components/MarkPaperShow' |
| | | import { mapGetters, mapState } from 'vuex' |
| | | |
| | | export default { |
| | | name: 'MarkPaperDetail', |
| | | components: { DoQuestion }, |
| | | components: { MarkPaperShow }, |
| | | 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() |
| | | } |
| | | getStudentExam(this.$route.query.examId, this.$route.query.userId).then(re => { |
| | | this.formLoading = true |
| | | this.form = re.data.data |
| | | this.formLoading = false |
| | | }) |
| | | }, |
| | | data () { |
| | | return { |
| | | paperQuestionList: [], |
| | | form: {}, |
| | | formLoading: false, |
| | | userId: null, |
| | | questionLoading: false, |
| | | examInfo: { |
| | | examId: null, |
| | | examName: '', |
| | | doTime: 0, |
| | | paperQuestionList: [] |
| | | } |
| | | userName: '张三', |
| | | questionLoading: false |
| | | } |
| | | }, |
| | | methods: { |
| | | open () { |
| | | this.$confirm('确认是否提交成绩批改?', '提示', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning' |
| | | }).then(() => { |
| | | submitMark(this.form).then(re => { |
| | | if (re.data.code === 1) { |
| | | console.log('1111111') |
| | | this.$message.success('提交成功') |
| | | this.$router.back() |
| | | } else { |
| | | this.$message.error(re.message) |
| | | } |
| | | }) |
| | | }) |
| | | }, |
| | | goAnchor (selector) { |
| | | this.$el.querySelector(selector).scrollIntoView({ behavior: 'instant', block: 'center', inline: 'nearest' }) |
| | | }, |
| | | questionDoRightTag (status) { |
| | | return this.enumFormat(this.doRightTag, status) |
| | | }, |
| | | getStudentPaper () { |
| | | this.getStudentExam(this.examInfo.examId, this.userId).then(res => { |
| | | getStudentExam(this.examInfo.examId, this.userId).then(res => { |
| | | this.examInfo = res.data.data |
| | | }) |
| | | } |
| | | }, |
| | | computed: { |
| | | formattedDoTime () { |
| | | const totalSeconds = this.form.doTime |
| | | const minutes = Math.floor(totalSeconds / 60) |
| | | const seconds = totalSeconds % 60 |
| | | return `${minutes}分${seconds < 10 ? '0' + seconds : seconds}秒` |
| | | }, |
| | | ...mapGetters('enumItem', ['enumFormat']), |
| | | ...mapState('enumItem', { |
| | | doRightTag: state => state.exam.question.answer.doRightTag |
| | | }) |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .question-warp { |
| | | margin-top: 50px; |
| | | |
| | | .paper-container { |
| | | display: flex; |
| | | flex-direction: row; |
| | | height: 100%; |
| | | padding: 20px; |
| | | min-height: 100%; |
| | | } |
| | | |
| | | .paper-card { |
| | | position: fixed; |
| | | width: 270px; |
| | | } |
| | | |
| | | .paper-form { |
| | | flex: 1; /* 占据剩余空间 */ |
| | | margin-left: 300px; |
| | | } |
| | | |
| | | .info { |
| | | display: flex; |
| | | flex-direction: row; |
| | | justify-content: left; |
| | | font-size: 14px; |
| | | margin-top: 10px; |
| | | } |
| | | |
| | | </style> |