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