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

章节作业支持驳回

上级 bb3b7053
......@@ -18,6 +18,16 @@ export default {
ckEditor: null
}
},
watch: {
disabled: {
immediate: true,
handler(value) {
if (this.ckEditor && this.ckEditor.instanceReady) {
this.ckEditor.setReadOnly(value)
}
}
}
},
methods: {
createEditor() {
const editor = (this.ckEditor = CKEDITOR.replace(this.textareaElementId, {
......@@ -74,11 +84,11 @@ export default {
}))
editor.on('instanceReady', () => {
const data = this.value
editor.fire('lockSnapshot')
editor.setData(data, {
callback: () => {
editor.setReadOnly(this.disabled)
this.bindEvent()
const newData = editor.getData()
......
<template>
<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>
<el-button type="text" size="small" icon="el-icon-upload">点击上传</el-button>
<template v-slot:tip>
......
......@@ -7,29 +7,42 @@
</div>
</div>
<div class="play-paper-content play-chapter-work">
<ul>
<li v-for="(item, index) in questions" :key="index">
<div class="work-number">{{index + 1}}.</div>
<div class="work-title">
<div class="edit_html" v-html="item.question_content"></div>
</div>
<!-- 文本内容 -->
<v-editor v-model="item.descreption"></v-editor>
<!-- 上传附件 -->
<v-upload v-model="item.file_url">请上传对应的文件附件:</v-upload>
</li>
</ul>
<el-form ref="form" :disabled="disabled">
<ul>
<li v-for="(item, index) in questions" :key="index">
<div class="work-number">{{index + 1}}.</div>
<div class="work-title">
<div class="edit_html" v-html="item.question_content"></div>
</div>
<!-- 文本内容 -->
<v-editor v-model="item.descreption" :disabled="disabled"></v-editor>
<!-- 上传附件 -->
<v-upload v-model="item.file_url">请上传对应的文件附件:</v-upload>
</li>
</ul>
</el-form>
<template v-if="deadLine">
<p style="color: red">请于截止日期 {{deadLine}} 前提交</p>
</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
type="primary"
@click="submitWork"
:disabled="!!homeData.checker_time || deadLineFlag"
>{{homeData.checker_time ? '已批改' : '提交'}}</el-button>
:disabled="homeData.status === 0 || deadLineFlag"
>{{homeData.status === 0 ? '已批改' : '提交'}}</el-button>
<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">
<h4>
已获批改
......@@ -76,7 +89,8 @@ export default {
homeData: {},
deadLine: '',
deadLineFlag: false,
questions: []
questions: [],
disabled: false
}
},
watch: {
......@@ -107,8 +121,12 @@ export default {
})
cAction.Player.getHomework(this.sid, this.cid, this.id)
.then(data => {
if (Array.isArray(data)) {
return
}
this.homeData = data
// 状态处理
this.disabled = data.status === 0 || data.status === 1
const parseAnswers = JSON.parse(data.work_contents)
this.questions = this.questions.map(item => {
const found = parseAnswers.find(
......@@ -125,7 +143,6 @@ export default {
})
})
.catch(e => {
this.filesArr.pop()
this.$message.error(e.message)
})
.finally(() => {
......@@ -181,12 +198,16 @@ export default {
}
})
.catch(e => {
this.filesArr.pop()
this.$message.error(e.message)
})
.finally(() => {
loading.close()
})
},
// 重新编辑
onReEdit() {
this.disabled = false
this.homeData.status = -1
}
}
}
......
......@@ -3,7 +3,8 @@ let conf = {}
if (state === 'test') {
conf.agentApiUrl = 'https://api2.ezijing.com/'
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') {
conf.agentApiUrl = 'https://zapi.ezijing.com/'
conf.apiKey = 'mwLyCymyEVCcKTn7nKDjYIMPBwScbugX'
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论