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