askbot-dragon 1.7.38-beta → 1.7.40-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.38-beta",
3
+ "version": "1.7.40-beta",
4
4
  "scripts": {
5
5
  "serve": "vue-cli-service serve",
6
6
  "build": "vue-cli-service build",
@@ -398,7 +398,9 @@ export default {
398
398
  }
399
399
  this.$refs.previewPdf.fileType = type
400
400
  this.$refs.previewPdf.tagIds = item.tagIds;
401
- this.$refs.previewPdf.getLocationInfo();
401
+ if (item.tagIds && item.tagIds.length > 0){
402
+ this.$refs.previewPdf.getLocationInfo();
403
+ }
402
404
  this.$refs.previewPdf.isMessageRecord = this.isMessageRecord ? true : false;
403
405
  let index = url.indexOf("?");
404
406
  let newFileInOssPath = url;
@@ -411,7 +413,7 @@ export default {
411
413
  } else {
412
414
  this.$refs.previewPdf.fileName = '';
413
415
  }
414
- if (item.tagIds && item.tagIds.length != 0) {
416
+ if (item.tagIds && item.tagIds.length != 0 && this.$refs.previewPdf.newFileType !== 'PPT') {
415
417
  this.$refs.previewPdf.loading = false
416
418
  return
417
419
  }
@@ -55,7 +55,7 @@ export default {
55
55
  item.original_paragraph.forEach(items => {
56
56
  let dom = document.getElementById(items.paragraph_id);
57
57
  if (this.fileSuffix === 'txt'){
58
- const paragraphs = this.$el.querySelectorAll(`[data-paragraph-id="${items.paragraph_id}"]`);
58
+ const paragraphs = this.$el.querySelectorAll(`[paragraph-id="${items.paragraph_id}"]`);
59
59
  paragraphs.forEach(paragraph => {
60
60
  paragraph.style.background = this.colors[colorIndex]
61
61
  })
@@ -69,21 +69,21 @@ export default {
69
69
  dom.style.marginBottom = '8px';
70
70
  }
71
71
  }
72
+ if (item.tableId){
73
+ let dom = document.getElementById(item.tableId);
74
+ if (dom){
75
+ dom.style.backgroundColor = this.colors[colorIndex]
76
+ }
77
+ }
72
78
  })
79
+ this.$parent.scrollToParagraph('first')
73
80
  },
74
81
  },
75
82
  watch:{
76
83
  html_result:{
77
84
  handler(){
78
85
  if (this.html_result){
79
- if (this.fileSuffix === 'txt'){
80
- this.html = this.html_result
81
- this.$nextTick(() => {
82
- this.setColor()
83
- })
84
- } else {
85
- this.getHtml();
86
- }
86
+ this.getHtml();
87
87
  }
88
88
  },
89
89
  immediate:true
@@ -62,7 +62,8 @@ export default {
62
62
  rowDataList:[],
63
63
  headerArray:[],
64
64
  currentPage:1,
65
- pageSize:20
65
+ pageSize:20,
66
+ colors: ['#E3EBFF', '#FFF5DC', '#FFE8D8','#D6F3EA','#FFF1C3'],
66
67
  }
67
68
  },
68
69
  props:{
@@ -116,20 +117,33 @@ export default {
116
117
  }
117
118
  this.rowDataList.push(obj);
118
119
  }
119
- setTimeout(() => {
120
- let dom = document.getElementById('659164be-19bd-4fd7-a47d-b04c3dbbfa6f');
121
- if (dom){
122
- dom.style.backgroundColor = 'red'
123
- }
124
- },1000)
120
+ this.$nextTick(() => {
121
+ this.setRowColor();
122
+ })
125
123
  },
126
124
  getRowKey(row){
127
125
  return row.id
128
126
  },
127
+ setRowColor(){
128
+ this.tableChunkData.forEach((item,index) => {
129
+ const colorIndex = index % this.colors.length;
130
+ let id = item.tableChunkId;
131
+ let dom = document.getElementsByClassName('setBgClass' + id);
132
+ console.log('dom',dom)
133
+ if (dom && dom.length > 0){
134
+ dom.forEach(doms => {
135
+ doms.style.backgroundColor = this.colors[colorIndex];
136
+ })
137
+ }
138
+ })
139
+ if (this.tableChunkData.length > 0){
140
+ this.scrollToRow(this.tableChunkData[0].tableChunkId)
141
+ }
142
+ },
129
143
  tableRowClassName({ row }){
130
144
  let id = this.tableChunkData.filter(item => item.tableChunkId == row.id);
131
145
  if (id && id.length > 0){
132
- return 'setBgClass'
146
+ return 'setBgClass' + id[0].tableChunkId
133
147
  }
134
148
  },
135
149
  scrollToRow(rowId) {
@@ -142,6 +156,9 @@ export default {
142
156
  },
143
157
  handleCurrentChange(val){
144
158
  this.currentPage = val;
159
+ this.$nextTick(() => {
160
+ this.setRowColor();
161
+ })
145
162
  }
146
163
  },
147
164
  mounted() {
@@ -154,7 +171,7 @@ export default {
154
171
  .excelView{
155
172
  height: 100%;
156
173
  /deep/.setBgClass{
157
- background-color: #366aff!important;
174
+ background-color: #E3EBFF!important;
158
175
  }
159
176
  }
160
177
  </style>
@@ -79,11 +79,12 @@ export default {
79
79
  this.splitParagraph.push(res.data.data[i].paragraphChunkInfo.splitParagraph)
80
80
  }
81
81
  if (res.data.data[i].paragraphChunkInfo && res.data.data[i].paragraphChunkInfo.tableChunkData){
82
- this.tableChunkData = this.tableChunkData.push(res.data.data[i].paragraphChunkInfo.tableChunkData)
82
+ this.tableChunkData.push(res.data.data[i].paragraphChunkInfo.tableChunkData)
83
83
  }
84
84
  }
85
85
  }
86
86
  }
87
+ this.splitParagraph = this.splitParagraph.concat(this.tableChunkData);
87
88
  this.getParseInfo();
88
89
  })
89
90
  },
@@ -120,7 +121,7 @@ export default {
120
121
  this.currentPage++;
121
122
  this.scrollToParagraph()
122
123
  },
123
- scrollToParagraph(){
124
+ scrollToParagraph(type){
124
125
  if (this.fileType == 'PDF') {
125
126
  this.$refs.pdfView.jumpToHighlight(this.currentPage)
126
127
  } else if (this.fileType == 'DOC' || this.fileType == 'DOCX' || this.fileType == 'TXT'){
@@ -130,16 +131,31 @@ export default {
130
131
  if (dom){
131
132
  dom.scrollIntoView({ behavior: 'smooth' });
132
133
  }
133
- for (let i=0;i<this.splitParagraph[this.currentPage].original_paragraph.length;i++){
134
- const id = this.splitParagraph[this.currentPage].original_paragraph[i].paragraph_id;
135
- const dom = document.getElementById(id);
134
+ if (type === 'first'){
136
135
  if (dom){
137
- dom.scrollIntoView({ behavior: 'smooth' });
138
136
  dom.classList.add('animation')
139
137
  setTimeout(() => {
140
138
  dom.classList.remove('animation')
141
- }, 4000)
139
+ }, 3000)
142
140
  }
141
+ } else {
142
+ for (let i=0;i<this.splitParagraph[this.currentPage].original_paragraph.length;i++){
143
+ const id = this.splitParagraph[this.currentPage].original_paragraph[i].paragraph_id;
144
+ const dom = document.getElementById(id);
145
+ if (dom){
146
+ dom.scrollIntoView({ behavior: 'smooth' });
147
+ dom.classList.add('animation')
148
+ setTimeout(() => {
149
+ dom.classList.remove('animation')
150
+ }, 3000)
151
+ }
152
+ }
153
+ }
154
+ } else if (this.splitParagraph[this.currentPage] && this.splitParagraph[this.currentPage].tableId){
155
+ const id = this.splitParagraph[this.currentPage].tableId;
156
+ const dom = document.getElementById(id);
157
+ if (dom){
158
+ dom.scrollIntoView({ behavior: 'smooth' });
143
159
  }
144
160
  }
145
161
  }
@@ -107,14 +107,16 @@ export default {
107
107
  setHighlights(arr){
108
108
  this.highlights = [];
109
109
  for (let i =0;i<arr.length;i++){
110
- for (let j=0;j<arr[i].original_paragraph.length;j++){
111
- let item = arr[i].original_paragraph[j];
112
- let obj = {
113
- position:item.position,
114
- pageNumber: i+1,
115
- page:item.page
110
+ if (arr[i].original_paragraph){
111
+ for (let j=0;j<arr[i].original_paragraph.length;j++){
112
+ let item = arr[i].original_paragraph[j];
113
+ let obj = {
114
+ position:item.position,
115
+ pageNumber: i+1,
116
+ page:item.page
117
+ }
118
+ this.highlights.push(obj);
116
119
  }
117
- this.highlights.push(obj);
118
120
  }
119
121
  }
120
122
  },
@@ -173,13 +175,13 @@ export default {
173
175
  this.observer.disconnect();
174
176
  }
175
177
  this.observer = new IntersectionObserver(
176
- (entries) => {
177
- entries.forEach((entry) => {
178
+ (entries) => {
179
+ entries.forEach( (entry) => {
178
180
  if (entry.isIntersecting) {
179
181
  const index = Number(entry.target.getAttribute('data-index'));
180
182
  const page = this.pages[index];
181
183
  if (!page.loaded && !page.loading) {
182
- this.renderPage(page.pageNumber);
184
+ this.renderPage(page.pageNumber);
183
185
  }
184
186
  this.updateCurrentPage();
185
187
  }
@@ -201,6 +203,9 @@ export default {
201
203
  }
202
204
  });
203
205
  },300)
206
+ setTimeout(() => {
207
+ this.jumpToHighlight(0);
208
+ },1300)
204
209
  });
205
210
  },
206
211
  async loadPage(number){
@@ -359,7 +364,10 @@ export default {
359
364
  }
360
365
  },
361
366
  jumpToHighlight(currentPage) {
362
- const highlight = this.split_paragraphs[currentPage].original_paragraph[0];
367
+ let highlight = null;
368
+ if (this.split_paragraphs[currentPage].original_paragraph){
369
+ highlight = this.split_paragraphs[currentPage].original_paragraph[0];
370
+ }
363
371
  if (!highlight) return;
364
372
  this.scrollToHighlight(highlight);
365
373
  },
@@ -91,11 +91,11 @@
91
91
  :formKnowledgeManagement="formKnowledgeManagement"
92
92
  @closeSummary="closeSummary" @recommendQues="recommendQues"
93
93
  @getSummarySuccess="getSummarySuccess"></intelligent-summary>
94
- <div class="pdf_positon" :style="pdfStyle" v-if="tagIds && tagIds.length != 0 && drawer && newVersion === false">
94
+ <div class="pdf_positon" :style="pdfStyle" v-if="tagIds && tagIds.length != 0 && drawer && newVersion === false && newFileType !== 'PPT'">
95
95
  <pdfPosition :tagIds="tagIds" :isMessageRecord="isMessageRecord" :textWatermarkStr="textWatermarkStr">
96
96
  </pdfPosition>
97
97
  </div>
98
- <new-position-preview v-else-if="newVersion" :knowledgeId="knowledgeId" :tagIds="tagIds" :url="previewHref"></new-position-preview>
98
+ <new-position-preview ref="newPositionPreview" v-else-if="tagIds && tagIds.length!= 0 && newVersion && newFileType !== 'PPT'" :knowledgeId="knowledgeId" :tagIds="tagIds" :url="previewHref"></new-position-preview>
99
99
  <template v-else>
100
100
  <div v-if="fileType == 'VIDEO'" style="width: 100%;height: 100%">
101
101
  <video :src="url" controls width="100%;" height="98%"></video>
@@ -151,7 +151,9 @@ export default {
151
151
  textWatermarkStr:"",
152
152
  copy:'',
153
153
  newVersion:'',
154
- previewHref:""}
154
+ previewHref:"",
155
+ newFileType:""
156
+ }
155
157
  },
156
158
  mounted() {
157
159
  window.addEventListener('message',this.handleIframeMessage,false);
@@ -310,7 +312,7 @@ export default {
310
312
  },
311
313
  loadIframe () {
312
314
 
313
- if (this.fileType == 'VIDEO' || this.fileType == 'WECHAT' || (this.tagIds && this.tagIds.length != 0)) {
315
+ if (this.fileType == 'VIDEO' || this.fileType == 'WECHAT' || (this.tagIds && this.tagIds.length != 0 && this.newFileType !== 'PPT')) {
314
316
  this.loading = false
315
317
  } else {
316
318
  let iframe = document.getElementsByClassName('preview_iframe')[0] || document.getElementsByClassName('preview_iframe_kk')[0];
@@ -479,6 +481,7 @@ export default {
479
481
  getOssPath(url){
480
482
  let httpUrl = '/knowledge-api/knowledge/getTemporaryCertificate';
481
483
  let type = this.getFileType(url)
484
+ this.newFileType = type;
482
485
  if (type === 'VIDEO' || type === 'PDF' || type === 'EXCEL' || type === 'TXT' || type === 'DOC') {
483
486
  httpUrl += '?needEncrypt=false'
484
487
  } else {
@@ -520,12 +523,15 @@ export default {
520
523
  },
521
524
  //判断是否使用新定位组件
522
525
  getLocationInfo(){
526
+ this.newVersion = "";
523
527
  this.$http.get('/knowledge-api/knowledge/knowledge-part-location-info/list?ids=' + this.tagIds.join(',')).then(res => {
524
528
  console.log('getLocationInfo',res)
525
529
  if (res.data.code == 0){
526
530
  if (res.data.data && res.data.data.length > 0 && res.data.data[0].extractVersion == 'v3'){
527
531
  this.newVersion = true;
528
- this.loading = false;
532
+ if (this.newFileType !== 'PPT'){
533
+ this.loading = false;
534
+ }
529
535
  } else {
530
536
  this.newVersion = false;
531
537
  }