askbot-dragon 1.5.49 → 1.5.50

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 (82) hide show
  1. package/README.md +27 -27
  2. package/babel.config.js +6 -6
  3. package/dragon.iml +7 -7
  4. package/package.json +56 -55
  5. package/public/index.html +73 -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 +89 -89
  14. package/src/assets/js/obsBrowser.js +63 -0
  15. package/src/assets/js/script.js +36 -36
  16. package/src/assets/less/common.css +6773 -6773
  17. package/src/assets/less/converSationContainer/common.less +192 -192
  18. package/src/assets/less/converSationContainer/converSatonContainer.less +493 -493
  19. package/src/assets/less/iconfont.css +37 -37
  20. package/src/assets/less/ticketMessage.less +294 -294
  21. package/src/components/ActionAlertIframe.vue +154 -154
  22. package/src/components/AiGuide.vue +468 -468
  23. package/src/components/AnswerDocknowledge.vue +581 -556
  24. package/src/components/AnswerVoice.vue +285 -285
  25. package/src/components/AskIFrame.vue +15 -15
  26. package/src/components/ConversationContainer.vue +4969 -5038
  27. package/src/components/FileType.vue +86 -86
  28. package/src/components/Message.vue +27 -27
  29. package/src/components/MyEditor.vue +348 -346
  30. package/src/components/actionSatisfaction.vue +107 -107
  31. package/src/components/actionSendToBot.vue +62 -62
  32. package/src/components/answerDissatisfaction.vue +62 -62
  33. package/src/components/answerRadio.vue +132 -186
  34. package/src/components/ask-components/DissatisfactionOptions.vue +57 -57
  35. package/src/components/ask-components/Msgloading.vue +37 -37
  36. package/src/components/ask-components/SatisfactionV2.vue +15 -15
  37. package/src/components/askVideo.vue +142 -139
  38. package/src/components/assetDetails.vue +370 -370
  39. package/src/components/assetMessage.vue +228 -228
  40. package/src/components/associationIntention.vue +349 -349
  41. package/src/components/attachmentPreview.vue +90 -90
  42. package/src/components/botActionSatisfactor.vue +68 -68
  43. package/src/components/chatContent.vue +513 -513
  44. package/src/components/feedBack.vue +136 -136
  45. package/src/components/fielListView.vue +351 -351
  46. package/src/components/file/AliyunOssComponents.vue +108 -108
  47. package/src/components/formTemplate.vue +3577 -3572
  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/pdfPosition.vue +1328 -1322
  60. package/src/components/popup.vue +227 -227
  61. package/src/components/previewDoc.vue +242 -242
  62. package/src/components/previewPdf.vue +353 -306
  63. package/src/components/receiverMessagePlatform.vue +65 -65
  64. package/src/components/recommend.vue +80 -80
  65. package/src/components/selector/hOption.vue +20 -20
  66. package/src/components/selector/hSelector.vue +199 -199
  67. package/src/components/selector/hWrapper.vue +216 -216
  68. package/src/components/senderMessagePlatform.vue +50 -50
  69. package/src/components/source/BotMessage.vue +24 -24
  70. package/src/components/source/CustomMessage.vue +24 -24
  71. package/src/components/test.vue +260 -260
  72. package/src/components/tree.vue +294 -294
  73. package/src/components/utils/AliyunIssUtil.js +81 -81
  74. package/src/components/utils/ckeditor.js +177 -174
  75. package/src/components/utils/format_date.js +25 -25
  76. package/src/components/utils/index.js +6 -6
  77. package/src/components/utils/math_utils.js +29 -29
  78. package/src/components/voiceComponent.vue +119 -119
  79. package/src/components/welcomeKnowledgeFile.vue +307 -270
  80. package/src/components/welcomeLlmCard.vue +134 -134
  81. package/src/main.js +57 -57
  82. package/vue.config.js +54 -54
@@ -1,557 +1,582 @@
1
- <template>
2
- <div class="answer-docknowledge">
3
- <div :class="['answer-docknowledge-header',msg.content.isKnowledgeSummary ? 'bgc' : '']">
4
- <div v-if="msg.content.isKnowledgeSummary" class="tips">AI为您总结生成了以下摘要</div>
5
- <div v-if="msg.content.type == 0" class="answer-text">
6
- <template v-if="msg.content.renderType == 1">
7
- <p v-html="msg.content.text"></p>
8
- </template>
9
- <template v-else>
10
- {{ msg.content.text }}
11
- </template>
12
- </div>
13
- <div v-if="msg.content.type == 1" class="answer-text">
14
- <template v-if="msg.content.renderType == 1">
15
- <p v-html="msg.content.text"></p>
16
- </template>
17
- <template v-else>
18
- {{ msg.content.text }}
19
- </template>
20
- </div>
21
- <div v-if="msg.content.images && msg.content.images.length != 0" class="answer-kn-image-box">
22
- <img v-for="(imageItem, imageItemIndex) in msg.content.images" style='max-width: 230px;border-radius: 25px;margin-bottom: 15px' :src="imageItem.url" :key="imageItemIndex" alt="" @click="lookAttach(imageItem.url, imageItem, $event)">
23
- </div>
24
- </div>
25
- <div class="ad-list">
26
- <div v-for="(item, itemIndex) in msg.content.list" :style="{paddingBottom: itemIndex === msg.content.list.length - 1?0:'10px'}" :key="itemIndex" class="ad-list-cell">
27
- <div class="alc-title">
28
- <div class="alc-box">
29
- <div class="alc-source-left">
30
- <span class="source-form">出自</span>
31
- <img class="alc-title-icon" height="24px" width="24px" :src="item.src" alt="" srcset="">
32
- <span class="alc-title-from">{{ item.from }}</span>
33
- </div>
34
-
35
- </div>
36
- <div v-html="item.introduction" v-if="!srcContentTypeIMG(item)" class="alc-box-introduction">
37
- </div>
38
- <div v-else class="alc-box-introduction">
39
- <img :src="item.expiredUrl" alt="" @click="lookAttach(item.url, item, $event)">
40
- </div>
41
- <div v-if="item.previewImage" class="alc-box-introduction-previewImage">
42
- <img :src="item.previewImage" alt="" @click="lookAttach(item.previewImage, {url: item.previewImage}, $event)">
43
- </div>
44
- <div class="alc-updateTime">
45
- <div v-show="docSource[item.source]" class="upload-source">
46
- {{docSource[item.source]}}
47
- </div>
48
- <div v-show="item.url" class="alc-content-text">
49
- <span @click="lookAttach(item.url, item, $event)" class="aci-view">查看 ></span>
50
- </div>
51
- <!-- <div class="time">
52
- <span>更新时间:</span>
53
- {{ new Date(item.updateTime).Format('MM-dd hh:mm') }}
54
- </div> -->
55
- </div>
56
- <!-- <span v-if="isPC" class="alc-title-updateTime">最后更新时间: {{ item.updateTime }}</span>-->
57
- </div>
58
- <div class="alc-content" v-if="false">
59
- <div v-if="msg.content.type == 1" class="alc-content-text">{{ item.introduction }} <span
60
- @click="lookAttach(item.url, item, $event)" class="aci-view">查看原文 ></span>
61
- </div>
62
- <span v-if="!isPC" class="alc-title-updateTime">最后更新时间: {{ item.updateTime }}</span>
63
- <div v-if="false" class="alc-content-info">
64
- <div class="alcc-box">
65
- <span class="aci-owner">所有者: {{ item.owner }}</span>
66
- <span class="aci-enterprise">所属企业: {{ item.enterprise }}</span>
67
- <span class="aci-source">文件来源: {{ item.source }}</span>
68
- </div>
69
- </div>
70
- </div>
71
- </div>
72
- <div class="ad-loadmore" v-if="loadMoreFlag" @click="lazyLoadKnowledegList">
73
- 查看更多
74
- </div>
75
- </div>
76
- <previewPdf ref="previewPdf" :url="previewHref" :sourceFileType="sourceFileType" officePreviewType="pdf"></previewPdf>
77
- </div>
78
- </template>
79
-
80
- <script>
81
- /* eslint-disable */
82
- import previewPdf from "./previewPdf";
83
- import { isMobile } from "../assets/js/common";
84
- export default {
85
- name: "answerDocknowledge",
86
- components: { previewPdf },
87
- data() {
88
- return {
89
- isPC: true,
90
- previewHref: "",
91
- sourceFileType:'',
92
- docSource: {
93
- LOCAL_FILE: "来源于本地文件",
94
- CREATED_BY_ONESELF: "来源于自建知识",
95
- WECHAT: "来源于微信",
96
- AUTO_SYN_FROM_LOCAL_FILE: "自动同步于本地",
97
- YUQUE: "来源于语雀",
98
- CORP_LOCAL_FILE:'来源于企业知识库',
99
- FEISHU:'来源于飞书-云文档'
100
- },
101
- imageObj: {
102
- PDF: 'pdf1',
103
- pdf: 'pdf1',
104
- TXT: 'txt1',
105
- txt: 'txt1',
106
- selfadd: 'selfadd1',
107
- md: "md2",
108
- html: 'selfadd1',
109
- mode: "mode",
110
- general: 'general',
111
- word: "word1",
112
- Word: "word1",
113
- docx: "word1",
114
- doc: "word1",
115
- WORD: "word1",
116
- Excel: 'excel1',
117
- EXCEL: 'excel1',
118
- excel: 'excel1',
119
- PPT: 'ppt1',
120
- ppt: 'ppt1',
121
- pptx: 'ppt1',
122
- img: "image1",
123
- image: "image1",
124
- video: "video",
125
- audio: 'audio',
126
- link: "link",
127
- wechat: "wechat",
128
- mp4: "video",
129
- MP4: "video",
130
- xlsx: "excel1",
131
- SLSX: "excel1",
132
- xls: "excel1",
133
- XLS: "excel1",
134
- jpg: "image1",
135
- JPG: "image1",
136
- jpeg: "image1",
137
- JPEG: "image1",
138
- png: "image1",
139
- PNG: "image1",
140
- webp: "image1",
141
- WEBP: "image1",
142
- gif: "image1",
143
- GIF: "image1",
144
- svg: "image1",
145
- SVG: "image1",
146
- bmp: "image1",
147
- BMP: "image1",
148
- avi: "video",
149
- AVI: "video",
150
- mov: "video",
151
- MOV: "video",
152
- rmvb: "video",
153
- RMVB: "video",
154
- wav: "audio",
155
- WAV: "audio",
156
- mp3: "audio",
157
- MP3: "audio",
158
- yqhtml: "yqhtml",
159
- feishuhtml:"feishuhtml"
160
- },
161
- allKnowledgeList:[],
162
- loadMoreFlag:false
163
- }
164
- },
165
- props: ['msg','isAskLightning', 'isMessageRecord',"isApp"],
166
- beforeMounted() {
167
- },
168
- watch:{
169
- msg:{
170
- handler(n){
171
- console.log(n,'answerDocknowledge');
172
- n.content.list.forEach(element => {
173
- console.log(this.imageObj[element.format],1111);
174
- element.src = 'https://static.guoranbot.com/cdn-office-website/askbot_doc/' + this.imageObj[element.format] + '.png';
175
- if ((element.format === "txt" || element.format === "html") && element.source === "WECHAT") {
176
- element.src = 'https://static.guoranbot.com/cdn-office-website/askbot_doc/wechat.png';
177
- }
178
- });
179
- },
180
- deep:true,
181
- immediate:true
182
- }
183
- },
184
- created() {
185
- var system = {};
186
- system.pingtai = /(Win32|Win16|WinCE|Mac68K|MacIntel|MacIntel|MacPPC|Linux mips64)/i.test(navigator.platform);
187
- if (system.pingtai) {
188
- //电脑
189
- this.isPC = true;
190
- } else {
191
- //手机
192
- this.isPC = false;
193
- }
194
- // this.msg.content.list.forEach(element => {
195
- // console.log(this.imageObj[element.format],1111);
196
- // element.src = 'https://static.guoranbot.com/cdn-office-website/askbot_doc/' + this.imageObj[element.format] + '.png';
197
- // if ((element.format === "txt" || element.format === "html") && element.source === "WECHAT") {
198
- // element.src = 'https://static.guoranbot.com/cdn-office-website/askbot_doc/wechat.png';
199
- // }
200
- // });
201
- },
202
- mounted() {
203
- console.log(this.msg.content,'this.msg.content');
204
- // if(this.msg.content.type == 1) {
205
-
206
- // }
207
- if(this.msg.content.list && this.msg.content.list.length > 0) {
208
- this.loadMoreFlag = true
209
- this.allKnowledgeList = JSON.parse(JSON.stringify(this.msg.content.list))
210
- // console.log(this.allKnowledgeList.length, 'this.allKnowledgeList');
211
- this.msg.content.list = []
212
- this.lazyLoadKnowledegList()
213
- }
214
- },
215
- methods: {
216
- //预览图片
217
- lookAttach(url, item, event) {
218
- event.preventDefault();
219
- if (this.isAskLightning == 1 && !this.isApp){
220
- window.parent.postMessage({
221
- data: "bot_preview",
222
- item: JSON.stringify(item),
223
- url: url
224
- },"*");
225
- } else {
226
- // if (isMobile()) {
227
- // this.$refs.previewPdf.drawer = true;
228
- // this.$refs.previewPdf.previewShowPopup = false;
229
- // } else {
230
- // this.$refs.previewPdf.drawer = false;
231
- // }
232
- this.$refs.previewPdf.previewShowPopup = false;
233
- this.$refs.previewPdf.drawer = false;
234
- let index = url.lastIndexOf('?')
235
- let type = ''
236
- let httpUrl = '/knowledge-api/knowledge/getTemporaryCertificate'
237
- if (index !== -1) {
238
- url = url.substring(0, index)
239
- type = this.fileType(url)
240
- } else {
241
- type = this.fileType(url)
242
- }
243
- if (type === '' || type === 'OTHER') {
244
- httpUrl = httpUrl += '?needEncrypt=true'
245
- } else {
246
- httpUrl = httpUrl += '?needEncrypt=false'
247
- }
248
- this.$http.post(httpUrl, {
249
- "fileInOssPath":url
250
- }).then(res =>{
251
- if(res.data.code == '0') {
252
- this.previewHref = res.data.data;
253
- this.sourceFileType = url.substring(url.lastIndexOf('.'))
254
- let isOhmPc = sessionStorage.getItem('isOhmPc')
255
- if (isMobile() || isOhmPc == 'true'){
256
- this.$refs.previewPdf.drawer = true;
257
- this.$refs.previewPdf.previewShowPopup = true;
258
- } else {
259
- this.$refs.previewPdf.previewShowPopup = false;
260
- this.$refs.previewPdf.drawer = true;
261
- }
262
- this.$refs.previewPdf.fileType = type
263
- this.$refs.previewPdf.tagIds = item.tagIds
264
- this.$refs.previewPdf.isMessageRecord = this.isMessageRecord ? true : false
265
- if(item.tagIds && item.tagIds.length != 0) {
266
- this.$refs.previewPdf.loading = false
267
- return
268
- }
269
- this.$nextTick(() =>{
270
- if(item.source == 'CREATED_BY_ONESELF' || type === 'HTML') {
271
- this.$refs.previewPdf.getBolb(item)
272
- }
273
- this.$refs.previewPdf.loadIframe(item)
274
- })
275
- }
276
- })
277
- }
278
- },
279
- fileType (url) {
280
- const fileType = url.substring(url.lastIndexOf('.'));
281
- if (fileType === '.mp4' || fileType === '.MP4' || fileType === '.MOV' || fileType === '.MOVC' || fileType === '.mov' || fileType === '.movc' || fileType === '.mav' || fileType === '.MAV' || fileType == '.mp3' || fileType == '.MP3' || fileType === '.wav') {
282
- return 'VIDEO'
283
- } else if (fileType === '.html') {
284
- return 'HTML'
285
- } else {
286
- return 'OTHER'
287
- }
288
- },
289
- srcContentTypeIMG(item) {
290
- let url = item.url || '';
291
- const type = url.substring(url.lastIndexOf('.'));
292
- if(type === '.jpg' || type === '.jpeg' || type === '.png' || type === '.gif') {
293
- this.getSrc(item)
294
- return true
295
- } else {
296
- return false
297
- }
298
- },
299
- getSrc (item) {
300
- // let imgurl = ''
301
- this.$http.post(
302
- '/knowledge-api/temporary-certificate/or-origin?expired=30',
303
- item.url,
304
- {
305
- headers: {
306
- "Content-Type": "application/json",
307
- },
308
- }).then( res => {
309
- console.log(res,'=====');
310
- // imgurl = await res.bodyText
311
- this.$set(item,'expiredUrl',res.data ? res.data : res.bodyText)
312
- // return res.data
313
- })
314
- // return imgurl
315
- },
316
- lazyLoadKnowledegList() {
317
- if(this.allKnowledgeList.length !== 0) {
318
- let arr = this.allKnowledgeList.splice(0, 5)
319
- if(arr.length < 5) {
320
- this.loadMoreFlag = false
321
- this.msg.content.list = [...this.msg.content.list, ...arr]
322
- return
323
- }
324
- if(this.allKnowledgeList.length == 0) {
325
- this.loadMoreFlag = false
326
- }
327
- this.msg.content.list = [...this.msg.content.list, ...arr]
328
- return
329
- }
330
- }
331
- }
332
- }
333
- </script>
334
-
335
- <style scoped lang="less">
336
- .answer-docknowledge {
337
- min-width: 100px;
338
- .answer-docknowledge-header{
339
-
340
-
341
- .tips{
342
- width: 154px;
343
- height: 22px;
344
- background: #366AFF;
345
- border-radius: 5px;
346
- text-align: center;
347
- line-height: 22px;
348
- color: #fff;
349
- font-size: 12px;
350
- margin-bottom: 7px;
351
- }
352
- .answer-text {
353
- // font-size: 13px;
354
- text-align: left;
355
- line-height: 25px;
356
- padding: 0px 0px 12px 0px;
357
-
358
- .aci-view {
359
- // font-size: 13px;
360
- display: inline-block;
361
- // margin-left: 5px;
362
- color: #366aff;
363
- cursor: pointer;
364
- }
365
- }
366
- &.bgc{
367
- padding: 10px;
368
- background: #EEF1FF;
369
- border-radius: 10px;
370
- margin-bottom: 16px;
371
- .answer-text {
372
- padding: 0;
373
- }
374
- }
375
- }
376
-
377
- .ad-list {
378
- .ad-list-cell {
379
- border-top: solid 1px #EEEEEE;
380
- padding: 10px 0 10px;
381
-
382
- .alc-title {
383
- display: flex;
384
- flex-wrap: wrap;
385
- align-items: center;
386
- justify-content: space-between;
387
- line-height: 16px;
388
-
389
- .alc-box {
390
- display: flex;
391
- align-items: center;
392
- justify-content: space-between;
393
- // font-size: 12px;
394
- width: 100%;
395
- .alc-source-left{
396
- display: flex;
397
- align-items: center;
398
- .source-form{
399
- width: 34px;
400
- flex: none;
401
- color: #A9B3C6;
402
- }
403
- }
404
- .alc-content-text{
405
- width: 55px;
406
- flex: none;
407
- .aci-view{
408
- color: #366aff;
409
- cursor: pointer;
410
- }
411
- }
412
- .alc-title-from {
413
- line-height: 22px;
414
- word-break: break-all !important;
415
- text-align: left;
416
- flex: auto;
417
- display: flex;
418
- justify-content: flex-start;
419
- }
420
- }
421
- .alc-box-introduction{
422
- overflow: hidden;
423
- text-overflow: ellipsis;
424
- display: -webkit-box;
425
- -webkit-line-clamp:3;
426
- -webkit-box-orient:vertical;
427
- margin-top: 10px;
428
- color: #616161;
429
- // font-size: 12px;
430
- line-height: 24px;
431
- text-align: left;
432
- img {
433
- width: 50px;
434
- height: 50px;
435
- margin: 10px;
436
- cursor: pointer;
437
- }
438
- }
439
- .alc-box-introduction-previewImage {
440
- overflow: hidden;
441
- text-overflow: ellipsis;
442
- display: -webkit-box;
443
- -webkit-line-clamp:3;
444
- -webkit-box-orient:vertical;
445
- margin-top: 10px;
446
- color: #616161;
447
- // font-size: 12px;
448
- line-height: 24px;
449
- text-align: left;
450
- img {
451
- max-width: 300px;
452
- width: 100%;
453
- max-height: 150px;
454
- margin: 10px;
455
- cursor: pointer;
456
- }
457
- }
458
- .alc-updateTime{
459
- display: flex;
460
- align-items: center;
461
- justify-content: space-between;
462
- font-size: 13px;
463
- width: 100%;
464
- margin-top: 10px;
465
- .upload-source{
466
- flex: none;
467
- height: 18px;
468
- line-height: 18px;
469
- background: #E9F9F8;
470
- border: 1px solid #AFF2CD;
471
- border-radius: 2px;
472
- display: flex;
473
- align-items: center;
474
- justify-content: center;
475
- padding: 0 8px;
476
- color: #00C2BB;
477
- }
478
- .time{
479
- color: #999999;
480
- margin-left: 10px;
481
- }
482
- .alc-content-text {
483
- color: #366aff;
484
- cursor: pointer;
485
- }
486
- }
487
- .alc-title-icon {
488
- margin: 0 2px;
489
- width: 18px;
490
- height: 18px;
491
- flex: none;
492
- }
493
-
494
- .alc-title-updateTime {
495
- text-align: right;
496
- color: #999999;
497
- // font-size: 13px;
498
- }
499
- }
500
-
501
- .alc-content {
502
- .alc-title-updateTime {
503
- margin-top: 6px;
504
- display: block;
505
- text-align: right;
506
- color: #999999;
507
- // font-size: 13px;
508
- }
509
-
510
- .alc-content-text {
511
- margin-bottom: 6px;
512
- width: 55px;
513
- flex: none;
514
- .aci-view {
515
- display: inline-block;
516
- margin-left: 30px;
517
- color: #366aff;
518
- cursor: pointer;
519
- }
520
- }
521
-
522
- .alc-content-info {
523
- display: flex;
524
- flex-wrap: wrap;
525
- justify-content: space-between;
526
-
527
- .alcc-box {
528
- display: flex;
529
- flex-wrap: wrap;
530
- color: #999999;
531
-
532
- .aci-owner {
533
- margin-right: 20px;
534
- }
535
-
536
- .aci-enterprise {
537
- margin-right: 20px;
538
- }
539
- }
540
- }
541
- }
542
- }
543
- .ad-loadmore {
544
- width: 100%;
545
- height: 40px;
546
- display: flex;
547
- align-items: center;
548
- justify-content: center;
549
- // background: #FFFFFF;
550
- color: #366AFF;
551
- font-size: 14px;
552
- margin-top: 8px;
553
- cursor: pointer;
554
- }
555
- }
556
- }
1
+ <template>
2
+ <div class="answer-docknowledge">
3
+ <div :class="['answer-docknowledge-header',msg.content.isKnowledgeSummary ? 'bgc' : '']">
4
+ <div v-if="msg.content.isKnowledgeSummary" class="tips">AI为您总结生成了以下摘要</div>
5
+ <div v-if="msg.content.type == 0" class="answer-text">
6
+ <template v-if="msg.content.renderType == 1">
7
+ <p v-html="msg.content.text"></p>
8
+ </template>
9
+ <template v-else>
10
+ {{ msg.content.text }}
11
+ </template>
12
+ </div>
13
+ <div v-if="msg.content.type == 1" class="answer-text">
14
+ <template v-if="msg.content.renderType == 1">
15
+ <p v-html="msg.content.text"></p>
16
+ </template>
17
+ <template v-else>
18
+ {{ msg.content.text }}
19
+ </template>
20
+ </div>
21
+ <div v-if="msg.content.images && msg.content.images.length != 0" class="answer-kn-image-box">
22
+ <img v-for="(imageItem, imageItemIndex) in msg.content.images" style='max-width: 230px;border-radius: 25px;margin-bottom: 15px' :src="imageItem.url" :key="imageItemIndex" alt="" @click="lookAttach(imageItem.url, imageItem, $event)">
23
+ </div>
24
+ </div>
25
+ <div class="ad-list">
26
+ <div v-for="(item, itemIndex) in msg.content.list" :style="{paddingBottom: itemIndex === msg.content.list.length - 1?0:'10px'}" :key="itemIndex" class="ad-list-cell">
27
+ <div class="alc-title">
28
+ <div class="alc-box">
29
+ <div class="alc-source-left">
30
+ <span class="source-form">出自</span>
31
+ <img class="alc-title-icon" height="24px" width="24px" :src="item.src" alt="" srcset="">
32
+ <span class="alc-title-from">{{ item.from }}</span>
33
+ </div>
34
+
35
+ </div>
36
+ <div v-html="item.introduction" v-if="!srcContentTypeIMG(item)" class="alc-box-introduction">
37
+ </div>
38
+ <div v-else class="alc-box-introduction">
39
+ <img :src="item.expiredUrl" alt="" @click="lookAttach(item.url, item, $event)">
40
+ </div>
41
+ <div v-if="item.previewImage" class="alc-box-introduction-previewImage">
42
+ <img :src="item.previewImage" alt="" @click="lookAttach(item.previewImage, {url: item.previewImage}, $event)">
43
+ </div>
44
+ <div class="alc-updateTime">
45
+ <div v-show="docSource[item.source]" class="upload-source">
46
+ {{docSource[item.source]}}
47
+ </div>
48
+ <div v-show="item.url" class="alc-content-text">
49
+ <span @click="lookAttach(item.url, item, $event)" class="aci-view">查看 ></span>
50
+ </div>
51
+ <!-- <div class="time">
52
+ <span>更新时间:</span>
53
+ {{ new Date(item.updateTime).Format('MM-dd hh:mm') }}
54
+ </div> -->
55
+ </div>
56
+ <!-- <span v-if="isPC" class="alc-title-updateTime">最后更新时间: {{ item.updateTime }}</span>-->
57
+ </div>
58
+ <div class="alc-content" v-if="false">
59
+ <div v-if="msg.content.type == 1" class="alc-content-text">{{ item.introduction }} <span
60
+ @click="lookAttach(item.url, item, $event)" class="aci-view">查看原文 ></span>
61
+ </div>
62
+ <span v-if="!isPC" class="alc-title-updateTime">最后更新时间: {{ item.updateTime }}</span>
63
+ <div v-if="false" class="alc-content-info">
64
+ <div class="alcc-box">
65
+ <span class="aci-owner">所有者: {{ item.owner }}</span>
66
+ <span class="aci-enterprise">所属企业: {{ item.enterprise }}</span>
67
+ <span class="aci-source">文件来源: {{ item.source }}</span>
68
+ </div>
69
+ </div>
70
+ </div>
71
+ </div>
72
+ <div class="ad-loadmore" v-if="loadMoreFlag" @click="lazyLoadKnowledegList">
73
+ 查看更多
74
+ </div>
75
+ </div>
76
+ <previewPdf ref="previewPdf"
77
+ :url="previewHref"
78
+ :sourceFileType="sourceFileType"
79
+ officePreviewType="pdf"
80
+ @previewToDialog="previewToDialog"
81
+ :isHasChat="isHasChat"
82
+ ></previewPdf>
83
+ </div>
84
+ </template>
85
+
86
+ <script>
87
+ /* eslint-disable */
88
+ import previewPdf from "./previewPdf";
89
+ import { isMobile } from "../assets/js/common";
90
+ export default {
91
+ name: "answerDocknowledge",
92
+ components: { previewPdf },
93
+ data() {
94
+ return {
95
+ isPC: true,
96
+ previewHref: "",
97
+ sourceFileType:'',
98
+ docSource: {
99
+ LOCAL_FILE: "来源于本地文件",
100
+ CREATED_BY_ONESELF: "来源于自建知识",
101
+ WECHAT: "来源于微信",
102
+ AUTO_SYN_FROM_LOCAL_FILE: "自动同步于本地",
103
+ YUQUE: "来源于语雀",
104
+ CORP_LOCAL_FILE:'来源于企业知识库',
105
+ FEISHU:'来源于飞书-云文档'
106
+ },
107
+ imageObj: {
108
+ PDF: 'pdf1',
109
+ pdf: 'pdf1',
110
+ TXT: 'txt1',
111
+ txt: 'txt1',
112
+ selfadd: 'selfadd1',
113
+ md: "md2",
114
+ html: 'selfadd1',
115
+ mode: "mode",
116
+ general: 'general',
117
+ word: "word1",
118
+ Word: "word1",
119
+ docx: "word1",
120
+ doc: "word1",
121
+ WORD: "word1",
122
+ Excel: 'excel1',
123
+ EXCEL: 'excel1',
124
+ excel: 'excel1',
125
+ PPT: 'ppt1',
126
+ ppt: 'ppt1',
127
+ pptx: 'ppt1',
128
+ img: "image1",
129
+ image: "image1",
130
+ video: "video",
131
+ audio: 'audio',
132
+ link: "link",
133
+ wechat: "wechat",
134
+ mp4: "video",
135
+ MP4: "video",
136
+ xlsx: "excel1",
137
+ SLSX: "excel1",
138
+ xls: "excel1",
139
+ XLS: "excel1",
140
+ jpg: "image1",
141
+ JPG: "image1",
142
+ jpeg: "image1",
143
+ JPEG: "image1",
144
+ png: "image1",
145
+ PNG: "image1",
146
+ webp: "image1",
147
+ WEBP: "image1",
148
+ gif: "image1",
149
+ GIF: "image1",
150
+ svg: "image1",
151
+ SVG: "image1",
152
+ bmp: "image1",
153
+ BMP: "image1",
154
+ avi: "video",
155
+ AVI: "video",
156
+ mov: "video",
157
+ MOV: "video",
158
+ rmvb: "video",
159
+ RMVB: "video",
160
+ wav: "audio",
161
+ WAV: "audio",
162
+ mp3: "audio",
163
+ MP3: "audio",
164
+ yqhtml: "yqhtml",
165
+ feishuhtml:"feishuhtml"
166
+ },
167
+ allKnowledgeList:[],
168
+ loadMoreFlag:false,
169
+ previewKnowledgeId:"",
170
+ }
171
+ },
172
+ props: ['msg','isAskLightning', 'isMessageRecord',"isApp","isHasChat","activeKnowledgeId"],
173
+ beforeMounted() {
174
+ },
175
+ watch:{
176
+ msg:{
177
+ handler(n){
178
+ console.log(n,'answerDocknowledge');
179
+ n.content.list.forEach(element => {
180
+ console.log(this.imageObj[element.format],1111);
181
+ element.src = 'https://static.guoranbot.com/cdn-office-website/askbot_doc/' + this.imageObj[element.format] + '.png';
182
+ if ((element.format === "txt" || element.format === "html") && element.source === "WECHAT") {
183
+ element.src = 'https://static.guoranbot.com/cdn-office-website/askbot_doc/wechat.png';
184
+ }
185
+ });
186
+ },
187
+ deep:true,
188
+ immediate:true
189
+ }
190
+ },
191
+ created() {
192
+ var system = {};
193
+ system.pingtai = /(Win32|Win16|WinCE|Mac68K|MacIntel|MacIntel|MacPPC|Linux mips64)/i.test(navigator.platform);
194
+ if (system.pingtai) {
195
+ //电脑
196
+ this.isPC = true;
197
+ } else {
198
+ //手机
199
+ this.isPC = false;
200
+ }
201
+ // this.msg.content.list.forEach(element => {
202
+ // console.log(this.imageObj[element.format],1111);
203
+ // element.src = 'https://static.guoranbot.com/cdn-office-website/askbot_doc/' + this.imageObj[element.format] + '.png';
204
+ // if ((element.format === "txt" || element.format === "html") && element.source === "WECHAT") {
205
+ // element.src = 'https://static.guoranbot.com/cdn-office-website/askbot_doc/wechat.png';
206
+ // }
207
+ // });
208
+ },
209
+ mounted() {
210
+ console.log(this.msg.content,'this.msg.content');
211
+ // if(this.msg.content.type == 1) {
212
+
213
+ // }
214
+ if(this.msg.content.list && this.msg.content.list.length > 0) {
215
+ this.loadMoreFlag = true
216
+ this.allKnowledgeList = JSON.parse(JSON.stringify(this.msg.content.list))
217
+ // console.log(this.allKnowledgeList.length, 'this.allKnowledgeList');
218
+ this.msg.content.list = []
219
+ this.lazyLoadKnowledegList()
220
+ }
221
+ },
222
+ methods: {
223
+ //预览图片
224
+ lookAttach(url, item, event) {
225
+ event.preventDefault();
226
+ if (this.isAskLightning == 1 && !this.isApp){
227
+ window.parent.postMessage({
228
+ data: "bot_preview",
229
+ item: JSON.stringify(item),
230
+ url: url
231
+ },"*");
232
+ } else {
233
+ // if (isMobile()) {
234
+ // this.$refs.previewPdf.drawer = true;
235
+ // this.$refs.previewPdf.previewShowPopup = false;
236
+ // } else {
237
+ // this.$refs.previewPdf.drawer = false;
238
+ // }
239
+ this.previewKnowledgeId = item.knowledgeId
240
+ this.$refs.previewPdf.previewShowPopup = false;
241
+ this.$refs.previewPdf.drawer = false;
242
+ let index = url.lastIndexOf('?')
243
+ let type = ''
244
+ let httpUrl = '/knowledge-api/knowledge/getTemporaryCertificate'
245
+ if (index !== -1) {
246
+ url = url.substring(0, index)
247
+ type = this.fileType(url)
248
+ } else {
249
+ type = this.fileType(url)
250
+ }
251
+ if (type === '' || type === 'OTHER') {
252
+ httpUrl = httpUrl += '?needEncrypt=true'
253
+ } else {
254
+ httpUrl = httpUrl += '?needEncrypt=false'
255
+ }
256
+ this.$http.post(httpUrl, {
257
+ "fileInOssPath":url
258
+ }).then(res =>{
259
+ if(res.data.code == '0') {
260
+ this.previewHref = res.data.data;
261
+ this.sourceFileType = url.substring(url.lastIndexOf('.'))
262
+ let isOhmPc = sessionStorage.getItem('isOhmPc')
263
+ if (isMobile() || isOhmPc == 'true'){
264
+ this.$refs.previewPdf.drawer = true;
265
+ this.$refs.previewPdf.previewShowPopup = true;
266
+ } else {
267
+ this.$refs.previewPdf.previewShowPopup = false;
268
+ this.$refs.previewPdf.drawer = true;
269
+ }
270
+ //聊一聊按钮的选中状态
271
+ if (this.activeKnowledgeId == item.knowledgeId){
272
+ this.$refs.previewPdf.previewKnowledgeId = this.activeKnowledgeId
273
+ } else {
274
+ this.$refs.previewPdf.previewKnowledgeId = ""
275
+ }
276
+ this.$refs.previewPdf.fileType = type
277
+ this.$refs.previewPdf.tagIds = item.tagIds
278
+ this.$refs.previewPdf.isMessageRecord = this.isMessageRecord ? true : false
279
+ if(item.tagIds && item.tagIds.length != 0) {
280
+ this.$refs.previewPdf.loading = false
281
+ return
282
+ }
283
+ this.$nextTick(() =>{
284
+ if(item.source == 'CREATED_BY_ONESELF' || type === 'HTML') {
285
+ this.$refs.previewPdf.getBolb(item)
286
+ }
287
+ this.$refs.previewPdf.loadIframe(item)
288
+ })
289
+ }
290
+ })
291
+ }
292
+ },
293
+ fileType (url) {
294
+ const fileType = url.substring(url.lastIndexOf('.'));
295
+ if (fileType === '.mp4' || fileType === '.MP4' || fileType === '.MOV' || fileType === '.MOVC' || fileType === '.mov' || fileType === '.movc' || fileType === '.mav' || fileType === '.MAV' || fileType == '.mp3' || fileType == '.MP3' || fileType === '.wav') {
296
+ return 'VIDEO'
297
+ } else if (fileType === '.html') {
298
+ return 'HTML'
299
+ } else {
300
+ return 'OTHER'
301
+ }
302
+ },
303
+ srcContentTypeIMG(item) {
304
+ let url = item.url || '';
305
+ const type = url.substring(url.lastIndexOf('.'));
306
+ if(type === '.jpg' || type === '.jpeg' || type === '.png' || type === '.gif') {
307
+ this.getSrc(item)
308
+ return true
309
+ } else {
310
+ return false
311
+ }
312
+ },
313
+ getSrc (item) {
314
+ // let imgurl = ''
315
+ this.$http.post(
316
+ '/knowledge-api/temporary-certificate/or-origin?expired=30',
317
+ item.url,
318
+ {
319
+ headers: {
320
+ "Content-Type": "application/json",
321
+ },
322
+ }).then( res => {
323
+ console.log(res,'=====');
324
+ // imgurl = await res.bodyText
325
+ this.$set(item,'expiredUrl',res.data ? res.data : res.bodyText)
326
+ // return res.data
327
+ })
328
+ // return imgurl
329
+ },
330
+ lazyLoadKnowledegList() {
331
+ if(this.allKnowledgeList.length !== 0) {
332
+ let arr = this.allKnowledgeList.splice(0, 5)
333
+ if(arr.length < 5) {
334
+ this.loadMoreFlag = false
335
+ this.msg.content.list = [...this.msg.content.list, ...arr]
336
+ return
337
+ }
338
+ if(this.allKnowledgeList.length == 0) {
339
+ this.loadMoreFlag = false
340
+ }
341
+ this.msg.content.list = [...this.msg.content.list, ...arr]
342
+ return
343
+ }
344
+ },
345
+ previewToDialog(flag){
346
+ if (!flag){
347
+ this.$refs.previewPdf.previewKnowledgeId = ""
348
+ } else {
349
+ this.$refs.previewPdf.previewKnowledgeId = this.previewKnowledgeId
350
+ }
351
+ this.$emit('previewToDialog',flag,this.previewKnowledgeId)
352
+ },
353
+ clearKnowledgeId(){
354
+ this.previewKnowledgeId = "";
355
+ }
356
+ }
357
+ }
358
+ </script>
359
+
360
+ <style scoped lang="less">
361
+ .answer-docknowledge {
362
+ min-width: 100px;
363
+ .answer-docknowledge-header{
364
+
365
+
366
+ .tips{
367
+ width: 154px;
368
+ height: 22px;
369
+ background: #366AFF;
370
+ border-radius: 5px;
371
+ text-align: center;
372
+ line-height: 22px;
373
+ color: #fff;
374
+ font-size: 12px;
375
+ margin-bottom: 7px;
376
+ }
377
+ .answer-text {
378
+ // font-size: 13px;
379
+ text-align: left;
380
+ line-height: 25px;
381
+ padding: 0px 0px 12px 0px;
382
+
383
+ .aci-view {
384
+ // font-size: 13px;
385
+ display: inline-block;
386
+ // margin-left: 5px;
387
+ color: #366aff;
388
+ cursor: pointer;
389
+ }
390
+ }
391
+ &.bgc{
392
+ padding: 10px;
393
+ background: #EEF1FF;
394
+ border-radius: 10px;
395
+ margin-bottom: 16px;
396
+ .answer-text {
397
+ padding: 0;
398
+ }
399
+ }
400
+ }
401
+
402
+ .ad-list {
403
+ .ad-list-cell {
404
+ border-top: solid 1px #EEEEEE;
405
+ padding: 10px 0 10px;
406
+
407
+ .alc-title {
408
+ display: flex;
409
+ flex-wrap: wrap;
410
+ align-items: center;
411
+ justify-content: space-between;
412
+ line-height: 16px;
413
+
414
+ .alc-box {
415
+ display: flex;
416
+ align-items: center;
417
+ justify-content: space-between;
418
+ // font-size: 12px;
419
+ width: 100%;
420
+ .alc-source-left{
421
+ display: flex;
422
+ align-items: center;
423
+ .source-form{
424
+ width: 34px;
425
+ flex: none;
426
+ color: #A9B3C6;
427
+ }
428
+ }
429
+ .alc-content-text{
430
+ width: 55px;
431
+ flex: none;
432
+ .aci-view{
433
+ color: #366aff;
434
+ cursor: pointer;
435
+ }
436
+ }
437
+ .alc-title-from {
438
+ line-height: 22px;
439
+ word-break: break-all !important;
440
+ text-align: left;
441
+ flex: auto;
442
+ display: flex;
443
+ justify-content: flex-start;
444
+ }
445
+ }
446
+ .alc-box-introduction{
447
+ overflow: hidden;
448
+ text-overflow: ellipsis;
449
+ display: -webkit-box;
450
+ -webkit-line-clamp:3;
451
+ -webkit-box-orient:vertical;
452
+ margin-top: 10px;
453
+ color: #616161;
454
+ // font-size: 12px;
455
+ line-height: 24px;
456
+ text-align: left;
457
+ img {
458
+ width: 50px;
459
+ height: 50px;
460
+ margin: 10px;
461
+ cursor: pointer;
462
+ }
463
+ }
464
+ .alc-box-introduction-previewImage {
465
+ overflow: hidden;
466
+ text-overflow: ellipsis;
467
+ display: -webkit-box;
468
+ -webkit-line-clamp:3;
469
+ -webkit-box-orient:vertical;
470
+ margin-top: 10px;
471
+ color: #616161;
472
+ // font-size: 12px;
473
+ line-height: 24px;
474
+ text-align: left;
475
+ img {
476
+ max-width: 300px;
477
+ width: 100%;
478
+ max-height: 150px;
479
+ margin: 10px;
480
+ cursor: pointer;
481
+ }
482
+ }
483
+ .alc-updateTime{
484
+ display: flex;
485
+ align-items: center;
486
+ justify-content: space-between;
487
+ font-size: 13px;
488
+ width: 100%;
489
+ margin-top: 10px;
490
+ .upload-source{
491
+ flex: none;
492
+ height: 18px;
493
+ line-height: 18px;
494
+ background: #E9F9F8;
495
+ border: 1px solid #AFF2CD;
496
+ border-radius: 2px;
497
+ display: flex;
498
+ align-items: center;
499
+ justify-content: center;
500
+ padding: 0 8px;
501
+ color: #00C2BB;
502
+ }
503
+ .time{
504
+ color: #999999;
505
+ margin-left: 10px;
506
+ }
507
+ .alc-content-text {
508
+ color: #366aff;
509
+ cursor: pointer;
510
+ }
511
+ }
512
+ .alc-title-icon {
513
+ margin: 0 2px;
514
+ width: 18px;
515
+ height: 18px;
516
+ flex: none;
517
+ }
518
+
519
+ .alc-title-updateTime {
520
+ text-align: right;
521
+ color: #999999;
522
+ // font-size: 13px;
523
+ }
524
+ }
525
+
526
+ .alc-content {
527
+ .alc-title-updateTime {
528
+ margin-top: 6px;
529
+ display: block;
530
+ text-align: right;
531
+ color: #999999;
532
+ // font-size: 13px;
533
+ }
534
+
535
+ .alc-content-text {
536
+ margin-bottom: 6px;
537
+ width: 55px;
538
+ flex: none;
539
+ .aci-view {
540
+ display: inline-block;
541
+ margin-left: 30px;
542
+ color: #366aff;
543
+ cursor: pointer;
544
+ }
545
+ }
546
+
547
+ .alc-content-info {
548
+ display: flex;
549
+ flex-wrap: wrap;
550
+ justify-content: space-between;
551
+
552
+ .alcc-box {
553
+ display: flex;
554
+ flex-wrap: wrap;
555
+ color: #999999;
556
+
557
+ .aci-owner {
558
+ margin-right: 20px;
559
+ }
560
+
561
+ .aci-enterprise {
562
+ margin-right: 20px;
563
+ }
564
+ }
565
+ }
566
+ }
567
+ }
568
+ .ad-loadmore {
569
+ width: 100%;
570
+ height: 40px;
571
+ display: flex;
572
+ align-items: center;
573
+ justify-content: center;
574
+ // background: #FFFFFF;
575
+ color: #366AFF;
576
+ font-size: 14px;
577
+ margin-top: 8px;
578
+ cursor: pointer;
579
+ }
580
+ }
581
+ }
557
582
  </style>