提交 7afc6d56 编写于 作者: guofeng.chen's avatar guofeng.chen

修改pdf

上级 0536af97
<template>
<div class="course-ware"></div>
<div class="course-ware">
<div v-show="url" class="canvas-box"></div>
<p v-show="!url" class="tip">无相关课件</p>
</div>
</template>
<script>
......@@ -29,10 +32,12 @@ export default {
}
},
mounted() {
this.parentDom = this.$el.querySelector('.canvas-box');
this.drawPDF();
},
methods: {
async drawPDF() {
console.log('_____url_______', this.url);
if (!this.url) {
return;
}
......@@ -48,7 +53,7 @@ export default {
pageAll.push(pdf.getPage(i + 1).catch(err => ''))
}
const pages = await Promise.all(pageAll);
this.$el.innerHTML = '';
this.parentDom.innerHTML = '';
for (let item of pages) {
this.createCanvas(item)
}
......@@ -91,7 +96,7 @@ export default {
}
box.appendChild(cover);
}
this.$el.appendChild(box);
this.parentDom.appendChild(box);
}
}
};
......@@ -101,5 +106,10 @@ export default {
.course-ware{
padding-top: 20px;
overflow: hidden;
.tip{
font-size: 14px;
text-align: center;
margin-top: 50px;
}
}
</style>
......@@ -150,11 +150,11 @@ export default {
if (token && !info.id) {
this.$store.dispatch('getUserInfo');
}
this.projectId = sessionStorage.getItem('projectId');
if (!this.projectId) {
this.$router.replace('/not-found');
return;
}
// this.projectId = sessionStorage.getItem('projectId');
// if (!this.projectId) {
// this.$router.replace('/not-found');
// return;
// }
this.getCourseInfo();
this.getCourseQas();
const { height } = this.$el.querySelector('.video-box').getBoundingClientRect();
......@@ -202,7 +202,7 @@ export default {
const [chaptersAll, curtLecture] = this.getAllChapters(chapters, lectureResourceList, lastLecture, showFlag, trySeeFlag);
this.chapters = chaptersAll;
this.curtLectureId = curtLecture.lectureId;
this.pdfUrl = getPdfFileUrl(curtLecture.courseware.filePath);
this.pdfUrl = getPdfFileUrl(curtLecture.courseware ? curtLecture.courseware.filePath : '');
// 付费课程-请去App查看;或可试看且时长为0
let enable = true;
if (showFlag === 10 || (trySeeFlag && !trySeeTime)) {
......@@ -323,7 +323,7 @@ export default {
this.coverType = 0;
}
this.curtLectureId = lecture.lectureId;
this.pdfUrl = getPdfFileUrl(lecture.courseware.filePath);
this.pdfUrl = getPdfFileUrl(lecture.courseware ? lecture.courseware.filePath : '');
let history = 0;
if (lecture.progress < 1) {
history = lecture.lastTime === 1 ? 0 : lecture.lastTime
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册