askbot-dragon 1.7.44-beta → 1.7.46-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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "askbot-dragon",
3
- "version": "1.7.44-beta",
3
+ "version": "1.7.46-beta",
4
4
  "scripts": {
5
5
  "serve": "vue-cli-service serve",
6
6
  "build": "vue-cli-service build",
package/public/index.html CHANGED
@@ -26,7 +26,7 @@
26
26
  <!-- 项目图标 -->
27
27
  <link rel="stylesheet" href="//at.alicdn.com/t/c/font_2913049_ee8dx548hg.css"/>
28
28
  <!-- iconfont图标 -->
29
- <link rel="stylesheet" href="//at.alicdn.com/t/c/font_2913049_mfmhkqumc7i.css"/>
29
+ <link rel="stylesheet" href="//at.alicdn.com/t/c/font_2913049_eje81c90ujh.css"/>
30
30
  <script src="https://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
31
31
  <!-- aliyun-oss -->
32
32
  <script src="https://static.guoranbot.com/cdn-common/alyun-oss/aliyun-oss-sdk-6.17.1.min.js"></script>
@@ -353,6 +353,10 @@ export default {
353
353
  // } else {
354
354
  // this.$refs.previewPdf.drawer = false;
355
355
  // }
356
+ //该事件是为了打开新的弹框时关闭上一个弹框
357
+ window.parent.postMessage({
358
+ data: "close_drawer"
359
+ }, "*");
356
360
  this.title = item.from || item.name
357
361
  this.folderName = item.folderName
358
362
  this.folderUrl = item.folderUrl
@@ -422,7 +426,7 @@ export default {
422
426
  this.$refs.previewPdf.getBolb(item)
423
427
  }
424
428
  this.$refs.previewPdf.loadIframe(item)
425
- this.$refs.previewPdf.showSummary = true;
429
+ this.$refs.previewPdf.showSummary = false;
426
430
  })
427
431
  }
428
432
  })
@@ -131,7 +131,9 @@ export default {
131
131
  let dom = document.getElementsByClassName('setBgClass' + id);
132
132
  console.log('dom',dom)
133
133
  if (dom && dom.length > 0){
134
- dom.forEach(doms => {
134
+ let newDom = Array.from(dom)
135
+ console.log('newDom',newDom)
136
+ newDom.forEach(doms => {
135
137
  doms.style.backgroundColor = this.colors[colorIndex];
136
138
  })
137
139
  }
@@ -14,7 +14,7 @@
14
14
  :excelRowList="excelRowList"
15
15
  :tableChunkData="tableChunkData"
16
16
  ></excel-view>
17
- <pdf-view v-else-if="fileType === 'PDF'" ref="pdfView" :split_paragraphs="splitParagraph" :ossPath="url"></pdf-view>
17
+ <pdf-view v-else-if="fileType === 'PDF'" ref="pdfView" :split_paragraphs="splitParagraph" :ossPath="url" :isPC="isPC"></pdf-view>
18
18
  </div>
19
19
  <template v-if="splitParagraph.length > 1 && fileType !== 'XLS' && fileType !== 'XLSX'">
20
20
  <div class="btn_footer" v-if="!isPC">
@@ -104,10 +104,14 @@ export default {
104
104
  }
105
105
  this.fileType = res.data.data.fileType
106
106
  }
107
- if (this.fileType === 'XLS' || this.fileType === 'XLSX'){
108
- let dom = document.getElementById('drawer_content_pre');
109
- dom.style.height = 'calc(100% - 90px)'
110
- }
107
+ this.$nextTick(() => {
108
+ if (this.fileType === 'XLS' || this.fileType === 'XLSX'){
109
+ let dom = document.getElementById('drawer_content_pre');
110
+ if (dom){
111
+ dom.style.height = 'calc(100% - 90px)'
112
+ }
113
+ }
114
+ })
111
115
  })
112
116
  },
113
117
  currentChange (value) {
@@ -140,10 +144,14 @@ export default {
140
144
  } else if (this.fileType == 'DOC' || this.fileType == 'DOCX' || this.fileType == 'TXT'){
141
145
  if (this.splitParagraph[this.currentPage] && this.splitParagraph[this.currentPage].original_paragraph){
142
146
  const id = this.splitParagraph[this.currentPage].original_paragraph[0].paragraph_id;
143
- const dom = document.getElementById(id);
147
+ let dom = document.getElementById(id);
148
+ const paragraphs = this.$el.querySelectorAll(`[paragraph-id="${this.splitParagraph[this.currentPage].original_paragraph[0].paragraph_id}"]`);
144
149
  if (dom){
145
150
  dom.scrollIntoView({ behavior: 'smooth' });
146
151
  }
152
+ if (paragraphs && paragraphs.length > 0){
153
+ paragraphs[0].scrollIntoView({ behavior: 'smooth' })
154
+ }
147
155
  if (type === 'first'){
148
156
  if (dom){
149
157
  dom.classList.add('animation')
@@ -151,6 +159,12 @@ export default {
151
159
  dom.classList.remove('animation')
152
160
  }, 3000)
153
161
  }
162
+ if (paragraphs && paragraphs.length > 0){
163
+ paragraphs[0].classList.add('animation')
164
+ setTimeout(() => {
165
+ paragraphs[0].classList.remove('animation')
166
+ }, 3000)
167
+ }
154
168
  } else {
155
169
  for (let i=0;i<this.splitParagraph[this.currentPage].original_paragraph.length;i++){
156
170
  const id = this.splitParagraph[this.currentPage].original_paragraph[i].paragraph_id;
@@ -162,6 +176,13 @@ export default {
162
176
  dom.classList.remove('animation')
163
177
  }, 3000)
164
178
  }
179
+ if (paragraphs && paragraphs.length > 0){
180
+ paragraphs[0].scrollIntoView({ behavior: 'smooth' });
181
+ paragraphs[0].classList.add('animation')
182
+ setTimeout(() => {
183
+ paragraphs[0].classList.remove('animation')
184
+ }, 3000)
185
+ }
165
186
  }
166
187
  }
167
188
  } else if (this.splitParagraph[this.currentPage] && this.splitParagraph[this.currentPage].tableId){
@@ -2,17 +2,26 @@
2
2
  <div class="pdfViewPage" id="pdfViewPage">
3
3
  <!-- 按钮容器 -->
4
4
  <div class="button-container" v-if="false">
5
+ <div class="change_scale">
6
+ <section @click="zoomOut">
7
+ <i class="el-icon-minus"></i>
8
+ </section>
9
+ <el-divider direction="vertical"></el-divider>
10
+ <section @click="zoomIn">
11
+ <i class="el-icon-plus"></i>
12
+ </section>
13
+ </div>
5
14
  <!-- 文件上传 -->
6
- <label for="file-upload" class="file-upload-label">
7
- 上传 PDF 文件
8
- <input
9
- id="file-upload"
10
- type="file"
11
- accept="application/pdf"
12
- @change="handleFileUpload"
13
- class="file-input"
14
- />
15
- </label>
15
+ <!-- <label for="file-upload" class="file-upload-label">-->
16
+ <!-- 上传 PDF 文件-->
17
+ <!-- <input-->
18
+ <!-- id="file-upload"-->
19
+ <!-- type="file"-->
20
+ <!-- accept="application/pdf"-->
21
+ <!-- @change="handleFileUpload"-->
22
+ <!-- class="file-input"-->
23
+ <!-- />-->
24
+ <!-- </label>-->
16
25
 
17
26
  <!-- &lt;!&ndash; 跳转按钮(已有高亮) &ndash;&gt;-->
18
27
  <!-- <button @click="jumpToHighlight" class="action-button">-->
@@ -53,6 +62,11 @@
53
62
  </div>
54
63
  </div>
55
64
  </div>
65
+
66
+ <div class="change_scale">
67
+ <i class="iconfont guoran-suoxiao1" @click="zoomOut"></i>
68
+ <i class="iconfont guoran-fangda1" @click="zoomIn"></i>
69
+ </div>
56
70
  </div>
57
71
  </template>
58
72
 
@@ -64,6 +78,8 @@ if(pdfjsLib) {
64
78
  pdfjsLib.GlobalWorkerOptions.workerSrc = window['pdfjs-dist/build/pdf.worker']
65
79
  }
66
80
  const { TextLayerBuilder } = window['pdfjs-dist/web/pdf_viewer']
81
+
82
+ import Vue from 'vue';
67
83
  export default {
68
84
  name: "PdfViewer",
69
85
  data() {
@@ -101,6 +117,10 @@ export default {
101
117
  ossPath:{
102
118
  type:String,
103
119
  default:""
120
+ },
121
+ isPC:{
122
+ type:Boolean,
123
+ default:true
104
124
  }
105
125
  },
106
126
  methods: {
@@ -170,7 +190,7 @@ export default {
170
190
  await this.initPdf();
171
191
  this.initObserver();
172
192
  },
173
- initObserver() {
193
+ initObserver(type) {
174
194
  if (this.observer) {
175
195
  this.observer.disconnect();
176
196
  }
@@ -203,15 +223,17 @@ export default {
203
223
  }
204
224
  });
205
225
  },300)
206
- setTimeout(async () => {
207
- let currentPage = this.split_paragraphs[0];
208
- let page = 1;
209
- if (currentPage){
210
- page = currentPage.original_paragraph[0].page
211
- }
212
- await this.loadPage(page);
213
- this.jumpToHighlight(0);
214
- },1300)
226
+ if (type !== 'changeScale' && type !== 'onResize'){
227
+ setTimeout(async () => {
228
+ let currentPage = this.split_paragraphs[0];
229
+ let page = 1;
230
+ if (currentPage){
231
+ page = currentPage.original_paragraph[0].page
232
+ }
233
+ await this.loadPage(page);
234
+ this.jumpToHighlight(0);
235
+ },1300)
236
+ }
215
237
  });
216
238
  },
217
239
  async loadPage(number){
@@ -251,8 +273,9 @@ export default {
251
273
  // await renderTask.promise;
252
274
  let hasDoc = document.getElementById('textLayer' + pageNumber)
253
275
  if (hasDoc){
254
- await renderTask.promise;
255
- return
276
+ hasDoc.parentNode.removeChild(hasDoc);
277
+ // await renderTask.promise;
278
+ // return
256
279
  }
257
280
  await renderTask.promise.then(() => {
258
281
  return page.getTextContent()
@@ -457,7 +480,8 @@ export default {
457
480
  this.reloadAllPages(currentScroll);
458
481
  },
459
482
  reloadAllPages(scrollPosition) {
460
- this.pages.forEach((p) => {
483
+ const pages = Vue.observable(this.pages)
484
+ pages.forEach((p) => {
461
485
  p.loaded = false;
462
486
  this.$set(p,'loading',false)
463
487
  if (p.canvas) {
@@ -469,7 +493,7 @@ export default {
469
493
  const container = this.$refs.pdfContainer;
470
494
  this.$nextTick(() => {
471
495
  container.scrollTop = scrollPosition;
472
- this.initObserver();
496
+ this.initObserver('changeScale');
473
497
  container.scrollTop = container.scrollTop + 1;
474
498
  container.scrollTop = container.scrollTop - 1;
475
499
  });
@@ -585,28 +609,27 @@ export default {
585
609
  this.scrollToHighlight(this.searchHighlights[this.currentSearchIndex]);
586
610
  },
587
611
  onResize() {
588
- this.clearPages();
589
- this.loadPdf();
590
- // clearTimeout(this.resizeTimeout);
591
- // this.resizeTimeout = setTimeout(() => {
592
- // if (this.renderInProgress) return;
593
- // const container = this.$refs.pdfContainer;
594
- // const currentScroll = container.scrollTop;
595
- // this.pages.forEach((p) => {
596
- // p.loaded = false;
597
- // this.$set(p,'loading',false)
598
- // if (p.canvas) {
599
- // const ctx = p.canvas.getContext('2d');
600
- // ctx.clearRect(0,0,p.canvas.width,p.canvas.height);
601
- // }
602
- // });
603
- // this.$nextTick(() => {
604
- // container.scrollTop = currentScroll;
605
- // this.initObserver();
606
- // container.scrollTop = container.scrollTop + 1;
607
- // container.scrollTop = container.scrollTop - 1;
608
- // });
609
- // }, 300);
612
+ clearTimeout(this.resizeTimeout);
613
+ this.resizeTimeout = setTimeout(() => {
614
+ if (this.renderInProgress) return;
615
+ const container = this.$refs.pdfContainer;
616
+ const currentScroll = container.scrollTop;
617
+ const pages = Vue.observable(this.pages)
618
+ pages.forEach((p) => {
619
+ p.loaded = false;
620
+ this.$set(p,'loading',false)
621
+ if (p.canvas) {
622
+ const ctx = p.canvas.getContext('2d');
623
+ ctx.clearRect(0,0,p.canvas.width,p.canvas.height);
624
+ }
625
+ });
626
+ this.$nextTick(() => {
627
+ container.scrollTop = currentScroll;
628
+ this.initObserver('onResize');
629
+ container.scrollTop = container.scrollTop + 1;
630
+ container.scrollTop = container.scrollTop - 1;
631
+ });
632
+ }, 300);
610
633
  },
611
634
  },
612
635
  async mounted() {
@@ -658,7 +681,7 @@ export default {
658
681
  gap: 10px;
659
682
  height: 100%;
660
683
  overflow-y: auto;
661
- overflow-x: hidden;
684
+ overflow-x: auto;
662
685
  margin: 0 auto;
663
686
  position: relative;
664
687
  border-radius: 10px;
@@ -679,10 +702,12 @@ export default {
679
702
  position: relative;
680
703
  display: flex;
681
704
  justify-content: center;
705
+ width: 100%;
682
706
  }
683
707
 
684
708
  .canvas-wrapper {
685
709
  position: relative;
710
+ width: 100%;
686
711
  }
687
712
 
688
713
  /* 在loading时覆盖canvas显示加载动画 */
@@ -716,12 +741,51 @@ canvas {
716
741
 
717
742
  .button-container {
718
743
  display: flex;
719
- flex-wrap: wrap;
720
- gap: 10px;
721
- margin: 10px 0;
722
744
  justify-content: center;
723
745
  }
746
+ .change_scale {
747
+ height: 80px;
748
+ //padding: 10px;
749
+ width: 32px;
750
+ border-top-left-radius: 20px;
751
+ border-bottom-left-radius: 20px;
752
+ position: absolute;
753
+ right: 0;
754
+ top: calc(50% - 40px);
755
+ //top: 50px;
756
+ //margin-bottom: 10px;
757
+ //left: 0;
758
+ background: #ffffff;
759
+ border: 1px solid #A1B9FF;
760
+ display: flex;
761
+ flex-direction: column;
762
+ align-items: center;
763
+ justify-content: space-evenly;
764
+ //padding: 0 10px;
765
+ box-sizing: border-box;
766
+ i{
767
+ color: #366aff;
768
+ font-size: 20px;
769
+ }
770
+ section {
771
+ cursor: pointer;
772
+ width: 30px;
773
+ height: 30px;
774
+ margin-right: 5px;
775
+ border-radius: 5px;
776
+ display: flex;
777
+ align-items: center;
778
+ justify-content: center;
779
+
780
+ i {
781
+ font-weight: 900;
782
+ }
783
+ }
724
784
 
785
+ section:hover {
786
+ background: rgba(221, 222, 223, 1);
787
+ }
788
+ }
725
789
  .search-nav {
726
790
  display: flex;
727
791
  align-items: center;
@@ -9,28 +9,38 @@
9
9
  :modal="formKnowledgeManagement ? true : false" :direction="previewShowPopup ? 'btt' : 'rtl'" :size="previewShowPopup ? '90%' : '65%'"
10
10
  custom-class="pdf-preview-drawer" v-if="drawer">
11
11
  <!-- v-else-if="drawer" -->
12
- <div class="drawer-header" :class="isLiBang ? 'libang_head' : ''" v-if="!isPc">
13
- <div class="header-btn btn_position">
14
- <div class="onload_btn" v-if="isDownload" @click="downLoad">
15
- 下载
16
- </div>
17
- <div class="summaryBtn" :class="showSummary ? 'summaryActiveBtn' : ''" @click="summaryFun" v-if="isHasChat">
18
- <i class="iconfont guoran-tongyichicun-write-29-jiqiren"></i>
19
- <span>智能摘要</span>
20
- </div>
21
- <template v-if="isHasChat">
22
- <div class="chat" @click="previewToDialog(true)" v-if="!previewKnowledgeId">
23
- <i class="iconfont guoran-wendapingjia"></i>
24
- 聊一聊
25
- </div>
26
- <div class="chat chat_active" @click="previewToDialog(false)" v-else>
27
- <i class="iconfont guoran-wendapingjia"></i>
28
- 聊一聊
12
+ <div class="drawer-header" :class="(isDownload || isHasChat) && isLiBang ? 'has_btn_libang_head' : (isLiBang ? 'libang_head' : (isDownload || isHasChat ? 'has_btn_head' : ''))" v-if="!isPc">
13
+ <div class="header_title">
14
+ <template v-if="isDownload || isHasChat">
15
+ <div class="top-header">
16
+ <div class="header-btn">
17
+ <div class="onload_btn" v-if="isDownload" @click="downLoad">
18
+ 下载
19
+ </div>
20
+ <div class="summaryBtn" :class="showSummary ? 'summaryActiveBtn' : ''" @click="summaryFun" v-if="isHasChat">
21
+ <i class="iconfont guoran-tongyichicun-write-29-jiqiren"></i>
22
+ <span>智能摘要</span>
23
+ </div>
24
+ <template v-if="isHasChat">
25
+ <div class="chat" @click="previewToDialog(true)" v-if="!previewKnowledgeId">
26
+ <i class="iconfont guoran-wendapingjia"></i>
27
+ 聊一聊
28
+ </div>
29
+ <div class="chat chat_active" @click="previewToDialog(false)" v-else>
30
+ <i class="iconfont guoran-wendapingjia"></i>
31
+ 聊一聊
32
+ </div>
33
+ </template>
34
+ </div>
35
+ <section @click="close">
36
+ <i class="iconfont guoran-shanchu"></i>
37
+ </section>
29
38
  </div>
39
+ <span class="title_left">
40
+ {{ title ? title : "查看详情" }}
41
+ </span>
30
42
  </template>
31
- </div>
32
- <div class="header_title">
33
- <div class="header_close">
43
+ <div class="header_close" v-else>
34
44
  <span class="title_left">
35
45
  {{ title ? title : '查看详情' }}
36
46
  </span>
@@ -116,7 +126,7 @@
116
126
  <template v-else>
117
127
  <iframe class="preview_iframe_kk" :src="previewUrl" style="border:none;"
118
128
  :style="{ height: iframeHeight }"></iframe>
119
- <template v-if="(newFileType === 'PPT' && pageChunkData.length > 1)">
129
+ <template v-if="!loading && (newFileType === 'PPT' && pageChunkData.length > 1)">
120
130
  <div class="btn_footer" v-if="!isPc">
121
131
  <div class="prev" @click="prev">上一段</div>
122
132
  <div class="next" @click="next">下一段</div>
@@ -557,6 +567,7 @@ export default {
557
567
  this.newVersion = "";
558
568
  this.$http.get('/knowledge-api/knowledge/knowledge-part-location-info/list?ids=' + this.tagIds.join(',')).then(res => {
559
569
  console.log('getLocationInfo',res)
570
+ this.pageChunkData = [];
560
571
  if (res.data.code == 0){
561
572
  if (res.data.data && res.data.data.length > 0 && res.data.data[0].extractVersion == 'v3'){
562
573
  this.newVersion = true;
@@ -570,7 +581,7 @@ export default {
570
581
  }
571
582
  if (this.pageChunkData.length > 1){
572
583
  let iframe = document.getElementsByClassName('preview_iframe_kk')
573
- if (iframe){
584
+ if (iframe && iframe.length > 0){
574
585
  iframe[0].style.paddingBottom = '50px'
575
586
  }
576
587
  }
@@ -878,7 +889,12 @@ export default {
878
889
  .libang_head {
879
890
  height: 64px !important;
880
891
  }
881
-
892
+ .has_btn_libang_head{
893
+ height: 85px!important;
894
+ }
895
+ .has_btn_head{
896
+ height: 60px!important;
897
+ }
882
898
  .drawer-header {
883
899
  width: 100%;
884
900
  height: 50px;
@@ -972,6 +988,12 @@ justify-content: space-between;
972
988
  margin-right: 8px;
973
989
  }
974
990
  }
991
+ .top-header{
992
+ display: flex;
993
+ align-items: center;
994
+ justify-content: flex-end;
995
+ margin-bottom: 6px;
996
+ }
975
997
  .header_floder {
976
998
  display: flex;
977
999
  align-items: center;