|
@@ -4,14 +4,36 @@
|
|
|
|
|
|
<div class="task-preview__header">
|
|
|
<div class="menu">
|
|
|
- <span></span>
|
|
|
+ <el-popover placement="bottom" trigger="click" popper-class="menu-popover">
|
|
|
+ <div class="menu-list">
|
|
|
+ <div
|
|
|
+ v-for="{ id: nodeId, name, deep, is_leaf_chapter, is_my_edit_task } in node_list"
|
|
|
+ :key="nodeId"
|
|
|
+ :class="['menu-item', { active: curSelectId === nodeId }]"
|
|
|
+ :style="computedNameStyle(deep, isTrue(is_leaf_chapter))"
|
|
|
+ @click="selectNode(nodeId, isTrue(is_leaf_chapter))"
|
|
|
+ >
|
|
|
+ <SvgIcon
|
|
|
+ v-if="isTrue(is_leaf_chapter)"
|
|
|
+ size="12"
|
|
|
+ icon-class="menu-item"
|
|
|
+ :class-name="isTrue(is_my_edit_task) ? 'my-edit-task' : ''"
|
|
|
+ />
|
|
|
+ <span class="name">
|
|
|
+ {{ name }}
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <el-button slot="reference">{{ courseware_info.name_path }}</el-button>
|
|
|
+ </el-popover>
|
|
|
+
|
|
|
<span class="link" @click="goBackBookList">返回教材列表</span>
|
|
|
</div>
|
|
|
<div class="courseware">
|
|
|
<span class="name-path">{{ courseware_info.name_path }}</span>
|
|
|
<div class="operator">
|
|
|
- <span class="link" @click="editTask">开始编辑</span>
|
|
|
- <span class="link">提交审核</span>
|
|
|
+ <span v-if="isTrue(courseware_info.is_my_edit_task)" class="link" @click="editTask">开始编辑</span>
|
|
|
+ <span v-if="isTrue(courseware_info.is_my_audit_task)" class="link">提交审核</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -28,8 +50,9 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { GetBookCoursewareInfo, GetMyBookCoursewareTaskList } from '@/api/project';
|
|
|
-import { ContentGetCoursewareContent_View } from '@/api/book';
|
|
|
+import { GetBookCoursewareInfo } from '@/api/project';
|
|
|
+import { ContentGetCoursewareContent_View, ChapterGetBookChapterStructExpandList } from '@/api/book';
|
|
|
+import { isTrue } from '@/utils/common';
|
|
|
|
|
|
import MenuPage from '@/views/personal_workbench/menu.vue';
|
|
|
import CoursewarePreview from '@/views/book/courseware/preview/CoursewarePreview.vue';
|
|
@@ -44,7 +67,11 @@ export default {
|
|
|
return {
|
|
|
id: this.$route.params.id,
|
|
|
project_id: this.$route.query.project_id,
|
|
|
- courseware_info: {},
|
|
|
+ curSelectId: this.$route.params.id,
|
|
|
+ courseware_info: {
|
|
|
+ is_my_edit_task: 'false',
|
|
|
+ is_my_audit_task: 'false',
|
|
|
+ },
|
|
|
background: {
|
|
|
background_image_url: '',
|
|
|
background_position: {
|
|
@@ -58,13 +85,14 @@ export default {
|
|
|
row_list: [],
|
|
|
},
|
|
|
component_list: [],
|
|
|
- courseware_list: [],
|
|
|
+ node_list: [],
|
|
|
+ isTrue,
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
|
- this.getBookCoursewareInfo();
|
|
|
- this.getCoursewareComponentContent_View();
|
|
|
- this.getMyBookCoursewareTaskList();
|
|
|
+ this.getBookCoursewareInfo(this.id);
|
|
|
+ this.getCoursewareComponentContent_View(this.id);
|
|
|
+ this.getBookChapterStructExpandList();
|
|
|
},
|
|
|
methods: {
|
|
|
goBackBookList() {
|
|
@@ -76,28 +104,64 @@ export default {
|
|
|
query: { project_id: this.project_id },
|
|
|
});
|
|
|
},
|
|
|
- getCoursewareComponentContent_View() {
|
|
|
- ContentGetCoursewareContent_View({ id: this.id }).then(({ content, component_list }) => {
|
|
|
+ /**
|
|
|
+ * 得到课件内容(展示内容)
|
|
|
+ * @param {string} id - 课件ID
|
|
|
+ */
|
|
|
+ getCoursewareComponentContent_View(id) {
|
|
|
+ ContentGetCoursewareContent_View({ id }).then(({ content, component_list }) => {
|
|
|
if (content) this.data = JSON.parse(content);
|
|
|
if (component_list) this.component_list = component_list;
|
|
|
});
|
|
|
},
|
|
|
/**
|
|
|
* 得到教材课件信息
|
|
|
+ * @param {string} id - 课件ID
|
|
|
*/
|
|
|
- getBookCoursewareInfo() {
|
|
|
- GetBookCoursewareInfo({ id: this.id }).then(({ courseware_info }) => {
|
|
|
- this.courseware_info = courseware_info;
|
|
|
- });
|
|
|
+ getBookCoursewareInfo(id) {
|
|
|
+ GetBookCoursewareInfo({ id, is_contain_producer: 'true', is_contain_auditor: 'true' }).then(
|
|
|
+ ({ courseware_info }) => {
|
|
|
+ this.courseware_info = courseware_info;
|
|
|
+ },
|
|
|
+ );
|
|
|
},
|
|
|
/**
|
|
|
- * 得到我的教材课件任务列表
|
|
|
+ * 得到教材章节结构展开列表
|
|
|
*/
|
|
|
- getMyBookCoursewareTaskList() {
|
|
|
- GetMyBookCoursewareTaskList({ project_id: this.project_id }).then(({ courseware_list }) => {
|
|
|
- this.courseware_list = courseware_list;
|
|
|
+ getBookChapterStructExpandList() {
|
|
|
+ ChapterGetBookChapterStructExpandList({
|
|
|
+ book_id: this.project_id,
|
|
|
+ node_deep_mode: 0,
|
|
|
+ is_contain_producer: 'true',
|
|
|
+ is_contain_auditor: 'true',
|
|
|
+ }).then(({ node_list }) => {
|
|
|
+ this.node_list = node_list;
|
|
|
});
|
|
|
},
|
|
|
+ /**
|
|
|
+ * 选择节点
|
|
|
+ * @param {string} nodeId 节点ID
|
|
|
+ * @param {boolean} isLeaf 是否是叶子节点
|
|
|
+ */
|
|
|
+ selectNode(nodeId, isLeaf) {
|
|
|
+ if (!isLeaf) return;
|
|
|
+ if (this.curSelectId === nodeId) return;
|
|
|
+ this.curSelectId = nodeId;
|
|
|
+ this.getCoursewareComponentContent_View(nodeId);
|
|
|
+ this.getBookCoursewareInfo(nodeId);
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 计算章节名称样式
|
|
|
+ * @param {number} deep - 节点深度
|
|
|
+ * @param {boolean} isLeaf - 是否是叶子节点
|
|
|
+ * @returns {Object} - 样式对象
|
|
|
+ */
|
|
|
+ computedNameStyle(deep, isLeaf) {
|
|
|
+ return {
|
|
|
+ 'padding-left': `${(deep - 1) * 16}px`,
|
|
|
+ cursor: isLeaf ? 'pointer' : 'auto',
|
|
|
+ };
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|
|
@@ -115,6 +179,10 @@ export default {
|
|
|
width: 360px;
|
|
|
padding: 4px 8px;
|
|
|
border-right: $border;
|
|
|
+
|
|
|
+ .el-popover__reference {
|
|
|
+ border: none;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
.courseware {
|
|
@@ -154,3 +222,37 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
</style>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+.menu-popover {
|
|
|
+ .menu-list {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+
|
|
|
+ .menu-item {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+
|
|
|
+ .svg-icon {
|
|
|
+ margin-left: 4px;
|
|
|
+
|
|
|
+ &.my-edit-task {
|
|
|
+ color: $right-color;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .name {
|
|
|
+ flex: 1;
|
|
|
+ padding: 4px 8px 4px 2px;
|
|
|
+ border-radius: 4px;
|
|
|
+ }
|
|
|
+
|
|
|
+ &.active {
|
|
|
+ .name {
|
|
|
+ background-color: $main-active-color;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|