askbot-dragon 1.7.35-beta → 1.7.36-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.35-beta",
3
+ "version": "1.7.36-beta",
4
4
  "scripts": {
5
5
  "serve": "vue-cli-service serve",
6
6
  "build": "vue-cli-service build",
@@ -361,26 +361,21 @@ export default {
361
361
  this.$refs.previewPdf.previewShowPopup = false;
362
362
  this.$refs.previewPdf.drawer = false;
363
363
  this.previewOssPath = url;
364
- // let index = url.lastIndexOf('?')
364
+ let index = url.lastIndexOf('?')
365
365
  let type = ''
366
366
  let httpUrl = '/knowledge-api/knowledge/getTemporaryCertificate'
367
- // if (index !== -1) {
368
- // url = url.substring(0, index)
369
- // type = this.fileType(url)
370
- // } else {
371
- // type = this.fileType(url)
372
- // }
373
- // if (type === '' || type === 'OTHER' || type == 'IMAGE') {
374
- // httpUrl = httpUrl += '?needEncrypt=true'
375
- // } else {
376
- // httpUrl = httpUrl += '?needEncrypt=false'
377
- // }
378
- type = this.getFileType(url)
379
- if (type === 'VIDEO' || type === 'PDF' || type === 'EXCEL' || type === 'TXT' || type === 'DOC') {
380
- httpUrl += '?needEncrypt=false'
367
+ if (index !== -1) {
368
+ url = url.substring(0, index)
369
+ type = this.fileType(url)
381
370
  } else {
382
- httpUrl += '?needEncrypt=true'
371
+ type = this.fileType(url)
383
372
  }
373
+ if (type === '' || type === 'OTHER' || type == 'IMAGE') {
374
+ httpUrl = httpUrl += '?needEncrypt=true'
375
+ } else {
376
+ httpUrl = httpUrl += '?needEncrypt=false'
377
+ }
378
+ this.$refs.previewPdf.getOssPath(url);
384
379
  this.$http.post(httpUrl, {
385
380
  "fileInOssPath": url
386
381
  }).then(res => {
@@ -449,31 +444,6 @@ export default {
449
444
  return 'OTHER'
450
445
  }
451
446
  },
452
- getFileType(url){
453
- let index = url.lastIndexOf('?')
454
- let newFileInOssPath = url.substring(0, url.indexOf("?"))
455
- if (index == -1){
456
- newFileInOssPath = url
457
- }
458
- const fileType = newFileInOssPath.substring(newFileInOssPath.lastIndexOf('.'));
459
- if (fileType === '.mp4' || fileType === '.MP4' || fileType === '.MOV' || fileType === '.MOVC' || fileType === '.mov' || fileType === '.movc') {
460
- return 'VIDEO'
461
- } else if (fileType === '.html') {
462
- return 'HTML'
463
- } else if (fileType === '.png' || fileType === '.jpg' || fileType === '.jpeg' || fileType === '.PNG' || fileType === '.JPG' || fileType === '.JPEG') {
464
- return 'IMAGE'
465
- } else if (fileType === '.docx'){
466
- return 'DOC'
467
- } else if (fileType === '.ppt' || fileType === '.pptx'){
468
- return 'PPT'
469
- } else if (fileType === '.pdf'){
470
- return 'PDF'
471
- } else if (fileType === '.txt'){
472
- return 'TXT'
473
- } else {
474
- return 'OTHER'
475
- }
476
- },
477
447
  srcContentTypeIMG (item) {
478
448
  let url = item.url || '';
479
449
  const type = url.substring(url.lastIndexOf('.'));
@@ -598,6 +598,7 @@ export default {
598
598
  async mounted() {
599
599
  window.addEventListener("resize", this.onResize);
600
600
  this.pdfFile = this.ossPath;
601
+ console.log('ossPath',this.ossPath)
601
602
  // this.clearPages();
602
603
  // this.loadPdf();
603
604
  },
@@ -619,6 +620,14 @@ export default {
619
620
  },
620
621
  immediate:true,
621
622
  deep:true
623
+ },
624
+ ossPath:{
625
+ handler(val){
626
+ if (val){
627
+ this.pdfFile = this.ossPath;
628
+ }
629
+ },
630
+ immediate:true
622
631
  }
623
632
  }
624
633
  };
@@ -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="url"></new-position-preview>
98
+ <new-position-preview v-else-if="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>
@@ -150,7 +150,8 @@ export default {
150
150
  isDownload: false,
151
151
  textWatermarkStr:"",
152
152
  copy:'',
153
- newVersion:''}
153
+ newVersion:'',
154
+ previewHref:""}
154
155
  },
155
156
  mounted() {
156
157
  window.addEventListener('message',this.handleIframeMessage,false);
@@ -475,9 +476,52 @@ export default {
475
476
  clickFloder() {
476
477
  this.$emit('previewClickFloder')
477
478
  },
479
+ getOssPath(url){
480
+ let httpUrl = '/knowledge-api/knowledge/getTemporaryCertificate';
481
+ let type = this.getFileType(url)
482
+ if (type === 'VIDEO' || type === 'PDF' || type === 'EXCEL' || type === 'TXT' || type === 'DOC') {
483
+ httpUrl += '?needEncrypt=false'
484
+ } else {
485
+ httpUrl += '?needEncrypt=true'
486
+ }
487
+ this.$http.post(httpUrl, {
488
+ "fileInOssPath": url
489
+ }).then(res => {
490
+ console.log('getOssPath',res)
491
+ if (res.data.code == '0'){
492
+ this.previewHref = res.data.data;
493
+ }
494
+ })
495
+ },
496
+ getFileType(url){
497
+ let index = url.lastIndexOf('?')
498
+ let newFileInOssPath = url.substring(0, url.indexOf("?"))
499
+ if (index == -1){
500
+ newFileInOssPath = url
501
+ }
502
+ const fileType = newFileInOssPath.substring(newFileInOssPath.lastIndexOf('.'));
503
+ if (fileType === '.mp4' || fileType === '.MP4' || fileType === '.MOV' || fileType === '.MOVC' || fileType === '.mov' || fileType === '.movc') {
504
+ return 'VIDEO'
505
+ } else if (fileType === '.html') {
506
+ return 'HTML'
507
+ } else if (fileType === '.png' || fileType === '.jpg' || fileType === '.jpeg' || fileType === '.PNG' || fileType === '.JPG' || fileType === '.JPEG') {
508
+ return 'IMAGE'
509
+ } else if (fileType === '.docx'){
510
+ return 'DOC'
511
+ } else if (fileType === '.ppt' || fileType === '.pptx'){
512
+ return 'PPT'
513
+ } else if (fileType === '.pdf'){
514
+ return 'PDF'
515
+ } else if (fileType === '.txt'){
516
+ return 'TXT'
517
+ } else {
518
+ return 'OTHER'
519
+ }
520
+ },
478
521
  //判断是否使用新定位组件
479
522
  getLocationInfo(){
480
523
  this.$http.get('/knowledge-api/knowledge/knowledge-part-location-info/list?ids=' + this.tagIds.join(',')).then(res => {
524
+ console.log('getLocationInfo',res)
481
525
  if (res.data.code == 0){
482
526
  if (res.data.data && res.data.data.length > 0 && res.data.data[0].extractVersion == 'v3'){
483
527
  this.newVersion = true;