askbot-dragon 1.5.19 → 1.5.20

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "askbot-dragon",
3
- "version": "1.5.19",
3
+ "version": "1.5.20",
4
4
  "scripts": {
5
5
  "serve": "vue-cli-service serve",
6
6
  "build": "vue-cli-service build",
@@ -2045,7 +2045,7 @@ export default {
2045
2045
  } else {
2046
2046
  let d = document.createElement('div')
2047
2047
  d.innerHTML = this.workOrderDestail.value
2048
- if (!d.innerText) {
2048
+ if (!d.innerText.trim()) {
2049
2049
  textFlag = false
2050
2050
  }
2051
2051
  d = null
@@ -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,46 +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
- if(this.isMessageRecord) {
138
+ if (this.isMessageRecord) {
147
139
  this.scale = Math.round(this.$refs.pdfView.clientWidth / pdfResloute.pageWidth * 100) / 100
148
140
  } else {
149
141
  this.scale = 2
@@ -155,7 +147,7 @@ export default {
155
147
  this.loadPdfData(pdfResloute.page)
156
148
  },
157
149
  async loadPdfData (loadPage) {
158
- if(this.pages[loadPage - 1] && ((this.pages[loadPage - 1].dom && this.pages[loadPage - 1].dom.children.length > 0) || this.pages[loadPage - 1].loadStatus)) {
150
+ if (this.pages[loadPage - 1] && ((this.pages[loadPage - 1].dom && this.pages[loadPage - 1].dom.children.length > 0) || this.pages[loadPage - 1].loadStatus)) {
159
151
  return
160
152
  } else {
161
153
  if (this.changetoolbar) {
@@ -177,7 +169,7 @@ export default {
177
169
  // const page = this.pages[pageIndex - 1];
178
170
  // // // 不在缓存列表内,重新获取本页pdf
179
171
  // // if (page.loadStatus !== this.pageLoadStatus.LOADED) {
180
-
172
+
181
173
  // // } else {
182
174
  // // if (this.changetoolbar) {
183
175
  // // this.$nextTick(() => {
@@ -188,7 +180,7 @@ export default {
188
180
  // // }
189
181
  // }
190
182
  const page = this.pages[loadPage - 1]
191
- await pdfDoc.getPage(1).then( async (pdfPage) => {
183
+ await pdfDoc.getPage(1).then(async (pdfPage) => {
192
184
  this.pages[loadPage - 1].loadStatus = true
193
185
  this.pages[loadPage - 1].pdfPage = pdfPage;
194
186
  // 通知可以进行渲染了
@@ -219,14 +211,14 @@ export default {
219
211
  "Content-Type": "application/json",
220
212
  },
221
213
  }).then(async res => {
222
- if(res.bodyText) {
223
- // 最后返回一个 包含这4个参数的对象
214
+ if (res.bodyText) {
215
+ // 最后返回一个 包含这4个参数的对象
224
216
  obj = await {
225
217
  "startPage": pageIndex, // 分片的开始页码
226
218
  "endPage": pageIndex + 5, // 分片结束页码
227
219
  "totalPage": this.totalPageCount, // pdf 总页数
228
220
  "url": res.bodyText // 分片内容下载地址
229
- }
221
+ }
230
222
  }
231
223
  if (res.data) {
232
224
  // 最后返回一个 包含这4个参数的对象
@@ -241,7 +233,7 @@ export default {
241
233
  return obj
242
234
  },
243
235
  startRenderPages (pdfPage, page, pageIndex) {
244
- if(Object.keys(this.pageSize).length == 0) {
236
+ if (Object.keys(this.pageSize).length == 0) {
245
237
  const viewport = pdfPage.getViewport({
246
238
  scale: this.scale, // 缩放的比例
247
239
  rotation: this.rotation, // 旋转的角度
@@ -253,13 +245,13 @@ export default {
253
245
  }
254
246
  this.pageSize = pageSize
255
247
  // 创建内容绘制区,并设置大小
256
- if(this.$refs.pdfView.clientWidth / this.pageSize.width >= 1 || this.isMessageRecord) {
257
- this.contentView.style.width = `${pageSize.width - 10 }px`;
258
- 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`;
259
251
  } else {
260
- this.transformSalce = this.$refs.pdfView.clientWidth / this.pageSize.width
252
+ this.transformSalce = this.$refs.pdfView.clientWidth / this.pageSize.width
261
253
  this.contentView.style.width = `${pageSize.width * this.transformSalce - 10}px`;
262
- 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`;
263
255
  }
264
256
  this.contentView.style.margin = '0 auto 0'
265
257
  this.contentView.style.position = 'relative'
@@ -273,8 +265,8 @@ export default {
273
265
  renderPages (pageIndex) {
274
266
  const pagesToRender = this.getRenderScope(pageIndex);
275
267
  for (const i of this.pages) {
276
- if(pagesToRender.some(p =>{ return p.pageNo == i.pageNo })) {
277
- if(i.loadStatus === true) {
268
+ if (pagesToRender.some(p => { return p.pageNo == i.pageNo })) {
269
+ if (i.loadStatus === true) {
278
270
  this.renderPageContent(i, i.pageNo)
279
271
  } else {
280
272
  this.renderPageLoading(i, i.pageNo)
@@ -283,7 +275,7 @@ export default {
283
275
  this.clearPage(i);
284
276
  }
285
277
  }
286
-
278
+
287
279
  },
288
280
  async renderPageContent (page, pageIndex) {
289
281
  const { pdfPage, pageNo, dom } = page;
@@ -302,6 +294,8 @@ export default {
302
294
  // canvas.getContext('2d');
303
295
  canvas.height = this.pageSize.height;
304
296
  canvas.width = this.pageSize.width;
297
+ canvas.style.position = 'relative'
298
+ canvas.style.top = -3 + 'px'
305
299
  // 创建渲染的dom
306
300
  const pageDom = document.createElement('div');
307
301
  pageDom.style.position = 'absolute';
@@ -317,7 +311,7 @@ export default {
317
311
  }
318
312
  await pdfPage.render(renderContext).promise.then(() => {
319
313
  return pdfPage.getTextContent()
320
- }).then( async (textContent) => {
314
+ }).then(async (textContent) => {
321
315
  const textLayerDiv = document.createElement('div');
322
316
  textLayerDiv.setAttribute('class', 'textLayer');
323
317
  // 将文本图层div添加至每页pdf的div中
@@ -348,17 +342,17 @@ export default {
348
342
  div.style.position = 'absolute';
349
343
  div.style.left = postionArr[0] * this.scale + 'px',
350
344
  // 后端返回的坐标有基线对齐的问题,top 值是后端算好(基线top - 文字高度),在此加上文字高度的 1/9 (大致比例)为实际展示出文字的top值
351
- div.style.top = (postionArr[1] + postionArr[3] / 9) * this.scale + 'px'
345
+ div.style.top = postionArr[1] * this.scale + 'px'
352
346
  div.style.height = postionArr[3] * this.scale + 'px';
353
347
  div.style.width = postionArr[2] * this.scale + 'px'
354
348
  div.style.backgroundColor = 'rgba(54, 106, 255, 0.3)'
355
349
  div.classList.add('lineHeight')
356
350
  rectdom.appendChild(div)
357
- if(index == 0 && j == 0) {
358
- if(this.transformSalce !== null) {
359
- 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
360
354
  } else {
361
- rectdomTop = (postionArr[1] + postionArr[3] / 9) * this.scale
355
+ rectdomTop = postionArr[1] * this.scale
362
356
  }
363
357
  // if(this.isPC) {
364
358
  // rectdomTop = rectdomTop - 50 < 0 ? 0 : rectdomTop - 50
@@ -374,16 +368,16 @@ export default {
374
368
  }
375
369
  textLayer.setTextContent(textContent);
376
370
  textLayer.render()
377
- pageDom.appendChild(textLayer.textLayerDiv);
378
-
371
+ pageDom.appendChild(textLayerDiv);
372
+
379
373
  let backgroundDom = document.getElementById('backgroundLoad' + pageNo)
380
- if(backgroundDom) {
374
+ if (backgroundDom) {
381
375
  this.contentView.removeChild(backgroundDom);
382
376
  }
383
377
  page.dom = await pageDom;
384
378
  page.loading = false
385
379
  this.contentView.appendChild(pageDom);
386
- if(this.transformSalce !== null) {
380
+ if (this.transformSalce !== null) {
387
381
  this.contentView.style.transform = `scale(${this.transformSalce}, ${this.transformSalce})`
388
382
  }
389
383
  if (this.changetoolbar) {
@@ -395,31 +389,31 @@ export default {
395
389
  if (this.fisrtLoad) {
396
390
  setTimeout(() => {
397
391
  let pageoffsetHeight = 0
398
- if(this.transformSalce !== null) {
392
+ if (this.transformSalce !== null) {
399
393
  pageoffsetHeight = (this.pageSize.height + this.PAGE_INTVERVAL) * this.transformSalce
400
394
  } else {
401
395
  pageoffsetHeight = (this.pageSize.height + this.PAGE_INTVERVAL)
402
396
  }
403
397
  if (this.$refs.pdfView.clientHeight - pageoffsetHeight > 0 && pageIndex == 1) {
404
398
  const height = this.$refs.pdfView.clientHeight;
405
- let startNum = 0
399
+ let startNum = 0
406
400
  let endNum = 0
407
- if(this.transformSalce !== null) {
401
+ if (this.transformSalce !== null) {
408
402
  startNum = Math.ceil(this.$refs.pdfView.scrollTop / ((this.pageSize.height + this.PAGE_INTVERVAL) * this.transformSalce))
409
- endNum = startNum + Math.ceil(height / ((this.pageSize.height + this.PAGE_INTVERVAL) * this.transformSalce))
403
+ endNum = startNum + Math.ceil(height / ((this.pageSize.height + this.PAGE_INTVERVAL) * this.transformSalce))
410
404
  } else {
411
405
  startNum = Math.ceil(this.$refs.pdfView.scrollTop / (this.pageSize.height + this.PAGE_INTVERVAL))
412
- endNum = startNum + Math.ceil(height / (this.pageSize.height + this.PAGE_INTVERVAL))
413
-
406
+ endNum = startNum + Math.ceil(height / (this.pageSize.height + this.PAGE_INTVERVAL))
407
+
414
408
  }
415
409
  for (let pageIndex = startNum; pageIndex <= endNum; pageIndex++) {
416
- if(pageIndex > 0 && pageIndex <= this.pages.length) {
410
+ if (pageIndex > 0 && pageIndex <= this.pages.length) {
417
411
  this.loadPdfData(pageIndex)
418
412
  }
419
413
  }
420
414
  }
421
415
  if (this.$refs.pdfView.scrollTop == Math.floor((pageNo - 1) * pageoffsetHeight)) {
422
- this.$refs.pdfView.scrollTop = rectdomTop
416
+ this.$refs.pdfView.scrollTop = rectdomTop
423
417
  this.fisrtLoad = false
424
418
  } else {
425
419
  this.$refs.pdfView.scrollTop = `${((pageNo - 1) * pageoffsetHeight) + rectdomTop - this.PAGE_INTVERVAL}`
@@ -440,17 +434,17 @@ export default {
440
434
  }
441
435
  const scrollTop = e.target.scrollTop;
442
436
  const height = e.target.clientHeight;
443
- let startNum = 0
437
+ let startNum = 0
444
438
  let endNum = 0
445
- if(this.transformSalce !== null) {
439
+ if (this.transformSalce !== null) {
446
440
  startNum = Math.ceil(scrollTop / ((that.pageSize.height + that.PAGE_INTVERVAL) * this.transformSalce))
447
- 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))
448
442
  } else {
449
443
  startNum = Math.ceil(scrollTop / (that.pageSize.height + that.PAGE_INTVERVAL))
450
- endNum = startNum + Math.ceil(height / (that.pageSize.height + that.PAGE_INTVERVAL))
444
+ endNum = startNum + Math.ceil(height / (that.pageSize.height + that.PAGE_INTVERVAL))
451
445
  }
452
446
  for (let pageIndex = startNum; pageIndex < endNum; pageIndex++) {
453
- if(pageIndex > 0 && pageIndex < that.pages.length) {
447
+ if (pageIndex > 0 && pageIndex < that.pages.length) {
454
448
  that.loadPdfData(pageIndex)
455
449
  }
456
450
  }
@@ -469,13 +463,13 @@ export default {
469
463
  this.loadPdfData(pageIndex)
470
464
  },
471
465
  pdfScroll (e) {
472
- if(this.preViewType !== 'pdf' || this.isTouchMoved) {
466
+ if (this.preViewType !== 'pdf' || this.isTouchMoved) {
473
467
  return
474
468
  }
475
- if(this.scrollLeft != e.target.scrollLeft) {
469
+ if (this.scrollLeft != e.target.scrollLeft) {
476
470
  this.scrollLeft = e.target.scrollLeft
477
471
  }
478
- if(this.scrollTop != e.target.scrollTop) {
472
+ if (this.scrollTop != e.target.scrollTop) {
479
473
  this.scrollTop = e.target.scrollTop
480
474
  this.debounceScrollPdf(e, this)
481
475
  }
@@ -510,14 +504,14 @@ export default {
510
504
  }
511
505
  // for (let index = 0; index < array.length; index++) {
512
506
  // const element = array[index];
513
-
507
+
514
508
  // }
515
509
  return pagesToRender;
516
510
  },
517
511
 
518
512
  // 清除页面 dom
519
513
  clearPage (page) {
520
- if(this.contentView.contains(page.dom) && page.dom) {
514
+ if (this.contentView.contains(page.dom) && page.dom) {
521
515
  this.contentView.removeChild(page.dom);
522
516
  page.loadStatus = false
523
517
  page.loading = false
@@ -531,7 +525,7 @@ export default {
531
525
  return;
532
526
  }
533
527
  let backgroundDom = document.getElementById('backgroundLoad' + pageNo)
534
- if(this.contentView.contains(backgroundDom)) {
528
+ if (this.contentView.contains(backgroundDom)) {
535
529
  return
536
530
  }
537
531
  const pageDom = document.createElement('div');
@@ -552,15 +546,15 @@ export default {
552
546
  this.currentPage--
553
547
  if (this.currentPage < 0) {
554
548
  this.currentPage = 0
555
- if(!this.isPC) {
549
+ if (!this.isPC) {
556
550
  this.$toast({
557
- message:'当前已经是第一段了',
558
- duration:2000,
551
+ message: '当前已经是第一段了',
552
+ duration: 2000,
559
553
  })
560
554
  return
561
555
  }
562
556
  }
563
- if(this.preViewType == 'pdf') {
557
+ if (this.preViewType == 'pdf') {
564
558
  this.scrollToUplaodePage(this.currentPage)
565
559
  } else {
566
560
  this.scrollToExcalTop(this.currentPage)
@@ -571,15 +565,15 @@ export default {
571
565
  this.currentPage++
572
566
  if (this.currentPage >= this.tagIds.length) {
573
567
  this.currentPage = this.tagIds.length - 1
574
- if(!this.isPC) {
568
+ if (!this.isPC) {
575
569
  this.$toast({
576
- message:'当前已经是最后一段了',
577
- duration:2000,
570
+ message: '当前已经是最后一段了',
571
+ duration: 2000,
578
572
  })
579
573
  return
580
574
  }
581
575
  }
582
- if(this.preViewType == 'pdf') {
576
+ if (this.preViewType == 'pdf') {
583
577
  this.scrollToUplaodePage(this.currentPage)
584
578
  } else {
585
579
  this.scrollToExcalTop(this.currentPage)
@@ -587,7 +581,7 @@ export default {
587
581
  },
588
582
  currentChange (value) {
589
583
  this.currentPage = value - 1
590
- if(this.preViewType == 'pdf') {
584
+ if (this.preViewType == 'pdf') {
591
585
  this.scrollToUplaodePage(this.currentPage)
592
586
  } else {
593
587
  this.scrollToExcalTop(this.currentPage)
@@ -595,10 +589,10 @@ export default {
595
589
  },
596
590
  scrollToUplaodePage (currentPage) {
597
591
  this.changetoolbar = true
598
- if(this.preViewType !== 'pdf') {
592
+ if (this.preViewType !== 'pdf') {
599
593
  return
600
594
  }
601
-
595
+
602
596
  let pdfResloute = this.cachePdf[currentPage]
603
597
  this.identifyTextPostion.extractInfo = pdfResloute.extractInfo
604
598
  this.identifyTextPostion.left = pdfResloute.extractInfo.location[0]
@@ -612,32 +606,32 @@ export default {
612
606
  this.$nextTick(() => {
613
607
  this.renderHighlights()
614
608
  })
615
- if(this.transformSalce !== null) {
609
+ if (this.transformSalce !== null) {
616
610
  this.$refs.pdfView.scrollTop = `${((pdfResloute.page - 1) * (this.pageSize.height + this.PAGE_INTVERVAL) * this.transformSalce) + (this.identifyTextPostion.top * this.scale * this.transformSalce)}`
617
611
  } else {
618
612
  this.$refs.pdfView.scrollTop = `${((pdfResloute.page - 1) * (this.pageSize.height + this.PAGE_INTVERVAL)) + (this.identifyTextPostion.top * this.scale * this.transformSalce)}`
619
613
  }
620
614
  },
621
- scrollToExcalTop(currentPage) {
615
+ scrollToExcalTop (currentPage) {
622
616
  for (let index = 0; index < this.allTr.length; index++) {
623
- if(index == currentPage) {
624
- Array.from(this.allTr[index].children).forEach(item =>{
617
+ if (index == currentPage) {
618
+ Array.from(this.allTr[index].children).forEach(item => {
625
619
  item.style.background = 'rgba(255, 136, 0, 0.6)'
626
620
  item.classList.add('animation')
627
- setTimeout(() =>{
621
+ setTimeout(() => {
628
622
  item.classList.remove('animation')
629
623
  }, 4000)
630
624
  })
631
625
  // getBoundingClientRect().top 当前元素距离屏幕顶部的高度 + 弹窗header 高度
632
- if(!this.isPC) {
633
- 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
634
628
  this.$refs.pdfView.scrollTop = top
635
629
  } else {
636
630
  let top = this.allTr[index].getBoundingClientRect().top
637
631
  this.$refs.pdfView.scrollTop = top - 50
638
632
  }
639
633
  } else {
640
- Array.from(this.allTr[index].children).forEach(item =>{
634
+ Array.from(this.allTr[index].children).forEach(item => {
641
635
  item.style.background = 'rgba(54, 106, 255, 0.6)'
642
636
  item.classList.remove('animation')
643
637
  })
@@ -653,7 +647,7 @@ export default {
653
647
  if (d.getAttribute('react-count') == this.currentPage) {
654
648
  d.children[i].style.backgroundColor = 'rgba(255, 136, 0, 0.3)'
655
649
  d.children[i].classList.add('animation')
656
- setTimeout(() =>{
650
+ setTimeout(() => {
657
651
  d.children[i].classList.remove('animation')
658
652
  }, 4000)
659
653
  } else {
@@ -706,7 +700,7 @@ export default {
706
700
  }
707
701
  })
708
702
  },
709
- openTouch() {
703
+ openTouch () {
710
704
  // this.$nextTick()将回调延迟到下次 DOM 更新循环之后执行
711
705
  let that = this;
712
706
  this.$nextTick(() => {
@@ -768,23 +762,23 @@ export default {
768
762
  }
769
763
  // 双指缩放比例计算
770
764
  let zoom = that.getDistance({
771
- x: events.pageX,
772
- 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
773
776
  },
774
- {
775
- x: events2.pageX,
776
- y: events2.pageY
777
- }
778
- ) / that.getDistance(
779
- {
780
- x: that.displacement.pageX,
781
- y: that.displacement.pageY
782
- },
783
- {
784
- x: that.displacement.pageX2,
785
- y: that.displacement.pageY2
786
- }
787
- );
777
+ {
778
+ x: that.displacement.pageX2,
779
+ y: that.displacement.pageY2
780
+ }
781
+ );
788
782
  // 应用在元素上的缩放比例
789
783
  let newScale = that.displacement.originScale * zoom;
790
784
  // 最大缩放比例限制
@@ -792,7 +786,7 @@ export default {
792
786
  newScale = 2;
793
787
  }
794
788
  // 最大缩放比例限制
795
- if(newScale < 1) {
789
+ if (newScale < 1) {
796
790
  newScale = 1;
797
791
  }
798
792
  // 记住使用的缩放值
@@ -802,38 +796,38 @@ export default {
802
796
  // 设置旋转元素的基点位置
803
797
  matrix_box.style.transformOrigin = "0px 0px 0px";
804
798
  }
805
- },{ passive: false });
806
- document.addEventListener('touchend',function() {
799
+ }, { passive: false });
800
+ document.addEventListener('touchend', function () {
807
801
  that.isTouchMoved = false
808
- },{ passive: false })
802
+ }, { passive: false })
809
803
  });
810
804
  },
811
- getDistance(start, stop) {
805
+ getDistance (start, stop) {
812
806
  // Math.hypot()计算参数的平方根
813
807
  return Math.hypot(stop.x - start.x, stop.y - start.y);
814
808
  },
815
- setupCanvas(canvas, width, height) {
816
- const dpr = 1;
809
+ setupCanvas (canvas, width, height) {
810
+ const dpr = 1;
817
811
  // const rect = canvas.getBoundingClientRect();
818
- canvas.width = width
819
- canvas.height = height
812
+ canvas.width = width
813
+ canvas.height = height
820
814
  const ctx = canvas.getContext('2d');
821
- ctx?.scale(dpr, dpr );
815
+ ctx?.scale(dpr, dpr);
822
816
  return ctx;
823
817
  },
824
- changeScale(value) {
825
- if(value == 'zoom') {
818
+ changeScale (value) {
819
+ if (value == 'zoom') {
826
820
  this.handScale = 'auto'
827
821
  this.transformSalce = (this.transformSalce + 0.2).toFixed(1)
828
- } else if(value == 'reduce') {
829
- if((this.transformSalce - 0.2).toFixed(1) <= 0) {
822
+ } else if (value == 'reduce') {
823
+ if ((this.transformSalce - 0.2).toFixed(1) <= 0) {
830
824
  return
831
825
  }
832
826
  this.handScale = 'auto'
833
827
  this.transformSalce = (this.transformSalce - 0.2).toFixed(1)
834
- } else if(value == 'auto') {
828
+ } else if (value == 'auto') {
835
829
  this.transformSalce = this.$refs.pdfView.clientWidth / this.pageSize.width
836
- } else if(value == 'reality') {
830
+ } else if (value == 'reality') {
837
831
  this.transformSalce = 0.5
838
832
  } else {
839
833
  this.transformSalce = (value / 2).toFixed(1)
@@ -843,19 +837,19 @@ export default {
843
837
  // this.getpdfResloutePage(this.cachePdf[0])
844
838
  },
845
839
  },
846
- computed:{
847
- perviewUrl() {
840
+ computed: {
841
+ perviewUrl () {
848
842
  return '/web/viewer.html?file=' + '/pdflist/pdf4split-1.pdf'
849
843
  },
850
- setHeight() {
851
- if(this.tagIds.length > 1 ) {
852
- if(this.isPC) {
844
+ setHeight () {
845
+ if (this.tagIds.length > 1) {
846
+ if (this.isPC) {
853
847
  return 'calc(100% - 110px)'
854
848
  } else {
855
849
  return 'calc(100% - 60px)'
856
850
  }
857
851
  } else {
858
- if(this.isPC) {
852
+ if (this.isPC) {
859
853
  return 'calc(100% - 50px)'
860
854
  } else {
861
855
  return '100%'
@@ -863,14 +857,14 @@ export default {
863
857
  }
864
858
  }
865
859
  },
866
- watch:{
860
+ watch: {
867
861
  tagIds: {
868
- handler(value) {
869
- if(value && value.length) {
862
+ handler (value) {
863
+ if (value && value.length) {
870
864
  // 在 pdf_view 下创建 所有canvs的容器
871
865
  this.contentView = document.createElement('div')
872
866
  this.contentView.style.transformOrigin = '0px 0px 0px'
873
- 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 => {
874
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}
875
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}
876
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}
@@ -882,30 +876,30 @@ export default {
882
876
  // res.data = {
883
877
  // "data": [
884
878
  // {
885
- // "id": "6502b03a5dc4b63cce992224",
886
- // "knowledgeId": "6502a777a7c9df4fb3115df8",
887
- // "mainId": "09a585f5cecf43678a979b542e685cea",
888
- // "page": 63,
889
- // "total": 115,
890
- // "pageHeight": 540.0,
891
- // "pageWidth": 960.00946,
892
- // "publicPageFileUrl": "https://askbot-pdf-all.oss-cn-zhangjiakou.aliyuncs.com/09a585f5cecf43678a979b542e685cea/2023/09/14/07/03/18/6502b0355dc4b63cce9921e3/63.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",
893
887
  // "extractInfo": {
894
888
  // "location": [
895
- // 269.802,
896
- // 284.004,
897
- // 420.5398,
898
- // 24.009003
889
+ // 52.665375,
890
+ // 312.01306,
891
+ // 404.98618,
892
+ // 142.5199
899
893
  // ],
900
- // "content": "ios会崩溃的原因是,或者是文件太大了",
894
+ // "content": null,
901
895
  // "lines": [
902
896
  // {
903
- // "content": "ios会崩溃的原因是,或者是文件太大了",
897
+ // "content": null,
904
898
  // "location": [
905
- // 269.802,
906
- // 284.004,
907
- // 420.5398,
908
- // 24.009003
899
+ // 52.665375,
900
+ // 312.01306,
901
+ // 404.98618,
902
+ // 142.5199
909
903
  // ]
910
904
  // }
911
905
  // ],
@@ -914,25 +908,113 @@ export default {
914
908
  // "block": {
915
909
  // "type": "TEXT",
916
910
  // "location": [
917
- // 269.802,
918
- // 284.004,
919
- // 420.5398,
920
- // 24.009003
911
+ // 52.665375,
912
+ // 312.01306,
913
+ // 404.98618,
914
+ // 142.5199
921
915
  // ],
922
- // "color": null,
923
- // "flowChart": null,
924
- // "image": null,
925
- // "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
+ // },
926
928
  // "text": {
927
- // "originText": "ios会崩溃的原因是,或者是文件太大了",
928
- // "indexText": "ios会崩溃的原因是,或者是文件太大了",
929
+ // "originText": "① 头部防护:安全帽\n佩戴要求:\n①存在坠物或对头部产生碰撞风险的作业场所需要佩戴安全帽 ;\n②安全帽必须戴正、戴牢、不能晃动,要系紧下颏带,调节好后箍以\n防安全帽脱落 ;\n③受强力撞击及超过有效期的安全帽必须更换。",
930
+ // "indexText": "① 头部防护:安全帽\n佩戴要求:\n①存在坠物或对头部产生碰撞风险的作业场所需要佩戴安全帽 ;\n②安全帽必须戴正、戴牢、不能晃动,要系紧下颏带,调节好后箍以\n防安全帽脱落 ;\n③受强力撞击及超过有效期的安全帽必须更换。",
929
931
  // "lines": [
930
932
  // {
931
933
  // "location": [
932
- // 269.802,
933
- // 284.004,
934
- // 420.5398,
935
- // 24.009003
934
+ // 69.08148,
935
+ // 368.92072,
936
+ // 65.90851,
937
+ // 10.5
938
+ // ]
939
+ // },
940
+ // {
941
+ // "location": [
942
+ // 86.290985,
943
+ // 384.67072,
944
+ // 31.5,
945
+ // 10.5
946
+ // ]
947
+ // },
948
+ // {
949
+ // "location": [
950
+ // 286.2992,
951
+ // 315.73584,
952
+ // 37.656006,
953
+ // 12.0
954
+ // ]
955
+ // },
956
+ // {
957
+ // "location": [
958
+ // 324.6939,
959
+ // 316.79932,
960
+ // 122.74487,
961
+ // 10.5
962
+ // ]
963
+ // },
964
+ // {
965
+ // "location": [
966
+ // 286.2954,
967
+ // 336.0458,
968
+ // 149.625,
969
+ // 10.5
970
+ // ]
971
+ // },
972
+ // {
973
+ // "location": [
974
+ // 286.2954,
975
+ // 356.0483,
976
+ // 161.15405,
977
+ // 10.5
978
+ // ]
979
+ // },
980
+ // {
981
+ // "location": [
982
+ // 286.2954,
983
+ // 376.0508,
984
+ // 161.15405,
985
+ // 10.5
986
+ // ]
987
+ // },
988
+ // {
989
+ // "location": [
990
+ // 286.2954,
991
+ // 396.0533,
992
+ // 76.125,
993
+ // 10.5
994
+ // ]
995
+ // },
996
+ // {
997
+ // "location": [
998
+ // 286.2954,
999
+ // 416.05582,
1000
+ // 161.17517,
1001
+ // 10.5
1002
+ // ]
1003
+ // },
1004
+ // {
1005
+ // "location": [
1006
+ // 286.2954,
1007
+ // 436.8038,
1008
+ // 52.5,
1009
+ // 10.5
1010
+ // ]
1011
+ // },
1012
+ // {
1013
+ // "location": [
1014
+ // 338.7992,
1015
+ // 435.73584,
1016
+ // 12.0,
1017
+ // 12.0
936
1018
  // ]
937
1019
  // }
938
1020
  // ]
@@ -966,7 +1048,7 @@ export default {
966
1048
  }).then(res => {
967
1049
  // 使用原声请求方式 axios会带有不需要的请求头
968
1050
  let xhr = new XMLHttpRequest();
969
- xhr.open('GET', res.data || res.bodyText , true);
1051
+ xhr.open('GET', res.data || res.bodyText, true);
970
1052
  // 定义请求完成的处理函数,请求前也可以增加加载框/禁用下载按钮逻辑
971
1053
  xhr.onload = ({ currentTarget }) => {
972
1054
  // 请求完成
@@ -979,7 +1061,7 @@ export default {
979
1061
  let allTr = Array.from(this.$refs.pdfView.getElementsByTagName('tr'))
980
1062
  this.allTr = []
981
1063
  for (let index = 0; index < allTr.length; index++) {
982
- if(value.includes(allTr[index].getAttribute('tag-id'))) {
1064
+ if (value.includes(allTr[index].getAttribute('tag-id'))) {
983
1065
  this.allTr.push(allTr[index])
984
1066
  }
985
1067
  }
@@ -999,8 +1081,8 @@ export default {
999
1081
  })
1000
1082
  }
1001
1083
  },
1002
- deep:true,
1003
- immediate:true
1084
+ deep: true,
1085
+ immediate: true
1004
1086
  }
1005
1087
  },
1006
1088
  mounted () {
@@ -1021,6 +1103,7 @@ export default {
1021
1103
  background-color: #f5f7fb;
1022
1104
  // margin-bottom: 60px;
1023
1105
  box-sizing: border-box;
1106
+
1024
1107
  // position: relative;
1025
1108
  // > div {
1026
1109
  // width: 100%;
@@ -1029,19 +1112,23 @@ export default {
1029
1112
  // overflow-y: auto;
1030
1113
  // position: relative;
1031
1114
  // }
1032
- > iframe {
1115
+ >iframe {
1033
1116
  width: 100%;
1034
1117
  height: 100%;
1035
1118
  }
1119
+
1036
1120
  a:link {
1037
1121
  color: none;
1038
1122
  }
1123
+
1039
1124
  a:visited {
1040
1125
  color: none;
1041
1126
  }
1127
+
1042
1128
  a:hover {
1043
1129
  color: none;
1044
1130
  }
1131
+
1045
1132
  a:active {
1046
1133
  color: none;
1047
1134
  }
@@ -1056,7 +1143,9 @@ export default {
1056
1143
  left: 0;
1057
1144
  z-index: 999;
1058
1145
  background: #ffffff;
1059
- .prev, .next {
1146
+
1147
+ .prev,
1148
+ .next {
1060
1149
  width: 35%;
1061
1150
  height: 40px;
1062
1151
  display: flex;
@@ -1065,15 +1154,18 @@ export default {
1065
1154
  border-radius: 50px;
1066
1155
  cursor: pointer;
1067
1156
  }
1157
+
1068
1158
  .prev {
1069
1159
  background: #F2F5FA;
1070
1160
  color: #000;
1071
1161
  }
1162
+
1072
1163
  .next {
1073
1164
  background: #366aff;
1074
1165
  color: #ffffff;
1075
1166
  }
1076
1167
  }
1168
+
1077
1169
  #pagination {
1078
1170
  .total-class {
1079
1171
  margin-right: 13px;
@@ -1093,6 +1185,8 @@ export default {
1093
1185
  border-radius: 5px;
1094
1186
  z-index: 1000;
1095
1187
 
1188
+
1189
+
1096
1190
  /deep/.el-pagination {
1097
1191
  margin-right: 110px;
1098
1192
  }
@@ -1166,6 +1260,7 @@ export default {
1166
1260
  background: #366AFF;
1167
1261
  }
1168
1262
  }
1263
+
1169
1264
  .change_scale {
1170
1265
  width: 100%;
1171
1266
  height: 50px;
@@ -1177,6 +1272,7 @@ export default {
1177
1272
  align-items: center;
1178
1273
  padding: 0 10px;
1179
1274
  box-sizing: border-box;
1275
+
1180
1276
  section {
1181
1277
  cursor: pointer;
1182
1278
  width: 30px;
@@ -1186,37 +1282,42 @@ export default {
1186
1282
  display: flex;
1187
1283
  align-items: center;
1188
1284
  justify-content: center;
1285
+
1189
1286
  i {
1190
1287
  font-weight: 900;
1191
1288
  }
1192
1289
  }
1290
+
1193
1291
  section:hover {
1194
1292
  background: rgba(221, 222, 223, 1);
1195
1293
  }
1196
1294
  }
1197
1295
  }
1198
-
1199
1296
  </style>
1200
1297
  <style lang="less">
1201
1298
  .animation {
1202
1299
  animation-name: highlight;
1203
1300
  animation-duration: 4s;
1204
1301
  }
1302
+
1205
1303
  @keyframes highlight {
1206
1304
  0% {
1207
- background:rgba(255, 136, 0, 0.3);
1208
- }
1305
+ background: rgba(255, 136, 0, 0.3);
1306
+ }
1307
+
1209
1308
  25% {
1210
- background:rgba(255, 136, 0, 0.6);
1309
+ background: rgba(255, 136, 0, 0.6);
1211
1310
  }
1311
+
1212
1312
  50% {
1213
- background:rgba(255, 136, 0, 0.3);
1313
+ background: rgba(255, 136, 0, 0.3);
1214
1314
  }
1315
+
1215
1316
  75% {
1216
- background:rgba(255, 136, 0, 0.6);
1317
+ background: rgba(255, 136, 0, 0.6);
1217
1318
  }
1319
+
1218
1320
  100% {
1219
- background:rgba(255, 136, 0, 0.3);
1321
+ background: rgba(255, 136, 0, 0.3);
1220
1322
  }
1221
- }
1222
- </style>
1323
+ }</style>