askbot-dragon 1.6.32-beta → 1.6.34-beta

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