|
@@ -1,7 +1,7 @@
|
|
<template>
|
|
<template>
|
|
<div class="lecture-notesjy">
|
|
<div class="lecture-notesjy">
|
|
<div class="header">
|
|
<div class="header">
|
|
- <div class="header__name">{{ courseHandoutsData.handoutsName }}</div>
|
|
|
|
|
|
+ <div class="header__name">{{ showId != null ? activeItem.urlName : courseHandoutsData.handoutsName }}</div>
|
|
<el-button
|
|
<el-button
|
|
class="header__btn"
|
|
class="header__btn"
|
|
size="mini"
|
|
size="mini"
|
|
@@ -13,7 +13,9 @@
|
|
<ul
|
|
<ul
|
|
class="center"
|
|
class="center"
|
|
v-if="
|
|
v-if="
|
|
- courseHandoutsData.fileList && courseHandoutsData.fileList.length > 0
|
|
|
|
|
|
+ courseHandoutsData.fileList &&
|
|
|
|
+ courseHandoutsData.fileList.length > 0 &&
|
|
|
|
+ showId == null
|
|
"
|
|
"
|
|
>
|
|
>
|
|
<li
|
|
<li
|
|
@@ -44,24 +46,30 @@
|
|
>
|
|
>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
- <div class="pdf_box" v-show="showId === item.fileId">
|
|
|
|
- <pdf
|
|
|
|
- class="iframe"
|
|
|
|
- :src="$tools.splitImgHost(item.url)"
|
|
|
|
- v-for="i in item.pdf"
|
|
|
|
- :key="i"
|
|
|
|
- :page="i"
|
|
|
|
- ref="pdf"
|
|
|
|
- ></pdf>
|
|
|
|
- <iframe
|
|
|
|
- id="printIframe"
|
|
|
|
- :src="$tools.splitImgHost(item.url)"
|
|
|
|
- frameborder="0"
|
|
|
|
- style="display: none"
|
|
|
|
- ></iframe>
|
|
|
|
- </div>
|
|
|
|
</li>
|
|
</li>
|
|
</ul>
|
|
</ul>
|
|
|
|
+ <div
|
|
|
|
+ class="pdf_box"
|
|
|
|
+ v-else-if="showId != null"
|
|
|
|
+ v-infinite-scroll="loadscroll"
|
|
|
|
+ :infinite-scroll-delay="200"
|
|
|
|
+ :infinite-scroll-distance="50"
|
|
|
|
+ >
|
|
|
|
+ <pdf
|
|
|
|
+ class="iframe"
|
|
|
|
+ :src="$tools.splitImgHost(activeItem.url)"
|
|
|
|
+ v-for="i in pdfCounts"
|
|
|
|
+ :key="i"
|
|
|
|
+ :page="i"
|
|
|
|
+ ref="pdf"
|
|
|
|
+ ></pdf>
|
|
|
|
+ <iframe
|
|
|
|
+ id="printIframe"
|
|
|
|
+ :src="$tools.splitImgHost(activeItem.url)"
|
|
|
|
+ frameborder="0"
|
|
|
|
+ style="display: none"
|
|
|
|
+ ></iframe>
|
|
|
|
+ </div>
|
|
<p class="no_center" v-else>暂无讲义列表</p>
|
|
<p class="no_center" v-else>暂无讲义列表</p>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
@@ -83,6 +91,8 @@ export default {
|
|
return {
|
|
return {
|
|
courseHandoutsData: {},
|
|
courseHandoutsData: {},
|
|
showId: null, //当前显示pdfID号
|
|
showId: null, //当前显示pdfID号
|
|
|
|
+ activeItem: {},
|
|
|
|
+ pdfCounts: 0,
|
|
};
|
|
};
|
|
},
|
|
},
|
|
watch: {
|
|
watch: {
|
|
@@ -153,17 +163,38 @@ export default {
|
|
.courseHandouts(this.goodsData.handoutsId)
|
|
.courseHandouts(this.goodsData.handoutsId)
|
|
.then((res) => {
|
|
.then((res) => {
|
|
this.courseHandoutsData = res.data || {};
|
|
this.courseHandoutsData = res.data || {};
|
|
- if(res.data.fileList &&res.data.fileList.length > 0){
|
|
|
|
- this.loadSeePdf(res.data.fileList[0])
|
|
|
|
|
|
+ if (res.data.fileList && res.data.fileList.length > 0) {
|
|
|
|
+ this.loadSeePdf(res.data.fileList[0]);
|
|
}
|
|
}
|
|
})
|
|
})
|
|
.catch((err) => {});
|
|
.catch((err) => {});
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
+
|
|
|
|
+ loadscroll() {
|
|
|
|
+ if (!this.pdfCounts && this.activeItem.pdf) {
|
|
|
|
+ if (this.activeItem.pdf >= 4) {
|
|
|
|
+ this.pdfCounts = 4;
|
|
|
|
+ } else {
|
|
|
|
+ this.pdfCounts = this.activeItem.pdf;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (this.pdfCounts < this.activeItem.pdf) {
|
|
|
|
+ this.pdfCounts++;
|
|
|
|
+ } else {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ },
|
|
//点击预览加载
|
|
//点击预览加载
|
|
loadSeePdf(item) {
|
|
loadSeePdf(item) {
|
|
if (item.pdf) {
|
|
if (item.pdf) {
|
|
this.showId = item.fileId;
|
|
this.showId = item.fileId;
|
|
|
|
+ this.activeItem = item;
|
|
|
|
+ if (item.pdf >= 4) {
|
|
|
|
+ this.pdfCounts = 4;
|
|
|
|
+ } else {
|
|
|
|
+ this.pdfCounts = item.pdf;
|
|
|
|
+ }
|
|
this.$emit("backSwitchPdfData", item);
|
|
this.$emit("backSwitchPdfData", item);
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
@@ -172,8 +203,14 @@ export default {
|
|
);
|
|
);
|
|
loadingTask.promise
|
|
loadingTask.promise
|
|
.then((pdf) => {
|
|
.then((pdf) => {
|
|
- this.showId = item.fileId;
|
|
|
|
item.pdf = pdf.numPages;
|
|
item.pdf = pdf.numPages;
|
|
|
|
+ this.showId = item.fileId;
|
|
|
|
+ this.activeItem = item;
|
|
|
|
+ if (item.pdf >= 4) {
|
|
|
|
+ this.pdfCounts = 4;
|
|
|
|
+ } else {
|
|
|
|
+ this.pdfCounts = item.pdf;
|
|
|
|
+ }
|
|
this.$emit("backSwitchPdfData", item);
|
|
this.$emit("backSwitchPdfData", item);
|
|
})
|
|
})
|
|
.catch((err) => {});
|
|
.catch((err) => {});
|
|
@@ -222,5 +259,9 @@ export default {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ .pdf_box {
|
|
|
|
+ flex: 1;
|
|
|
|
+ overflow: auto;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
</style>
|
|
</style>
|