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