提交 a8677546 编写于 作者: guangjun.yang's avatar guangjun.yang

Merge branch 'dev-coursedetail-0817' of...

Merge branch 'dev-coursedetail-0817' of http://192.168.110.53/com.pica.cloud.education.frontend/pica-professional-exam into dev-coursedetail-0817

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