askbot-dragon 1.5.44-beta → 1.5.47-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 +100 -100
  14. package/src/assets/js/script.js +36 -36
  15. package/src/assets/less/common.css +6773 -6773
  16. package/src/assets/less/converSationContainer/common.less +199 -192
  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 +467 -467
  22. package/src/components/AnswerDocknowledge.vue +504 -499
  23. package/src/components/AnswerVoice.vue +285 -285
  24. package/src/components/AskIFrame.vue +15 -15
  25. package/src/components/ConversationContainer.vue +5120 -5120
  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 +131 -131
  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 +138 -138
  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 +3557 -3557
  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/newPdfPosition.vue +877 -877
  58. package/src/components/pdfPosition.vue +1362 -1360
  59. package/src/components/popup.vue +227 -227
  60. package/src/components/previewDoc.vue +242 -242
  61. package/src/components/previewPdf.vue +310 -313
  62. package/src/components/receiverMessagePlatform.vue +65 -65
  63. package/src/components/recommend.vue +89 -89
  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 +180 -180
  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 +34 -34
  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 +55 -55
@@ -1,500 +1,505 @@
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
- let fileName = url.substring(url.lastIndexOf('.'))
249
- if (fileName === '.doc' || fileName === '.docx' || fileName === '.txt'){
250
- this.$refs.previewPdf.fileName = fileName;
251
- } else {
252
- this.$refs.previewPdf.fileName = '';
253
- }
254
- if(item.tagIds && item.tagIds.length != 0) {
255
- this.$refs.previewPdf.loading = false
256
- return
257
- }
258
- this.$nextTick(() =>{
259
- if(item.source == 'CREATED_BY_ONESELF' || type === 'HTML') {
260
- this.$refs.previewPdf.getBolb(item)
261
- }
262
- this.$refs.previewPdf.loadIframe(item)
263
- })
264
- }
265
- })
266
- }
267
- },
268
- fileType (url) {
269
- const fileType = url.substring(url.lastIndexOf('.'));
270
- if (fileType === '.mp4' || fileType === '.MP4' || fileType === '.MOV' || fileType === '.MOVC' || fileType === '.mov' || fileType === '.movc' || fileType === '.mav' || fileType === '.MAV' || fileType == '.mp3' || fileType == '.MP3' || fileType === '.wav') {
271
- return 'VIDEO'
272
- } else if (fileType === '.html') {
273
- return 'HTML'
274
- } else {
275
- return 'OTHER'
276
- }
277
- },
278
- srcContentTypeIMG(item) {
279
- let url = item.url || '';
280
- const type = url.substring(url.lastIndexOf('.'));
281
- if(type === '.jpg' || type === '.jpeg' || type === '.png' || type === '.gif') {
282
- this.getSrc(item)
283
- return true
284
- } else {
285
- return false
286
- }
287
- },
288
- getSrc (item) {
289
- // let imgurl = ''
290
- this.$http.post(
291
- '/knowledge-api/temporary-certificate/or-origin?expired=30',
292
- item.url,
293
- {
294
- headers: {
295
- "Content-Type": "application/json",
296
- },
297
- }).then( res => {
298
- console.log(res,'=====');
299
- // imgurl = await res.bodyText
300
- this.$set(item,'expiredUrl',res.data ? res.data : res.bodyText)
301
- // return res.data
302
- })
303
- // return imgurl
304
- }
305
- }
306
- }
307
- </script>
308
-
309
- <style scoped lang="less">
310
- .answer-docknowledge {
311
- min-width: 100px;
312
- .answer-docknowledge-header{
313
-
314
-
315
- .tips{
316
- width: 154px;
317
- height: 22px;
318
- background: #366AFF;
319
- border-radius: 5px;
320
- text-align: center;
321
- line-height: 22px;
322
- color: #fff;
323
- font-size: 12px;
324
- margin-bottom: 7px;
325
- }
326
- .answer-text {
327
- // font-size: 13px;
328
- text-align: left;
329
- line-height: 25px;
330
- padding: 0px 0px 12px 0px;
331
-
332
- .aci-view {
333
- // font-size: 13px;
334
- display: inline-block;
335
- // margin-left: 5px;
336
- color: #366aff;
337
- cursor: pointer;
338
- }
339
- }
340
- &.bgc{
341
- padding: 10px;
342
- background: #EEF1FF;
343
- border-radius: 10px;
344
- margin-bottom: 16px;
345
- .answer-text {
346
- padding: 0;
347
- }
348
- }
349
- }
350
-
351
- .ad-list {
352
- .ad-list-cell {
353
- border-top: solid 1px #EEEEEE;
354
- padding: 10px 0 10px;
355
-
356
- .alc-title {
357
- display: flex;
358
- flex-wrap: wrap;
359
- align-items: center;
360
- justify-content: space-between;
361
- line-height: 16px;
362
-
363
- .alc-box {
364
- display: flex;
365
- align-items: center;
366
- justify-content: space-between;
367
- // font-size: 12px;
368
- width: 100%;
369
- .alc-source-left{
370
- display: flex;
371
- align-items: center;
372
- .source-form{
373
- width: 34px;
374
- flex: none;
375
- color: #A9B3C6;
376
- }
377
- }
378
- .alc-content-text{
379
- width: 55px;
380
- flex: none;
381
- .aci-view{
382
- color: #366aff;
383
- cursor: pointer;
384
- }
385
- }
386
- .alc-title-from {
387
- line-height: 22px;
388
- word-break: break-all !important;
389
- text-align: left;
390
- flex: auto;
391
- display: flex;
392
- justify-content: flex-start;
393
- }
394
- }
395
- .alc-box-introduction{
396
- overflow: hidden;
397
- text-overflow: ellipsis;
398
- display: -webkit-box;
399
- -webkit-line-clamp:3;
400
- -webkit-box-orient:vertical;
401
- margin-top: 10px;
402
- color: #616161;
403
- // font-size: 12px;
404
- line-height: 24px;
405
- text-align: left;
406
- img {
407
- width: 50px;
408
- height: 50px;
409
- margin: 10px;
410
- cursor: pointer;
411
- }
412
- }
413
- .alc-updateTime{
414
- display: flex;
415
- align-items: center;
416
- justify-content: space-between;
417
- font-size: 13px;
418
- width: 100%;
419
- margin-top: 10px;
420
- .upload-source{
421
- flex: none;
422
- height: 18px;
423
- line-height: 18px;
424
- background: #E9F9F8;
425
- border: 1px solid #AFF2CD;
426
- border-radius: 2px;
427
- display: flex;
428
- align-items: center;
429
- justify-content: center;
430
- padding: 0 8px;
431
- color: #00C2BB;
432
- }
433
- .time{
434
- color: #999999;
435
- margin-left: 10px;
436
- }
437
- .alc-content-text {
438
- color: #366aff;
439
- cursor: pointer;
440
- }
441
- }
442
- .alc-title-icon {
443
- margin: 0 2px;
444
- width: 18px;
445
- height: 18px;
446
- flex: none;
447
- }
448
-
449
- .alc-title-updateTime {
450
- text-align: right;
451
- color: #999999;
452
- // font-size: 13px;
453
- }
454
- }
455
-
456
- .alc-content {
457
- .alc-title-updateTime {
458
- margin-top: 6px;
459
- display: block;
460
- text-align: right;
461
- color: #999999;
462
- // font-size: 13px;
463
- }
464
-
465
- .alc-content-text {
466
- margin-bottom: 6px;
467
- width: 55px;
468
- flex: none;
469
- .aci-view {
470
- display: inline-block;
471
- margin-left: 30px;
472
- color: #366aff;
473
- cursor: pointer;
474
- }
475
- }
476
-
477
- .alc-content-info {
478
- display: flex;
479
- flex-wrap: wrap;
480
- justify-content: space-between;
481
-
482
- .alcc-box {
483
- display: flex;
484
- flex-wrap: wrap;
485
- color: #999999;
486
-
487
- .aci-owner {
488
- margin-right: 20px;
489
- }
490
-
491
- .aci-enterprise {
492
- margin-right: 20px;
493
- }
494
- }
495
- }
496
- }
497
- }
498
- }
499
- }
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
+ let index = url.indexOf("?");
249
+ let newFileInOssPath = url;
250
+ if (index !== -1){
251
+ newFileInOssPath = url.substring(0, url.indexOf("?"))
252
+ }
253
+ let fileName = newFileInOssPath.substring(newFileInOssPath.lastIndexOf('.'))
254
+ if (fileName === '.doc' || fileName === '.docx' || fileName === '.txt'){
255
+ this.$refs.previewPdf.fileName = fileName;
256
+ } else {
257
+ this.$refs.previewPdf.fileName = '';
258
+ }
259
+ if(item.tagIds && item.tagIds.length != 0) {
260
+ this.$refs.previewPdf.loading = false
261
+ return
262
+ }
263
+ this.$nextTick(() =>{
264
+ if(item.source == 'CREATED_BY_ONESELF' || type === 'HTML') {
265
+ this.$refs.previewPdf.getBolb(item)
266
+ }
267
+ this.$refs.previewPdf.loadIframe(item)
268
+ })
269
+ }
270
+ })
271
+ }
272
+ },
273
+ fileType (url) {
274
+ const fileType = url.substring(url.lastIndexOf('.'));
275
+ if (fileType === '.mp4' || fileType === '.MP4' || fileType === '.MOV' || fileType === '.MOVC' || fileType === '.mov' || fileType === '.movc' || fileType === '.mav' || fileType === '.MAV' || fileType == '.mp3' || fileType == '.MP3' || fileType === '.wav') {
276
+ return 'VIDEO'
277
+ } else if (fileType === '.html') {
278
+ return 'HTML'
279
+ } else {
280
+ return 'OTHER'
281
+ }
282
+ },
283
+ srcContentTypeIMG(item) {
284
+ let url = item.url || '';
285
+ const type = url.substring(url.lastIndexOf('.'));
286
+ if(type === '.jpg' || type === '.jpeg' || type === '.png' || type === '.gif') {
287
+ this.getSrc(item)
288
+ return true
289
+ } else {
290
+ return false
291
+ }
292
+ },
293
+ getSrc (item) {
294
+ // let imgurl = ''
295
+ this.$http.post(
296
+ '/knowledge-api/temporary-certificate/or-origin?expired=30',
297
+ item.url,
298
+ {
299
+ headers: {
300
+ "Content-Type": "application/json",
301
+ },
302
+ }).then( res => {
303
+ console.log(res,'=====');
304
+ // imgurl = await res.bodyText
305
+ this.$set(item,'expiredUrl',res.data ? res.data : res.bodyText)
306
+ // return res.data
307
+ })
308
+ // return imgurl
309
+ }
310
+ }
311
+ }
312
+ </script>
313
+
314
+ <style scoped lang="less">
315
+ .answer-docknowledge {
316
+ min-width: 100px;
317
+ .answer-docknowledge-header{
318
+
319
+
320
+ .tips{
321
+ width: 154px;
322
+ height: 22px;
323
+ background: #366AFF;
324
+ border-radius: 5px;
325
+ text-align: center;
326
+ line-height: 22px;
327
+ color: #fff;
328
+ font-size: 12px;
329
+ margin-bottom: 7px;
330
+ }
331
+ .answer-text {
332
+ // font-size: 13px;
333
+ text-align: left;
334
+ line-height: 25px;
335
+ padding: 0px 0px 12px 0px;
336
+
337
+ .aci-view {
338
+ // font-size: 13px;
339
+ display: inline-block;
340
+ // margin-left: 5px;
341
+ color: #366aff;
342
+ cursor: pointer;
343
+ }
344
+ }
345
+ &.bgc{
346
+ padding: 10px;
347
+ background: #EEF1FF;
348
+ border-radius: 10px;
349
+ margin-bottom: 16px;
350
+ .answer-text {
351
+ padding: 0;
352
+ }
353
+ }
354
+ }
355
+
356
+ .ad-list {
357
+ .ad-list-cell {
358
+ border-top: solid 1px #EEEEEE;
359
+ padding: 10px 0 10px;
360
+
361
+ .alc-title {
362
+ display: flex;
363
+ flex-wrap: wrap;
364
+ align-items: center;
365
+ justify-content: space-between;
366
+ line-height: 16px;
367
+
368
+ .alc-box {
369
+ display: flex;
370
+ align-items: center;
371
+ justify-content: space-between;
372
+ // font-size: 12px;
373
+ width: 100%;
374
+ .alc-source-left{
375
+ display: flex;
376
+ align-items: center;
377
+ .source-form{
378
+ width: 34px;
379
+ flex: none;
380
+ color: #A9B3C6;
381
+ }
382
+ }
383
+ .alc-content-text{
384
+ width: 55px;
385
+ flex: none;
386
+ .aci-view{
387
+ color: #366aff;
388
+ cursor: pointer;
389
+ }
390
+ }
391
+ .alc-title-from {
392
+ line-height: 22px;
393
+ word-break: break-all !important;
394
+ text-align: left;
395
+ flex: auto;
396
+ display: flex;
397
+ justify-content: flex-start;
398
+ }
399
+ }
400
+ .alc-box-introduction{
401
+ overflow: hidden;
402
+ text-overflow: ellipsis;
403
+ display: -webkit-box;
404
+ -webkit-line-clamp:3;
405
+ -webkit-box-orient:vertical;
406
+ margin-top: 10px;
407
+ color: #616161;
408
+ // font-size: 12px;
409
+ line-height: 24px;
410
+ text-align: left;
411
+ img {
412
+ width: 50px;
413
+ height: 50px;
414
+ margin: 10px;
415
+ cursor: pointer;
416
+ }
417
+ }
418
+ .alc-updateTime{
419
+ display: flex;
420
+ align-items: center;
421
+ justify-content: space-between;
422
+ font-size: 13px;
423
+ width: 100%;
424
+ margin-top: 10px;
425
+ .upload-source{
426
+ flex: none;
427
+ height: 18px;
428
+ line-height: 18px;
429
+ background: #E9F9F8;
430
+ border: 1px solid #AFF2CD;
431
+ border-radius: 2px;
432
+ display: flex;
433
+ align-items: center;
434
+ justify-content: center;
435
+ padding: 0 8px;
436
+ color: #00C2BB;
437
+ }
438
+ .time{
439
+ color: #999999;
440
+ margin-left: 10px;
441
+ }
442
+ .alc-content-text {
443
+ color: #366aff;
444
+ cursor: pointer;
445
+ }
446
+ }
447
+ .alc-title-icon {
448
+ margin: 0 2px;
449
+ width: 18px;
450
+ height: 18px;
451
+ flex: none;
452
+ }
453
+
454
+ .alc-title-updateTime {
455
+ text-align: right;
456
+ color: #999999;
457
+ // font-size: 13px;
458
+ }
459
+ }
460
+
461
+ .alc-content {
462
+ .alc-title-updateTime {
463
+ margin-top: 6px;
464
+ display: block;
465
+ text-align: right;
466
+ color: #999999;
467
+ // font-size: 13px;
468
+ }
469
+
470
+ .alc-content-text {
471
+ margin-bottom: 6px;
472
+ width: 55px;
473
+ flex: none;
474
+ .aci-view {
475
+ display: inline-block;
476
+ margin-left: 30px;
477
+ color: #366aff;
478
+ cursor: pointer;
479
+ }
480
+ }
481
+
482
+ .alc-content-info {
483
+ display: flex;
484
+ flex-wrap: wrap;
485
+ justify-content: space-between;
486
+
487
+ .alcc-box {
488
+ display: flex;
489
+ flex-wrap: wrap;
490
+ color: #999999;
491
+
492
+ .aci-owner {
493
+ margin-right: 20px;
494
+ }
495
+
496
+ .aci-enterprise {
497
+ margin-right: 20px;
498
+ }
499
+ }
500
+ }
501
+ }
502
+ }
503
+ }
504
+ }
500
505
  </style>