askbot-dragon 1.4.33 → 1.4.35

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.4.33",
3
+ "version": "1.4.35",
4
4
  "scripts": {
5
5
  "serve": "vue-cli-service serve",
6
6
  "build": "vue-cli-service build",
@@ -91,7 +91,7 @@ export default {
91
91
  // 定位功能,加载对应页码位置
92
92
  this.loadPdfData(pdfResloute.page)
93
93
  },
94
- async loadPdfData (loadPage) {
94
+ async loadPdfData (loadPage) {
95
95
  if(this.pages[loadPage - 1] && this.pages[loadPage - 1].dom && this.pages[loadPage - 1].dom.children.length > 0) {
96
96
  return
97
97
  }
@@ -287,26 +287,51 @@ export default {
287
287
  }
288
288
  if (this.fisrtLoad) {
289
289
  setTimeout(() => {
290
- // (this.pageSize.height + this.PAGE_INTVERVAL)
291
- if (this.$refs.pdfView.clientHeight - (this.pageSize.height + this.PAGE_INTVERVAL) > 0 ) {
292
- let loadNum = Math.ceil(this.$refs.pdfView.clientHeight / (this.pageSize.height + this.PAGE_INTVERVAL))
290
+ let pageoffsetHeight = 0
291
+ if(this.transformSalce !== null) {
292
+ pageoffsetHeight = (this.pageSize.height + this.PAGE_INTVERVAL) * this.transformSalce
293
+ } else {
294
+ pageoffsetHeight = (this.pageSize.height + this.PAGE_INTVERVAL)
295
+ }
296
+ if (this.$refs.pdfView.clientHeight - pageoffsetHeight > 0) {
297
+ let loadNum = Math.ceil(this.$refs.pdfView.clientHeight / pageoffsetHeight)
293
298
  for (let n = 0; n < loadNum; n++) {
294
299
  this.loadPdfData(pageNo + n)
295
300
  }
296
301
  }
297
- if(this.transformSalce !== null) {
298
- if (this.$refs.pdfView.scrollTop == Math.floor((pageNo - 1) * (this.pageSize.height + this.PAGE_INTVERVAL)) * this.transformSalce ) {
299
- this.fisrtLoad = false
300
- } else {
301
- this.$refs.pdfView.scrollTop = `${((pageNo - 1) * (this.pageSize.height + this.PAGE_INTVERVAL) * this.transformSalce)}`
302
- }
302
+ if (this.$refs.pdfView.scrollTop == Math.floor((pageNo - 1) * pageoffsetHeight)) {
303
+ this.fisrtLoad = false
303
304
  } else {
304
- if (this.$refs.pdfView.scrollTop == Math.floor((pageNo - 1) * (this.pageSize.height + this.PAGE_INTVERVAL))) {
305
- this.fisrtLoad = false
306
- } else {
307
- this.$refs.pdfView.scrollTop = `${((pageNo - 1) * (this.pageSize.height + this.PAGE_INTVERVAL))}`
308
- }
305
+ this.$refs.pdfView.scrollTop = `${((pageNo - 1) * pageoffsetHeight)}`
306
+ this.fisrtLoad = false
309
307
  }
308
+ // if(this.transformSalce !== null) {
309
+ // if (this.$refs.pdfView.clientHeight - (this.pageSize.height + this.PAGE_INTVERVAL) > 0 ) {
310
+ // let loadNum = Math.ceil(this.$refs.pdfView.clientHeight / (this.pageSize.height + this.PAGE_INTVERVAL))
311
+ // for (let n = 0; n < loadNum; n++) {
312
+ // this.loadPdfData(pageNo + n)
313
+ // }
314
+ // }
315
+ // if (this.$refs.pdfView.scrollTop == Math.floor((pageNo - 1) * (this.pageSize.height + this.PAGE_INTVERVAL)) * this.transformSalce ) {
316
+ // this.fisrtLoad = false
317
+ // } else {
318
+ // this.$refs.pdfView.scrollTop = `${((pageNo - 1) * (this.pageSize.height + this.PAGE_INTVERVAL) * this.transformSalce)}`
319
+ // this.fisrtLoad = false
320
+ // }
321
+ // } else {
322
+ // if (this.$refs.pdfView.clientHeight - (this.pageSize.height + this.PAGE_INTVERVAL) > 0 ) {
323
+ // let loadNum = Math.ceil(this.$refs.pdfView.clientHeight / (this.pageSize.height + this.PAGE_INTVERVAL))
324
+ // for (let n = 0; n < loadNum; n++) {
325
+ // this.loadPdfData(pageNo + n)
326
+ // }
327
+ // }
328
+ // if (this.$refs.pdfView.scrollTop == Math.floor((pageNo - 1) * (this.pageSize.height + this.PAGE_INTVERVAL))) {
329
+ // this.fisrtLoad = false
330
+ // } else {
331
+ // this.$refs.pdfView.scrollTop = `${((pageNo - 1) * (this.pageSize.height + this.PAGE_INTVERVAL))}`
332
+ // this.fisrtLoad = false
333
+ // }
334
+ // }
310
335
  this.renderHighlights()
311
336
  // zoomElement(this.contentView)
312
337
  }, 100)
@@ -323,13 +348,29 @@ export default {
323
348
  const scrollTop = e.target.scrollTop;
324
349
  const height = e.target.clientHeight;
325
350
  // 根据内容可视区域中心点计算页码, 没有滚动时,指向第一页
326
- const pageIndex = scrollTop > 0 ?
327
- Math.ceil((scrollTop + (height / 2)) / (that.pageSize.height + that.PAGE_INTVERVAL)) :
328
- 1;
351
+ // const pageIndex = scrollTop > 0 ?
352
+ // Math.ceil((scrollTop + (height / 2)) / (that.pageSize.height + that.PAGE_INTVERVAL)) :
353
+ // 1;
354
+ let startNum = 0
355
+ let endNum = 0
329
356
 
330
- pageIndex - 1 != 0 && that.loadPdfData(pageIndex - 1)
331
- that.loadPdfData(pageIndex)
332
- pageIndex + 1 <= that.totalPageCount && that.loadPdfData(pageIndex + 1)
357
+ // console.log(pageIndex);
358
+ if(this.transformSalce !== null) {
359
+ startNum = Math.ceil(scrollTop / ((that.pageSize.height + that.PAGE_INTVERVAL) * this.transformSalce))
360
+ endNum = startNum + Math.ceil(height / ((that.pageSize.height + that.PAGE_INTVERVAL) * this.transformSalce))
361
+ } else {
362
+ startNum = Math.ceil(scrollTop / (that.pageSize.height + that.PAGE_INTVERVAL))
363
+ endNum = startNum + Math.ceil(height / (that.pageSize.height + that.PAGE_INTVERVAL))
364
+ }
365
+ for (let pageIndex = startNum; pageIndex <= endNum; pageIndex++) {
366
+ console.log(pageIndex,pageIndex >= 0 && pageIndex <= that.pages.length, 'pageIndexpageIndexpageIndex');
367
+ if(pageIndex >= 0 && pageIndex <= that.pages.length) {
368
+ that.loadPdfData(pageIndex)
369
+ }
370
+ }
371
+ // pageIndex - 1 != 0 && that.loadPdfData(pageIndex - 1)
372
+ // that.loadPdfData(pageIndex)
373
+ // pageIndex + 1 < that.totalPageCount.length && that.loadPdfData(pageIndex + 1)
333
374
  }, 200),
334
375
  directScrolling (e, that) {
335
376
  if (this.fisrtLoad) {
@@ -694,6 +735,8 @@ export default {
694
735
  this.contentView = document.createElement('div')
695
736
  this.contentView.style.transformOrigin = '0px 0px 0px'
696
737
  this.$http.get('/knowledge-api/knowledge/knowledge-part-location-info/list?ids=' + value.join(',')).then(res =>{
738
+ // 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}
739
+ // 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}
697
740
  // 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}
698
741
  if (res.data.code == 0) {
699
742
  // tagIds 会按照gpt识别的生成有序的数组,前端直接按照下标的顺序取就可以了