|
@@ -36,53 +36,37 @@
|
|
id="player"
|
|
id="player"
|
|
></div>
|
|
></div>
|
|
<div
|
|
<div
|
|
- v-if="switchPdf.pdf || ShowAlist !== ''"
|
|
|
|
|
|
+ v-if="ShowAlist !== ''"
|
|
:class="!switchBox ? 'smallBox overStyle' : 'switchPdf'"
|
|
:class="!switchBox ? 'smallBox overStyle' : 'switchPdf'"
|
|
:style="!switchBox && hideBox ? 'display:none;' : ''"
|
|
:style="!switchBox && hideBox ? 'display:none;' : ''"
|
|
>
|
|
>
|
|
<div
|
|
<div
|
|
- v-if="
|
|
|
|
- (switchPdf.pdf && switchPdf.pdf > 0) || ShowAlist !== ''
|
|
|
|
- "
|
|
|
|
- v-infinite-scroll="loadscroll"
|
|
|
|
- :infinite-scroll-delay="200"
|
|
|
|
- :infinite-scroll-distance="50"
|
|
|
|
|
|
+ v-if="ShowAlist !== ''"
|
|
>
|
|
>
|
|
- <div
|
|
|
|
- id="bodyContainers"
|
|
|
|
|
|
+ <vue-office-docx
|
|
|
|
+ style="width:808px;height: 452px!important;"
|
|
v-if="ShowAlist === 'docx'"
|
|
v-if="ShowAlist === 'docx'"
|
|
- ></div>
|
|
|
|
|
|
+ :src="readerResult"
|
|
|
|
+ />
|
|
<vue-office-excel
|
|
<vue-office-excel
|
|
style="width:808px;height: 452px!important;overflow: hidden;"
|
|
style="width:808px;height: 452px!important;overflow: hidden;"
|
|
v-else-if="ShowAlist === 'xlsx'"
|
|
v-else-if="ShowAlist === 'xlsx'"
|
|
:src="readerResult"
|
|
:src="readerResult"
|
|
/>
|
|
/>
|
|
- <template v-else>
|
|
|
|
- <pdf
|
|
|
|
- class="iframe"
|
|
|
|
- :src="$tools.splitImgHost(switchPdf.url)"
|
|
|
|
- v-for="i in counts"
|
|
|
|
- :key="i"
|
|
|
|
- :page="i"
|
|
|
|
- ref="pdf"
|
|
|
|
- @page-loaded="pageLoaded"
|
|
|
|
- ></pdf>
|
|
|
|
- <iframe
|
|
|
|
- id="printIframe"
|
|
|
|
- :src="$tools.splitImgHost(switchPdf.url)"
|
|
|
|
- frameborder="0"
|
|
|
|
- style="display: none"
|
|
|
|
- ></iframe>
|
|
|
|
- </template>
|
|
|
|
|
|
+ <vue-office-pdf
|
|
|
|
+ style="width:808px;height: 452px!important;"
|
|
|
|
+ v-else-if="ShowAlist === 'pdf'"
|
|
|
|
+ :src="readerResult"
|
|
|
|
+ />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<i
|
|
<i
|
|
- v-if="!hideBox && (switchPdf.pdf || ShowAlist !== '')"
|
|
|
|
|
|
+ v-if="!hideBox && ShowAlist !== ''"
|
|
class="switch el-icon-monitor"
|
|
class="switch el-icon-monitor"
|
|
@click="switchBoxFunc"
|
|
@click="switchBoxFunc"
|
|
></i>
|
|
></i>
|
|
<i
|
|
<i
|
|
- v-if="switchPdf.pdf || ShowAlist !== ''"
|
|
|
|
|
|
+ v-if="ShowAlist !== ''"
|
|
class="hideSwitchBox el-icon-view"
|
|
class="hideSwitchBox el-icon-view"
|
|
@click="hideBox = !hideBox"
|
|
@click="hideBox = !hideBox"
|
|
></i>
|
|
></i>
|
|
@@ -94,7 +78,7 @@
|
|
您上次看{{
|
|
您上次看{{
|
|
$tools.secondToTime(recordObj.videoCurrentTime)
|
|
$tools.secondToTime(recordObj.videoCurrentTime)
|
|
}},正在自动续播
|
|
}},正在自动续播
|
|
- <span
|
|
|
|
|
|
+ <span
|
|
style="
|
|
style="
|
|
display: inline-block;
|
|
display: inline-block;
|
|
width: 50px;
|
|
width: 50px;
|
|
@@ -177,7 +161,7 @@
|
|
<Hand-out
|
|
<Hand-out
|
|
ref="handOut"
|
|
ref="handOut"
|
|
:goodsData="goodsData"
|
|
:goodsData="goodsData"
|
|
- @backSwitchPdfData="backSwitchPdfData"
|
|
|
|
|
|
+ @backSwitchOfficeData="backSwitchOfficeData"
|
|
></Hand-out>
|
|
></Hand-out>
|
|
</template>
|
|
</template>
|
|
</el-tab-pane>
|
|
</el-tab-pane>
|
|
@@ -894,12 +878,18 @@ import ToolBar from "@/components/toolbar/index";
|
|
import GoodsItem from "@/components/goodsItem/index";
|
|
import GoodsItem from "@/components/goodsItem/index";
|
|
import * as imageConversion from "image-conversion";
|
|
import * as imageConversion from "image-conversion";
|
|
import { mapGetters, mapMutations, mapActions } from "vuex";
|
|
import { mapGetters, mapMutations, mapActions } from "vuex";
|
|
-import pdf from "vue-pdf";
|
|
|
|
import CourseTree from "./components/CourseTree.vue";
|
|
import CourseTree from "./components/CourseTree.vue";
|
|
import AnswerQuestions from "./components/AnswerQuestions.vue";
|
|
import AnswerQuestions from "./components/AnswerQuestions.vue";
|
|
import Notes from "./components/Notes.vue";
|
|
import Notes from "./components/Notes.vue";
|
|
import HandOut from "./components/HandOut.vue";
|
|
import HandOut from "./components/HandOut.vue";
|
|
|
|
+//引入VueOfficeDocx组件
|
|
|
|
+import VueOfficeDocx from "@vue-office/docx";
|
|
|
|
+//引入VueOfficeExcel组件
|
|
import VueOfficeExcel from "@vue-office/excel";
|
|
import VueOfficeExcel from "@vue-office/excel";
|
|
|
|
+//引入VueOfficePdf组件
|
|
|
|
+import VueOfficePdf from "@vue-office/pdf";
|
|
|
|
+//引入相关样式
|
|
|
|
+import "@vue-office/docx/lib/index.css";
|
|
import "@vue-office/excel/lib/index.css";
|
|
import "@vue-office/excel/lib/index.css";
|
|
export default {
|
|
export default {
|
|
name: "CourseDetail",
|
|
name: "CourseDetail",
|
|
@@ -907,13 +897,14 @@ export default {
|
|
Footer,
|
|
Footer,
|
|
Header,
|
|
Header,
|
|
ToolBar,
|
|
ToolBar,
|
|
- pdf,
|
|
|
|
GoodsItem,
|
|
GoodsItem,
|
|
CourseTree,
|
|
CourseTree,
|
|
AnswerQuestions,
|
|
AnswerQuestions,
|
|
Notes,
|
|
Notes,
|
|
HandOut,
|
|
HandOut,
|
|
- VueOfficeExcel
|
|
|
|
|
|
+ VueOfficeDocx,
|
|
|
|
+ VueOfficeExcel,
|
|
|
|
+ VueOfficePdf
|
|
},
|
|
},
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
@@ -922,8 +913,6 @@ export default {
|
|
switchPdf: {}, //pdf数据
|
|
switchPdf: {}, //pdf数据
|
|
liveDuration: 0,
|
|
liveDuration: 0,
|
|
numPages: 0,
|
|
numPages: 0,
|
|
- // loadingPage: 0, //当前加载pdf页面数量
|
|
|
|
- counts: 0,
|
|
|
|
showPdf: false,
|
|
showPdf: false,
|
|
// 总页数
|
|
// 总页数
|
|
pdfPages: 10,
|
|
pdfPages: 10,
|
|
@@ -1422,46 +1411,16 @@ export default {
|
|
methods: {
|
|
methods: {
|
|
...mapMutations(["getCartCount"]),
|
|
...mapMutations(["getCartCount"]),
|
|
...mapActions(["getUserInfo"]),
|
|
...mapActions(["getUserInfo"]),
|
|
- loadscroll() {
|
|
|
|
- if (!this.counts && this.switchPdf.pdf) {
|
|
|
|
- if (this.switchPdf.pdf >= 4) {
|
|
|
|
- this.counts = 4;
|
|
|
|
- } else {
|
|
|
|
- this.counts = this.switchPdf.pdf;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- if (this.counts < this.switchPdf.pdf) {
|
|
|
|
- this.counts++;
|
|
|
|
- } else {
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
switchBoxFunc() {
|
|
switchBoxFunc() {
|
|
- // if (this.loadingPage === this.switchPdf.pdf) {
|
|
|
|
this.switchBox = !this.switchBox;
|
|
this.switchBox = !this.switchBox;
|
|
- // } else {
|
|
|
|
- // this.$message.warning("PDF加载中,请耐心等待");
|
|
|
|
- // return;
|
|
|
|
- // }
|
|
|
|
- },
|
|
|
|
- pageLoaded(e) {
|
|
|
|
- console.log("pdf页面总数:", this.switchPdf.pdf, "当前已加载总数:", e);
|
|
|
|
- if (this.switchPdf.pdf === e) {
|
|
|
|
- this.$message.success("PDF已全部加载,如出现模糊问题,请尝试重新切换");
|
|
|
|
- // this.loadingPage = e;
|
|
|
|
- }
|
|
|
|
},
|
|
},
|
|
- backSwitchPdfData(item) {
|
|
|
|
- this.counts = 0;
|
|
|
|
|
|
+ backSwitchOfficeData(item) {
|
|
this.switchPdf = item;
|
|
this.switchPdf = item;
|
|
- if (this.ShowAlist === "xlsx") {
|
|
|
|
- this.xlsxRender(this.$tools.splitImgHost(item.url));
|
|
|
|
- } else if (this.ShowAlist === "pdf") {
|
|
|
|
- this.loadscroll();
|
|
|
|
- }
|
|
|
|
|
|
+ this.readerResult = null;
|
|
|
|
+ this.officeRender(this.$tools.splitImgHost(item.url));
|
|
},
|
|
},
|
|
//渲染xlsx
|
|
//渲染xlsx
|
|
- xlsxRender(url, fileName) {
|
|
|
|
|
|
+ officeRender(url, fileName) {
|
|
axios({
|
|
axios({
|
|
method: "get",
|
|
method: "get",
|
|
responseType: "blob", // 设置响应文件格式
|
|
responseType: "blob", // 设置响应文件格式
|
|
@@ -1480,7 +1439,6 @@ export default {
|
|
reader.onload = loadEvent => {
|
|
reader.onload = loadEvent => {
|
|
let arrayBuffer = loadEvent.target.result;
|
|
let arrayBuffer = loadEvent.target.result;
|
|
this.readerResult = arrayBuffer;
|
|
this.readerResult = arrayBuffer;
|
|
- console.log("readerResult:", this.readerResult);
|
|
|
|
};
|
|
};
|
|
return false;
|
|
return false;
|
|
},
|
|
},
|
|
@@ -3350,7 +3308,6 @@ export default {
|
|
];
|
|
];
|
|
}
|
|
}
|
|
this.courseBusiness();
|
|
this.courseBusiness();
|
|
- // this.courseHandouts();
|
|
|
|
if (self.goodsData.goodsPlayConfig) {
|
|
if (self.goodsData.goodsPlayConfig) {
|
|
self.goodsPlayConfig = JSON.parse(self.goodsData.goodsPlayConfig);
|
|
self.goodsPlayConfig = JSON.parse(self.goodsData.goodsPlayConfig);
|
|
if (self.goodsPlayConfig.autoPlay > 0) {
|
|
if (self.goodsPlayConfig.autoPlay > 0) {
|
|
@@ -4529,28 +4486,6 @@ export default {
|
|
});
|
|
});
|
|
},
|
|
},
|
|
|
|
|
|
- /**
|
|
|
|
- * 获取讲义权限
|
|
|
|
- */
|
|
|
|
- courseHandouts() {
|
|
|
|
- if (this.goodsData.handoutsId) {
|
|
|
|
- this.$request
|
|
|
|
- .courseHandouts(this.goodsData.handoutsId)
|
|
|
|
- .then(res => {
|
|
|
|
- this.courseHandoutsData = res.data;
|
|
|
|
- const loadingTask = pdf.createLoadingTask(
|
|
|
|
- this.$tools.splitImgHost(this.courseHandoutsData.handoutsUrl)
|
|
|
|
- );
|
|
|
|
- loadingTask.promise
|
|
|
|
- .then(pdf => {
|
|
|
|
- this.numPages = pdf.numPages;
|
|
|
|
- })
|
|
|
|
- .catch(err => {});
|
|
|
|
- })
|
|
|
|
- .catch(err => {});
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* 获取培训项目详情
|
|
* 获取培训项目详情
|
|
*/
|
|
*/
|