提交 31decb36 authored 作者: 王鹏飞's avatar 王鹏飞

优化作业驳回

上级 064d8228
<template>
<div>
<div ref="box" :class="classes">
<slot></slot>
</div>
<div class="block-control" @click="toggle" v-if="hasMore">
<template v-if="isOpen"> <i class="el-icon-caret-top"></i><span>收起</span> </template>
<template v-else> <i class="el-icon-caret-bottom"></i><span>展开</span> </template>
</div>
</div>
</template>
<script>
export default {
data() {
return {
max: 300,
hasMore: false,
isOpen: false
}
},
computed: {
classes() {
return {
'has-more': this.hasMore && !this.isOpen
}
}
},
methods: {
init() {
const height = this.$refs.box.offsetHeight
this.hasMore = height > this.max
},
toggle() {
this.isOpen = !this.isOpen
}
},
mounted() {
this.init()
}
}
</script>
<style lang="scss">
.block-control {
height: 20px;
display: flex;
align-items: center;
justify-content: center;
margin-top: 10px;
padding-top: 5px;
color: #d3dce6;
cursor: pointer;
border-top: 1px solid #eaeefb;
i {
font-size: 16px;
}
span {
display: none;
padding-left: 5px;
font-size: 12px;
}
&:hover {
color: #1f2f3d;
span {
display: block;
}
}
}
.has-more {
max-height: 300px;
overflow: hidden;
}
</style>
<template> <template>
<div> <div>
<container :title="chapter.name" v-loading="loading"> <container :title="chapter.name" v-loading="loading" id="work">
<template v-slot:header-aside v-if="isRevised"> <template v-slot:header-aside v-if="isRevised">
{{ $t('viewerWork.score') }}{{ detail.score }}{{ $t('viewerWork.fractionUnit') }} <p v-if="hasScore">{{ $t('viewerWork.score') }}{{ detail.score }}{{ $t('viewerWork.fractionUnit') }}</p>
</template> </template>
<div class="exam-form"> <div class="exam-form">
<template v-for="(item, index) in questions"> <template v-for="(item, index) in questions">
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
</div> </div>
<p style="color: red" v-if="deadline">{{ $t('viewerWork.deadline', { date: deadline }) }}</p> <p style="color: red" v-if="deadline">{{ $t('viewerWork.deadline', { date: deadline }) }}</p>
<!-- 驳回状态 --> <!-- 驳回状态 -->
<template v-if="detail.status === 1"> <template v-if="detail.status === 8">
<div class="work-bottom"> <div class="work-bottom">
<div class="info"> <div class="info">
<div class="paper-check"> <div class="paper-check">
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
</template> </template>
<!-- 正常状态 --> <!-- 正常状态 -->
<template v-else> <template v-else>
<div class="work-bottom" v-if="detail"> <div class="work-bottom">
<div class="info"> <div class="info">
<template v-if="isRevised"> <template v-if="isRevised">
<div class="paper-check"> <div class="paper-check">
...@@ -77,7 +77,34 @@ ...@@ -77,7 +77,34 @@
</div> </div>
</template> </template>
</container> </container>
<chapter-work-comment :endDate="commentEndDate" :status="detail.status2" v-if="showComment" />
<chapter-work-comment
:endDate="commentEndDate"
:status="detail.status2"
@update="getDetail"
v-if="showComment"
id="comment"
/>
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="400px">
<div class="paper-check-item">
<p>您本次的作业被老师驳回,请您重新编辑作业提交!</p>
</div>
<div class="paper-check-item">
<span>{{ $t('viewerWork.rejectTime') }}</span>
{{ detail.checker_time }}
</div>
<div class="paper-check-item">
<span>{{ $t('viewerWork.rejectContent') }}</span>
<div class="edit_html" v-html="detail.check_comments"></div>
</div>
<div class="paper-check-item">
<p>注:重新提交后不可修改,请检查好作业内容再做提交。</p>
</div>
<template #footer>
<el-button type="primary" @click="onReEdit">重新编辑</el-button>
</template>
</el-dialog>
</div> </div>
</template> </template>
...@@ -125,11 +152,9 @@ export default { ...@@ -125,11 +152,9 @@ export default {
hasComment: false, // 是否评论 hasComment: false, // 是否评论
commentEndDate: '', commentEndDate: '',
rules: { rules: {
user_answer: [ user_answer: [{ required: true, message: '请输入', trigger: 'change' }]
{ required: true, message: '请输入', trigger: 'change' } },
// { max: 1000, message: '最多输入1000个字符', trigger: 'change' } dialogVisible: false
]
}
} }
}, },
watch: { watch: {
...@@ -179,7 +204,7 @@ export default { ...@@ -179,7 +204,7 @@ export default {
}, },
hasScore() { hasScore() {
// allow_score 1 显示 2隐藏 // allow_score 1 显示 2隐藏
return this.detail.allow_score !== 2 return this.detail.allow_score !== 2 && this.detail.score
}, },
// 显示作业评论 // 显示作业评论
showComment() { showComment() {
...@@ -188,11 +213,19 @@ export default { ...@@ -188,11 +213,19 @@ export default {
return this.hasComment && currentTime > endTime return this.hasComment && currentTime > endTime
}, },
disabled() { disabled() {
if (this.detail.status === 9) { if (this.detail.status === 1) {
return false return false
} }
// -1未处理 0已处理 1驳回 9重新编辑 // -1未处理 0已处理 1驳回
return [0, 1].includes(this.detail.status) || !this.isWorkTime return this.detail.status === 0 || !this.isWorkTime
},
dialogTitle() {
if (this.detail.status === 1) {
return '作业驳回'
}
if (this.detail.status2 === 1) {
return '互评作业驳回'
}
} }
}, },
methods: { methods: {
...@@ -213,6 +246,9 @@ export default { ...@@ -213,6 +246,9 @@ export default {
.getChapterHomework(this.sid, this.cid, this.resourceId) .getChapterHomework(this.sid, this.cid, this.resourceId)
.then(response => { .then(response => {
this.detail = Array.isArray(response) ? {} : response this.detail = Array.isArray(response) ? {} : response
if (this.detail.status === 1 || this.detail.status2 === 1) {
this.dialogVisible = true
}
if (this.detail.id) { if (this.detail.id) {
const parseAnswers = JSON.parse(this.detail.work_contents) const parseAnswers = JSON.parse(this.detail.work_contents)
// 设置答案 // 设置答案
...@@ -336,7 +372,12 @@ export default { ...@@ -336,7 +372,12 @@ export default {
}, },
// 重新编辑 // 重新编辑
onReEdit() { onReEdit() {
this.detail.status = 9 this.dialogVisible = false
if (this.detail.status2 === 1) {
window.location.hash = '#comment'
} else {
window.location.hash = '#work'
}
} }
}, },
beforeMount() { beforeMount() {
...@@ -369,6 +410,7 @@ export default { ...@@ -369,6 +410,7 @@ export default {
} }
} }
.paper-check-item { .paper-check-item {
padding: 5px 0;
display: flex; display: flex;
b { b {
white-space: nowrap; white-space: nowrap;
......
...@@ -3,11 +3,13 @@ ...@@ -3,11 +3,13 @@
<div class="chapter-work-answer-item-hd">{{ nickname }}:</div> <div class="chapter-work-answer-item-hd">{{ nickname }}:</div>
<div class="chapter-work-answer-item-bd"> <div class="chapter-work-answer-item-bd">
<div class="item" v-for="item in workList" :key="item.question_id"> <div class="item" v-for="item in workList" :key="item.question_id">
<div v-html="decode(item.descreption)"></div> <show-more>
<a :href="item.file_url" target="_blank" class="file" v-if="item.file_url"> <div v-html="decode(item.descreption)"></div>
<i class="el-icon-document"></i> <a :href="item.file_url" target="_blank" class="file" v-if="item.file_url">
{{ $t('viewerWork.downloadName') }} <i class="el-icon-document"></i>
</a> {{ $t('viewerWork.downloadName') }}
</a>
</show-more>
</div> </div>
</div> </div>
<slot /> <slot />
...@@ -16,12 +18,13 @@ ...@@ -16,12 +18,13 @@
<script> <script>
import Base64 from 'Base64' import Base64 from 'Base64'
import showMore from '@/components/showMore'
export default { export default {
props: { props: {
index: { type: Number, default: 0 }, index: { type: Number, default: 0 },
data: { type: Object, default: () => ({}) } data: { type: Object, default: () => ({}) }
}, },
components: { showMore },
data() { data() {
return {} return {}
}, },
......
...@@ -119,6 +119,7 @@ export default { ...@@ -119,6 +119,7 @@ export default {
.then(response => { .then(response => {
this.$message({ type: 'success', message: response.message }) this.$message({ type: 'success', message: response.message })
this.getList() this.getList()
this.$emit('update')
}) })
.catch(error => { .catch(error => {
this.$message({ type: 'error', message: error.message }) this.$message({ type: 'error', message: error.message })
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论