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