|
|
@@ -5,9 +5,9 @@
|
|
|
<CommonPreview :id="id" ref="preview" :project-id="project_id" type="edit_preview">
|
|
|
<template #operator="{ courseware }">
|
|
|
<el-popover placement="bottom" width="125" trigger="click">
|
|
|
- <el-link type="primary" @click="saveCoursewareAsTemplate(0)">保存本页为模板</el-link>
|
|
|
- <el-link type="primary" @click="saveCoursewareAsTemplate(3)">保存本课为模板</el-link>
|
|
|
- <el-link type="primary" @click="saveCoursewareAsTemplate(1)">保存本书为模板</el-link>
|
|
|
+ <el-link type="primary" @click="openCreateTemplateDialog(0)">保存本页为模板</el-link>
|
|
|
+ <el-link type="primary" @click="openCreateTemplateDialog(3)">保存本课为模板</el-link>
|
|
|
+ <el-link type="primary" @click="openCreateTemplateDialog(1)">保存本书为模板</el-link>
|
|
|
<span slot="reference" class="link save-template">保存为个人模板</span>
|
|
|
</el-popover>
|
|
|
<span class="link"></span>
|
|
|
@@ -18,12 +18,19 @@
|
|
|
<span class="link" @click="goBackBookList()">返回教材列表</span>
|
|
|
</template>
|
|
|
</CommonPreview>
|
|
|
+
|
|
|
+ <CreateCoursewareAsTemplateVue
|
|
|
+ :visible.sync="visibleTemplate"
|
|
|
+ :scope="templateScope"
|
|
|
+ @confirm="saveCoursewareAsTemplate"
|
|
|
+ />
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import MenuPage from '@/views/personal_workbench/common/menu.vue';
|
|
|
import CommonPreview from '@/components/CommonPreview.vue';
|
|
|
+import CreateCoursewareAsTemplateVue from '@/views/personal_workbench/edit_task/preview/CreateCoursewareAsTemplate.vue';
|
|
|
|
|
|
import { SubmitBookCoursewareToAuditFlow } from '@/api/project';
|
|
|
import { isTrue } from '@/utils/validate';
|
|
|
@@ -34,12 +41,15 @@ export default {
|
|
|
components: {
|
|
|
MenuPage,
|
|
|
CommonPreview,
|
|
|
+ CreateCoursewareAsTemplateVue,
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
id: this.$route.params.id,
|
|
|
project_id: this.$route.query.project_id,
|
|
|
isTrue,
|
|
|
+ visibleTemplate: false,
|
|
|
+ templateScope: 0,
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
|
@@ -61,18 +71,30 @@ export default {
|
|
|
this.$refs.preview.getBookCoursewareInfo(this.$refs.preview.select_node);
|
|
|
});
|
|
|
},
|
|
|
+ openCreateTemplateDialog(scope) {
|
|
|
+ this.visibleTemplate = true;
|
|
|
+ this.templateScope = scope;
|
|
|
+ },
|
|
|
/**
|
|
|
* 保存为个人模板
|
|
|
- * @param {Number} scope 范围
|
|
|
+ * @param {object} form 模板信息
|
|
|
+ * @param {string} form.name 模板名称
|
|
|
+ * @param {array} form.label_list 模板标签列表
|
|
|
+ * @param {string} form.memo 模板备注
|
|
|
*/
|
|
|
- saveCoursewareAsTemplate(scope) {
|
|
|
+ saveCoursewareAsTemplate(form) {
|
|
|
this.$confirm('确定保存为个人模板吗?', '提示', {
|
|
|
confirmButtonText: '确定',
|
|
|
cancelButtonText: '取消',
|
|
|
type: 'warning',
|
|
|
})
|
|
|
.then(() => {
|
|
|
- SaveCoursewareAsTemplatePersonal({ courseware_id: this.$refs.preview.select_node, scope }).then(() => {
|
|
|
+ this.visibleTemplate = false;
|
|
|
+ SaveCoursewareAsTemplatePersonal({
|
|
|
+ courseware_id: this.$refs.preview.select_node,
|
|
|
+ scope: this.templateScope,
|
|
|
+ ...form,
|
|
|
+ }).then(() => {
|
|
|
this.$message.success('已保存为个人模板');
|
|
|
});
|
|
|
})
|