|
|
@@ -1,231 +1,201 @@
|
|
|
<template>
|
|
|
<el-row id="manage-page-body">
|
|
|
-<!-- <div class="pdf-reader">-->
|
|
|
-<!-- <el-button type="info" circle @click="this.$router.go(-1)" class="mybuttton"><el-icon class="myicon"><Back /></el-icon></el-button>-->
|
|
|
-<!-- <div class="container">-->
|
|
|
-<!-- <iframe :src="pdfurl" width="100%" height="100%"></iframe>-->
|
|
|
-<!-- </div>-->
|
|
|
-
|
|
|
-<!-- <img :src="imageUrl" alt="" class="image">-->
|
|
|
-<!-- <canvas class="pdf pdf-canvas" id="pdf-canvas"></canvas>-->
|
|
|
-
|
|
|
-<!-- <pdf-viewer></pdf-viewer>-->
|
|
|
-<!-- <pointer-canvas ref="pointerCanvas" :no-pointer="!pointer" :no-box="!box"></pointer-canvas>-->
|
|
|
-<!-- <div class="pointer-actions">-->
|
|
|
-<!-- <c-button text :theme="pointer ? 'red' : ''" @click="pointer = !pointer">-->
|
|
|
-<!-- <i class="el-icon-edit"/> 指针</c-button>-->
|
|
|
-<!-- <c-button text :left="8" :theme="box ? 'blue' : ''" @click="box = !box">-->
|
|
|
-<!-- <i class="el-icon-crop"/> 框选</c-button>-->
|
|
|
-<!-- <c-button text :left="8" theme="orange" @click="cleanCanvas">-->
|
|
|
-<!-- <i class="el-icon-refresh-left"/> 清除</c-button>-->
|
|
|
-<!-- </div>-->
|
|
|
-<!-- </div>-->
|
|
|
+ <el-col :span="3">
|
|
|
+ <el-menu background-color="#f8f9fb" default-active="1" style="position: fixed;"
|
|
|
+ @select="handleSelect">
|
|
|
+ <el-menu-item index="0">
|
|
|
+ <el-icon>
|
|
|
+ <Back/>
|
|
|
+ </el-icon>
|
|
|
+ <span style="padding-left: 20px">返回首页</span>
|
|
|
+ </el-menu-item>
|
|
|
+ <el-menu-item index="1">
|
|
|
+ <el-icon>
|
|
|
+ <Document/>
|
|
|
+ </el-icon>
|
|
|
+ <span style="padding-left: 20px">全部课程</span>
|
|
|
+ </el-menu-item>
|
|
|
+ </el-menu>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="1"/>
|
|
|
+ <el-col :span="18">
|
|
|
+ <div class="pdf-reader">
|
|
|
+ <pdf-viewer></pdf-viewer>
|
|
|
+ <pointer-canvas ref="pointerCanvas" :no-pointer="!pointer" :no-box="!box"></pointer-canvas>
|
|
|
+ <div class="pointer-actions">
|
|
|
+ <c-button text :theme="pointer ? 'red' : ''" @click="pointer = !pointer">
|
|
|
+ <i class="el-icon-edit"/> 指针</c-button>
|
|
|
+ <c-button text :left="8" :theme="box ? 'blue' : ''" @click="box = !box">
|
|
|
+ <i class="el-icon-crop"/> 框选</c-button>
|
|
|
+ <c-button text :left="8" theme="orange" @click="cleanCanvas">
|
|
|
+ <i class="el-icon-refresh-left"/> 清除</c-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </el-col>
|
|
|
</el-row>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-// import PdfViewer from "@/components/PDF/PdfViewer";
|
|
|
-// import { mapState } from "vuex";
|
|
|
-// import {
|
|
|
-// FOCUS_ON_INPUT,
|
|
|
-// NEXT_PAGE,
|
|
|
-// PREVIOUS_PAGE,
|
|
|
-// RESET, SET_CURRENT_PAGE,
|
|
|
-// SET_SRC,
|
|
|
-// TOGGLE_SHOW_DISCUSSION,
|
|
|
-// USE_FOCUS
|
|
|
-// } from "@/store/types/pdf-types";
|
|
|
-// import PointerCanvas from "@/components/PDF/PointerCanvas";
|
|
|
-// import CButton from "@/components/Basic/CButton";
|
|
|
-// import { SET_TOTAL_PAGES } from "@/store/types/pdf-types";
|
|
|
-// import FadeTransition from "@/animations/FadeTransition";
|
|
|
-//
|
|
|
-// const pdfJS = require("pdfjs-dist");
|
|
|
-// pdfJS.GlobalWorkerOptions.workerSrc = require("pdfjs-dist/build/pdf.worker.entry");
|
|
|
-//
|
|
|
-// export default {
|
|
|
-// components: {
|
|
|
-// // CButton,
|
|
|
-// // PointerCanvas,
|
|
|
-// // PdfViewer
|
|
|
-// },
|
|
|
-// computed: {
|
|
|
-// ...mapState({
|
|
|
-// src: state => state.pdf.src,
|
|
|
-// focus: state => state.pdf.focus,
|
|
|
-// currentPage: state => state.pdf.currentPage,
|
|
|
-// screenShot: state => state.pdf.screenShot,
|
|
|
-// }),
|
|
|
-// imageUrl() {
|
|
|
-// //return "https://seec-portal.oss-cn-hangzhou.aliyuncs.com/1/1bc3ed2e423eec0.jpg" + "?t=" + Date.now().valueOf();
|
|
|
-// return "https://seec-portal.oss-cn-hangzhou.aliyuncs.com/1/8610161.jpg";
|
|
|
-// },
|
|
|
-// },
|
|
|
-// data () {
|
|
|
-// return {
|
|
|
-// pdfurl:"",
|
|
|
-// courseWare: {}
|
|
|
-// };
|
|
|
-// },
|
|
|
-// watch: {
|
|
|
-// currentPage() {
|
|
|
-// this.showPage();
|
|
|
-// }
|
|
|
-// },
|
|
|
-// async mounted() {
|
|
|
-// console.log("coursewarepage");
|
|
|
-// console.log(this.$route.params.courseWareId);
|
|
|
-// this.$store.commit(RESET);
|
|
|
-// let {page} = this.$route.params.page;
|
|
|
-// if (page) {
|
|
|
-// this.$store.commit(SET_CURRENT_PAGE, {currentPage: parseInt(page)});
|
|
|
-// }
|
|
|
-// this.courseWare = (await this.$apis.getSlideInfo(this.$route.params.courseWareId)).data.data;
|
|
|
-// this.pdfurl = (await this.$apis.getSlideUrl(this.$route.params.courseWareId)).data.data;
|
|
|
-// this.$store.commit(SET_SRC, {src: this.pdfurl});
|
|
|
-// window.addEventListener("keydown", this.handleKey);
|
|
|
-//
|
|
|
-// this._canvas = document.getElementById("pdf-canvas");
|
|
|
-// this._context = this._canvas.getContext("2d");
|
|
|
-//
|
|
|
-// this.load(this.pdfurl);
|
|
|
-// },
|
|
|
-// beforeUnmount () {
|
|
|
-// window.removeEventListener("keydown", this.handleKey);
|
|
|
-// },
|
|
|
-// methods: {
|
|
|
-// handleKey (e) {
|
|
|
-// if (e.key === "Enter") {
|
|
|
-// !this.showDiscussion && this.$store.commit(TOGGLE_SHOW_DISCUSSION);
|
|
|
-// !this.focus && this.$store.commit(FOCUS_ON_INPUT);
|
|
|
-// return;
|
|
|
-// }
|
|
|
-// if (e.key === "Escape") {
|
|
|
-// if (this.focus) {
|
|
|
-// this.$store.commit(USE_FOCUS);
|
|
|
-// } else {
|
|
|
-// this.$store.commit(TOGGLE_SHOW_DISCUSSION);
|
|
|
-// }
|
|
|
-// return;
|
|
|
-// }
|
|
|
-// if (!this.showDiscussion || !this.focus) {
|
|
|
-// switch (e.key) {
|
|
|
-// case "ArrowDown":
|
|
|
-// case "ArrowRight":
|
|
|
-// case "s":
|
|
|
-// case "d":
|
|
|
-// case " ":
|
|
|
-// this.$store.commit(NEXT_PAGE);
|
|
|
-// break;
|
|
|
-// case "ArrowUp":
|
|
|
-// case "ArrowLeft":
|
|
|
-// case "w":
|
|
|
-// case "a":
|
|
|
-// this.$store.commit(PREVIOUS_PAGE);
|
|
|
-// break;
|
|
|
-// case "c":
|
|
|
-// this.cleanCanvas();
|
|
|
-// break;
|
|
|
-// case "q":
|
|
|
-// case "z":
|
|
|
-// this.$refs.pointerCanvas.undo();
|
|
|
-// break;
|
|
|
-// case "e":
|
|
|
-// case "y":
|
|
|
-// this.$refs.pointerCanvas.redo();
|
|
|
-// break;
|
|
|
-// case "[":
|
|
|
-// case "b":
|
|
|
-// this.box = !this.box;
|
|
|
-// break;
|
|
|
-// case "p":
|
|
|
-// case "v":
|
|
|
-// this.pointer = !this.pointer;
|
|
|
-// break;
|
|
|
-// }
|
|
|
-// }
|
|
|
-// },
|
|
|
-// load(src) {
|
|
|
-// console.log("load:" + src.substring(48));
|
|
|
-// const loadingTask = pdfJS.getDocument("/api/slide" + src.substring(48));
|
|
|
-// loadingTask.promise.then(pdf => {
|
|
|
-// this.loading = false;
|
|
|
-// this._pdf = pdf;
|
|
|
-// this.$store.commit(SET_TOTAL_PAGES, {totalPages: pdf.numPages});
|
|
|
-// this.showPage();
|
|
|
-// });
|
|
|
-// },
|
|
|
-// showPage() {
|
|
|
-// this._pdf && this._pdf.getPage(this.currentPage || 1).then(page => {
|
|
|
-// const scale = 2.5;
|
|
|
-// const viewport = page.getViewport({scale: scale});
|
|
|
-//
|
|
|
-// this._canvas.height = viewport.height;
|
|
|
-// this._canvas.width = viewport.width;
|
|
|
-//
|
|
|
-// const renderContext = {
|
|
|
-// canvasContext: this._context,
|
|
|
-// viewport: viewport
|
|
|
-// };
|
|
|
-// page.render(renderContext);
|
|
|
-// }).catch(() => {
|
|
|
-// console.log("PDF 当前页解析错误");
|
|
|
-// //this.$setInfoMessage('PDF 当前页解析错误')
|
|
|
-// });
|
|
|
-// }
|
|
|
-// },
|
|
|
-// };
|
|
|
+import PdfViewer from "@/components/PDF/PdfViewer";
|
|
|
+import { mapState } from "vuex";
|
|
|
+import {
|
|
|
+ FOCUS_ON_INPUT,
|
|
|
+ NEXT_PAGE,
|
|
|
+ PREVIOUS_PAGE,
|
|
|
+ RESET, SET_CURRENT_PAGE,
|
|
|
+ SET_SRC,
|
|
|
+ TOGGLE_SHOW_DISCUSSION,
|
|
|
+ USE_FOCUS
|
|
|
+} from "@/store/types/pdf-types";
|
|
|
+import PointerCanvas from "@/components/PDF/PointerCanvas";
|
|
|
+import CButton from "@/components/Basic/CButton";
|
|
|
|
|
|
+export default {
|
|
|
+ components: {CButton, PointerCanvas, PdfViewer},
|
|
|
+ computed: {
|
|
|
+ ...mapState({
|
|
|
+ src: state => state.pdf.src,
|
|
|
+ focus: state => state.pdf.focus
|
|
|
+ })
|
|
|
+ },
|
|
|
+ data () {
|
|
|
+ return {
|
|
|
+ pointer: false,
|
|
|
+ box: false,
|
|
|
+ slide: {}
|
|
|
+ };
|
|
|
+ },
|
|
|
+ mounted () {
|
|
|
+ console.log("coursewarepage");
|
|
|
+ this.$store.commit(RESET);
|
|
|
+ let { page } = this.$route.params;
|
|
|
+ if (page) {
|
|
|
+ this.$store.commit(SET_CURRENT_PAGE, { currentPage: parseInt(page) });
|
|
|
+ }
|
|
|
+ const _slideId = this.$route.params.slideId;
|
|
|
+ this.$apis.getSlideInfo({ slideId: _slideId }).then(res => {
|
|
|
+ this.slide = res;
|
|
|
+ }).catch(err => {
|
|
|
+ //this.$setErrorMessage(err.response.data.msg)
|
|
|
+ });
|
|
|
+ this.$apis.getSlideUrl({ slideId: _slideId }).then(res => {
|
|
|
+ console.log(this.$apis.getSlideUrl({ slideId: _slideId }));
|
|
|
+ this.$store.commit(SET_SRC, { src: res });
|
|
|
+ }).catch(err => {
|
|
|
+ //this.$setErrorMessage('获取课件链接的过程中:' + err.response.data.msg)
|
|
|
+ });
|
|
|
+ window.addEventListener("keydown", this.handleKey);
|
|
|
+ },
|
|
|
+ beforeUnmount () {
|
|
|
+ window.removeEventListener("keydown", this.handleKey);
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ handleSelect(index) {
|
|
|
+ if (index === "0") {
|
|
|
+ this.$router.push("portal");
|
|
|
+ }
|
|
|
+ if (index === "1") {
|
|
|
+ document.getElementById("app").scrollIntoView({behavior: "smooth"});
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handleKey (e) {
|
|
|
+ if (e.key === "Enter") {
|
|
|
+ !this.showDiscussion && this.$store.commit(TOGGLE_SHOW_DISCUSSION);
|
|
|
+ !this.focus && this.$store.commit(FOCUS_ON_INPUT);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (e.key === "Escape") {
|
|
|
+ if (this.focus) {
|
|
|
+ this.$store.commit(USE_FOCUS);
|
|
|
+ } else {
|
|
|
+ this.$store.commit(TOGGLE_SHOW_DISCUSSION);
|
|
|
+ }
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (!this.showDiscussion || !this.focus) {
|
|
|
+ switch (e.key) {
|
|
|
+ case "ArrowDown":
|
|
|
+ case "ArrowRight":
|
|
|
+ case "s":
|
|
|
+ case "d":
|
|
|
+ case " ":
|
|
|
+ this.$store.commit(NEXT_PAGE);
|
|
|
+ break;
|
|
|
+ case "ArrowUp":
|
|
|
+ case "ArrowLeft":
|
|
|
+ case "w":
|
|
|
+ case "a":
|
|
|
+ this.$store.commit(PREVIOUS_PAGE);
|
|
|
+ break;
|
|
|
+ case "c":
|
|
|
+ this.cleanCanvas();
|
|
|
+ break;
|
|
|
+ case "q":
|
|
|
+ case "z":
|
|
|
+ this.$refs.pointerCanvas.undo();
|
|
|
+ break;
|
|
|
+ case "e":
|
|
|
+ case "y":
|
|
|
+ this.$refs.pointerCanvas.redo();
|
|
|
+ break;
|
|
|
+ case "[":
|
|
|
+ case "b":
|
|
|
+ this.box = !this.box;
|
|
|
+ break;
|
|
|
+ case "p":
|
|
|
+ case "v":
|
|
|
+ this.pointer = !this.pointer;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ cleanCanvas () {
|
|
|
+ this.$refs.pointerCanvas.cleanCanvas();
|
|
|
+ }
|
|
|
+ },
|
|
|
+};
|
|
|
|
|
|
-</script>
|
|
|
|
|
|
-<!--<style lang="scss" scoped>-->
|
|
|
-<!-- .pdf-reader {-->
|
|
|
-<!-- display: flex;-->
|
|
|
-<!-- align-items: center;-->
|
|
|
-<!-- justify-content: center;-->
|
|
|
-<!-- min-height: 100vh;-->
|
|
|
-<!-- }-->
|
|
|
-
|
|
|
-<!-- .mybuttton {-->
|
|
|
-<!-- position: absolute;-->
|
|
|
-<!-- left: 16px;-->
|
|
|
-<!-- top: 16px;-->
|
|
|
-<!-- background-color: rgba(160, 180, 200, .1);-->
|
|
|
-<!-- color: #7a8a9a;-->
|
|
|
-<!-- align-items: center;-->
|
|
|
-<!-- justify-content: center;-->
|
|
|
-<!-- padding: 8px;-->
|
|
|
-<!-- width: 44px;-->
|
|
|
-<!-- height: 44px;-->
|
|
|
-<!-- &:hover {-->
|
|
|
-<!-- background-color: rgba(218, 234, 250, 0.67);-->
|
|
|
-<!-- }-->
|
|
|
-<!-- }-->
|
|
|
+</script>
|
|
|
|
|
|
-<!-- .myicon {-->
|
|
|
-<!-- font-size: 25px;-->
|
|
|
-<!-- }-->
|
|
|
+<style lang="scss" scoped>
|
|
|
+ .pdf-reader {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ min-height: 100vh;
|
|
|
+ }
|
|
|
|
|
|
-<!-- .show-discussion, .hide-discussion {-->
|
|
|
-<!-- transition: .2s;-->
|
|
|
-<!-- }-->
|
|
|
+ .icon-button {
|
|
|
+ z-index: 2;
|
|
|
+ position: absolute;
|
|
|
+ left: 16px;
|
|
|
+ top: 16px;
|
|
|
+ background-color: rgba(218, 234, 250, 0.4);
|
|
|
+ backdrop-filter: saturate(150%) blur(20px);
|
|
|
|
|
|
-<!-- .hide-discussion {-->
|
|
|
-<!-- transform: translateY(100%);-->
|
|
|
-<!-- opacity: 0;-->
|
|
|
-<!-- }-->
|
|
|
+ &:hover {
|
|
|
+ background-color: rgba(218, 234, 250, 0.67);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
-<!-- .pointer-actions {-->
|
|
|
-<!-- position: fixed;-->
|
|
|
-<!-- left: 6px;-->
|
|
|
-<!-- bottom: 8px;-->
|
|
|
+ .show-discussion, .hide-discussion {
|
|
|
+ transition: .2s;
|
|
|
+ }
|
|
|
|
|
|
-<!-- .c-button {-->
|
|
|
-<!-- background-color: white;-->
|
|
|
-<!-- }-->
|
|
|
-<!-- }-->
|
|
|
-<!--</style>-->
|
|
|
+ .hide-discussion {
|
|
|
+ transform: translateY(100%);
|
|
|
+ opacity: 0;
|
|
|
+ }
|
|
|
|
|
|
+ .pointer-actions {
|
|
|
+ position: fixed;
|
|
|
+ left: 6px;
|
|
|
+ bottom: 8px;
|
|
|
|
|
|
+ .c-button {
|
|
|
+ background-color: white;
|
|
|
+ }
|
|
|
+ }
|
|
|
+</style>
|