v3.4.0
This commit is contained in:
@@ -0,0 +1,127 @@
|
||||
<template>
|
||||
<div v-loading="qLoading" style="line-height:1.8">
|
||||
<div v-if="qType==1||qType==2||qType==3||qType==4||qType==5">
|
||||
<div v-if="qType==1" >
|
||||
<div class="q-title" v-html="question.title"/>
|
||||
<div class="q-content">
|
||||
<el-radio-group v-model="answer.content">
|
||||
<el-radio v-for="item in question.items" :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" >
|
||||
<div class="q-title" v-html="question.title"/>
|
||||
<div class="q-content">
|
||||
<el-checkbox-group v-model="answer.contentArray" >
|
||||
<el-checkbox v-for="item in question.items" :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" >
|
||||
<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="answer.content">
|
||||
<el-radio v-for="item in question.items" :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" >
|
||||
<div class="q-title" v-html="question.title"/>
|
||||
<div v-if="answer.contentArray!==null">
|
||||
<el-form-item :label="item.prefix" :key="item.prefix" v-for="item in question.items" label-width="50px" style="margin-top: 10px;margin-bottom: 10px;">
|
||||
<el-input v-model="answer.contentArray[item.prefix-1]" />
|
||||
</el-form-item>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else-if="qType==5">
|
||||
<div class="q-title" v-html="question.title"/>
|
||||
<div>
|
||||
<el-input v-model="answer.content" type="textarea" rows="5" ></el-input>
|
||||
</div>
|
||||
</div>
|
||||
<div class="question-answer-show-item" style="margin-top: 15px">
|
||||
<span class="question-show-item">结果:</span>
|
||||
<el-tag :type="doRightTagFormatter(answer.doRight)">
|
||||
{{ doRightTextFormatter(answer.doRight) }}
|
||||
</el-tag>
|
||||
</div>
|
||||
<div class="question-answer-show-item">
|
||||
<span class="question-show-item">分数:</span>
|
||||
<span>{{question.score}}</span>
|
||||
</div>
|
||||
<div class="question-answer-show-item">
|
||||
<span class="question-show-item">难度:</span>
|
||||
<el-rate disabled v-model="question.difficult" class="question-show-item"></el-rate>
|
||||
</div>
|
||||
<br/>
|
||||
<div class="question-answer-show-item" style="line-height: 1.8">
|
||||
<span class="question-show-item">解析:</span>
|
||||
<span v-html="question.analyze" class="q-item-span-content" />
|
||||
</div>
|
||||
<div class="question-answer-show-item">
|
||||
<span class="question-show-item">正确答案:</span>
|
||||
<span v-if="qType==1||qType==2 ||qType==5" v-html="question.correct" class="q-item-span-content"/>
|
||||
<span v-if="qType==3" v-html="trueFalseFormatter(question)" class="q-item-span-content"/>
|
||||
<span v-if="qType==4">{{question.correctArray}}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapState, mapGetters } from 'vuex'
|
||||
export default {
|
||||
name: 'QuestionShow',
|
||||
props: {
|
||||
question: {
|
||||
type: Object,
|
||||
default: function () {
|
||||
return {}
|
||||
}
|
||||
},
|
||||
answer: {
|
||||
type: Object,
|
||||
default: function () {
|
||||
return { id: null, content: '', contentArray: [], doRight: false }
|
||||
}
|
||||
},
|
||||
qLoading: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
qType: {
|
||||
type: Number,
|
||||
default: 0
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
trueFalseFormatter (question) {
|
||||
return question.items.filter(d => d.prefix === question.correct)[0].content
|
||||
},
|
||||
doRightTagFormatter (status) {
|
||||
return this.enumFormat(this.doRightTag, status)
|
||||
},
|
||||
doRightTextFormatter (status) {
|
||||
return this.enumFormat(this.doRightEnum, status)
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters('enumItem', ['enumFormat']),
|
||||
...mapState('enumItem', {
|
||||
doRightEnum: state => state.exam.question.answer.doRightEnum,
|
||||
doRightTag: state => state.exam.question.answer.doRightTag
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,83 @@
|
||||
<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="answer.content" @change="answer.completed = true" >
|
||||
<el-radio v-for="item in question.items" :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="answer.contentArray" @change="answer.completed = true" >
|
||||
<el-checkbox v-for="item in question.items" :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="answer.content" @change="answer.completed = true" >
|
||||
<el-radio v-for="item in question.items" :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.items" label-width="50px" style="margin-top: 10px;margin-bottom: 10px;">
|
||||
<el-input v-model="answer.contentArray[item.prefix-1]" @change="answer.completed = true" />
|
||||
</el-form-item>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else-if="qType==5" v-loading="qLoading">
|
||||
<div class="q-title" v-html="question.title"/>
|
||||
<div>
|
||||
<el-input v-model="answer.content" type="textarea" rows="5" @change="answer.completed = true"/>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'QuestionShow',
|
||||
props: {
|
||||
question: {
|
||||
type: Object,
|
||||
default: function () {
|
||||
return {}
|
||||
}
|
||||
},
|
||||
answer: {
|
||||
type: Object,
|
||||
default: function () {
|
||||
return { id: null, content: '', contentArray: [] }
|
||||
}
|
||||
},
|
||||
qLoading: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
qType: {
|
||||
type: Number,
|
||||
default: 0
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
}
|
||||
}
|
||||
</script>
|
||||
176
source/vue/exam-student/src/views/exam/paper/do.vue
Normal file
176
source/vue/exam-student/src/views/exam/paper/do.vue
Normal file
@@ -0,0 +1,176 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-row class="do-exam-title">
|
||||
<el-col :span="24">
|
||||
<span :key="item.itemOrder" v-for="item in answer.answerItems">
|
||||
<el-tag :type="questionCompleted(item.completed)" class="do-exam-title-tag" @click="goAnchor('#question-'+item.itemOrder)">{{item.itemOrder}}</el-tag>
|
||||
</span>
|
||||
<span class="do-exam-time">
|
||||
<label>剩余时间:</label>
|
||||
<label>{{formatSeconds(remainTime)}}</label>
|
||||
</span>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row class="do-exam-title-hidden">
|
||||
<el-col :span="24">
|
||||
<span :key="item.itemOrder" v-for="item in answer.answerItems">
|
||||
<el-tag class="do-exam-title-tag" >{{item.itemOrder}}</el-tag>
|
||||
</span>
|
||||
<span class="do-exam-time">
|
||||
<label>剩余时间:</label>
|
||||
</span>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-container class="app-item-contain">
|
||||
<el-header class="align-center">
|
||||
<h1>{{form.name}}</h1>
|
||||
<div>
|
||||
<span class="question-title-padding">试卷总分:{{form.score}}</span>
|
||||
<span class="question-title-padding">考试时间:{{form.suggestTime}}分钟</span>
|
||||
</div>
|
||||
</el-header>
|
||||
<el-main>
|
||||
<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.name}}</h3>
|
||||
<el-card class="exampaper-item-box" v-if="titleItem.questionItems.length!==0">
|
||||
<el-form-item :key="questionItem.itemOrder" :label="questionItem.itemOrder+'.'"
|
||||
v-for="questionItem in titleItem.questionItems"
|
||||
class="exam-question-item" label-width="50px" :id="'question-'+ questionItem.itemOrder">
|
||||
<QuestionEdit :qType="questionItem.questionType" :question="questionItem"
|
||||
:answer="answer.answerItems[questionItem.itemOrder-1]"/>
|
||||
</el-form-item>
|
||||
</el-card>
|
||||
</el-row>
|
||||
<el-row class="do-align-center">
|
||||
<el-button type="primary" @click="submitForm">提交</el-button>
|
||||
<el-button>取消</el-button>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</el-main>
|
||||
</el-container>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapState, mapGetters } from 'vuex'
|
||||
import { formatSeconds } from '@/utils'
|
||||
import QuestionEdit from '../components/QuestionEdit'
|
||||
import examPaperApi from '@/api/examPaper'
|
||||
import examPaperAnswerApi from '@/api/examPaperAnswer'
|
||||
|
||||
export default {
|
||||
components: { QuestionEdit },
|
||||
data () {
|
||||
return {
|
||||
form: {},
|
||||
formLoading: false,
|
||||
answer: {
|
||||
questionId: null,
|
||||
doTime: 0,
|
||||
answerItems: []
|
||||
},
|
||||
timer: null,
|
||||
remainTime: 0
|
||||
}
|
||||
},
|
||||
created () {
|
||||
let id = this.$route.query.id
|
||||
let _this = this
|
||||
if (id && parseInt(id) !== 0) {
|
||||
_this.formLoading = true
|
||||
examPaperApi.select(id).then(re => {
|
||||
_this.form = re.response
|
||||
_this.remainTime = re.response.suggestTime * 60
|
||||
_this.initAnswer()
|
||||
_this.timeReduce()
|
||||
_this.formLoading = false
|
||||
})
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
|
||||
},
|
||||
beforeDestroy () {
|
||||
window.clearInterval(this.timer)
|
||||
},
|
||||
methods: {
|
||||
formatSeconds (theTime) {
|
||||
return formatSeconds(theTime)
|
||||
},
|
||||
timeReduce () {
|
||||
let _this = this
|
||||
this.timer = setInterval(function () {
|
||||
if (_this.remainTime <= 0) {
|
||||
_this.submitForm()
|
||||
} else {
|
||||
++_this.answer.doTime
|
||||
--_this.remainTime
|
||||
}
|
||||
}, 1000)
|
||||
},
|
||||
questionCompleted (completed) {
|
||||
return this.enumFormat(this.doCompletedTag, completed)
|
||||
},
|
||||
goAnchor (selector) {
|
||||
this.$el.querySelector(selector).scrollIntoView({ behavior: 'instant', block: 'center', inline: 'nearest' })
|
||||
},
|
||||
initAnswer () {
|
||||
this.answer.id = this.form.id
|
||||
let titleItemArray = this.form.titleItems
|
||||
for (let tIndex in titleItemArray) {
|
||||
let questionArray = titleItemArray[tIndex].questionItems
|
||||
for (let qIndex in questionArray) {
|
||||
let question = questionArray[qIndex]
|
||||
this.answer.answerItems.push({ questionId: question.id, content: null, contentArray: [], completed: false, itemOrder: question.itemOrder })
|
||||
}
|
||||
}
|
||||
},
|
||||
submitForm () {
|
||||
let _this = this
|
||||
window.clearInterval(_this.timer)
|
||||
_this.formLoading = true
|
||||
examPaperAnswerApi.answerSubmit(this.answer).then(re => {
|
||||
if (re.code === 1) {
|
||||
_this.$alert('试卷得分:' + re.response + '分', '考试结果', {
|
||||
confirmButtonText: '返回考试记录',
|
||||
callback: action => {
|
||||
_this.$router.push('/record/index')
|
||||
}
|
||||
})
|
||||
} else {
|
||||
_this.$message.error(re.message)
|
||||
}
|
||||
_this.formLoading = false
|
||||
}).catch(e => {
|
||||
_this.formLoading = false
|
||||
})
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters('enumItem', ['enumFormat']),
|
||||
...mapState('enumItem', {
|
||||
doCompletedTag: state => state.exam.question.answer.doCompletedTag
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.align-center {
|
||||
text-align: center
|
||||
}
|
||||
|
||||
.exam-question-item {
|
||||
padding: 10px;
|
||||
|
||||
.el-form-item__label {
|
||||
font-size: 15px !important;
|
||||
}
|
||||
}
|
||||
|
||||
.question-title-padding {
|
||||
padding-left: 25px;
|
||||
padding-right: 25px;
|
||||
}
|
||||
</style>
|
||||
154
source/vue/exam-student/src/views/exam/paper/edit.vue
Normal file
154
source/vue/exam-student/src/views/exam/paper/edit.vue
Normal file
@@ -0,0 +1,154 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-row class="do-exam-title" style="background-color: #F5F5DC">
|
||||
<el-col :span="24">
|
||||
<span :key="item.itemOrder" v-for="item in answer.answerItems">
|
||||
<el-tag :type="questionDoRightTag(item.doRight)" class="do-exam-title-tag" @click="goAnchor('#question-'+item.itemOrder)">{{item.itemOrder}}</el-tag>
|
||||
</span>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row class="do-exam-title-hidden">
|
||||
<el-col :span="24">
|
||||
<span :key="item.itemOrder" v-for="item in answer.answerItems">
|
||||
<el-tag class="do-exam-title-tag" >{{item.itemOrder}}</el-tag>
|
||||
</span>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-container class="app-item-contain">
|
||||
<el-header class="align-center">
|
||||
<h1>{{form.name}}</h1>
|
||||
<div>
|
||||
<span class="question-title-padding">试卷得分:{{answer.score}}</span>
|
||||
<span class="question-title-padding">试卷耗时:{{formatSeconds(answer.doTime)}}</span>
|
||||
</div>
|
||||
</el-header>
|
||||
<el-main>
|
||||
<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.name}}</h3>
|
||||
<el-card class="exampaper-item-box" v-if="titleItem.questionItems.length!==0">
|
||||
<el-form-item :key="questionItem.itemOrder" :label="questionItem.itemOrder+'.'"
|
||||
v-for="questionItem in titleItem.questionItems"
|
||||
class="exam-question-item" label-width="50px" :id="'question-'+ questionItem.itemOrder">
|
||||
<el-row>
|
||||
<QuestionAnswerShow :qType="questionItem.questionType" :question="questionItem" :answer="answer.answerItems[questionItem.itemOrder-1]"/>
|
||||
</el-row>
|
||||
<el-row v-if="answer.answerItems[questionItem.itemOrder-1].doRight === null">
|
||||
<label style="color: #e6a23c">批改:</label>
|
||||
<el-radio-group v-model="answer.answerItems[questionItem.itemOrder-1].score">
|
||||
<el-radio v-for="item in scoreSelect(questionItem.score)" :key="item" :label="item" >
|
||||
{{item}}
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
</el-row>
|
||||
</el-form-item>
|
||||
</el-card>
|
||||
</el-row>
|
||||
<el-row class="do-align-center">
|
||||
<el-button type="primary" @click="submitForm">提交</el-button>
|
||||
<el-button>取消</el-button>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</el-main>
|
||||
</el-container>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapState, mapGetters } from 'vuex'
|
||||
import { formatSeconds } from '@/utils'
|
||||
import QuestionAnswerShow from '../components/QuestionAnswerShow'
|
||||
import examPaperAnswerApi from '@/api/examPaperAnswer'
|
||||
export default {
|
||||
components: { QuestionAnswerShow },
|
||||
data () {
|
||||
return {
|
||||
form: {},
|
||||
formLoading: false,
|
||||
answer: {
|
||||
id: null,
|
||||
score: 0,
|
||||
doTime: 0,
|
||||
answerItems: [],
|
||||
doRight: false
|
||||
}
|
||||
}
|
||||
},
|
||||
created () {
|
||||
let id = this.$route.query.id
|
||||
let _this = this
|
||||
if (id && parseInt(id) !== 0) {
|
||||
_this.formLoading = true
|
||||
examPaperAnswerApi.read(id).then(re => {
|
||||
_this.form = re.response.paper
|
||||
_this.answer = re.response.answer
|
||||
_this.formLoading = false
|
||||
})
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
submitForm () {
|
||||
let _this = this
|
||||
_this.formLoading = true
|
||||
examPaperAnswerApi.edit(this.answer).then(re => {
|
||||
if (re.code === 1) {
|
||||
_this.$alert('试卷得分:' + re.response + '分', '考试结果', {
|
||||
confirmButtonText: '返回考试记录',
|
||||
callback: action => {
|
||||
_this.$router.push('/record/index')
|
||||
}
|
||||
})
|
||||
} else {
|
||||
_this.$message.error(re.message)
|
||||
}
|
||||
_this.formLoading = false
|
||||
}).catch(e => {
|
||||
_this.formLoading = false
|
||||
})
|
||||
},
|
||||
scoreSelect (score) {
|
||||
let array = []
|
||||
for (let i = 0; i <= parseInt(score); i++) {
|
||||
array.push(i.toString())
|
||||
}
|
||||
if (score.indexOf('.') !== -1) {
|
||||
array.push(score)
|
||||
}
|
||||
return array
|
||||
},
|
||||
formatSeconds (theTime) {
|
||||
return formatSeconds(theTime)
|
||||
},
|
||||
questionDoRightTag (status) {
|
||||
return this.enumFormat(this.doRightTag, status)
|
||||
},
|
||||
goAnchor (selector) {
|
||||
this.$el.querySelector(selector).scrollIntoView({ behavior: 'instant', block: 'center', inline: 'nearest' })
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters('enumItem', ['enumFormat']),
|
||||
...mapState('enumItem', {
|
||||
doRightTag: state => state.exam.question.answer.doRightTag
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.align-center {
|
||||
text-align: center
|
||||
}
|
||||
|
||||
.exam-question-item{
|
||||
padding: 10px;
|
||||
.el-form-item__label{
|
||||
font-size: 15px !important;
|
||||
}
|
||||
}
|
||||
|
||||
.question-title-padding{
|
||||
padding-left: 25px;
|
||||
padding-right: 25px;
|
||||
}
|
||||
</style>
|
||||
111
source/vue/exam-student/src/views/exam/paper/read.vue
Normal file
111
source/vue/exam-student/src/views/exam/paper/read.vue
Normal file
@@ -0,0 +1,111 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-row class="do-exam-title" style="background-color: #F5F5DC">
|
||||
<el-col :span="24">
|
||||
<span :key="item.itemOrder" v-for="item in answer.answerItems">
|
||||
<el-tag :type="questionDoRightTag(item.doRight)" class="do-exam-title-tag" @click="goAnchor('#question-'+item.itemOrder)">{{item.itemOrder}}</el-tag>
|
||||
</span>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row class="do-exam-title-hidden">
|
||||
<el-col :span="24">
|
||||
<span :key="item.itemOrder" v-for="item in answer.answerItems">
|
||||
<el-tag class="do-exam-title-tag" >{{item.itemOrder}}</el-tag>
|
||||
</span>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-container class="app-item-contain">
|
||||
<el-header class="align-center">
|
||||
<h1>{{form.name}}</h1>
|
||||
<div>
|
||||
<span class="question-title-padding">试卷得分:{{answer.score}}</span>
|
||||
<span class="question-title-padding">试卷耗时:{{formatSeconds(answer.doTime)}}</span>
|
||||
</div>
|
||||
</el-header>
|
||||
<el-main>
|
||||
<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.name}}</h3>
|
||||
<el-card class="exampaper-item-box" v-if="titleItem.questionItems.length!==0">
|
||||
<el-form-item :key="questionItem.itemOrder" :label="questionItem.itemOrder+'.'"
|
||||
v-for="questionItem in titleItem.questionItems"
|
||||
class="exam-question-item" label-width="50px" :id="'question-'+ questionItem.itemOrder">
|
||||
<QuestionAnswerShow :qType="questionItem.questionType" :question="questionItem" :answer="answer.answerItems[questionItem.itemOrder-1]"/>
|
||||
</el-form-item>
|
||||
</el-card>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</el-main>
|
||||
</el-container>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapState, mapGetters } from 'vuex'
|
||||
import { formatSeconds } from '@/utils'
|
||||
import QuestionAnswerShow from '../components/QuestionAnswerShow'
|
||||
import examPaperAnswerApi from '@/api/examPaperAnswer'
|
||||
export default {
|
||||
components: { QuestionAnswerShow },
|
||||
data () {
|
||||
return {
|
||||
form: {},
|
||||
formLoading: false,
|
||||
answer: {
|
||||
id: null,
|
||||
score: 0,
|
||||
doTime: 0,
|
||||
answerItems: [],
|
||||
doRight: false
|
||||
}
|
||||
}
|
||||
},
|
||||
created () {
|
||||
let id = this.$route.query.id
|
||||
let _this = this
|
||||
if (id && parseInt(id) !== 0) {
|
||||
_this.formLoading = true
|
||||
examPaperAnswerApi.read(id).then(re => {
|
||||
_this.form = re.response.paper
|
||||
_this.answer = re.response.answer
|
||||
_this.formLoading = false
|
||||
})
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
formatSeconds (theTime) {
|
||||
return formatSeconds(theTime)
|
||||
},
|
||||
questionDoRightTag (status) {
|
||||
return this.enumFormat(this.doRightTag, status)
|
||||
},
|
||||
goAnchor (selector) {
|
||||
this.$el.querySelector(selector).scrollIntoView({ behavior: 'instant', block: 'center', inline: 'nearest' })
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters('enumItem', ['enumFormat']),
|
||||
...mapState('enumItem', {
|
||||
doRightTag: state => state.exam.question.answer.doRightTag
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.align-center {
|
||||
text-align: center
|
||||
}
|
||||
|
||||
.exam-question-item{
|
||||
padding: 10px;
|
||||
.el-form-item__label{
|
||||
font-size: 15px !important;
|
||||
}
|
||||
}
|
||||
|
||||
.question-title-padding{
|
||||
padding-left: 25px;
|
||||
padding-right: 25px;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user