askbot-dragon 1.5.21-beta → 1.5.21

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.
@@ -1,13 +1,9 @@
1
1
  <template>
2
- <div
3
- class="pdf_view"
4
- ref="pdfView"
5
- @scroll="pdfScroll"
6
- :style="{
7
- marginTop: isPC ? '50px' : '',
8
- marginBottom: tagIds.length > 1 ? '60px' : '0px',
9
- height: setHeight
10
- }">
2
+ <div class="pdf_view" ref="pdfView" @scroll="pdfScroll" :style="{
3
+ marginTop: isPC ? '50px' : '',
4
+ marginBottom: tagIds.length > 1 ? '60px' : '0px',
5
+ height: setHeight
6
+ }">
11
7
  <div class="change_scale" v-if="isPC">
12
8
  <section @click="changeScale('reduce')">
13
9
  <i class="el-icon-minus"></i>
@@ -16,16 +12,12 @@
16
12
  <section @click="changeScale('zoom')">
17
13
  <i class="el-icon-plus"></i>
18
14
  </section>
19
- <el-select size="small" v-model="handScale" @change="changeScale" placeholder="请选择">
20
- <el-option
21
- v-for="item in scaleList"
22
- :key="item.value"
23
- :label="item.label"
24
- :value="item.value">
15
+ <el-select size="small" v-model="handScale" @change="changeScale" placeholder="请选择">
16
+ <el-option v-for="item in scaleList" :key="item.value" :label="item.label" :value="item.value">
25
17
  </el-option>
26
18
  </el-select>
27
19
  </div>
28
- <div class="btn_footer" v-if="tagIds.length > 1 && !isPC">
20
+ <div class="btn_footer" v-if="tagIds.length > 1 && !isPC">
29
21
  <div class="prev" @click="prev">上一段</div>
30
22
  <div class="next" @click="next">下一段</div>
31
23
  </div>
@@ -47,16 +39,16 @@ import _ from 'lodash'
47
39
  // import 'pdfjs-dist/web/pdf_viewer.css'
48
40
  /* eslint-disable */
49
41
  const pdfjsLib = window['pdfjsLib']
50
- if(pdfjsLib) {
51
- pdfjsLib.GlobalWorkerOptions.workerSrc = window['pdfjs-dist/build/pdf.worker']
42
+ if (pdfjsLib) {
43
+ pdfjsLib.GlobalWorkerOptions.workerSrc = window['pdfjs-dist/build/pdf.worker']
52
44
  // 'pdfjs-dist/build/pdf.worker';
53
45
  }
54
46
  const { TextLayerBuilder } = window['pdfjs-dist/web/pdf_viewer']
55
47
  // import { zoomElement } from '../assets/js/hammer'
56
48
  export default {
57
49
  name: 'pdfView',
58
- props:['tagIds','isMessageRecord'],
59
- data() {
50
+ props: ['tagIds', 'isMessageRecord'],
51
+ data () {
60
52
  return {
61
53
  url: '',
62
54
  pages: [],
@@ -90,9 +82,9 @@ export default {
90
82
  newViewer: null,
91
83
  currentPage: 0,
92
84
  changetoolbar: false,
93
- allTr:[],
85
+ allTr: [],
94
86
  preViewType: 'pdf',
95
- displacement:{
87
+ displacement: {
96
88
  pageX: 0,
97
89
  pageY: 0,
98
90
  moveable: false,
@@ -104,47 +96,46 @@ export default {
104
96
  transformSalce: null,
105
97
  isPC: false,
106
98
  handScale: 'auto',
107
- scaleList:[
99
+ scaleList: [
108
100
  {
109
- label:'自动缩放',
110
- value:'auto'
101
+ label: '自动缩放',
102
+ value: 'auto'
111
103
  },
112
104
  {
113
- label:'实际比例',
114
- value:'reality'
105
+ label: '实际比例',
106
+ value: 'reality'
115
107
  },
116
108
  {
117
- label:'100%',
109
+ label: '100%',
118
110
  value: 1
119
111
  },
120
112
  {
121
- label:'120%',
113
+ label: '120%',
122
114
  value: 1.2
123
115
  },
124
116
  {
125
- label:'150%',
117
+ label: '150%',
126
118
  value: 1.5
127
119
  },
128
120
  {
129
- label:'170%',
121
+ label: '170%',
130
122
  value: 1.7
131
123
  }
132
124
  ,
133
125
  {
134
- label:'200%',
126
+ label: '200%',
135
127
  value: 2
136
128
  }
137
129
  ],
138
- scrollTop:0,
139
- scrollLeft:0
130
+ scrollTop: 0,
131
+ scrollLeft: 0
140
132
  }
141
133
  },
142
134
  methods: {
143
135
  getpdfResloutePage (pdfResloute) {
144
136
  // 根据当前页面宽度设置缩放比例
145
137
  // this.scale = Math.round(this.$refs.pdfView.clientWidth / pdfResloute.pageWidth * 100) / 100
146
- // console.log(this.scale,'this.scale');
147
- if(this.isMessageRecord) {
138
+ if (this.isMessageRecord) {
148
139
  this.scale = Math.round(this.$refs.pdfView.clientWidth / pdfResloute.pageWidth * 100) / 100
149
140
  } else {
150
141
  this.scale = 2
@@ -156,36 +147,45 @@ export default {
156
147
  this.loadPdfData(pdfResloute.page)
157
148
  },
158
149
  async loadPdfData (loadPage) {
159
- if(this.pages[loadPage - 1] && ((this.pages[loadPage - 1].dom && this.pages[loadPage - 1].dom.children.length > 0) || this.pages[loadPage - 1].loading)) {
150
+ if (this.pages[loadPage - 1] && ((this.pages[loadPage - 1].dom && this.pages[loadPage - 1].dom.children.length > 0) || this.pages[loadPage - 1].loadStatus)) {
160
151
  return
152
+ } else {
153
+ if (this.changetoolbar) {
154
+ this.$nextTick(() => {
155
+ this.renderHighlights()
156
+ })
157
+ this.changetoolbar = false
158
+ }
161
159
  }
162
- this.pages[loadPage - 1].loading = true
160
+ // 记录开始缓存的状态
163
161
  // pdfjsLib.GlobalWorkerOptions.workerSrc = require("pdfjs-dist/legacy/build/pdf.worker.entry.js");
164
162
  // 拿到第一个分片
165
163
  const { startPage, url } = await this.fetchPdfFragment(loadPage);
166
164
  let loadingTask = pdfjsLib.getDocument(url)
167
- loadingTask.promise.then((pdfDoc) => {
165
+ loadingTask.promise.then(async (pdfDoc) => {
168
166
  // 将已经下载的分片保存到 pages 数组中
169
- for (let i = 0; i < pdfDoc.numPages; i += 1) {
170
- const pageIndex = startPage + i;
171
- const page = this.pages[pageIndex - 1];
172
- // 不在缓存列表内,重新获取本页pdf
173
- if (page.loadStatus !== this.pageLoadStatus.LOADED) {
174
- pdfDoc.getPage(i + 1).then((pdfPage) => {
175
- page.pdfPage = pdfPage;
176
- page.loadStatus = this.pageLoadStatus.LOADED;
177
- // 通知可以进行渲染了
178
- this.startRenderPages(pdfPage, page, pageIndex)
179
- });
180
- } else {
181
- if (this.changetoolbar) {
182
- this.$nextTick(() => {
183
- this.renderHighlights()
184
- })
185
- this.changetoolbar = false
186
- }
187
- }
188
- }
167
+ // for (let i = 0; i < pdfDoc.numPages; i += 1) {
168
+ // const pageIndex = startPage + i;
169
+ // const page = this.pages[pageIndex - 1];
170
+ // // // 不在缓存列表内,重新获取本页pdf
171
+ // // if (page.loadStatus !== this.pageLoadStatus.LOADED) {
172
+
173
+ // // } else {
174
+ // // if (this.changetoolbar) {
175
+ // // this.$nextTick(() => {
176
+ // // this.renderHighlights()
177
+ // // })
178
+ // // this.changetoolbar = false
179
+ // // }
180
+ // // }
181
+ // }
182
+ const page = this.pages[loadPage - 1]
183
+ await pdfDoc.getPage(1).then(async (pdfPage) => {
184
+ this.pages[loadPage - 1].loadStatus = true
185
+ this.pages[loadPage - 1].pdfPage = pdfPage;
186
+ // 通知可以进行渲染了
187
+ await this.startRenderPages(pdfPage, page, loadPage)
188
+ });
189
189
  });
190
190
  },
191
191
  initPages (totalPage) {
@@ -194,7 +194,7 @@ export default {
194
194
  for (let i = 0; i < totalPage; i += 1) {
195
195
  this.pages.push({
196
196
  pageNo: i + 1,
197
- loadStatus: this.pageLoadStatus.WAIT,
197
+ loadStatus: false,
198
198
  pdfPage: null,
199
199
  dom: null
200
200
  });
@@ -211,14 +211,14 @@ export default {
211
211
  "Content-Type": "application/json",
212
212
  },
213
213
  }).then(async res => {
214
- if(res.bodyText) {
215
- // 最后返回一个 包含这4个参数的对象
214
+ if (res.bodyText) {
215
+ // 最后返回一个 包含这4个参数的对象
216
216
  obj = await {
217
217
  "startPage": pageIndex, // 分片的开始页码
218
218
  "endPage": pageIndex + 5, // 分片结束页码
219
219
  "totalPage": this.totalPageCount, // pdf 总页数
220
220
  "url": res.bodyText // 分片内容下载地址
221
- }
221
+ }
222
222
  }
223
223
  if (res.data) {
224
224
  // 最后返回一个 包含这4个参数的对象
@@ -233,7 +233,7 @@ export default {
233
233
  return obj
234
234
  },
235
235
  startRenderPages (pdfPage, page, pageIndex) {
236
- if(Object.keys(this.pageSize).length == 0) {
236
+ if (Object.keys(this.pageSize).length == 0) {
237
237
  const viewport = pdfPage.getViewport({
238
238
  scale: this.scale, // 缩放的比例
239
239
  rotation: this.rotation, // 旋转的角度
@@ -245,13 +245,13 @@ export default {
245
245
  }
246
246
  this.pageSize = pageSize
247
247
  // 创建内容绘制区,并设置大小
248
- if(this.$refs.pdfView.clientWidth / this.pageSize.width >= 1 || this.isMessageRecord) {
249
- this.contentView.style.width = `${pageSize.width - 10 }px`;
250
- this.contentView.style.height = `${(this.totalPageCount * (pageSize.height + this.PAGE_INTVERVAL)) + this.PAGE_INTVERVAL}px`;
248
+ if (this.$refs.pdfView.clientWidth / this.pageSize.width >= 1 || this.isMessageRecord) {
249
+ this.contentView.style.width = `${pageSize.width - 10}px`;
250
+ this.contentView.style.height = `${(this.totalPageCount * (pageSize.height + this.PAGE_INTVERVAL)) + this.PAGE_INTVERVAL}px`;
251
251
  } else {
252
- this.transformSalce = this.$refs.pdfView.clientWidth / this.pageSize.width
252
+ this.transformSalce = this.$refs.pdfView.clientWidth / this.pageSize.width
253
253
  this.contentView.style.width = `${pageSize.width * this.transformSalce - 10}px`;
254
- this.contentView.style.height = `${(this.totalPageCount * (pageSize.height * (this.transformSalce) + this.PAGE_INTVERVAL)) + this.PAGE_INTVERVAL}px`;
254
+ this.contentView.style.height = `${(this.totalPageCount * (pageSize.height * (this.transformSalce) + this.PAGE_INTVERVAL)) + this.PAGE_INTVERVAL}px`;
255
255
  }
256
256
  this.contentView.style.margin = '0 auto 0'
257
257
  this.contentView.style.position = 'relative'
@@ -261,12 +261,29 @@ export default {
261
261
  }
262
262
  this.renderPages(pageIndex)
263
263
  },
264
- renderPageContent (page, pageIndex) {
264
+ // 渲染需要展示的页面,不需展示的页码将其清除
265
+ renderPages (pageIndex) {
266
+ const pagesToRender = this.getRenderScope(pageIndex);
267
+ for (const i of this.pages) {
268
+ if (pagesToRender.some(p => { return p.pageNo == i.pageNo })) {
269
+ if (i.loadStatus === true) {
270
+ this.renderPageContent(i, i.pageNo)
271
+ } else {
272
+ this.renderPageLoading(i, i.pageNo)
273
+ }
274
+ } else {
275
+ this.clearPage(i);
276
+ }
277
+ }
278
+
279
+ },
280
+ async renderPageContent (page, pageIndex) {
265
281
  const { pdfPage, pageNo, dom } = page;
266
282
  // dom 元素已存在,无须重新渲染,直接返回
267
- if (dom && dom.children.length != 0) {
283
+ if ((dom && dom.children.length != 0) || page.loading) {
268
284
  return;
269
285
  }
286
+ page.loading = true
270
287
  const viewport = pdfPage.getViewport({
271
288
  scale: this.scale,
272
289
  rotation: this.rotation,
@@ -277,22 +294,24 @@ export default {
277
294
  // canvas.getContext('2d');
278
295
  canvas.height = this.pageSize.height;
279
296
  canvas.width = this.pageSize.width;
297
+ canvas.style.position = 'relative'
298
+ canvas.style.top = -3 + 'px'
280
299
  // 创建渲染的dom
281
300
  const pageDom = document.createElement('div');
282
301
  pageDom.style.position = 'absolute';
283
302
  pageDom.style.top = `${((pageNo - 1) * (this.pageSize.height + this.PAGE_INTVERVAL)) + this.PAGE_INTVERVAL}px`;
284
303
  pageDom.style.width = `${this.pageSize.width}px`;
285
304
  pageDom.style.height = `${this.pageSize.height}px`;
305
+ pageDom.setAttribute('data-id', 'page' + pageNo)
286
306
  pageDom.appendChild(canvas);
287
307
  // 渲染内容
288
308
  let renderContext = {
289
309
  canvasContext: context,
290
310
  viewport: viewport,
291
311
  }
292
- pdfPage.render(renderContext).promise.then(() => {
293
- console.log(pdfPage.getTextContent(), 'getTextContent');
312
+ await pdfPage.render(renderContext).promise.then(() => {
294
313
  return pdfPage.getTextContent()
295
- }).then((textContent) => {
314
+ }).then(async (textContent) => {
296
315
  const textLayerDiv = document.createElement('div');
297
316
  textLayerDiv.setAttribute('class', 'textLayer');
298
317
  // 将文本图层div添加至每页pdf的div中
@@ -307,7 +326,6 @@ export default {
307
326
  if (findPage) {
308
327
  let AllLines = findPage.allLines
309
328
  // setTimeout(() => {
310
- console.log(findPage,'findPage');
311
329
  if (AllLines.length > 0) {
312
330
  for (let j = 0; j < AllLines.length; j++) {
313
331
  let lines = AllLines[j].lines
@@ -324,22 +342,21 @@ export default {
324
342
  div.style.position = 'absolute';
325
343
  div.style.left = postionArr[0] * this.scale + 'px',
326
344
  // 后端返回的坐标有基线对齐的问题,top 值是后端算好(基线top - 文字高度),在此加上文字高度的 1/9 (大致比例)为实际展示出文字的top值
327
- div.style.top = (postionArr[1] + postionArr[3] / 9) * this.scale + 'px'
345
+ div.style.top = postionArr[1] * this.scale + 'px'
328
346
  div.style.height = postionArr[3] * this.scale + 'px';
329
347
  div.style.width = postionArr[2] * this.scale + 'px'
330
348
  div.style.backgroundColor = 'rgba(54, 106, 255, 0.3)'
331
349
  div.classList.add('lineHeight')
332
350
  rectdom.appendChild(div)
333
- if(index == 0 && j == 0) {
334
- if(this.transformSalce !== null) {
335
- rectdomTop = (postionArr[1] + postionArr[3] / 9) * this.scale * this.transformSalce
351
+ if (index == 0 && j == 0) {
352
+ if (this.transformSalce !== null) {
353
+ rectdomTop = postionArr[1] * this.scale * this.transformSalce
336
354
  } else {
337
- rectdomTop = (postionArr[1] + postionArr[3] / 9) * this.scale
355
+ rectdomTop = postionArr[1] * this.scale
338
356
  }
339
357
  // if(this.isPC) {
340
358
  // rectdomTop = rectdomTop - 50 < 0 ? 0 : rectdomTop - 50
341
359
  // }
342
- // console.log(rectdomTop,div.style.top, (postionArr[1] + postionArr[3] / 9) * this.scale);
343
360
  }
344
361
  }
345
362
  }
@@ -351,11 +368,16 @@ export default {
351
368
  }
352
369
  textLayer.setTextContent(textContent);
353
370
  textLayer.render()
354
- pageDom.appendChild(textLayer.textLayerDiv);
355
- page.dom = pageDom;
371
+ pageDom.appendChild(textLayerDiv);
372
+
373
+ let backgroundDom = document.getElementById('backgroundLoad' + pageNo)
374
+ if (backgroundDom) {
375
+ this.contentView.removeChild(backgroundDom);
376
+ }
377
+ page.dom = await pageDom;
356
378
  page.loading = false
357
379
  this.contentView.appendChild(pageDom);
358
- if(this.transformSalce !== null) {
380
+ if (this.transformSalce !== null) {
359
381
  this.contentView.style.transform = `scale(${this.transformSalce}, ${this.transformSalce})`
360
382
  }
361
383
  if (this.changetoolbar) {
@@ -364,37 +386,34 @@ export default {
364
386
  this.changetoolbar = false
365
387
  }, 500)
366
388
  }
367
- // console.log(this.fisrtLoad,'this.fisrtLoad');
368
389
  if (this.fisrtLoad) {
369
390
  setTimeout(() => {
370
391
  let pageoffsetHeight = 0
371
- if(this.transformSalce !== null) {
392
+ if (this.transformSalce !== null) {
372
393
  pageoffsetHeight = (this.pageSize.height + this.PAGE_INTVERVAL) * this.transformSalce
373
394
  } else {
374
395
  pageoffsetHeight = (this.pageSize.height + this.PAGE_INTVERVAL)
375
396
  }
376
397
  if (this.$refs.pdfView.clientHeight - pageoffsetHeight > 0 && pageIndex == 1) {
377
398
  const height = this.$refs.pdfView.clientHeight;
378
- let startNum = 0
399
+ let startNum = 0
379
400
  let endNum = 0
380
- if(this.transformSalce !== null) {
401
+ if (this.transformSalce !== null) {
381
402
  startNum = Math.ceil(this.$refs.pdfView.scrollTop / ((this.pageSize.height + this.PAGE_INTVERVAL) * this.transformSalce))
382
- endNum = startNum + Math.ceil(height / ((this.pageSize.height + this.PAGE_INTVERVAL) * this.transformSalce))
383
- console.log( Math.ceil(height / ((this.pageSize.height + this.PAGE_INTVERVAL) * this.transformSalce)),this.pageSize.height , this.PAGE_INTVERVAL, height, this.transformSalce,'startNum');
384
-
403
+ endNum = startNum + Math.ceil(height / ((this.pageSize.height + this.PAGE_INTVERVAL) * this.transformSalce))
385
404
  } else {
386
405
  startNum = Math.ceil(this.$refs.pdfView.scrollTop / (this.pageSize.height + this.PAGE_INTVERVAL))
387
- endNum = startNum + Math.ceil(height / (this.pageSize.height + this.PAGE_INTVERVAL))
388
-
406
+ endNum = startNum + Math.ceil(height / (this.pageSize.height + this.PAGE_INTVERVAL))
407
+
389
408
  }
390
409
  for (let pageIndex = startNum; pageIndex <= endNum; pageIndex++) {
391
- if(pageIndex > 0 && pageIndex <= this.pages.length) {
410
+ if (pageIndex > 0 && pageIndex <= this.pages.length) {
392
411
  this.loadPdfData(pageIndex)
393
412
  }
394
413
  }
395
414
  }
396
415
  if (this.$refs.pdfView.scrollTop == Math.floor((pageNo - 1) * pageoffsetHeight)) {
397
- this.$refs.pdfView.scrollTop = rectdomTop
416
+ this.$refs.pdfView.scrollTop = rectdomTop
398
417
  this.fisrtLoad = false
399
418
  } else {
400
419
  this.$refs.pdfView.scrollTop = `${((pageNo - 1) * pageoffsetHeight) + rectdomTop - this.PAGE_INTVERVAL}`
@@ -415,21 +434,20 @@ export default {
415
434
  }
416
435
  const scrollTop = e.target.scrollTop;
417
436
  const height = e.target.clientHeight;
418
- let startNum = 0
437
+ let startNum = 0
419
438
  let endNum = 0
420
- if(this.transformSalce !== null) {
439
+ if (this.transformSalce !== null) {
421
440
  startNum = Math.ceil(scrollTop / ((that.pageSize.height + that.PAGE_INTVERVAL) * this.transformSalce))
422
- endNum = startNum + Math.ceil(height / ((that.pageSize.height + that.PAGE_INTVERVAL) * this.transformSalce))
441
+ endNum = startNum + Math.ceil(height / ((that.pageSize.height + that.PAGE_INTVERVAL) * this.transformSalce))
423
442
  } else {
424
443
  startNum = Math.ceil(scrollTop / (that.pageSize.height + that.PAGE_INTVERVAL))
425
- endNum = startNum + Math.ceil(height / (that.pageSize.height + that.PAGE_INTVERVAL))
444
+ endNum = startNum + Math.ceil(height / (that.pageSize.height + that.PAGE_INTVERVAL))
426
445
  }
427
- for (let pageIndex = startNum; pageIndex <= endNum; pageIndex++) {
428
- if(pageIndex > 0 && pageIndex <= that.pages.length) {
446
+ for (let pageIndex = startNum; pageIndex < endNum; pageIndex++) {
447
+ if (pageIndex > 0 && pageIndex < that.pages.length) {
429
448
  that.loadPdfData(pageIndex)
430
449
  }
431
450
  }
432
- console.log('=======');
433
451
  }, 200),
434
452
  directScrolling (e, that) {
435
453
  if (this.fisrtLoad) {
@@ -445,13 +463,13 @@ export default {
445
463
  this.loadPdfData(pageIndex)
446
464
  },
447
465
  pdfScroll (e) {
448
- if(this.preViewType !== 'pdf' || this.isTouchMoved) {
466
+ if (this.preViewType !== 'pdf' || this.isTouchMoved) {
449
467
  return
450
468
  }
451
- if(this.scrollLeft != e.target.scrollLeft) {
469
+ if (this.scrollLeft != e.target.scrollLeft) {
452
470
  this.scrollLeft = e.target.scrollLeft
453
471
  }
454
- if(this.scrollTop != e.target.scrollTop) {
472
+ if (this.scrollTop != e.target.scrollTop) {
455
473
  this.scrollTop = e.target.scrollTop
456
474
  this.debounceScrollPdf(e, this)
457
475
  }
@@ -484,26 +502,18 @@ export default {
484
502
  j += 1;
485
503
  }
486
504
  }
505
+ // for (let index = 0; index < array.length; index++) {
506
+ // const element = array[index];
507
+
508
+ // }
487
509
  return pagesToRender;
488
510
  },
489
- // 渲染需要展示的页面,不需展示的页码将其清除
490
- renderPages (pageIndex) {
491
- const pagesToRender = this.getRenderScope(pageIndex);
492
- for (const i of this.pages) {
493
- if (pagesToRender.includes(i)) {
494
- i.loadStatus === this.pageLoadStatus.LOADED ?
495
- this.renderPageContent(i, pageIndex) :
496
- this.renderPageLoading(i);
497
- } else {
498
- this.clearPage(i);
499
- }
500
- }
501
- },
511
+
502
512
  // 清除页面 dom
503
513
  clearPage (page) {
504
- if (page.dom) {
514
+ if (this.contentView.contains(page.dom) && page.dom) {
505
515
  this.contentView.removeChild(page.dom);
506
- page.loadStatus = 0
516
+ page.loadStatus = false
507
517
  page.loading = false
508
518
  page.dom = undefined;
509
519
  }
@@ -514,6 +524,10 @@ export default {
514
524
  if (dom && dom.children.length != 0) {
515
525
  return;
516
526
  }
527
+ let backgroundDom = document.getElementById('backgroundLoad' + pageNo)
528
+ if (this.contentView.contains(backgroundDom)) {
529
+ return
530
+ }
517
531
  const pageDom = document.createElement('div');
518
532
  pageDom.style.width = `${this.pageSize.width}px`;
519
533
  pageDom.style.height = `${this.pageSize.height}px`;
@@ -524,6 +538,7 @@ export default {
524
538
  pageDom.style.backgroundPosition = 'center'
525
539
  pageDom.style.backgroundRepeat = 'no-repeat'
526
540
  pageDom.style.backgroundColor = '#FFF'
541
+ pageDom.setAttribute('id', 'backgroundLoad' + pageNo)
527
542
  page.dom = pageDom;
528
543
  this.contentView.appendChild(pageDom);
529
544
  },
@@ -531,15 +546,15 @@ export default {
531
546
  this.currentPage--
532
547
  if (this.currentPage < 0) {
533
548
  this.currentPage = 0
534
- if(!this.isPC) {
549
+ if (!this.isPC) {
535
550
  this.$toast({
536
- message:'当前已经是第一段了',
537
- duration:2000,
551
+ message: '当前已经是第一段了',
552
+ duration: 2000,
538
553
  })
539
554
  return
540
555
  }
541
556
  }
542
- if(this.preViewType == 'pdf') {
557
+ if (this.preViewType == 'pdf') {
543
558
  this.scrollToUplaodePage(this.currentPage)
544
559
  } else {
545
560
  this.scrollToExcalTop(this.currentPage)
@@ -550,15 +565,15 @@ export default {
550
565
  this.currentPage++
551
566
  if (this.currentPage >= this.tagIds.length) {
552
567
  this.currentPage = this.tagIds.length - 1
553
- if(!this.isPC) {
568
+ if (!this.isPC) {
554
569
  this.$toast({
555
- message:'当前已经是最后一段了',
556
- duration:2000,
570
+ message: '当前已经是最后一段了',
571
+ duration: 2000,
557
572
  })
558
573
  return
559
574
  }
560
575
  }
561
- if(this.preViewType == 'pdf') {
576
+ if (this.preViewType == 'pdf') {
562
577
  this.scrollToUplaodePage(this.currentPage)
563
578
  } else {
564
579
  this.scrollToExcalTop(this.currentPage)
@@ -566,7 +581,7 @@ export default {
566
581
  },
567
582
  currentChange (value) {
568
583
  this.currentPage = value - 1
569
- if(this.preViewType == 'pdf') {
584
+ if (this.preViewType == 'pdf') {
570
585
  this.scrollToUplaodePage(this.currentPage)
571
586
  } else {
572
587
  this.scrollToExcalTop(this.currentPage)
@@ -574,10 +589,10 @@ export default {
574
589
  },
575
590
  scrollToUplaodePage (currentPage) {
576
591
  this.changetoolbar = true
577
- if(this.preViewType !== 'pdf') {
592
+ if (this.preViewType !== 'pdf') {
578
593
  return
579
594
  }
580
-
595
+
581
596
  let pdfResloute = this.cachePdf[currentPage]
582
597
  this.identifyTextPostion.extractInfo = pdfResloute.extractInfo
583
598
  this.identifyTextPostion.left = pdfResloute.extractInfo.location[0]
@@ -591,32 +606,32 @@ export default {
591
606
  this.$nextTick(() => {
592
607
  this.renderHighlights()
593
608
  })
594
- if(this.transformSalce !== null) {
609
+ if (this.transformSalce !== null) {
595
610
  this.$refs.pdfView.scrollTop = `${((pdfResloute.page - 1) * (this.pageSize.height + this.PAGE_INTVERVAL) * this.transformSalce) + (this.identifyTextPostion.top * this.scale * this.transformSalce)}`
596
611
  } else {
597
612
  this.$refs.pdfView.scrollTop = `${((pdfResloute.page - 1) * (this.pageSize.height + this.PAGE_INTVERVAL)) + (this.identifyTextPostion.top * this.scale * this.transformSalce)}`
598
613
  }
599
614
  },
600
- scrollToExcalTop(currentPage) {
615
+ scrollToExcalTop (currentPage) {
601
616
  for (let index = 0; index < this.allTr.length; index++) {
602
- if(index == currentPage) {
603
- Array.from(this.allTr[index].children).forEach(item =>{
617
+ if (index == currentPage) {
618
+ Array.from(this.allTr[index].children).forEach(item => {
604
619
  item.style.background = 'rgba(255, 136, 0, 0.6)'
605
620
  item.classList.add('animation')
606
- setTimeout(() =>{
621
+ setTimeout(() => {
607
622
  item.classList.remove('animation')
608
623
  }, 4000)
609
624
  })
610
625
  // getBoundingClientRect().top 当前元素距离屏幕顶部的高度 + 弹窗header 高度
611
- if(!this.isPC) {
612
- let top = this.allTr[index].getBoundingClientRect().top - this.$refs.pdfView.getBoundingClientRect().top
626
+ if (!this.isPC) {
627
+ let top = this.allTr[index].getBoundingClientRect().top - this.$refs.pdfView.getBoundingClientRect().top
613
628
  this.$refs.pdfView.scrollTop = top
614
629
  } else {
615
630
  let top = this.allTr[index].getBoundingClientRect().top
616
631
  this.$refs.pdfView.scrollTop = top - 50
617
632
  }
618
633
  } else {
619
- Array.from(this.allTr[index].children).forEach(item =>{
634
+ Array.from(this.allTr[index].children).forEach(item => {
620
635
  item.style.background = 'rgba(54, 106, 255, 0.6)'
621
636
  item.classList.remove('animation')
622
637
  })
@@ -626,14 +641,13 @@ export default {
626
641
  // pdf是否需要重新渲染高亮位置
627
642
  renderHighlights () {
628
643
  let lineHeightDom = Array.from(document.getElementsByClassName('rectdom'))
629
- console.log(lineHeightDom, this.currentPage, 'this.currentPage');
630
644
  if (lineHeightDom) {
631
645
  lineHeightDom.forEach((d) => {
632
646
  for (let i = 0; i < d.children.length; i++) {
633
647
  if (d.getAttribute('react-count') == this.currentPage) {
634
648
  d.children[i].style.backgroundColor = 'rgba(255, 136, 0, 0.3)'
635
649
  d.children[i].classList.add('animation')
636
- setTimeout(() =>{
650
+ setTimeout(() => {
637
651
  d.children[i].classList.remove('animation')
638
652
  }, 4000)
639
653
  } else {
@@ -686,7 +700,7 @@ export default {
686
700
  }
687
701
  })
688
702
  },
689
- openTouch() {
703
+ openTouch () {
690
704
  // this.$nextTick()将回调延迟到下次 DOM 更新循环之后执行
691
705
  let that = this;
692
706
  this.$nextTick(() => {
@@ -728,7 +742,6 @@ export default {
728
742
  }
729
743
 
730
744
  that.displacement.originScale = this.scale || 1;
731
- // console.log(that.displacement);
732
745
  });
733
746
  document.addEventListener("touchmove", function (event) {
734
747
  if (!that.displacement.moveable) {
@@ -749,32 +762,31 @@ export default {
749
762
  }
750
763
  // 双指缩放比例计算
751
764
  let zoom = that.getDistance({
752
- x: events.pageX,
753
- y: events.pageY
765
+ x: events.pageX,
766
+ y: events.pageY
767
+ },
768
+ {
769
+ x: events2.pageX,
770
+ y: events2.pageY
771
+ }
772
+ ) / that.getDistance(
773
+ {
774
+ x: that.displacement.pageX,
775
+ y: that.displacement.pageY
754
776
  },
755
- {
756
- x: events2.pageX,
757
- y: events2.pageY
758
- }
759
- ) / that.getDistance(
760
- {
761
- x: that.displacement.pageX,
762
- y: that.displacement.pageY
763
- },
764
- {
765
- x: that.displacement.pageX2,
766
- y: that.displacement.pageY2
767
- }
768
- );
777
+ {
778
+ x: that.displacement.pageX2,
779
+ y: that.displacement.pageY2
780
+ }
781
+ );
769
782
  // 应用在元素上的缩放比例
770
783
  let newScale = that.displacement.originScale * zoom;
771
- console.log(zoom, newScale , this.scale, 'newScale');
772
784
  // 最大缩放比例限制
773
785
  if (newScale > 2) {
774
786
  newScale = 2;
775
787
  }
776
788
  // 最大缩放比例限制
777
- if(newScale < 1) {
789
+ if (newScale < 1) {
778
790
  newScale = 1;
779
791
  }
780
792
  // 记住使用的缩放值
@@ -784,39 +796,38 @@ export default {
784
796
  // 设置旋转元素的基点位置
785
797
  matrix_box.style.transformOrigin = "0px 0px 0px";
786
798
  }
787
- },{ passive: false });
788
- document.addEventListener('touchend',function() {
799
+ }, { passive: false });
800
+ document.addEventListener('touchend', function () {
789
801
  that.isTouchMoved = false
790
- },{ passive: false })
802
+ }, { passive: false })
791
803
  });
792
804
  },
793
- getDistance(start, stop) {
805
+ getDistance (start, stop) {
794
806
  // Math.hypot()计算参数的平方根
795
807
  return Math.hypot(stop.x - start.x, stop.y - start.y);
796
808
  },
797
- setupCanvas(canvas, width, height) {
798
- const dpr = 1;
809
+ setupCanvas (canvas, width, height) {
810
+ const dpr = 1;
799
811
  // const rect = canvas.getBoundingClientRect();
800
- canvas.width = width
801
- canvas.height = height
812
+ canvas.width = width
813
+ canvas.height = height
802
814
  const ctx = canvas.getContext('2d');
803
- console.log(canvas.width, canvas.height, dpr, this.scale);
804
- ctx?.scale(dpr, dpr );
815
+ ctx?.scale(dpr, dpr);
805
816
  return ctx;
806
817
  },
807
- changeScale(value) {
808
- if(value == 'zoom') {
818
+ changeScale (value) {
819
+ if (value == 'zoom') {
809
820
  this.handScale = 'auto'
810
821
  this.transformSalce = (this.transformSalce + 0.2).toFixed(1)
811
- } else if(value == 'reduce') {
812
- if((this.transformSalce - 0.2).toFixed(1) <= 0) {
822
+ } else if (value == 'reduce') {
823
+ if ((this.transformSalce - 0.2).toFixed(1) <= 0) {
813
824
  return
814
825
  }
815
826
  this.handScale = 'auto'
816
827
  this.transformSalce = (this.transformSalce - 0.2).toFixed(1)
817
- } else if(value == 'auto') {
828
+ } else if (value == 'auto') {
818
829
  this.transformSalce = this.$refs.pdfView.clientWidth / this.pageSize.width
819
- } else if(value == 'reality') {
830
+ } else if (value == 'reality') {
820
831
  this.transformSalce = 0.5
821
832
  } else {
822
833
  this.transformSalce = (value / 2).toFixed(1)
@@ -826,19 +837,19 @@ export default {
826
837
  // this.getpdfResloutePage(this.cachePdf[0])
827
838
  },
828
839
  },
829
- computed:{
830
- perviewUrl() {
840
+ computed: {
841
+ perviewUrl () {
831
842
  return '/web/viewer.html?file=' + '/pdflist/pdf4split-1.pdf'
832
843
  },
833
- setHeight() {
834
- if(this.tagIds.length > 1 ) {
835
- if(this.isPC) {
844
+ setHeight () {
845
+ if (this.tagIds.length > 1) {
846
+ if (this.isPC) {
836
847
  return 'calc(100% - 110px)'
837
848
  } else {
838
849
  return 'calc(100% - 60px)'
839
850
  }
840
851
  } else {
841
- if(this.isPC) {
852
+ if (this.isPC) {
842
853
  return 'calc(100% - 50px)'
843
854
  } else {
844
855
  return '100%'
@@ -846,14 +857,14 @@ export default {
846
857
  }
847
858
  }
848
859
  },
849
- watch:{
860
+ watch: {
850
861
  tagIds: {
851
- handler(value) {
852
- if(value && value.length) {
862
+ handler (value) {
863
+ if (value && value.length) {
853
864
  // 在 pdf_view 下创建 所有canvs的容器
854
865
  this.contentView = document.createElement('div')
855
866
  this.contentView.style.transformOrigin = '0px 0px 0px'
856
- this.$http.get('/knowledge-api/knowledge/knowledge-part-location-info/list?ids=' + value.join(',')).then(res =>{
867
+ this.$http.get('/knowledge-api/knowledge/knowledge-part-location-info/list?ids=' + value.join(',')).then(res => {
857
868
  // res.data = {"data":[{"id":"64591b7d8bb8ab1b91c65f24","knowledgeId":"64591a9c8da27649473f3b4b","mainId":"fb348d095c0b4fd7bbd37826563dac7d","page":3,"total":18,"pageHeight":540.0,"pageWidth":960.00946,"publicPageFileUrl":"https://askbot-pdf-all.oss-cn-zhangjiakou.aliyuncs.com/fb348d095c0b4fd7bbd37826563dac7d/2023/05/08/11/55/18/64591b638bb8ab1b91c65eed/3.pdf","extractInfo":{"location":[280.488,161.32,398.71573,61.99298],"content":"黄花城水长城旅游区位于北京市怀柔区九渡河镇境内,距北京市区65公里,是以奇而著称,融山川、碧水、古长城为一体的旅游休闲胜地。而这里的“三绝景”更是引人入","lines":[{"content":"黄花城水长城旅游区位于北京市怀柔区九渡河镇境内,距","location":[280.488,161.32,398.71573,15.9869995]},{"content":"北京市区65公里,是以奇而著称,融山川、碧水、古长","location":[283.691,184.30899,392.3055,15.9869995]},{"content":"城为一体的旅游休闲胜地。而这里的“三绝景”更是引人入","location":[282.699,207.32599,394.3033,15.9869995]}],"tagId":null}}],"code":"0","msg":null,"traceId":null}
858
869
  // res.data = {"data":[{"id":"64590ce1eb1320043401cc90","knowledgeId":"64590cd5017b461d67e282e1","mainId":"fb348d095c0b4fd7bbd37826563dac7d","page":2,"total":5,"pageHeight":841.8898,"pageWidth":595.30396,"publicPageFileUrl":"https://askbot-pdf-all.oss-cn-zhangjiakou.aliyuncs.com/fb348d095c0b4fd7bbd37826563dac7d/2023/05/08/10/53/20/64590ce0eb1320043401cc7b/2.pdf","extractInfo":{"location":[89.32981,638.1907,415.15512,98.63251],"content":":北京地铁 13\r号线 :藤黄\r色 :西直门站—\r东直门站 :17 :41.\r5 :6\r准\rB :2002年\r09月\r28日 ","lines":[{"content":":北京地铁 13\r号线 ","location":[89.32981,638.1907,99.44599,98.63251]},{"content":":藤黄\r色 ","location":[188.7758,638.1907,46.79959,98.63251]},{"content":":西直门站—\r东直门站 ","location":[235.5754,638.1907,86.09996,98.63251]},{"content":":17 ","location":[321.67535,638.1907,36.200012,98.63251]},{"content":":41.\r5 ","location":[357.87537,638.1907,39.400696,98.63251]},{"content":":6\r准\rB ","location":[397.27606,638.1907,41.099,98.63251]},{"content":":2002年\r09月\r28日 ","location":[438.37506,638.1907,66.10986,98.63251]}],"tagId":null}}],"code":"0","msg":null,"traceId":null}
859
870
  // res.data = {"data":[{"id":"64591b7d8bb8ab1b91c65f24","knowledgeId":"64591a9c8da27649473f3b4b","mainId":"fb348d095c0b4fd7bbd37826563dac7d","page":3,"total":18,"pageHeight":540.0,"pageWidth":960.00946,"publicPageFileUrl":"https://askbot-pdf-all.oss-cn-zhangjiakou.aliyuncs.com/fb348d095c0b4fd7bbd37826563dac7d/2023/05/08/11/55/18/64591b638bb8ab1b91c65eed/3.pdf","extractInfo":{"location":[280.488,161.32,398.71573,61.99298],"content":"黄花城水长城旅游区位于北京市怀柔区九渡河镇境内,距北京市区65公里,是以奇而著称,融山川、碧水、古长城为一体的旅游休闲胜地。而这里的“三绝景”更是引人入","lines":[{"content":"黄花城水长城旅游区位于北京市怀柔区九渡河镇境内,距","location":[280.488,161.32,398.71573,15.9869995]},{"content":"北京市区65公里,是以奇而著称,融山川、碧水、古长","location":[283.691,184.30899,392.3055,15.9869995]},{"content":"城为一体的旅游休闲胜地。而这里的“三绝景”更是引人入","location":[282.699,207.32599,394.3033,15.9869995]}],"tagId":null}}],"code":"0","msg":null,"traceId":null}
@@ -865,183 +876,30 @@ export default {
865
876
  // res.data = {
866
877
  // "data": [
867
878
  // {
868
- // "id": "6501ae851169c35ace9739f7",
869
- // "knowledgeId": "6501ae444f324a70bf677cce",
870
- // "mainId": "b3cec709ed904d56b29cb95362dc181f",
871
- // "page": 5,
872
- // "total": 118,
873
- // "pageHeight": 540.0,
874
- // "pageWidth": 960.00946,
875
- // "publicPageFileUrl": "https://askbot-pdf-all.oss-cn-zhangjiakou.aliyuncs.com/b3cec709ed904d56b29cb95362dc181f/2023/09/13/08/43/12/6501ae451169c35ace9739b7/5.pdf",
879
+ // "id": "64e746120372d778849d2e8e",
880
+ // "knowledgeId": "64e30035edffac0ec96a2d39",
881
+ // "mainId": "e0f6898c6b0d47fa98e8f71ceab1bde8",
882
+ // "page": 14,
883
+ // "total": 60,
884
+ // "pageHeight": 728.504,
885
+ // "pageWidth": 515.906,
886
+ // "publicPageFileUrl": "https://askbot-pdf-all.oss-cn-zhangjiakou.aliyuncs.com/e0f6898c6b0d47fa98e8f71ceab1bde8/2023/08/21/02/12/07/64e300378c3dfb3bc434f51a/15.pdf",
876
887
  // "extractInfo": {
877
888
  // "location": [
878
- // 42.208,
879
- // 297.014,
880
- // 723.56104,
881
- // 41.18799
889
+ // 52.665375,
890
+ // 312.01306,
891
+ // 404.98618,
892
+ // 142.5199
882
893
  // ],
883
- // "content": "体验整体提升,推出全渠道、智能化知识管理平台,面向员工智能服务,业务自动化,知识智能搜索与问答场景。成为飞书ISVAI交互专利发布国家高新技术企业北京市科技型中小企业认证北京市创新型中小企业认证AAA企业信用评价认证优衣库",
894
+ // "content": null,
884
895
  // "lines": [
885
896
  // {
886
- // "content": "体验整体提升,推出全",
887
- // "location": [
888
- // 42.208,
889
- // 297.014,
890
- // 119.874016,
891
- // 11.990997
892
- // ]
893
- // },
894
- // {
895
- // "content": "渠道、智能化知识管理",
896
- // "location": [
897
- // 42.208,
898
- // 314.50302,
899
- // 119.874016,
900
- // 11.990997
901
- // ]
902
- // },
903
- // {
904
- // "content": "平台,面向员工智能服",
905
- // "location": [
906
- // 42.208,
907
- // 332.022,
908
- // 119.874016,
909
- // 11.990997
910
- // ]
911
- // },
912
- // {
913
- // "content": "务,业务自动化,知识",
914
- // "location": [
915
- // 42.208,
916
- // 349.398,
917
- // 119.874016,
918
- // 11.990997
919
- // ]
920
- // },
921
- // {
922
- // "content": "智能搜索与问答场景。",
923
- // "location": [
924
- // 42.208,
925
- // 366.916,
926
- // 119.874016,
927
- // 11.990997
928
- // ]
929
- // },
930
- // {
931
- // "content": "成为飞书",
932
- // "location": [
933
- // 362.409,
934
- // 270.311,
935
- // 47.951996,
936
- // 11.990997
937
- // ]
938
- // },
939
- // {
940
- // "content": "ISV",
941
- // "location": [
942
- // 362.409,
943
- // 284.711,
944
- // 18.47815,
945
- // 11.990997
946
- // ]
947
- // },
948
- // {
949
- // "content": "AI交互专利发",
950
- // "location": [
951
- // 362.409,
952
- // 300.018,
953
- // 74.64407,
954
- // 11.990997
955
- // ]
956
- // },
957
- // {
958
- // "content": "布",
959
- // "location": [
960
- // 362.409,
961
- // 314.418,
962
- // 11.990997,
963
- // 11.990997
964
- // ]
965
- // },
966
- // {
967
- // "content": "国家高新技术企",
968
- // "location": [
969
- // 363.713,
970
- // 330.009,
971
- // 83.93698,
972
- // 11.990997
973
- // ]
974
- // },
975
- // {
976
- // "content": "业",
897
+ // "content": null,
977
898
  // "location": [
978
- // 363.713,
979
- // 344.409,
980
- // 11.990997,
981
- // 11.990997
982
- // ]
983
- // },
984
- // {
985
- // "content": "北京市科技型中小企业认",
986
- // "location": [
987
- // 363.798,
988
- // 359.915,
989
- // 131.90097,
990
- // 11.990997
991
- // ]
992
- // },
993
- // {
994
- // "content": "证",
995
- // "location": [
996
- // 363.798,
997
- // 374.315,
998
- // 11.990997,
999
- // 11.990997
1000
- // ]
1001
- // },
1002
- // {
1003
- // "content": "北京市创新型中小企业认",
1004
- // "location": [
1005
- // 363.798,
1006
- // 389.905,
1007
- // 131.90097,
1008
- // 11.990997
1009
- // ]
1010
- // },
1011
- // {
1012
- // "content": "证",
1013
- // "location": [
1014
- // 363.798,
1015
- // 404.22,
1016
- // 11.990997,
1017
- // 11.990997
1018
- // ]
1019
- // },
1020
- // {
1021
- // "content": "AAA企业信用评价认",
1022
- // "location": [
1023
- // 362.409,
1024
- // 419.811,
1025
- // 112.02899,
1026
- // 11.990997
1027
- // ]
1028
- // },
1029
- // {
1030
- // "content": "证",
1031
- // "location": [
1032
- // 362.409,
1033
- // 434.09702,
1034
- // 11.990997,
1035
- // 11.990997
1036
- // ]
1037
- // },
1038
- // {
1039
- // "content": "优衣库",
1040
- // "location": [
1041
- // 729.808,
1042
- // 326.211,
1043
- // 35.96106,
1044
- // 11.990997
899
+ // 52.665375,
900
+ // 312.01306,
901
+ // 404.98618,
902
+ // 142.5199
1045
903
  // ]
1046
904
  // }
1047
905
  // ],
@@ -1050,219 +908,113 @@ export default {
1050
908
  // "block": {
1051
909
  // "type": "TEXT",
1052
910
  // "location": [
1053
- // 42.208,
1054
- // 297.014,
1055
- // 723.56104,
1056
- // 41.18799
911
+ // 52.665375,
912
+ // 312.01306,
913
+ // 404.98618,
914
+ // 142.5199
1057
915
  // ],
1058
- // "color": null,
1059
- // "flowChart": null,
1060
- // "image": null,
1061
- // "table": null,
916
+ // "color": "#366AFF",
917
+ // "flowChart": {
918
+ // "content": ""
919
+ // },
920
+ // "image": {
921
+ // "url": null,
922
+ // "desc": ""
923
+ // },
924
+ // "table": {
925
+ // "title": null,
926
+ // "table": null
927
+ // },
1062
928
  // "text": {
1063
- // "originText": "体验整体提升,推出全渠道、智能化知识管理平台,面向员工智能服务,业务自动化,知识智能搜索与问答场景。成为飞书ISVAI交互专利发布国家高新技术企业北京市科技型中小企业认证北京市创新型中小企业认证AAA企业信用评价认证优衣库",
1064
- // "indexText": "体验整体提升,推出全渠道、智能化知识管理平台,面向员工智能服务,业务自动化,知识智能搜索与问答场景。成为飞书ISVAI交互专利发布国家高新技术企业北京市科技型中小企业认证北京市创新型中小企业认证AAA企业信用评价认证优衣库",
929
+ // "originText": "① 头部防护:安全帽\n佩戴要求:\n①存在坠物或对头部产生碰撞风险的作业场所需要佩戴安全帽 ;\n②安全帽必须戴正、戴牢、不能晃动,要系紧下颏带,调节好后箍以\n防安全帽脱落 ;\n③受强力撞击及超过有效期的安全帽必须更换。",
930
+ // "indexText": "① 头部防护:安全帽\n佩戴要求:\n①存在坠物或对头部产生碰撞风险的作业场所需要佩戴安全帽 ;\n②安全帽必须戴正、戴牢、不能晃动,要系紧下颏带,调节好后箍以\n防安全帽脱落 ;\n③受强力撞击及超过有效期的安全帽必须更换。",
1065
931
  // "lines": [
1066
932
  // {
1067
933
  // "location": [
1068
- // 42.208,
1069
- // 297.014,
1070
- // 119.874016,
1071
- // 11.990997
1072
- // ]
1073
- // },
1074
- // {
1075
- // "location": [
1076
- // 42.208,
1077
- // 314.50302,
1078
- // 119.874016,
1079
- // 11.990997
1080
- // ]
1081
- // },
1082
- // {
1083
- // "location": [
1084
- // 42.208,
1085
- // 332.022,
1086
- // 119.874016,
1087
- // 11.990997
1088
- // ]
1089
- // },
1090
- // {
1091
- // "location": [
1092
- // 42.208,
1093
- // 349.398,
1094
- // 119.874016,
1095
- // 11.990997
934
+ // 69.08148,
935
+ // 368.92072,
936
+ // 65.90851,
937
+ // 10.5
1096
938
  // ]
1097
939
  // },
1098
940
  // {
1099
941
  // "location": [
1100
- // 42.208,
1101
- // 366.916,
1102
- // 119.874016,
1103
- // 11.990997
942
+ // 86.290985,
943
+ // 384.67072,
944
+ // 31.5,
945
+ // 10.5
1104
946
  // ]
1105
947
  // },
1106
948
  // {
1107
949
  // "location": [
1108
- // 362.409,
1109
- // 270.311,
1110
- // 47.951996,
1111
- // 11.990997
950
+ // 286.2992,
951
+ // 315.73584,
952
+ // 37.656006,
953
+ // 12.0
1112
954
  // ]
1113
955
  // },
1114
956
  // {
1115
957
  // "location": [
1116
- // 362.409,
1117
- // 284.711,
1118
- // 18.47815,
1119
- // 11.990997
958
+ // 324.6939,
959
+ // 316.79932,
960
+ // 122.74487,
961
+ // 10.5
1120
962
  // ]
1121
963
  // },
1122
964
  // {
1123
965
  // "location": [
1124
- // 362.409,
1125
- // 300.018,
1126
- // 74.64407,
1127
- // 11.990997
966
+ // 286.2954,
967
+ // 336.0458,
968
+ // 149.625,
969
+ // 10.5
1128
970
  // ]
1129
971
  // },
1130
972
  // {
1131
973
  // "location": [
1132
- // 362.409,
1133
- // 314.418,
1134
- // 11.990997,
1135
- // 11.990997
974
+ // 286.2954,
975
+ // 356.0483,
976
+ // 161.15405,
977
+ // 10.5
1136
978
  // ]
1137
979
  // },
1138
980
  // {
1139
981
  // "location": [
1140
- // 363.713,
1141
- // 330.009,
1142
- // 83.93698,
1143
- // 11.990997
982
+ // 286.2954,
983
+ // 376.0508,
984
+ // 161.15405,
985
+ // 10.5
1144
986
  // ]
1145
987
  // },
1146
988
  // {
1147
989
  // "location": [
1148
- // 363.713,
1149
- // 344.409,
1150
- // 11.990997,
1151
- // 11.990997
990
+ // 286.2954,
991
+ // 396.0533,
992
+ // 76.125,
993
+ // 10.5
1152
994
  // ]
1153
995
  // },
1154
996
  // {
1155
997
  // "location": [
1156
- // 363.798,
1157
- // 359.915,
1158
- // 131.90097,
1159
- // 11.990997
998
+ // 286.2954,
999
+ // 416.05582,
1000
+ // 161.17517,
1001
+ // 10.5
1160
1002
  // ]
1161
1003
  // },
1162
1004
  // {
1163
1005
  // "location": [
1164
- // 363.798,
1165
- // 374.315,
1166
- // 11.990997,
1167
- // 11.990997
1006
+ // 286.2954,
1007
+ // 436.8038,
1008
+ // 52.5,
1009
+ // 10.5
1168
1010
  // ]
1169
1011
  // },
1170
1012
  // {
1171
1013
  // "location": [
1172
- // 363.798,
1173
- // 389.905,
1174
- // 131.90097,
1175
- // 11.990997
1176
- // ]
1177
- // },
1178
- // {
1179
- // "location": [
1180
- // 363.798,
1181
- // 404.22,
1182
- // 11.990997,
1183
- // 11.990997
1184
- // ]
1185
- // },
1186
- // {
1187
- // "location": [
1188
- // 362.409,
1189
- // 419.811,
1190
- // 112.02899,
1191
- // 11.990997
1192
- // ]
1193
- // },
1194
- // {
1195
- // "location": [
1196
- // 362.409,
1197
- // 434.09702,
1198
- // 11.990997,
1199
- // 11.990997
1200
- // ]
1201
- // },
1202
- // {
1203
- // "location": [
1204
- // 729.808,
1205
- // 326.211,
1206
- // 35.96106,
1207
- // 11.990997
1208
- // ]
1209
- // }
1210
- // ]
1211
- // }
1212
- // }
1213
- // },
1214
- // {
1215
- // "id": "6501ae871169c35ace973a87",
1216
- // "knowledgeId": "6501ae444f324a70bf677cce",
1217
- // "mainId": "b3cec709ed904d56b29cb95362dc181f",
1218
- // "page": 32,
1219
- // "total": 118,
1220
- // "pageHeight": 540.0,
1221
- // "pageWidth": 960.00946,
1222
- // "publicPageFileUrl": "https://askbot-pdf-all.oss-cn-zhangjiakou.aliyuncs.com/b3cec709ed904d56b29cb95362dc181f/2023/09/13/08/43/12/6501ae451169c35ace9739b7/32.pdf",
1223
- // "extractInfo": {
1224
- // "location": [
1225
- // 28.913,
1226
- // 30.983013,
1227
- // 307.587,
1228
- // 28.006
1229
- // ],
1230
- // "content": "智能化知识管理价值体现",
1231
- // "lines": [
1232
- // {
1233
- // "content": "智能化知识管理价值体现",
1234
- // "location": [
1235
- // 28.913,
1236
- // 30.983013,
1237
- // 307.587,
1238
- // 28.006
1239
- // ]
1240
- // }
1241
- // ],
1242
- // "tagId": null
1243
- // },
1244
- // "block": {
1245
- // "type": "TEXT",
1246
- // "location": [
1247
- // 28.913,
1248
- // 30.983013,
1249
- // 307.587,
1250
- // 28.006
1251
- // ],
1252
- // "color": null,
1253
- // "flowChart": null,
1254
- // "image": null,
1255
- // "table": null,
1256
- // "text": {
1257
- // "originText": "智能化知识管理价值体现",
1258
- // "indexText": "智能化知识管理价值体现",
1259
- // "lines": [
1260
- // {
1261
- // "location": [
1262
- // 28.913,
1263
- // 30.983013,
1264
- // 307.587,
1265
- // 28.006
1014
+ // 338.7992,
1015
+ // 435.73584,
1016
+ // 12.0,
1017
+ // 12.0
1266
1018
  // ]
1267
1019
  // }
1268
1020
  // ]
@@ -1280,7 +1032,6 @@ export default {
1280
1032
  this.cachePdf = res.data.data
1281
1033
  let publicPageFileUrl = res.data.data[0].publicPageFileUrl
1282
1034
  this.currentPage = 0
1283
- // console.log(publicPageFileUrl.substring(publicPageFileUrl.lastIndexOf('.')));
1284
1035
  if (publicPageFileUrl.substring(publicPageFileUrl.lastIndexOf('.')) === '.pdf') {
1285
1036
  this.preViewType = 'pdf'
1286
1037
  this.setPageAllLine(this.cachePdf)
@@ -1297,7 +1048,7 @@ export default {
1297
1048
  }).then(res => {
1298
1049
  // 使用原声请求方式 axios会带有不需要的请求头
1299
1050
  let xhr = new XMLHttpRequest();
1300
- xhr.open('GET', res.data || res.bodyText , true);
1051
+ xhr.open('GET', res.data || res.bodyText, true);
1301
1052
  // 定义请求完成的处理函数,请求前也可以增加加载框/禁用下载按钮逻辑
1302
1053
  xhr.onload = ({ currentTarget }) => {
1303
1054
  // 请求完成
@@ -1310,7 +1061,7 @@ export default {
1310
1061
  let allTr = Array.from(this.$refs.pdfView.getElementsByTagName('tr'))
1311
1062
  this.allTr = []
1312
1063
  for (let index = 0; index < allTr.length; index++) {
1313
- if(value.includes(allTr[index].getAttribute('tag-id'))) {
1064
+ if (value.includes(allTr[index].getAttribute('tag-id'))) {
1314
1065
  this.allTr.push(allTr[index])
1315
1066
  }
1316
1067
  }
@@ -1330,8 +1081,8 @@ export default {
1330
1081
  })
1331
1082
  }
1332
1083
  },
1333
- deep:true,
1334
- immediate:true
1084
+ deep: true,
1085
+ immediate: true
1335
1086
  }
1336
1087
  },
1337
1088
  mounted () {
@@ -1352,6 +1103,7 @@ export default {
1352
1103
  background-color: #f5f7fb;
1353
1104
  // margin-bottom: 60px;
1354
1105
  box-sizing: border-box;
1106
+
1355
1107
  // position: relative;
1356
1108
  // > div {
1357
1109
  // width: 100%;
@@ -1360,19 +1112,23 @@ export default {
1360
1112
  // overflow-y: auto;
1361
1113
  // position: relative;
1362
1114
  // }
1363
- > iframe {
1115
+ >iframe {
1364
1116
  width: 100%;
1365
1117
  height: 100%;
1366
1118
  }
1119
+
1367
1120
  a:link {
1368
1121
  color: none;
1369
1122
  }
1123
+
1370
1124
  a:visited {
1371
1125
  color: none;
1372
1126
  }
1127
+
1373
1128
  a:hover {
1374
1129
  color: none;
1375
1130
  }
1131
+
1376
1132
  a:active {
1377
1133
  color: none;
1378
1134
  }
@@ -1387,7 +1143,9 @@ export default {
1387
1143
  left: 0;
1388
1144
  z-index: 999;
1389
1145
  background: #ffffff;
1390
- .prev, .next {
1146
+
1147
+ .prev,
1148
+ .next {
1391
1149
  width: 35%;
1392
1150
  height: 40px;
1393
1151
  display: flex;
@@ -1396,15 +1154,18 @@ export default {
1396
1154
  border-radius: 50px;
1397
1155
  cursor: pointer;
1398
1156
  }
1157
+
1399
1158
  .prev {
1400
1159
  background: #F2F5FA;
1401
1160
  color: #000;
1402
1161
  }
1162
+
1403
1163
  .next {
1404
1164
  background: #366aff;
1405
1165
  color: #ffffff;
1406
1166
  }
1407
1167
  }
1168
+
1408
1169
  #pagination {
1409
1170
  .total-class {
1410
1171
  margin-right: 13px;
@@ -1424,6 +1185,8 @@ export default {
1424
1185
  border-radius: 5px;
1425
1186
  z-index: 1000;
1426
1187
 
1188
+
1189
+
1427
1190
  /deep/.el-pagination {
1428
1191
  margin-right: 110px;
1429
1192
  }
@@ -1497,6 +1260,7 @@ export default {
1497
1260
  background: #366AFF;
1498
1261
  }
1499
1262
  }
1263
+
1500
1264
  .change_scale {
1501
1265
  width: 100%;
1502
1266
  height: 50px;
@@ -1508,6 +1272,7 @@ export default {
1508
1272
  align-items: center;
1509
1273
  padding: 0 10px;
1510
1274
  box-sizing: border-box;
1275
+
1511
1276
  section {
1512
1277
  cursor: pointer;
1513
1278
  width: 30px;
@@ -1517,37 +1282,42 @@ export default {
1517
1282
  display: flex;
1518
1283
  align-items: center;
1519
1284
  justify-content: center;
1285
+
1520
1286
  i {
1521
1287
  font-weight: 900;
1522
1288
  }
1523
1289
  }
1290
+
1524
1291
  section:hover {
1525
1292
  background: rgba(221, 222, 223, 1);
1526
1293
  }
1527
1294
  }
1528
1295
  }
1529
-
1530
1296
  </style>
1531
1297
  <style lang="less">
1532
1298
  .animation {
1533
1299
  animation-name: highlight;
1534
1300
  animation-duration: 4s;
1535
1301
  }
1302
+
1536
1303
  @keyframes highlight {
1537
1304
  0% {
1538
- background:rgba(255, 136, 0, 0.3);
1539
- }
1305
+ background: rgba(255, 136, 0, 0.3);
1306
+ }
1307
+
1540
1308
  25% {
1541
- background:rgba(255, 136, 0, 0.6);
1309
+ background: rgba(255, 136, 0, 0.6);
1542
1310
  }
1311
+
1543
1312
  50% {
1544
- background:rgba(255, 136, 0, 0.3);
1313
+ background: rgba(255, 136, 0, 0.3);
1545
1314
  }
1315
+
1546
1316
  75% {
1547
- background:rgba(255, 136, 0, 0.6);
1317
+ background: rgba(255, 136, 0, 0.6);
1548
1318
  }
1319
+
1549
1320
  100% {
1550
- background:rgba(255, 136, 0, 0.3);
1321
+ background: rgba(255, 136, 0, 0.3);
1551
1322
  }
1552
- }
1553
- </style>
1323
+ }</style>