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