askbot-dragon 1.7.0-beta → 1.7.11-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 (87) 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 +72 -72
  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 +92 -92
  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 -100
  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 -199
  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 -177
  21. package/src/components/AiGuide.vue +471 -471
  22. package/src/components/AnswerDocknowledge.vue +1071 -1071
  23. package/src/components/AnswerVoice.vue +285 -285
  24. package/src/components/AskIFrame.vue +15 -15
  25. package/src/components/ConversationContainer.vue +4948 -4948
  26. package/src/components/FileType.vue +86 -86
  27. package/src/components/Message.vue +27 -27
  28. package/src/components/MyEditor.vue +351 -351
  29. package/src/components/actionSatisfaction.vue +110 -110
  30. package/src/components/actionSendToBot.vue +62 -62
  31. package/src/components/answerDissatisfaction.vue +62 -62
  32. package/src/components/answerRadio.vue +204 -204
  33. package/src/components/ask-components/DissatisfactionOptions.vue +57 -57
  34. package/src/components/ask-components/Msgloading.vue +37 -37
  35. package/src/components/ask-components/SatisfactionV2.vue +15 -15
  36. package/src/components/askVideo.vue +162 -162
  37. package/src/components/assetDetails.vue +378 -378
  38. package/src/components/assetMessage.vue +228 -228
  39. package/src/components/associationIntention.vue +381 -381
  40. package/src/components/attachmentPreview.vue +90 -90
  41. package/src/components/botActionSatisfactor.vue +68 -68
  42. package/src/components/chatContent.vue +513 -513
  43. package/src/components/feedBack.vue +136 -136
  44. package/src/components/fielListView.vue +351 -351
  45. package/src/components/file/AliyunOssComponents.vue +108 -108
  46. package/src/components/formTemplate.vue +3577 -3577
  47. package/src/components/intelligentSummary.vue +231 -231
  48. package/src/components/kkview.vue +1138 -1138
  49. package/src/components/loadingProcess.vue +164 -164
  50. package/src/components/message/ActionAlertIframe.vue +112 -112
  51. package/src/components/message/ShopMessage.vue +164 -164
  52. package/src/components/message/TextMessage.vue +929 -929
  53. package/src/components/message/TicketMessage.vue +201 -201
  54. package/src/components/message/swiper/index.js +4 -4
  55. package/src/components/message/swiper/ticketSwiper.vue +503 -503
  56. package/src/components/message/swiper/ticketSwiperItem.vue +61 -61
  57. package/src/components/msgLoading.vue +231 -231
  58. package/src/components/myPopup.vue +70 -70
  59. package/src/components/newPdfPosition.vue +877 -877
  60. package/src/components/pdfPosition.vue +1508 -1508
  61. package/src/components/popup.vue +227 -227
  62. package/src/components/previewDoc.vue +252 -252
  63. package/src/components/previewPdf.vue +804 -804
  64. package/src/components/receiverMessagePlatform.vue +65 -65
  65. package/src/components/recommend.vue +80 -80
  66. package/src/components/selector/hOption.vue +20 -20
  67. package/src/components/selector/hSelector.vue +199 -199
  68. package/src/components/selector/hWrapper.vue +216 -216
  69. package/src/components/senderMessagePlatform.vue +53 -53
  70. package/src/components/source/BotMessage.vue +24 -24
  71. package/src/components/source/CustomMessage.vue +24 -24
  72. package/src/components/test.vue +260 -260
  73. package/src/components/tree.vue +294 -294
  74. package/src/components/utils/AliyunIssUtil.js +81 -81
  75. package/src/components/utils/ckeditor.js +174 -174
  76. package/src/components/utils/format_date.js +25 -25
  77. package/src/components/utils/index.js +6 -6
  78. package/src/components/utils/math_utils.js +29 -29
  79. package/src/components/voiceComponent.vue +119 -119
  80. package/src/components/welcomeKnowledgeFile.vue +347 -347
  81. package/src/components/welcomeLlmCard.vue +140 -140
  82. package/src/components/welcomeSuggest.vue +97 -97
  83. package/src/locales/cn.json +71 -71
  84. package/src/locales/en.json +72 -72
  85. package/src/locales/jp.json +72 -72
  86. package/src/main.js +74 -74
  87. package/vue.config.js +54 -54
@@ -1,804 +1,804 @@
1
-
2
- <!-- preview-pdf
3
- 组件主要负责 知识项目中 文件的预览,携带定位信息参数 tagIds tagId 的会解析文件增加定位功能
4
- 不携带定位信息的 也是走 kkview项目预览
5
- 另外增加了在知识项目中预览当前文件的一些功能
6
- -->
7
- <template>
8
- <el-drawer :title="$t('common.drawerTitle')" :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="isLiBang ? 'libang_head' : ''" v-if="!isPc">
13
- <div class="header-btn btn_position">
14
- <div class="onload_btn" v-if="isDownload" @click="downLoad">
15
- {{$t('common.download')}}
16
- </div>
17
- <div class="summaryBtn" :class="showSummary ? 'summaryActiveBtn' : ''" @click="summaryFun" v-if="isHasChat">
18
- <i class="iconfont guoran-tongyichicun-write-29-jiqiren"></i>
19
- <span>{{$t('previewPdf.intelligentSummary')}}</span>
20
- </div>
21
- <template v-if="isHasChat">
22
- <div class="chat" @click="previewToDialog(true)" v-if="!previewKnowledgeId">
23
- <i class="iconfont guoran-wendapingjia"></i>
24
- {{$t('previewPdf.chat')}}
25
- </div>
26
- <div class="chat chat_active" @click="previewToDialog(false)" v-else>
27
- <i class="iconfont guoran-wendapingjia"></i>
28
- {{$t('previewPdf.chat')}}
29
- </div>
30
- </template>
31
- </div>
32
- <div class="header_title">
33
- <div class="header_close">
34
- <span class="title_left">
35
- {{ title ? title : $t('common.viewDetail') }}
36
- </span>
37
- <section @click="close">
38
- <i class="iconfont guoran-shanchu"></i>
39
- </section>
40
- </div>
41
- <p v-if="folderName && isLiBang" class="header_floder" @click="clickFloder">
42
- <i class="iconfont guoran-tongyichicun-wenjianjia-zhankaizhuangtai--folderOpen"></i>
43
- {{ folderName }}
44
- <i v-if="folderUrl" class="iconfont guoran-tongyichicun-dianjichakantuli"></i>
45
- </p>
46
- </div>
47
- </div>
48
- <div class="drawer-header" :class="isLiBang && folderName ? 'libang_head' : ''" v-else>
49
- <div class="header_title">
50
- <div :class="isLiBang && folderName ? 'header_close' : 'header_top'">
51
- <span class="title_left">
52
- {{ title ? title : "查看详情" }}
53
- </span>
54
- <div class="header-btn">
55
- <div class="onload_btn" v-if="isDownload || true" @click="downLoad">
56
- {{$t('common.download')}}
57
- </div>
58
- <div class="summaryBtn" :class="showSummary ? 'summaryActiveBtn' : ''" @click="summaryFun"
59
- v-if="isHasChat || formKnowledgeManagement">
60
- <i class="iconfont guoran-tongyichicun-write-29-jiqiren"></i>
61
- <span>{{$t('previewPdf.intelligentSummary')}}</span>
62
- </div>
63
- <template v-if="isHasChat">
64
- <div class="chat" @click="previewToDialog(true)" v-if="!previewKnowledgeId">
65
- <i class="iconfont guoran-wendapingjia"></i>
66
- {{$t('previewPdf.chat')}}
67
- </div>
68
- <div class="chat chat_active" @click="previewToDialog(false)" v-else>
69
- <i class="iconfont guoran-wendapingjia"></i>
70
- {{$t('previewPdf.chat')}}
71
- </div>
72
- </template>
73
- <section @click="close">
74
- <i class="iconfont guoran-shanchu"></i>
75
- </section>
76
- </div>
77
- </div>
78
- <p v-if="folderName && isLiBang" class="header_floder" @click="clickFloder">
79
- <i class="iconfont guoran-tongyichicun-wenjianjia-zhankaizhuangtai--folderOpen"></i>
80
- {{ folderName }}
81
- <i v-if="folderUrl" class="iconfont guoran-tongyichicun-dianjichakantuli"></i>
82
- </p>
83
- </div>
84
- </div>
85
- <div id="drawer_content_pre" :class="isLiBang && folderName ? 'libang_content_pre' : ''">
86
- <!-- :style="{marginTop:tagIds && tagIds.length != 0 && isPc ? '50px' : ''}" -->
87
- <intelligent-summary
88
- v-show="showSummary && (isHasChat || formKnowledgeManagement) && fileType !== 'VIDEO' && fileType !== 'IMAGE'"
89
- :tagIds="tagIds"
90
- :knowledgeId="knowledgeId"
91
- :formKnowledgeManagement="formKnowledgeManagement"
92
- @closeSummary="closeSummary" @recommendQues="recommendQues"
93
- @getSummarySuccess="getSummarySuccess"></intelligent-summary>
94
- <div class="pdf_positon" :style="pdfStyle" v-if="tagIds && tagIds.length != 0 && drawer">
95
- <pdfPosition :tagIds="tagIds" :isMessageRecord="isMessageRecord" :textWatermarkStr="textWatermarkStr">
96
- </pdfPosition>
97
- </div>
98
- <template v-else>
99
- <div v-if="fileType == 'VIDEO'" style="width: 100%;height: 100%">
100
- <video :src="url" controls width="100%;" height="98%"></video>
101
- </div>
102
- <div v-else-if="fileType == 'HTML'" style="width: 100%;">
103
- <div class="preview_iframe_html" style="text-algin:left" v-html="fileText"></div>
104
- </div>
105
- <template v-else-if="url.includes('https://www') || url.includes('http://www')">
106
- <iframe class="preview_iframe" :src="url" width="100%" height="100%" scrolling="100%" frameborder="no"
107
- border="0"></iframe>
108
- </template>
109
- <template v-else>
110
- <iframe class="preview_iframe_kk" :src="previewUrl" style="border:none;"
111
- :style="{ height: iframeHeight }"></iframe>
112
- </template>
113
- </template>
114
- <!-- <div class="mobile_onload_btn" v-if="isDownload && !isPc" @click="downLoad">
115
- 下载
116
- </div> -->
117
- </div>
118
- <div class="loading_img" v-show="loading">
119
- <img src="https://guoranopen-zjk.oss-cn-zhangjiakou.aliyuncs.com/cdn-common/images/loading.gif" alt="">
120
- </div>
121
- <div id="text">
122
- {{ copy }}
123
- </div>
124
- </el-drawer>
125
- </template>
126
-
127
- <script>
128
- import pdfPosition from './pdfPosition.vue'
129
- import { zoomElement } from '../assets/js/hammer'
130
- import IntelligentSummary from "./intelligentSummary";
131
- import { isMobile } from "../assets/js/common";
132
- import { Toast } from 'vant';
133
- export default {
134
- data () {
135
- return {
136
- previewShowPopup: false,
137
- fileText: '',
138
- fileType: "",
139
- isPc: false,
140
- drawer: false,
141
- tagIds: [],
142
- // '6454aa1a70573a6ead6f0f7d', '6454aa1a70573a6ead6f0f81',
143
- loading: true,
144
- fileName:'',
145
- previewKnowledgeId:"",
146
- showSummary:true,
147
- iframeHeight:"100%",
148
- isDownload: false,
149
- textWatermarkStr:"",
150
- copy:''}
151
- },
152
- mounted() {
153
- window.addEventListener('message',this.handleIframeMessage,false);
154
- this.isPcFun();
155
- },
156
- props:{
157
- url:{
158
- type: String,
159
- required: true,
160
- },
161
- officePreviewType:{
162
- type: String,
163
- default: ''
164
- },
165
- isMessageRecord:{
166
- type: Boolean,
167
- default:false,
168
- },
169
- sourceFileType:{
170
- type: String,
171
- default: '',
172
- },
173
- title: {
174
- type: String,
175
- default: ''
176
- },
177
- isHasChat:{
178
- type:Boolean,
179
- default:false
180
- },
181
- knowledgeId:{
182
- type: String,
183
- default: '',
184
- },
185
- previewOssPath:{
186
- type: String,
187
- default: '',
188
- },
189
- folderName: {
190
- type: String,
191
- default: '',
192
- },
193
- folderUrl: {
194
- type: String,
195
- default: '',
196
- },
197
- isLiBang: {
198
- type: Boolean,
199
- default: false
200
- },
201
- formKnowledgeManagement:{
202
- type: Boolean,
203
- default: false
204
- }
205
- },
206
- components: {
207
- IntelligentSummary,
208
- pdfPosition
209
- },
210
- watch: {
211
- drawer (value) {
212
- if (value) {
213
- this.$emit('open')
214
- this.$nextTick(() => {
215
- if (this.tagIds && this.tagIds.length != 0){
216
- zoomElement(document.getElementById('pdf_container_view'))
217
- }
218
- })
219
- } else {
220
- this.$emit('close')
221
- }
222
- setTimeout(() => {
223
- let previewIframe = document.getElementsByClassName('preview_iframe')
224
- Array.from(previewIframe).forEach(item =>{
225
- item.onload = () =>{
226
- console.debug('previewIframe 106',previewIframe,this.drawer)
227
- item.style.backgroundImage = 'none'
228
- }
229
- })
230
- })
231
- },
232
- showSummary:{
233
- handler(val){
234
- // if (!val){
235
- // this.$nextTick(() => {
236
- // let preCon = document.querySelector('.pdf_view');
237
- // if (preCon){
238
- // preCon.style.height = 'calc(100% - ' + 50 + 'px)'
239
- // }
240
- // })
241
- // } else {
242
- // this.getSummarySuccess();
243
- // }
244
- if(val) {
245
- this.getSummarySuccess();
246
- }
247
- }
248
- },
249
- knowledgeId:{
250
- handler(val){
251
- if (val){
252
- this.getTextWatermark();
253
- }
254
- }
255
- }
256
- },
257
- computed:{
258
- pdfStyle() {
259
- return {
260
- paddingTop: this.isPc ? '30px' : '0', // 30px 是 加上外层的 20 流出 50的上边距展示 放大缩小操作栏
261
- paddingBottom: this.tagIds > 1 ? '60px' : '0',
262
- height: '100%'
263
- }
264
- },
265
- previewUrl() {
266
- console.debug('VUE_APP_ENV',process.env.VUE_APP_ENV)
267
- let url = process.env.VUE_APP_ENV === 'production' ? 'https://kkfileview.askbot.cn/onlinePreview?url=' : 'https://test.open.askbot.cn/kkfileview/onlinePreview?url='
268
- // if(this.url != '') {
269
- // if(/[\u4E00-\u9FA5]+/g.test(this.url)) {
270
- // url += btoa(encodeURIComponent(this.url))
271
- // } else {
272
- // url += btoa(this.url)
273
- // }
274
- // }
275
- url = url + this.url
276
- url += '&officePreviewType=pdf'
277
- if(this.watermark) {
278
- url = this.watermark.textWatermarkValue ? (url += '&textWatermarkValue=' + this.watermark.textWatermarkValue) : url
279
- url = this.watermark.visitorWatermarkValue ? (url += '&visitorWatermarkValue=' + this.watermark.visitorWatermarkValue) : url
280
- }
281
- console.log('textWatermarkStr 216', this.textWatermarkStr)
282
- if (this.textWatermarkStr) {
283
- url += '&textWatermarkValue=' + this.textWatermarkStr
284
- }
285
- return url
286
- },
287
- // fileType() {
288
- // const fileType = this.url.substring(this.url.lastIndexOf('.'));
289
- // if (fileType === '.mp4' || fileType === '.MP4' || fileType === '.MOV' || fileType === '.mov') {
290
- // return 'VIDEO'
291
- // } else {
292
- // return 'OTHER'
293
- // }
294
-
295
- // }
296
- },
297
- methods: {
298
- close () {
299
- setTimeout(() => {
300
- this.previewShowPopup = false;
301
- this.fileType = ''
302
- }, 300)
303
- this.drawer = false;
304
- this.showSummary = false;
305
- },
306
- loadIframe () {
307
-
308
- if (this.fileType == 'VIDEO' || this.fileType == 'WECHAT' || (this.tagIds && this.tagIds.length != 0)) {
309
- this.loading = false
310
- } else {
311
- let iframe = document.getElementsByClassName('preview_iframe')[0] || document.getElementsByClassName('preview_iframe_kk')[0];
312
- if (iframe) {
313
- iframe.onload = () => {
314
- this.loading = false;
315
- document.getElementById('drawer_content_pre').style.backgroundImage = 'none'
316
- }
317
- }
318
- // let time = setInterval(() =>{
319
- //
320
- // if(iframe) {
321
- // this.loading = false
322
- // clearInterval(time)
323
- // }
324
- // }, 500)
325
- }
326
- },
327
- getBolb () {
328
- this.$http.post('/knowledge-api/knowledge/htmlTextDeal?onlyText=false', {
329
- fileInOssPath: this.url,
330
- templateId: ''
331
- }).then(res => {
332
- if (res.data.code == 0) {
333
- this.fileText = res.data.data
334
- this.loading = false
335
- }
336
- })
337
- },
338
- previewToDialog (flag) {
339
- this.$emit('previewToDialog', flag)
340
- },
341
- closeSummary () {
342
- this.showSummary = false;
343
- },
344
- recommendQues (item, knowledgeId) {
345
- console.log('recommendQues', item, knowledgeId);
346
- this.$emit('recommendQues', item, knowledgeId)
347
- },
348
- handleIframeMessage (res) {
349
- console.log('handleIframeMessage', res)
350
- if (res.data.type == 'getViewerHeight') {
351
- let iframeHeight = this.iframeHeight.replace('px', '')
352
- if (res.data.data && iframeHeight != (res.data.data + 50)) {
353
- this.iframeHeight = res.data.data + 50 + 'px'
354
- }
355
- }
356
- },
357
- summaryFun () {
358
- this.showSummary = !this.showSummary;
359
- if (this.showSummary) {
360
- document.getElementById('drawer_content_pre').scrollTop = 0;
361
- }
362
- },
363
- getSummarySuccess () {
364
- this.$nextTick(() => {
365
- // if (this.tagIds.length > 0){
366
- // let intelligentSummary = document.getElementById('intelligentSummary');
367
- // let preCon = document.querySelector('.pdf_view')
368
- // if (intelligentSummary){
369
- // let height = intelligentSummary.offsetHeight + (this.isPc ? 100 : 50 );
370
- // if (preCon){
371
- // preCon.style.height = 'calc(100% - ' + height + 'px)'
372
- // }
373
- // console.log('height',height,preCon)
374
- // }
375
- // }
376
- // let intelligentSummary = document.getElementById('intelligentSummary');
377
- // let height = intelligentSummary.offsetHeight
378
- // this.pdfStyle.height = 'calc(100% - ' + height + 'px)'
379
- })
380
- },
381
- getTextWatermark () {
382
- let url = '/knowledge-api/open/knowledge/getPermissionInfo';
383
- let obj = {
384
- "knowledgeId": this.knowledgeId,
385
- "userId": sessionStorage.getItem('_currentUserId'),
386
- "mainId": sessionStorage.getItem('_mainId'),
387
- "corpId": sessionStorage.getItem('_corpid')
388
- }
389
- this.$http.post(url, obj).then(res => {
390
- console.log('getTextWatermark', res.data.data)
391
- if (res.data.data) {
392
- this.textWatermarkStr = res.data.data.textWatermarkStr;
393
- this.isDownload = res.data.data.showDownloadBtn;
394
- }
395
- })
396
- },
397
- downLoad () {
398
- if (this.formKnowledgeManagement){
399
- this.$emit('downLoad',this.previewOssPath);
400
- return
401
- }
402
- let url = this.previewOssPath
403
- if (decodeURIComponent(url) != url) {
404
- url = decodeURIComponent(url)
405
- }
406
- const fileType = url.substring(url.lastIndexOf('.'));
407
- this.$http.post('/knowledge-api/temporary-certificate/or-origin?expired=10', url, {
408
- headers: {
409
- "Content-Type": "application/json",
410
- }
411
- }).then(res => {
412
- console.log('downLoad 341', res)
413
- if (res.data|| res.bodyText) {
414
- if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
415
- this.copy = res.data
416
- if (isMobile()) {
417
- setTimeout(() =>{
418
- const range = document.createRange();
419
- range.selectNode(document.getElementById('text'));
420
- const selection = window.getSelection();
421
- //移除之前选中内容
422
- if (selection.rangeCount > 0) selection.removeAllRanges();
423
- selection.addRange(range);
424
- document.execCommand('copy');
425
- selection.removeAllRanges()
426
- Toast(this.$t('previewPdf.copyUrl'));
427
- this.close()
428
- },100)
429
- } else {
430
- let a = document.createElement('a')
431
- a.href = res.data
432
- a.download = (this.title) + fileType
433
- a.dispatchEvent(new MouseEvent('click', { bubbles: true, cancelable: true, view: window }))
434
- }
435
- return
436
- } else {
437
- // setTimeout(() =>{
438
- // window.open(res.data,'下载', 'noopener')
439
- // }, 2000)
440
- // window.open(res.data,'下载', 'noopener')
441
- if (isMobile()) {
442
-
443
- const iframe = document.createElement("iframe");
444
- iframe.setAttribute("hidden", "hidden");
445
- iframe.onload = () => {
446
- if (iframe) {
447
- console.log("iframe onload....")
448
- iframe.setAttribute('src', 'about:blank');
449
- }
450
- };
451
- document.body.insertBefore(iframe, null);
452
- iframe.setAttribute("src", res.data );
453
- } else {
454
- let a = document.createElement('a')
455
- a.href = res.data
456
- a.download = (this.title) + fileType
457
- a.dispatchEvent(new MouseEvent('click', { bubbles: true, cancelable: true, view: window }))
458
- }
459
- this.close()
460
- }
461
- }
462
- })
463
- },
464
- isPcFun () {
465
- if (/(iPhone|iPad|iPod|iOS|Android)/i.test(navigator.userAgent)) {
466
- this.isPc = false
467
- } else {
468
- this.isPc = true
469
- }
470
- },
471
- clickFloder() {
472
- this.$emit('previewClickFloder')
473
- }},
474
- beforeDestroy () {
475
- window.removeEventListener('message', this.handleIframeMessage);
476
- }
477
- }
478
- </script>
479
-
480
- <style lang="less" scoped>
481
- #drawer_content_pre {
482
- padding: 20px;
483
- scroll-behavior: smooth;
484
-
485
- .mobile_onload_btn {
486
- position: absolute;
487
- right: 0;
488
- bottom: 10%;
489
- width: 20px;
490
- height: 60px;
491
- display: flex;
492
- align-items: center;
493
- justify-content: center;
494
- cursor: pointer;
495
- border-top-left-radius: 10px;
496
- border-bottom-left-radius: 10px;
497
- color: #366aff;
498
- background: #ffffff;
499
- border: 1px solid #a1b9ff;
500
- font-size: 12px;
501
- border-right: none;
502
- text-align: center;
503
- }
504
-
505
- .pdf_positon {
506
- width: 100%;
507
- box-sizing: border-box;
508
- }
509
- }
510
-
511
- .onload_btn {
512
- width: 76px;
513
- height: 26px;
514
- display: flex;
515
- align-items: center;
516
- justify-content: center;
517
- cursor: pointer;
518
- margin-right: 10px;
519
- border-radius: 15px;
520
- color: #366aff;
521
- background: #ffffff;
522
- border: 1px solid #a1b9ff;
523
- box-sizing: border-box;
524
- }
525
-
526
- .preview_iframe {
527
- width: 100%;
528
- height: 100%;
529
- box-sizing: border-box;
530
- background-image: url('https://guoranopen-zjk.oss-cn-zhangjiakou.aliyuncs.com/cdn-common/images/loading.gif');
531
- background-position: center;
532
- background-size: 50px;
533
- background-repeat: no-repeat;
534
- }
535
-
536
- .preview_iframe_kk {
537
- width: 100%;
538
- height: 100%;
539
- }
540
-
541
-
542
- .preview_iframe_html {
543
- width: 100%;
544
- height: 100%;
545
- overflow-y: scroll;
546
- text-align: left;
547
- box-sizing: border-box;
548
- padding: 16px;
549
-
550
- /deep/.lake-content {
551
- margin-left: 10px;
552
- }
553
-
554
- /deep/a:link {
555
- color: #0000ee !important;
556
- }
557
-
558
- /deep/a:visited {
559
- color: #0000ee !important;
560
- }
561
-
562
- /deep/a:hover {
563
- color: #0000ee !important;
564
- }
565
-
566
- /deep/a:active {
567
- color: #0000ee !important;
568
- }
569
-
570
- /deep/li:not(.rich-text-li),
571
- ol:not(.list-paddingleft-2),
572
- ul:not(.list-paddingleft-2) {
573
- list-style-type: auto !important;
574
- }
575
-
576
- /deep/img {
577
- width: 100%;
578
- }
579
-
580
- /deep/.ne-table {
581
- width: 100% !important;
582
- }
583
- }
584
-
585
- .footer {
586
- width: calc(100% - 40px);
587
- height: 50px;
588
- display: flex;
589
- align-items: center;
590
- justify-content: space-between;
591
- cursor: pointer;
592
- padding: 0 20px;
593
- border-bottom: 1px solid #cccccc;
594
- }
595
-
596
- .loading_img {
597
- display: flex;
598
- align-items: center;
599
- justify-content: center;
600
- width: 100%;
601
- height: 100%;
602
- position: absolute;
603
- top: 0;
604
- left: 0;
605
- background: #FFF;
606
-
607
- img {
608
- width: 50px;
609
- height: 50px;
610
- }
611
- }
612
-
613
- .libang_head {
614
- height: 64px !important;
615
- }
616
-
617
- .drawer-header {
618
- width: 100%;
619
- height: 50px;
620
- cursor: pointer;
621
- padding: 6px 20px;
622
- border-bottom: 1px solid #cccccc;
623
- .btn_position {
624
- position: absolute;
625
- top: -34px;
626
- left: 12px;
627
- }
628
-
629
- .header-btn {
630
- display: flex;
631
- align-items: center;
632
- justify-content: space-between;
633
-
634
- .header-right {
635
- display: flex;
636
- }
637
-
638
- .summaryBtn {
639
- flex: none;
640
- //width: 95px;
641
- height: 26px;
642
- padding: 0 8px;
643
- background: #ffffff;
644
- display: flex;
645
- align-items: center;
646
- justify-content: center;
647
- box-sizing: border-box;
648
- border: 1px solid #a1b9ff;
649
- border-radius: 15px;
650
- cursor: pointer;
651
- color: #366aff;
652
- margin-right: 10px;
653
- font-size: 14px;
654
-
655
- i {
656
- font-size: 14px;
657
- margin-right: 5px;
658
- }
659
- }
660
-
661
- .summaryActiveBtn {
662
- background: #366aff !important;
663
- color: #ffffff !important;
664
- }
665
-
666
- .chat {
667
- flex: none;
668
- height: 26px;
669
- padding: 0 8px;
670
- background: #ffffff;
671
- display: flex;
672
- align-items: center;
673
- justify-content: center;
674
- box-sizing: border-box;
675
- border: 1px solid #a1b9ff;
676
- border-radius: 15px 0px 15px 15px;
677
- cursor: pointer;
678
- color: #366aff;
679
- margin-right: 10px;
680
- font-size: 14px;
681
-
682
- i {
683
- font-size: 14px;
684
- margin-right: 5px;
685
- margin-top: 2px;
686
- }
687
- }
688
-
689
- .chat_active {
690
- background: #366aff !important;
691
- color: #FFFFFF !important;
692
- }
693
- }
694
-
695
- .header_title {
696
- font-size: 14px;
697
- height: 100%;
698
- .header_close {
699
- display: flex;
700
- align-items: center;
701
- justify-content: space-between;
702
- line-height: 26px;
703
- .title_left {
704
- white-space: nowrap; /* 确保文本不会换行 */
705
- overflow: hidden; /* 隐藏超出容器的文本 */
706
- text-overflow: ellipsis; /* 当文本超出容器时显示省略号 */
707
- margin-right: 8px;
708
- }
709
- }
710
- .header_floder {
711
- display: flex;
712
- align-items: center;
713
- line-height: 26px;
714
- i {
715
- margin: 0 5px;
716
- color: #366aff;
717
- }
718
- }
719
- .header_top {
720
- height: 100%;
721
- display: flex;
722
- align-items: center;
723
- justify-content: space-between;
724
- }
725
- }
726
- }
727
-
728
- @media screen and (max-width: 767px) {
729
-
730
- /* 这里是针对移动设备的css样式设置 */
731
- /deep/.el-drawer__body {
732
- height: 100%;
733
- }
734
-
735
- #drawer_content_pre {
736
- overflow: auto;
737
- height: calc(100% - 50px);
738
- background: #FFF;
739
- }
740
-
741
- .libang_content_pre {
742
- height: calc(100% - 64px) !important;
743
- }
744
- }
745
-
746
- @media screen and (min-width: 768px) {
747
-
748
- /* 这里是针对pc设备的css样式设置 */
749
- /deep/.el-drawer__body {
750
- height: 100%;
751
- }
752
-
753
- #drawer_content_pre {
754
- overflow: auto;
755
- height: calc(100% - 50px);
756
- background: #FFF;
757
- }
758
-
759
- .libang_content_pre {
760
- height: calc(100% - 64px) !important;
761
- }
762
- }
763
-
764
- @media screen and (min-width: 1200px) {
765
-
766
- /* 这里是针对pc设备的css样式设置 */
767
- .el-drawer__wrapper {
768
- width: 55%;
769
- left: calc(100vw - 55%);
770
- right: 0;
771
-
772
- /deep/.pdf-preview-drawer {
773
- width: 100% !important;
774
- }
775
- }
776
-
777
- /deep/.el-drawer__body {
778
- height: 100%;
779
- }
780
-
781
- #drawer_content_pre {
782
- overflow: auto;
783
- height: calc(100% - 50px);
784
- background: #FFF;
785
- }
786
-
787
- .libang_content_pre {
788
- height: calc(100% - 64px) !important;
789
- }
790
- }
791
- </style>
792
- <style lang="less">
793
- .pdf-preview-drawer {
794
- overflow: visible !important;
795
- }
796
- .libang_content_pre {
797
- .change_scale {
798
- top: 64px !important;
799
- }
800
- .float_intelligentSummary {
801
- top: 74px !important;
802
- }
803
- }
804
- </style>
1
+
2
+ <!-- preview-pdf
3
+ 组件主要负责 知识项目中 文件的预览,携带定位信息参数 tagIds tagId 的会解析文件增加定位功能
4
+ 不携带定位信息的 也是走 kkview项目预览
5
+ 另外增加了在知识项目中预览当前文件的一些功能
6
+ -->
7
+ <template>
8
+ <el-drawer :title="$t('common.drawerTitle')" :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="isLiBang ? 'libang_head' : ''" v-if="!isPc">
13
+ <div class="header-btn btn_position">
14
+ <div class="onload_btn" v-if="isDownload" @click="downLoad">
15
+ {{$t('common.download')}}
16
+ </div>
17
+ <div class="summaryBtn" :class="showSummary ? 'summaryActiveBtn' : ''" @click="summaryFun" v-if="isHasChat">
18
+ <i class="iconfont guoran-tongyichicun-write-29-jiqiren"></i>
19
+ <span>{{$t('previewPdf.intelligentSummary')}}</span>
20
+ </div>
21
+ <template v-if="isHasChat">
22
+ <div class="chat" @click="previewToDialog(true)" v-if="!previewKnowledgeId">
23
+ <i class="iconfont guoran-wendapingjia"></i>
24
+ {{$t('previewPdf.chat')}}
25
+ </div>
26
+ <div class="chat chat_active" @click="previewToDialog(false)" v-else>
27
+ <i class="iconfont guoran-wendapingjia"></i>
28
+ {{$t('previewPdf.chat')}}
29
+ </div>
30
+ </template>
31
+ </div>
32
+ <div class="header_title">
33
+ <div class="header_close">
34
+ <span class="title_left">
35
+ {{ title ? title : $t('common.viewDetail') }}
36
+ </span>
37
+ <section @click="close">
38
+ <i class="iconfont guoran-shanchu"></i>
39
+ </section>
40
+ </div>
41
+ <p v-if="folderName && isLiBang" class="header_floder" @click="clickFloder">
42
+ <i class="iconfont guoran-tongyichicun-wenjianjia-zhankaizhuangtai--folderOpen"></i>
43
+ {{ folderName }}
44
+ <i v-if="folderUrl" class="iconfont guoran-tongyichicun-dianjichakantuli"></i>
45
+ </p>
46
+ </div>
47
+ </div>
48
+ <div class="drawer-header" :class="isLiBang && folderName ? 'libang_head' : ''" v-else>
49
+ <div class="header_title">
50
+ <div :class="isLiBang && folderName ? 'header_close' : 'header_top'">
51
+ <span class="title_left">
52
+ {{ title ? title : "查看详情" }}
53
+ </span>
54
+ <div class="header-btn">
55
+ <div class="onload_btn" v-if="isDownload || true" @click="downLoad">
56
+ {{$t('common.download')}}
57
+ </div>
58
+ <div class="summaryBtn" :class="showSummary ? 'summaryActiveBtn' : ''" @click="summaryFun"
59
+ v-if="isHasChat || formKnowledgeManagement">
60
+ <i class="iconfont guoran-tongyichicun-write-29-jiqiren"></i>
61
+ <span>{{$t('previewPdf.intelligentSummary')}}</span>
62
+ </div>
63
+ <template v-if="isHasChat">
64
+ <div class="chat" @click="previewToDialog(true)" v-if="!previewKnowledgeId">
65
+ <i class="iconfont guoran-wendapingjia"></i>
66
+ {{$t('previewPdf.chat')}}
67
+ </div>
68
+ <div class="chat chat_active" @click="previewToDialog(false)" v-else>
69
+ <i class="iconfont guoran-wendapingjia"></i>
70
+ {{$t('previewPdf.chat')}}
71
+ </div>
72
+ </template>
73
+ <section @click="close">
74
+ <i class="iconfont guoran-shanchu"></i>
75
+ </section>
76
+ </div>
77
+ </div>
78
+ <p v-if="folderName && isLiBang" class="header_floder" @click="clickFloder">
79
+ <i class="iconfont guoran-tongyichicun-wenjianjia-zhankaizhuangtai--folderOpen"></i>
80
+ {{ folderName }}
81
+ <i v-if="folderUrl" class="iconfont guoran-tongyichicun-dianjichakantuli"></i>
82
+ </p>
83
+ </div>
84
+ </div>
85
+ <div id="drawer_content_pre" :class="isLiBang && folderName ? 'libang_content_pre' : ''">
86
+ <!-- :style="{marginTop:tagIds && tagIds.length != 0 && isPc ? '50px' : ''}" -->
87
+ <intelligent-summary
88
+ v-show="showSummary && (isHasChat || formKnowledgeManagement) && fileType !== 'VIDEO' && fileType !== 'IMAGE'"
89
+ :tagIds="tagIds"
90
+ :knowledgeId="knowledgeId"
91
+ :formKnowledgeManagement="formKnowledgeManagement"
92
+ @closeSummary="closeSummary" @recommendQues="recommendQues"
93
+ @getSummarySuccess="getSummarySuccess"></intelligent-summary>
94
+ <div class="pdf_positon" :style="pdfStyle" v-if="tagIds && tagIds.length != 0 && drawer">
95
+ <pdfPosition :tagIds="tagIds" :isMessageRecord="isMessageRecord" :textWatermarkStr="textWatermarkStr">
96
+ </pdfPosition>
97
+ </div>
98
+ <template v-else>
99
+ <div v-if="fileType == 'VIDEO'" style="width: 100%;height: 100%">
100
+ <video :src="url" controls width="100%;" height="98%"></video>
101
+ </div>
102
+ <div v-else-if="fileType == 'HTML'" style="width: 100%;">
103
+ <div class="preview_iframe_html" style="text-algin:left" v-html="fileText"></div>
104
+ </div>
105
+ <template v-else-if="url.includes('https://www') || url.includes('http://www')">
106
+ <iframe class="preview_iframe" :src="url" width="100%" height="100%" scrolling="100%" frameborder="no"
107
+ border="0"></iframe>
108
+ </template>
109
+ <template v-else>
110
+ <iframe class="preview_iframe_kk" :src="previewUrl" style="border:none;"
111
+ :style="{ height: iframeHeight }"></iframe>
112
+ </template>
113
+ </template>
114
+ <!-- <div class="mobile_onload_btn" v-if="isDownload && !isPc" @click="downLoad">
115
+ 下载
116
+ </div> -->
117
+ </div>
118
+ <div class="loading_img" v-show="loading">
119
+ <img src="https://guoranopen-zjk.oss-cn-zhangjiakou.aliyuncs.com/cdn-common/images/loading.gif" alt="">
120
+ </div>
121
+ <div id="text">
122
+ {{ copy }}
123
+ </div>
124
+ </el-drawer>
125
+ </template>
126
+
127
+ <script>
128
+ import pdfPosition from './pdfPosition.vue'
129
+ import { zoomElement } from '../assets/js/hammer'
130
+ import IntelligentSummary from "./intelligentSummary";
131
+ import { isMobile } from "../assets/js/common";
132
+ import { Toast } from 'vant';
133
+ export default {
134
+ data () {
135
+ return {
136
+ previewShowPopup: false,
137
+ fileText: '',
138
+ fileType: "",
139
+ isPc: false,
140
+ drawer: false,
141
+ tagIds: [],
142
+ // '6454aa1a70573a6ead6f0f7d', '6454aa1a70573a6ead6f0f81',
143
+ loading: true,
144
+ fileName:'',
145
+ previewKnowledgeId:"",
146
+ showSummary:true,
147
+ iframeHeight:"100%",
148
+ isDownload: false,
149
+ textWatermarkStr:"",
150
+ copy:''}
151
+ },
152
+ mounted() {
153
+ window.addEventListener('message',this.handleIframeMessage,false);
154
+ this.isPcFun();
155
+ },
156
+ props:{
157
+ url:{
158
+ type: String,
159
+ required: true,
160
+ },
161
+ officePreviewType:{
162
+ type: String,
163
+ default: ''
164
+ },
165
+ isMessageRecord:{
166
+ type: Boolean,
167
+ default:false,
168
+ },
169
+ sourceFileType:{
170
+ type: String,
171
+ default: '',
172
+ },
173
+ title: {
174
+ type: String,
175
+ default: ''
176
+ },
177
+ isHasChat:{
178
+ type:Boolean,
179
+ default:false
180
+ },
181
+ knowledgeId:{
182
+ type: String,
183
+ default: '',
184
+ },
185
+ previewOssPath:{
186
+ type: String,
187
+ default: '',
188
+ },
189
+ folderName: {
190
+ type: String,
191
+ default: '',
192
+ },
193
+ folderUrl: {
194
+ type: String,
195
+ default: '',
196
+ },
197
+ isLiBang: {
198
+ type: Boolean,
199
+ default: false
200
+ },
201
+ formKnowledgeManagement:{
202
+ type: Boolean,
203
+ default: false
204
+ }
205
+ },
206
+ components: {
207
+ IntelligentSummary,
208
+ pdfPosition
209
+ },
210
+ watch: {
211
+ drawer (value) {
212
+ if (value) {
213
+ this.$emit('open')
214
+ this.$nextTick(() => {
215
+ if (this.tagIds && this.tagIds.length != 0){
216
+ zoomElement(document.getElementById('pdf_container_view'))
217
+ }
218
+ })
219
+ } else {
220
+ this.$emit('close')
221
+ }
222
+ setTimeout(() => {
223
+ let previewIframe = document.getElementsByClassName('preview_iframe')
224
+ Array.from(previewIframe).forEach(item =>{
225
+ item.onload = () =>{
226
+ console.debug('previewIframe 106',previewIframe,this.drawer)
227
+ item.style.backgroundImage = 'none'
228
+ }
229
+ })
230
+ })
231
+ },
232
+ showSummary:{
233
+ handler(val){
234
+ // if (!val){
235
+ // this.$nextTick(() => {
236
+ // let preCon = document.querySelector('.pdf_view');
237
+ // if (preCon){
238
+ // preCon.style.height = 'calc(100% - ' + 50 + 'px)'
239
+ // }
240
+ // })
241
+ // } else {
242
+ // this.getSummarySuccess();
243
+ // }
244
+ if(val) {
245
+ this.getSummarySuccess();
246
+ }
247
+ }
248
+ },
249
+ knowledgeId:{
250
+ handler(val){
251
+ if (val){
252
+ this.getTextWatermark();
253
+ }
254
+ }
255
+ }
256
+ },
257
+ computed:{
258
+ pdfStyle() {
259
+ return {
260
+ paddingTop: this.isPc ? '30px' : '0', // 30px 是 加上外层的 20 流出 50的上边距展示 放大缩小操作栏
261
+ paddingBottom: this.tagIds > 1 ? '60px' : '0',
262
+ height: '100%'
263
+ }
264
+ },
265
+ previewUrl() {
266
+ console.debug('VUE_APP_ENV',process.env.VUE_APP_ENV)
267
+ let url = process.env.VUE_APP_ENV === 'production' ? 'https://kkfileview.askbot.cn/onlinePreview?url=' : 'https://test.open.askbot.cn/kkfileview/onlinePreview?url='
268
+ // if(this.url != '') {
269
+ // if(/[\u4E00-\u9FA5]+/g.test(this.url)) {
270
+ // url += btoa(encodeURIComponent(this.url))
271
+ // } else {
272
+ // url += btoa(this.url)
273
+ // }
274
+ // }
275
+ url = url + this.url
276
+ url += '&officePreviewType=pdf'
277
+ if(this.watermark) {
278
+ url = this.watermark.textWatermarkValue ? (url += '&textWatermarkValue=' + this.watermark.textWatermarkValue) : url
279
+ url = this.watermark.visitorWatermarkValue ? (url += '&visitorWatermarkValue=' + this.watermark.visitorWatermarkValue) : url
280
+ }
281
+ console.log('textWatermarkStr 216', this.textWatermarkStr)
282
+ if (this.textWatermarkStr) {
283
+ url += '&textWatermarkValue=' + this.textWatermarkStr
284
+ }
285
+ return url
286
+ },
287
+ // fileType() {
288
+ // const fileType = this.url.substring(this.url.lastIndexOf('.'));
289
+ // if (fileType === '.mp4' || fileType === '.MP4' || fileType === '.MOV' || fileType === '.mov') {
290
+ // return 'VIDEO'
291
+ // } else {
292
+ // return 'OTHER'
293
+ // }
294
+
295
+ // }
296
+ },
297
+ methods: {
298
+ close () {
299
+ setTimeout(() => {
300
+ this.previewShowPopup = false;
301
+ this.fileType = ''
302
+ }, 300)
303
+ this.drawer = false;
304
+ this.showSummary = false;
305
+ },
306
+ loadIframe () {
307
+
308
+ if (this.fileType == 'VIDEO' || this.fileType == 'WECHAT' || (this.tagIds && this.tagIds.length != 0)) {
309
+ this.loading = false
310
+ } else {
311
+ let iframe = document.getElementsByClassName('preview_iframe')[0] || document.getElementsByClassName('preview_iframe_kk')[0];
312
+ if (iframe) {
313
+ iframe.onload = () => {
314
+ this.loading = false;
315
+ document.getElementById('drawer_content_pre').style.backgroundImage = 'none'
316
+ }
317
+ }
318
+ // let time = setInterval(() =>{
319
+ //
320
+ // if(iframe) {
321
+ // this.loading = false
322
+ // clearInterval(time)
323
+ // }
324
+ // }, 500)
325
+ }
326
+ },
327
+ getBolb () {
328
+ this.$http.post('/knowledge-api/knowledge/htmlTextDeal?onlyText=false', {
329
+ fileInOssPath: this.url,
330
+ templateId: ''
331
+ }).then(res => {
332
+ if (res.data.code == 0) {
333
+ this.fileText = res.data.data
334
+ this.loading = false
335
+ }
336
+ })
337
+ },
338
+ previewToDialog (flag) {
339
+ this.$emit('previewToDialog', flag)
340
+ },
341
+ closeSummary () {
342
+ this.showSummary = false;
343
+ },
344
+ recommendQues (item, knowledgeId) {
345
+ console.log('recommendQues', item, knowledgeId);
346
+ this.$emit('recommendQues', item, knowledgeId)
347
+ },
348
+ handleIframeMessage (res) {
349
+ console.log('handleIframeMessage', res)
350
+ if (res.data.type == 'getViewerHeight') {
351
+ let iframeHeight = this.iframeHeight.replace('px', '')
352
+ if (res.data.data && iframeHeight != (res.data.data + 50)) {
353
+ this.iframeHeight = res.data.data + 50 + 'px'
354
+ }
355
+ }
356
+ },
357
+ summaryFun () {
358
+ this.showSummary = !this.showSummary;
359
+ if (this.showSummary) {
360
+ document.getElementById('drawer_content_pre').scrollTop = 0;
361
+ }
362
+ },
363
+ getSummarySuccess () {
364
+ this.$nextTick(() => {
365
+ // if (this.tagIds.length > 0){
366
+ // let intelligentSummary = document.getElementById('intelligentSummary');
367
+ // let preCon = document.querySelector('.pdf_view')
368
+ // if (intelligentSummary){
369
+ // let height = intelligentSummary.offsetHeight + (this.isPc ? 100 : 50 );
370
+ // if (preCon){
371
+ // preCon.style.height = 'calc(100% - ' + height + 'px)'
372
+ // }
373
+ // console.log('height',height,preCon)
374
+ // }
375
+ // }
376
+ // let intelligentSummary = document.getElementById('intelligentSummary');
377
+ // let height = intelligentSummary.offsetHeight
378
+ // this.pdfStyle.height = 'calc(100% - ' + height + 'px)'
379
+ })
380
+ },
381
+ getTextWatermark () {
382
+ let url = '/knowledge-api/open/knowledge/getPermissionInfo';
383
+ let obj = {
384
+ "knowledgeId": this.knowledgeId,
385
+ "userId": sessionStorage.getItem('_currentUserId'),
386
+ "mainId": sessionStorage.getItem('_mainId'),
387
+ "corpId": sessionStorage.getItem('_corpid')
388
+ }
389
+ this.$http.post(url, obj).then(res => {
390
+ console.log('getTextWatermark', res.data.data)
391
+ if (res.data.data) {
392
+ this.textWatermarkStr = res.data.data.textWatermarkStr;
393
+ this.isDownload = res.data.data.showDownloadBtn;
394
+ }
395
+ })
396
+ },
397
+ downLoad () {
398
+ if (this.formKnowledgeManagement){
399
+ this.$emit('downLoad',this.previewOssPath);
400
+ return
401
+ }
402
+ let url = this.previewOssPath
403
+ if (decodeURIComponent(url) != url) {
404
+ url = decodeURIComponent(url)
405
+ }
406
+ const fileType = url.substring(url.lastIndexOf('.'));
407
+ this.$http.post('/knowledge-api/temporary-certificate/or-origin?expired=10', url, {
408
+ headers: {
409
+ "Content-Type": "application/json",
410
+ }
411
+ }).then(res => {
412
+ console.log('downLoad 341', res)
413
+ if (res.data|| res.bodyText) {
414
+ if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
415
+ this.copy = res.data
416
+ if (isMobile()) {
417
+ setTimeout(() =>{
418
+ const range = document.createRange();
419
+ range.selectNode(document.getElementById('text'));
420
+ const selection = window.getSelection();
421
+ //移除之前选中内容
422
+ if (selection.rangeCount > 0) selection.removeAllRanges();
423
+ selection.addRange(range);
424
+ document.execCommand('copy');
425
+ selection.removeAllRanges()
426
+ Toast(this.$t('previewPdf.copyUrl'));
427
+ this.close()
428
+ },100)
429
+ } else {
430
+ let a = document.createElement('a')
431
+ a.href = res.data
432
+ a.download = (this.title) + fileType
433
+ a.dispatchEvent(new MouseEvent('click', { bubbles: true, cancelable: true, view: window }))
434
+ }
435
+ return
436
+ } else {
437
+ // setTimeout(() =>{
438
+ // window.open(res.data,'下载', 'noopener')
439
+ // }, 2000)
440
+ // window.open(res.data,'下载', 'noopener')
441
+ if (isMobile()) {
442
+
443
+ const iframe = document.createElement("iframe");
444
+ iframe.setAttribute("hidden", "hidden");
445
+ iframe.onload = () => {
446
+ if (iframe) {
447
+ console.log("iframe onload....")
448
+ iframe.setAttribute('src', 'about:blank');
449
+ }
450
+ };
451
+ document.body.insertBefore(iframe, null);
452
+ iframe.setAttribute("src", res.data );
453
+ } else {
454
+ let a = document.createElement('a')
455
+ a.href = res.data
456
+ a.download = (this.title) + fileType
457
+ a.dispatchEvent(new MouseEvent('click', { bubbles: true, cancelable: true, view: window }))
458
+ }
459
+ this.close()
460
+ }
461
+ }
462
+ })
463
+ },
464
+ isPcFun () {
465
+ if (/(iPhone|iPad|iPod|iOS|Android)/i.test(navigator.userAgent)) {
466
+ this.isPc = false
467
+ } else {
468
+ this.isPc = true
469
+ }
470
+ },
471
+ clickFloder() {
472
+ this.$emit('previewClickFloder')
473
+ }},
474
+ beforeDestroy () {
475
+ window.removeEventListener('message', this.handleIframeMessage);
476
+ }
477
+ }
478
+ </script>
479
+
480
+ <style lang="less" scoped>
481
+ #drawer_content_pre {
482
+ padding: 20px;
483
+ scroll-behavior: smooth;
484
+
485
+ .mobile_onload_btn {
486
+ position: absolute;
487
+ right: 0;
488
+ bottom: 10%;
489
+ width: 20px;
490
+ height: 60px;
491
+ display: flex;
492
+ align-items: center;
493
+ justify-content: center;
494
+ cursor: pointer;
495
+ border-top-left-radius: 10px;
496
+ border-bottom-left-radius: 10px;
497
+ color: #366aff;
498
+ background: #ffffff;
499
+ border: 1px solid #a1b9ff;
500
+ font-size: 12px;
501
+ border-right: none;
502
+ text-align: center;
503
+ }
504
+
505
+ .pdf_positon {
506
+ width: 100%;
507
+ box-sizing: border-box;
508
+ }
509
+ }
510
+
511
+ .onload_btn {
512
+ width: 76px;
513
+ height: 26px;
514
+ display: flex;
515
+ align-items: center;
516
+ justify-content: center;
517
+ cursor: pointer;
518
+ margin-right: 10px;
519
+ border-radius: 15px;
520
+ color: #366aff;
521
+ background: #ffffff;
522
+ border: 1px solid #a1b9ff;
523
+ box-sizing: border-box;
524
+ }
525
+
526
+ .preview_iframe {
527
+ width: 100%;
528
+ height: 100%;
529
+ box-sizing: border-box;
530
+ background-image: url('https://guoranopen-zjk.oss-cn-zhangjiakou.aliyuncs.com/cdn-common/images/loading.gif');
531
+ background-position: center;
532
+ background-size: 50px;
533
+ background-repeat: no-repeat;
534
+ }
535
+
536
+ .preview_iframe_kk {
537
+ width: 100%;
538
+ height: 100%;
539
+ }
540
+
541
+
542
+ .preview_iframe_html {
543
+ width: 100%;
544
+ height: 100%;
545
+ overflow-y: scroll;
546
+ text-align: left;
547
+ box-sizing: border-box;
548
+ padding: 16px;
549
+
550
+ /deep/.lake-content {
551
+ margin-left: 10px;
552
+ }
553
+
554
+ /deep/a:link {
555
+ color: #0000ee !important;
556
+ }
557
+
558
+ /deep/a:visited {
559
+ color: #0000ee !important;
560
+ }
561
+
562
+ /deep/a:hover {
563
+ color: #0000ee !important;
564
+ }
565
+
566
+ /deep/a:active {
567
+ color: #0000ee !important;
568
+ }
569
+
570
+ /deep/li:not(.rich-text-li),
571
+ ol:not(.list-paddingleft-2),
572
+ ul:not(.list-paddingleft-2) {
573
+ list-style-type: auto !important;
574
+ }
575
+
576
+ /deep/img {
577
+ width: 100%;
578
+ }
579
+
580
+ /deep/.ne-table {
581
+ width: 100% !important;
582
+ }
583
+ }
584
+
585
+ .footer {
586
+ width: calc(100% - 40px);
587
+ height: 50px;
588
+ display: flex;
589
+ align-items: center;
590
+ justify-content: space-between;
591
+ cursor: pointer;
592
+ padding: 0 20px;
593
+ border-bottom: 1px solid #cccccc;
594
+ }
595
+
596
+ .loading_img {
597
+ display: flex;
598
+ align-items: center;
599
+ justify-content: center;
600
+ width: 100%;
601
+ height: 100%;
602
+ position: absolute;
603
+ top: 0;
604
+ left: 0;
605
+ background: #FFF;
606
+
607
+ img {
608
+ width: 50px;
609
+ height: 50px;
610
+ }
611
+ }
612
+
613
+ .libang_head {
614
+ height: 64px !important;
615
+ }
616
+
617
+ .drawer-header {
618
+ width: 100%;
619
+ height: 50px;
620
+ cursor: pointer;
621
+ padding: 6px 20px;
622
+ border-bottom: 1px solid #cccccc;
623
+ .btn_position {
624
+ position: absolute;
625
+ top: -34px;
626
+ left: 12px;
627
+ }
628
+
629
+ .header-btn {
630
+ display: flex;
631
+ align-items: center;
632
+ justify-content: space-between;
633
+
634
+ .header-right {
635
+ display: flex;
636
+ }
637
+
638
+ .summaryBtn {
639
+ flex: none;
640
+ //width: 95px;
641
+ height: 26px;
642
+ padding: 0 8px;
643
+ background: #ffffff;
644
+ display: flex;
645
+ align-items: center;
646
+ justify-content: center;
647
+ box-sizing: border-box;
648
+ border: 1px solid #a1b9ff;
649
+ border-radius: 15px;
650
+ cursor: pointer;
651
+ color: #366aff;
652
+ margin-right: 10px;
653
+ font-size: 14px;
654
+
655
+ i {
656
+ font-size: 14px;
657
+ margin-right: 5px;
658
+ }
659
+ }
660
+
661
+ .summaryActiveBtn {
662
+ background: #366aff !important;
663
+ color: #ffffff !important;
664
+ }
665
+
666
+ .chat {
667
+ flex: none;
668
+ height: 26px;
669
+ padding: 0 8px;
670
+ background: #ffffff;
671
+ display: flex;
672
+ align-items: center;
673
+ justify-content: center;
674
+ box-sizing: border-box;
675
+ border: 1px solid #a1b9ff;
676
+ border-radius: 15px 0px 15px 15px;
677
+ cursor: pointer;
678
+ color: #366aff;
679
+ margin-right: 10px;
680
+ font-size: 14px;
681
+
682
+ i {
683
+ font-size: 14px;
684
+ margin-right: 5px;
685
+ margin-top: 2px;
686
+ }
687
+ }
688
+
689
+ .chat_active {
690
+ background: #366aff !important;
691
+ color: #FFFFFF !important;
692
+ }
693
+ }
694
+
695
+ .header_title {
696
+ font-size: 14px;
697
+ height: 100%;
698
+ .header_close {
699
+ display: flex;
700
+ align-items: center;
701
+ justify-content: space-between;
702
+ line-height: 26px;
703
+ .title_left {
704
+ white-space: nowrap; /* 确保文本不会换行 */
705
+ overflow: hidden; /* 隐藏超出容器的文本 */
706
+ text-overflow: ellipsis; /* 当文本超出容器时显示省略号 */
707
+ margin-right: 8px;
708
+ }
709
+ }
710
+ .header_floder {
711
+ display: flex;
712
+ align-items: center;
713
+ line-height: 26px;
714
+ i {
715
+ margin: 0 5px;
716
+ color: #366aff;
717
+ }
718
+ }
719
+ .header_top {
720
+ height: 100%;
721
+ display: flex;
722
+ align-items: center;
723
+ justify-content: space-between;
724
+ }
725
+ }
726
+ }
727
+
728
+ @media screen and (max-width: 767px) {
729
+
730
+ /* 这里是针对移动设备的css样式设置 */
731
+ /deep/.el-drawer__body {
732
+ height: 100%;
733
+ }
734
+
735
+ #drawer_content_pre {
736
+ overflow: auto;
737
+ height: calc(100% - 50px);
738
+ background: #FFF;
739
+ }
740
+
741
+ .libang_content_pre {
742
+ height: calc(100% - 64px) !important;
743
+ }
744
+ }
745
+
746
+ @media screen and (min-width: 768px) {
747
+
748
+ /* 这里是针对pc设备的css样式设置 */
749
+ /deep/.el-drawer__body {
750
+ height: 100%;
751
+ }
752
+
753
+ #drawer_content_pre {
754
+ overflow: auto;
755
+ height: calc(100% - 50px);
756
+ background: #FFF;
757
+ }
758
+
759
+ .libang_content_pre {
760
+ height: calc(100% - 64px) !important;
761
+ }
762
+ }
763
+
764
+ @media screen and (min-width: 1200px) {
765
+
766
+ /* 这里是针对pc设备的css样式设置 */
767
+ .el-drawer__wrapper {
768
+ width: 55%;
769
+ left: calc(100vw - 55%);
770
+ right: 0;
771
+
772
+ /deep/.pdf-preview-drawer {
773
+ width: 100% !important;
774
+ }
775
+ }
776
+
777
+ /deep/.el-drawer__body {
778
+ height: 100%;
779
+ }
780
+
781
+ #drawer_content_pre {
782
+ overflow: auto;
783
+ height: calc(100% - 50px);
784
+ background: #FFF;
785
+ }
786
+
787
+ .libang_content_pre {
788
+ height: calc(100% - 64px) !important;
789
+ }
790
+ }
791
+ </style>
792
+ <style lang="less">
793
+ .pdf-preview-drawer {
794
+ overflow: visible !important;
795
+ }
796
+ .libang_content_pre {
797
+ .change_scale {
798
+ top: 64px !important;
799
+ }
800
+ .float_intelligentSummary {
801
+ top: 74px !important;
802
+ }
803
+ }
804
+ </style>