提交 f99803b3 authored 作者: haodaking's avatar haodaking

课程作业提交提示语修改

上级 d3b27796
...@@ -27,12 +27,7 @@ ...@@ -27,12 +27,7 @@
<em class="player-button player-button-download" v-if="chapter.pdf"> <em class="player-button player-button-download" v-if="chapter.pdf">
<a :href="chapter.pdf" download target="_blank">下载PPT</a> <a :href="chapter.pdf" download target="_blank">下载PPT</a>
</em> </em>
<em <em :class="pptClass" @click="togglePPTVisible" v-if="chatperResources.ppts.length">同步显示PPT</em>
:class="pptClass"
@click="togglePPTVisible"
v-if="chatperResources.ppts.length"
>同步显示PPT</em
>
<em :class="skipClass" @click="toggleSkip">始终跳过片头</em> <em :class="skipClass" @click="toggleSkip">始终跳过片头</em>
</div> </div>
</div> </div>
...@@ -159,7 +154,7 @@ export default { ...@@ -159,7 +154,7 @@ export default {
this.isPlaying = true this.isPlaying = true
const ppts = this.chatperResources.ppts || [] const ppts = this.chatperResources.ppts || []
let index = this.chatperResources.ppts.findIndex( let index = this.chatperResources.ppts.findIndex(
(item) => item.ppt_point > time item => item.ppt_point > time
) )
index = index !== -1 ? index - 1 : ppts.length - 1 index = index !== -1 ? index - 1 : ppts.length - 1
this.$emit('change-ppt', index) this.$emit('change-ppt', index)
...@@ -191,12 +186,12 @@ export default { ...@@ -191,12 +186,12 @@ export default {
getChapterVideo() { getChapterVideo() {
// 视频播放类型 1是CC加密; 2是非加密; 3是阿里云 // 视频播放类型 1是CC加密; 2是非加密; 3是阿里云
if (this.videoProvider === 3) { if (this.videoProvider === 3) {
api.getChapterVideoAliyun(this.resourceId).then((response) => { api.getChapterVideoAliyun(this.resourceId).then(response => {
this.chatperResources = response this.chatperResources = response
Array.isArray(response.ppts) && this.$emit('pptupdate', response.ppts) Array.isArray(response.ppts) && this.$emit('pptupdate', response.ppts)
}) })
} else { } else {
api.getChapterVideo(this.resourceId).then((response) => { api.getChapterVideo(this.resourceId).then(response => {
let { video, audio, ppts } = response let { video, audio, ppts } = response
video = video.reduce( video = video.reduce(
(result, item) => { (result, item) => {
...@@ -221,7 +216,7 @@ export default { ...@@ -221,7 +216,7 @@ export default {
.getChapterVideoProgress(this.sid, this.resourceId, { .getChapterVideoProgress(this.sid, this.resourceId, {
device_id: Cookies.get('_idt') device_id: Cookies.get('_idt')
}) })
.then((response) => { .then(response => {
this.progress = response this.progress = response
// 跳转播放进度 // 跳转播放进度
if (this.player && response.cpt) { if (this.player && response.cpt) {
......
...@@ -32,9 +32,7 @@ ...@@ -32,9 +32,7 @@
</div> </div>
</div> </div>
<div class="buttons"> <div class="buttons">
<el-button type="primary" @click="onReEdit" :disabled="!isWorkTime" <el-button type="primary" @click="onReEdit" :disabled="!isWorkTime">重新编辑</el-button>
>重新编辑</el-button
>
</div> </div>
</template> </template>
<!-- 正常状态 --> <!-- 正常状态 -->
...@@ -55,9 +53,7 @@ ...@@ -55,9 +53,7 @@
</div> </div>
</template> </template>
<template v-else-if="detail.created_time"> <template v-else-if="detail.created_time">
<p class="help"> <p class="help">已于 {{ detail.created_time }} 提交,等待老师批改中。</p>
已于 {{ detail.created_time }} 提交,等待老师批改中。
</p>
<template <template
v-if=" v-if="
detail.updated_time && detail.updated_time &&
...@@ -70,16 +66,12 @@ ...@@ -70,16 +66,12 @@
</div> </div>
</div> </div>
<div class="buttons"> <div class="buttons">
<el-tooltip <el-tooltip content="在获老师批改之前,可以多次提交,将以最后一次提交为准" placement="right">
content="在获老师批改之前,可以多次提交,将以最后一次提交为准"
placement="right"
>
<el-button <el-button
type="primary" type="primary"
@click="onSubmit" @click="onSubmit"
:disabled="disabled || !isWorkTime" :disabled="disabled || !isWorkTime"
>{{ submitText }}</el-button >{{ submitText }}</el-button>
>
</el-tooltip> </el-tooltip>
</div> </div>
</template> </template>
...@@ -177,7 +169,7 @@ export default { ...@@ -177,7 +169,7 @@ export default {
getDeadline() { getDeadline() {
api api
.getChapterHomeworkDeadline(this.sid, this.cid, this.pid) .getChapterHomeworkDeadline(this.sid, this.cid, this.pid)
.then((response) => { .then(response => {
this.deadline = response.dead_line this.deadline = response.dead_line
}) })
}, },
...@@ -186,16 +178,16 @@ export default { ...@@ -186,16 +178,16 @@ export default {
this.loading = true this.loading = true
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) ? null : response
if (this.detail) { if (this.detail) {
// -1未处理 0已处理 1驳回 // -1未处理 0已处理 1驳回
this.disabled = [0, 1].includes(this.detail.status) this.disabled = [0, 1].includes(this.detail.status)
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 => {
const found = parseAnswers.find( const found = parseAnswers.find(
(answer) => answer.question_id === item.id answer => answer.question_id === item.id
) )
if (found) { if (found) {
item.user_answer = found.descreption item.user_answer = found.descreption
...@@ -215,7 +207,7 @@ export default { ...@@ -215,7 +207,7 @@ export default {
if (!list) { if (!list) {
return [] return []
} }
return list.map((item) => { return list.map(item => {
let temp = null let temp = null
if (item.question_type === 1) { if (item.question_type === 1) {
// 单选 // 单选
...@@ -268,7 +260,9 @@ export default { ...@@ -268,7 +260,9 @@ export default {
// 校验 // 校验
if (!this.checkSubmit()) { if (!this.checkSubmit()) {
this.messageInstance && this.messageInstance.close() this.messageInstance && this.messageInstance.close()
this.messageInstance = this.$message.error('还有题目未做,不能提交') this.messageInstance = this.$message.error(
'答题内容不能为空,请检查并输入内容'
)
return return
} }
// 计算答题时间 // 计算答题时间
...@@ -276,7 +270,7 @@ export default { ...@@ -276,7 +270,7 @@ export default {
(new Date().getTime() - this.startTime) / 1000 (new Date().getTime() - this.startTime) / 1000
) )
// 提交的答案数据 // 提交的答案数据
const answers = this.questions.map((item) => { const answers = this.questions.map(item => {
return { return {
question_id: item.id, question_id: item.id,
descreption: descreption:
...@@ -303,7 +297,7 @@ export default { ...@@ -303,7 +297,7 @@ export default {
handleSubmitRequest(params) { handleSubmitRequest(params) {
api api
.sbumitChapterHomework(params) .sbumitChapterHomework(params)
.then((response) => { .then(response => {
if (response.status) { if (response.status) {
this.$message.success('提交成功,等待批改') this.$message.success('提交成功,等待批改')
this.getDetail() this.getDetail()
...@@ -311,7 +305,7 @@ export default { ...@@ -311,7 +305,7 @@ export default {
this.$message.error(response.data.error) this.$message.error(response.data.error)
} }
}) })
.catch((error) => { .catch(error => {
this.$message.error(error.message) this.$message.error(error.message)
}) })
}, },
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
ref="ruleForm" ref="ruleForm"
> >
<el-form-item label="主题" prop="essay_name"> <el-form-item label="主题" prop="essay_name">
<el-input v-model="ruleForm.essay_name" placeholder="主题"></el-input> <el-input v-model="ruleForm.essay_name" placeholder="主题" maxlength="50"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="正文" prop="essay_description"> <el-form-item label="正文" prop="essay_description">
<!-- 编辑器 --> <!-- 编辑器 -->
...@@ -108,11 +108,10 @@ export default { ...@@ -108,11 +108,10 @@ export default {
}, },
rules: { rules: {
essay_name: [ essay_name: [
{ required: true, message: '请输入主题', trigger: 'blur' }, { required: true, message: '请输入主题', trigger: 'blur' }
{ max: 50, message: '最多输入 50 个字符', trigger: 'blur' }
], ],
essay_description: [ essay_description: [
{ required: true, message: '请输入正文', trigger: 'blur' } { required: true, message: '请输入正文', trigger: 'change' }
], ],
url: [{ required: true, message: '请上传附件', trigger: 'change' }] url: [{ required: true, message: '请上传附件', trigger: 'change' }]
}, },
...@@ -159,19 +158,24 @@ export default { ...@@ -159,19 +158,24 @@ export default {
}, },
// 提交 // 提交
onSubmit() { onSubmit() {
this.$refs.ruleForm this.messageInstance && this.messageInstance.close()
.validate() if (!this.ruleForm.essay_name) {
.then(response => { this.messageInstance = this.$message.error('请输入主题')
return
}
if (!this.ruleForm.essay_description) {
this.messageInstance = this.$message.error('请输入正文')
return
}
if (!this.ruleForm.url) {
this.messageInstance = this.$message.error('请上传附件')
return
}
const params = Object.assign(this.ruleForm, { const params = Object.assign(this.ruleForm, {
semester_id: this.sid, semester_id: this.sid,
course_id: this.cid course_id: this.cid
}) })
this.handleSubmitRequest(params) this.handleSubmitRequest(params)
})
.catch(() => {
this.messageInstance && this.messageInstance.close()
this.messageInstance = this.$message.error('还有题目未做,不能提交')
})
}, },
// 请求提交接口 // 请求提交接口
handleSubmitRequest(params) { handleSubmitRequest(params) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论