|
|
@@ -77,6 +77,7 @@
|
|
|
:group-show-all="groupShowAll"
|
|
|
:group-row-list="content_group_row_list"
|
|
|
:data="data"
|
|
|
+ :courseware-id="curSelectId"
|
|
|
:component-list="component_list"
|
|
|
:background="background"
|
|
|
:can-remark="isTrue(courseware_info.is_my_audit_task) && isTrue(courseware_info.is_can_add_audit_remark)"
|
|
|
@@ -85,6 +86,8 @@
|
|
|
:project="project"
|
|
|
@computeScroll="computeScroll"
|
|
|
@addRemark="addRemark"
|
|
|
+ @editNote="handEditNote"
|
|
|
+ @saveCollect="saveCollect"
|
|
|
/>
|
|
|
<div class="preview-right"></div>
|
|
|
</main>
|
|
|
@@ -171,6 +174,40 @@
|
|
|
<p v-if="loading">加载中...</p>
|
|
|
<p v-if="noMore">没有更多了</p>
|
|
|
</div>
|
|
|
+ <div v-if="curToolbarIcon === 'note'" class="resource_box">
|
|
|
+ <h5>{{ drawerTitle }}</h5>
|
|
|
+ <div style="height: 40px"></div>
|
|
|
+ <ul v-if="allNoteList.length > 0" class="card-box">
|
|
|
+ <li v-for="item in allNoteList" :key="item.id">
|
|
|
+ <span class="el-icon-notebook-2"> 原文</span>
|
|
|
+ <span>{{ item.text }}</span>
|
|
|
+ <el-divider class="mt10" />
|
|
|
+ <span v-html="item.note"></span>
|
|
|
+ <div class="remark-bottom">
|
|
|
+ <el-button type="text" class="el-icon-edit" @click="handEditNote(item)"> 编辑</el-button>
|
|
|
+ <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="handLocation(item, 1)"> 定位</el-button>
|
|
|
+ </div>
|
|
|
+ </li>
|
|
|
+ </ul>
|
|
|
+ </div>
|
|
|
+ <div v-if="curToolbarIcon === 'collect'" class="resource_box">
|
|
|
+ <h5>{{ drawerTitle }}</h5>
|
|
|
+ <div style="height: 40px"></div>
|
|
|
+ <ul v-if="allCottectList.length > 0" class="card-box">
|
|
|
+ <li v-for="item in allCottectList" :key="item.id">
|
|
|
+ <span class="el-icon-notebook-2"> 原文</span>
|
|
|
+ <span>{{ item.text }}</span>
|
|
|
+ <div class="remark-bottom">
|
|
|
+ <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="handLocation(item, 2)"> 定位</el-button>
|
|
|
+ </div>
|
|
|
+ </li>
|
|
|
+ </ul>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
|
|
|
<div class="back-top" @click="backTop">
|
|
|
@@ -211,6 +248,15 @@
|
|
|
@child-click="handleNodeClick"
|
|
|
/>
|
|
|
</el-dialog>
|
|
|
+
|
|
|
+ <ExplanatoryNoteDialog
|
|
|
+ ref="explanatoryNote"
|
|
|
+ :open.sync="editDialogOpen"
|
|
|
+ :init-data="oldRichData"
|
|
|
+ title-text="笔记"
|
|
|
+ @confirm="saveNote"
|
|
|
+ @cancel="delNote"
|
|
|
+ />
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
@@ -222,6 +268,7 @@ import MindMap from '@/components/MindMap.vue';
|
|
|
import VideoPlay from '@/views/book/courseware/preview/components/common/VideoPlay.vue';
|
|
|
import AudioPlay from '@/views/book/courseware/preview/components/common/AudioPlay.vue';
|
|
|
import AuditRemark from '@/components/AuditRemark.vue';
|
|
|
+import ExplanatoryNoteDialog from '@/components/ExplanatoryNoteDialog.vue';
|
|
|
import * as OpenCC from 'opencc-js';
|
|
|
|
|
|
import {
|
|
|
@@ -240,6 +287,13 @@ import {
|
|
|
PageQueryBookResourceList,
|
|
|
GetLanguageTypeList,
|
|
|
GetBookUnifiedAttrib,
|
|
|
+ GetMyNoteList,
|
|
|
+ DeleteMyNote,
|
|
|
+ AddMyNote,
|
|
|
+ UpdateMyNote,
|
|
|
+ AddMyCollect,
|
|
|
+ GetMyCollectList,
|
|
|
+ DeleteMyCollect,
|
|
|
} from '@/api/book';
|
|
|
|
|
|
export default {
|
|
|
@@ -251,6 +305,7 @@ export default {
|
|
|
AudioPlay,
|
|
|
VideoPlay,
|
|
|
AuditRemark,
|
|
|
+ ExplanatoryNoteDialog,
|
|
|
},
|
|
|
provide() {
|
|
|
return {
|
|
|
@@ -289,11 +344,11 @@ export default {
|
|
|
{ icon: 'mindmap', title: '思维导图', handle: 'openMindMap', param: {} },
|
|
|
// { icon: 'knowledge', title: '知识图谱', handle: '', param: {} },
|
|
|
// { icon: 'totalResources', title: '总资源', handle: '', param: {} },
|
|
|
- // { icon: 'collect', title: '收藏', handle: '', param: {} },
|
|
|
+ { icon: 'collect', title: '收藏', handle: 'getCollect', param: { type: '3' } },
|
|
|
{ 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: 'note', title: '笔记', handle: '', param: {} },
|
|
|
+ { icon: 'note', title: '笔记', handle: 'getNote', param: { type: '4' } },
|
|
|
// { icon: 'translate', title: '翻译', handle: '', param: {} },
|
|
|
// { icon: 'setting', title: '设置', handle: '', param: {} },
|
|
|
];
|
|
|
@@ -374,6 +429,11 @@ export default {
|
|
|
cover_image_file_id: null, // 封面图片ID
|
|
|
cover_image_file_url: '', // 封面图片URL
|
|
|
},
|
|
|
+ allNoteList: [],
|
|
|
+ editDialogOpen: false,
|
|
|
+ oldRichData: {},
|
|
|
+ newSelectedInfo: null,
|
|
|
+ allCottectList: [],
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
@@ -390,6 +450,8 @@ export default {
|
|
|
0: '图片资源',
|
|
|
1: '音频资源',
|
|
|
2: '视频资源',
|
|
|
+ 3: '收藏列表',
|
|
|
+ 4: '笔记列表',
|
|
|
};
|
|
|
return titleMap[this.drawerType] || '资源列表';
|
|
|
},
|
|
|
@@ -404,6 +466,13 @@ export default {
|
|
|
isShowAnswer() {
|
|
|
this.simulateAnswer();
|
|
|
},
|
|
|
+ curSelectId() {
|
|
|
+ if (this.curToolbarIcon == 'note') {
|
|
|
+ this.getNote();
|
|
|
+ } else if (this.curToolbarIcon == 'collect') {
|
|
|
+ this.getCollect();
|
|
|
+ }
|
|
|
+ },
|
|
|
},
|
|
|
created() {
|
|
|
if (this.id) {
|
|
|
@@ -805,6 +874,187 @@ export default {
|
|
|
behavior: 'smooth',
|
|
|
});
|
|
|
},
|
|
|
+ handLocation(item, type) {
|
|
|
+ if (this.$refs.courserware && this.$refs.courserware.handLocation) {
|
|
|
+ item.type = type;
|
|
|
+ this.$refs.courserware.handLocation(item);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async getNote(params) {
|
|
|
+ if (params && params.type) this.drawerType = Number(params.type);
|
|
|
+ this.allNoteList = [];
|
|
|
+ await GetMyNoteList({ courseware_id: this.curSelectId }).then((res) => {
|
|
|
+ if (res.status === 1) {
|
|
|
+ res.note_list.forEach((x) => {
|
|
|
+ if (x.note_desc) {
|
|
|
+ let n = JSON.parse(x.note_desc);
|
|
|
+ let obj = {
|
|
|
+ coursewareId: x.courseware_id,
|
|
|
+ id: x.id,
|
|
|
+ blockId: n.blockId,
|
|
|
+ startIndex: n.startIndex,
|
|
|
+ endIndex: n.endIndex,
|
|
|
+ text: n.text,
|
|
|
+ note: n.note,
|
|
|
+ };
|
|
|
+ this.allNoteList.push(obj);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ async handEditNote(note) {
|
|
|
+ this.oldRichData = {};
|
|
|
+ if (this.allNoteList.length === 0) {
|
|
|
+ await this.getNote();
|
|
|
+ }
|
|
|
+ let old = this.allNoteList.find(
|
|
|
+ (x) =>
|
|
|
+ x.coursewareId === note.coursewareId &&
|
|
|
+ x.blockId === note.blockId &&
|
|
|
+ x.startIndex === note.startIndex &&
|
|
|
+ x.endIndex === note.endIndex,
|
|
|
+ );
|
|
|
+ if (old) {
|
|
|
+ this.oldRichData = old;
|
|
|
+ }
|
|
|
+ this.newSelectedInfo = note;
|
|
|
+ this.editDialogOpen = true;
|
|
|
+ },
|
|
|
+ saveNote(note) {
|
|
|
+ let noteInfo = {
|
|
|
+ blockId: this.newSelectedInfo.blockId,
|
|
|
+ startIndex: this.newSelectedInfo.startIndex,
|
|
|
+ endIndex: this.newSelectedInfo.endIndex,
|
|
|
+ note: note.note,
|
|
|
+ text: this.newSelectedInfo.text,
|
|
|
+ };
|
|
|
+
|
|
|
+ let reqData = {
|
|
|
+ courseware_id: this.newSelectedInfo.coursewareId, // 课件 ID
|
|
|
+ component_id: 'WHOLE',
|
|
|
+ note_desc: JSON.stringify(noteInfo), // 位置描述
|
|
|
+ };
|
|
|
+ if (note.id) {
|
|
|
+ if (!noteInfo.note) {
|
|
|
+ this.delNote(note.id);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ let upDate = {
|
|
|
+ id: note.id,
|
|
|
+ note_desc: reqData.note_desc,
|
|
|
+ };
|
|
|
+ UpdateMyNote(upDate).then(() => {
|
|
|
+ this.getNote();
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ AddMyNote(reqData).then(() => {
|
|
|
+ this.getNote();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ this.editDialogOpen = false;
|
|
|
+ this.newSelectedInfo = null;
|
|
|
+ this.selectedInfo = null;
|
|
|
+ },
|
|
|
+ handDelNote(id) {
|
|
|
+ this.$confirm('确定要删除此条笔记吗?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning',
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ this.delNote(id);
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
+ },
|
|
|
+ delNote(id) {
|
|
|
+ if (!id) {
|
|
|
+ if (!this.oldRichData || !this.oldRichData.id) return;
|
|
|
+ id = this.oldRichData.id;
|
|
|
+ }
|
|
|
+ DeleteMyNote({ id }).then(() => {
|
|
|
+ this.allNoteList = this.allNoteList.filter((x) => x.id !== id);
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ async getCollect(params) {
|
|
|
+ if (params && params.type) this.drawerType = Number(params.type);
|
|
|
+ this.allCottectList = [];
|
|
|
+ await GetMyCollectList({ courseware_id: this.curSelectId }).then((res) => {
|
|
|
+ if (res.status === 1) {
|
|
|
+ res.collect_list.forEach((x) => {
|
|
|
+ if (x.collect_desc) {
|
|
|
+ let n = JSON.parse(x.collect_desc);
|
|
|
+ let obj = {
|
|
|
+ coursewareId: x.courseware_id,
|
|
|
+ id: x.id,
|
|
|
+ blockId: n.blockId,
|
|
|
+ startIndex: n.startIndex,
|
|
|
+ endIndex: n.endIndex,
|
|
|
+ text: n.text,
|
|
|
+ };
|
|
|
+ this.allCottectList.push(obj);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ async saveCollect(collect) {
|
|
|
+ if (this.allCottectList.length === 0) {
|
|
|
+ await this.getCollect();
|
|
|
+ }
|
|
|
+
|
|
|
+ let old = this.allCottectList.find(
|
|
|
+ (x) =>
|
|
|
+ x.coursewareId === collect.coursewareId &&
|
|
|
+ x.blockId === collect.blockId &&
|
|
|
+ x.startIndex === collect.startIndex &&
|
|
|
+ x.endIndex === collect.endIndex,
|
|
|
+ );
|
|
|
+ if (old) {
|
|
|
+ this.$message({
|
|
|
+ dangerouslyUseHTMLString: true,
|
|
|
+ message: "<i class='el-icon-check' />已收藏",
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.newSelectedInfo = collect;
|
|
|
+ let collectInfo = {
|
|
|
+ blockId: this.newSelectedInfo.blockId,
|
|
|
+ startIndex: this.newSelectedInfo.startIndex,
|
|
|
+ endIndex: this.newSelectedInfo.endIndex,
|
|
|
+ text: this.newSelectedInfo.text,
|
|
|
+ };
|
|
|
+
|
|
|
+ let reqData = {
|
|
|
+ courseware_id: this.newSelectedInfo.coursewareId, // 课件 ID
|
|
|
+ component_id: 'WHOLE',
|
|
|
+ collect_desc: JSON.stringify(collectInfo), // 位置描述
|
|
|
+ };
|
|
|
+ AddMyCollect(reqData)
|
|
|
+ .then(() => {
|
|
|
+ this.getCollect();
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ this.$message({
|
|
|
+ dangerouslyUseHTMLString: true,
|
|
|
+ message: "<i class='el-icon-check' />已收藏",
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+ handDelCollect(id) {
|
|
|
+ this.$confirm('确定要删除此条收藏吗?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning',
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ DeleteMyCollect({ id: id }).then(() => {
|
|
|
+ this.allCottectList = this.allCottectList.filter((x) => x.id !== id);
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|
|
|
@@ -1216,6 +1466,18 @@ $total-width: $courseware-width + $courseware-left-margin + $courseware-right-ma
|
|
|
color: #999;
|
|
|
text-align: center;
|
|
|
}
|
|
|
+
|
|
|
+ .card-box li {
|
|
|
+ padding: 10px;
|
|
|
+ border-bottom: 1px solid #ccc;
|
|
|
+
|
|
|
+ .el-icon-notebook-2 {
|
|
|
+ display: block;
|
|
|
+ margin-bottom: 4px;
|
|
|
+ font-size: 12px;
|
|
|
+ color: grey;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -1269,6 +1531,11 @@ $total-width: $courseware-width + $courseware-left-margin + $courseware-right-ma
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+.mt10 {
|
|
|
+ margin: 10px 0 0 !important;
|
|
|
+ background-color: #eee;
|
|
|
+}
|
|
|
</style>
|
|
|
|
|
|
<style lang="scss">
|