askbot-dragon 1.6.53-beta → 1.6.55-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 +54 -54
  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 +75 -75
  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 +691 -691
  23. package/src/components/AnswerVoice.vue +285 -285
  24. package/src/components/AskIFrame.vue +15 -15
  25. package/src/components/ConversationContainer.vue +5317 -5131
  26. package/src/components/FileType.vue +86 -86
  27. package/src/components/Message.vue +27 -27
  28. package/src/components/MyEditor.vue +350 -350
  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 -370
  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 +209 -209
  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 -1508
  61. package/src/components/popup.vue +227 -227
  62. package/src/components/previewDoc.vue +242 -242
  63. package/src/components/previewPdf.vue +591 -483
  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 +329 -329
  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,484 +1,592 @@
1
- <template>
2
- <!-- <van-popup v-model="previewShowPopup" position="bottom" :style="{ height: '90%', background:'#FFFFFF'}" v-if="previewShowPopup">
3
- <div class="footer">
4
- <span>查看详情</span>
5
- <section @click="close">
6
- <i class="iconfont guoran-shanchu"></i>
7
- </section>
8
- </div>
9
- <template v-if="tagIds && tagIds.length != 0 && previewShowPopup">
10
- <pdfPosition :tagIds="tagIds" ></pdfPosition>
11
- </template>
12
- <template v-else>
13
- <div v-if="fileType == 'VIDEO'" style="width: 100%;height: calc(100% - 60px)">
14
- <video :src="url" controls width="100%;" height="98%"></video>
15
- </div>
16
- <div v-else-if="fileType == 'HTML'" style="width: 100%;height: calc(100% - 60px)">
17
- <div class="preview_iframe_html" style="text-algin:left" v-html="fileText"></div>
18
- </div>
19
- <template v-else-if="url.includes('https://www') || url.includes('http://www')">
20
- <iframe class="preview_iframe"
21
- :src="url"
22
- width="100%"
23
- height="100%"
24
- scrolling="100%"
25
- frameborder="no"
26
- border="0"></iframe>
27
- </template>
28
- <template v-else>
29
- <iframe class="preview_iframe" :src="previewUrl" style="border:none;"></iframe>
30
- </template>
31
- </template>
32
- <div class="loading_img" v-show="loading">
33
- <img src="https://guoranopen-zjk.oss-cn-zhangjiakou.aliyuncs.com/cdn-common/images/loading.gif" alt="">
34
- </div>
35
- </van-popup> -->
36
- <el-drawer
37
- title="我是标题"
38
- :visible.sync="drawer"
39
- :with-header="false"
40
- :append-to-body="true"
41
- :destroy-on-close="true"
42
- :model="false"
43
- :direction="previewShowPopup ? 'btt' : 'rtl'"
44
- :size="previewShowPopup ? '90%' : '65%'"
45
- custom-class="pdf-preview-drawer"
46
- v-if="drawer"
47
- >
48
- <!-- v-else-if="drawer" -->
49
- <div class="drawer-footer">
50
- <span>{{title ? title : "查看详情"}}</span>
51
- <div class="header-right">
52
- <div class="summaryBtn"
53
- :class="showSummary ? 'summaryActiveBtn' : ''"
54
- @click="summaryFun"
55
- >
56
- <i class="iconfont guoran-tongyichicun-write-29-jiqiren"></i>
57
- <span>智能摘要</span>
58
- </div>
59
- <template v-if="isHasChat">
60
- <div class="chat" @click="previewToDialog(true)" v-if="!previewKnowledgeId">
61
- <i class="iconfont guoran-wendapingjia"></i>
62
- 聊一聊
63
- </div>
64
- <div class="chat chat_active" @click="previewToDialog(false)" v-else>
65
- <i class="iconfont guoran-wendapingjia"></i>
66
- 聊一聊
67
- </div>
68
- </template>
69
- <section @click="close">
70
- <i class="iconfont guoran-shanchu"></i>
71
- </section>
72
- </div>
73
- </div>
74
- <div id="drawer_content_pre">
75
- <intelligent-summary
76
- v-show="showSummary"
77
- :knowledgeId="knowledgeId"
78
- @closeSummary="closeSummary"
79
- @recommendQues="recommendQues"
80
- @getSummarySuccess="getSummarySuccess"
81
- :style="{marginTop:tagIds && tagIds.length != 0 ? '50px' : ''}"
82
- ></intelligent-summary>
83
- <template v-if="tagIds && tagIds.length != 0 && drawer">
84
- <pdfPosition :tagIds="tagIds" :isMessageRecord="isMessageRecord" :fileName="fileName" :knowledgeItem="watermark" ref="pdfPosition"></pdfPosition>
85
- </template>
86
- <template v-else>
87
- <div v-if="fileType == 'VIDEO'" style="width: 100%;">
88
- <video :src="url" controls width="100%;" height="98%"></video>
89
- </div>
90
- <div v-else-if="fileType == 'HTML'" style="width: 100%;">
91
- <div class="preview_iframe_html" style="text-algin:left" v-html="fileText"></div>
92
- </div>
93
- <template v-else-if="url.includes('https://www') || url.includes('http://www')">
94
- <iframe class="preview_iframe"
95
- :src="url"
96
- width="100%"
97
- height="100%"
98
- scrolling="100%"
99
- frameborder="no"
100
- border="0"></iframe>
101
- </template>
102
- <template v-else>
103
- <iframe class="preview_iframe_kk" :src="previewUrl" style="border:none;" :style="{height: iframeHeight}"></iframe>
104
- </template>
105
- </template>
106
- </div>
107
- <div class="loading_img" v-show="loading">
108
- <img src="https://guoranopen-zjk.oss-cn-zhangjiakou.aliyuncs.com/cdn-common/images/loading.gif" alt="">
109
- </div>
110
- </el-drawer>
111
- </template>
112
-
113
- <script>
114
- import pdfPosition from './pdfPosition.vue'
115
- import { zoomElement } from '../assets/js/hammer'
116
- import IntelligentSummary from "./intelligentSummary";
117
- export default {
118
- data () {
119
- return {
120
- previewShowPopup: false,
121
- fileText:'',
122
- fileType:"",
123
- isPc:true,
124
- drawer:false,
125
- tagIds: [],
126
- // '6454aa1a70573a6ead6f0f7d', '6454aa1a70573a6ead6f0f81',
127
- loading:true,
128
- fileName:'',
129
- previewKnowledgeId:"",
130
- showSummary:true,
131
- iframeHeight:"100%"
132
- }
133
- },
134
- mounted() {
135
- window.addEventListener('message',this.handleIframeMessage,false)
136
- },
137
- props:{
138
- url:{
139
- type: String,
140
- required: true,
141
- },
142
- officePreviewType:{
143
- type: String,
144
- default: ''
145
- },
146
- isMessageRecord:{
147
- type: Boolean,
148
- default:false,
149
- },
150
- sourceFileType:{
151
- type: String,
152
- default: '',
153
- },
154
- title: {
155
- type: String,
156
- default: ''
157
- },
158
- isHasChat:{
159
- type:Boolean,
160
- default:false
161
- },
162
- knowledgeId:{
163
- type: String,
164
- default: '',
165
- }
166
- },
167
- components:{
168
- IntelligentSummary,
169
- pdfPosition
170
- },
171
- watch:{
172
- drawer(value) {
173
- if(value) {
174
- this.$nextTick(() =>{
175
- if (this.tagIds && this.tagIds.length != 0){
176
- zoomElement(document.getElementById('pdf_container_view'))
177
- }
178
- })
179
- }
180
- setTimeout(() => {
181
- let previewIframe = document.getElementsByClassName('preview_iframe')
182
- Array.from(previewIframe).forEach(item =>{
183
- item.onload = () =>{
184
- console.debug('previewIframe 106',previewIframe,this.drawer)
185
- item.style.backgroundImage = 'none'
186
- }
187
- })
188
- })
189
- },
190
- showSummary:{
191
- handler(val){
192
- if (!val){
193
- this.$nextTick(() => {
194
- let preCon = document.querySelector('.pdf_view');
195
- if (preCon){
196
- preCon.style.height = 'calc(100% - ' + 50 + 'px)'
197
- }
198
- })
199
- } else {
200
- this.getSummarySuccess();
201
- }
202
- }
203
- }
204
- },
205
- computed:{
206
- previewUrl() {
207
- console.debug('VUE_APP_ENV',process.env.VUE_APP_ENV)
208
- let url = process.env.VUE_APP_ENV === 'production' ? 'https://kkfileview.askbot.cn/onlinePreview?url=' : 'https://test.open.askbot.cn/kkfileview/onlinePreview?url='
209
- // if(this.url != '') {
210
- // if(/[\u4E00-\u9FA5]+/g.test(this.url)) {
211
- // url += btoa(encodeURIComponent(this.url))
212
- // } else {
213
- // url += btoa(this.url)
214
- // }
215
- // }
216
- url = url + this.url
217
- url += '&officePreviewType=pdf'
218
- if(this.watermark) {
219
- url = this.watermark.textWatermarkValue ? (url += '&textWatermarkValue=' + this.watermark.textWatermarkValue) : url
220
- url = this.watermark.visitorWatermarkValue ? (url += '&visitorWatermarkValue=' + this.watermark.visitorWatermarkValue) : url
221
- }
222
- return url
223
- },
224
- // fileType() {
225
- // const fileType = this.url.substring(this.url.lastIndexOf('.'));
226
- // if (fileType === '.mp4' || fileType === '.MP4' || fileType === '.MOV' || fileType === '.mov') {
227
- // return 'VIDEO'
228
- // } else {
229
- // return 'OTHER'
230
- // }
231
-
232
- // }
233
- },
234
- methods :{
235
- close() {
236
- setTimeout(() =>{
237
- this.previewShowPopup = false;
238
- this.fileType = ''
239
- }, 300)
240
- this.drawer = false;
241
- this.showSummary = false;
242
- },
243
- loadIframe() {
244
-
245
- if(this.fileType == 'VIDEO' || this.fileType == 'WECHAT' || (this.tagIds && this.tagIds.length != 0)) {
246
- this.loading = false
247
- } else {
248
- let iframe = document.getElementsByClassName('preview_iframe')[0] || document.getElementsByClassName('preview_iframe_kk')[0];
249
- if (iframe){
250
- iframe.onload = () => {
251
- this.loading = false;
252
- document.getElementById('drawer_content_pre').style.backgroundImage = 'none'
253
- }
254
- }
255
- // let time = setInterval(() =>{
256
- //
257
- // if(iframe) {
258
- // this.loading = false
259
- // clearInterval(time)
260
- // }
261
- // }, 500)
262
- }
263
- },
264
- getBolb() {
265
- this.$http.post('/knowledge-api/knowledge/htmlTextDeal?onlyText=false',{
266
- fileInOssPath: this.url,
267
- templateId: ''
268
- }).then(res =>{
269
- if (res.data.code == 0) {
270
- this.fileText = res.data.data
271
- this.loading = false
272
- }
273
- })
274
- },
275
- previewToDialog(flag){
276
- this.$emit('previewToDialog',flag)
277
- },
278
- closeSummary(){
279
- this.showSummary = false;
280
- },
281
- recommendQues(item,knowledgeId){
282
- console.log('recommendQues',item,knowledgeId);
283
- this.$emit('recommendQues',item,knowledgeId)
284
- },
285
- handleIframeMessage(res){
286
- console.log('handleIframeMessage',res)
287
- if (res.data.type == 'getViewerHeight'){
288
- let iframeHeight = this.iframeHeight.replace('px','')
289
- if (res.data.data && iframeHeight != (res.data.data + 50)){
290
- this.iframeHeight = res.data.data + 50 + 'px'
291
- }
292
- }
293
- },
294
- summaryFun(){
295
- this.showSummary = !this.showSummary;
296
- if (this.showSummary){
297
- document.getElementById('drawer_content_pre').scrollTop = 0;
298
- }
299
- },
300
- getSummarySuccess(){
301
- this.$nextTick(() => {
302
- if (this.tagIds.length > 0){
303
- let intelligentSummary = document.getElementById('intelligentSummary');
304
- let preCon = document.querySelector('.pdf_view')
305
- console.log('intelligentSummary',preCon,intelligentSummary)
306
- if (intelligentSummary){
307
- let height = intelligentSummary.offsetHeight + 100;
308
- if (preCon){
309
- preCon.style.height = 'calc(100% - ' + height + 'px)'
310
- }
311
- console.log('height',height,preCon)
312
- }
313
- }
314
- })
315
- },
316
- },
317
- beforeDestroy() {
318
- window.removeEventListener('message', this.handleIframeMessage);
319
- }
320
- }
321
- </script>
322
-
323
- <style lang="less" scoped>
324
- #drawer_content_pre{
325
- padding: 20px;
326
- scroll-behavior: smooth;
327
- }
328
- .preview_iframe {
329
- width: 100%;
330
- height: 100%;
331
- box-sizing: border-box;
332
- background-image: url('https://guoranopen-zjk.oss-cn-zhangjiakou.aliyuncs.com/cdn-common/images/loading.gif');
333
- background-position: center;
334
- background-size: 50px;
335
- background-repeat: no-repeat;
336
- }
337
- .preview_iframe_kk{
338
- width: 100%;
339
- height: 100%;
340
- }
341
- .preview_iframe_html{
342
- width: 100%;
343
- height: 100%;
344
- overflow-y: scroll;
345
- text-align: left;
346
- box-sizing: border-box;
347
- padding: 16px;
348
- /deep/.lake-content{
349
- margin-left: 10px;
350
- }
351
- /deep/a:link {
352
- color: #0000ee!important;
353
- }
354
- /deep/a:visited {
355
- color: #0000ee!important;
356
- }
357
- /deep/a:hover {
358
- color: #0000ee!important;
359
- }
360
- /deep/a:active {
361
- color: #0000ee!important;
362
- }
363
- /deep/li:not(.rich-text-li), ol:not(.list-paddingleft-2), ul:not(.list-paddingleft-2){
364
- list-style-type: auto!important;
365
- }
366
- /deep/img{
367
- width: 100%;
368
- }
369
- /deep/.ne-table{
370
- width: 100% !important;
371
- }
372
- }
373
- .footer {
374
- width: calc(100% - 40px);
375
- height: 50px;
376
- display: flex;
377
- align-items: center;
378
- justify-content: space-between;
379
- cursor: pointer;
380
- padding: 0 20px;
381
- border-bottom: 1px solid #cccccc;
382
- }
383
- .loading_img {
384
- display: flex;
385
- align-items: center;
386
- justify-content: center;
387
- width: 100%;
388
- height: 100%;
389
- position: absolute;
390
- top: 0;
391
- left: 0;
392
- background: #FFF;
393
- img {
394
- width: 50px;
395
- height: 50px;
396
- }
397
- }
398
-
399
- .drawer-footer{
400
- width:100%;
401
- height: 50px;
402
- display: flex;
403
- align-items: center;
404
- justify-content: space-between;
405
- cursor: pointer;
406
- padding: 0 20px;
407
- border-bottom: 1px solid #cccccc;
408
- .header-right{
409
- display: flex;
410
- align-items: center;
411
- .summaryBtn{
412
- flex: none;
413
- //width: 95px;
414
- height: 26px;
415
- padding: 0 10px;
416
- background: #ffffff;
417
- display: flex;
418
- align-items: center;
419
- justify-content: center;
420
- box-sizing: border-box;
421
- border: 1px solid #a1b9ff;
422
- border-radius: 15px;
423
- cursor: pointer;
424
- color: #366aff;
425
- margin-right: 10px;
426
- font-size: 14px;
427
- i {
428
- font-size: 18px;
429
- margin: 0 5px;
430
- }
431
- }
432
- .summaryActiveBtn{
433
- background: #366aff !important;
434
- color: #ffffff !important;
435
- }
436
- .chat {
437
- width: 95px;
438
- height: 26px;
439
- background: #ffffff;
440
- display: flex;
441
- align-items: center;
442
- justify-content: center;
443
- box-sizing: border-box;
444
- border: 1px solid #a1b9ff;
445
- border-radius: 15px 0px 15px 15px;
446
- cursor: pointer;
447
- color: #366aff;
448
- margin-right: 10px;
449
- font-size: 14px;
450
- i {
451
- font-size: 16px;
452
- margin: 0 5px;
453
- }
454
- }
455
- .chat_active {
456
- background: #366aff !important;
457
- color: #FFFFFF !important;
458
- }
459
- }
460
- }
461
- @media screen and (max-width: 767px) {
462
- /* 这里是针对移动设备的css样式设置 */
463
- /deep/.el-drawer__body{
464
- height: 100%;
465
- }
466
- #drawer_content_pre {
467
- overflow: auto;
468
- height: calc(100% - 50px);
469
- background: #FFF;
470
- }
471
- }
472
- @media screen and (min-width: 768px) {
473
- /* 这里是针对pc设备的css样式设置 */
474
- /deep/.el-drawer__body{
475
- height: 100%;
476
- }
477
- #drawer_content_pre {
478
- overflow: auto;
479
- height: calc(100% - 50px);
480
- background: #FFF;
481
- }
482
- }
483
-
1
+ <template>
2
+ <!-- <van-popup v-model="previewShowPopup" position="bottom" :style="{ height: '90%', background:'#FFFFFF'}" v-if="previewShowPopup">
3
+ <div class="footer">
4
+ <span>查看详情</span>
5
+ <section @click="close">
6
+ <i class="iconfont guoran-shanchu"></i>
7
+ </section>
8
+ </div>
9
+ <template v-if="tagIds && tagIds.length != 0 && previewShowPopup">
10
+ <pdfPosition :tagIds="tagIds" ></pdfPosition>
11
+ </template>
12
+ <template v-else>
13
+ <div v-if="fileType == 'VIDEO'" style="width: 100%;height: calc(100% - 60px)">
14
+ <video :src="url" controls width="100%;" height="98%"></video>
15
+ </div>
16
+ <div v-else-if="fileType == 'HTML'" style="width: 100%;height: calc(100% - 60px)">
17
+ <div class="preview_iframe_html" style="text-algin:left" v-html="fileText"></div>
18
+ </div>
19
+ <template v-else-if="url.includes('https://www') || url.includes('http://www')">
20
+ <iframe class="preview_iframe"
21
+ :src="url"
22
+ width="100%"
23
+ height="100%"
24
+ scrolling="100%"
25
+ frameborder="no"
26
+ border="0"></iframe>
27
+ </template>
28
+ <template v-else>
29
+ <iframe class="preview_iframe" :src="previewUrl" style="border:none;"></iframe>
30
+ </template>
31
+ </template>
32
+ <div class="loading_img" v-show="loading">
33
+ <img src="https://guoranopen-zjk.oss-cn-zhangjiakou.aliyuncs.com/cdn-common/images/loading.gif" alt="">
34
+ </div>
35
+ </van-popup> -->
36
+ <el-drawer
37
+ title="我是标题"
38
+ :visible.sync="drawer"
39
+ :with-header="false"
40
+ :append-to-body="true"
41
+ :destroy-on-close="true"
42
+ :model="false"
43
+ :direction="previewShowPopup ? 'btt' : 'rtl'"
44
+ :size="previewShowPopup ? '90%' : '65%'"
45
+ custom-class="pdf-preview-drawer"
46
+ v-if="drawer"
47
+ >
48
+ <!-- v-else-if="drawer" -->
49
+ <div class="drawer-footer">
50
+ <span>{{title ? title : "查看详情"}}</span>
51
+ <div class="header-right">
52
+ <div class="summaryBtn"
53
+ :class="showSummary ? 'summaryActiveBtn' : ''"
54
+ @click="summaryFun"
55
+ >
56
+ <i class="iconfont guoran-tongyichicun-write-29-jiqiren"></i>
57
+ <span>智能摘要</span>
58
+ </div>
59
+ <template v-if="isHasChat">
60
+ <div class="chat" @click="previewToDialog(true)" v-if="!previewKnowledgeId">
61
+ <i class="iconfont guoran-wendapingjia"></i>
62
+ 聊一聊
63
+ </div>
64
+ <div class="chat chat_active" @click="previewToDialog(false)" v-else>
65
+ <i class="iconfont guoran-wendapingjia"></i>
66
+ 聊一聊
67
+ </div>
68
+ </template>
69
+ <section @click="close">
70
+ <i class="iconfont guoran-shanchu"></i>
71
+ </section>
72
+ </div>
73
+ </div>
74
+ <div id="drawer_content_pre" :style="{ height:isDownload ? 'calc(100% - 110px)' :'calc(100% - 50px)'}">
75
+ <intelligent-summary
76
+ v-show="showSummary"
77
+ :knowledgeId="knowledgeId"
78
+ @closeSummary="closeSummary"
79
+ @recommendQues="recommendQues"
80
+ @getSummarySuccess="getSummarySuccess"
81
+ :style="{marginTop:tagIds && tagIds.length != 0 ? '50px' : ''}"
82
+ ></intelligent-summary>
83
+ <template v-if="tagIds && tagIds.length != 0 && drawer">
84
+ <pdfPosition :tagIds="tagIds" :isMessageRecord="isMessageRecord" :fileName="fileName" :knowledgeItem="watermark" ref="pdfPosition"></pdfPosition>
85
+ </template>
86
+ <template v-else>
87
+ <div v-if="fileType == 'VIDEO'" style="width: 100%;">
88
+ <video :src="url" controls width="100%;" height="98%"></video>
89
+ </div>
90
+ <div v-else-if="fileType == 'HTML'" style="width: 100%;">
91
+ <div class="preview_iframe_html" style="text-algin:left" v-html="fileText"></div>
92
+ </div>
93
+ <template v-else-if="url.includes('https://www') || url.includes('http://www')">
94
+ <iframe class="preview_iframe"
95
+ :src="url"
96
+ width="100%"
97
+ height="100%"
98
+ scrolling="100%"
99
+ frameborder="no"
100
+ border="0"></iframe>
101
+ </template>
102
+ <template v-else>
103
+ <iframe class="preview_iframe_kk" :src="previewUrl" style="border:none;" :style="{height: iframeHeight}"></iframe>
104
+ </template>
105
+ </template>
106
+ </div>
107
+ <div class="onload_btn" v-if="isDownload" @click="downLoad">
108
+ 下载
109
+ </div>
110
+ <div class="loading_img" v-show="loading">
111
+ <img src="https://guoranopen-zjk.oss-cn-zhangjiakou.aliyuncs.com/cdn-common/images/loading.gif" alt="">
112
+ </div>
113
+ </el-drawer>
114
+ </template>
115
+
116
+ <script>
117
+ import pdfPosition from './pdfPosition.vue'
118
+ import { zoomElement } from '../assets/js/hammer'
119
+ import IntelligentSummary from "./intelligentSummary";
120
+ import { isMobile } from "../assets/js/common";
121
+ import { Toast } from 'vant';
122
+ export default {
123
+ data () {
124
+ return {
125
+ previewShowPopup: false,
126
+ fileText:'',
127
+ fileType:"",
128
+ isPc:true,
129
+ drawer:false,
130
+ tagIds: [],
131
+ // '6454aa1a70573a6ead6f0f7d', '6454aa1a70573a6ead6f0f81',
132
+ loading:true,
133
+ fileName:'',
134
+ previewKnowledgeId:"",
135
+ showSummary:true,
136
+ iframeHeight:"100%",
137
+ isDownload:true,
138
+ textWatermarkStr:""
139
+ }
140
+ },
141
+ mounted() {
142
+ window.addEventListener('message',this.handleIframeMessage,false);
143
+ if (!this.tagIds || this.tagIds.length == 0){
144
+ this.getTextWatermark();
145
+ }
146
+ },
147
+ props:{
148
+ url:{
149
+ type: String,
150
+ required: true,
151
+ },
152
+ officePreviewType:{
153
+ type: String,
154
+ default: ''
155
+ },
156
+ isMessageRecord:{
157
+ type: Boolean,
158
+ default:false,
159
+ },
160
+ sourceFileType:{
161
+ type: String,
162
+ default: '',
163
+ },
164
+ title: {
165
+ type: String,
166
+ default: ''
167
+ },
168
+ isHasChat:{
169
+ type:Boolean,
170
+ default:false
171
+ },
172
+ knowledgeId:{
173
+ type: String,
174
+ default: '',
175
+ }
176
+ },
177
+ components:{
178
+ IntelligentSummary,
179
+ pdfPosition
180
+ },
181
+ watch:{
182
+ drawer(value) {
183
+ if(value) {
184
+ this.$nextTick(() =>{
185
+ if (this.tagIds && this.tagIds.length != 0){
186
+ zoomElement(document.getElementById('pdf_container_view'))
187
+ }
188
+ })
189
+ }
190
+ setTimeout(() => {
191
+ let previewIframe = document.getElementsByClassName('preview_iframe')
192
+ Array.from(previewIframe).forEach(item =>{
193
+ item.onload = () =>{
194
+ console.debug('previewIframe 106',previewIframe,this.drawer)
195
+ item.style.backgroundImage = 'none'
196
+ }
197
+ })
198
+ })
199
+ },
200
+ showSummary:{
201
+ handler(val){
202
+ if (!val){
203
+ this.$nextTick(() => {
204
+ let preCon = document.querySelector('.pdf_view');
205
+ if (preCon){
206
+ preCon.style.height = 'calc(100% - ' + 50 + 'px)'
207
+ }
208
+ })
209
+ } else {
210
+ this.getSummarySuccess();
211
+ }
212
+ }
213
+ }
214
+ },
215
+ computed:{
216
+ previewUrl() {
217
+ console.debug('VUE_APP_ENV',process.env.VUE_APP_ENV)
218
+ let url = process.env.VUE_APP_ENV === 'production' ? 'https://kkfileview.askbot.cn/onlinePreview?url=' : 'https://test.open.askbot.cn/kkfileview/onlinePreview?url='
219
+ // if(this.url != '') {
220
+ // if(/[\u4E00-\u9FA5]+/g.test(this.url)) {
221
+ // url += btoa(encodeURIComponent(this.url))
222
+ // } else {
223
+ // url += btoa(this.url)
224
+ // }
225
+ // }
226
+ url = url + this.url
227
+ url += '&officePreviewType=pdf'
228
+ if(this.watermark) {
229
+ url = this.watermark.textWatermarkValue ? (url += '&textWatermarkValue=' + this.watermark.textWatermarkValue) : url
230
+ url = this.watermark.visitorWatermarkValue ? (url += '&visitorWatermarkValue=' + this.watermark.visitorWatermarkValue) : url
231
+ }
232
+ console.log('textWatermarkStr 216',this.textWatermarkStr)
233
+ if (this.textWatermarkStr){
234
+ url += '&textWatermarkValue=' + this.textWatermarkStr
235
+ }
236
+ return url
237
+ },
238
+ // fileType() {
239
+ // const fileType = this.url.substring(this.url.lastIndexOf('.'));
240
+ // if (fileType === '.mp4' || fileType === '.MP4' || fileType === '.MOV' || fileType === '.mov') {
241
+ // return 'VIDEO'
242
+ // } else {
243
+ // return 'OTHER'
244
+ // }
245
+
246
+ // }
247
+ },
248
+ methods :{
249
+ close() {
250
+ setTimeout(() =>{
251
+ this.previewShowPopup = false;
252
+ this.fileType = ''
253
+ }, 300)
254
+ this.drawer = false;
255
+ this.showSummary = false;
256
+ },
257
+ loadIframe() {
258
+
259
+ if(this.fileType == 'VIDEO' || this.fileType == 'WECHAT' || (this.tagIds && this.tagIds.length != 0)) {
260
+ this.loading = false
261
+ } else {
262
+ let iframe = document.getElementsByClassName('preview_iframe')[0] || document.getElementsByClassName('preview_iframe_kk')[0];
263
+ if (iframe){
264
+ iframe.onload = () => {
265
+ this.loading = false;
266
+ document.getElementById('drawer_content_pre').style.backgroundImage = 'none'
267
+ }
268
+ }
269
+ // let time = setInterval(() =>{
270
+ //
271
+ // if(iframe) {
272
+ // this.loading = false
273
+ // clearInterval(time)
274
+ // }
275
+ // }, 500)
276
+ }
277
+ },
278
+ getBolb() {
279
+ this.$http.post('/knowledge-api/knowledge/htmlTextDeal?onlyText=false',{
280
+ fileInOssPath: this.url,
281
+ templateId: ''
282
+ }).then(res =>{
283
+ if (res.data.code == 0) {
284
+ this.fileText = res.data.data
285
+ this.loading = false
286
+ }
287
+ })
288
+ },
289
+ previewToDialog(flag){
290
+ this.$emit('previewToDialog',flag)
291
+ },
292
+ closeSummary(){
293
+ this.showSummary = false;
294
+ },
295
+ recommendQues(item,knowledgeId){
296
+ console.log('recommendQues',item,knowledgeId);
297
+ this.$emit('recommendQues',item,knowledgeId)
298
+ },
299
+ handleIframeMessage(res){
300
+ console.log('handleIframeMessage',res)
301
+ if (res.data.type == 'getViewerHeight'){
302
+ let iframeHeight = this.iframeHeight.replace('px','')
303
+ if (res.data.data && iframeHeight != (res.data.data + 50)){
304
+ this.iframeHeight = res.data.data + 50 + 'px'
305
+ }
306
+ }
307
+ },
308
+ summaryFun(){
309
+ this.showSummary = !this.showSummary;
310
+ if (this.showSummary){
311
+ document.getElementById('drawer_content_pre').scrollTop = 0;
312
+ }
313
+ },
314
+ getSummarySuccess(){
315
+ this.$nextTick(() => {
316
+ if (this.tagIds.length > 0){
317
+ let intelligentSummary = document.getElementById('intelligentSummary');
318
+ let preCon = document.querySelector('.pdf_view')
319
+ console.log('intelligentSummary',preCon,intelligentSummary)
320
+ if (intelligentSummary){
321
+ let height = intelligentSummary.offsetHeight + 100;
322
+ if (preCon){
323
+ preCon.style.height = 'calc(100% - ' + height + 'px)'
324
+ }
325
+ console.log('height',height,preCon)
326
+ }
327
+ }
328
+ })
329
+ },
330
+ getTextWatermark(){
331
+ let url = '/knowledge-api/open/knowledge/getPermissionInfo';
332
+ let obj = {
333
+ "knowledgeId":this.knowledgeId,
334
+ "userId":sessionStorage.getItem('_userId') || localStorage.getItem('_userId')
335
+ }
336
+ this.$http.post(url,obj).then(res => {
337
+ console.log('getTextWatermark',res.data.data)
338
+ if (res.data.data){
339
+ this.textWatermarkStr = res.data.data.textWatermarkStr;
340
+ this.isDownload = res.data.data.showDownloadBtn;
341
+ }
342
+ })
343
+ },
344
+ downLoad () {
345
+ let url = this.url
346
+ if (decodeURIComponent(url) != url) {
347
+ url = decodeURIComponent(url)
348
+ }
349
+ const fileType = url.substring(url.lastIndexOf('.'));
350
+ this.$http.post('/knowledge-api/temporary-certificate/or-origin?expired=10', url, {
351
+ headers:{
352
+ "Content-Type": "application/json",
353
+ }
354
+ }).then(res => {
355
+ console.log('downLoad 341',res)
356
+ if (res.data) {
357
+ if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
358
+ if(isMobile()) {
359
+ setTimeout(() =>{
360
+ const range = document.createRange();
361
+ range.selectNode(document.getElementById('text'));
362
+ const selection = window.getSelection();
363
+ //移除之前选中内容
364
+ if (selection.rangeCount > 0) selection.removeAllRanges();
365
+ selection.addRange(range);
366
+ document.execCommand('copy');
367
+ selection.removeAllRanges()
368
+ Toast('下载地址已复制,请前往Safari浏览器访问下载');
369
+ this.close()
370
+ },100)
371
+ } else {
372
+ navigator.clipboard.writeText(res.data)
373
+ this.$message.success({
374
+ message:'下载地址已复制,请前往Safari浏览器访问下载',
375
+ })
376
+ }
377
+ return
378
+ } else {
379
+ // setTimeout(() =>{
380
+ // window.open(res.data,'下载', 'noopener')
381
+ // }, 2000)
382
+ // window.open(res.data,'下载', 'noopener')
383
+ if(isMobile()) {
384
+ const iframe = document.createElement("iframe");
385
+ iframe.setAttribute("hidden", "hidden");
386
+ iframe.onload = () => {
387
+ if (iframe) {
388
+ console.log("iframe onload....")
389
+ iframe.setAttribute('src', 'about:blank');
390
+ }
391
+ };
392
+ document.body.insertBefore(iframe, null);
393
+ iframe.setAttribute("src", res.data);
394
+ } else {
395
+ let a = document.createElement('a')
396
+ a.href = res.data
397
+ a.download = (this.title) + fileType
398
+ a.dispatchEvent(new MouseEvent('click', { bubbles: true, cancelable: true, view: window }))
399
+ }
400
+ this.close()
401
+ }
402
+ }
403
+ })
404
+ }
405
+ },
406
+ beforeDestroy() {
407
+ window.removeEventListener('message', this.handleIframeMessage);
408
+ }
409
+ }
410
+ </script>
411
+
412
+ <style lang="less" scoped>
413
+ #drawer_content_pre{
414
+ padding: 20px;
415
+ scroll-behavior: smooth;
416
+ }
417
+ .onload_btn {
418
+ position: absolute;
419
+ left: 50%;
420
+ transform: translateX(-50%);
421
+ bottom: 10px;
422
+ width: 200px;
423
+ background-color: #366AFF;
424
+ color: white;
425
+ height: 48px;
426
+ display: flex;
427
+ align-items: center;
428
+ justify-content: center;
429
+ border-radius: 28px;
430
+ cursor: pointer;
431
+ z-index: 9999;
432
+ i{
433
+ margin-right: 8px;
434
+ }
435
+ }
436
+ .preview_iframe {
437
+ width: 100%;
438
+ height: 100%;
439
+ box-sizing: border-box;
440
+ background-image: url('https://guoranopen-zjk.oss-cn-zhangjiakou.aliyuncs.com/cdn-common/images/loading.gif');
441
+ background-position: center;
442
+ background-size: 50px;
443
+ background-repeat: no-repeat;
444
+ }
445
+ .preview_iframe_kk{
446
+ width: 100%;
447
+ height: 100%;
448
+ }
449
+ .preview_iframe_html{
450
+ width: 100%;
451
+ height: 100%;
452
+ overflow-y: scroll;
453
+ text-align: left;
454
+ box-sizing: border-box;
455
+ padding: 16px;
456
+ /deep/.lake-content{
457
+ margin-left: 10px;
458
+ }
459
+ /deep/a:link {
460
+ color: #0000ee!important;
461
+ }
462
+ /deep/a:visited {
463
+ color: #0000ee!important;
464
+ }
465
+ /deep/a:hover {
466
+ color: #0000ee!important;
467
+ }
468
+ /deep/a:active {
469
+ color: #0000ee!important;
470
+ }
471
+ /deep/li:not(.rich-text-li), ol:not(.list-paddingleft-2), ul:not(.list-paddingleft-2){
472
+ list-style-type: auto!important;
473
+ }
474
+ /deep/img{
475
+ width: 100%;
476
+ }
477
+ /deep/.ne-table{
478
+ width: 100% !important;
479
+ }
480
+ }
481
+ .footer {
482
+ width: calc(100% - 40px);
483
+ height: 50px;
484
+ display: flex;
485
+ align-items: center;
486
+ justify-content: space-between;
487
+ cursor: pointer;
488
+ padding: 0 20px;
489
+ border-bottom: 1px solid #cccccc;
490
+ }
491
+ .loading_img {
492
+ display: flex;
493
+ align-items: center;
494
+ justify-content: center;
495
+ width: 100%;
496
+ height: 100%;
497
+ position: absolute;
498
+ top: 0;
499
+ left: 0;
500
+ background: #FFF;
501
+ img {
502
+ width: 50px;
503
+ height: 50px;
504
+ }
505
+ }
506
+
507
+ .drawer-footer{
508
+ width:100%;
509
+ height: 50px;
510
+ display: flex;
511
+ align-items: center;
512
+ justify-content: space-between;
513
+ cursor: pointer;
514
+ padding: 0 20px;
515
+ border-bottom: 1px solid #cccccc;
516
+ .header-right{
517
+ display: flex;
518
+ align-items: center;
519
+ .summaryBtn{
520
+ flex: none;
521
+ //width: 95px;
522
+ height: 26px;
523
+ padding: 0 10px;
524
+ background: #ffffff;
525
+ display: flex;
526
+ align-items: center;
527
+ justify-content: center;
528
+ box-sizing: border-box;
529
+ border: 1px solid #a1b9ff;
530
+ border-radius: 15px;
531
+ cursor: pointer;
532
+ color: #366aff;
533
+ margin-right: 10px;
534
+ font-size: 14px;
535
+ i {
536
+ font-size: 18px;
537
+ margin: 0 5px;
538
+ }
539
+ }
540
+ .summaryActiveBtn{
541
+ background: #366aff !important;
542
+ color: #ffffff !important;
543
+ }
544
+ .chat {
545
+ width: 95px;
546
+ height: 26px;
547
+ background: #ffffff;
548
+ display: flex;
549
+ align-items: center;
550
+ justify-content: center;
551
+ box-sizing: border-box;
552
+ border: 1px solid #a1b9ff;
553
+ border-radius: 15px 0px 15px 15px;
554
+ cursor: pointer;
555
+ color: #366aff;
556
+ margin-right: 10px;
557
+ font-size: 14px;
558
+ i {
559
+ font-size: 16px;
560
+ margin: 0 5px;
561
+ }
562
+ }
563
+ .chat_active {
564
+ background: #366aff !important;
565
+ color: #FFFFFF !important;
566
+ }
567
+ }
568
+ }
569
+ @media screen and (max-width: 767px) {
570
+ /* 这里是针对移动设备的css样式设置 */
571
+ /deep/.el-drawer__body{
572
+ height: 100%;
573
+ }
574
+ #drawer_content_pre {
575
+ overflow: auto;
576
+ height: calc(100% - 50px);
577
+ background: #FFF;
578
+ }
579
+ }
580
+ @media screen and (min-width: 768px) {
581
+ /* 这里是针对pc设备的css样式设置 */
582
+ /deep/.el-drawer__body{
583
+ height: 100%;
584
+ }
585
+ #drawer_content_pre {
586
+ overflow: auto;
587
+ height: calc(100% - 50px);
588
+ background: #FFF;
589
+ }
590
+ }
591
+
484
592
  </style>