|
|
@@ -165,14 +165,14 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column label="" width="50">
|
|
|
<template #default="{ row }">
|
|
|
- <el-link type="primary" @click="handleLocation(row, 3)">定位</el-link>
|
|
|
+ <el-link type="primary" @click="handleLocation(row, 0)">定位</el-link>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
</div>
|
|
|
</div>
|
|
|
<!-- <div v-if="curToolbarIcon === 'totalResources'" class="resource_box"></div> -->
|
|
|
- <div v-if="['image', 'audio', 'video'].includes(twoCurToolbarIcon)" class="resource_box">
|
|
|
+ <div v-if="['image', 'audio', 'video', 'text'].includes(twoCurToolbarIcon)" class="resource_box">
|
|
|
<div class="source-toolbar-list">
|
|
|
<div
|
|
|
v-for="{ icon, title, handle, param } in twoSidebarList"
|
|
|
@@ -192,6 +192,10 @@
|
|
|
</div>
|
|
|
<div style="height: 40px"></div>
|
|
|
|
|
|
+ <div style="margin: 5px">
|
|
|
+ <span>全部显示 </span>
|
|
|
+ <el-switch v-model="multimediaIsAllShow" :active-value="true" :inactive-value="false" />
|
|
|
+ </div>
|
|
|
<el-collapse v-model="activeBookChapterId" accordion @change="multimediaHandleChange">
|
|
|
<el-collapse-item
|
|
|
v-for="chapter in bookChapterList"
|
|
|
@@ -207,38 +211,45 @@
|
|
|
<ul class="scroll-container" infinite-scroll-disabled="disabled" :infinite-scroll-immediate="false">
|
|
|
<li v-for="(item, index) in chapter.data" :key="`${chapter.id}-${index}`" class="list-item">
|
|
|
<template v-if="parseInt(drawerType) === 0">
|
|
|
- <el-image v-if="shouldShowItem(chapter, item)" :src="item.file_url" fit="contain" />
|
|
|
- <div class="mark">
|
|
|
- <span class="word">{{ item.file_name }}</span>
|
|
|
- <el-link type="primary" class="el-icon-place linkLocation" @click="handleLocation(item, 3)" />
|
|
|
- </div>
|
|
|
+ <el-image v-if="shouldMediaShowItem(chapter, item)" :src="item.file_url" fit="contain" />
|
|
|
</template>
|
|
|
<template v-else-if="parseInt(drawerType) === 1">
|
|
|
<AudioPlay
|
|
|
- v-if="shouldShowItem(chapter, item)"
|
|
|
+ v-if="shouldMediaShowItem(chapter, item)"
|
|
|
view-size="middle"
|
|
|
:file-id="item.file_id"
|
|
|
:file-name="item.file_name.slice(0, item.file_name.lastIndexOf('.'))"
|
|
|
:show-slider="true"
|
|
|
:audio-index="index"
|
|
|
/>
|
|
|
- <div class="mark">
|
|
|
- <span class="word"></span>
|
|
|
- <el-link type="primary" class="el-icon-place linkLocation" @click="handleLocation(item, 3)" />
|
|
|
- </div>
|
|
|
</template>
|
|
|
<template v-else-if="parseInt(drawerType) === 2">
|
|
|
<VideoPlay
|
|
|
- v-if="shouldShowItem(chapter, item)"
|
|
|
+ v-if="shouldMediaShowItem(chapter, item)"
|
|
|
view-size="small"
|
|
|
:file-id="item.file_id"
|
|
|
:video-index="index"
|
|
|
/>
|
|
|
+ </template>
|
|
|
+ <template v-else-if="parseInt(drawerType) === 3">
|
|
|
+ <el-image v-if="shouldMediaShowItem(chapter, item)" :src="item.file_url" fit="contain" />
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <!-- 资源底部的操作 -->
|
|
|
+ <div class="file-handle-info">
|
|
|
+ <span v-if="parseInt(drawerType) !== 1" class="word">{{ item.file_name }}</span>
|
|
|
<div class="mark">
|
|
|
- <span class="word">{{ item.file_name }}</span>
|
|
|
- <el-link type="primary" class="el-icon-place linkLocation" @click="handleLocation(item, 3)" />
|
|
|
+ <el-checkbox
|
|
|
+ :disabled="!item.is_can_edit"
|
|
|
+ v-model="item.is_hided"
|
|
|
+ size="small"
|
|
|
+ @change="handleMediaShowChange(item)"
|
|
|
+ >
|
|
|
+ 隐藏
|
|
|
+ </el-checkbox>
|
|
|
+ <el-link type="primary" class="el-icon-place linkLocation" @click="handleLocation(item, 0)" />
|
|
|
</div>
|
|
|
- </template>
|
|
|
+ </div>
|
|
|
</li>
|
|
|
</ul>
|
|
|
</div>
|
|
|
@@ -259,7 +270,7 @@
|
|
|
<div>
|
|
|
<el-button type="text" class="el-icon-delete" @click="handDelCollect(item.id)"> 删除</el-button>
|
|
|
<el-divider direction="vertical" />
|
|
|
- <el-button type="text" class="el-icon-place" @click="handleLocation(item, 2)"> 定位</el-button>
|
|
|
+ <el-button type="text" class="el-icon-place" @click="handleLocation(item, 12)"> 定位</el-button>
|
|
|
</div>
|
|
|
</li>
|
|
|
</ul>
|
|
|
@@ -278,7 +289,7 @@
|
|
|
<el-divider direction="vertical" />
|
|
|
<el-button type="text" class="el-icon-delete" @click="handDelNote(item.id)"> 删除</el-button>
|
|
|
<el-divider direction="vertical" />
|
|
|
- <el-button type="text" class="el-icon-place" @click="handleLocation(item, 1)"> 定位</el-button>
|
|
|
+ <el-button type="text" class="el-icon-place" @click="handleLocation(item, 11)"> 定位</el-button>
|
|
|
</div>
|
|
|
</li>
|
|
|
</ul>
|
|
|
@@ -375,7 +386,6 @@ import {
|
|
|
GetBookChapterStructExpandList,
|
|
|
PageQueryBookResourceList,
|
|
|
GetLanguageTypeList,
|
|
|
- GetBookUnifiedAttrib,
|
|
|
GetMyNoteList,
|
|
|
DeleteMyNote,
|
|
|
AddMyNote,
|
|
|
@@ -384,6 +394,7 @@ import {
|
|
|
GetMyCollectList,
|
|
|
DeleteMyCollect,
|
|
|
SearchBookContentText,
|
|
|
+ SetBookResourceHide,
|
|
|
} from '@/api/book';
|
|
|
import { toggleFullScreen } from '@/utils/common';
|
|
|
import * as OpenCC from 'opencc-js';
|
|
|
@@ -441,7 +452,7 @@ export default {
|
|
|
},
|
|
|
data() {
|
|
|
const sidebarIconList = [
|
|
|
- { icon: 'search', title: '搜索', handle: 'getSearch', param: { type: '5' } },
|
|
|
+ { icon: 'search', title: '搜索', handle: 'getSearch', param: { type: '13' } },
|
|
|
{ icon: 'mindmap', title: '思维导图', handle: 'openMindMap', param: {} },
|
|
|
{ icon: 'knowledge', title: '知识图谱', handle: 'openVisNetwork', param: {} },
|
|
|
{
|
|
|
@@ -453,12 +464,13 @@ export default {
|
|
|
{ icon: 'audio', title: '音频', handle: 'openDrawer', param: { type: '1' } },
|
|
|
{ icon: 'image', title: '图片', handle: 'openDrawer', param: { type: '0' } },
|
|
|
{ icon: 'video', title: '视频', handle: 'openDrawer', param: { type: '2' } },
|
|
|
+ { icon: 'text', title: '文本', handle: 'openDrawer', param: { type: '3' } },
|
|
|
],
|
|
|
},
|
|
|
- { icon: 'collect', title: '收藏', handle: 'getCollect', param: { type: '3' } },
|
|
|
- { icon: 'note', title: '笔记', handle: 'getNote', param: { type: '4' } },
|
|
|
- // { icon: 'translate', title: '翻译', handle: '', param: {} },
|
|
|
- // { icon: 'setting', title: '设置', handle: '', param: {} },
|
|
|
+ { icon: 'collect', title: '收藏', handle: 'getCollect', param: { type: '11' } },
|
|
|
+ { icon: 'note', title: '笔记', handle: 'getNote', param: { type: '12' } },
|
|
|
+ { icon: 'translate', title: '翻译', handle: '', param: {} },
|
|
|
+ { icon: 'setting', title: '设置', handle: '', param: {} },
|
|
|
];
|
|
|
|
|
|
if (this.isShowAudit) {
|
|
|
@@ -528,7 +540,6 @@ export default {
|
|
|
chinese: 'zh-Hans', // 语言简体中文zh-Hans,繁体中文zh-Hant
|
|
|
isJudgeCorrect: false,
|
|
|
isShowAnswer: false,
|
|
|
- unified_attrib: {},
|
|
|
curSelectId: this.id,
|
|
|
navigationShow: true,
|
|
|
sidebarShow: true,
|
|
|
@@ -546,6 +557,7 @@ export default {
|
|
|
book_id: '',
|
|
|
activeBookChapterId: '',
|
|
|
multimediaLoadingStates: true,
|
|
|
+ multimediaIsAllShow: false,
|
|
|
isFullScreen: false, // 是否全屏状态
|
|
|
title_list: [],
|
|
|
// 模拟答题权限控制
|
|
|
@@ -572,13 +584,14 @@ export default {
|
|
|
0: '图片资源',
|
|
|
1: '音频资源',
|
|
|
2: '视频资源',
|
|
|
- 3: '收藏列表',
|
|
|
- 4: '笔记列表',
|
|
|
- 5: '搜索结果',
|
|
|
+ 3: '文本资源',
|
|
|
+ 11: '收藏列表',
|
|
|
+ 12: '笔记列表',
|
|
|
+ 13: '搜索结果',
|
|
|
};
|
|
|
return titleMap[this.drawerType] || '资源列表';
|
|
|
},
|
|
|
- shouldShowItem() {
|
|
|
+ shouldMediaShowItem() {
|
|
|
return (chapter, item) => {
|
|
|
return this.activeBookChapterId === chapter.id && item && item.file_id;
|
|
|
};
|
|
|
@@ -601,6 +614,14 @@ export default {
|
|
|
this.getCollect();
|
|
|
}
|
|
|
},
|
|
|
+ multimediaIsAllShow(newVal) {
|
|
|
+ //切换显示全部,需清空所有数据,全部重新加载
|
|
|
+ this.bookChapterList.forEach((x) => {
|
|
|
+ this.$set(x, 'data', null);
|
|
|
+ });
|
|
|
+
|
|
|
+ this.multimediaHandleChange();
|
|
|
+ },
|
|
|
},
|
|
|
created() {
|
|
|
if (this.id) {
|
|
|
@@ -611,7 +632,6 @@ export default {
|
|
|
this.isBook ? this.getBookBaseInfo() : this.getProjectBaseInfo();
|
|
|
}
|
|
|
this.getBookChapterStructExpandList();
|
|
|
- this.getBookUnifiedAttr();
|
|
|
if (!this.isBook) {
|
|
|
this.getProjectInfo();
|
|
|
}
|
|
|
@@ -663,7 +683,7 @@ export default {
|
|
|
({ courseware_info }) => {
|
|
|
this.courseware_info = { ...this.courseware_info, ...courseware_info };
|
|
|
this.getLangList();
|
|
|
- },
|
|
|
+ }
|
|
|
);
|
|
|
},
|
|
|
/**
|
|
|
@@ -727,14 +747,14 @@ export default {
|
|
|
});
|
|
|
|
|
|
if (content_group_row_list) this.content_group_row_list = JSON.parse(content_group_row_list) || [];
|
|
|
- },
|
|
|
+ }
|
|
|
);
|
|
|
},
|
|
|
getLangList() {
|
|
|
GetLanguageTypeList({ book_id: this.courseware_info.book_id, is_contain_zh: 'true' }).then(
|
|
|
({ language_type_list }) => {
|
|
|
this.langList = language_type_list;
|
|
|
- },
|
|
|
+ }
|
|
|
);
|
|
|
},
|
|
|
|
|
|
@@ -752,14 +772,6 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
|
|
|
- getBookUnifiedAttr() {
|
|
|
- GetBookUnifiedAttrib({ book_id: this.projectId }).then(({ content }) => {
|
|
|
- if (content) {
|
|
|
- this.unified_attrib = JSON.parse(content);
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
-
|
|
|
/**
|
|
|
* 选择节点
|
|
|
* @param {string} nodeId - 节点ID
|
|
|
@@ -847,7 +859,7 @@ export default {
|
|
|
this.$refs.courserware.handleResult(
|
|
|
this.$refs.previewMain.scrollTop,
|
|
|
this.$refs.previewMain.scrollLeft,
|
|
|
- this.select_node,
|
|
|
+ this.select_node
|
|
|
);
|
|
|
},
|
|
|
/**
|
|
|
@@ -910,7 +922,7 @@ export default {
|
|
|
/**
|
|
|
* 打开抽屉并初始化加载
|
|
|
* @param {Object} param - 抽屉参数
|
|
|
- * @param {string} param.type - 抽屉类型(0: 图片, 1: 音频, 2: 视频)
|
|
|
+ * @param {string} param.type - 抽屉类型(0: 图片, 1: 音频, 2: 视频, 3:文本)
|
|
|
*/
|
|
|
openDrawer({ type }) {
|
|
|
if (this.drawerType === type) {
|
|
|
@@ -918,6 +930,7 @@ export default {
|
|
|
return;
|
|
|
}
|
|
|
this.activeBookChapterId = '';
|
|
|
+ this.multimediaIsAllShow = true;
|
|
|
// 重置所有加载状态
|
|
|
this.resetLoadState();
|
|
|
this.drawerType = type;
|
|
|
@@ -964,11 +977,17 @@ export default {
|
|
|
book_id: this.projectId,
|
|
|
book_chapter_node_id: this.activeBookChapterId,
|
|
|
type: parseInt(this.drawerType),
|
|
|
+ scope: this.multimediaIsAllShow ? -1 : 0,
|
|
|
};
|
|
|
await PageQueryBookResourceList(params)
|
|
|
.then(({ total_count, resource_list }) => {
|
|
|
this.total_count = total_count;
|
|
|
+
|
|
|
this.file_list = resource_list || [];
|
|
|
+ this.file_list.forEach((x, i) => {
|
|
|
+ this.$set(x, 'is_can_edit', x.is_can_edit === 'true');
|
|
|
+ this.$set(x, 'is_hided', x.is_hided === 'true');
|
|
|
+ });
|
|
|
})
|
|
|
.finally(() => {
|
|
|
this.loading = false;
|
|
|
@@ -977,11 +996,11 @@ export default {
|
|
|
/**
|
|
|
* 点击章节,切换数据
|
|
|
*/
|
|
|
- async multimediaHandleChange() {
|
|
|
+ async multimediaHandleChange(id) {
|
|
|
const item = this.bookChapterList.find((item) => item.id === this.activeBookChapterId);
|
|
|
if (item) {
|
|
|
this.multimediaLoadingStates = true;
|
|
|
- if (!item.data && !item.error) {
|
|
|
+ if ((!item.data && !item.error) || !id) {
|
|
|
await this.loadmultimediaList();
|
|
|
let tmpList = this.file_list && this.file_list.length > 0 ? [...this.file_list] : null;
|
|
|
this.$set(item, 'data', tmpList);
|
|
|
@@ -991,7 +1010,21 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 切换资源显示隐藏
|
|
|
+ */
|
|
|
+ handleMediaShowChange(item) {
|
|
|
+ const params = { id: item.id, is_hided: item.is_hided ? 'true' : 'false' };
|
|
|
+ SetBookResourceHide(params).then((res) => {
|
|
|
+ //如果不是显示全部资源,则需要重新加载
|
|
|
+ if (!this.multimediaIsAllShow) {
|
|
|
+ this.multimediaHandleChange();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
// 加载更多数据
|
|
|
+ //弃用
|
|
|
async loadMore() {
|
|
|
const now = Date.now();
|
|
|
// 只有当lastLoadTime不为0(不是第一次)且时间间隔太短时才return
|
|
|
@@ -1158,10 +1191,10 @@ export default {
|
|
|
/**
|
|
|
* 定位到对应位置
|
|
|
* @param {Object} item - 位置对象
|
|
|
- * @param {number} type - 定位类型(1: 笔记定位, 2: 收藏定位, 3: 资源定位)
|
|
|
+ * @param {number} type - 定位类型(11: 笔记定位, 12: 收藏定位, 0: 资源定位)
|
|
|
*/
|
|
|
handleLocation(item, type) {
|
|
|
- if (type === 3) {
|
|
|
+ if (type === 0) {
|
|
|
let did = `${item.courseware_id}#${item.component_id}`;
|
|
|
this.handleNodeClick(did);
|
|
|
this.curSelectId = item.courseware_id;
|
|
|
@@ -1210,7 +1243,7 @@ export default {
|
|
|
x.coursewareId === note.coursewareId &&
|
|
|
x.blockId === note.blockId &&
|
|
|
x.startIndex === note.startIndex &&
|
|
|
- x.endIndex === note.endIndex,
|
|
|
+ x.endIndex === note.endIndex
|
|
|
);
|
|
|
if (old) {
|
|
|
this.oldRichData = old;
|
|
|
@@ -1304,7 +1337,7 @@ export default {
|
|
|
x.coursewareId === collect.coursewareId &&
|
|
|
x.blockId === collect.blockId &&
|
|
|
x.startIndex === collect.startIndex &&
|
|
|
- x.endIndex === collect.endIndex,
|
|
|
+ x.endIndex === collect.endIndex
|
|
|
);
|
|
|
if (old) {
|
|
|
this.$message({
|
|
|
@@ -1842,27 +1875,34 @@ $total-width: $courseware-width + $courseware-left-margin + $courseware-right-ma
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- .mark {
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
- justify-content: space-between;
|
|
|
- padding: 3px;
|
|
|
+ .file-handle-info {
|
|
|
+ margin: 0 5px;
|
|
|
+
|
|
|
+ .mark {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: space-between;
|
|
|
+ padding: 3px;
|
|
|
+
|
|
|
+ .linkLocation {
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
.word {
|
|
|
flex: 1;
|
|
|
- margin-right: 10px;
|
|
|
word-break: break-all;
|
|
|
}
|
|
|
-
|
|
|
- .linkLocation {
|
|
|
- cursor: pointer;
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
::v-deep .el-collapse-item__header {
|
|
|
margin-left: 5px;
|
|
|
}
|
|
|
|
|
|
+ ::v-deep .el-collapse-item__content {
|
|
|
+ padding-bottom: 5px;
|
|
|
+ }
|
|
|
+
|
|
|
.loading-text {
|
|
|
padding: 5px;
|
|
|
color: #999;
|