master
parent
707e739922
commit
1efe8a8843
30 changed files with 326 additions and 574 deletions
@ -1,320 +0,0 @@ |
||||
<template> |
||||
<div class="box"> |
||||
<h1 class="title">{{paperName}}</h1> |
||||
<div class="metas"> |
||||
<div> |
||||
<span class="name">学生姓名:</span> |
||||
<span class="val">{{userName}}</span> |
||||
</div> |
||||
<div> |
||||
<span class="name">学生得分:</span> |
||||
<span class="val">{{(reviewStatus == 2 || reviewStatus == 3) ? this_score : '--'}}</span> |
||||
</div> |
||||
<div> |
||||
<span class="name">试卷总分:</span> |
||||
<span class="val">100</span> |
||||
</div> |
||||
<div> |
||||
<span class="name">练习时长:</span> |
||||
<span class="val">{{duration}}</span> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="wrap"> |
||||
<div class="select"> |
||||
<el-radio v-model="look" label="1">查看全部</el-radio> |
||||
<el-radio v-model="look" label="2" v-if="reviewStatus == 2 || reviewStatus == 3">只看错题</el-radio> |
||||
</div> |
||||
|
||||
<div class="item" v-for="(item,index) in list" :key="index"> |
||||
<div class="status" :class="{done: item.isCorrecting}">{{item.isSub ? '简答题' : '客观题'}}:{{getCorrectingName(item.isCorrecting)}}</div> |
||||
<div class="name" v-html="item.question_stem"></div> |
||||
<div class="answer"> |
||||
<div class="info" v-if="!item.isSub"> |
||||
<p class="key">正确答案:</p> |
||||
<p class="val">{{item.answer}}</p> |
||||
</div> |
||||
<div class="info"> |
||||
<p class="key">学生答案:</p> |
||||
<p class="val">{{item.user_answer}}</p> |
||||
</div> |
||||
</div> |
||||
<div class="meta"> |
||||
<span class="key">知识点:</span> |
||||
<span class="val">{{item.knowledge_points}}</span> |
||||
</div> |
||||
<div class="meta" v-if="item.isSub"> |
||||
<p class="key">附件:</p> |
||||
<div class="val"> |
||||
<el-button v-if="item.fileUrl || item.videoAudio" type="text" @click="preview(item)">{{item.fileName}}</el-button> |
||||
<el-button v-if="item.fileUrl" type="primary" size="mini" @click="download(item)">下载</el-button> |
||||
</div> |
||||
</div> |
||||
<div class="meta"> |
||||
<span class="key">答案解析:</span> |
||||
<span class="val">{{item.answer_analysis}}</span> |
||||
</div> |
||||
<div class="flex a-center point"> |
||||
<div class="meta"> |
||||
<span class="key">题目分数:</span> |
||||
<div class="val">{{item.question_points}} 分</div> |
||||
</div> |
||||
<div class="meta"> |
||||
<span class="key">考试得分:</span> |
||||
<div class="val"> |
||||
<input type="text" v-model.number="item.question_score" :disabled="!isReview || !item.isSub"> 分 |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="btns" v-if="isReview"> |
||||
<button type="button" class="submit" @click="save(1)">提交</button> |
||||
<button type="button" @click="save(0)">保存</button> |
||||
</div> |
||||
|
||||
<div v-show="playAuth" class="el-image-viewer__wrapper" :class="{active: playAuth}" style="z-index: 2000"> |
||||
<div class="el-image-viewer__mask"></div> |
||||
<span class="el-image-viewer__btn el-image-viewer__close" @click="closePlayer"><i class="el-icon-circle-close" style="color: #fff"></i></span> |
||||
<div class="player" id="player"></div> |
||||
</div> |
||||
<pdf :visible.sync="pdfVisible" :src.sync="pdfSrc"></pdf> |
||||
</div> |
||||
</template> |
||||
<script> |
||||
import setBackground from '@/mixins/setBackground' |
||||
import file from '@/mixins/file' |
||||
import { mapState,mapGetters,mapActions } from 'vuex' |
||||
import pdf from '@/components/pdf' |
||||
export default { |
||||
mixins: [ setBackground,file ], |
||||
data() { |
||||
return { |
||||
paperName: '', |
||||
userName: '', |
||||
this_score: '', |
||||
duration: '', |
||||
list: [], |
||||
look: '1', |
||||
}; |
||||
}, |
||||
computed: { |
||||
...mapState('user', [ |
||||
'userId','clientId' |
||||
]), |
||||
...mapState('assessment', [ |
||||
'reviewId','paperId','isReview','reviewStatus','stuId' |
||||
]), |
||||
...mapGetters('assessment', [ |
||||
'getCorrectingName' |
||||
]) |
||||
}, |
||||
watch: { |
||||
look(val,oldVal){ |
||||
val == 1 ? this.getData() : this.getWrong() |
||||
} |
||||
}, |
||||
components: { pdf }, |
||||
mounted() { |
||||
this.getData() |
||||
}, |
||||
methods: { |
||||
getData() { |
||||
this.$post(`${this.api.correcting}?assessmentId=${this.reviewId}&userId=${this.stuId}&paperId=${this.paperId}`) |
||||
.then(res => { |
||||
let list = res.data.list |
||||
list.forEach(n => { |
||||
n.isCorrecting == 0 && (n.question_score = '') |
||||
n.isSub = n.typeName == '简答题' |
||||
if(n.typeName == '填空题'){ |
||||
let answer = [] |
||||
for(let i in n){ |
||||
if(i.includes('option_')) answer.push(n[i]) |
||||
} |
||||
n.answer = answer.join('|') |
||||
n.user_answer = n.user_answer.replace(/<>/g,'|') |
||||
} |
||||
if(n.fileUrl){ |
||||
let file = n.fileUrl.split(',') |
||||
n.fileName = file[0] |
||||
n.fileurl = file[1] |
||||
} |
||||
if(n.videoAudio){ |
||||
let file = n.videoAudio.split(',') |
||||
n.fileName = file[0] |
||||
n.fileurl = file[1] |
||||
} |
||||
}) |
||||
this.list = list |
||||
this.paperName = list[0].name |
||||
this.userName = list[0].userName |
||||
this.this_score = list[0].this_score |
||||
this.duration = list[0].duration |
||||
}) |
||||
.catch(err => {}) |
||||
}, |
||||
getWrong(){ |
||||
this.$post(`${this.api.getWrong}?assessmentId=${this.reviewId}&userId=${this.stuId}&paperId=${this.paperId}`) |
||||
.then(res => { |
||||
this.list = res.data.list |
||||
}).catch(err => {}) |
||||
}, |
||||
save(status) { |
||||
let isEmpty = false |
||||
let isNotNum = false |
||||
let invalid = false |
||||
this.list.map(n => { |
||||
if(n.question_score === '') isEmpty = true |
||||
if(isNaN(n.question_score)) isNotNum = true |
||||
if(Number(n.question_score) > Number(n.question_points)) invalid = true |
||||
}) |
||||
if(status){ |
||||
if(isEmpty) return this.$message.warning('请批阅完所有题目') |
||||
if(isNotNum) return this.$message.warning('考试得分请输入数字') |
||||
} |
||||
if(invalid) return this.$message.warning('考试得分不得大于题目分数') |
||||
let data = { |
||||
review: [], |
||||
assessmentId: this.reviewId, |
||||
userId: this.stuId, |
||||
paperId: this.paperId, |
||||
teacherId: this.userId, |
||||
} |
||||
let totalScore = 0 |
||||
this.list.map(n => { |
||||
n.question_score !== '' && n.isSub && data.review.push({ |
||||
detailId: Number(n.detailId) , |
||||
score: Number(n.question_score) |
||||
}) |
||||
totalScore += Number(n.question_score) |
||||
}) |
||||
if(!data.review.length) return this.$message.warning('请至少批阅一道题目') |
||||
|
||||
if(status || this.list.filter(n => n.isSub).length == data.review.length){ |
||||
data.totalScore = totalScore |
||||
} |
||||
this.$post(this.api.reviewByid,data).then(res => { |
||||
this.$message.success(status ? '提交成功' : '保存成功') |
||||
this.$router.back() |
||||
}).catch(err => {}) |
||||
}, |
||||
}, |
||||
}; |
||||
</script> |
||||
|
||||
<style lang="scss" scoped> |
||||
.title{ |
||||
text-align: center; |
||||
font-size: 18px; |
||||
font-weight: 600; |
||||
} |
||||
.metas{ |
||||
display: flex; |
||||
justify-content: space-between; |
||||
margin: 20px 0 30px; |
||||
.name{ |
||||
font-size: 12px; |
||||
color: #717171; |
||||
} |
||||
.val{ |
||||
font-size: 12px; |
||||
color: #929292; |
||||
} |
||||
} |
||||
.wrap{ |
||||
padding: 20px; |
||||
background-color: #fbfbfb; |
||||
|
||||
.select{ |
||||
padding: 10px; |
||||
margin-bottom: 20px; |
||||
border-bottom: 1px solid #f4f4f4; |
||||
} |
||||
|
||||
.item{ |
||||
padding-bottom: 30px; |
||||
margin-bottom: 30px; |
||||
border-bottom: 1px dashed #d2d2d2; |
||||
&:last-child{ |
||||
border-bottom: 0; |
||||
} |
||||
|
||||
.status{ |
||||
color: #cb221c; |
||||
&.done{ |
||||
color: #56d5bf; |
||||
} |
||||
} |
||||
.name{ |
||||
margin-top: 15px; |
||||
font-size: 14px; |
||||
color: #555555; |
||||
} |
||||
.key{ |
||||
font-weight: bold; |
||||
color: #333; |
||||
} |
||||
.val{ |
||||
color: #757575; |
||||
} |
||||
.answer{ |
||||
display: flex; |
||||
align-items: center; |
||||
padding: 15px; |
||||
margin: 15px 0; |
||||
font-size: 12px; |
||||
border: 1px solid #e8e8e8; |
||||
background-color: #f3f2f2; |
||||
.info{ |
||||
display: inline-flex; |
||||
align-items: center; |
||||
margin-right: 30px; |
||||
} |
||||
} |
||||
.meta{ |
||||
display: flex; |
||||
align-items: center; |
||||
padding-left: 10px; |
||||
margin: 10px 0; |
||||
font-size: 12px; |
||||
.key{ |
||||
width: 80px; |
||||
margin-right: 10px; |
||||
text-align: right; |
||||
white-space: nowrap; |
||||
} |
||||
input{ |
||||
width: 60px; |
||||
height: 28px; |
||||
padding: 0 5px; |
||||
margin-right: 5px; |
||||
color: #444; |
||||
background-color: #fff; |
||||
border: 1px solid #ebebeb; |
||||
box-sizing: border-box; |
||||
&:focus{ |
||||
outline: none; |
||||
} |
||||
&:disabled{ |
||||
background-color: #e8e8e8; |
||||
cursor: not-allowed; |
||||
} |
||||
} |
||||
} |
||||
.point{ |
||||
.meta{ |
||||
margin: 0; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
.player{ |
||||
position: absolute; |
||||
top: 50%; |
||||
left: 50%; |
||||
transform: translate(-50%,-50%); |
||||
width: 1200px !important; |
||||
height: 600px !important; |
||||
} |
||||
</style> |
Loading…
Reference in new issue