| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231 |
- <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-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 当前页解析错误')
- // });
- // }
- // },
- // };
- </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);-->
- <!-- }-->
- <!-- }-->
- <!-- .myicon {-->
- <!-- font-size: 25px;-->
- <!-- }-->
- <!-- .show-discussion, .hide-discussion {-->
- <!-- transition: .2s;-->
- <!-- }-->
- <!-- .hide-discussion {-->
- <!-- transform: translateY(100%);-->
- <!-- opacity: 0;-->
- <!-- }-->
- <!-- .pointer-actions {-->
- <!-- position: fixed;-->
- <!-- left: 6px;-->
- <!-- bottom: 8px;-->
- <!-- .c-button {-->
- <!-- background-color: white;-->
- <!-- }-->
- <!-- }-->
- <!--</style>-->
|