askbot-dragon 1.7.78-beta → 1.7.79-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.
@@ -41,7 +41,7 @@
41
41
  </template>
42
42
  <div class="header_close" v-else>
43
43
  <span class="title_left">
44
- {{ title ? title : $t('dragonCommon.viewDetails') }}
44
+ {{ title ? title : '查看详情' }}
45
45
  </span>
46
46
  <section @click="close">
47
47
  <i class="iconfont guoran-shanchu"></i>
@@ -107,7 +107,7 @@
107
107
  :url="previewHref"
108
108
  ></new-position-preview>
109
109
  <template v-else>
110
- <div v-if="fileType == 'VIDEO'" style="width: 100%;">
110
+ <div v-if="fileType == 'VIDEO'" style="width: 100%;height: 100%">
111
111
  <video :src="url" controls width="100%;" height="98%"></video>
112
112
  </div>
113
113
  <div v-else-if="fileType == 'HTML'" style="width: 100%;">
@@ -152,7 +152,7 @@ import { isMobile } from "../assets/js/common";
152
152
  import { Toast } from 'vant';
153
153
  import NewPositionPreview from "./preview/newPositionPreview";
154
154
  export default {
155
- data () {
155
+ data() {
156
156
  return {
157
157
  previewShowPopup: false,
158
158
  fileText: '',
@@ -162,18 +162,19 @@ export default {
162
162
  tagIds: [],
163
163
  // '6454aa1a70573a6ead6f0f7d', '6454aa1a70573a6ead6f0f81',
164
164
  loading: true,
165
+ fileName: '',
165
166
  previewKnowledgeId: "",
166
167
  showSummary: false,
167
168
  iframeHeight: "100%",
168
169
  isDownload: false,
169
170
  textWatermarkStr: "",
170
- copy:'',
171
- newVersion:'',
172
- previewHref:"",
173
- newFileType:"",
174
- numberPage:0,
175
- pageChunkData:[],
176
- currentPage:0
171
+ copy: '',
172
+ newVersion: '',
173
+ previewHref: "",
174
+ newFileType: "",
175
+ numberPage: 0,
176
+ pageChunkData: [],
177
+ currentPage: 0
177
178
  }
178
179
  },
179
180
  mounted () {
@@ -182,55 +183,68 @@ export default {
182
183
  this.isPcFun();
183
184
  },
184
185
  props: {
185
- url: {
186
- type: String,
187
- required: true,
188
- },
189
- officePreviewType: {
190
- type: String,
191
- default: ''
192
- },
193
- isMessageRecord: {
194
- type: Boolean,
195
- default: false,
196
- },
197
- sourceFileType: {
198
- type: String,
199
- default: '',
200
- },
201
- title: {
202
- type: String,
203
- default: ''
204
- },
205
- isHasChat: {
206
- type: Boolean,
207
- default: false
208
- },
209
- knowledgeId: {
210
- type: String,
211
- default: '',
212
- },
213
- previewOssPath: {
214
- type: String,
215
- default: '',
216
- },
217
- folderName: {
218
- type: String,
219
- default: '',
220
- },
221
- folderUrl: {
222
- type: String,
223
- default: '',
224
- },
225
- isLiBang: {
226
- type: Boolean,
227
- default: false
228
- }},
229
- components: {
230
- NewPositionPreview,
231
- IntelligentSummary,
232
- pdfPosition
186
+ url: {
187
+ type: String,
188
+ required: true,
189
+ },
190
+ officePreviewType: {
191
+ type: String,
192
+ default: ''
193
+ },
194
+ isMessageRecord: {
195
+ type: Boolean,
196
+ default: false,
197
+ },
198
+ sourceFileType: {
199
+ type: String,
200
+ default: '',
201
+ },
202
+ title: {
203
+ type: String,
204
+ default: ''
205
+ },
206
+ isHasChat: {
207
+ type: Boolean,
208
+ default: false
209
+ },
210
+ knowledgeId: {
211
+ type: String,
212
+ default: '',
213
+ },
214
+ previewOssPath: {
215
+ type: String,
216
+ default: '',
217
+ },
218
+ folderName: {
219
+ type: String,
220
+ default: '',
221
+ },
222
+ folderUrl: {
223
+ type: String,
224
+ default: '',
225
+ },
226
+ isLiBang: {
227
+ type: Boolean,
228
+ default: false
229
+ },
230
+ formKnowledgeManagement: {
231
+ type: Boolean,
232
+ default: false
233
+ },
234
+ mainId: {
235
+ type: String,
236
+ default: ''
237
+ },
238
+ userId: {
239
+ type: String,
240
+ default: ''
241
+ },
233
242
  },
243
+ components: {
244
+ NewPositionPreview,
245
+ IntelligentSummary,
246
+ pdfPosition
247
+ },
234
248
  watch: {
235
249
  drawer (value) {
236
250
  if (value) {
@@ -288,311 +302,326 @@ export default {
288
302
  url = url + this.url
289
303
  if (this.sourceFileType == '.ppt' || this.sourceFileType == '.pptx' || this.sourceFileType == '.pdf') {
290
304
  url += '&officePreviewType=pdf'
291
- }
292
- console.log('textWatermarkStr 216', this.textWatermarkStr)
293
- if (this.textWatermarkStr) {
294
- url += '&textWatermarkValue=' + this.textWatermarkStr
295
- }
296
- return url
297
- },
298
- // fileType() {
299
- // const fileType = this.url.substring(this.url.lastIndexOf('.'));
300
- // if (fileType === '.mp4' || fileType === '.MP4' || fileType === '.MOV' || fileType === '.mov') {
301
- // return 'VIDEO'
302
- // } else {
303
- // return 'OTHER'
304
- // }
305
+ if (this.watermark) {
306
+ url = this.watermark.textWatermarkValue ? (url += '&textWatermarkValue=' + this.watermark.textWatermarkValue) : url
307
+ url = this.watermark.visitorWatermarkValue ? (url += '&visitorWatermarkValue=' + this.watermark.visitorWatermarkValue) : url
308
+ }
309
+ console.log('textWatermarkStr 216', this.textWatermarkStr)
310
+ if (this.textWatermarkStr) {
311
+ url += '&textWatermarkValue=' + this.textWatermarkStr
312
+ }
313
+ return url
314
+ },
315
+ // fileType() {
316
+ // const fileType = this.url.substring(this.url.lastIndexOf('.'));
317
+ // if (fileType === '.mp4' || fileType === '.MP4' || fileType === '.MOV' || fileType === '.mov') {
318
+ // return 'VIDEO'
319
+ // } else {
320
+ // return 'OTHER'
321
+ // }
305
322
 
306
- // }
307
- },
308
- methods: {
309
- close () {
310
- setTimeout(() => {
311
- this.previewShowPopup = false;
312
- this.fileType = ''
313
- }, 300)
314
- this.drawer = false;
315
- this.showSummary = false;
323
+ // }
316
324
  },
317
- loadIframe () {
325
+ methods: {
326
+ close() {
327
+ setTimeout(() => {
328
+ this.previewShowPopup = false;
329
+ this.fileType = ''
330
+ }, 300)
331
+ this.drawer = false;
332
+ this.showSummary = false;
333
+ },
334
+ loadIframe() {
318
335
 
319
- if (this.fileType == 'VIDEO' || this.fileType == 'WECHAT' || (this.tagIds && this.tagIds.length != 0 && this.newFileType !== 'PPT')) {
320
- this.loading = false
321
- } else {
322
- let iframe = document.getElementsByClassName('preview_iframe')[0] || document.getElementsByClassName('preview_iframe_kk')[0];
323
- if (iframe) {
324
- iframe.onload = () => {
325
- this.loading = false;
326
- document.getElementById('drawer_content_pre').style.backgroundImage = 'none'
336
+ if (this.fileType == 'VIDEO' || this.fileType == 'WECHAT' || (this.tagIds && this.tagIds.length != 0 && this.newFileType !== 'PPT')) {
337
+ this.loading = false
338
+ } else {
339
+ let iframe = document.getElementsByClassName('preview_iframe')[0] || document.getElementsByClassName('preview_iframe_kk')[0];
340
+ if (iframe) {
341
+ iframe.onload = () => {
342
+ this.loading = false;
343
+ document.getElementById('drawer_content_pre').style.backgroundImage = 'none'
344
+ window.postMessage({
345
+ type: "wx_bind",
346
+ data: {
347
+ mainId: sessionStorage.getItem('_mainId'),
348
+ userId: sessionStorage.getItem('_currentUserId'),
349
+ test: process.env.VUE_APP_ENV !== 'production'
350
+ }
351
+ }, '*')}
327
352
  }
353
+ // let time = setInterval(() =>{
354
+ //
355
+ // if(iframe) {
356
+ // this.loading = false
357
+ // clearInterval(time)
358
+ // }
359
+ // }, 500)
328
360
  }
329
- // let time = setInterval(() =>{
330
- //
331
- // if(iframe) {
332
- // this.loading = false
333
- // clearInterval(time)
334
- // }
335
- // }, 500)
336
- }
337
- },
338
- getBolb () {
339
- this.$http.post('/knowledge-api/knowledge/htmlTextDeal?onlyText=false', {
340
- fileInOssPath: this.url,
341
- templateId: ''
342
- }).then(res => {
343
- if (res.data.code == 0) {
344
- this.fileText = res.data.data
345
- this.loading = false
361
+ },
362
+ getBolb() {
363
+ this.$http.post('/knowledge-api/knowledge/htmlTextDeal?onlyText=false', {
364
+ fileInOssPath: this.url,
365
+ templateId: ''
366
+ }).then(res => {
367
+ if (res.data.code == 0) {
368
+ this.fileText = res.data.data
369
+ this.loading = false
370
+ }
371
+ })
372
+ },
373
+ previewToDialog(flag) {
374
+ this.$emit('previewToDialog', flag)
375
+ },
376
+ closeSummary() {
377
+ this.showSummary = false;
378
+ },
379
+ recommendQues(item, knowledgeId) {
380
+ console.log('recommendQues', item, knowledgeId);
381
+ this.$emit('recommendQues', item, knowledgeId)
382
+ },
383
+ handleIframeMessage(res) {
384
+ if (res.data.type == 'getViewerHeight') {
385
+ let iframeHeight = this.iframeHeight.replace('px', '')
386
+ if (res.data.data && iframeHeight != (res.data.data + 50)) {
387
+ this.iframeHeight = res.data.data + 50 + 'px'
388
+ }
346
389
  }
347
- })
348
- },
349
- previewToDialog (flag) {
350
- this.$emit('previewToDialog', flag)
351
- },
352
- closeSummary () {
353
- this.showSummary = false;
354
- },
355
- recommendQues (item, knowledgeId) {
356
- console.log('recommendQues', item, knowledgeId);
357
- this.$emit('recommendQues', item, knowledgeId)
358
- },
359
- handleIframeMessage (res) {
360
- if (res.data.type == 'getViewerHeight') {
361
- let iframeHeight = this.iframeHeight.replace('px', '')
362
- if (res.data.data && iframeHeight != (res.data.data + 50)) {
363
- this.iframeHeight = res.data.data + 50 + 'px'
390
+ if (res.data.type == 'getViewPage' && res.data.data) {
391
+ this.numberPage = Number(res.data.data);
392
+ if (this.pageChunkData.length > 0) {
393
+ this.scrollPPTPage(this.pageChunkData[0])
394
+ }
364
395
  }
365
- }
366
- if (res.data.type == 'getViewPage' && res.data.data){
367
- this.numberPage = Number(res.data.data);
368
- if (this.pageChunkData.length > 0){
369
- this.scrollPPTPage(this.pageChunkData[0])
396
+ if (res.data.type == 'getViewerHeight' || res.data.type == 'getViewPage') {
397
+ if (this.pageChunkData.length > 0) {
398
+ this.scrollPPTPage(this.pageChunkData[0])
399
+ }
370
400
  }
371
- }
372
- if (res.data.type == 'getViewerHeight' || res.data.type == 'getViewPage'){
373
- if (this.pageChunkData.length > 0){
374
- this.scrollPPTPage(this.pageChunkData[0])
401
+ },
402
+ summaryFun() {
403
+ this.showSummary = !this.showSummary;
404
+ if (this.showSummary) {
405
+ document.getElementById('drawer_content_pre').scrollTop = 0;
375
406
  }
376
- }
377
- },
378
- summaryFun () {
379
- this.showSummary = !this.showSummary;
380
- if (this.showSummary) {
381
- document.getElementById('drawer_content_pre').scrollTop = 0;
382
- }
383
- },
384
- getSummarySuccess () {
385
- this.$nextTick(() => {
386
- // if (this.tagIds.length > 0){
387
- // let intelligentSummary = document.getElementById('intelligentSummary');
388
- // let preCon = document.querySelector('.pdf_view')
389
- // if (intelligentSummary){
390
- // let height = intelligentSummary.offsetHeight + (this.isPc ? 100 : 50 );
391
- // if (preCon){
392
- // preCon.style.height = 'calc(100% - ' + height + 'px)'
393
- // }
394
- // console.log('height',height,preCon)
395
- // }
396
- // }
397
- // let intelligentSummary = document.getElementById('intelligentSummary');
398
- // let height = intelligentSummary.offsetHeight
399
- // this.pdfStyle.height = 'calc(100% - ' + height + 'px)'
400
- })
401
- },
402
- getTextWatermark () {
403
- let url = '/knowledge-api/open/knowledge/getPermissionInfo';
404
- let obj = {
405
- "knowledgeId": this.knowledgeId,
406
- "userId": sessionStorage.getItem('_currentUserId'),
407
- "mainId": sessionStorage.getItem('_mainId'),
408
- "corpId": sessionStorage.getItem('_corpid')
409
- }
410
- this.$http.post(url, obj).then(res => {
411
- console.log('getTextWatermark', res.data.data)
412
- if (res.data.data) {
413
- this.textWatermarkStr = res.data.data.textWatermarkStr;
414
- this.isDownload = res.data.data.showDownloadBtn;
407
+ },
408
+ getSummarySuccess() {
409
+ this.$nextTick(() => {
410
+ // if (this.tagIds.length > 0){
411
+ // let intelligentSummary = document.getElementById('intelligentSummary');
412
+ // let preCon = document.querySelector('.pdf_view')
413
+ // if (intelligentSummary){
414
+ // let height = intelligentSummary.offsetHeight + (this.isPc ? 100 : 50 );
415
+ // if (preCon){
416
+ // preCon.style.height = 'calc(100% - ' + height + 'px)'
417
+ // }
418
+ // console.log('height',height,preCon)
419
+ // }
420
+ // }
421
+ // let intelligentSummary = document.getElementById('intelligentSummary');
422
+ // let height = intelligentSummary.offsetHeight
423
+ // this.pdfStyle.height = 'calc(100% - ' + height + 'px)'
424
+ })
425
+ },
426
+ getTextWatermark() {
427
+ let url = '/knowledge-api/open/knowledge/getPermissionInfo';
428
+ let obj = {
429
+ "knowledgeId": this.knowledgeId,
430
+ "userId": sessionStorage.getItem('_currentUserId'),
431
+ "mainId": sessionStorage.getItem('_mainId'),
432
+ "corpId": sessionStorage.getItem('_corpid')
415
433
  }
416
- })
417
- },
418
- downLoad () {
419
- let url = this.previewOssPath
420
- if (decodeURIComponent(url) != url) {
421
- url = decodeURIComponent(url)
422
- }
423
- const fileType = url.substring(url.lastIndexOf('.'));
424
- this.$http.post('/knowledge-api/temporary-certificate/or-origin?expired=10', url, {
425
- headers: {
426
- "Content-Type": "application/json",
434
+ this.$http.post(url, obj).then(res => {
435
+ console.log('getTextWatermark', res.data.data)
436
+ if (res.data.data) {
437
+ this.textWatermarkStr = res.data.data.textWatermarkStr;
438
+ this.isDownload = res.data.data.showDownloadBtn;
439
+ }
440
+ })
441
+ },
442
+ downLoad() {
443
+ // if (this.formKnowledgeManagement) {
444
+ // this.$emit('downLoad', this.previewOssPath);
445
+ // return
446
+ // }
447
+ let url = this.previewOssPath
448
+ if (decodeURIComponent(url) != url) {
449
+ url = decodeURIComponent(url)
427
450
  }
428
- }).then(res => {
429
- console.log('downLoad 341', res)
430
- if (res.data || res.bodyText) {
431
- if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
432
- this.copy = res.data
433
- if (isMobile()) {
434
- setTimeout(() =>{
435
- const range = document.createRange();
436
- range.selectNode(document.getElementById('text'));
437
- const selection = window.getSelection();
438
- //移除之前选中内容
439
- if (selection.rangeCount > 0) selection.removeAllRanges();
440
- selection.addRange(range);
441
- document.execCommand('copy');
442
- selection.removeAllRanges()
443
- Toast(this.$t('dragonCommon.Safaridownload'));
444
- this.close()
445
- },100)
446
- } else {
447
- let a = document.createElement('a')
448
- a.href = res.data
449
- a.download = (this.title) + fileType
450
- a.dispatchEvent(new MouseEvent('click', { bubbles: true, cancelable: true, view: window }))
451
- }
452
- return
453
- } else {
454
- // setTimeout(() =>{
455
- // window.open(res.data,'下载', 'noopener')
456
- // }, 2000)
457
- // window.open(res.data,'下载', 'noopener')
458
- if (isMobile()) {
459
- const iframe = document.createElement("iframe");
460
- iframe.setAttribute("hidden", "hidden");
461
- iframe.onload = () => {
462
- if (iframe) {
463
- console.log("iframe onload....")
464
- iframe.setAttribute('src', 'about:blank');
465
- }
466
- };
467
- document.body.insertBefore(iframe, null);
468
- iframe.setAttribute("src", res.data);
451
+ const fileType = url.substring(url.lastIndexOf('.'));
452
+ this.$http.post('/knowledge-api/temporary-certificate/or-origin?expired=10', url, {
453
+ headers: {
454
+ "Content-Type": "application/json",
455
+ }
456
+ }).then(res => {
457
+ console.log('downLoad 341', res)
458
+ if (res.data || res.bodyText) {
459
+ if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
460
+ this.copy = res.data
461
+ if (isMobile()) {
462
+ setTimeout(() => {
463
+ const range = document.createRange();
464
+ range.selectNode(document.getElementById('text'));
465
+ const selection = window.getSelection();
466
+ //移除之前选中内容
467
+ if (selection.rangeCount > 0) selection.removeAllRanges();
468
+ selection.addRange(range);
469
+ document.execCommand('copy');
470
+ selection.removeAllRanges()
471
+ Toast(this.$t('dragonCommon.Safaridownload'));
472
+ this.close()
473
+ }, 100)
474
+ } else {
475
+ let a = document.createElement('a')
476
+ a.href = res.data
477
+ a.download = (this.title) + fileType
478
+ a.dispatchEvent(new MouseEvent('click', { bubbles: true, cancelable: true, view: window }))
479
+ }
480
+ return
469
481
  } else {
470
- let a = document.createElement('a')
471
- a.href = res.data
472
- a.download = (this.title) + fileType
473
- a.dispatchEvent(new MouseEvent('click', { bubbles: true, cancelable: true, view: window }))
482
+ // setTimeout(() =>{
483
+ // window.open(res.data,'下载', 'noopener')
484
+ // }, 2000)
485
+ // window.open(res.data,'下载', 'noopener')
486
+ if (isMobile()) {
487
+
488
+ const iframe = document.createElement("iframe");
489
+ iframe.setAttribute("hidden", "hidden");
490
+ iframe.onload = () => {
491
+ if (iframe) {
492
+ console.log("iframe onload....")
493
+ iframe.setAttribute('src', 'about:blank');
494
+ }
495
+ };
496
+ document.body.insertBefore(iframe, null);
497
+ iframe.setAttribute("src", res.data);
498
+ } else {
499
+ let a = document.createElement('a')
500
+ a.href = res.data
501
+ a.download = (this.title) + fileType
502
+ a.dispatchEvent(new MouseEvent('click', { bubbles: true, cancelable: true, view: window }))
503
+ }
504
+ this.close()
474
505
  }
475
- this.close()
476
506
  }
507
+ })
508
+ },
509
+ isPcFun() {
510
+ if (/(iPhone|iPad|iPod|iOS|Android)/i.test(navigator.userAgent)) {
511
+ this.isPc = false
512
+ } else {
513
+ this.isPc = true
477
514
  }
478
- })
479
- },
480
- isPcFun () {
481
- if (/(iPhone|iPad|iPod|iOS|Android)/i.test(navigator.userAgent)) {
482
- this.isPc = false
483
- } else {
484
- this.isPc = true
485
- }
486
- },
487
- clickFloder() {
488
- this.$emit('previewClickFloder')
489
- },
490
- getOssPath(url){
491
- let httpUrl = '/knowledge-api/knowledge/getTemporaryCertificate';
492
- let type = this.getFileType(url)
493
- this.newFileType = type;
494
- if (type === 'VIDEO' || type === 'PDF' || type === 'EXCEL' || type === 'TXT' || type === 'DOC') {
495
- httpUrl += '?needEncrypt=false'
496
- } else {
497
- httpUrl += '?needEncrypt=true'
498
- }
499
- this.$http.post(httpUrl, {
500
- "fileInOssPath": url
501
- }).then(res => {
502
- console.log('getOssPath',res)
503
- if (res.data.code == '0'){
504
- this.previewHref = res.data.data;
515
+ },
516
+ clickFloder() {
517
+ this.$emit('previewClickFloder')
518
+ },
519
+ getOssPath(url) {
520
+ let httpUrl = '/knowledge-api/knowledge/getTemporaryCertificate';
521
+ let type = this.getFileType(url)
522
+ this.newFileType = type;
523
+ if (type === 'VIDEO' || type === 'PDF' || type === 'EXCEL' || type === 'TXT' || type === 'DOC') {
524
+ httpUrl += '?needEncrypt=false'
525
+ } else {
526
+ httpUrl += '?needEncrypt=true'
505
527
  }
506
- })
507
- },
508
- getFileType(url){
509
- let index = url.lastIndexOf('?')
510
- let newFileInOssPath = url.substring(0, url.indexOf("?"))
511
- if (index == -1){
512
- newFileInOssPath = url
513
- }
514
- const fileType = newFileInOssPath.substring(newFileInOssPath.lastIndexOf('.'));
515
- if (fileType === '.mp4' || fileType === '.MP4' || fileType === '.MOV' || fileType === '.MOVC' || fileType === '.mov' || fileType === '.movc') {
516
- return 'VIDEO'
517
- } else if (fileType === '.html') {
518
- return 'HTML'
519
- } else if (fileType === '.png' || fileType === '.jpg' || fileType === '.jpeg' || fileType === '.PNG' || fileType === '.JPG' || fileType === '.JPEG') {
520
- return 'IMAGE'
521
- } else if (fileType === '.docx' || fileType === '.doc'){
522
- return 'DOC'
523
- } else if (fileType === '.ppt' || fileType === '.pptx'){
524
- return 'PPT'
525
- } else if (fileType === '.pdf'){
526
- return 'PDF'
527
- } else if (fileType === '.txt'){
528
- return 'TXT'
529
- } else {
530
- return 'OTHER'
531
- }
532
- },
533
- //判断是否使用新定位组件
534
- getLocationInfo(){
535
- this.newVersion = "";
536
- this.$http.get('/knowledge-api/knowledge/knowledge-part-location-info/list?ids=' + this.tagIds.join(',')).then(res => {
537
- console.log('getLocationInfo',res)
538
- this.pageChunkData = [];
539
- if (res.data.code == 0){
540
- if (res.data.data && res.data.data.length > 0 && res.data.data[0].extractVersion == 'v3'){
541
- this.newVersion = true;
542
- if (this.newFileType !== 'PPT'){
543
- this.loading = false;
544
- }
545
- for (let i=0;i<res.data.data.length;i++){
546
- if (res.data.data[i].paragraphChunkInfo && res.data.data[i].paragraphChunkInfo.pageChunkData){
547
- this.pageChunkData.push(res.data.data[i].paragraphChunkInfo.pageChunkData.page_number)
528
+ this.$http.post(httpUrl, {
529
+ "fileInOssPath": url
530
+ }).then(res => {
531
+ console.log('getOssPath', res)
532
+ if (res.data.code == '0') {
533
+ this.previewHref = res.data.data;
534
+ }
535
+ })
536
+ },
537
+ getFileType(url) {
538
+ let index = url.lastIndexOf('?')
539
+ let newFileInOssPath = url.substring(0, url.indexOf("?"))
540
+ if (index == -1) {
541
+ newFileInOssPath = url
542
+ }
543
+ const fileType = newFileInOssPath.substring(newFileInOssPath.lastIndexOf('.'));
544
+ if (fileType === '.mp4' || fileType === '.MP4' || fileType === '.MOV' || fileType === '.MOVC' || fileType === '.mov' || fileType === '.movc') {
545
+ return 'VIDEO'
546
+ } else if (fileType === '.html') {
547
+ return 'HTML'
548
+ } else if (fileType === '.png' || fileType === '.jpg' || fileType === '.jpeg' || fileType === '.PNG' || fileType === '.JPG' || fileType === '.JPEG') {
549
+ return 'IMAGE'
550
+ } else if (fileType === '.docx' || fileType === '.doc') {
551
+ return 'DOC'
552
+ } else if (fileType === '.ppt' || fileType === '.pptx') {
553
+ return 'PPT'
554
+ } else if (fileType === '.pdf') {
555
+ return 'PDF'
556
+ } else if (fileType === '.txt') {
557
+ return 'TXT'
558
+ } else {
559
+ return 'OTHER'
560
+ }
561
+ },
562
+ //判断是否使用新定位组件
563
+ getLocationInfo() {
564
+ this.newVersion = "";
565
+ this.$http.get('/knowledge-api/knowledge/knowledge-part-location-info/list?ids=' + this.tagIds.join(',')).then(res => {
566
+ console.log('getLocationInfo', res)
567
+ this.pageChunkData = [];
568
+ if (res.data.code == 0) {
569
+ if (res.data.data && res.data.data.length > 0 && res.data.data[0].extractVersion == 'v3') {
570
+ this.newVersion = true;
571
+ if (this.newFileType !== 'PPT') {
572
+ this.loading = false;
548
573
  }
549
- }
550
- if (this.pageChunkData.length > 1){
551
- let iframe = document.getElementsByClassName('preview_iframe_kk')
552
- if (iframe && iframe.length > 0){
553
- iframe[0].style.paddingBottom = '50px'
574
+ for (let i = 0; i < res.data.data.length; i++) {
575
+ if (res.data.data[i].paragraphChunkInfo && res.data.data[i].paragraphChunkInfo.pageChunkData) {
576
+ this.pageChunkData.push(res.data.data[i].paragraphChunkInfo.pageChunkData.page_number)
577
+ }
578
+ }
579
+ if (this.pageChunkData.length > 1) {
580
+ let iframe = document.getElementsByClassName('preview_iframe_kk')
581
+ if (iframe && iframe.length > 0) {
582
+ iframe[0].style.paddingBottom = '50px'
583
+ }
554
584
  }
585
+ } else {
586
+ this.newVersion = false;
555
587
  }
556
- } else {
557
- this.newVersion = false;
558
588
  }
589
+ })
590
+ },
591
+ currentChange(value) {
592
+ this.currentPage = value - 1;
593
+ this.scrollPPTPage()
594
+ },
595
+ prev() {
596
+ if (this.currentPage == 0) {
597
+ return
559
598
  }
560
- })
561
- },
562
- currentChange (value) {
563
- this.currentPage = value - 1;
564
- this.scrollPPTPage()
565
- },
566
- prev(){
567
- if (this.currentPage == 0){
568
- return
569
- }
570
- this.currentPage--;
571
- this.scrollPPTPage()
572
- },
573
- next(){
574
- if (this.currentPage === (this.pageChunkData.length - 1)){
575
- return;
576
- }
577
- this.currentPage++;
578
- this.scrollPPTPage()
579
- },
580
- scrollPPTPage(){
581
- if (this.numberPage > 0){
582
- let pageNumber = this.pageChunkData[this.currentPage];
583
- let height = Math.floor(Number(this.iframeHeight.replace('px',"")));
584
- let pageHeight = Math.floor(height / this.numberPage);
585
- let scrollHeight = (pageNumber - 1) * pageHeight;
586
- let dom = document.getElementById('drawer_content_pre');
587
- if (dom){
588
- dom.scrollTo(0,scrollHeight)
599
+ this.currentPage--;
600
+ this.scrollPPTPage()
601
+ },
602
+ next() {
603
+ if (this.currentPage === (this.pageChunkData.length - 1)) {
604
+ return;
605
+ }
606
+ this.currentPage++;
607
+ this.scrollPPTPage()
608
+ },
609
+ scrollPPTPage() {
610
+ if (this.numberPage > 0) {
611
+ let pageNumber = this.pageChunkData[this.currentPage];
612
+ let height = Math.floor(Number(this.iframeHeight.replace('px', "")));
613
+ let pageHeight = Math.floor(height / this.numberPage);
614
+ let scrollHeight = (pageNumber - 1) * pageHeight;
615
+ let dom = document.getElementById('drawer_content_pre');
616
+ if (dom) {
617
+ dom.scrollTo(0, scrollHeight)
618
+ }
589
619
  }
590
620
  }
591
- }
592
621
  },
593
- beforeDestroy () {
594
- window.removeEventListener('message', this.handleIframeMessage);
595
- }
622
+ beforeDestroy() {
623
+ window.removeEventListener('message', this.handleIframeMessage);
624
+ }
596
625
  }
597
626
  </script>
598
627
 
@@ -883,6 +912,7 @@ justify-content: space-between;
883
912
  .header-right {
884
913
  display: flex;
885
914
  }
915
+
886
916
  .summaryBtn {
887
917
  flex: none;
888
918
  //width: 95px;
@@ -994,10 +1024,6 @@ justify-content: space-between;
994
1024
  overflow: auto;
995
1025
  height: calc(100% - 50px);
996
1026
  background: #FFF;
997
- background-image: url('https://guoranopen-zjk.oss-cn-zhangjiakou.aliyuncs.com/cdn-common/images/loading.gif');
998
- background-position: center;
999
- background-size: 50px;
1000
- background-repeat: no-repeat;
1001
1027
  }
1002
1028
 
1003
1029
  .libang_content_pre {