chunk-61f49d50.2217c5db.js.map 12 KB

1
  1. {"version":3,"sources":["webpack:///./src/views/pdf/pdf-view-radius.vue?f604","webpack:///./src/views/pdf/pdf-view-radius.vue","webpack:///src/views/pdf/pdf-view-radius.vue","webpack:///./src/views/pdf/pdf-view-radius.vue?99d0","webpack:///./src/views/pdf/pdf-view-radius.vue?08ad"],"names":["render","_vm","this","_c","_self","staticClass","staticStyle","on","showDrawer","_v","$event","scaleD","scaleX","ref","style","width","pdf_div_width","margin","attrs","_l","pdf_pages","page","key","placement","visible","onClose","expandedKeys","gData","children","title","value","handleSelect","staticRenderFns","PDFJS","data","pageArr","pdf_scale","pdf_src","mounted","methods","console","window","top","max","get_pdfurl","_loadFile","loadingTask","pdf","r","_renderPage","that","ctx","scale","canvas","canvasContext","viewport","component"],"mappings":"kHAAA,W,yCCAA,IAAIA,EAAS,WAAkB,IAAIC,EAAIC,KAAKC,EAAGF,EAAIG,MAAMD,GAAG,OAAOA,EAAG,MAAM,CAACE,YAAY,aAAa,CAACF,EAAG,WAAW,CAACG,YAAY,CAAC,SAAW,SAASC,GAAG,CAAC,MAAQN,EAAIO,aAAa,CAACP,EAAIQ,GAAG,QAAQN,EAAG,MAAM,CAACE,YAAY,YAAY,CAACF,EAAG,MAAM,CAACE,YAAY,eAAeE,GAAG,CAAC,MAAQ,SAASG,GAAQ,OAAOT,EAAIU,YAAY,CAACV,EAAIQ,GAAG,QAAQN,EAAG,MAAM,CAACE,YAAY,iBAAiBE,GAAG,CAAC,MAAQ,SAASG,GAAQ,OAAOT,EAAIW,YAAY,CAACX,EAAIQ,GAAG,UAAUN,EAAG,MAAM,CAACU,IAAI,YAAYC,MAAO,CAAEC,MAAOd,EAAIe,cAAeC,OAAQ,UAAYC,MAAM,CAAC,GAAK,cAAcjB,EAAIkB,GAAIlB,EAAImB,WAAW,SAASC,GAAM,OAAOlB,EAAG,SAAS,CAACmB,IAAID,EAAKH,MAAM,CAAC,GAAK,aAAeG,QAAU,GAAGlB,EAAG,WAAW,CAACe,MAAM,CAAC,MAAQ,KAAK,UAAYjB,EAAIsB,UAAU,UAAW,EAAM,QAAUtB,EAAIuB,SAASjB,GAAG,CAAC,MAAQN,EAAIwB,UAAU,CAACtB,EAAG,SAAS,CAACE,YAAY,iBAAiBa,MAAM,CAAC,wBAAwBjB,EAAIyB,aAAa,UAAY,GAAG,YAAYzB,EAAI0B,MAAM,cAAgB,CAC15BC,SAAU,QACVC,MAAO,QACPP,IAAK,QACLQ,MAAO,SACNvB,GAAG,CAAC,OAASN,EAAI8B,iBAAiB,IAAI,IAE3CC,EAAkB,G,kCCqCtB,YACAC,EAAMA,oBAAoBA,UAAYA,EAAQA,QAE/B,OACfC,gBACA,OACAR,gBACAS,WACAR,SACAH,WACAD,iBACAa,YACAhB,aACAJ,iBACAqB,eAGAC,mBACA,mBAEAC,SACAR,+BACAS,qBACA,wCACA,GACA,iDACA,wCACAA,iBACAA,YACA,wCACA,qBAMAC,iBACAC,QAMAF,eACAA,8BAEAf,mBACA,iBAEAjB,sBACA,iBAEAG,kBAEA,QAEAgC,EADA,yBACAA,IAEAA,IAEA,oBAGA,iCACA,+BAEA/B,kBAEA,QACA,oBAGA,iCACA,+BAEAgC,sBAMA,wBACA,yCACA,6BACAJ,2BAUAK,sBAAA,WAEA,mBACAC,4BACA,WACA,8BACAC,iCACAP,oBACAA,eACA,UACA,UACAA,sBACAQ,uBACAR,eAEAO,gBAAAlC,gBAAA,kBACA2B,yBAOA,wBACA,wBAIAS,wBAAA,WAEA,OACA,yCACAC,sBACA,8CACA,qBACA,6BACA,EACAC,gCACAA,6BACAA,4BACAA,2BACAA,0BACA,EACA,MACA,iBAAAC,oBAEAC,kBACAA,oBAEAA,2BAEAH,6BAEAG,6BAEAF,4BACA,OACAG,gBACAC,YAEAlC,YACA,eACA,yBCxMwW,I,wBCQpWmC,EAAY,eACd,EACAxD,EACAgC,GACA,EACA,KACA,WACA,MAIa,aAAAwB,E","file":"js/chunk-61f49d50.2217c5db.js","sourcesContent":["export * from \"-!../../../node_modules/mini-css-extract-plugin/dist/loader.js??ref--8-oneOf-1-0!../../../node_modules/css-loader/index.js??ref--8-oneOf-1-1!../../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../../node_modules/postcss-loader/src/index.js??ref--8-oneOf-1-2!../../../node_modules/sass-loader/dist/cjs.js??ref--8-oneOf-1-3!../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./pdf-view-radius.vue?vue&type=style&index=0&id=7edfb9f6&prod&lang=scss&scoped=true&\"","var render = function render(){var _vm=this,_c=_vm._self._c;return _c('div',{staticClass:\"home_wrap\"},[_c('a-button',{staticStyle:{\"position\":\"fixed\"},on:{\"click\":_vm.showDrawer}},[_vm._v(\"目录\")]),_c('div',{staticClass:\"pdf_down\"},[_c('div',{staticClass:\"pdf_set_left\",on:{\"click\":function($event){return _vm.scaleD()}}},[_vm._v(\"放大\")]),_c('div',{staticClass:\"pdf_set_middle\",on:{\"click\":function($event){return _vm.scaleX()}}},[_vm._v(\"缩小\")])]),_c('div',{ref:\"getheight\",style:({ width: _vm.pdf_div_width, margin: '0 auto' }),attrs:{\"id\":\"scrollBox\"}},_vm._l((_vm.pdf_pages),function(page){return _c('canvas',{key:page,attrs:{\"id\":'the_canvas' + page}})}),0),_c('a-drawer',{attrs:{\"title\":\"目录\",\"placement\":_vm.placement,\"closable\":false,\"visible\":_vm.visible},on:{\"close\":_vm.onClose}},[_c('a-tree',{staticClass:\"draggable-tree\",attrs:{\"default-expanded-keys\":_vm.expandedKeys,\"draggable\":\"\",\"tree-data\":_vm.gData,\"replaceFields\":{\n children: 'items',\n title: 'title',\n key: 'title',\n value: 'dest',\n }},on:{\"select\":_vm.handleSelect}})],1)],1)\n}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","<template>\n <div class=\"home_wrap\">\n <a-button @click=\"showDrawer\" style=\"position: fixed\">目录</a-button>\n <div class=\"pdf_down\">\n <div class=\"pdf_set_left\" @click=\"scaleD()\">放大</div>\n <div class=\"pdf_set_middle\" @click=\"scaleX()\">缩小</div>\n </div>\n\n <div\n ref=\"getheight\"\n id=\"scrollBox\"\n :style=\"{ width: pdf_div_width, margin: '0 auto' }\"\n >\n <canvas\n v-for=\"page in pdf_pages\"\n :id=\"'the_canvas' + page\"\n :key=\"page\"\n ></canvas>\n </div>\n <a-drawer\n title=\"目录\"\n :placement=\"placement\"\n :closable=\"false\"\n :visible=\"visible\"\n @close=\"onClose\"\n >\n <a-tree\n class=\"draggable-tree\"\n :default-expanded-keys=\"expandedKeys\"\n draggable\n :tree-data=\"gData\"\n :replaceFields=\"{\n children: 'items',\n title: 'title',\n key: 'title',\n value: 'dest',\n }\"\n @select=\"handleSelect\"\n />\n </a-drawer>\n </div>\n</template>\n\n<script>\nlet PDFJS = require(\"pdfjs-dist\");\nPDFJS.GlobalWorkerOptions.workerSrc = require(\"pdfjs-dist/build/pdf.worker.entry.js\");\nimport { OSS_URL } from \"@/common/config\";\nexport default {\n data() {\n return {\n expandedKeys: [],\n pageArr: [],\n gData: [],\n visible: false,\n placement: \"left\",\n pdf_scale: 1.0, //pdf放大系数\n pdf_pages: [],\n pdf_div_width: \"\",\n pdf_src: null,\n };\n },\n mounted() {\n this.get_pdfurl();\n },\n methods: {\n handleSelect(a, b, c, d) {\n console.log(a, b, c, d);\n let height = this.$refs.getheight.offsetHeight;\n const offsetHeight =\n ((height - 1000) * b.selectedNodes[0].data.props.dest[0].num) /\n this.pageArr[this.pageArr.length - 1].num;\n console.log(height, offsetHeight);\n console.log(\n this.pageArr[this.pageArr.length - 1].num,\n this.pageArr[0].num\n );\n // this.$refs.getheight.scrollTo(0,offsetHeight);\n\n // document.getElementById(\"scrollBox\").scrollIntoView(offsetHeight);\n // this.$refs.getheight.scrollTop = offsetHeight\n window.scrollTo({\n top: offsetHeight,\n // behavior: 'smooth' // 滚动行为:smooth平滑滚动,instant瞬间滚动,默认值auto,等同于instant\n });\n // this.$nextTick(() => {\n // this.$refs.getheight.scrollTop = parseInt(offsetHeight)\n // })\n console.log(height);\n console.log(this.pageArr[0]);\n },\n onClose() {\n this.visible = false;\n },\n showDrawer() {\n this.visible = true;\n },\n scaleD() {\n //放大\n let max = 0;\n if (window.screen.width > 1440) {\n max = 1.4;\n } else {\n max = 1.2;\n }\n if (this.pdf_scale >= max) {\n return;\n }\n this.pdf_scale = this.pdf_scale + 0.1;\n this._loadFile(this.pdf_src);\n },\n scaleX() {\n //缩小\n let min = 1.0;\n if (this.pdf_scale <= min) {\n return;\n }\n this.pdf_scale = this.pdf_scale - 0.1;\n this._loadFile(this.pdf_src);\n },\n get_pdfurl() {\n //获得pdf教案\n //加载本地\n // this.pdf_src = 'https://mozilla.github.io/pdf.js/web/compressed.tracemonkey-pldi-09.pdf'\n // this.pdf_src = \"../Pig.pdf\";\n // this.pdf_src = 'http://kaoshiftp.book118.com//%E5%B0%8F%E5%AD%A6%E5%88%9D%E4%B8%AD/%E5%88%9D%E4%B8%AD%E6%95%B0%E5%AD%A6/%E6%B5%B7%E6%B7%80%E8%A7%A3%E9%A2%98%E9%A2%98%E5%85%B8-%E5%88%9D%E4%B8%AD%E6%95%B0%E5%AD%A6.pdf'\n const option = this.$route.query;\n this.pdf_src = OSS_URL + encodeURI(option.url) || \"\";\n this._loadFile(this.pdf_src);\n console.log(this.pdf_src);\n return;\n\n //线上请求\n // this.$axios.get('')\n // .then((res)=>{\n // \tthis.pdf_src = res.url\n // \tthis._loadFile(this.pdf_src)\n // })\n },\n _loadFile(url) {\n //初始化pdf\n let loadingTask = PDFJS.getDocument(url);\n loadingTask.promise.then((pdf) => {\n this.pdfDoc = pdf;\n this.pdf_pages = this.pdfDoc.numPages;\n pdf.getOutline().then((r) => {\n console.log(\"dddd\");\n console.log(r);\n this.gData = r;\n if (r != null) {\n console.log(\"888888\");\n r.forEach((it) => {\n console.log(it);\n\n pdf.getPageIndex({ ref: it.dest[0] }).then((vvv) => {\n console.log(vvv);\n });\n // $(\"#div\").html(it.title)\n });\n }\n });\n //debugger\n this.$nextTick(() => {\n this._renderPage(1);\n });\n });\n },\n _renderPage(num) {\n //渲染pdf页\n const that = this;\n this.pdfDoc.getPage(num).then((page) => {\n that.pageArr.push(page.ref);\n let canvas = document.getElementById(\"the_canvas\" + num);\n let ctx = canvas.getContext(\"2d\");\n let dpr = window.devicePixelRatio || 1;\n let bsr =\n ctx.webkitBackingStorePixelRatio ||\n ctx.mozBackingStorePixelRatio ||\n ctx.msBackingStorePixelRatio ||\n ctx.oBackingStorePixelRatio ||\n ctx.backingStorePixelRatio ||\n 1;\n let ratio = dpr / bsr;\n let viewport = page.getViewport({ scale: this.pdf_scale });\n\n canvas.width = viewport.width * ratio;\n canvas.height = viewport.height * ratio;\n\n canvas.style.width = viewport.width + \"px\";\n\n that.pdf_div_width = viewport.width + \"px\";\n\n canvas.style.height = viewport.height + \"px\";\n\n ctx.setTransform(ratio, 0, 0, ratio, 0, 0);\n let renderContext = {\n canvasContext: ctx,\n viewport: viewport,\n };\n page.render(renderContext);\n if (this.pdf_pages > num) {\n this._renderPage(num + 1);\n }\n });\n },\n },\n};\n</script>\n<style lang=\"scss\" scoped>\n.home_wrap {\n width: 100%;\n height: 100%;\n .pdf_down {\n position: fixed;\n display: flex;\n z-index: 20;\n right: 26px;\n bottom: 7%;\n .pdf_set_left {\n width: 30px;\n height: 40px;\n color: #408fff;\n font-size: 11px;\n padding-top: 25px;\n text-align: center;\n margin-right: 5px;\n cursor: pointer;\n }\n .pdf_set_middle {\n width: 30px;\n height: 40px;\n color: #408fff;\n font-size: 11px;\n padding-top: 25px;\n text-align: center;\n margin-right: 5px;\n cursor: pointer;\n }\n }\n}\nhtml {\n background: #ccc;\n}\ncanvas {\n border-radius: 10px;\n}\n</style>\n","import mod from \"-!../../../node_modules/cache-loader/dist/cjs.js??ref--12-0!../../../node_modules/thread-loader/dist/cjs.js!../../../node_modules/babel-loader/lib/index.js!../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./pdf-view-radius.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../../node_modules/cache-loader/dist/cjs.js??ref--12-0!../../../node_modules/thread-loader/dist/cjs.js!../../../node_modules/babel-loader/lib/index.js!../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./pdf-view-radius.vue?vue&type=script&lang=js&\"","import { render, staticRenderFns } from \"./pdf-view-radius.vue?vue&type=template&id=7edfb9f6&scoped=true&\"\nimport script from \"./pdf-view-radius.vue?vue&type=script&lang=js&\"\nexport * from \"./pdf-view-radius.vue?vue&type=script&lang=js&\"\nimport style0 from \"./pdf-view-radius.vue?vue&type=style&index=0&id=7edfb9f6&prod&lang=scss&scoped=true&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n \"7edfb9f6\",\n null\n \n)\n\nexport default component.exports"],"sourceRoot":""}