askbot-dragon 1.7.78-beta → 1.7.81-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) {
@@ -269,330 +283,346 @@ export default {
269
283
  },
270
284
  computed: {
271
285
  pdfStyle () {
272
- return {
273
- paddingTop: this.isPc ? '30px' : '0', // 30px 是 加上外层的 20 流出 50的上边距展示 放大缩小操作栏
274
- paddingBottom: this.tagIds > 1 ? '60px' : '0',
275
- height: '100%'
276
- }
286
+ return {
287
+ paddingTop: this.isPc ? '30px' : '0', // 30px 是 加上外层的 20 流出 50的上边距展示 放大缩小操作栏
288
+ paddingBottom: this.tagIds > 1 ? '60px' : '0',
289
+ height: '100%'
290
+ }
277
291
  },
278
292
  previewUrl () {
279
- console.debug('VUE_APP_ENV', process.env.VUE_APP_ENV)
280
- let url = process.env.VUE_APP_ENV === 'production' ? 'https://kkfileview.askbot.cn/onlinePreview?url=' : 'https://test.open.askbot.cn/kkfileview/onlinePreview?url='
281
- // if(this.url != '') {
282
- // if(/[\u4E00-\u9FA5]+/g.test(this.url)) {
283
- // url += btoa(encodeURIComponent(this.url))
293
+ console.debug('VUE_APP_ENV', process.env.VUE_APP_ENV)
294
+ let url = process.env.VUE_APP_ENV === 'production' ? 'https://kkfileview.askbot.cn/onlinePreview?url=' : 'https://test.open.askbot.cn/kkfileview/onlinePreview?url='
295
+ // if(this.url != '') {
296
+ // if(/[\u4E00-\u9FA5]+/g.test(this.url)) {
297
+ // url += btoa(encodeURIComponent(this.url))
298
+ // } else {
299
+ // url += btoa(this.url)
300
+ // }
301
+ // }
302
+ url = url + this.url
303
+ if (this.sourceFileType == '.ppt' || this.sourceFileType == '.pptx' || this.sourceFileType == '.pdf') {
304
+ url += '&officePreviewType=pdf'
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
+ }
316
+ // fileType() {
317
+ // const fileType = this.url.substring(this.url.lastIndexOf('.'));
318
+ // if (fileType === '.mp4' || fileType === '.MP4' || fileType === '.MOV' || fileType === '.mov') {
319
+ // return 'VIDEO'
284
320
  // } else {
285
- // url += btoa(this.url)
321
+ // return 'OTHER'
286
322
  // }
287
- // }
288
- url = url + this.url
289
- if (this.sourceFileType == '.ppt' || this.sourceFileType == '.pptx' || this.sourceFileType == '.pdf') {
290
- 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
323
 
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;
324
+ // }
316
325
  },
317
- loadIframe () {
326
+ methods: {
327
+ close() {
328
+ setTimeout(() => {
329
+ this.previewShowPopup = false;
330
+ this.fileType = ''
331
+ }, 300)
332
+ this.drawer = false;
333
+ this.showSummary = false;
334
+ },
335
+ loadIframe() {
318
336
 
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'
337
+ if (this.fileType == 'VIDEO' || this.fileType == 'WECHAT' || (this.tagIds && this.tagIds.length != 0 && this.newFileType !== 'PPT')) {
338
+ this.loading = false
339
+ } else {
340
+ let iframe = document.getElementsByClassName('preview_iframe')[0] || document.getElementsByClassName('preview_iframe_kk')[0];
341
+ if (iframe) {
342
+ iframe.onload = () => {
343
+ this.loading = false;
344
+ document.getElementById('drawer_content_pre').style.backgroundImage = 'none'
345
+ window.postMessage({
346
+ type: "wx_bind",
347
+ data: {
348
+ mainId: sessionStorage.getItem('_mainId'),
349
+ userId: sessionStorage.getItem('_currentUserId'),
350
+ test: process.env.VUE_APP_ENV !== 'production'
351
+ }
352
+ }, '*')}
327
353
  }
354
+ // let time = setInterval(() =>{
355
+ //
356
+ // if(iframe) {
357
+ // this.loading = false
358
+ // clearInterval(time)
359
+ // }
360
+ // }, 500)
328
361
  }
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
362
+ },
363
+ getBolb() {
364
+ this.$http.post('/knowledge-api/knowledge/htmlTextDeal?onlyText=false', {
365
+ fileInOssPath: this.url,
366
+ templateId: ''
367
+ }).then(res => {
368
+ if (res.data.code == 0) {
369
+ this.fileText = res.data.data
370
+ this.loading = false
371
+ }
372
+ })
373
+ },
374
+ previewToDialog(flag) {
375
+ this.$emit('previewToDialog', flag)
376
+ },
377
+ closeSummary() {
378
+ this.showSummary = false;
379
+ },
380
+ recommendQues(item, knowledgeId) {
381
+ console.log('recommendQues', item, knowledgeId);
382
+ this.$emit('recommendQues', item, knowledgeId)
383
+ },
384
+ handleIframeMessage(res) {
385
+ if (res.data.type == 'getViewerHeight') {
386
+ let iframeHeight = this.iframeHeight.replace('px', '')
387
+ if (res.data.data && iframeHeight != (res.data.data + 50)) {
388
+ this.iframeHeight = res.data.data + 50 + 'px'
389
+ }
346
390
  }
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'
391
+ if (res.data.type == 'getViewPage' && res.data.data) {
392
+ this.numberPage = Number(res.data.data);
393
+ if (this.pageChunkData.length > 0) {
394
+ this.scrollPPTPage(this.pageChunkData[0])
395
+ }
364
396
  }
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])
397
+ if (res.data.type == 'getViewerHeight' || res.data.type == 'getViewPage') {
398
+ if (this.pageChunkData.length > 0) {
399
+ this.scrollPPTPage(this.pageChunkData[0])
400
+ }
370
401
  }
371
- }
372
- if (res.data.type == 'getViewerHeight' || res.data.type == 'getViewPage'){
373
- if (this.pageChunkData.length > 0){
374
- this.scrollPPTPage(this.pageChunkData[0])
402
+ },
403
+ summaryFun() {
404
+ this.showSummary = !this.showSummary;
405
+ if (this.showSummary) {
406
+ document.getElementById('drawer_content_pre').scrollTop = 0;
375
407
  }
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;
408
+ },
409
+ getSummarySuccess() {
410
+ this.$nextTick(() => {
411
+ // if (this.tagIds.length > 0){
412
+ // let intelligentSummary = document.getElementById('intelligentSummary');
413
+ // let preCon = document.querySelector('.pdf_view')
414
+ // if (intelligentSummary){
415
+ // let height = intelligentSummary.offsetHeight + (this.isPc ? 100 : 50 );
416
+ // if (preCon){
417
+ // preCon.style.height = 'calc(100% - ' + height + 'px)'
418
+ // }
419
+ // console.log('height',height,preCon)
420
+ // }
421
+ // }
422
+ // let intelligentSummary = document.getElementById('intelligentSummary');
423
+ // let height = intelligentSummary.offsetHeight
424
+ // this.pdfStyle.height = 'calc(100% - ' + height + 'px)'
425
+ })
426
+ },
427
+ getTextWatermark() {
428
+ let url = '/knowledge-api/open/knowledge/getPermissionInfo';
429
+ let obj = {
430
+ "knowledgeId": this.knowledgeId,
431
+ "userId": sessionStorage.getItem('_currentUserId'),
432
+ "mainId": sessionStorage.getItem('_mainId'),
433
+ "corpId": sessionStorage.getItem('_corpid')
415
434
  }
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",
435
+ this.$http.post(url, obj).then(res => {
436
+ console.log('getTextWatermark', res.data.data)
437
+ if (res.data.data) {
438
+ this.textWatermarkStr = res.data.data.textWatermarkStr;
439
+ this.isDownload = res.data.data.showDownloadBtn;
440
+ }
441
+ })
442
+ },
443
+ downLoad() {
444
+ // if (this.formKnowledgeManagement) {
445
+ // this.$emit('downLoad', this.previewOssPath);
446
+ // return
447
+ // }
448
+ let url = this.previewOssPath
449
+ if (decodeURIComponent(url) != url) {
450
+ url = decodeURIComponent(url)
427
451
  }
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);
452
+ const fileType = url.substring(url.lastIndexOf('.'));
453
+ this.$http.post('/knowledge-api/temporary-certificate/or-origin?expired=10', url, {
454
+ headers: {
455
+ "Content-Type": "application/json",
456
+ }
457
+ }).then(res => {
458
+ console.log('downLoad 341', res)
459
+ if (res.data || res.bodyText) {
460
+ if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
461
+ this.copy = res.data
462
+ if (isMobile()) {
463
+ setTimeout(() => {
464
+ const range = document.createRange();
465
+ range.selectNode(document.getElementById('text'));
466
+ const selection = window.getSelection();
467
+ //移除之前选中内容
468
+ if (selection.rangeCount > 0) selection.removeAllRanges();
469
+ selection.addRange(range);
470
+ document.execCommand('copy');
471
+ selection.removeAllRanges()
472
+ Toast(this.$t('dragonCommon.Safaridownload'));
473
+ this.close()
474
+ }, 100)
475
+ } else {
476
+ let a = document.createElement('a')
477
+ a.href = res.data
478
+ a.download = (this.title) + fileType
479
+ a.dispatchEvent(new MouseEvent('click', { bubbles: true, cancelable: true, view: window }))
480
+ }
481
+ return
469
482
  } 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 }))
483
+ // setTimeout(() =>{
484
+ // window.open(res.data,'下载', 'noopener')
485
+ // }, 2000)
486
+ // window.open(res.data,'下载', 'noopener')
487
+ if (isMobile()) {
488
+
489
+ const iframe = document.createElement("iframe");
490
+ iframe.setAttribute("hidden", "hidden");
491
+ iframe.onload = () => {
492
+ if (iframe) {
493
+ console.log("iframe onload....")
494
+ iframe.setAttribute('src', 'about:blank');
495
+ }
496
+ };
497
+ document.body.insertBefore(iframe, null);
498
+ iframe.setAttribute("src", res.data);
499
+ } else {
500
+ let a = document.createElement('a')
501
+ a.href = res.data
502
+ a.download = (this.title) + fileType
503
+ a.dispatchEvent(new MouseEvent('click', { bubbles: true, cancelable: true, view: window }))
504
+ }
505
+ this.close()
474
506
  }
475
- this.close()
476
507
  }
508
+ })
509
+ },
510
+ isPcFun() {
511
+ if (/(iPhone|iPad|iPod|iOS|Android)/i.test(navigator.userAgent)) {
512
+ this.isPc = false
513
+ } else {
514
+ this.isPc = true
477
515
  }
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;
516
+ },
517
+ clickFloder() {
518
+ this.$emit('previewClickFloder')
519
+ },
520
+ getOssPath(url) {
521
+ let httpUrl = '/knowledge-api/knowledge/getTemporaryCertificate';
522
+ let type = this.getFileType(url)
523
+ this.newFileType = type;
524
+ if (type === 'VIDEO' || type === 'PDF' || type === 'EXCEL' || type === 'TXT' || type === 'DOC') {
525
+ httpUrl += '?needEncrypt=false'
526
+ } else {
527
+ httpUrl += '?needEncrypt=true'
505
528
  }
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)
529
+ this.$http.post(httpUrl, {
530
+ "fileInOssPath": url
531
+ }).then(res => {
532
+ console.log('getOssPath', res)
533
+ if (res.data.code == '0') {
534
+ this.previewHref = res.data.data;
535
+ }
536
+ })
537
+ },
538
+ getFileType(url) {
539
+ let index = url.lastIndexOf('?')
540
+ let newFileInOssPath = url.substring(0, url.indexOf("?"))
541
+ if (index == -1) {
542
+ newFileInOssPath = url
543
+ }
544
+ const fileType = newFileInOssPath.substring(newFileInOssPath.lastIndexOf('.'));
545
+ if (fileType === '.mp4' || fileType === '.MP4' || fileType === '.MOV' || fileType === '.MOVC' || fileType === '.mov' || fileType === '.movc') {
546
+ return 'VIDEO'
547
+ } else if (fileType === '.html') {
548
+ return 'HTML'
549
+ } else if (fileType === '.png' || fileType === '.jpg' || fileType === '.jpeg' || fileType === '.PNG' || fileType === '.JPG' || fileType === '.JPEG') {
550
+ return 'IMAGE'
551
+ } else if (fileType === '.docx' || fileType === '.doc') {
552
+ return 'DOC'
553
+ } else if (fileType === '.ppt' || fileType === '.pptx') {
554
+ return 'PPT'
555
+ } else if (fileType === '.pdf') {
556
+ return 'PDF'
557
+ } else if (fileType === '.txt') {
558
+ return 'TXT'
559
+ } else {
560
+ return 'OTHER'
561
+ }
562
+ },
563
+ //判断是否使用新定位组件
564
+ getLocationInfo() {
565
+ this.newVersion = "";
566
+ this.$http.get('/knowledge-api/knowledge/knowledge-part-location-info/list?ids=' + this.tagIds.join(',')).then(res => {
567
+ console.log('getLocationInfo', res)
568
+ this.pageChunkData = [];
569
+ if (res.data.code == 0) {
570
+ if (res.data.data && res.data.data.length > 0 && res.data.data[0].extractVersion == 'v3') {
571
+ this.newVersion = true;
572
+ if (this.newFileType !== 'PPT') {
573
+ this.loading = false;
548
574
  }
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'
575
+ for (let i = 0; i < res.data.data.length; i++) {
576
+ if (res.data.data[i].paragraphChunkInfo && res.data.data[i].paragraphChunkInfo.pageChunkData) {
577
+ this.pageChunkData.push(res.data.data[i].paragraphChunkInfo.pageChunkData.page_number)
578
+ }
554
579
  }
580
+ if (this.pageChunkData.length > 1) {
581
+ let iframe = document.getElementsByClassName('preview_iframe_kk')
582
+ if (iframe && iframe.length > 0) {
583
+ iframe[0].style.paddingBottom = '50px'
584
+ }
585
+ }
586
+ } else {
587
+ this.newVersion = false;
555
588
  }
556
- } else {
557
- this.newVersion = false;
558
589
  }
590
+ })
591
+ },
592
+ currentChange(value) {
593
+ this.currentPage = value - 1;
594
+ this.scrollPPTPage()
595
+ },
596
+ prev() {
597
+ if (this.currentPage == 0) {
598
+ return
559
599
  }
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)
600
+ this.currentPage--;
601
+ this.scrollPPTPage()
602
+ },
603
+ next() {
604
+ if (this.currentPage === (this.pageChunkData.length - 1)) {
605
+ return;
606
+ }
607
+ this.currentPage++;
608
+ this.scrollPPTPage()
609
+ },
610
+ scrollPPTPage() {
611
+ if (this.numberPage > 0) {
612
+ let pageNumber = this.pageChunkData[this.currentPage];
613
+ let height = Math.floor(Number(this.iframeHeight.replace('px', "")));
614
+ let pageHeight = Math.floor(height / this.numberPage);
615
+ let scrollHeight = (pageNumber - 1) * pageHeight;
616
+ let dom = document.getElementById('drawer_content_pre');
617
+ if (dom) {
618
+ dom.scrollTo(0, scrollHeight)
619
+ }
589
620
  }
590
621
  }
591
- }
592
622
  },
593
- beforeDestroy () {
594
- window.removeEventListener('message', this.handleIframeMessage);
595
- }
623
+ beforeDestroy() {
624
+ window.removeEventListener('message', this.handleIframeMessage);
625
+ }
596
626
  }
597
627
  </script>
598
628
 
@@ -883,6 +913,7 @@ justify-content: space-between;
883
913
  .header-right {
884
914
  display: flex;
885
915
  }
916
+
886
917
  .summaryBtn {
887
918
  flex: none;
888
919
  //width: 95px;
@@ -994,10 +1025,6 @@ justify-content: space-between;
994
1025
  overflow: auto;
995
1026
  height: calc(100% - 50px);
996
1027
  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
1028
  }
1002
1029
 
1003
1030
  .libang_content_pre {