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