askbot-dragon 1.5.49 → 1.5.50
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.
- package/README.md +27 -27
- package/babel.config.js +6 -6
- package/dragon.iml +7 -7
- package/package.json +56 -55
- package/public/index.html +73 -72
- package/src/App.vue +31 -31
- package/src/api/index.js +1 -1
- package/src/api/mock.http +2 -2
- package/src/api/requestUrl.js +185 -185
- package/src/assets/js/AliyunlssUtil.js +92 -92
- package/src/assets/js/Base64Util.js +22 -22
- package/src/assets/js/common.js +75 -75
- package/src/assets/js/hammer.js +89 -89
- package/src/assets/js/obsBrowser.js +63 -0
- package/src/assets/js/script.js +36 -36
- package/src/assets/less/common.css +6773 -6773
- package/src/assets/less/converSationContainer/common.less +192 -192
- package/src/assets/less/converSationContainer/converSatonContainer.less +493 -493
- package/src/assets/less/iconfont.css +37 -37
- package/src/assets/less/ticketMessage.less +294 -294
- package/src/components/ActionAlertIframe.vue +154 -154
- package/src/components/AiGuide.vue +468 -468
- package/src/components/AnswerDocknowledge.vue +581 -556
- package/src/components/AnswerVoice.vue +285 -285
- package/src/components/AskIFrame.vue +15 -15
- package/src/components/ConversationContainer.vue +4969 -5038
- package/src/components/FileType.vue +86 -86
- package/src/components/Message.vue +27 -27
- package/src/components/MyEditor.vue +348 -346
- package/src/components/actionSatisfaction.vue +107 -107
- package/src/components/actionSendToBot.vue +62 -62
- package/src/components/answerDissatisfaction.vue +62 -62
- package/src/components/answerRadio.vue +132 -186
- package/src/components/ask-components/DissatisfactionOptions.vue +57 -57
- package/src/components/ask-components/Msgloading.vue +37 -37
- package/src/components/ask-components/SatisfactionV2.vue +15 -15
- package/src/components/askVideo.vue +142 -139
- package/src/components/assetDetails.vue +370 -370
- package/src/components/assetMessage.vue +228 -228
- package/src/components/associationIntention.vue +349 -349
- package/src/components/attachmentPreview.vue +90 -90
- package/src/components/botActionSatisfactor.vue +68 -68
- package/src/components/chatContent.vue +513 -513
- package/src/components/feedBack.vue +136 -136
- package/src/components/fielListView.vue +351 -351
- package/src/components/file/AliyunOssComponents.vue +108 -108
- package/src/components/formTemplate.vue +3577 -3572
- package/src/components/kkview.vue +1138 -1138
- package/src/components/loadingProcess.vue +164 -164
- package/src/components/message/ActionAlertIframe.vue +112 -112
- package/src/components/message/ShopMessage.vue +164 -164
- package/src/components/message/TextMessage.vue +924 -924
- package/src/components/message/TicketMessage.vue +201 -201
- package/src/components/message/swiper/index.js +4 -4
- package/src/components/message/swiper/ticketSwiper.vue +503 -503
- package/src/components/message/swiper/ticketSwiperItem.vue +61 -61
- package/src/components/msgLoading.vue +231 -231
- package/src/components/myPopup.vue +70 -70
- package/src/components/pdfPosition.vue +1328 -1322
- package/src/components/popup.vue +227 -227
- package/src/components/previewDoc.vue +242 -242
- package/src/components/previewPdf.vue +353 -306
- package/src/components/receiverMessagePlatform.vue +65 -65
- package/src/components/recommend.vue +80 -80
- package/src/components/selector/hOption.vue +20 -20
- package/src/components/selector/hSelector.vue +199 -199
- package/src/components/selector/hWrapper.vue +216 -216
- package/src/components/senderMessagePlatform.vue +50 -50
- package/src/components/source/BotMessage.vue +24 -24
- package/src/components/source/CustomMessage.vue +24 -24
- package/src/components/test.vue +260 -260
- package/src/components/tree.vue +294 -294
- package/src/components/utils/AliyunIssUtil.js +81 -81
- package/src/components/utils/ckeditor.js +177 -174
- package/src/components/utils/format_date.js +25 -25
- package/src/components/utils/index.js +6 -6
- package/src/components/utils/math_utils.js +29 -29
- package/src/components/voiceComponent.vue +119 -119
- package/src/components/welcomeKnowledgeFile.vue +307 -270
- package/src/components/welcomeLlmCard.vue +134 -134
- package/src/main.js +57 -57
- package/vue.config.js +54 -54
|
@@ -1,347 +1,349 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="my_editor">
|
|
3
|
-
<div class="editor_head" v-if="havToolbar">
|
|
4
|
-
<button class="button" @click="handleUpdate">
|
|
5
|
-
<svg
|
|
6
|
-
t="1703581982515"
|
|
7
|
-
class="icon"
|
|
8
|
-
viewBox="0 0 1024 1024"
|
|
9
|
-
version="1.1"
|
|
10
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
11
|
-
p-id="74840"
|
|
12
|
-
width="200"
|
|
13
|
-
height="200"
|
|
14
|
-
>
|
|
15
|
-
<path
|
|
16
|
-
d="M566.839921 866.857572V983.050833c0 22.522042-7.677969 33.271198-29.688146 37.877979-18.427125 4.094917-37.366115 3.583052-55.281375-2.047458-17.403396-5.63051-24.057636-15.867802-24.057636-33.271198v-410.003534c0-7.166104-1.535594-9.213563-9.213562-9.213562-80.36274 0.511865-330.152658 0-410.515399 0-19.450854 0-29.688146-7.166104-34.294927-26.105094-5.118646-19.450854-5.118646-39.925438 0.511865-58.864427 5.118646-16.891531 15.355938-23.545771 32.759333-23.545771h412.562857c7.166104 0 8.189833-1.535594 8.189833-8.189834V41.219994c0-25.081365 7.166104-34.806792 32.247469-38.901708 18.93899-3.583052 38.389844-3.583052 56.305105 4.094917 13.820344 5.63051 20.474583 15.867802 20.474583 30.711875v412.562856c0 6.65424 1.535594 8.189833 8.189833 8.189834h406.932346c23.545771 0 33.783063 7.677969 38.901709 30.711875 4.094917 18.427125 4.094917 37.366115-2.047458 55.281375-5.118646 16.379667-15.355938 23.033906-32.247469 23.033907h-410.515398c-7.166104 0-10.237292 1.023729-9.725428 9.725427 0.511865 40.437302 0.511865 249.789918 0.511865 290.22722z"
|
|
17
|
-
p-id="74841"
|
|
18
|
-
/>
|
|
19
|
-
</svg>
|
|
20
|
-
上传图片或附件
|
|
21
|
-
</button>
|
|
22
|
-
</div>
|
|
23
|
-
<div
|
|
24
|
-
class="editor_content"
|
|
25
|
-
id="my_editor_content"
|
|
26
|
-
v-html="text"
|
|
27
|
-
contenteditable
|
|
28
|
-
ref="editorContent"
|
|
29
|
-
@focus="ischecked = true"
|
|
30
|
-
@blur="blurFn"
|
|
31
|
-
@input="changeInput"
|
|
32
|
-
:data-placeholder="placeholder"
|
|
33
|
-
></div>
|
|
34
|
-
</div>
|
|
35
|
-
</template>
|
|
36
|
-
|
|
37
|
-
<script>
|
|
38
|
-
import { v4 as uuidv4 } from "uuid";
|
|
39
|
-
import { multipartUpload, ossFileUrl } from "./utils/AliyunIssUtil";
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
this.
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
inputObj.
|
|
77
|
-
inputObj.setAttribute('
|
|
78
|
-
inputObj.setAttribute('
|
|
79
|
-
inputObj.setAttribute('
|
|
80
|
-
inputObj.setAttribute(
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
inputObj.
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
//
|
|
91
|
-
//
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
//
|
|
95
|
-
//
|
|
96
|
-
//
|
|
97
|
-
// this.editor.uploadImg
|
|
98
|
-
//
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
node.
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
node.setAttribute("
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
node.
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
this.
|
|
143
|
-
|
|
144
|
-
this.
|
|
145
|
-
this
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
myEditorContent
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
})
|
|
215
|
-
myEditorContent.addEventListener("
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
//
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
padding
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<div class="my_editor">
|
|
3
|
+
<div class="editor_head" v-if="havToolbar">
|
|
4
|
+
<button class="button" @click="handleUpdate">
|
|
5
|
+
<svg
|
|
6
|
+
t="1703581982515"
|
|
7
|
+
class="icon"
|
|
8
|
+
viewBox="0 0 1024 1024"
|
|
9
|
+
version="1.1"
|
|
10
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
11
|
+
p-id="74840"
|
|
12
|
+
width="200"
|
|
13
|
+
height="200"
|
|
14
|
+
>
|
|
15
|
+
<path
|
|
16
|
+
d="M566.839921 866.857572V983.050833c0 22.522042-7.677969 33.271198-29.688146 37.877979-18.427125 4.094917-37.366115 3.583052-55.281375-2.047458-17.403396-5.63051-24.057636-15.867802-24.057636-33.271198v-410.003534c0-7.166104-1.535594-9.213563-9.213562-9.213562-80.36274 0.511865-330.152658 0-410.515399 0-19.450854 0-29.688146-7.166104-34.294927-26.105094-5.118646-19.450854-5.118646-39.925438 0.511865-58.864427 5.118646-16.891531 15.355938-23.545771 32.759333-23.545771h412.562857c7.166104 0 8.189833-1.535594 8.189833-8.189834V41.219994c0-25.081365 7.166104-34.806792 32.247469-38.901708 18.93899-3.583052 38.389844-3.583052 56.305105 4.094917 13.820344 5.63051 20.474583 15.867802 20.474583 30.711875v412.562856c0 6.65424 1.535594 8.189833 8.189833 8.189834h406.932346c23.545771 0 33.783063 7.677969 38.901709 30.711875 4.094917 18.427125 4.094917 37.366115-2.047458 55.281375-5.118646 16.379667-15.355938 23.033906-32.247469 23.033907h-410.515398c-7.166104 0-10.237292 1.023729-9.725428 9.725427 0.511865 40.437302 0.511865 249.789918 0.511865 290.22722z"
|
|
17
|
+
p-id="74841"
|
|
18
|
+
/>
|
|
19
|
+
</svg>
|
|
20
|
+
上传图片或附件
|
|
21
|
+
</button>
|
|
22
|
+
</div>
|
|
23
|
+
<div
|
|
24
|
+
class="editor_content"
|
|
25
|
+
id="my_editor_content"
|
|
26
|
+
v-html="text"
|
|
27
|
+
contenteditable
|
|
28
|
+
ref="editorContent"
|
|
29
|
+
@focus="ischecked = true"
|
|
30
|
+
@blur="blurFn"
|
|
31
|
+
@input="changeInput"
|
|
32
|
+
:data-placeholder="placeholder"
|
|
33
|
+
></div>
|
|
34
|
+
</div>
|
|
35
|
+
</template>
|
|
36
|
+
|
|
37
|
+
<script>
|
|
38
|
+
import { v4 as uuidv4 } from "uuid";
|
|
39
|
+
// import { multipartUpload, ossFileUrl } from "./utils/AliyunIssUtil";
|
|
40
|
+
import { putObject } from "../assets/js/obsBrowser";
|
|
41
|
+
|
|
42
|
+
export default {
|
|
43
|
+
props: ["value", "placeholder", "havToolbar"],
|
|
44
|
+
data () {
|
|
45
|
+
return {
|
|
46
|
+
ossConfig: {
|
|
47
|
+
region: "oss-cn-zhangjiakou",
|
|
48
|
+
//云账号AccessKey有所有API访问权限,建议遵循阿里云安全最佳实践,创建并使用STS方式来进行API访问
|
|
49
|
+
accessKeyId: "LTAI4G3QtdEdwkEbihBngAsK",
|
|
50
|
+
accessKeySecret: "OwgdVfc5PeCkIgqIdug660xmiSPchn",
|
|
51
|
+
// stsToken: '<Your securityToken(STS)>',
|
|
52
|
+
bucket: "guoranopen-zjk",
|
|
53
|
+
},
|
|
54
|
+
ischecked: false,
|
|
55
|
+
text: ''
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
watch: {
|
|
59
|
+
value () {
|
|
60
|
+
// 解决光标跳动BUG
|
|
61
|
+
if (!this.ischecked) {
|
|
62
|
+
this.text = this.value
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
methods: {
|
|
67
|
+
blurFn (e) {
|
|
68
|
+
this.ischecked = false
|
|
69
|
+
this.text = this.value
|
|
70
|
+
e.view.blur()
|
|
71
|
+
},
|
|
72
|
+
changeInput (e) {
|
|
73
|
+
this.$emit("input", e.target.innerHTML)
|
|
74
|
+
},
|
|
75
|
+
handleUpdate () {
|
|
76
|
+
let inputObj = document.createElement('input')
|
|
77
|
+
inputObj.setAttribute('id', '_ef');
|
|
78
|
+
inputObj.setAttribute('type', 'file');
|
|
79
|
+
inputObj.setAttribute('accept', '*')
|
|
80
|
+
inputObj.setAttribute('multiple', true)
|
|
81
|
+
inputObj.setAttribute("style", 'visibility:hidden');
|
|
82
|
+
document.body.appendChild(inputObj);
|
|
83
|
+
inputObj.click();
|
|
84
|
+
inputObj.onchange = () => {
|
|
85
|
+
// 循环上传文件
|
|
86
|
+
let files = inputObj.files;
|
|
87
|
+
for (let index = 0; index < files.length; index++) {
|
|
88
|
+
const file = files[index];
|
|
89
|
+
let uid = uuidv4()
|
|
90
|
+
// let command = this.editor.commands.get("insertAskComponent");
|
|
91
|
+
// const listeners = this.editor.config.get('askPluginListener');
|
|
92
|
+
// let beforeButtonInsert = findListener(listeners, "UPLOAD");
|
|
93
|
+
if (file.type.includes('image')) {
|
|
94
|
+
// if (this.editor.uploadImg) {
|
|
95
|
+
// this.editor.uploadImg.push(uid)
|
|
96
|
+
// } else {
|
|
97
|
+
// this.editor.uploadImg = []
|
|
98
|
+
// this.editor.uploadImg.push(uid)
|
|
99
|
+
// }
|
|
100
|
+
this.imgUploadCallback(file, uid, index)
|
|
101
|
+
} else {
|
|
102
|
+
this.fileUploadCallback(file, uid)
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
appenNode (type, uid, value) {
|
|
108
|
+
let node = document.createElement(type)
|
|
109
|
+
node.setAttribute("uid", uid)
|
|
110
|
+
if (type == 'img') {
|
|
111
|
+
node.setAttribute("src", value)
|
|
112
|
+
node.setAttribute("class", 'image')
|
|
113
|
+
setTimeout(() => {
|
|
114
|
+
this.appenNode('div', '', '')
|
|
115
|
+
})
|
|
116
|
+
}
|
|
117
|
+
if (type == 'div' && uid) {
|
|
118
|
+
node.innerText = value
|
|
119
|
+
node.setAttribute("class", 'loading')
|
|
120
|
+
setTimeout(() => {
|
|
121
|
+
this.appenNode('div', '', '')
|
|
122
|
+
})
|
|
123
|
+
}
|
|
124
|
+
if (type == 'div' && !uid) {
|
|
125
|
+
node.setAttribute("class", 'wrap')
|
|
126
|
+
}
|
|
127
|
+
this.$refs.editorContent.appendChild(node)
|
|
128
|
+
},
|
|
129
|
+
deleteNode (uid) {
|
|
130
|
+
console.log(uid);
|
|
131
|
+
try {
|
|
132
|
+
let node = document.querySelector("[uid=" + uid + ']')
|
|
133
|
+
if (node) {
|
|
134
|
+
this.$refs.editorContent.removeChild(node)
|
|
135
|
+
}
|
|
136
|
+
} catch {
|
|
137
|
+
console.error("未找到该节点");
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
imgUploadCallback (file, uid, index) {
|
|
141
|
+
console.log(file, uid, index);
|
|
142
|
+
this.appenNode("div", "div" + index + uid, file.name + "正在上传,请稍后...")
|
|
143
|
+
this.upload(file).then(res => {
|
|
144
|
+
this.appenNode('img', "img" + index + uid, res.default)
|
|
145
|
+
this.deleteNode("div" + index + uid)
|
|
146
|
+
this.$emit("input", this.$refs.editorContent.innerHTML)
|
|
147
|
+
})
|
|
148
|
+
},
|
|
149
|
+
upload (file) {
|
|
150
|
+
return new Promise((resolve) => {
|
|
151
|
+
this.uploadFile(file, resolve)
|
|
152
|
+
})
|
|
153
|
+
},
|
|
154
|
+
uploadFile (file, resolve) {
|
|
155
|
+
let imgInfo = {
|
|
156
|
+
url: '',
|
|
157
|
+
}
|
|
158
|
+
// let res = multipartUpload(
|
|
159
|
+
// this.ossConfig,
|
|
160
|
+
// file,
|
|
161
|
+
// null,
|
|
162
|
+
// imgInfo
|
|
163
|
+
// );
|
|
164
|
+
let res = putObject(file)
|
|
165
|
+
res.then(resp => {
|
|
166
|
+
imgInfo.url = resp.url
|
|
167
|
+
resolve({
|
|
168
|
+
name: resp.name,
|
|
169
|
+
default: imgInfo.url
|
|
170
|
+
})
|
|
171
|
+
})
|
|
172
|
+
},
|
|
173
|
+
fileUploadCallback (file, uid) {
|
|
174
|
+
this.$emit("fileUploadCallback", {
|
|
175
|
+
param: {
|
|
176
|
+
uid: uid,
|
|
177
|
+
type: 'pending',
|
|
178
|
+
name: file.name
|
|
179
|
+
}
|
|
180
|
+
})
|
|
181
|
+
this.upload(file).then(res => {
|
|
182
|
+
this.$emit("fileUploadCallback", {
|
|
183
|
+
param: {
|
|
184
|
+
uid: uid,
|
|
185
|
+
name: file.name,
|
|
186
|
+
type: 'success',
|
|
187
|
+
url: res.default
|
|
188
|
+
}
|
|
189
|
+
})
|
|
190
|
+
this.$emit("input", this.$refs.editorContent.innerHTML)
|
|
191
|
+
})
|
|
192
|
+
},
|
|
193
|
+
|
|
194
|
+
},
|
|
195
|
+
mounted () {
|
|
196
|
+
this.$nextTick(() => {
|
|
197
|
+
let myEditorContent = this.$refs.editorContent
|
|
198
|
+
console.log(myEditorContent, 'myEditorContent');
|
|
199
|
+
myEditorContent.addEventListener("paste", (e) => {
|
|
200
|
+
let { files } = e.clipboardData
|
|
201
|
+
console.log(files, e.clipboardData, 'filesfilesfilesfiles');
|
|
202
|
+
if (files.length > 0) {
|
|
203
|
+
for (let index = 0; index < files.length; index++) {
|
|
204
|
+
let uid = uuidv4()
|
|
205
|
+
if (files[index].type.indexOf('image') != -1) {
|
|
206
|
+
this.imgUploadCallback(files[index], uid, index)
|
|
207
|
+
e.preventDefault();
|
|
208
|
+
} else {
|
|
209
|
+
this.fileUploadCallback(files[index], uid)
|
|
210
|
+
e.preventDefault();
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
})
|
|
215
|
+
myEditorContent.addEventListener("dragenter", function () {
|
|
216
|
+
});
|
|
217
|
+
myEditorContent.addEventListener("dragover", function (e) {
|
|
218
|
+
e.preventDefault();
|
|
219
|
+
});
|
|
220
|
+
myEditorContent.addEventListener("drop", (e) => {
|
|
221
|
+
e.preventDefault();
|
|
222
|
+
let files = e.dataTransfer.files; // 这个就相当于文件上传组件
|
|
223
|
+
if (files.length > 0) {
|
|
224
|
+
for (let index = 0; index < files.length; index++) {
|
|
225
|
+
let uid = uuidv4()
|
|
226
|
+
if (files[index].type.indexOf('image') != -1) {
|
|
227
|
+
this.imgUploadCallback(files[index], uid, index)
|
|
228
|
+
e.preventDefault();
|
|
229
|
+
} else {
|
|
230
|
+
this.fileUploadCallback(files[index], uid)
|
|
231
|
+
e.preventDefault();
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}, false);
|
|
236
|
+
})
|
|
237
|
+
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
</script>
|
|
241
|
+
|
|
242
|
+
<style lang="less" scoped>
|
|
243
|
+
.my_editor {
|
|
244
|
+
width: 100%;
|
|
245
|
+
border: 1px solid #e0e6f7;
|
|
246
|
+
border-radius: 9px !important;
|
|
247
|
+
background: #ffffff;
|
|
248
|
+
/deep/.editor_content {
|
|
249
|
+
border-bottom-left-radius: 9px !important;
|
|
250
|
+
border-bottom-right-radius: 9px !important;
|
|
251
|
+
padding: 10px;
|
|
252
|
+
box-sizing: border-box;
|
|
253
|
+
min-height: 150px !important;
|
|
254
|
+
font-size: 14px !important;
|
|
255
|
+
outline: none;
|
|
256
|
+
div {
|
|
257
|
+
margin-bottom: 8px;
|
|
258
|
+
white-space: pre-wrap;
|
|
259
|
+
}
|
|
260
|
+
.image {
|
|
261
|
+
height: 140px;
|
|
262
|
+
object-fit: contain;
|
|
263
|
+
}
|
|
264
|
+
// .image{
|
|
265
|
+
// outline: 3px solid #366aff;
|
|
266
|
+
// }
|
|
267
|
+
.loading {
|
|
268
|
+
background: rgba(0, 89, 255, 0.2);
|
|
269
|
+
display: inline-block;
|
|
270
|
+
padding: 2px 5px;
|
|
271
|
+
border-radius: 3px;
|
|
272
|
+
padding-left: 20px;
|
|
273
|
+
position: relative;
|
|
274
|
+
font-size: 12px;
|
|
275
|
+
-webkit-user-modify: read-only;
|
|
276
|
+
-moz-user-modify: read-only;
|
|
277
|
+
}
|
|
278
|
+
.loading::after {
|
|
279
|
+
content: '';
|
|
280
|
+
background-image: url(../assets/image/building.png);
|
|
281
|
+
background-size: 100%;
|
|
282
|
+
width: 15px;
|
|
283
|
+
height: 15px;
|
|
284
|
+
position: absolute;
|
|
285
|
+
top: 3px;
|
|
286
|
+
left: 2px;
|
|
287
|
+
color: #366aff;
|
|
288
|
+
-webkit-animation: rotate 1.5s linear infinite;
|
|
289
|
+
animation: rotate 1.5s linear infinite;
|
|
290
|
+
}
|
|
291
|
+
.wrap {
|
|
292
|
+
height: 1px;
|
|
293
|
+
width: 100%;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
.editor_content:focus {
|
|
297
|
+
box-shadow: 2px 2px 3px rgba(0, 0, 0, 0.1) inset, 0, 0;
|
|
298
|
+
}
|
|
299
|
+
.editor_content:empty::before {
|
|
300
|
+
content: attr(data-placeholder);
|
|
301
|
+
color: #b3b3b3;
|
|
302
|
+
font-size: 14px;
|
|
303
|
+
}
|
|
304
|
+
.editor_head {
|
|
305
|
+
display: flex;
|
|
306
|
+
align-items: center;
|
|
307
|
+
width: 100%;
|
|
308
|
+
height: 38px;
|
|
309
|
+
padding: 0 10px;
|
|
310
|
+
padding-left: 3px;
|
|
311
|
+
box-sizing: border-box;
|
|
312
|
+
color: #366aff;
|
|
313
|
+
font-size: 14px;
|
|
314
|
+
border-bottom: 1px solid #e0e6f7;
|
|
315
|
+
|
|
316
|
+
.button {
|
|
317
|
+
padding: 5px 8px;
|
|
318
|
+
background: #ffffff;
|
|
319
|
+
border: none;
|
|
320
|
+
border-radius: 2px;
|
|
321
|
+
svg {
|
|
322
|
+
fill: #366aff;
|
|
323
|
+
width: 12px !important;
|
|
324
|
+
height: 12px !important;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
.button:focus {
|
|
328
|
+
// box-shadow: var(--ck-focus-outer-shadow),0 0;
|
|
329
|
+
outline: none;
|
|
330
|
+
background: #f0f0f0;
|
|
331
|
+
transition: box-shadow 0.2s ease-in-out, border 0.2s ease-in-ou;
|
|
332
|
+
}
|
|
333
|
+
.button:active {
|
|
334
|
+
border: 1px solid #366aff;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
@keyframes rotate {
|
|
339
|
+
0% {
|
|
340
|
+
-webkit-transform: rotate(0deg);
|
|
341
|
+
transform: rotate(0deg);
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
100% {
|
|
345
|
+
-webkit-transform: rotate(360deg);
|
|
346
|
+
transform: rotate(360deg);
|
|
347
|
+
}
|
|
348
|
+
}
|
|
347
349
|
</style>
|