|
|
|
@ -2,7 +2,7 @@ |
|
|
|
|
<div> |
|
|
|
|
<el-card shadow="hover" class="m-b-20"> |
|
|
|
|
<div class="flex-between"> |
|
|
|
|
<el-page-header @back="goBack" :content="id ? '编辑课程' : '新增课程'"></el-page-header> |
|
|
|
|
<el-page-header @back="goback" :content="id ? '编辑课程' : '新增课程'"></el-page-header> |
|
|
|
|
</div> |
|
|
|
|
</el-card> |
|
|
|
|
|
|
|
|
@ -89,10 +89,6 @@ export default { |
|
|
|
|
quill |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
// 返回 |
|
|
|
|
goBack() { |
|
|
|
|
this.$router.back(); |
|
|
|
|
}, |
|
|
|
|
save() { |
|
|
|
|
if (this.submiting) return false; |
|
|
|
|
if (!this.name) return util.warningMsg("请填写课程名称"); |
|
|
|
@ -115,8 +111,7 @@ export default { |
|
|
|
|
this.submiting = false; |
|
|
|
|
util.successMsg("修改成功"); |
|
|
|
|
this.$router.back(); |
|
|
|
|
}) |
|
|
|
|
.catch(err => { |
|
|
|
|
}).catch(err => { |
|
|
|
|
this.submiting = false; |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
@ -126,14 +121,12 @@ export default { |
|
|
|
|
type: "success", |
|
|
|
|
confirmButtonText: "马上设置", |
|
|
|
|
cancelButtonText: "稍后操作" |
|
|
|
|
}) |
|
|
|
|
.then(() => { |
|
|
|
|
this.$router.push(`courseConfig?id=${res.data.courseId}`); |
|
|
|
|
}).then(() => { |
|
|
|
|
this.$router.push(`/course/contentSettings?id=${res.courseId}`); |
|
|
|
|
}).catch(() => { |
|
|
|
|
this.$router.back(); |
|
|
|
|
}); |
|
|
|
|
}) |
|
|
|
|
.catch(err => { |
|
|
|
|
}).catch(err => { |
|
|
|
|
this.submiting = false; |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
@ -141,12 +134,10 @@ export default { |
|
|
|
|
getClassification() { |
|
|
|
|
this.$get(this.api.queryGlClassification).then(res => { |
|
|
|
|
this.classificationList = res.classificationList; |
|
|
|
|
}).catch(res => { |
|
|
|
|
}); |
|
|
|
|
}).catch(res => {}); |
|
|
|
|
}, |
|
|
|
|
getData() { |
|
|
|
|
this.$get(`${this.api.getCourse}/${this.id}`) |
|
|
|
|
.then(res => { |
|
|
|
|
this.$get(`${this.api.getCourse}/${this.id}`).then(res => { |
|
|
|
|
let data = res.course; |
|
|
|
|
this.name = data.name; |
|
|
|
|
this.classificationId = data.classificationId; |
|
|
|
@ -156,10 +147,7 @@ export default { |
|
|
|
|
name: "cover.jpg", |
|
|
|
|
url: this.coverUrl |
|
|
|
|
}); |
|
|
|
|
}) |
|
|
|
|
.catch(err => { |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
}).catch(err => {}); |
|
|
|
|
}, |
|
|
|
|
handleExceed(files, fileList) { // 上传文件 |
|
|
|
|
util.warningMsg("当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!"); |
|
|
|
@ -182,8 +170,7 @@ export default { |
|
|
|
|
let fileName = this.coverUrl.replace("https://liuwanr.oss-cn-shenzhen.aliyuncs.com/", ""); |
|
|
|
|
this.$del(`${this.api.fileDeletion}?keys=${fileName}`).then(res => { |
|
|
|
|
this.coverUrl = ""; |
|
|
|
|
}).catch(res => { |
|
|
|
|
}); |
|
|
|
|
}).catch(res => {}); |
|
|
|
|
}, |
|
|
|
|
goback() { // 返回 |
|
|
|
|
if (this.isDetail) { |
|
|
|
@ -191,12 +178,9 @@ export default { |
|
|
|
|
} else { |
|
|
|
|
this.$confirm("确定返回?未更新的信息将不会保存。", "提示", { |
|
|
|
|
type: "warning" |
|
|
|
|
}) |
|
|
|
|
.then(() => { |
|
|
|
|
}).then(() => { |
|
|
|
|
this.$router.back(); |
|
|
|
|
}) |
|
|
|
|
.catch(() => { |
|
|
|
|
}); |
|
|
|
|
}).catch(() => {}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|