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