提交 064d8228 authored 作者: 王鹏飞's avatar 王鹏飞

bug fixes

上级 24938a73
...@@ -54,6 +54,22 @@ export default { ...@@ -54,6 +54,22 @@ export default {
}, },
onEditorInput(value) { onEditorInput(value) {
this.$emit('input', value) this.$emit('input', value)
this.dispatch('ElFormItem', 'el.form.change', value)
},
dispatch(componentName, eventName, params) {
var parent = this.$parent || this.$root
var name = parent.$options.componentName
while (parent && (!name || name !== componentName)) {
parent = parent.$parent
if (parent) {
name = parent.$options.componentName
}
}
if (parent) {
parent.$emit.apply(parent, [eventName].concat(params))
}
} }
} }
} }
......
<template> <template>
<div> <div>
<container :title="chapter.name" v-loading="loading"> <container :title="chapter.name" v-loading="loading">
<template v-slot:header-aside v-if="isRevised">
{{ $t('viewerWork.score') }}{{ detail.score }}{{ $t('viewerWork.fractionUnit') }}
</template>
<div class="exam-form"> <div class="exam-form">
<template v-for="(item, index) in questions"> <template v-for="(item, index) in questions">
<el-form :disabled="disabled" :key="item.id" ref="form" :model="item.formModel" :rules="rules"> <el-form :disabled="disabled" :key="item.id" ref="form" :model="item.formModel" :rules="rules">
...@@ -19,7 +22,7 @@ ...@@ -19,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 && detail.status === 1"> <template v-if="detail.status === 1">
<div class="work-bottom"> <div class="work-bottom">
<div class="info"> <div class="info">
<div class="paper-check"> <div class="paper-check">
...@@ -74,7 +77,7 @@ ...@@ -74,7 +77,7 @@
</div> </div>
</template> </template>
</container> </container>
<chapter-work-comment :endDate="commentEndDate" v-if="showComment" /> <chapter-work-comment :endDate="commentEndDate" :status="detail.status2" v-if="showComment" />
</div> </div>
</template> </template>
...@@ -111,7 +114,7 @@ export default { ...@@ -111,7 +114,7 @@ export default {
data() { data() {
return { return {
loading: false, loading: false,
detail: null, detail: {},
questions: [], // 问题列表 questions: [], // 问题列表
startTime: new Date().getTime(), // 进入时间 startTime: new Date().getTime(), // 进入时间
messageInstance: null, messageInstance: null,
...@@ -158,7 +161,7 @@ export default { ...@@ -158,7 +161,7 @@ export default {
}, },
// 是否批改 // 是否批改
isRevised() { isRevised() {
return this.detail ? this.detail.status === 0 : false return this.detail.status === 0
}, },
// 提交按钮文本 // 提交按钮文本
submitText() { submitText() {
...@@ -185,11 +188,11 @@ export default { ...@@ -185,11 +188,11 @@ export default {
return this.hasComment && currentTime > endTime return this.hasComment && currentTime > endTime
}, },
disabled() { disabled() {
// -1未处理 0已处理 1驳回 if (this.detail.status === 9) {
if (this.detail && this.detail.status === -1) {
return false return false
} }
return [0, 1].includes(this.detail ? this.detail.status : null) || !this.isWorkTime // -1未处理 0已处理 1驳回 9重新编辑
return [0, 1].includes(this.detail.status) || !this.isWorkTime
} }
}, },
methods: { methods: {
...@@ -209,8 +212,8 @@ export default { ...@@ -209,8 +212,8 @@ export default {
api api
.getChapterHomework(this.sid, this.cid, this.resourceId) .getChapterHomework(this.sid, this.cid, this.resourceId)
.then(response => { .then(response => {
this.detail = Array.isArray(response) ? null : response this.detail = Array.isArray(response) ? {} : response
if (this.detail) { if (this.detail.id) {
const parseAnswers = JSON.parse(this.detail.work_contents) const parseAnswers = JSON.parse(this.detail.work_contents)
// 设置答案 // 设置答案
this.questions = this.questions.map(item => { this.questions = this.questions.map(item => {
...@@ -333,7 +336,7 @@ export default { ...@@ -333,7 +336,7 @@ export default {
}, },
// 重新编辑 // 重新编辑
onReEdit() { onReEdit() {
this.detail.status = -1 this.detail.status = 9
} }
}, },
beforeMount() { beforeMount() {
......
...@@ -45,10 +45,16 @@ export default { ...@@ -45,10 +45,16 @@ export default {
<style lang="scss"> <style lang="scss">
.chatper-work-answer-item { .chatper-work-answer-item {
border-bottom: 1px solid #c9c9c97a; // padding-bottom: 10px;
// border-bottom: 1px solid #c9c9c97a;
margin-bottom: 20px; margin-bottom: 20px;
.item {
padding: 10px;
border-radius: 8px;
background-color: #fff;
}
.item + .item { .item + .item {
border-top: 1px dashed #c9c9c97a; margin-top: 10px;
} }
.file { .file {
display: inline-block; display: inline-block;
...@@ -60,4 +66,12 @@ export default { ...@@ -60,4 +66,12 @@ export default {
} }
} }
} }
.chapter-work-answer-item-hd {
margin-bottom: 10px;
}
.chapter-work-answer-item-bd {
img {
max-width: 100%;
}
}
</style> </style>
<template> <template>
<container :title="$t('viewerWork.commentTitle')"> <container :title="$t('viewerWork.commentTitle')">
<template v-for="(item, index) in list"> <template v-for="(item, index) in list">
<el-form :disabled="disabled" :key="item.id" ref="form" :model="item" :rules="rules"> <el-form
<el-form-item :label="$t('viewerWork.commentMyTitle')" prop="comment"> label-position="top"
:disabled="disabled"
:model="item"
:rules="rules"
:hide-required-asterisk="true"
:key="item.id"
ref="form"
>
<el-form-item prop="comment">
<chapter-work-comment-item <chapter-work-comment-item
:data="item" :data="item"
:index="index" :index="index"
...@@ -36,12 +44,12 @@ import ChapterWorkCommentItem from './chapterWorkCommentItem.vue' ...@@ -36,12 +44,12 @@ import ChapterWorkCommentItem from './chapterWorkCommentItem.vue'
export default { export default {
components: { Container, ChapterWorkCommentItem }, components: { Container, ChapterWorkCommentItem },
props: { endDate: { type: String } }, props: { endDate: { type: String }, status: { type: Number } },
data() { data() {
return { return {
list: [], list: [],
rules: { rules: {
comment: [{ required: true, message: '请输入评价内容', trigger: 'blur' }] comment: [{ required: true, message: '请输入评价内容', trigger: 'change' }]
} }
} }
}, },
...@@ -66,6 +74,10 @@ export default { ...@@ -66,6 +74,10 @@ export default {
}, },
// 是否禁用 // 是否禁用
disabled() { disabled() {
// -1未处理 0已处理 1驳回
if (this.status === 1) {
return false
}
return !this.isSubmitTime return !this.isSubmitTime
} }
}, },
...@@ -131,4 +143,7 @@ export default { ...@@ -131,4 +143,7 @@ export default {
padding-left: 20px; padding-left: 20px;
} }
} }
::v-deep .el-form-item__content {
line-height: 24px;
}
</style> </style>
<template> <template>
<chapter-work-answer-item :data="data" :key="data.id" v-bind="$attrs"> <chapter-work-answer-item :data="data" :key="data.id" v-bind="$attrs">
<h3 class="comment-title">{{ $t('viewerWork.commentMyTitle') }}</h3>
<v-editor v-model="data.comment" :disabled="disabled"></v-editor> <v-editor v-model="data.comment" :disabled="disabled"></v-editor>
</chapter-work-answer-item> </chapter-work-answer-item>
</template> </template>
...@@ -17,3 +18,12 @@ export default { ...@@ -17,3 +18,12 @@ export default {
} }
} }
</script> </script>
<style lang="scss">
.comment-title {
margin: 10px 0;
font-size: 14px;
font-weight: normal;
// padding: 10px 0;
}
</style>
...@@ -12,7 +12,9 @@ body { ...@@ -12,7 +12,9 @@ body {
font-family: 'Source Han Sans CN', 'PingFang SC', -apple-system, 'Microsoft YaHei', 'Helvetica', 'Arial', Verdana, font-family: 'Source Han Sans CN', 'PingFang SC', -apple-system, 'Microsoft YaHei', 'Helvetica', 'Arial', Verdana,
'Hiragino Sans GB', 'Wenquanyi Micro Hei', sans-serif; 'Hiragino Sans GB', 'Wenquanyi Micro Hei', sans-serif;
} }
p {
margin: 0;
}
/* 公共标题 - 样式 /app/learn */ /* 公共标题 - 样式 /app/learn */
.con-title { .con-title {
padding: 0 30px; padding: 0 30px;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论