askbot-dragon 1.6.39-beta → 1.6.40-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 (83) 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 +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 +687 -687
  23. package/src/components/AnswerVoice.vue +285 -285
  24. package/src/components/AskIFrame.vue +15 -15
  25. package/src/components/ConversationContainer.vue +5097 -5097
  26. package/src/components/FileType.vue +86 -86
  27. package/src/components/Message.vue +27 -27
  28. package/src/components/MyEditor.vue +350 -346
  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 +370 -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 +165 -165
  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 +454 -454
  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 +315 -315
  81. package/src/components/welcomeLlmCard.vue +134 -134
  82. package/src/main.js +57 -57
  83. package/vue.config.js +54 -54
@@ -1,455 +1,455 @@
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
- ></intelligent-summary>
81
- <template v-if="tagIds && tagIds.length != 0 && drawer">
82
- <pdfPosition :tagIds="tagIds" :isMessageRecord="isMessageRecord" :fileName="fileName" :knowledgeItem="watermark" ref="pdfPosition"></pdfPosition>
83
- </template>
84
- <template v-else>
85
- <div v-if="fileType == 'VIDEO'" style="width: 100%;">
86
- <video :src="url" controls width="100%;" height="98%"></video>
87
- </div>
88
- <div v-else-if="fileType == 'HTML'" style="width: 100%;">
89
- <div class="preview_iframe_html" style="text-algin:left" v-html="fileText"></div>
90
- </div>
91
- <template v-else-if="url.includes('https://www') || url.includes('http://www')">
92
- <iframe class="preview_iframe"
93
- :src="url"
94
- width="100%"
95
- height="100%"
96
- scrolling="100%"
97
- frameborder="no"
98
- border="0"></iframe>
99
- </template>
100
- <template v-else>
101
- <iframe class="preview_iframe_kk" :src="previewUrl" style="border:none;" :style="{height: iframeHeight}"></iframe>
102
- </template>
103
- </template>
104
- </div>
105
- <div class="loading_img" v-show="loading">
106
- <img src="https://guoranopen-zjk.oss-cn-zhangjiakou.aliyuncs.com/cdn-common/images/loading.gif" alt="">
107
- </div>
108
- </el-drawer>
109
- </template>
110
-
111
- <script>
112
- import pdfPosition from './pdfPosition.vue'
113
- import { zoomElement } from '../assets/js/hammer'
114
- import IntelligentSummary from "./intelligentSummary";
115
- export default {
116
- data () {
117
- return {
118
- previewShowPopup: false,
119
- fileText:'',
120
- fileType:"",
121
- isPc:true,
122
- drawer:false,
123
- tagIds: [],
124
- // '6454aa1a70573a6ead6f0f7d', '6454aa1a70573a6ead6f0f81',
125
- loading:true,
126
- fileName:'',
127
- previewKnowledgeId:"",
128
- showSummary:true,
129
- iframeHeight:"100%"
130
- }
131
- },
132
- mounted() {
133
- window.addEventListener('message',this.handleIframeMessage,false)
134
- },
135
- props:{
136
- url:{
137
- type: String,
138
- required: true,
139
- },
140
- officePreviewType:{
141
- type: String,
142
- default: ''
143
- },
144
- isMessageRecord:{
145
- type: Boolean,
146
- default:false,
147
- },
148
- sourceFileType:{
149
- type: String,
150
- default: '',
151
- },
152
- watermark:{
153
- type: Object
154
- },
155
- isHasChat:{
156
- type:Boolean,
157
- default:false
158
- },
159
- title: {
160
- type: String,
161
- default: ''
162
- },
163
- knowledgeId:{
164
- type: String,
165
- default: '',
166
- }
167
- },
168
- components:{
169
- IntelligentSummary,
170
- pdfPosition
171
- },
172
- watch:{
173
- drawer(value) {
174
- if(value) {
175
- this.$nextTick(() =>{
176
- if (this.tagIds && this.tagIds.length != 0){
177
- zoomElement(document.getElementById('pdf_container_view'))
178
- }
179
- })
180
- }
181
- setTimeout(() => {
182
- let previewIframe = document.getElementsByClassName('preview_iframe')
183
- Array.from(previewIframe).forEach(item =>{
184
- item.onload = () =>{
185
- console.debug('previewIframe 106',previewIframe,this.drawer)
186
- item.style.backgroundImage = 'none'
187
- }
188
- })
189
- })
190
- }
191
- },
192
- computed:{
193
- previewUrl() {
194
- console.debug('VUE_APP_ENV',process.env.VUE_APP_ENV)
195
- let url = process.env.VUE_APP_ENV === 'production' ? 'https://kkfileview.askbot.cn/onlinePreview?url=' : 'https://test.open.askbot.cn/kkfileview/onlinePreview?url='
196
- // if(this.url != '') {
197
- // if(/[\u4E00-\u9FA5]+/g.test(this.url)) {
198
- // url += btoa(encodeURIComponent(this.url))
199
- // } else {
200
- // url += btoa(this.url)
201
- // }
202
- // }
203
- url = url + this.url
204
- url += '&officePreviewType=pdf'
205
- if(this.watermark) {
206
- url = this.watermark.textWatermarkValue ? (url += '&textWatermarkValue=' + this.watermark.textWatermarkValue) : url
207
- url = this.watermark.visitorWatermarkValue ? (url += '&visitorWatermarkValue=' + this.watermark.visitorWatermarkValue) : url
208
- }
209
- return url
210
- },
211
- // fileType() {
212
- // const fileType = this.url.substring(this.url.lastIndexOf('.'));
213
- // if (fileType === '.mp4' || fileType === '.MP4' || fileType === '.MOV' || fileType === '.mov') {
214
- // return 'VIDEO'
215
- // } else {
216
- // return 'OTHER'
217
- // }
218
-
219
- // }
220
- },
221
- methods :{
222
- close() {
223
- setTimeout(() =>{
224
- this.previewShowPopup = false;
225
- this.fileType = ''
226
- }, 300)
227
- this.drawer = false;
228
- this.showSummary = false;
229
- },
230
- loadIframe() {
231
-
232
- if(this.fileType == 'VIDEO' || this.fileType == 'WECHAT' || (this.tagIds && this.tagIds.length != 0)) {
233
- this.loading = false
234
- } else {
235
- let iframe = document.getElementsByClassName('preview_iframe')[0] || document.getElementsByClassName('preview_iframe_kk')[0];
236
- if (iframe){
237
- iframe.onload = () => {
238
- this.loading = false;
239
- document.getElementById('drawer_content_pre').style.backgroundImage = 'none'
240
- }
241
- }
242
- // let time = setInterval(() =>{
243
- //
244
- // if(iframe) {
245
- // this.loading = false
246
- // clearInterval(time)
247
- // }
248
- // }, 500)
249
- }
250
- },
251
- getBolb() {
252
- this.$http.post('/knowledge-api/knowledge/htmlTextDeal?onlyText=false',{
253
- fileInOssPath: this.url,
254
- templateId: ''
255
- }).then(res =>{
256
- if (res.data.code == 0) {
257
- this.fileText = res.data.data
258
- this.loading = false
259
- }
260
- })
261
- },
262
- previewToDialog(flag){
263
- this.$emit('previewToDialog',flag)
264
- },
265
- closeSummary(){
266
- this.showSummary = false;
267
- },
268
- recommendQues(item,knowledgeId){
269
- console.log('recommendQues',item,knowledgeId);
270
- this.$emit('recommendQues',item,knowledgeId)
271
- },
272
- handleIframeMessage(res){
273
- console.log('handleIframeMessage',res)
274
- if (res.data.type == 'getViewerHeight'){
275
- let iframeHeight = this.iframeHeight.replace('px','')
276
- if (res.data.data && iframeHeight != (res.data.data + 50)){
277
- this.iframeHeight = res.data.data + 50 + 'px'
278
- }
279
- }
280
- },
281
- summaryFun(){
282
- this.showSummary = !this.showSummary;
283
- if (this.showSummary){
284
- document.getElementById('drawer_content_pre').scrollTop = 0;
285
- }
286
- }
287
- },
288
- beforeDestroy() {
289
- window.removeEventListener('message', this.handleIframeMessage);
290
- }
291
- }
292
- </script>
293
-
294
- <style lang="less" scoped>
295
- #drawer_content_pre{
296
- padding: 20px;
297
- scroll-behavior: smooth;
298
- }
299
- .preview_iframe {
300
- width: 100%;
301
- height: 100%;
302
- box-sizing: border-box;
303
- background-image: url('https://guoranopen-zjk.oss-cn-zhangjiakou.aliyuncs.com/cdn-common/images/loading.gif');
304
- background-position: center;
305
- background-size: 50px;
306
- background-repeat: no-repeat;
307
- }
308
- .preview_iframe_kk{
309
- width: 100%;
310
- height: 100%;
311
- }
312
- .preview_iframe_html{
313
- width: 100%;
314
- height: 100%;
315
- overflow-y: scroll;
316
- text-align: left;
317
- box-sizing: border-box;
318
- padding: 16px;
319
- /deep/.lake-content{
320
- margin-left: 10px;
321
- }
322
- /deep/a:link {
323
- color: #0000ee!important;
324
- }
325
- /deep/a:visited {
326
- color: #0000ee!important;
327
- }
328
- /deep/a:hover {
329
- color: #0000ee!important;
330
- }
331
- /deep/a:active {
332
- color: #0000ee!important;
333
- }
334
- /deep/li:not(.rich-text-li), ol:not(.list-paddingleft-2), ul:not(.list-paddingleft-2){
335
- list-style-type: auto!important;
336
- }
337
- /deep/img{
338
- width: 100%;
339
- }
340
- /deep/.ne-table{
341
- width: 100% !important;
342
- }
343
- }
344
- .footer {
345
- width: calc(100% - 40px);
346
- height: 50px;
347
- display: flex;
348
- align-items: center;
349
- justify-content: space-between;
350
- cursor: pointer;
351
- padding: 0 20px;
352
- border-bottom: 1px solid #cccccc;
353
- }
354
- .loading_img {
355
- display: flex;
356
- align-items: center;
357
- justify-content: center;
358
- width: 100%;
359
- height: 100%;
360
- position: absolute;
361
- top: 0;
362
- left: 0;
363
- background: #FFF;
364
- img {
365
- width: 50px;
366
- height: 50px;
367
- }
368
- }
369
-
370
- .drawer-footer{
371
- width:100%;
372
- height: 50px;
373
- display: flex;
374
- align-items: center;
375
- justify-content: space-between;
376
- cursor: pointer;
377
- padding: 0 20px;
378
- border-bottom: 1px solid #cccccc;
379
- .header-right{
380
- display: flex;
381
- align-items: center;
382
- .summaryBtn{
383
- flex: none;
384
- //width: 95px;
385
- height: 26px;
386
- padding: 0 10px;
387
- background: #ffffff;
388
- display: flex;
389
- align-items: center;
390
- justify-content: center;
391
- box-sizing: border-box;
392
- border: 1px solid #a1b9ff;
393
- border-radius: 15px;
394
- cursor: pointer;
395
- color: #366aff;
396
- margin-right: 10px;
397
- font-size: 14px;
398
- i {
399
- font-size: 18px;
400
- margin: 0 5px;
401
- }
402
- }
403
- .summaryActiveBtn{
404
- background: #366aff !important;
405
- color: #ffffff !important;
406
- }
407
- .chat {
408
- width: 95px;
409
- height: 26px;
410
- background: #ffffff;
411
- display: flex;
412
- align-items: center;
413
- justify-content: center;
414
- box-sizing: border-box;
415
- border: 1px solid #a1b9ff;
416
- border-radius: 15px 0px 15px 15px;
417
- cursor: pointer;
418
- color: #366aff;
419
- margin-right: 10px;
420
- font-size: 14px;
421
- i {
422
- font-size: 16px;
423
- margin: 0 5px;
424
- }
425
- }
426
- .chat_active {
427
- background: #366aff !important;
428
- color: #FFFFFF !important;
429
- }
430
- }
431
- }
432
- @media screen and (max-width: 767px) {
433
- /* 这里是针对移动设备的css样式设置 */
434
- /deep/.el-drawer__body{
435
- height: 100%;
436
- }
437
- #drawer_content_pre {
438
- overflow: auto;
439
- height: calc(100% - 50px);
440
- background: #FFF;
441
- }
442
- }
443
- @media screen and (min-width: 768px) {
444
- /* 这里是针对pc设备的css样式设置 */
445
- /deep/.el-drawer__body{
446
- height: 100%;
447
- }
448
- #drawer_content_pre {
449
- overflow: auto;
450
- height: calc(100% - 50px);
451
- background: #FFF;
452
- }
453
- }
454
-
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
+ ></intelligent-summary>
81
+ <template v-if="tagIds && tagIds.length != 0 && drawer">
82
+ <pdfPosition :tagIds="tagIds" :isMessageRecord="isMessageRecord" :fileName="fileName" :knowledgeItem="watermark" ref="pdfPosition"></pdfPosition>
83
+ </template>
84
+ <template v-else>
85
+ <div v-if="fileType == 'VIDEO'" style="width: 100%;">
86
+ <video :src="url" controls width="100%;" height="98%"></video>
87
+ </div>
88
+ <div v-else-if="fileType == 'HTML'" style="width: 100%;">
89
+ <div class="preview_iframe_html" style="text-algin:left" v-html="fileText"></div>
90
+ </div>
91
+ <template v-else-if="url.includes('https://www') || url.includes('http://www')">
92
+ <iframe class="preview_iframe"
93
+ :src="url"
94
+ width="100%"
95
+ height="100%"
96
+ scrolling="100%"
97
+ frameborder="no"
98
+ border="0"></iframe>
99
+ </template>
100
+ <template v-else>
101
+ <iframe class="preview_iframe_kk" :src="previewUrl" style="border:none;" :style="{height: iframeHeight}"></iframe>
102
+ </template>
103
+ </template>
104
+ </div>
105
+ <div class="loading_img" v-show="loading">
106
+ <img src="https://guoranopen-zjk.oss-cn-zhangjiakou.aliyuncs.com/cdn-common/images/loading.gif" alt="">
107
+ </div>
108
+ </el-drawer>
109
+ </template>
110
+
111
+ <script>
112
+ import pdfPosition from './pdfPosition.vue'
113
+ import { zoomElement } from '../assets/js/hammer'
114
+ import IntelligentSummary from "./intelligentSummary";
115
+ export default {
116
+ data () {
117
+ return {
118
+ previewShowPopup: false,
119
+ fileText:'',
120
+ fileType:"",
121
+ isPc:true,
122
+ drawer:false,
123
+ tagIds: [],
124
+ // '6454aa1a70573a6ead6f0f7d', '6454aa1a70573a6ead6f0f81',
125
+ loading:true,
126
+ fileName:'',
127
+ previewKnowledgeId:"",
128
+ showSummary:true,
129
+ iframeHeight:"100%"
130
+ }
131
+ },
132
+ mounted() {
133
+ window.addEventListener('message',this.handleIframeMessage,false)
134
+ },
135
+ props:{
136
+ url:{
137
+ type: String,
138
+ required: true,
139
+ },
140
+ officePreviewType:{
141
+ type: String,
142
+ default: ''
143
+ },
144
+ isMessageRecord:{
145
+ type: Boolean,
146
+ default:false,
147
+ },
148
+ sourceFileType:{
149
+ type: String,
150
+ default: '',
151
+ },
152
+ watermark:{
153
+ type: Object
154
+ },
155
+ isHasChat:{
156
+ type:Boolean,
157
+ default:false
158
+ },
159
+ title: {
160
+ type: String,
161
+ default: ''
162
+ },
163
+ knowledgeId:{
164
+ type: String,
165
+ default: '',
166
+ }
167
+ },
168
+ components:{
169
+ IntelligentSummary,
170
+ pdfPosition
171
+ },
172
+ watch:{
173
+ drawer(value) {
174
+ if(value) {
175
+ this.$nextTick(() =>{
176
+ if (this.tagIds && this.tagIds.length != 0){
177
+ zoomElement(document.getElementById('pdf_container_view'))
178
+ }
179
+ })
180
+ }
181
+ setTimeout(() => {
182
+ let previewIframe = document.getElementsByClassName('preview_iframe')
183
+ Array.from(previewIframe).forEach(item =>{
184
+ item.onload = () =>{
185
+ console.debug('previewIframe 106',previewIframe,this.drawer)
186
+ item.style.backgroundImage = 'none'
187
+ }
188
+ })
189
+ })
190
+ }
191
+ },
192
+ computed:{
193
+ previewUrl() {
194
+ console.debug('VUE_APP_ENV',process.env.VUE_APP_ENV)
195
+ let url = process.env.VUE_APP_ENV === 'production' ? 'https://kkfileview.askbot.cn/onlinePreview?url=' : 'https://test.open.askbot.cn/kkfileview/onlinePreview?url='
196
+ // if(this.url != '') {
197
+ // if(/[\u4E00-\u9FA5]+/g.test(this.url)) {
198
+ // url += btoa(encodeURIComponent(this.url))
199
+ // } else {
200
+ // url += btoa(this.url)
201
+ // }
202
+ // }
203
+ url = url + this.url
204
+ url += '&officePreviewType=pdf'
205
+ if(this.watermark) {
206
+ url = this.watermark.textWatermarkValue ? (url += '&textWatermarkValue=' + this.watermark.textWatermarkValue) : url
207
+ url = this.watermark.visitorWatermarkValue ? (url += '&visitorWatermarkValue=' + this.watermark.visitorWatermarkValue) : url
208
+ }
209
+ return url
210
+ },
211
+ // fileType() {
212
+ // const fileType = this.url.substring(this.url.lastIndexOf('.'));
213
+ // if (fileType === '.mp4' || fileType === '.MP4' || fileType === '.MOV' || fileType === '.mov') {
214
+ // return 'VIDEO'
215
+ // } else {
216
+ // return 'OTHER'
217
+ // }
218
+
219
+ // }
220
+ },
221
+ methods :{
222
+ close() {
223
+ setTimeout(() =>{
224
+ this.previewShowPopup = false;
225
+ this.fileType = ''
226
+ }, 300)
227
+ this.drawer = false;
228
+ this.showSummary = false;
229
+ },
230
+ loadIframe() {
231
+
232
+ if(this.fileType == 'VIDEO' || this.fileType == 'WECHAT' || (this.tagIds && this.tagIds.length != 0)) {
233
+ this.loading = false
234
+ } else {
235
+ let iframe = document.getElementsByClassName('preview_iframe')[0] || document.getElementsByClassName('preview_iframe_kk')[0];
236
+ if (iframe){
237
+ iframe.onload = () => {
238
+ this.loading = false;
239
+ document.getElementById('drawer_content_pre').style.backgroundImage = 'none'
240
+ }
241
+ }
242
+ // let time = setInterval(() =>{
243
+ //
244
+ // if(iframe) {
245
+ // this.loading = false
246
+ // clearInterval(time)
247
+ // }
248
+ // }, 500)
249
+ }
250
+ },
251
+ getBolb() {
252
+ this.$http.post('/knowledge-api/knowledge/htmlTextDeal?onlyText=false',{
253
+ fileInOssPath: this.url,
254
+ templateId: ''
255
+ }).then(res =>{
256
+ if (res.data.code == 0) {
257
+ this.fileText = res.data.data
258
+ this.loading = false
259
+ }
260
+ })
261
+ },
262
+ previewToDialog(flag){
263
+ this.$emit('previewToDialog',flag)
264
+ },
265
+ closeSummary(){
266
+ this.showSummary = false;
267
+ },
268
+ recommendQues(item,knowledgeId){
269
+ console.log('recommendQues',item,knowledgeId);
270
+ this.$emit('recommendQues',item,knowledgeId)
271
+ },
272
+ handleIframeMessage(res){
273
+ console.log('handleIframeMessage',res)
274
+ if (res.data.type == 'getViewerHeight'){
275
+ let iframeHeight = this.iframeHeight.replace('px','')
276
+ if (res.data.data && iframeHeight != (res.data.data + 50)){
277
+ this.iframeHeight = res.data.data + 50 + 'px'
278
+ }
279
+ }
280
+ },
281
+ summaryFun(){
282
+ this.showSummary = !this.showSummary;
283
+ if (this.showSummary){
284
+ document.getElementById('drawer_content_pre').scrollTop = 0;
285
+ }
286
+ }
287
+ },
288
+ beforeDestroy() {
289
+ window.removeEventListener('message', this.handleIframeMessage);
290
+ }
291
+ }
292
+ </script>
293
+
294
+ <style lang="less" scoped>
295
+ #drawer_content_pre{
296
+ padding: 20px;
297
+ scroll-behavior: smooth;
298
+ }
299
+ .preview_iframe {
300
+ width: 100%;
301
+ height: 100%;
302
+ box-sizing: border-box;
303
+ background-image: url('https://guoranopen-zjk.oss-cn-zhangjiakou.aliyuncs.com/cdn-common/images/loading.gif');
304
+ background-position: center;
305
+ background-size: 50px;
306
+ background-repeat: no-repeat;
307
+ }
308
+ .preview_iframe_kk{
309
+ width: 100%;
310
+ height: 100%;
311
+ }
312
+ .preview_iframe_html{
313
+ width: 100%;
314
+ height: 100%;
315
+ overflow-y: scroll;
316
+ text-align: left;
317
+ box-sizing: border-box;
318
+ padding: 16px;
319
+ /deep/.lake-content{
320
+ margin-left: 10px;
321
+ }
322
+ /deep/a:link {
323
+ color: #0000ee!important;
324
+ }
325
+ /deep/a:visited {
326
+ color: #0000ee!important;
327
+ }
328
+ /deep/a:hover {
329
+ color: #0000ee!important;
330
+ }
331
+ /deep/a:active {
332
+ color: #0000ee!important;
333
+ }
334
+ /deep/li:not(.rich-text-li), ol:not(.list-paddingleft-2), ul:not(.list-paddingleft-2){
335
+ list-style-type: auto!important;
336
+ }
337
+ /deep/img{
338
+ width: 100%;
339
+ }
340
+ /deep/.ne-table{
341
+ width: 100% !important;
342
+ }
343
+ }
344
+ .footer {
345
+ width: calc(100% - 40px);
346
+ height: 50px;
347
+ display: flex;
348
+ align-items: center;
349
+ justify-content: space-between;
350
+ cursor: pointer;
351
+ padding: 0 20px;
352
+ border-bottom: 1px solid #cccccc;
353
+ }
354
+ .loading_img {
355
+ display: flex;
356
+ align-items: center;
357
+ justify-content: center;
358
+ width: 100%;
359
+ height: 100%;
360
+ position: absolute;
361
+ top: 0;
362
+ left: 0;
363
+ background: #FFF;
364
+ img {
365
+ width: 50px;
366
+ height: 50px;
367
+ }
368
+ }
369
+
370
+ .drawer-footer{
371
+ width:100%;
372
+ height: 50px;
373
+ display: flex;
374
+ align-items: center;
375
+ justify-content: space-between;
376
+ cursor: pointer;
377
+ padding: 0 20px;
378
+ border-bottom: 1px solid #cccccc;
379
+ .header-right{
380
+ display: flex;
381
+ align-items: center;
382
+ .summaryBtn{
383
+ flex: none;
384
+ //width: 95px;
385
+ height: 26px;
386
+ padding: 0 10px;
387
+ background: #ffffff;
388
+ display: flex;
389
+ align-items: center;
390
+ justify-content: center;
391
+ box-sizing: border-box;
392
+ border: 1px solid #a1b9ff;
393
+ border-radius: 15px;
394
+ cursor: pointer;
395
+ color: #366aff;
396
+ margin-right: 10px;
397
+ font-size: 14px;
398
+ i {
399
+ font-size: 18px;
400
+ margin: 0 5px;
401
+ }
402
+ }
403
+ .summaryActiveBtn{
404
+ background: #366aff !important;
405
+ color: #ffffff !important;
406
+ }
407
+ .chat {
408
+ width: 95px;
409
+ height: 26px;
410
+ background: #ffffff;
411
+ display: flex;
412
+ align-items: center;
413
+ justify-content: center;
414
+ box-sizing: border-box;
415
+ border: 1px solid #a1b9ff;
416
+ border-radius: 15px 0px 15px 15px;
417
+ cursor: pointer;
418
+ color: #366aff;
419
+ margin-right: 10px;
420
+ font-size: 14px;
421
+ i {
422
+ font-size: 16px;
423
+ margin: 0 5px;
424
+ }
425
+ }
426
+ .chat_active {
427
+ background: #366aff !important;
428
+ color: #FFFFFF !important;
429
+ }
430
+ }
431
+ }
432
+ @media screen and (max-width: 767px) {
433
+ /* 这里是针对移动设备的css样式设置 */
434
+ /deep/.el-drawer__body{
435
+ height: 100%;
436
+ }
437
+ #drawer_content_pre {
438
+ overflow: auto;
439
+ height: calc(100% - 50px);
440
+ background: #FFF;
441
+ }
442
+ }
443
+ @media screen and (min-width: 768px) {
444
+ /* 这里是针对pc设备的css样式设置 */
445
+ /deep/.el-drawer__body{
446
+ height: 100%;
447
+ }
448
+ #drawer_content_pre {
449
+ overflow: auto;
450
+ height: calc(100% - 50px);
451
+ background: #FFF;
452
+ }
453
+ }
454
+
455
455
  </style>