askbot-dragon 1.7.38-beta → 1.7.39-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.39-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;
@@ -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()
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
  },
@@ -138,9 +139,15 @@ export default {
138
139
  dom.classList.add('animation')
139
140
  setTimeout(() => {
140
141
  dom.classList.remove('animation')
141
- }, 4000)
142
+ }, 3000)
142
143
  }
143
144
  }
145
+ } else if (this.splitParagraph[this.currentPage] && this.splitParagraph[this.currentPage].tableId){
146
+ const id = this.splitParagraph[this.currentPage].tableId;
147
+ const dom = document.getElementById(id);
148
+ if (dom){
149
+ dom.scrollIntoView({ behavior: 'smooth' });
150
+ }
144
151
  }
145
152
  }
146
153
  }
@@ -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
  },
@@ -168,22 +170,23 @@ export default {
168
170
  await this.initPdf();
169
171
  this.initObserver();
170
172
  },
171
- initObserver() {
173
+ async initObserver() {
172
174
  if (this.observer) {
173
175
  this.observer.disconnect();
174
176
  }
175
- this.observer = new IntersectionObserver(
176
- (entries) => {
177
- entries.forEach((entry) => {
177
+ this.observer = await new IntersectionObserver(
178
+ async (entries) => {
179
+ await entries.forEach(async (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
+ await this.renderPage(page.pageNumber);
183
185
  }
184
- this.updateCurrentPage();
186
+ await this.updateCurrentPage();
185
187
  }
186
188
  });
189
+ await this.jumpToHighlight(0);
187
190
  },
188
191
  {
189
192
  root: this.$refs.pdfContainer,
@@ -359,7 +362,10 @@ export default {
359
362
  }
360
363
  },
361
364
  jumpToHighlight(currentPage) {
362
- const highlight = this.split_paragraphs[currentPage].original_paragraph[0];
365
+ let highlight = null;
366
+ if (this.split_paragraphs[currentPage].original_paragraph){
367
+ highlight = this.split_paragraphs[currentPage].original_paragraph[0];
368
+ }
363
369
  if (!highlight) return;
364
370
  this.scrollToHighlight(highlight);
365
371
  },
@@ -95,7 +95,7 @@
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" :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>
@@ -520,6 +520,7 @@ export default {
520
520
  },
521
521
  //判断是否使用新定位组件
522
522
  getLocationInfo(){
523
+ this.newVersion = "";
523
524
  this.$http.get('/knowledge-api/knowledge/knowledge-part-location-info/list?ids=' + this.tagIds.join(',')).then(res => {
524
525
  console.log('getLocationInfo',res)
525
526
  if (res.data.code == 0){