|
@@ -4,36 +4,17 @@
|
|
|
|
|
|
<div class="task-preview__header">
|
|
|
<div class="menu">
|
|
|
- <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 }, { courseware: isTrue(is_leaf_chapter) }]"
|
|
|
- :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.book_name }}</el-button>
|
|
|
- </el-popover>
|
|
|
+ <MenuPopover :id="id" :node-list="node_list" :book-name="courseware_info.book_name" @selectNode="selectNode" />
|
|
|
|
|
|
<span class="link" @click="goBackBookList">返回教材列表</span>
|
|
|
</div>
|
|
|
<div class="courseware">
|
|
|
<span class="name-path">{{ courseware_info.name_path }}</span>
|
|
|
<div class="operator">
|
|
|
- <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>
|
|
|
+ <span v-if="isTrue(courseware_info.is_can_start_edit)" class="link" @click="editTask">开始编辑</span>
|
|
|
+ <span v-if="isTrue(courseware_info.is_can_submit_audit)" class="link" @click="submitCoursewareToAuditFlow">
|
|
|
+ 提交审核
|
|
|
+ </span>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -50,24 +31,25 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-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';
|
|
|
+import MenuPopover from '@/views/personal_workbench/common/MenuPopover.vue';
|
|
|
+
|
|
|
+import { GetBookCoursewareInfo, SubmitBookCoursewareToAuditFlow } from '@/api/project';
|
|
|
+import { ContentGetCoursewareContent_View, ChapterGetBookChapterStructExpandList } from '@/api/book';
|
|
|
+import { isTrue } from '@/utils/common';
|
|
|
|
|
|
export default {
|
|
|
name: 'TaskPreviewPage',
|
|
|
components: {
|
|
|
MenuPage,
|
|
|
CoursewarePreview,
|
|
|
+ MenuPopover,
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
id: this.$route.params.id,
|
|
|
project_id: this.$route.query.project_id,
|
|
|
- curSelectId: this.$route.params.id,
|
|
|
courseware_info: {
|
|
|
is_my_edit_task: 'false',
|
|
|
is_my_audit_task: 'false',
|
|
@@ -105,12 +87,26 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
/**
|
|
|
+ * 提交课件到审核流程
|
|
|
+ */
|
|
|
+ submitCoursewareToAuditFlow() {
|
|
|
+ SubmitBookCoursewareToAuditFlow({ id: this.id }).then(() => {
|
|
|
+ this.$message.success('课件已提交审核');
|
|
|
+ this.getBookCoursewareInfo(this.id);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /**
|
|
|
* 得到课件内容(展示内容)
|
|
|
* @param {string} id - 课件ID
|
|
|
*/
|
|
|
getCoursewareComponentContent_View(id) {
|
|
|
ContentGetCoursewareContent_View({ id }).then(({ content, component_list }) => {
|
|
|
- if (content) this.data = JSON.parse(content);
|
|
|
+ if (content) {
|
|
|
+ this.data = JSON.parse(content);
|
|
|
+ } else {
|
|
|
+ this.data = { row_list: [] };
|
|
|
+ }
|
|
|
+
|
|
|
if (component_list) this.component_list = component_list;
|
|
|
});
|
|
|
},
|
|
@@ -140,13 +136,9 @@ export default {
|
|
|
},
|
|
|
/**
|
|
|
* 选择节点
|
|
|
- * @param {string} nodeId 节点ID
|
|
|
- * @param {boolean} isLeaf 是否是叶子节点
|
|
|
+ * @param {string} nodeId - 节点ID
|
|
|
*/
|
|
|
- selectNode(nodeId, isLeaf) {
|
|
|
- if (!isLeaf) return;
|
|
|
- if (this.curSelectId === nodeId) return;
|
|
|
- this.curSelectId = nodeId;
|
|
|
+ selectNode(nodeId) {
|
|
|
this.getCoursewareComponentContent_View(nodeId);
|
|
|
this.getBookCoursewareInfo(nodeId);
|
|
|
},
|
|
@@ -179,19 +171,6 @@ export default {
|
|
|
width: 360px;
|
|
|
padding: 4px 8px;
|
|
|
border-right: $border;
|
|
|
-
|
|
|
- .el-button {
|
|
|
- max-width: 260px;
|
|
|
- overflow: hidden;
|
|
|
- font-size: 16px;
|
|
|
- font-weight: bold;
|
|
|
- text-overflow: ellipsis;
|
|
|
- white-space: nowrap;
|
|
|
- }
|
|
|
-
|
|
|
- .el-popover__reference {
|
|
|
- border: none;
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
.courseware {
|
|
@@ -231,46 +210,3 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
</style>
|
|
|
-
|
|
|
-<style lang="scss" scoped>
|
|
|
-.menu-popover {
|
|
|
- .menu-list {
|
|
|
- display: flex;
|
|
|
- flex-direction: column;
|
|
|
-
|
|
|
- .menu-item {
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
-
|
|
|
- &.courseware {
|
|
|
- &:hover {
|
|
|
- .name {
|
|
|
- background-color: #f3f3f3;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- .svg-icon {
|
|
|
- margin-left: 4px;
|
|
|
-
|
|
|
- &.my-edit-task {
|
|
|
- color: $right-color;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- .name {
|
|
|
- flex: 1;
|
|
|
- padding: 4px 8px 4px 4px;
|
|
|
- border-radius: 4px;
|
|
|
- }
|
|
|
-
|
|
|
- &.active {
|
|
|
- .name {
|
|
|
- font-weight: bold;
|
|
|
- background-color: $main-active-color !important;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
-</style>
|