askbot-dragon 1.7.49-beta → 1.7.52-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.
Files changed (95) hide show
  1. package/README.md +27 -27
  2. package/babel.config.js +6 -6
  3. package/dragon.iml +7 -7
  4. package/package.json +56 -56
  5. package/public/index.html +73 -75
  6. package/src/App.vue +31 -31
  7. package/src/api/index.js +1 -1
  8. package/src/api/mock.http +2 -2
  9. package/src/api/requestUrl.js +185 -185
  10. package/src/assets/js/AliyunlssUtil.js +141 -117
  11. package/src/assets/js/Base64Util.js +22 -22
  12. package/src/assets/js/common.js +252 -252
  13. package/src/assets/js/hammer.js +100 -89
  14. package/src/assets/js/script.js +36 -36
  15. package/src/assets/less/common.css +6773 -6773
  16. package/src/assets/less/converSationContainer/common.less +199 -192
  17. package/src/assets/less/converSationContainer/converSatonContainer.less +493 -493
  18. package/src/assets/less/iconfont.css +37 -37
  19. package/src/assets/less/ticketMessage.less +294 -294
  20. package/src/components/ActionAlertIframe.vue +177 -154
  21. package/src/components/AiGuide.vue +438 -471
  22. package/src/components/AnswerDocknowledge.vue +1100 -1088
  23. package/src/components/AnswerVoice.vue +285 -285
  24. package/src/components/AskIFrame.vue +15 -15
  25. package/src/components/ConversationContainer.vue +10766 -10873
  26. package/src/components/FileType.vue +86 -86
  27. package/src/components/Message.vue +27 -27
  28. package/src/components/MyEditor.vue +342 -341
  29. package/src/components/QwFeedback.vue +301 -301
  30. package/src/components/actionSatisfaction.vue +107 -107
  31. package/src/components/actionSendToBot.vue +62 -62
  32. package/src/components/answerDissatisfaction.vue +62 -62
  33. package/src/components/answerRadio.vue +211 -213
  34. package/src/components/ask-components/DissatisfactionOptions.vue +57 -57
  35. package/src/components/ask-components/Msgloading.vue +37 -37
  36. package/src/components/ask-components/SatisfactionV2.vue +15 -15
  37. package/src/components/askVideo.vue +162 -139
  38. package/src/components/assetDetails.vue +378 -378
  39. package/src/components/assetMessage.vue +228 -226
  40. package/src/components/associationIntention.vue +378 -374
  41. package/src/components/attachmentPreview.vue +90 -90
  42. package/src/components/botActionSatisfactor.vue +68 -68
  43. package/src/components/chatContent.vue +513 -513
  44. package/src/components/feedBack.vue +136 -136
  45. package/src/components/fielListView.vue +351 -351
  46. package/src/components/file/AliyunOssComponents.vue +108 -108
  47. package/src/components/formTemplate.vue +3501 -3497
  48. package/src/components/imgView.vue +31 -31
  49. package/src/components/intelligentSummary.vue +231 -229
  50. package/src/components/kkview.vue +1138 -1138
  51. package/src/components/loadingProcess.vue +164 -164
  52. package/src/components/markDownText.vue +197 -197
  53. package/src/components/message/ActionAlertIframe.vue +112 -112
  54. package/src/components/message/ShopMessage.vue +164 -164
  55. package/src/components/message/TextMessage.vue +928 -924
  56. package/src/components/message/TicketMessage.vue +201 -201
  57. package/src/components/message/swiper/index.js +4 -4
  58. package/src/components/message/swiper/ticketSwiper.vue +503 -503
  59. package/src/components/message/swiper/ticketSwiperItem.vue +61 -61
  60. package/src/components/msgLoading.vue +231 -231
  61. package/src/components/myPopup.vue +70 -70
  62. package/src/components/newPdfPosition.vue +878 -0
  63. package/src/components/pagination.vue +129 -0
  64. package/src/components/pdfPosition.vue +1514 -1342
  65. package/src/components/popup.vue +227 -227
  66. package/src/components/preview/docView.vue +112 -0
  67. package/src/components/preview/excelView.vue +179 -0
  68. package/src/components/preview/newPositionPreview.vue +370 -0
  69. package/src/components/preview/pdfView.vue +824 -0
  70. package/src/components/previewDoc.vue +251 -247
  71. package/src/components/previewPdf.vue +1093 -774
  72. package/src/components/receiverMessagePlatform.vue +65 -66
  73. package/src/components/recommend.vue +80 -80
  74. package/src/components/selector/hOption.vue +20 -20
  75. package/src/components/selector/hSelector.vue +199 -199
  76. package/src/components/selector/hWrapper.vue +216 -216
  77. package/src/components/senderMessagePlatform.vue +50 -55
  78. package/src/components/source/BotMessage.vue +24 -24
  79. package/src/components/source/CustomMessage.vue +24 -24
  80. package/src/components/test.vue +260 -260
  81. package/src/components/tree.vue +307 -307
  82. package/src/components/utils/AliyunIssUtil.js +103 -103
  83. package/src/components/utils/ckeditor.js +185 -185
  84. package/src/components/utils/format_date.js +25 -25
  85. package/src/components/utils/index.js +6 -6
  86. package/src/components/utils/math_utils.js +29 -29
  87. package/src/components/voiceComponent.vue +119 -119
  88. package/src/components/welcomeKnowledgeFile.vue +344 -340
  89. package/src/components/welcomeLlmCard.vue +144 -140
  90. package/src/components/welcomeSuggest.vue +97 -97
  91. package/src/locales/cn.json +71 -61
  92. package/src/locales/en.json +73 -62
  93. package/src/locales/jp.json +73 -0
  94. package/src/main.js +75 -76
  95. package/vue.config.js +54 -54
@@ -1,774 +1,1093 @@
1
-
2
- <!-- preview-pdf
3
- 组件主要负责 知识项目中 文件的预览,携带定位信息参数 tagIds tagId 的会解析文件增加定位功能
4
- 不携带定位信息的 也是走 kkview项目预览
5
- 另外增加了在知识项目中预览当前文件的一些功能
6
- -->
7
- <template>
8
- <el-drawer title="" :visible.sync="drawer" :with-header="false" :append-to-body="true" :destroy-on-close="true"
9
- :modal="false" :direction="previewShowPopup ? 'btt' : 'rtl'" :size="previewShowPopup ? '90%' : '65%'"
10
- custom-class="pdf-preview-drawer" v-if="drawer">
11
- <div class="drawer-header" :class="isLiBang ? 'libang_head' : ''" v-if="!isPc">
12
- <div class="header-btn btn_position">
13
- <div class="onload_btn" v-if="isDownload" @click="downLoad">
14
- {{ $t('dragonCommon.download') }}
15
- </div>
16
- <div class="summaryBtn" :class="showSummary ? 'summaryActiveBtn' : ''" @click="summaryFun" v-if="isHasChat">
17
- <i class="iconfont guoran-tongyichicun-write-29-jiqiren"></i>
18
- <span>{{ $t('dragonCommon.smartSummary') }}</span>
19
- </div>
20
- <template v-if="isHasChat">
21
- <div class="chat" @click="previewToDialog(true)" v-if="!previewKnowledgeId">
22
- <i class="iconfont guoran-wendapingjia"></i>
23
- {{ $t('dragonCommon.chat') }}
24
- </div>
25
- <div class="chat chat_active" @click="previewToDialog(false)" v-else>
26
- <i class="iconfont guoran-wendapingjia"></i>
27
- {{ $t('dragonCommon.chat') }}
28
- </div>
29
- </template>
30
- </div>
31
- <div class="header_title">
32
- <div class="header_close">
33
- <span class="title_left">
34
- {{ title ? title : $t('dragonCommon.viewDetails') }}
35
- </span>
36
- <section @click="close">
37
- <i class="iconfont guoran-shanchu"></i>
38
- </section>
39
- </div>
40
- <p v-if="folderName && isLiBang" class="header_floder" @click="clickFloder">
41
- <i class="iconfont guoran-tongyichicun-wenjianjia-zhankaizhuangtai--folderOpen"></i>
42
- {{ folderName }}
43
- <i v-if="folderUrl" class="iconfont guoran-tongyichicun-dianjichakantuli"></i>
44
- </p>
45
- </div>
46
- </div>
47
- <div class="drawer-header" :class="isLiBang && folderName ? 'libang_head' : ''" v-else>
48
- <div class="header_title">
49
- <div :class="isLiBang && folderName ? 'header_close' : 'header_top'">
50
- <span class="title_left">
51
- {{ title ? title : $t('dragonCommon.viewDetails') }}
52
- </span>
53
- <div class="header-btn">
54
- <div class="onload_btn" v-if="isDownload" @click="downLoad">
55
- {{ $t('dragonCommon.download') }}
56
- </div>
57
- <div class="summaryBtn" :class="showSummary ? 'summaryActiveBtn' : ''" @click="summaryFun"
58
- v-if="isHasChat">
59
- <i class="iconfont guoran-tongyichicun-write-29-jiqiren"></i>
60
- <span>{{ $t('dragonCommon.smartSummary') }}</span>
61
- </div>
62
- <template v-if="isHasChat">
63
- <div class="chat" @click="previewToDialog(true)" v-if="!previewKnowledgeId">
64
- <i class="iconfont guoran-wendapingjia"></i>
65
- {{ $t('dragonCommon.chat') }}
66
- </div>
67
- <div class="chat chat_active" @click="previewToDialog(false)" v-else>
68
- <i class="iconfont guoran-wendapingjia"></i>
69
- {{ $t('dragonCommon.chat') }}
70
- </div>
71
- </template>
72
- <section @click="close">
73
- <i class="iconfont guoran-shanchu"></i>
74
- </section>
75
- </div>
76
- </div>
77
- <p v-if="folderName && isLiBang" class="header_floder" @click="clickFloder">
78
- <i class="iconfont guoran-tongyichicun-wenjianjia-zhankaizhuangtai--folderOpen"></i>
79
- {{ folderName }}
80
- <i v-if="folderUrl" class="iconfont guoran-tongyichicun-dianjichakantuli"></i>
81
- </p>
82
- </div>
83
- </div>
84
- <div id="drawer_content_pre" :class="isLiBang && folderName ? 'libang_content_pre' : ''">
85
- <intelligent-summary v-show="showSummary && isHasChat" :tagIds="tagIds" :knowledgeId="knowledgeId"
86
- @closeSummary="closeSummary" @recommendQues="recommendQues"
87
- @getSummarySuccess="getSummarySuccess"></intelligent-summary>
88
- <div class="pdf_positon" :style="pdfStyle" v-if="tagIds && tagIds.length != 0 && drawer">
89
- <pdfPosition :tagIds="tagIds" :isMessageRecord="isMessageRecord" :textWatermarkStr="textWatermarkStr">
90
- </pdfPosition>
91
- </div>
92
- <template v-else>
93
- <div v-if="fileType == 'VIDEO'" style="width: 100%;">
94
- <video :src="url" controls width="100%;" height="98%"></video>
95
- </div>
96
- <div v-else-if="fileType == 'HTML'" style="width: 100%;">
97
- <div class="preview_iframe_html" style="text-align:left" v-html="fileText"></div>
98
- </div>
99
- <template v-else-if="url.includes('https://www') || url.includes('http://www')">
100
- <iframe class="preview_iframe" :src="url" width="100%" height="100%" scrolling="100%" frameborder="no"
101
- border="0"></iframe>
102
- </template>
103
- <template v-else>
104
- <iframe class="preview_iframe_kk" :src="previewUrl" style="border:none;"
105
- :style="{ height: iframeHeight }"></iframe>
106
- </template>
107
- </template>
108
- </div>
109
- <div class="loading_img" v-show="loading">
110
- <img src="https://guoranopen-zjk.oss-cn-zhangjiakou.aliyuncs.com/cdn-common/images/loading.gif" alt="">
111
- </div>
112
- <div id="text">
113
- {{ copy }}
114
- </div>
115
- </el-drawer>
116
- </template>
117
-
118
- <script>
119
- import pdfPosition from './pdfPosition.vue'
120
- import { zoomElement } from '../assets/js/hammer'
121
- import IntelligentSummary from "./intelligentSummary";
122
- import { isMobile } from "../assets/js/common";
123
- import { Toast } from 'vant';
124
- export default {
125
- data () {
126
- return {
127
- previewShowPopup: false,
128
- fileText: '',
129
- fileType: "",
130
- isPc: false,
131
- drawer: false,
132
- tagIds: [],
133
- // '6454aa1a70573a6ead6f0f7d', '6454aa1a70573a6ead6f0f81',
134
- loading: true,
135
- previewKnowledgeId: "",
136
- showSummary: true,
137
- iframeHeight: "100%",
138
- isDownload: false,
139
- textWatermarkStr: "",
140
- copy:''
141
- }
142
- },
143
- mounted () {
144
- window.addEventListener('message', this.handleIframeMessage, false);
145
- this.isPcFun();
146
- },
147
- props: {
148
- url: {
149
- type: String,
150
- required: true,
151
- },
152
- officePreviewType: {
153
- type: String,
154
- default: ''
155
- },
156
- isMessageRecord: {
157
- type: Boolean,
158
- default: false,
159
- },
160
- sourceFileType: {
161
- type: String,
162
- default: '',
163
- },
164
- title: {
165
- type: String,
166
- default: ''
167
- },
168
- isHasChat: {
169
- type: Boolean,
170
- default: false
171
- },
172
- knowledgeId: {
173
- type: String,
174
- default: '',
175
- },
176
- previewOssPath: {
177
- type: String,
178
- default: '',
179
- },
180
- folderName: {
181
- type: String,
182
- default: '',
183
- },
184
- folderUrl: {
185
- type: String,
186
- default: '',
187
- },
188
- isLiBang: {
189
- type: Boolean,
190
- default: false
191
- }},
192
- components: {
193
- IntelligentSummary,
194
- pdfPosition
195
- },
196
- watch: {
197
- drawer (value) {
198
- if (value) {
199
- this.$emit('open')
200
- this.$nextTick(() => {
201
- zoomElement(document.getElementById('drawer_content_pre'))
202
- })
203
- } else {
204
- this.$emit('close')
205
- }
206
- },
207
- showSummary: {
208
- handler (val) {
209
- // if (!val){
210
- // this.$nextTick(() => {
211
- // let preCon = document.querySelector('.pdf_view');
212
- // if (preCon){
213
- // preCon.style.height = 'calc(100% - ' + 50 + 'px)'
214
- // }
215
- // })
216
- // } else {
217
- // this.getSummarySuccess();
218
- // }
219
- if (val) {
220
- this.getSummarySuccess();
221
- }
222
- }
223
- },
224
- knowledgeId: {
225
- handler (val) {
226
- if (val) {
227
- this.getTextWatermark();
228
- }
229
- }
230
- }
231
- },
232
- computed: {
233
- pdfStyle () {
234
- return {
235
- paddingTop: this.isPc ? '30px' : '0', // 30px 是 加上外层的 20 流出 50的上边距展示 放大缩小操作栏
236
- paddingBottom: this.tagIds > 1 ? '60px' : '0',
237
- height: '100%'
238
- }
239
- },
240
- previewUrl () {
241
- console.debug('VUE_APP_ENV', process.env.VUE_APP_ENV)
242
- let url = process.env.VUE_APP_ENV === 'production' ? 'https://kkfileview.askbot.cn/onlinePreview?url=' : 'https://test.open.askbot.cn/kkfileview/onlinePreview?url='
243
- // if(this.url != '') {
244
- // if(/[\u4E00-\u9FA5]+/g.test(this.url)) {
245
- // url += btoa(encodeURIComponent(this.url))
246
- // } else {
247
- // url += btoa(this.url)
248
- // }
249
- // }
250
- url = url + this.url
251
- if (this.sourceFileType == '.ppt' || this.sourceFileType == '.pptx' || this.sourceFileType == '.pdf') {
252
- url += '&officePreviewType=pdf'
253
- }
254
- console.log('textWatermarkStr 216', this.textWatermarkStr)
255
- if (this.textWatermarkStr) {
256
- url += '&textWatermarkValue=' + this.textWatermarkStr
257
- }
258
- return url
259
- },
260
- // fileType() {
261
- // const fileType = this.url.substring(this.url.lastIndexOf('.'));
262
- // if (fileType === '.mp4' || fileType === '.MP4' || fileType === '.MOV' || fileType === '.mov') {
263
- // return 'VIDEO'
264
- // } else {
265
- // return 'OTHER'
266
- // }
267
-
268
- // }
269
- },
270
- methods: {
271
- close () {
272
- setTimeout(() => {
273
- this.previewShowPopup = false;
274
- this.fileType = ''
275
- }, 300)
276
- this.drawer = false;
277
- this.showSummary = false;
278
- },
279
- loadIframe () {
280
-
281
- if (this.fileType == 'VIDEO' || this.fileType == 'WECHAT' || (this.tagIds && this.tagIds.length != 0)) {
282
- this.loading = false
283
- } else {
284
- let iframe = document.getElementsByClassName('preview_iframe')[0] || document.getElementsByClassName('preview_iframe_kk')[0];
285
- if (iframe) {
286
- iframe.onload = () => {
287
- this.loading = false;
288
- document.getElementById('drawer_content_pre').style.backgroundImage = 'none'
289
- }
290
- }
291
- // let time = setInterval(() =>{
292
- //
293
- // if(iframe) {
294
- // this.loading = false
295
- // clearInterval(time)
296
- // }
297
- // }, 500)
298
- }
299
- },
300
- getBolb () {
301
- this.$http.post('/knowledge-api/knowledge/htmlTextDeal?onlyText=false', {
302
- fileInOssPath: this.url,
303
- templateId: ''
304
- }).then(res => {
305
- if (res.data.code == 0) {
306
- this.fileText = res.data.data
307
- this.loading = false
308
- }
309
- })
310
- },
311
- previewToDialog (flag) {
312
- this.$emit('previewToDialog', flag)
313
- },
314
- closeSummary () {
315
- this.showSummary = false;
316
- },
317
- recommendQues (item, knowledgeId) {
318
- console.log('recommendQues', item, knowledgeId);
319
- this.$emit('recommendQues', item, knowledgeId)
320
- },
321
- handleIframeMessage (res) {
322
- console.log('handleIframeMessage', res)
323
- if (res.data.type == 'getViewerHeight') {
324
- let iframeHeight = this.iframeHeight.replace('px', '')
325
- if (res.data.data && iframeHeight != (res.data.data + 50)) {
326
- this.iframeHeight = res.data.data + 50 + 'px'
327
- }
328
- }
329
- },
330
- summaryFun () {
331
- this.showSummary = !this.showSummary;
332
- if (this.showSummary) {
333
- document.getElementById('drawer_content_pre').scrollTop = 0;
334
- }
335
- },
336
- getSummarySuccess () {
337
- this.$nextTick(() => {
338
- // if (this.tagIds.length > 0){
339
- // let intelligentSummary = document.getElementById('intelligentSummary');
340
- // let preCon = document.querySelector('.pdf_view')
341
- // if (intelligentSummary){
342
- // let height = intelligentSummary.offsetHeight + (this.isPc ? 100 : 50 );
343
- // if (preCon){
344
- // preCon.style.height = 'calc(100% - ' + height + 'px)'
345
- // }
346
- // console.log('height',height,preCon)
347
- // }
348
- // }
349
- // let intelligentSummary = document.getElementById('intelligentSummary');
350
- // let height = intelligentSummary.offsetHeight
351
- // this.pdfStyle.height = 'calc(100% - ' + height + 'px)'
352
- })
353
- },
354
- getTextWatermark () {
355
- let url = '/knowledge-api/open/knowledge/getPermissionInfo';
356
- let obj = {
357
- "knowledgeId": this.knowledgeId,
358
- "userId": sessionStorage.getItem('_currentUserId'),
359
- "mainId": sessionStorage.getItem('_mainId'),
360
- "corpId": sessionStorage.getItem('_corpid')
361
- }
362
- this.$http.post(url, obj).then(res => {
363
- console.log('getTextWatermark', res.data.data)
364
- if (res.data.data) {
365
- this.textWatermarkStr = res.data.data.textWatermarkStr;
366
- this.isDownload = res.data.data.showDownloadBtn;
367
- }
368
- })
369
- },
370
- downLoad () {
371
- let url = this.previewOssPath
372
- if (decodeURIComponent(url) != url) {
373
- url = decodeURIComponent(url)
374
- }
375
- const fileType = url.substring(url.lastIndexOf('.'));
376
- this.$http.post('/knowledge-api/temporary-certificate/or-origin?expired=10', url, {
377
- headers: {
378
- "Content-Type": "application/json",
379
- }
380
- }).then(res => {
381
- console.log('downLoad 341', res)
382
- if (res.data || res.bodyText) {
383
- if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
384
- this.copy = res.data
385
- if (isMobile()) {
386
- setTimeout(() =>{
387
- const range = document.createRange();
388
- range.selectNode(document.getElementById('text'));
389
- const selection = window.getSelection();
390
- //移除之前选中内容
391
- if (selection.rangeCount > 0) selection.removeAllRanges();
392
- selection.addRange(range);
393
- document.execCommand('copy');
394
- selection.removeAllRanges()
395
- Toast(this.$t('dragonCommon.Safaridownload'));
396
- this.close()
397
- },100)
398
- } else {
399
- let a = document.createElement('a')
400
- a.href = res.data
401
- a.download = (this.title) + fileType
402
- a.dispatchEvent(new MouseEvent('click', { bubbles: true, cancelable: true, view: window }))
403
- }
404
- return
405
- } else {
406
- // setTimeout(() =>{
407
- // window.open(res.data,'下载', 'noopener')
408
- // }, 2000)
409
- // window.open(res.data,'下载', 'noopener')
410
- if (isMobile()) {
411
- const iframe = document.createElement("iframe");
412
- iframe.setAttribute("hidden", "hidden");
413
- iframe.onload = () => {
414
- if (iframe) {
415
- console.log("iframe onload....")
416
- iframe.setAttribute('src', 'about:blank');
417
- }
418
- };
419
- document.body.insertBefore(iframe, null);
420
- iframe.setAttribute("src", res.data);
421
- } else {
422
- let a = document.createElement('a')
423
- a.href = res.data
424
- a.download = (this.title) + fileType
425
- a.dispatchEvent(new MouseEvent('click', { bubbles: true, cancelable: true, view: window }))
426
- }
427
- this.close()
428
- }
429
- }
430
- })
431
- },
432
- isPcFun () {
433
- if (/(iPhone|iPad|iPod|iOS|Android)/i.test(navigator.userAgent)) {
434
- this.isPc = false
435
- } else {
436
- this.isPc = true
437
- }
438
- },
439
- clickFloder() {
440
- this.$emit('previewClickFloder')
441
- }},
442
- beforeDestroy () {
443
- window.removeEventListener('message', this.handleIframeMessage);
444
- }
445
- }
446
- </script>
447
-
448
- <style lang="less" scoped>
449
- #drawer_content_pre {
450
- padding: 20px;
451
- scroll-behavior: smooth;
452
-
453
- .mobile_onload_btn {
454
- position: absolute;
455
- right: 0;
456
- bottom: 10%;
457
- width: 20px;
458
- height: 60px;
459
- display: flex;
460
- align-items: center;
461
- justify-content: center;
462
- cursor: pointer;
463
- border-top-left-radius: 10px;
464
- border-bottom-left-radius: 10px;
465
- color: #366aff;
466
- background: #ffffff;
467
- border: 1px solid #a1b9ff;
468
- font-size: 12px;
469
- border-right: none;
470
- text-align: center;
471
- }
472
-
473
- .pdf_positon {
474
- width: 100%;
475
- box-sizing: border-box;
476
- }
477
- }
478
-
479
- .onload_btn {
480
- width: 76px;
481
- height: 26px;
482
- display: flex;
483
- align-items: center;
484
- justify-content: center;
485
- cursor: pointer;
486
- margin-right: 10px;
487
- border-radius: 15px;
488
- color: #366aff;
489
- background: #ffffff;
490
- border: 1px solid #a1b9ff;
491
- box-sizing: border-box;
492
- }
493
-
494
- .preview_iframe {
495
- width: 100%;
496
- height: 100%;
497
- box-sizing: border-box;
498
- background-image: url('https://guoranopen-zjk.oss-cn-zhangjiakou.aliyuncs.com/cdn-common/images/loading.gif');
499
- background-position: center;
500
- background-size: 50px;
501
- background-repeat: no-repeat;
502
- }
503
-
504
- .preview_iframe_kk {
505
- width: 100%;
506
- height: 100%;
507
- }
508
-
509
- .preview_iframe_html {
510
- width: 100%;
511
- height: 100%;
512
- overflow-y: scroll;
513
- text-align: left;
514
- box-sizing: border-box;
515
- padding: 16px;
516
-
517
- /deep/.lake-content {
518
- margin-left: 10px;
519
- }
520
-
521
- /deep/a:link {
522
- color: #0000ee !important;
523
- }
524
-
525
- /deep/a:visited {
526
- color: #0000ee !important;
527
- }
528
-
529
- /deep/a:hover {
530
- color: #0000ee !important;
531
- }
532
-
533
- /deep/a:active {
534
- color: #0000ee !important;
535
- }
536
-
537
- /deep/li:not(.rich-text-li),
538
- ol:not(.list-paddingleft-2),
539
- ul:not(.list-paddingleft-2) {
540
- list-style-type: auto !important;
541
- }
542
-
543
- /deep/img {
544
- width: 100%;
545
- }
546
-
547
- /deep/.ne-table {
548
- width: 100% !important;
549
- }
550
- }
551
-
552
- .footer {
553
- width: calc(100% - 40px);
554
- height: 50px;
555
- display: flex;
556
- align-items: center;
557
- justify-content: space-between;
558
- cursor: pointer;
559
- padding: 0 20px;
560
- border-bottom: 1px solid #cccccc;
561
- }
562
-
563
- .loading_img {
564
- display: flex;
565
- align-items: center;
566
- justify-content: center;
567
- width: 100%;
568
- height: 100%;
569
- position: absolute;
570
- top: 0;
571
- left: 0;
572
- background: #FFF;
573
-
574
- img {
575
- width: 50px;
576
- height: 50px;
577
- }
578
- }
579
-
580
- .libang_head {
581
- height: 64px !important;
582
- }
583
-
584
- .drawer-header {
585
- width: 100%;
586
- height: 50px;
587
- cursor: pointer;
588
- padding: 6px 20px;
589
- border-bottom: 1px solid #cccccc;
590
- .btn_position {
591
- position: absolute;
592
- top: -34px;
593
- left: 12px;
594
- }
595
-
596
- .header-btn {
597
- display: flex;
598
- align-items: center;
599
- justify-content: space-between;
600
-
601
- .header-right {
602
- display: flex;
603
- }
604
- .summaryBtn {
605
- flex: none;
606
- //width: 95px;
607
- height: 26px;
608
- padding: 0 8px;
609
- background: #ffffff;
610
- display: flex;
611
- align-items: center;
612
- justify-content: center;
613
- box-sizing: border-box;
614
- border: 1px solid #a1b9ff;
615
- border-radius: 15px;
616
- cursor: pointer;
617
- color: #366aff;
618
- margin-right: 10px;
619
- font-size: 14px;
620
-
621
- i {
622
- font-size: 14px;
623
- margin-right: 5px;
624
- }
625
- }
626
-
627
- .summaryActiveBtn {
628
- background: #366aff !important;
629
- color: #ffffff !important;
630
- }
631
-
632
- .chat {
633
- flex: none;
634
- height: 26px;
635
- padding: 0 8px;
636
- background: #ffffff;
637
- display: flex;
638
- align-items: center;
639
- justify-content: center;
640
- box-sizing: border-box;
641
- border: 1px solid #a1b9ff;
642
- border-radius: 15px 0px 15px 15px;
643
- cursor: pointer;
644
- color: #366aff;
645
- margin-right: 10px;
646
- font-size: 14px;
647
-
648
- i {
649
- font-size: 14px;
650
- margin-right: 5px;
651
- margin-top: 2px;
652
- }
653
- }
654
-
655
- .chat_active {
656
- background: #366aff !important;
657
- color: #FFFFFF !important;
658
- }
659
- }
660
-
661
- .header_title {
662
- font-size: 14px;
663
- height: 100%;
664
- .header_close {
665
- display: flex;
666
- align-items: center;
667
- justify-content: space-between;
668
- line-height: 26px;
669
- .title_left {
670
- white-space: nowrap; /* 确保文本不会换行 */
671
- overflow: hidden; /* 隐藏超出容器的文本 */
672
- text-overflow: ellipsis; /* 当文本超出容器时显示省略号 */
673
- margin-right: 8px;
674
- }
675
- }
676
- .header_floder {
677
- display: flex;
678
- align-items: center;
679
- line-height: 26px;
680
- i {
681
- margin: 0 5px;
682
- color: #366aff;
683
- }
684
- }
685
- .header_top {
686
- height: 100%;
687
- display: flex;
688
- align-items: center;
689
- justify-content: space-between;
690
- }
691
- }
692
- }
693
-
694
- @media screen and (max-width: 767px) {
695
-
696
- /* 这里是针对移动设备的css样式设置 */
697
- /deep/.el-drawer__body {
698
- height: 100%;
699
- }
700
-
701
- #drawer_content_pre {
702
- overflow: auto;
703
- height: calc(100% - 50px);
704
- background: #FFF;
705
- background-image: url('https://guoranopen-zjk.oss-cn-zhangjiakou.aliyuncs.com/cdn-common/images/loading.gif');
706
- background-position: center;
707
- background-size: 50px;
708
- background-repeat: no-repeat;
709
- }
710
-
711
- .libang_content_pre {
712
- height: calc(100% - 64px) !important;
713
- }
714
- }
715
-
716
- @media screen and (min-width: 768px) {
717
-
718
- /* 这里是针对pc设备的css样式设置 */
719
- /deep/.el-drawer__body {
720
- height: 100%;
721
- }
722
-
723
- #drawer_content_pre {
724
- overflow: auto;
725
- height: calc(100% - 50px);
726
- background: #FFF;
727
- }
728
-
729
- .libang_content_pre {
730
- height: calc(100% - 64px) !important;
731
- }
732
- }
733
-
734
- @media screen and (min-width: 1200px) {
735
-
736
- /* 这里是针对pc设备的css样式设置 */
737
- .el-drawer__wrapper {
738
- width: 55%;
739
- left: calc(100vw - 55%);
740
- right: 0;
741
-
742
- /deep/.pdf-preview-drawer {
743
- width: 100% !important;
744
- }
745
- }
746
-
747
- /deep/.el-drawer__body {
748
- height: 100%;
749
- }
750
-
751
- #drawer_content_pre {
752
- overflow: auto;
753
- height: calc(100% - 50px);
754
- background: #FFF;
755
- }
756
-
757
- .libang_content_pre {
758
- height: calc(100% - 64px) !important;
759
- }
760
- }
761
- </style>
762
- <style lang="less">
763
- .pdf-preview-drawer {
764
- overflow: visible !important;
765
- }
766
- .libang_content_pre {
767
- .change_scale {
768
- top: 64px !important;
769
- }
770
- .float_intelligentSummary {
771
- top: 74px !important;
772
- }
773
- }
774
- </style>
1
+
2
+ <!-- preview-pdf
3
+ 组件主要负责 知识项目中 文件的预览,携带定位信息参数 tagIds tagId 的会解析文件增加定位功能
4
+ 不携带定位信息的 也是走 kkview项目预览
5
+ 另外增加了在知识项目中预览当前文件的一些功能
6
+ -->
7
+ <template>
8
+ <el-drawer :title="'我是标题'" :visible.sync="drawer" :with-header="false" :append-to-body="true" :destroy-on-close="true"
9
+ :modal="formKnowledgeManagement ? true : false" :direction="previewShowPopup ? 'btt' : 'rtl'" :size="previewShowPopup ? '90%' : '65%'"
10
+ custom-class="pdf-preview-drawer" v-if="drawer">
11
+ <!-- v-else-if="drawer" -->
12
+ <div class="drawer-header" :class="(isDownload || isHasChat) && isLiBang ? 'has_btn_libang_head' : (isLiBang ? 'libang_head' : (isDownload || isHasChat ? 'has_btn_head' : ''))" v-if="!isPc">
13
+ <div class="header_title">
14
+ <template v-if="isDownload || isHasChat">
15
+ <div class="top-header">
16
+ <div class="header-btn">
17
+ <div class="onload_btn" v-if="isDownload" @click="downLoad">
18
+ 下载
19
+ </div>
20
+ <div class="summaryBtn" :class="showSummary ? 'summaryActiveBtn' : ''" @click="summaryFun" v-if="isHasChat">
21
+ <i class="iconfont guoran-tongyichicun-write-29-jiqiren"></i>
22
+ <span>智能摘要</span>
23
+ </div>
24
+ <template v-if="isHasChat">
25
+ <div class="chat" @click="previewToDialog(true)" v-if="!previewKnowledgeId">
26
+ <i class="iconfont guoran-wendapingjia"></i>
27
+ 聊一聊
28
+ </div>
29
+ <div class="chat chat_active" @click="previewToDialog(false)" v-else>
30
+ <i class="iconfont guoran-wendapingjia"></i>
31
+ 聊一聊
32
+ </div>
33
+ </template>
34
+ </div>
35
+ <section @click="close">
36
+ <i class="iconfont guoran-shanchu"></i>
37
+ </section>
38
+ </div>
39
+ <span class="title_left">
40
+ {{ title ? title : "查看详情" }}
41
+ </span>
42
+ </template>
43
+ <div class="header_close" v-else>
44
+ <span class="title_left">
45
+ {{ title ? title : '查看详情' }}
46
+ </span>
47
+ <section @click="close">
48
+ <i class="iconfont guoran-shanchu"></i>
49
+ </section>
50
+ </div>
51
+ <p v-if="folderName && isLiBang" class="header_floder" @click="clickFloder">
52
+ <i class="iconfont guoran-tongyichicun-wenjianjia-zhankaizhuangtai--folderOpen"></i>
53
+ {{ folderName }}
54
+ <i v-if="folderUrl" class="iconfont guoran-tongyichicun-dianjichakantuli"></i>
55
+ </p>
56
+ </div>
57
+ </div>
58
+ <div class="drawer-header" :class="isLiBang && folderName ? 'libang_head' : ''" v-else>
59
+ <div class="header_title">
60
+ <div :class="isLiBang && folderName ? 'header_close' : 'header_top'">
61
+ <span class="title_left">
62
+ {{ title ? title : "查看详情" }}
63
+ </span>
64
+ <div class="header-btn">
65
+ <div class="onload_btn" v-if="isDownload" @click="downLoad">
66
+ 下载
67
+ </div>
68
+ <div class="summaryBtn" :class="showSummary ? 'summaryActiveBtn' : ''" @click="summaryFun"
69
+ v-if="isHasChat || formKnowledgeManagement">
70
+ <i class="iconfont guoran-tongyichicun-write-29-jiqiren"></i>
71
+ <span>智能摘要</span>
72
+ </div>
73
+ <template v-if="isHasChat">
74
+ <div class="chat" @click="previewToDialog(true)" v-if="!previewKnowledgeId">
75
+ <i class="iconfont guoran-wendapingjia"></i>
76
+ 聊一聊
77
+ </div>
78
+ <div class="chat chat_active" @click="previewToDialog(false)" v-else>
79
+ <i class="iconfont guoran-wendapingjia"></i>
80
+ 聊一聊
81
+ </div>
82
+ </template>
83
+ <section @click="close">
84
+ <i class="iconfont guoran-shanchu"></i>
85
+ </section>
86
+ </div>
87
+ </div>
88
+ <p v-if="folderName && isLiBang" class="header_floder" @click="clickFloder">
89
+ <i class="iconfont guoran-tongyichicun-wenjianjia-zhankaizhuangtai--folderOpen"></i>
90
+ {{ folderName }}
91
+ <i v-if="folderUrl" class="iconfont guoran-tongyichicun-dianjichakantuli"></i>
92
+ </p>
93
+ </div>
94
+ </div>
95
+ <div id="drawer_content_pre" :class="isLiBang && folderName ? 'libang_content_pre' : ''">
96
+ <!-- :style="{marginTop:tagIds && tagIds.length != 0 && isPc ? '50px' : ''}" -->
97
+ <intelligent-summary
98
+ v-show="showSummary && (isHasChat || formKnowledgeManagement) && fileType !== 'VIDEO' && fileType !== 'IMAGE'"
99
+ :tagIds="tagIds"
100
+ :knowledgeId="knowledgeId"
101
+ :formKnowledgeManagement="formKnowledgeManagement"
102
+ @closeSummary="closeSummary" @recommendQues="recommendQues"
103
+ @getSummarySuccess="getSummarySuccess"></intelligent-summary>
104
+ <div class="pdf_positon" :style="pdfStyle" v-if="tagIds && tagIds.length != 0 && drawer && newVersion === false && newFileType !== 'PPT'">
105
+ <pdfPosition :tagIds="tagIds" :isMessageRecord="isMessageRecord" :textWatermarkStr="textWatermarkStr">
106
+ </pdfPosition>
107
+ </div>
108
+ <new-position-preview
109
+ ref="newPositionPreview"
110
+ v-else-if="tagIds && tagIds.length!= 0 && newVersion && newFileType !== 'PPT'"
111
+ :knowledgeId="knowledgeId"
112
+ :tagIds="tagIds"
113
+ :url="previewHref"
114
+ ></new-position-preview>
115
+ <template v-else>
116
+ <div v-if="fileType == 'VIDEO'" style="width: 100%;height: 100%">
117
+ <video :src="url" controls width="100%;" height="98%"></video>
118
+ </div>
119
+ <div v-else-if="fileType == 'HTML'" style="width: 100%;">
120
+ <div class="preview_iframe_html" style="text-algin:left" v-html="fileText"></div>
121
+ </div>
122
+ <template v-else-if="url.includes('https://www') || url.includes('http://www')">
123
+ <iframe class="preview_iframe" :src="url" width="100%" height="100%" scrolling="100%" frameborder="no"
124
+ border="0"></iframe>
125
+ </template>
126
+ <template v-else>
127
+ <iframe class="preview_iframe_kk" :src="previewUrl" style="border:none;"
128
+ :style="{ height: iframeHeight }"></iframe>
129
+ <template v-if="!loading && (newFileType === 'PPT' && pageChunkData.length > 1)">
130
+ <div class="btn_footer" v-if="!isPc">
131
+ <div class="prev" @click="prev">上一段</div>
132
+ <div class="next" @click="next">下一段</div>
133
+ </div>
134
+ <div id="pagination" v-if="isPc">
135
+ <el-pagination :current-page="currentPage + 1" @current-change="currentChange" @prev-click="prev"
136
+ @next-click="next" layout="slot, prev, pager, next" :page-size="1" :total="pageChunkData.length">
137
+ <span class="total-class">答案由{{ pageChunkData.length }}段内容生成</span>
138
+ </el-pagination>
139
+ </div>
140
+ </template>
141
+ </template>
142
+ </template>
143
+ <!-- <div class="mobile_onload_btn" v-if="isDownload && !isPc" @click="downLoad">
144
+ 下载
145
+ </div> -->
146
+ </div>
147
+ <div class="loading_img" v-show="loading">
148
+ <img src="https://guoranopen-zjk.oss-cn-zhangjiakou.aliyuncs.com/cdn-common/images/loading.gif" alt="">
149
+ </div>
150
+ <div id="text">
151
+ {{ copy }}
152
+ </div>
153
+ </el-drawer>
154
+ </template>
155
+
156
+ <script>
157
+ import pdfPosition from './pdfPosition.vue'
158
+ import { zoomElement } from '../assets/js/hammer'
159
+ import IntelligentSummary from "./intelligentSummary";
160
+ import { isMobile } from "../assets/js/common";
161
+ import { Toast } from 'vant';
162
+ import NewPositionPreview from "./preview/newPositionPreview";
163
+ export default {
164
+ data () {
165
+ return {
166
+ previewShowPopup: false,
167
+ fileText: '',
168
+ fileType: "",
169
+ isPc: false,
170
+ drawer: false,
171
+ tagIds: [],
172
+ // '6454aa1a70573a6ead6f0f7d', '6454aa1a70573a6ead6f0f81',
173
+ loading: true,
174
+ fileName:'',
175
+ previewKnowledgeId:"",
176
+ showSummary:false,
177
+ iframeHeight:"100%",
178
+ isDownload: false,
179
+ textWatermarkStr:"",
180
+ copy:'',
181
+ newVersion:'',
182
+ previewHref:"",
183
+ newFileType:"",
184
+ numberPage:0,
185
+ pageChunkData:[],
186
+ currentPage:0
187
+ }
188
+ },
189
+ mounted() {
190
+ window.addEventListener('message',this.handleIframeMessage,false);
191
+ this.isPcFun();
192
+ },
193
+ props:{
194
+ url:{
195
+ type: String,
196
+ required: true,
197
+ },
198
+ officePreviewType:{
199
+ type: String,
200
+ default: ''
201
+ },
202
+ isMessageRecord:{
203
+ type: Boolean,
204
+ default:false,
205
+ },
206
+ sourceFileType:{
207
+ type: String,
208
+ default: '',
209
+ },
210
+ title: {
211
+ type: String,
212
+ default: ''
213
+ },
214
+ isHasChat:{
215
+ type:Boolean,
216
+ default:false
217
+ },
218
+ knowledgeId:{
219
+ type: String,
220
+ default: '',
221
+ },
222
+ previewOssPath:{
223
+ type: String,
224
+ default: '',
225
+ },
226
+ folderName: {
227
+ type: String,
228
+ default: '',
229
+ },
230
+ folderUrl: {
231
+ type: String,
232
+ default: '',
233
+ },
234
+ isLiBang: {
235
+ type: Boolean,
236
+ default: false
237
+ },
238
+ formKnowledgeManagement:{
239
+ type: Boolean,
240
+ default: false
241
+ }
242
+ },
243
+ components: {
244
+ NewPositionPreview,
245
+ IntelligentSummary,
246
+ pdfPosition
247
+ },
248
+ watch: {
249
+ drawer (value) {
250
+ if (value) {
251
+ this.$emit('open')
252
+ this.$nextTick(() => {
253
+ if (this.tagIds && this.tagIds.length != 0){
254
+ zoomElement(document.getElementById('pdf_container_view'))
255
+ }
256
+ })
257
+ } else {
258
+ this.$emit('close')
259
+ }
260
+ setTimeout(() => {
261
+ let previewIframe = document.getElementsByClassName('preview_iframe')
262
+ Array.from(previewIframe).forEach(item =>{
263
+ item.onload = () =>{
264
+ console.debug('previewIframe 106',previewIframe,this.drawer)
265
+ item.style.backgroundImage = 'none'
266
+ }
267
+ })
268
+ })
269
+ },
270
+ showSummary:{
271
+ handler(val){
272
+ // if (!val){
273
+ // this.$nextTick(() => {
274
+ // let preCon = document.querySelector('.pdf_view');
275
+ // if (preCon){
276
+ // preCon.style.height = 'calc(100% - ' + 50 + 'px)'
277
+ // }
278
+ // })
279
+ // } else {
280
+ // this.getSummarySuccess();
281
+ // }
282
+ if(val) {
283
+ this.getSummarySuccess();
284
+ }
285
+ }
286
+ },
287
+ knowledgeId:{
288
+ handler(val){
289
+ if (val){
290
+ this.getTextWatermark();
291
+ }
292
+ }
293
+ }
294
+ },
295
+ computed:{
296
+ pdfStyle() {
297
+ return {
298
+ paddingTop: this.isPc ? '30px' : '0', // 30px 是 加上外层的 20 流出 50的上边距展示 放大缩小操作栏
299
+ paddingBottom: this.tagIds > 1 ? '60px' : '0',
300
+ height: '100%'
301
+ }
302
+ },
303
+ previewUrl() {
304
+ console.debug('VUE_APP_ENV',process.env.VUE_APP_ENV)
305
+ let url = process.env.VUE_APP_ENV === 'production' ? 'https://kkfileview.askbot.cn/onlinePreview?url=' : 'https://test.open.askbot.cn/kkfileview/onlinePreview?url='
306
+ // if(this.url != '') {
307
+ // if(/[\u4E00-\u9FA5]+/g.test(this.url)) {
308
+ // url += btoa(encodeURIComponent(this.url))
309
+ // } else {
310
+ // url += btoa(this.url)
311
+ // }
312
+ // }
313
+ url = url + this.url
314
+ url += '&officePreviewType=pdf'
315
+ if(this.watermark) {
316
+ url = this.watermark.textWatermarkValue ? (url += '&textWatermarkValue=' + this.watermark.textWatermarkValue) : url
317
+ url = this.watermark.visitorWatermarkValue ? (url += '&visitorWatermarkValue=' + this.watermark.visitorWatermarkValue) : url
318
+ }
319
+ console.log('textWatermarkStr 216', this.textWatermarkStr)
320
+ if (this.textWatermarkStr) {
321
+ url += '&textWatermarkValue=' + this.textWatermarkStr
322
+ }
323
+ return url
324
+ },
325
+ // fileType() {
326
+ // const fileType = this.url.substring(this.url.lastIndexOf('.'));
327
+ // if (fileType === '.mp4' || fileType === '.MP4' || fileType === '.MOV' || fileType === '.mov') {
328
+ // return 'VIDEO'
329
+ // } else {
330
+ // return 'OTHER'
331
+ // }
332
+
333
+ // }
334
+ },
335
+ methods: {
336
+ close () {
337
+ setTimeout(() => {
338
+ this.previewShowPopup = false;
339
+ this.fileType = ''
340
+ }, 300)
341
+ this.drawer = false;
342
+ this.showSummary = false;
343
+ },
344
+ loadIframe () {
345
+
346
+ if (this.fileType == 'VIDEO' || this.fileType == 'WECHAT' || (this.tagIds && this.tagIds.length != 0 && this.newFileType !== 'PPT')) {
347
+ this.loading = false
348
+ } else {
349
+ let iframe = document.getElementsByClassName('preview_iframe')[0] || document.getElementsByClassName('preview_iframe_kk')[0];
350
+ if (iframe) {
351
+ iframe.onload = () => {
352
+ this.loading = false;
353
+ document.getElementById('drawer_content_pre').style.backgroundImage = 'none'
354
+ }
355
+ }
356
+ // let time = setInterval(() =>{
357
+ //
358
+ // if(iframe) {
359
+ // this.loading = false
360
+ // clearInterval(time)
361
+ // }
362
+ // }, 500)
363
+ }
364
+ },
365
+ getBolb () {
366
+ this.$http.post('/knowledge-api/knowledge/htmlTextDeal?onlyText=false', {
367
+ fileInOssPath: this.url,
368
+ templateId: ''
369
+ }).then(res => {
370
+ if (res.data.code == 0) {
371
+ this.fileText = res.data.data
372
+ this.loading = false
373
+ }
374
+ })
375
+ },
376
+ previewToDialog (flag) {
377
+ this.$emit('previewToDialog', flag)
378
+ },
379
+ closeSummary () {
380
+ this.showSummary = false;
381
+ },
382
+ recommendQues (item, knowledgeId) {
383
+ console.log('recommendQues', item, knowledgeId);
384
+ this.$emit('recommendQues', item, knowledgeId)
385
+ },
386
+ handleIframeMessage (res) {
387
+ if (res.data.type == 'getViewerHeight') {
388
+ let iframeHeight = this.iframeHeight.replace('px', '')
389
+ if (res.data.data && iframeHeight != (res.data.data + 50)) {
390
+ this.iframeHeight = res.data.data + 50 + 'px'
391
+ }
392
+ }
393
+ if (res.data.type == 'getViewPage' && res.data.data){
394
+ this.numberPage = Number(res.data.data);
395
+ if (this.pageChunkData.length > 0){
396
+ this.scrollPPTPage(this.pageChunkData[0])
397
+ }
398
+ }
399
+ if (res.data.type == 'getViewerHeight' || res.data.type == 'getViewPage'){
400
+ if (this.pageChunkData.length > 0){
401
+ this.scrollPPTPage(this.pageChunkData[0])
402
+ }
403
+ }
404
+ },
405
+ summaryFun () {
406
+ this.showSummary = !this.showSummary;
407
+ if (this.showSummary) {
408
+ document.getElementById('drawer_content_pre').scrollTop = 0;
409
+ }
410
+ },
411
+ getSummarySuccess () {
412
+ this.$nextTick(() => {
413
+ // if (this.tagIds.length > 0){
414
+ // let intelligentSummary = document.getElementById('intelligentSummary');
415
+ // let preCon = document.querySelector('.pdf_view')
416
+ // if (intelligentSummary){
417
+ // let height = intelligentSummary.offsetHeight + (this.isPc ? 100 : 50 );
418
+ // if (preCon){
419
+ // preCon.style.height = 'calc(100% - ' + height + 'px)'
420
+ // }
421
+ // console.log('height',height,preCon)
422
+ // }
423
+ // }
424
+ // let intelligentSummary = document.getElementById('intelligentSummary');
425
+ // let height = intelligentSummary.offsetHeight
426
+ // this.pdfStyle.height = 'calc(100% - ' + height + 'px)'
427
+ })
428
+ },
429
+ getTextWatermark () {
430
+ let url = '/knowledge-api/open/knowledge/getPermissionInfo';
431
+ let obj = {
432
+ "knowledgeId": this.knowledgeId,
433
+ "userId": sessionStorage.getItem('_currentUserId'),
434
+ "mainId": sessionStorage.getItem('_mainId'),
435
+ "corpId": sessionStorage.getItem('_corpid')
436
+ }
437
+ this.$http.post(url, obj).then(res => {
438
+ console.log('getTextWatermark', res.data.data)
439
+ if (res.data.data) {
440
+ this.textWatermarkStr = res.data.data.textWatermarkStr;
441
+ this.isDownload = res.data.data.showDownloadBtn;
442
+ }
443
+ })
444
+ },
445
+ downLoad () {
446
+ if (this.formKnowledgeManagement){
447
+ this.$emit('downLoad',this.previewOssPath);
448
+ return
449
+ }
450
+ let url = this.previewOssPath
451
+ if (decodeURIComponent(url) != url) {
452
+ url = decodeURIComponent(url)
453
+ }
454
+ const fileType = url.substring(url.lastIndexOf('.'));
455
+ this.$http.post('/knowledge-api/temporary-certificate/or-origin?expired=10', url, {
456
+ headers: {
457
+ "Content-Type": "application/json",
458
+ }
459
+ }).then(res => {
460
+ console.log('downLoad 341', res)
461
+ if (res.data|| res.bodyText) {
462
+ if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
463
+ this.copy = res.data
464
+ if (isMobile()) {
465
+ setTimeout(() =>{
466
+ const range = document.createRange();
467
+ range.selectNode(document.getElementById('text'));
468
+ const selection = window.getSelection();
469
+ //移除之前选中内容
470
+ if (selection.rangeCount > 0) selection.removeAllRanges();
471
+ selection.addRange(range);
472
+ document.execCommand('copy');
473
+ selection.removeAllRanges()
474
+ Toast('下载地址已复制,请前往Safari浏览器访问下载');
475
+ this.close()
476
+ },100)
477
+ } else {
478
+ let a = document.createElement('a')
479
+ a.href = res.data
480
+ a.download = (this.title) + fileType
481
+ a.dispatchEvent(new MouseEvent('click', { bubbles: true, cancelable: true, view: window }))
482
+ }
483
+ return
484
+ } else {
485
+ // setTimeout(() =>{
486
+ // window.open(res.data,'下载', 'noopener')
487
+ // }, 2000)
488
+ // window.open(res.data,'下载', 'noopener')
489
+ if (isMobile()) {
490
+
491
+ const iframe = document.createElement("iframe");
492
+ iframe.setAttribute("hidden", "hidden");
493
+ iframe.onload = () => {
494
+ if (iframe) {
495
+ console.log("iframe onload....")
496
+ iframe.setAttribute('src', 'about:blank');
497
+ }
498
+ };
499
+ document.body.insertBefore(iframe, null);
500
+ iframe.setAttribute("src", res.data );
501
+ } else {
502
+ let a = document.createElement('a')
503
+ a.href = res.data
504
+ a.download = (this.title) + fileType
505
+ a.dispatchEvent(new MouseEvent('click', { bubbles: true, cancelable: true, view: window }))
506
+ }
507
+ this.close()
508
+ }
509
+ }
510
+ })
511
+ },
512
+ isPcFun () {
513
+ if (/(iPhone|iPad|iPod|iOS|Android)/i.test(navigator.userAgent)) {
514
+ this.isPc = false
515
+ } else {
516
+ this.isPc = true
517
+ }
518
+ },
519
+ clickFloder() {
520
+ this.$emit('previewClickFloder')
521
+ },
522
+ getOssPath(url){
523
+ let httpUrl = '/knowledge-api/knowledge/getTemporaryCertificate';
524
+ let type = this.getFileType(url)
525
+ this.newFileType = type;
526
+ if (type === 'VIDEO' || type === 'PDF' || type === 'EXCEL' || type === 'TXT' || type === 'DOC') {
527
+ httpUrl += '?needEncrypt=false'
528
+ } else {
529
+ httpUrl += '?needEncrypt=true'
530
+ }
531
+ this.$http.post(httpUrl, {
532
+ "fileInOssPath": url
533
+ }).then(res => {
534
+ console.log('getOssPath',res)
535
+ if (res.data.code == '0'){
536
+ this.previewHref = res.data.data;
537
+ }
538
+ })
539
+ },
540
+ getFileType(url){
541
+ let index = url.lastIndexOf('?')
542
+ let newFileInOssPath = url.substring(0, url.indexOf("?"))
543
+ if (index == -1){
544
+ newFileInOssPath = url
545
+ }
546
+ const fileType = newFileInOssPath.substring(newFileInOssPath.lastIndexOf('.'));
547
+ if (fileType === '.mp4' || fileType === '.MP4' || fileType === '.MOV' || fileType === '.MOVC' || fileType === '.mov' || fileType === '.movc') {
548
+ return 'VIDEO'
549
+ } else if (fileType === '.html') {
550
+ return 'HTML'
551
+ } else if (fileType === '.png' || fileType === '.jpg' || fileType === '.jpeg' || fileType === '.PNG' || fileType === '.JPG' || fileType === '.JPEG') {
552
+ return 'IMAGE'
553
+ } else if (fileType === '.docx' || fileType === '.doc'){
554
+ return 'DOC'
555
+ } else if (fileType === '.ppt' || fileType === '.pptx'){
556
+ return 'PPT'
557
+ } else if (fileType === '.pdf'){
558
+ return 'PDF'
559
+ } else if (fileType === '.txt'){
560
+ return 'TXT'
561
+ } else {
562
+ return 'OTHER'
563
+ }
564
+ },
565
+ //判断是否使用新定位组件
566
+ getLocationInfo(){
567
+ this.newVersion = "";
568
+ this.$http.get('/knowledge-api/knowledge/knowledge-part-location-info/list?ids=' + this.tagIds.join(',')).then(res => {
569
+ console.log('getLocationInfo',res)
570
+ this.pageChunkData = [];
571
+ if (res.data.code == 0){
572
+ if (res.data.data && res.data.data.length > 0 && res.data.data[0].extractVersion == 'v3'){
573
+ this.newVersion = true;
574
+ if (this.newFileType !== 'PPT'){
575
+ this.loading = false;
576
+ }
577
+ for (let i=0;i<res.data.data.length;i++){
578
+ if (res.data.data[i].paragraphChunkInfo && res.data.data[i].paragraphChunkInfo.pageChunkData){
579
+ this.pageChunkData.push(res.data.data[i].paragraphChunkInfo.pageChunkData.page_number)
580
+ }
581
+ }
582
+ if (this.pageChunkData.length > 1){
583
+ let iframe = document.getElementsByClassName('preview_iframe_kk')
584
+ if (iframe && iframe.length > 0){
585
+ iframe[0].style.paddingBottom = '50px'
586
+ }
587
+ }
588
+ } else {
589
+ this.newVersion = false;
590
+ }
591
+ }
592
+ })
593
+ },
594
+ currentChange (value) {
595
+ this.currentPage = value - 1;
596
+ this.scrollPPTPage()
597
+ },
598
+ prev(){
599
+ if (this.currentPage == 0){
600
+ return
601
+ }
602
+ this.currentPage--;
603
+ this.scrollPPTPage()
604
+ },
605
+ next(){
606
+ if (this.currentPage === (this.pageChunkData.length - 1)){
607
+ return;
608
+ }
609
+ this.currentPage++;
610
+ this.scrollPPTPage()
611
+ },
612
+ scrollPPTPage(){
613
+ if (this.numberPage > 0){
614
+ let pageNumber = this.pageChunkData[this.currentPage];
615
+ let height = Math.floor(Number(this.iframeHeight.replace('px',"")));
616
+ let pageHeight = Math.floor(height / this.numberPage);
617
+ let scrollHeight = (pageNumber - 1) * pageHeight;
618
+ let dom = document.getElementById('drawer_content_pre');
619
+ if (dom){
620
+ dom.scrollTo(0,scrollHeight)
621
+ }
622
+ }
623
+ }
624
+ },
625
+ beforeDestroy () {
626
+ window.removeEventListener('message', this.handleIframeMessage);
627
+ }
628
+ }
629
+ </script>
630
+
631
+ <style lang="less" scoped>
632
+ #drawer_content_pre {
633
+ padding: 20px;
634
+ scroll-behavior: smooth;
635
+
636
+ .mobile_onload_btn {
637
+ position: absolute;
638
+ right: 0;
639
+ bottom: 10%;
640
+ width: 20px;
641
+ height: 60px;
642
+ display: flex;
643
+ align-items: center;
644
+ justify-content: center;
645
+ cursor: pointer;
646
+ border-top-left-radius: 10px;
647
+ border-bottom-left-radius: 10px;
648
+ color: #366aff;
649
+ background: #ffffff;
650
+ border: 1px solid #a1b9ff;
651
+ font-size: 12px;
652
+ border-right: none;
653
+ text-align: center;
654
+ }
655
+
656
+ .pdf_positon {
657
+ width: 100%;
658
+ box-sizing: border-box;
659
+ }
660
+ }
661
+
662
+ .onload_btn {
663
+ width: 76px;
664
+ height: 26px;
665
+ display: flex;
666
+ align-items: center;
667
+ justify-content: center;
668
+ cursor: pointer;
669
+ margin-right: 10px;
670
+ border-radius: 15px;
671
+ color: #366aff;
672
+ background: #ffffff;
673
+ border: 1px solid #a1b9ff;
674
+ box-sizing: border-box;
675
+ }
676
+
677
+ .preview_iframe {
678
+ width: 100%;
679
+ height: 100%;
680
+ box-sizing: border-box;
681
+ background-image: url('https://guoranopen-zjk.oss-cn-zhangjiakou.aliyuncs.com/cdn-common/images/loading.gif');
682
+ background-position: center;
683
+ background-size: 50px;
684
+ background-repeat: no-repeat;
685
+ }
686
+
687
+ .preview_iframe_kk {
688
+ width: 100%;
689
+ height: 100%;
690
+ }
691
+ .btn_footer {
692
+ width: 100%;
693
+ height: 60px;
694
+ display: flex;
695
+ align-items: center;
696
+ justify-content: space-around;
697
+ position: absolute;
698
+ bottom: 0px;
699
+ left: 0;
700
+ z-index: 999;
701
+ background: #ffffff;
702
+
703
+ .prev,
704
+ .next {
705
+ width: 35%;
706
+ height: 40px;
707
+ display: flex;
708
+ align-items: center;
709
+ justify-content: center;
710
+ border-radius: 50px;
711
+ cursor: pointer;
712
+ }
713
+
714
+ .prev {
715
+ background: #F2F5FA;
716
+ color: #000;
717
+ }
718
+
719
+ .next {
720
+ background: #366aff;
721
+ color: #ffffff;
722
+ }
723
+ }
724
+ #pagination {
725
+ .total-class {
726
+ margin-right: 13px;
727
+ font-weight: 400;
728
+ }
729
+
730
+ position: absolute;
731
+ bottom: 0px;
732
+ right: 0;
733
+ width: 100%;
734
+ display: flex;
735
+ align-items: center;
736
+ justify-content: center;
737
+ height: 50px;
738
+ background-color: white;
739
+ box-shadow: 0px 0px 18px 0px rgba(29, 55, 129, 0.07);
740
+ border-radius: 5px;
741
+ z-index: 1000;
742
+
743
+
744
+
745
+ /deep/.el-pagination {
746
+ margin-right: 110px;
747
+ }
748
+
749
+ /deep/.el-pager {
750
+ background: #EDF0F6;
751
+ border-radius: 15px;
752
+ }
753
+
754
+ /deep/.el-pagination.is-background .btn-next {
755
+ width: 30px;
756
+ height: 30px;
757
+ background: #EDF0F6;
758
+ border-radius: 50%;
759
+ }
760
+
761
+ /deep/.el-pagination .btn-next {
762
+ width: 30px;
763
+ height: 30px;
764
+ background: #EDF0F6;
765
+ border-radius: 50%;
766
+ padding-left: 0;
767
+ margin-left: 5px;
768
+ }
769
+
770
+ /deep/.el-pagination .btn-prev {
771
+ width: 30px;
772
+ height: 30px;
773
+ background: #EDF0F6;
774
+ border-radius: 50%;
775
+ padding-right: 0;
776
+ margin-right: 5px;
777
+ }
778
+
779
+ /deep/.el-pagination button {
780
+ padding: 0;
781
+ min-width: 30px;
782
+ }
783
+
784
+ /deep/.el-pager li {
785
+ background: #EDF0F6;
786
+ height: 30px;
787
+ min-width: 30px;
788
+ line-height: 30px;
789
+ font-size: 12px;
790
+ color: #717b90;
791
+ }
792
+
793
+ /deep/.el-pager li:first-child {
794
+ border-bottom-left-radius: 15px !important;
795
+ border-top-left-radius: 15px !important;
796
+ }
797
+
798
+ /deep/.el-pager li:last-child {
799
+ border-top-right-radius: 15px !important;
800
+ border-bottom-right-radius: 15px !important;
801
+ }
802
+
803
+ /deep/.el-pager li.active {
804
+ width: 30px;
805
+ height: 30px;
806
+ min-width: 30px;
807
+ background: #366AFF;
808
+ border: 3px solid #A1B9FF;
809
+ border-radius: 50%;
810
+ line-height: 24px;
811
+ color: white;
812
+ }
813
+
814
+ /deep/.el-pagination.is-background .el-pager li:not(.disabled).active {
815
+ background: #366AFF;
816
+ }
817
+ }
818
+ .preview_iframe_html {
819
+ width: 100%;
820
+ height: 100%;
821
+ overflow-y: scroll;
822
+ text-align: left;
823
+ box-sizing: border-box;
824
+ padding: 16px;
825
+
826
+ /deep/.lake-content {
827
+ margin-left: 10px;
828
+ }
829
+
830
+ /deep/a:link {
831
+ color: #0000ee !important;
832
+ }
833
+
834
+ /deep/a:visited {
835
+ color: #0000ee !important;
836
+ }
837
+
838
+ /deep/a:hover {
839
+ color: #0000ee !important;
840
+ }
841
+
842
+ /deep/a:active {
843
+ color: #0000ee !important;
844
+ }
845
+
846
+ /deep/li:not(.rich-text-li),
847
+ ol:not(.list-paddingleft-2),
848
+ ul:not(.list-paddingleft-2) {
849
+ list-style-type: auto !important;
850
+ }
851
+
852
+ /deep/img {
853
+ width: 100%;
854
+ }
855
+
856
+ /deep/.ne-table {
857
+ width: 100% !important;
858
+ }
859
+ }
860
+
861
+ .footer {
862
+ width: calc(100% - 40px);
863
+ height: 50px;
864
+ display: flex;
865
+ align-items: center;
866
+ justify-content: space-between;
867
+ cursor: pointer;
868
+ padding: 0 20px;
869
+ border-bottom: 1px solid #cccccc;
870
+ }
871
+
872
+ .loading_img {
873
+ display: flex;
874
+ align-items: center;
875
+ justify-content: center;
876
+ width: 100%;
877
+ height: 100%;
878
+ position: absolute;
879
+ top: 0;
880
+ left: 0;
881
+ background: #FFF;
882
+
883
+ img {
884
+ width: 50px;
885
+ height: 50px;
886
+ }
887
+ }
888
+
889
+ .libang_head {
890
+ height: 64px !important;
891
+ }
892
+ .has_btn_libang_head{
893
+ height: 85px!important;
894
+ }
895
+ .has_btn_head{
896
+ height: 60px!important;
897
+ }
898
+ .drawer-header {
899
+ width: 100%;
900
+ height: 50px;
901
+ cursor: pointer;
902
+ padding: 6px 20px;
903
+ border-bottom: 1px solid #cccccc;
904
+ .btn_position {
905
+ position: absolute;
906
+ top: -34px;
907
+ left: 12px;
908
+ }
909
+
910
+ .header-btn {
911
+ display: flex;
912
+ align-items: center;
913
+ justify-content: space-between;
914
+
915
+ .header-right {
916
+ display: flex;
917
+ }
918
+
919
+ .summaryBtn {
920
+ flex: none;
921
+ //width: 95px;
922
+ height: 26px;
923
+ padding: 0 8px;
924
+ background: #ffffff;
925
+ display: flex;
926
+ align-items: center;
927
+ justify-content: center;
928
+ box-sizing: border-box;
929
+ border: 1px solid #a1b9ff;
930
+ border-radius: 15px;
931
+ cursor: pointer;
932
+ color: #366aff;
933
+ margin-right: 10px;
934
+ font-size: 14px;
935
+
936
+ i {
937
+ font-size: 14px;
938
+ margin-right: 5px;
939
+ }
940
+ }
941
+
942
+ .summaryActiveBtn {
943
+ background: #366aff !important;
944
+ color: #ffffff !important;
945
+ }
946
+
947
+ .chat {
948
+ flex: none;
949
+ height: 26px;
950
+ padding: 0 8px;
951
+ background: #ffffff;
952
+ display: flex;
953
+ align-items: center;
954
+ justify-content: center;
955
+ box-sizing: border-box;
956
+ border: 1px solid #a1b9ff;
957
+ border-radius: 15px 0px 15px 15px;
958
+ cursor: pointer;
959
+ color: #366aff;
960
+ margin-right: 10px;
961
+ font-size: 14px;
962
+
963
+ i {
964
+ font-size: 14px;
965
+ margin-right: 5px;
966
+ margin-top: 2px;
967
+ }
968
+ }
969
+
970
+ .chat_active {
971
+ background: #366aff !important;
972
+ color: #FFFFFF !important;
973
+ }
974
+ }
975
+
976
+ .header_title {
977
+ font-size: 14px;
978
+ height: 100%;
979
+ .header_close {
980
+ display: flex;
981
+ align-items: center;
982
+ justify-content: space-between;
983
+ line-height: 26px;
984
+ }
985
+ .title_left {
986
+ white-space: nowrap; /* 确保文本不会换行 */
987
+ overflow: hidden; /* 隐藏超出容器的文本 */
988
+ text-overflow: ellipsis; /* 当文本超出容器时显示省略号 */
989
+ margin-right: 8px;
990
+ text-align: left;
991
+ }
992
+ .top-header{
993
+ display: flex;
994
+ align-items: center;
995
+ justify-content: flex-end;
996
+ margin-bottom: 6px;
997
+ }
998
+ .header_floder {
999
+ display: flex;
1000
+ align-items: center;
1001
+ line-height: 26px;
1002
+ text-align: left;
1003
+ i {
1004
+ margin: 0 5px;
1005
+ color: #366aff;
1006
+ }
1007
+ }
1008
+ .header_top {
1009
+ height: 100%;
1010
+ display: flex;
1011
+ align-items: center;
1012
+ justify-content: space-between;
1013
+ }
1014
+ }
1015
+ }
1016
+
1017
+ @media screen and (max-width: 767px) {
1018
+
1019
+ /* 这里是针对移动设备的css样式设置 */
1020
+ /deep/.el-drawer__body {
1021
+ height: 100%;
1022
+ }
1023
+
1024
+ #drawer_content_pre {
1025
+ overflow: auto;
1026
+ height: calc(100% - 50px);
1027
+ background: #FFF;
1028
+ }
1029
+
1030
+ .libang_content_pre {
1031
+ height: calc(100% - 64px) !important;
1032
+ }
1033
+ }
1034
+
1035
+ @media screen and (min-width: 768px) {
1036
+
1037
+ /* 这里是针对pc设备的css样式设置 */
1038
+ /deep/.el-drawer__body {
1039
+ height: 100%;
1040
+ }
1041
+
1042
+ #drawer_content_pre {
1043
+ overflow: auto;
1044
+ height: calc(100% - 50px);
1045
+ background: #FFF;
1046
+ }
1047
+
1048
+ .libang_content_pre {
1049
+ height: calc(100% - 64px) !important;
1050
+ }
1051
+ }
1052
+
1053
+ @media screen and (min-width: 1200px) {
1054
+
1055
+ /* 这里是针对pc设备的css样式设置 */
1056
+ .el-drawer__wrapper {
1057
+ width: 55%;
1058
+ left: calc(100vw - 55%);
1059
+ right: 0;
1060
+
1061
+ /deep/.pdf-preview-drawer {
1062
+ width: 100% !important;
1063
+ }
1064
+ }
1065
+
1066
+ /deep/.el-drawer__body {
1067
+ height: 100%;
1068
+ }
1069
+
1070
+ #drawer_content_pre {
1071
+ overflow: auto;
1072
+ height: calc(100% - 50px);
1073
+ background: #FFF;
1074
+ }
1075
+
1076
+ .libang_content_pre {
1077
+ height: calc(100% - 64px) !important;
1078
+ }
1079
+ }
1080
+ </style>
1081
+ <style lang="less">
1082
+ .pdf-preview-drawer {
1083
+ overflow: visible !important;
1084
+ }
1085
+ .libang_content_pre {
1086
+ .change_scale {
1087
+ top: 64px !important;
1088
+ }
1089
+ .float_intelligentSummary {
1090
+ top: 74px !important;
1091
+ }
1092
+ }
1093
+ </style>