askbot-dragon 1.3.22 → 1.3.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -2
- package/public/index.html +12 -2
- package/src/components/pdfPosition.vue +15 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "askbot-dragon",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.23",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"serve": "vue-cli-service serve",
|
|
6
6
|
"build": "vue-cli-service build",
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
"install": "^0.13.0",
|
|
16
16
|
"jquery": "^3.5.1",
|
|
17
17
|
"lodash": "^4.17.21",
|
|
18
|
-
"pdfjs-dist": "^3.5.141",
|
|
19
18
|
"uuid": "^8.3.2",
|
|
20
19
|
"v-viewer": "^1.6.4",
|
|
21
20
|
"vant": "^2.12.51",
|
package/public/index.html
CHANGED
|
@@ -27,10 +27,17 @@
|
|
|
27
27
|
<link rel="stylesheet" href="https://static.guoranbot.com/vant/2.12/lib/index.css" /> -->
|
|
28
28
|
|
|
29
29
|
<!-- pdf.js -->
|
|
30
|
-
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/3.5.141/pdf.min.js" integrity="sha512-BagCUdQjQ2Ncd42n5GGuXQn1qwkHL2jCSkxN5+ot9076d5wAI8bcciSooQaI3OG3YLj6L97dKAFaRvhSXVO0/Q==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
|
30
|
+
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/3.5.141/pdf.min.js" integrity="sha512-BagCUdQjQ2Ncd42n5GGuXQn1qwkHL2jCSkxN5+ot9076d5wAI8bcciSooQaI3OG3YLj6L97dKAFaRvhSXVO0/Q==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
|
31
31
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/3.5.141/pdf.worker.min.js" integrity="sha512-6UHd2tcWIvg5hIYHXb3lnNO61tWfriGen6KddwGYTSUUazWGYESTHDDxJFEQkCy1cSL//yXKc1gcL+51/DTLFQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
|
32
32
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/3.5.141/pdf_viewer.min.js" integrity="sha512-tYEGuMBQkCfSlBKJ3dNgS06wbb/MNE6nO2poZ1Y5brix8NajGcDcfEvuL38wJDOTkq0j5ojASNmrzv/8/wgGHQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
|
33
|
-
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/3.5.141/pdf_viewer.min.css" integrity="sha512-Jf9DLkegLgARLR151csVkPvcVt4cOUhslrSZwiTAe9mqFL/BbYRDmxCOioCtbHifEgjsBFbrVhOMQ3mYPDLrqQ==" crossorigin="anonymous" referrerpolicy="no-referrer" />
|
|
33
|
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/3.5.141/pdf_viewer.min.css" integrity="sha512-Jf9DLkegLgARLR151csVkPvcVt4cOUhslrSZwiTAe9mqFL/BbYRDmxCOioCtbHifEgjsBFbrVhOMQ3mYPDLrqQ==" crossorigin="anonymous" referrerpolicy="no-referrer" /> -->
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.1.266/pdf.min.js" integrity="sha512-1VjCQ9oENTPqqDCs6xQAk6ETB/jbCPvaOPI2z3Q+bWxTudBP7aTJZI3eB+mSbVvth0W2LQL1jePGkAWa79zr5Q==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
|
37
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.1.266/pdf.worker.min.js" integrity="sha512-14hvtl/LxmtX9F2tsqmOUveDlKql0bm7lR5ua+J+ddLuhoXCrOfG8aD/WJejCtLLvnjcEhX/XCuOyoTZv4Xq4A==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
|
38
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.1.266/pdf_viewer.js" integrity="sha512-/Kuwn901frjpfp2NMgB9S/LEtm+ilDzwVy/iS8MlY0BeIwkvtjGTxnjY8u+fn8QyDxS23OLJ+M2g++W/zsb0nw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
|
39
|
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.1.266/pdf_viewer.css" integrity="sha512-0LYOXoVuJYymEk9nBWqkOCflK2quQSJHaKavRoiaaq7LFM0ThLErV8uqE9vBuXAliN+8qbymsx0u5C9B/pHn7g==" crossorigin="anonymous" referrerpolicy="no-referrer" />
|
|
40
|
+
|
|
34
41
|
<style>
|
|
35
42
|
*{
|
|
36
43
|
margin: 0;
|
|
@@ -45,4 +52,7 @@
|
|
|
45
52
|
<div id="app"></div>
|
|
46
53
|
<!-- built files will be auto injected -->
|
|
47
54
|
</body>
|
|
55
|
+
<script>
|
|
56
|
+
console.log(window);
|
|
57
|
+
</script>
|
|
48
58
|
</html>
|
|
@@ -5,12 +5,18 @@
|
|
|
5
5
|
|
|
6
6
|
<script>
|
|
7
7
|
import _ from 'lodash'
|
|
8
|
-
import * as pdfjsLib from 'pdfjs-dist'
|
|
9
|
-
pdfjsLib.GlobalWorkerOptions.workerSrc = 'pdfjs-dist/build/pdf.worker';
|
|
10
|
-
import { TextLayerBuilder } from "pdfjs-dist/web/pdf_viewer";
|
|
8
|
+
// import * as pdfjsLib from 'pdfjs-dist'
|
|
9
|
+
// pdfjsLib.GlobalWorkerOptions.workerSrc = 'pdfjs-dist/build/pdf.worker';
|
|
10
|
+
// import { TextLayerBuilder } from "pdfjs-dist/web/pdf_viewer";
|
|
11
11
|
// EventBus pdf_viewer 支持绑定自定义事件,一版不做
|
|
12
|
-
import 'pdfjs-dist/web/pdf_viewer.css'
|
|
12
|
+
// import 'pdfjs-dist/web/pdf_viewer.css'
|
|
13
13
|
|
|
14
|
+
const pdfjsLib = window['pdfjs-dist']
|
|
15
|
+
if(pdfjsLib) {
|
|
16
|
+
pdfjsLib.GlobalWorkerOptions.workerSrc = window['pdfjsWorker']
|
|
17
|
+
// 'pdfjs-dist/build/pdf.worker';
|
|
18
|
+
}
|
|
19
|
+
const { TextLayerBuilder } = window['pdfjsViewer']
|
|
14
20
|
export default {
|
|
15
21
|
name: 'pdfView',
|
|
16
22
|
props:['tagId'],
|
|
@@ -46,7 +52,7 @@ export default {
|
|
|
46
52
|
},
|
|
47
53
|
methods:{
|
|
48
54
|
async loadPdfData(loadPage) {
|
|
49
|
-
pdfjsLib.GlobalWorkerOptions.workerSrc = require("pdfjs-dist/legacy/build/pdf.worker.entry.js");
|
|
55
|
+
// pdfjsLib.GlobalWorkerOptions.workerSrc = require("pdfjs-dist/legacy/build/pdf.worker.entry.js");
|
|
50
56
|
// 拿到第一个分片
|
|
51
57
|
const { startPage, url } = await this.fetchPdfFragment(loadPage);
|
|
52
58
|
|
|
@@ -162,14 +168,15 @@ export default {
|
|
|
162
168
|
textLayerDiv.setAttribute('class', 'textLayer');
|
|
163
169
|
// 将文本图层div添加至每页pdf的div中
|
|
164
170
|
// 创建新的TextLayerBuilder实例
|
|
171
|
+
// 这里因为版本问题跟pc端有些差异
|
|
172
|
+
pageDom.appendChild(textLayerDiv);
|
|
165
173
|
let textLayer = new TextLayerBuilder({
|
|
166
174
|
textLayerDiv:textLayerDiv,
|
|
167
175
|
pageIndex: pdfPage._pageIndex,
|
|
168
176
|
viewport: viewport,
|
|
169
177
|
});
|
|
170
|
-
textLayer.
|
|
171
|
-
textLayer.render(
|
|
172
|
-
pageDom.appendChild(textLayer.div);
|
|
178
|
+
textLayer.setTextContent(textContent);
|
|
179
|
+
textLayer.render()
|
|
173
180
|
})
|
|
174
181
|
page.dom = pageDom;
|
|
175
182
|
if(pageIndex == this.identifyTextPostion.page) {
|