askbot-dragon 1.4.63 → 1.4.65

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