askbot-dragon 1.4.94 → 1.4.96

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