提交 64cbed3b authored 作者: 王鹏飞's avatar 王鹏飞

章节作业支持驳回

上级 bb3b7053
...@@ -18,6 +18,16 @@ export default { ...@@ -18,6 +18,16 @@ export default {
ckEditor: null ckEditor: null
} }
}, },
watch: {
disabled: {
immediate: true,
handler(value) {
if (this.ckEditor && this.ckEditor.instanceReady) {
this.ckEditor.setReadOnly(value)
}
}
}
},
methods: { methods: {
createEditor() { createEditor() {
const editor = (this.ckEditor = CKEDITOR.replace(this.textareaElementId, { const editor = (this.ckEditor = CKEDITOR.replace(this.textareaElementId, {
...@@ -74,11 +84,11 @@ export default { ...@@ -74,11 +84,11 @@ export default {
})) }))
editor.on('instanceReady', () => { editor.on('instanceReady', () => {
const data = this.value const data = this.value
editor.fire('lockSnapshot') editor.fire('lockSnapshot')
editor.setData(data, { editor.setData(data, {
callback: () => { callback: () => {
editor.setReadOnly(this.disabled)
this.bindEvent() this.bindEvent()
const newData = editor.getData() const newData = editor.getData()
......
<template> <template>
<div class="upload"> <div class="upload">
<el-upload action :show-file-list="false" :http-request="httpRequest"> <el-upload action :show-file-list="false" :http-request="httpRequest" v-bind="$attrs">
<slot></slot> <slot></slot>
<el-button type="text" size="small" icon="el-icon-upload">点击上传</el-button> <el-button type="text" size="small" icon="el-icon-upload">点击上传</el-button>
<template v-slot:tip> <template v-slot:tip>
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
</div> </div>
</div> </div>
<div class="play-paper-content play-chapter-work"> <div class="play-paper-content play-chapter-work">
<el-form ref="form" :disabled="disabled">
<ul> <ul>
<li v-for="(item, index) in questions" :key="index"> <li v-for="(item, index) in questions" :key="index">
<div class="work-number">{{index + 1}}.</div> <div class="work-number">{{index + 1}}.</div>
...@@ -14,22 +15,34 @@ ...@@ -14,22 +15,34 @@
<div class="edit_html" v-html="item.question_content"></div> <div class="edit_html" v-html="item.question_content"></div>
</div> </div>
<!-- 文本内容 --> <!-- 文本内容 -->
<v-editor v-model="item.descreption"></v-editor> <v-editor v-model="item.descreption" :disabled="disabled"></v-editor>
<!-- 上传附件 --> <!-- 上传附件 -->
<v-upload v-model="item.file_url">请上传对应的文件附件:</v-upload> <v-upload v-model="item.file_url">请上传对应的文件附件:</v-upload>
</li> </li>
</ul> </ul>
</el-form>
<template v-if="deadLine"> <template v-if="deadLine">
<p style="color: red">请于截止日期 {{deadLine}} 前提交</p> <p style="color: red">请于截止日期 {{deadLine}} 前提交</p>
</template> </template>
<div class="area-btns"> <!-- 驳回状态 -->
<div class="area-btns" v-if="homeData.status === 1">
<el-button type="primary" @click="onReEdit">重新编辑</el-button>
<div class="play-paper-check">
<h4>作业被驳回,点击“重新编辑”按钮重新编辑内容再次提交</h4>
<div class="play-paper-check-item">
<b>评语:</b>
<div class="edit_html" v-html="homeData.check_comments"></div>
</div>
</div>
</div>
<div class="area-btns" v-else>
<el-button <el-button
type="primary" type="primary"
@click="submitWork" @click="submitWork"
:disabled="!!homeData.checker_time || deadLineFlag" :disabled="homeData.status === 0 || deadLineFlag"
>{{homeData.checker_time ? '已批改' : '提交'}}</el-button> >{{homeData.status === 0 ? '已批改' : '提交'}}</el-button>
<span class="help-info">&emsp;&emsp;在获老师批改之前,可以多次提交,将以最后一次提交为准</span> <span class="help-info">&emsp;&emsp;在获老师批改之前,可以多次提交,将以最后一次提交为准</span>
<template v-if="homeData.checker_time"> <template v-if="homeData.status === 0 && homeData.checker_time">
<div class="play-paper-check"> <div class="play-paper-check">
<h4> <h4>
已获批改 已获批改
...@@ -76,7 +89,8 @@ export default { ...@@ -76,7 +89,8 @@ export default {
homeData: {}, homeData: {},
deadLine: '', deadLine: '',
deadLineFlag: false, deadLineFlag: false,
questions: [] questions: [],
disabled: false
} }
}, },
watch: { watch: {
...@@ -107,8 +121,12 @@ export default { ...@@ -107,8 +121,12 @@ export default {
}) })
cAction.Player.getHomework(this.sid, this.cid, this.id) cAction.Player.getHomework(this.sid, this.cid, this.id)
.then(data => { .then(data => {
if (Array.isArray(data)) {
return
}
this.homeData = data this.homeData = data
// 状态处理
this.disabled = data.status === 0 || data.status === 1
const parseAnswers = JSON.parse(data.work_contents) const parseAnswers = JSON.parse(data.work_contents)
this.questions = this.questions.map(item => { this.questions = this.questions.map(item => {
const found = parseAnswers.find( const found = parseAnswers.find(
...@@ -125,7 +143,6 @@ export default { ...@@ -125,7 +143,6 @@ export default {
}) })
}) })
.catch(e => { .catch(e => {
this.filesArr.pop()
this.$message.error(e.message) this.$message.error(e.message)
}) })
.finally(() => { .finally(() => {
...@@ -181,12 +198,16 @@ export default { ...@@ -181,12 +198,16 @@ export default {
} }
}) })
.catch(e => { .catch(e => {
this.filesArr.pop()
this.$message.error(e.message) this.$message.error(e.message)
}) })
.finally(() => { .finally(() => {
loading.close() loading.close()
}) })
},
// 重新编辑
onReEdit() {
this.disabled = false
this.homeData.status = -1
} }
} }
} }
......
...@@ -3,7 +3,8 @@ let conf = {} ...@@ -3,7 +3,8 @@ let conf = {}
if (state === 'test') { if (state === 'test') {
conf.agentApiUrl = 'https://api2.ezijing.com/' conf.agentApiUrl = 'https://api2.ezijing.com/'
conf.apiKey = 'mwLyCymyEVCcKTn7nKDjYIMPBwScbugX' conf.apiKey = 'mwLyCymyEVCcKTn7nKDjYIMPBwScbugX'
conf.host = 'lms-api2.ezijing.com' // conf.host = 'lms-api2.ezijing.com'
conf.host = 'docker-lms-api.ezijing.com'
} else if (state === 'production') { } else if (state === 'production') {
conf.agentApiUrl = 'https://zapi.ezijing.com/' conf.agentApiUrl = 'https://zapi.ezijing.com/'
conf.apiKey = 'mwLyCymyEVCcKTn7nKDjYIMPBwScbugX' conf.apiKey = 'mwLyCymyEVCcKTn7nKDjYIMPBwScbugX'
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论