askbot-dragon 1.7.61-beta → 1.7.63-beta

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.
Files changed (36) hide show
  1. package/package.json +5 -4
  2. package/public/index.html +8 -10
  3. package/src/assets/js/AliyunlssUtil.js +49 -25
  4. package/src/assets/js/hammer.js +13 -2
  5. package/src/assets/less/converSationContainer/common.less +7 -0
  6. package/src/components/ActionAlertIframe.vue +24 -1
  7. package/src/components/AiGuide.vue +114 -151
  8. package/src/components/AnswerDocknowledge.vue +23 -14
  9. package/src/components/ConversationContainer.vue +104 -213
  10. package/src/components/MyEditor.vue +2 -1
  11. package/src/components/actionSatisfaction.vue +1 -1
  12. package/src/components/answerRadio.vue +50 -4
  13. package/src/components/askVideo.vue +23 -0
  14. package/src/components/associationIntention.vue +11 -7
  15. package/src/components/formTemplate.vue +54 -50
  16. package/src/components/intelligentSummary.vue +5 -1
  17. package/src/components/markDownText.vue +21 -21
  18. package/src/components/message/TextMessage.vue +5 -1
  19. package/src/components/message/swiper/ticketSwiper.vue +1 -1
  20. package/src/components/newPdfPosition.vue +878 -0
  21. package/src/components/pagination.vue +129 -0
  22. package/src/components/pdfPosition.vue +213 -33
  23. package/src/components/preview/docView.vue +114 -0
  24. package/src/components/preview/excelView.vue +191 -0
  25. package/src/components/preview/newPositionPreview.vue +370 -0
  26. package/src/components/preview/pdfView.vue +824 -0
  27. package/src/components/previewDoc.vue +4 -0
  28. package/src/components/previewPdf.vue +626 -314
  29. package/src/components/senderMessagePlatform.vue +1 -1
  30. package/src/components/utils/ckeditor.js +1 -1
  31. package/src/components/welcomeKnowledgeFile.vue +5 -1
  32. package/src/components/welcomeLlmCard.vue +5 -1
  33. package/src/locales/cn.json +60 -60
  34. package/src/locales/en.json +60 -60
  35. package/src/locales/jp.json +73 -0
  36. package/src/main.js +1 -1
@@ -0,0 +1,129 @@
1
+ <template>
2
+ <div id="pagination">
3
+ <el-pagination
4
+ @size-change="handleSizeChange"
5
+ @current-change="currentChange"
6
+ :current-page.sync="currentPages"
7
+ :page-size="pageSize"
8
+ layout="slot, prev, pager, next"
9
+ :total="total">
10
+ <span class="total-class">共 {{total}} 条数据</span>
11
+ </el-pagination>
12
+ </div>
13
+ </template>
14
+
15
+ <script>
16
+ export default {
17
+ name: "paginationPage",
18
+ data(){
19
+ return{
20
+ currentPages:1
21
+ }
22
+ },
23
+ props:['pageSize','currentPage','total',"isReportForm"],
24
+ watch:{
25
+ currentPage: {
26
+ handler(val){
27
+ this.currentPages = val
28
+ },
29
+ },
30
+
31
+ },
32
+ mounted() {
33
+ this.currentPages = this.currentPage
34
+ },
35
+ methods:{
36
+ handleSizeChange(value){
37
+ this.$emit('handleSizeChange',value)
38
+ },
39
+ currentChange(value){
40
+ this.$emit('currentChange',value)
41
+ },
42
+ }
43
+ }
44
+ </script>
45
+
46
+ <style scoped lang="less">
47
+ #pagination{
48
+ .total-class{
49
+ margin-right: 13px;
50
+ font-weight: 400;
51
+ }
52
+ position: absolute;
53
+ bottom: 0px;
54
+ right: 0;
55
+ width: 100%;
56
+ display: flex;
57
+ align-items: center;
58
+ justify-content: center;
59
+ height: 50px;
60
+ background-color: white;
61
+ box-shadow: 0px 0px 18px 0px rgba(29, 55, 129, 0.07);
62
+ border-radius: 5px;
63
+ /deep/.el-pager{
64
+ background: #EDF0F6;
65
+ border-radius: 15px;
66
+ }
67
+ /deep/.el-pagination.is-background .btn-next{
68
+ width: 30px;
69
+ height: 30px;
70
+ background: #EDF0F6;
71
+ border-radius: 50%;
72
+ }
73
+ /deep/.el-pagination .btn-next{
74
+ width: 30px;
75
+ height: 30px;
76
+ background: #EDF0F6;
77
+ border-radius: 50%;
78
+ padding-left: 0;
79
+ margin-left:5px ;
80
+ }
81
+ /deep/.el-pagination .btn-prev{
82
+ width: 30px;
83
+ height: 30px;
84
+ background: #EDF0F6;
85
+ border-radius: 50%;
86
+ padding-right: 0;
87
+ margin-right:5px ;
88
+ }
89
+ /deep/.el-pagination button{
90
+ padding: 0;
91
+ min-width: 30px;
92
+ }
93
+ /deep/.el-pager li{
94
+ background: #EDF0F6;
95
+ height: 30px;
96
+ min-width: 30px;
97
+ line-height: 30px;
98
+ font-size: 12px;
99
+ color: #717b90;
100
+ }
101
+ /deep/.el-pager li:first-child{
102
+ border-bottom-left-radius: 15px!important;
103
+ border-top-left-radius: 15px!important;
104
+ }
105
+ /deep/.el-pager li:last-child{
106
+ border-top-right-radius: 15px!important;
107
+ border-bottom-right-radius: 15px!important;
108
+ }
109
+ /deep/.el-pager li.active{
110
+ width: 30px;
111
+ height: 30px;
112
+ min-width: 30px;
113
+ background: #366AFF;
114
+ border: 3px solid #A1B9FF;
115
+ border-radius: 50%;
116
+ line-height: 24px;
117
+ color: white;
118
+ }
119
+ /deep/.el-pagination.is-background .el-pager li:not(.disabled).active{
120
+ background: #366AFF;
121
+
122
+ }
123
+ /deep/.el-pagination button:disabled{
124
+ i{
125
+ cursor: no-drop;
126
+ }
127
+ }
128
+ }
129
+ </style>
@@ -52,10 +52,11 @@ if (pdfjsLib) {
52
52
  // 'pdfjs-dist/build/pdf.worker';
53
53
  }
54
54
  const { TextLayerBuilder } = window['pdfjs-dist/web/pdf_viewer']
55
+ const CSS_UNITS = 96.0 / 72.0
55
56
  // import { zoomElement } from '../assets/js/hammer'
56
57
  export default {
57
58
  name: 'pdfView',
58
- props: ['tagIds', 'isMessageRecord','textWatermarkStr'],
59
+ props: ['tagIds', 'isMessageRecord','fileName', "knowledgeItem",'textWatermarkStr'],
59
60
  data () {
60
61
  return {
61
62
  url: '',
@@ -102,6 +103,7 @@ export default {
102
103
  },
103
104
  isTouchMoved: false,
104
105
  transformSalce: null,
106
+ defaultTransform:0.8,
105
107
  isPC: false,
106
108
  handScale: 'auto',
107
109
  scaleList: [],
@@ -262,12 +264,12 @@ export default {
262
264
  const { pdfPage, pageNo, dom } = page;
263
265
  // dom 元素已存在,无须重新渲染,直接返回
264
266
  if ((dom && dom.children.length != 0) || page.loading) {
265
- return;
267
+ return;
266
268
  }
267
269
  page.loading = true
268
270
  const viewport = pdfPage.getViewport({
269
- scale: this.scale,
270
- rotation: this.rotation,
271
+ scale: this.scale,
272
+ rotation: this.rotation,
271
273
  });
272
274
  // 创建新的canvas
273
275
  const canvas = document.createElement('canvas');
@@ -316,32 +318,34 @@ export default {
316
318
  rectdom.style.top = 0
317
319
  rectdom.style.left = 0
318
320
  rectdom.classList.add('rectdom')
319
- for (let index = 0; index < lines.length; index++) {
321
+ if (lines){
322
+ for (let index = 0; index < lines.length; index++) {
320
323
  if (!/^\s+$/g.test(lines[index].content)) {
321
- let postionArr = lines[index].location
322
- let div = document.createElement('div')
323
- div.style.position = 'absolute';
324
- div.style.left = postionArr[0] * this.scale + 'px',
325
- // 后端返回的坐标有基线对齐的问题,top 值是后端算好(基线top - 文字高度),在此加上文字高度的 1/9 (大致比例)为实际展示出文字的top值
326
- div.style.top = postionArr[1] * this.scale + 'px'
327
- div.style.height = postionArr[3] * this.scale + 'px';
328
- div.style.width = postionArr[2] * this.scale + 'px'
329
- div.style.backgroundColor = 'rgba(54, 106, 255, 0.3)'
330
- div.classList.add('lineHeight')
331
- rectdom.appendChild(div)
332
- if (index == 0 && j == 0) {
333
- if (this.transformSalce !== null) {
334
- rectdomTop = postionArr[1] * this.scale * this.transformSalce
335
- } else {
336
- rectdomTop = postionArr[1] * this.scale
337
- }
338
- // if(this.isPC) {
339
- // rectdomTop = rectdomTop - 50 < 0 ? 0 : rectdomTop - 50
340
- // }
324
+ let postionArr = lines[index].location
325
+ let div = document.createElement('div')
326
+ div.style.position = 'absolute';
327
+ div.style.left = postionArr[0] * this.scale + 'px',
328
+ // 后端返回的坐标有基线对齐的问题,top 值是后端算好(基线top - 文字高度),在此加上文字高度的 1/9 (大致比例)为实际展示出文字的top值
329
+ div.style.top = postionArr[1] * this.scale + 'px'
330
+ div.style.height = postionArr[3] * this.scale + 'px';
331
+ div.style.width = postionArr[2] * this.scale + 'px'
332
+ div.style.backgroundColor = 'rgba(54, 106, 255, 0.3)'
333
+ div.classList.add('lineHeight')
334
+ rectdom.appendChild(div)
335
+ if (index == 0 && j == 0) {
336
+ if (this.transformSalce !== null) {
337
+ rectdomTop = postionArr[1] * this.scale * this.transformSalce
338
+ } else {
339
+ rectdomTop = postionArr[1] * this.scale
341
340
  }
341
+ // if(this.isPC) {
342
+ // rectdomTop = rectdomTop - 50 < 0 ? 0 : rectdomTop - 50
343
+ // }
344
+ }
342
345
  }
346
+ }
343
347
  }
344
- if (rectdom.children.length > 0) {
348
+ if (rectdom.children && rectdom.children.length > 0) {
345
349
  pageDom.appendChild(rectdom)
346
350
  }
347
351
  }
@@ -358,6 +362,10 @@ export default {
358
362
  page.dom = await pageDom;
359
363
  page.loading = false
360
364
  this.contentView.appendChild(pageDom);
365
+ let pdf_view = document.getElementsByClassName('pdf_view');
366
+ if (pdf_view && pdf_view[0]){
367
+ pdf_view[0].style.backgroundImage = 'none'
368
+ }
361
369
  if (this.transformSalce !== null) {
362
370
  this.contentView.style.transform = `scale(${this.transformSalce}, ${this.transformSalce})`
363
371
  }
@@ -424,7 +432,7 @@ export default {
424
432
  startNum = Math.ceil(scrollTop / (that.pageSize.height + that.PAGE_INTVERVAL))
425
433
  endNum = startNum + Math.ceil(height / (that.pageSize.height + that.PAGE_INTVERVAL))
426
434
  }
427
- for (let pageIndex = startNum; pageIndex < endNum; pageIndex++) {
435
+ for (let pageIndex = startNum; pageIndex <= endNum; pageIndex++) {
428
436
  if (pageIndex > 0 && pageIndex <= that.pages.length) {
429
437
  that.loadPdfData(pageIndex)
430
438
  }
@@ -668,14 +676,20 @@ export default {
668
676
  // this.currentPageAllLine[i].allLines.lines.push(item.extractInfo.lines)
669
677
  this.currentPageAllLine[i].allLines.push({
670
678
  pageCount: index,
671
- lines: item.extractInfo.lines
679
+ lines: item.extractInfo.lines ? item.extractInfo.lines : [{
680
+ content:"测试内容填充,不必理会",
681
+ location:item.extractInfo.location
682
+ }]
672
683
  })
673
684
  } else {
674
685
  this.currentPageAllLine.push({
675
686
  page: item.page,
676
687
  allLines: [{
677
688
  pageCount: index,
678
- lines: item.extractInfo.lines
689
+ lines: item.extractInfo.lines ? item.extractInfo.lines : [{
690
+ content:"测试内容填充,不必理会",
691
+ location:item.extractInfo.location
692
+ }]
679
693
  }],
680
694
  })
681
695
  }
@@ -817,6 +831,164 @@ export default {
817
831
  this.contentView.style.transform = 'scale(' + this.transformSalce + ')';
818
832
  // this.getpdfResloutePage(this.cachePdf[0])
819
833
  },
834
+ //添加水印
835
+ watermark() {
836
+ //默认设置
837
+ var defaultSettings = {
838
+ watermark_txt:"",
839
+ watermark_x: 0,//水印起始位置x轴坐标
840
+ watermark_y: 0,//水印起始位置Y轴坐标
841
+ watermark_rows: 0,//水印行数
842
+ watermark_cols: 0,//水印列数
843
+ watermark_x_space: 40,//水印x轴间隔
844
+ watermark_y_space: 60,//水印y轴间隔
845
+ watermark_color: 'black',//水印字体颜色
846
+ watermark_alpha: .3,//水印透明度
847
+ watermark_fontsize: 12,//水印字体大小
848
+ watermark_font: '微软雅黑',//水印字体
849
+ watermark_width: 100,//水印宽度
850
+ watermark_height: 80,//水印长度
851
+ watermark_angle: 20,//水印倾斜度数***
852
+ visitorWatermark_txt:""
853
+ };
854
+ if(this.knowledgeItem.textWatermarkValue){
855
+ defaultSettings.watermark_txt = this.knowledgeItem.textWatermarkValue;
856
+ }
857
+ if (this.knowledgeItem.visitorWatermarkValue){
858
+ defaultSettings.visitorWatermark_txt = this.knowledgeItem.visitorWatermarkValue
859
+ }
860
+ //采用配置项替换默认值,作用类似jquery.extend
861
+ if (arguments.length === 1 && typeof arguments[0] === "object") {
862
+ console.log("arguments = " + JSON.stringify(arguments[0]));
863
+ // 获取参数配置
864
+ var src = arguments[0];
865
+ for (let key in src) {
866
+ if (src[key] && defaultSettings[key] && src[key] === defaultSettings[key])
867
+ continue;
868
+ else if (src[key])
869
+ defaultSettings[key] = src[key];
870
+ }
871
+ }
872
+ var oTemp = document.createDocumentFragment();
873
+ //获取页面最大宽度
874
+ console.debug('pdf_view',document.getElementById('pdf_view'))
875
+ let scrollWidth = document.getElementById('pdf_view').scrollWidth;
876
+ let clientWidth = document.getElementById('pdf_view').clientWidth;
877
+ var page_width = Math.max(scrollWidth, clientWidth);
878
+
879
+ var cutWidth = page_width * 0.0150;
880
+
881
+ page_width = page_width - cutWidth;
882
+
883
+ //获取页面最大高度
884
+ let height = parseInt(this.totalPageCount * this.pageSize.height)
885
+ var page_height = Math.max(document.getElementById('pdf_container_view').scrollHeight,height);
886
+
887
+ console.debug('page_height',page_height,this.totalPageCount * this.pageSize.height);
888
+
889
+ // var page_height = document.body.scrollHeight+document.body.scrollTop;
890
+
891
+ //如果将水印列数设置为0,或水印列数设置过大,超过页面最大宽度,则重新计算水印列数和水印x轴间隔
892
+
893
+ if (defaultSettings.watermark_cols == 0 || (parseInt(defaultSettings.watermark_x + defaultSettings
894
+ .watermark_width * defaultSettings.watermark_cols + defaultSettings.watermark_x_space *
895
+ (defaultSettings.watermark_cols - 1)) > page_width)) {
896
+ defaultSettings.watermark_cols = parseInt((page_width - defaultSettings.watermark_x + defaultSettings
897
+ .watermark_x_space) / (defaultSettings.watermark_width + defaultSettings
898
+ .watermark_x_space));
899
+ defaultSettings.watermark_x_space = parseInt((page_width - defaultSettings.watermark_x -
900
+ defaultSettings
901
+ .watermark_width * defaultSettings.watermark_cols) / (defaultSettings.watermark_cols - 1));
902
+ }
903
+
904
+ //如果将水印行数设置为0,或水印行数设置过大,超过页面最大长度,则重新计算水印行数和水印y轴间隔
905
+
906
+ if (defaultSettings.watermark_rows == 0 || (parseInt(defaultSettings.watermark_y + defaultSettings
907
+
908
+ .watermark_height * defaultSettings.watermark_rows + defaultSettings.watermark_y_space * (
909
+
910
+ defaultSettings.watermark_rows - 1)) > page_height)) {
911
+
912
+ defaultSettings.watermark_rows = parseInt((defaultSettings.watermark_y_space + page_height -
913
+
914
+ defaultSettings
915
+
916
+ .watermark_y) / (defaultSettings.watermark_height + defaultSettings.watermark_y_space));
917
+
918
+ defaultSettings.watermark_y_space = parseInt(((page_height - defaultSettings.watermark_y) -
919
+
920
+ defaultSettings
921
+
922
+ .watermark_height * defaultSettings.watermark_rows) / (defaultSettings.watermark_rows - 1));
923
+
924
+ }
925
+
926
+ var x;
927
+
928
+ var y;
929
+
930
+ for (var i = 0; i < defaultSettings.watermark_rows; i++) {
931
+ y = defaultSettings.watermark_y + (defaultSettings.watermark_y_space + defaultSettings.watermark_height) * i;
932
+ for (var j = 0; j < defaultSettings.watermark_cols; j++) {
933
+ x = defaultSettings.watermark_x + (defaultSettings.watermark_width + defaultSettings.watermark_x_space) * j;
934
+
935
+ var mask_div = document.createElement('div');
936
+ mask_div.id = 'mask_div' + i + j;
937
+ mask_div.className = 'mask_div';
938
+
939
+ //注意看这里加了图片水印
940
+ mask_div.style.webkitTransform = "rotate(-" + defaultSettings.watermark_angle + "deg)";
941
+ mask_div.style.MozTransform = "rotate(-" + defaultSettings.watermark_angle + "deg)";
942
+ mask_div.style.msTransform = "rotate(-" + defaultSettings.watermark_angle + "deg)";
943
+ mask_div.style.OTransform = "rotate(-" + defaultSettings.watermark_angle + "deg)";
944
+ mask_div.style.transform = "rotate(-" + defaultSettings.watermark_angle + "deg)";
945
+ mask_div.style.visibility = "";
946
+ mask_div.style.position = "absolute";
947
+ //奇偶行错开,这样水印就不对齐,显的不呆板
948
+ console.debug('x',x)
949
+ if (i % 2 != 0) {
950
+ mask_div.style.left = x + 'px';
951
+ if (j % 2 != 0 && this.knowledgeItem.visitorWatermarkValue){
952
+ mask_div.appendChild(document.createTextNode(defaultSettings.visitorWatermark_txt));
953
+ } else {
954
+ if (!this.knowledgeItem.textWatermarkValue){
955
+ mask_div.appendChild(document.createTextNode(defaultSettings.visitorWatermark_txt));
956
+ } else {
957
+ mask_div.appendChild(document.createTextNode(defaultSettings.watermark_txt));
958
+ }
959
+ }
960
+ } else {
961
+ mask_div.style.left = x + 'px';
962
+ if (j % 2 != 0 && this.knowledgeItem.textWatermarkValue){
963
+ mask_div.appendChild(document.createTextNode(defaultSettings.watermark_txt));
964
+ } else {
965
+ if (!this.knowledgeItem.visitorWatermarkValue){
966
+ mask_div.appendChild(document.createTextNode(defaultSettings.watermark_txt));
967
+ } else {
968
+ mask_div.appendChild(document.createTextNode(defaultSettings.visitorWatermark_txt));
969
+ }
970
+ }
971
+ }
972
+
973
+ mask_div.style.top = y + 'px';
974
+ mask_div.style.overflow = "hidden";
975
+ mask_div.style.zIndex = "9999";
976
+ mask_div.style.pointerEvents = 'none'; //让水印不遮挡页面的点击事件
977
+ mask_div.style.opacity = defaultSettings.watermark_alpha;
978
+ mask_div.style.fontSize = defaultSettings.watermark_fontsize;
979
+ mask_div.style.fontFamily = defaultSettings.watermark_font;
980
+ mask_div.style.color = defaultSettings.watermark_color;
981
+ mask_div.style.textAlign = "center";
982
+ mask_div.style.width = defaultSettings.watermark_width + 'px';
983
+ mask_div.style.height = defaultSettings.watermark_height + 'px';
984
+ mask_div.style.display = "block";
985
+ oTemp.appendChild(mask_div);
986
+ }
987
+ }
988
+ let pageDom = document.getElementById('pdf_container_view')
989
+ pageDom.appendChild(oTemp);
990
+
991
+ },
820
992
  },
821
993
  computed: {
822
994
  perviewUrl () {
@@ -844,16 +1016,18 @@ export default {
844
1016
  if (value && value.length) {
845
1017
  // 在 pdf_view 下创建 所有canvs的容器
846
1018
  this.contentView = document.createElement('div')
1019
+ this.contentView.setAttribute('id','contentView')
847
1020
  this.contentView.style.transformOrigin = '0px 0px 0px'
848
1021
  this.contentView.setAttribute('id','contentView');
849
- this.$http.get('/knowledge-api/knowledge/knowledge-part-location-info/list?ids=' + value.join(',')).then(res => {
1022
+
1023
+ this.$http.get('/knowledge-api/knowledge/knowledge-part-location-info/list?ids=' + value.join(',')).then(res => {
850
1024
  // 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}
851
1025
  // 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}
852
1026
  // 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}
853
1027
  // res.data = {"data":[{"id":"6475eab868110215ab821a80","knowledgeId":"6475e7eac724c54c46cbfa2d","mainId":"5ecf2fcd704541149201ab9c1c31162d","page":0,"total":1,"pageHeight":0.0,"pageWidth":0.0,"publicPageFileUrl":"https://askbot-pdf-all.oss-cn-zhangjiakou.aliyuncs.com/5ecf2fcd704541149201ab9c1c31162d/2023/05/30/08/23/20/6475eab63339db423f26b196/0.html","extractInfo":{"location":null,"content":"产品:系统配置,产品型号:存储,VX30:4G+16G,VX50:16G+256G","lines":null,"tagId":"6475eab868110215ab821a80"}}],"code":"0","msg":null,"traceId":null}
854
1028
  // res.data = {"data":[{"id":"6475e9393339db423f26af01","knowledgeId":"6475e44fc724c54c46cbfa21","mainId":"5ecf2fcd704541149201ab9c1c31162d","page":2,"total":2,"pageHeight":510.25,"pageWidth":1559.05,"publicPageFileUrl":"https://askbot-pdf-all.oss-cn-zhangjiakou.aliyuncs.com/5ecf2fcd704541149201ab9c1c31162d/2023/05/30/08/00/29/6475e55d3339db423f26a9b8/2.pdf","extractInfo":{"location":[327.70532,288.0498,414.9734,12.241608],"content":"三、指示灯状态说明1.白色常亮:开机/开机中2.红色常亮:待机3.白色呼吸:息屏4.红色闪烁:升级1.LAN:通过网线连接到主机的Camera端口2.电源开关:电源切换开关","lines":[{"content":"三、指示灯状态说明","location":[634.3203,288.0498,108.3584,12.0]},{"content":"1.白色常亮:开机/开机中","location":[634.3203,320.08978,108.23407,9.0]},{"content":"2.红色常亮:待机","location":[634.3204,341.3298,78.597046,9.0]},{"content":"3.白色呼吸:息屏","location":[634.32043,362.45282,78.597046,9.0]},{"content":"4.红色闪烁:升级","location":[634.3205,383.6928,78.597046,9.0]},{"content":"1.LAN:通过网线连接到主机的","location":[327.70535,291.2914,144.35995,9.0]},{"content":"Camera端口","location":[327.70532,306.88843,55.322998,9.0]},{"content":"2.电源开关:电源切换开关","location":[482.74832,291.2914,105.36301,9.0]}],"tagId":null}}],"code":"0","msg":null,"traceId":null}
855
1029
  // if(value.length === 1) {
856
- // this.$refs.pdfView.style.height = 'calc(100% - 50px)'
1030
+ // this.$refs.pdfView.style.height = 'calc(100% - 50px)'
857
1031
  // }
858
1032
  // res.data = {
859
1033
  // "data": [
@@ -1028,18 +1202,23 @@ export default {
1028
1202
  "Content-Type": "application/json",
1029
1203
  },
1030
1204
  }).then(res => {
1031
- // 使用原声请求方式 axios会带有不需要的请求头
1205
+ // 使用原声请求方式 axios会带有不需要的请求头
1032
1206
  let xhr = new XMLHttpRequest();
1033
1207
  xhr.open('GET', res.data || res.bodyText, true);
1034
1208
  // 定义请求完成的处理函数,请求前也可以增加加载框/禁用下载按钮逻辑
1035
1209
  xhr.onload = ({ currentTarget }) => {
1036
1210
  // 请求完成
1037
1211
  if (currentTarget.status === 200) { // 返回200
1212
+ let pdf_view = document.getElementsByClassName('pdf_view');
1213
+ if (pdf_view && pdf_view[0]){
1214
+ pdf_view[0].style.backgroundImage = 'none'
1215
+ }
1038
1216
  this.contentView.innerHTML = currentTarget.response
1039
1217
  this.contentView.style.padding = '10px'
1040
1218
  // this.contentView.style.position = 'relative'
1041
1219
  this.$refs.pdfView.style.backgroundColor = '#FFFFFF'
1042
1220
  this.$refs.pdfView.appendChild(this.contentView)
1221
+
1043
1222
  let allTr = Array.from(this.$refs.pdfView.getElementsByTagName('tr'))
1044
1223
  this.allTr = []
1045
1224
  for (let index = 0; index < allTr.length; index++) {
@@ -1115,6 +1294,7 @@ export default {
1115
1294
  // height: calc(100% - 110px);
1116
1295
  height: 100%;
1117
1296
  overflow: auto;
1297
+ //overflow-y: scroll;
1118
1298
  background-color: #f5f7fb;
1119
1299
  // margin-bottom: 60px;
1120
1300
  box-sizing: border-box;
@@ -1340,4 +1520,4 @@ export default {
1340
1520
  100% {
1341
1521
  background: rgba(255, 136, 0, 0.3);
1342
1522
  }
1343
- }</style>
1523
+ }</style>
@@ -0,0 +1,114 @@
1
+ <template>
2
+ <div class="docView">
3
+ <div class="docHtml"
4
+ ref="docHtml"
5
+ v-html="html"
6
+ @click="selectDiv"
7
+ >
8
+ </div>
9
+ </div>
10
+ </template>
11
+
12
+ <script>
13
+ export default {
14
+ name: "docView",
15
+ data(){
16
+ return{
17
+ colors: ['#E3EBFF', '#FFF5DC', '#FFE8D8','#D6F3EA','#FFF1C3'],
18
+ html:"",
19
+ }
20
+ },
21
+ props:{
22
+ html_result:{
23
+ type:String,
24
+ default:""
25
+ },
26
+ split_paragraphs:{
27
+ type:Array,
28
+ default(){
29
+ return []
30
+ }
31
+ },
32
+ fileSuffix:{
33
+ type:String,
34
+ default:""
35
+ }
36
+ },
37
+ methods:{
38
+ selectDiv(e){
39
+ this.$emit('selectDiv',e)
40
+ },
41
+ getHtml(){
42
+ // let url = 'https://guoranwisdom.oss-cn-zhangjiakou.aliyuncs.com/123/2024/12/09/14/18/17/123/%E5%85%AC%E5%8F%B8%E5%91%98%E5%B7%A5%E6%89%8B%E5%86%8C_1733725097.html'
43
+ let url = this.html_result
44
+ this.$http.get(url).then(res => {
45
+ this.html = res.data;
46
+ let drawer = document.getElementById('drawer_content_pre')
47
+ if (drawer){
48
+ drawer.style.backgroundImage = 'none';
49
+ drawer.style.overflowX = 'hidden'
50
+ }
51
+ this.$nextTick(() => {
52
+ this.setColor()
53
+ })
54
+ })
55
+ },
56
+ setColor(){
57
+ this.split_paragraphs.forEach((item,index) => {
58
+ const colorIndex = index % this.colors.length;
59
+ if (item.original_paragraph){
60
+ item.original_paragraph.forEach(items => {
61
+ let dom = document.getElementById(items.paragraph_id);
62
+ if (this.fileSuffix === 'TXT'){
63
+ const paragraphs = this.$el.querySelectorAll(`[paragraph-id="${items.paragraph_id}"]`);
64
+ paragraphs.forEach(paragraph => {
65
+ paragraph.style.background = this.colors[colorIndex]
66
+ })
67
+ } else if (dom){
68
+ dom.style.background = this.colors[colorIndex];
69
+ }
70
+ })
71
+ let newOriginal = item.original_paragraph.filter(items => !items.type)
72
+ let dom = document.getElementById(newOriginal[newOriginal.length - 1].paragraph_id);
73
+ if (dom){
74
+ dom.style.marginBottom = '8px';
75
+ }
76
+ }
77
+ if (item.tableId){
78
+ let dom = document.getElementById(item.tableId);
79
+ if (dom){
80
+ dom.style.backgroundColor = this.colors[colorIndex]
81
+ }
82
+ }
83
+ })
84
+ setTimeout(() => {
85
+ this.$parent.scrollToParagraph('first')
86
+ },500)
87
+ },
88
+ },
89
+ watch:{
90
+ html_result:{
91
+ handler(){
92
+ if (this.html_result){
93
+ this.getHtml();
94
+ }
95
+ },
96
+ immediate:true
97
+ }
98
+ }
99
+ };
100
+ </script>
101
+
102
+ <style scoped lang="less">
103
+ .docView{
104
+ width: 100%;
105
+ flex: none;
106
+ box-sizing: border-box;
107
+ div{
108
+ position: relative;
109
+ }
110
+ /deep/img{
111
+ max-width: 100%;
112
+ }
113
+ }
114
+ </style>