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