askbot-dragon 1.6.15-beta → 1.6.16-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.
- package/package.json +1 -4
- package/public/index.html +1 -1
- package/src/assets/js/hammer.js +2 -13
- package/src/assets/less/converSationContainer/common.less +0 -7
- package/src/components/ActionAlertIframe.vue +1 -24
- package/src/components/AiGuide.vue +6 -4
- package/src/components/AnswerDocknowledge.vue +3 -44
- package/src/components/ConversationContainer.vue +9 -9
- package/src/components/MyEditor.vue +345 -0
- package/src/components/askVideo.vue +1 -24
- package/src/components/associationIntention.vue +1 -7
- package/src/components/formTemplate.vue +25 -27
- package/src/components/pdfPosition.vue +11 -197
- package/src/components/previewPdf.vue +8 -21
- package/src/main.js +2 -2
- package/vue.config.js +0 -1
- package/src/components/newPdfPosition.vue +0 -878
package/package.json
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "askbot-dragon",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.16-beta",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"serve": "vue-cli-service serve",
|
|
6
6
|
"build": "vue-cli-service build",
|
|
7
7
|
"lint": "vue-cli-service lint"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@ckeditor/ckeditor5-ui": "^10.1.0",
|
|
11
|
-
"@ckeditor/ckeditor5-vue2": "^3.0.1",
|
|
12
10
|
"ali-oss": "^6.2.1",
|
|
13
11
|
"audio-loader": "^1.0.3",
|
|
14
|
-
"ckeditor": "^4.12.1",
|
|
15
12
|
"core-js": "^3.6.5",
|
|
16
13
|
"install": "^0.13.0",
|
|
17
14
|
"jquery": "^3.5.1",
|
package/public/index.html
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
25
|
</script>
|
|
26
|
-
<script src="https://guoranopen-zjk.oss-cn-zhangjiakou.aliyuncs.com/ckeditor5-build-classic/0.4.4/ckeditor.js"></script>
|
|
26
|
+
<!-- <script src="https://guoranopen-zjk.oss-cn-zhangjiakou.aliyuncs.com/ckeditor5-build-classic/0.4.4/ckeditor.js"></script> -->
|
|
27
27
|
<!-- 项目图标 -->
|
|
28
28
|
<link rel="stylesheet" href="//at.alicdn.com/t/font_1566110_3hu6pyd938i.css"/>
|
|
29
29
|
<!-- guoran图标 -->
|
package/src/assets/js/hammer.js
CHANGED
|
@@ -3,15 +3,6 @@ export function zoomElement (el) {
|
|
|
3
3
|
let store = {
|
|
4
4
|
scale: 1
|
|
5
5
|
};
|
|
6
|
-
if (!el){
|
|
7
|
-
return
|
|
8
|
-
}
|
|
9
|
-
let scale = 1;
|
|
10
|
-
if (el.style.transform){
|
|
11
|
-
let transForm = el.style.transform;
|
|
12
|
-
var values = transForm.split('(')[1].split(')')[0].split(',');
|
|
13
|
-
scale = values[0] ? values[0] : 1
|
|
14
|
-
}
|
|
15
6
|
// 缩放事件的处理
|
|
16
7
|
el.addEventListener('touchstart', function (event) {
|
|
17
8
|
let touches = event.touches;
|
|
@@ -76,15 +67,13 @@ export function zoomElement (el) {
|
|
|
76
67
|
newScale = 3;
|
|
77
68
|
}
|
|
78
69
|
// 最小缩放比例限制
|
|
79
|
-
if(newScale <
|
|
80
|
-
newScale =
|
|
70
|
+
if(newScale < 1) {
|
|
71
|
+
newScale = 1;
|
|
81
72
|
}
|
|
82
73
|
// 记住使用的缩放值
|
|
83
74
|
store.scale = newScale;
|
|
84
75
|
// 图像应用缩放效果
|
|
85
76
|
el.style.transform = 'scale(' + newScale + ')';
|
|
86
|
-
el.style.transformOrigin = 'top left'
|
|
87
|
-
|
|
88
77
|
}
|
|
89
78
|
});
|
|
90
79
|
document.addEventListener('touchend', function () {
|
|
@@ -35,13 +35,6 @@
|
|
|
35
35
|
border-radius: 6px;
|
|
36
36
|
background-color: #bfceec !important;
|
|
37
37
|
}
|
|
38
|
-
@media screen and (max-width: 767px){
|
|
39
|
-
::-webkit-scrollbar {
|
|
40
|
-
width: 0;
|
|
41
|
-
height: 0;
|
|
42
|
-
background-color:@system_bordercolor_4;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
38
|
|
|
46
39
|
// 弹窗body
|
|
47
40
|
.el-dialog__body{
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
class="grzh-iframe"
|
|
27
27
|
:src="actionAlertIframe.template"
|
|
28
28
|
width="100%"
|
|
29
|
-
height="
|
|
29
|
+
height="95%"
|
|
30
30
|
:scrolling="actionAlertIframe.scrolling"
|
|
31
31
|
frameborder="no"
|
|
32
32
|
border="0"
|
|
@@ -87,29 +87,6 @@ export default {
|
|
|
87
87
|
this.actionAlertIframe.template = this.actionAlertIframe.template + "&iframeId=" + this.tampId
|
|
88
88
|
}
|
|
89
89
|
this.actionAlertIframe.template = this.actionAlertIframe.template.split("&").join("&")
|
|
90
|
-
|
|
91
|
-
// 监听回退事件
|
|
92
|
-
let _that = this;
|
|
93
|
-
|
|
94
|
-
(function () {
|
|
95
|
-
console.log(95, 'addEventListener window.onpopstate');
|
|
96
|
-
if (window.history && window.history.pushState) {
|
|
97
|
-
console.log(97, 'window.history && window.history.pushState');
|
|
98
|
-
window.onpopstate = function (e) {
|
|
99
|
-
console.log(9999, 'window.onpopstate innner', e);
|
|
100
|
-
if (_that.showAskFullScreen) {
|
|
101
|
-
window.history.go(1);
|
|
102
|
-
}
|
|
103
|
-
// window.history.pushState('forward', null, '');
|
|
104
|
-
// window.history.forward(1);
|
|
105
|
-
_that.showAskFullScreen = false;
|
|
106
|
-
if ( e && e.stopPropagation ) {
|
|
107
|
-
console.log(105, 'e.stopPropagation');
|
|
108
|
-
e.stopPropagation();
|
|
109
|
-
}
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
})();
|
|
113
90
|
},
|
|
114
91
|
};
|
|
115
92
|
</script>
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
<span v-html="aiGuide.content.description"></span>
|
|
17
17
|
</div>
|
|
18
18
|
<!-- 一级分类 -->
|
|
19
|
-
<div v-show="aiGuide.content.typesVisible
|
|
19
|
+
<div v-show="aiGuide.content.typesVisible" class="ig-types-f">
|
|
20
20
|
<span
|
|
21
21
|
v-for="(fType, fTypeIndex) in aiGuide.content.options"
|
|
22
22
|
:key="`f_${fTypeIndex}`"
|
|
@@ -31,7 +31,9 @@
|
|
|
31
31
|
>
|
|
32
32
|
</div>
|
|
33
33
|
<!-- 二级分类 -->
|
|
34
|
-
|
|
34
|
+
<div v-show="aiGuide.content.typesVisible && aiGuide.content.options[
|
|
35
|
+
activeFirstTypeIndex
|
|
36
|
+
].types.length !== 0" class="ig-types-s">
|
|
35
37
|
<span
|
|
36
38
|
v-for="(sType, sTypeIndex) in aiGuide.content.options[
|
|
37
39
|
activeFirstTypeIndex
|
|
@@ -232,11 +234,11 @@ export default {
|
|
|
232
234
|
beforeMount() {},
|
|
233
235
|
mounted() {
|
|
234
236
|
this.isMobile();
|
|
235
|
-
if (this.aiGuide.content.options[0]
|
|
237
|
+
if (this.aiGuide.content.options[0].types.length === 0) {
|
|
236
238
|
this.activeOtherObj = this.aiGuide.content.options[0];
|
|
237
239
|
} else {
|
|
238
240
|
this.activeSecondTypeIndex = 0;
|
|
239
|
-
this.activeOtherObj = this.aiGuide.content.options[0]
|
|
241
|
+
this.activeOtherObj = this.aiGuide.content.options[0].types[0];
|
|
240
242
|
}
|
|
241
243
|
},
|
|
242
244
|
methods: {
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
</div>
|
|
71
71
|
</div>
|
|
72
72
|
</div>
|
|
73
|
-
<previewPdf ref="previewPdf" :url="previewHref" :
|
|
73
|
+
<previewPdf ref="previewPdf" :url="previewHref" :sourceFileType="sourceFileType" officePreviewType="pdf"></previewPdf>
|
|
74
74
|
</div>
|
|
75
75
|
</template>
|
|
76
76
|
|
|
@@ -154,11 +154,6 @@ export default {
|
|
|
154
154
|
MP3: "audio",
|
|
155
155
|
yqhtml: "yqhtml",
|
|
156
156
|
feishuhtml:"feishuhtml"
|
|
157
|
-
},
|
|
158
|
-
watermark: {
|
|
159
|
-
textWatermarkValue:'',
|
|
160
|
-
visitorWatermarkValue:'',
|
|
161
|
-
source:""
|
|
162
157
|
}
|
|
163
158
|
}
|
|
164
159
|
},
|
|
@@ -206,9 +201,6 @@ export default {
|
|
|
206
201
|
methods: {
|
|
207
202
|
//预览图片
|
|
208
203
|
lookAttach(url, item, event) {
|
|
209
|
-
// console.log(item.knowledgeId);
|
|
210
|
-
// this.$http.get("/knowledge-api/internal/knowledgeBaseStructure/" + "642ffbccde420e2772f7787b")
|
|
211
|
-
// debugger
|
|
212
204
|
event.preventDefault();
|
|
213
205
|
if (this.isAskLightning == 1 && !this.isApp){
|
|
214
206
|
window.parent.postMessage({
|
|
@@ -241,10 +233,8 @@ export default {
|
|
|
241
233
|
}
|
|
242
234
|
this.$http.post(httpUrl, {
|
|
243
235
|
"fileInOssPath":url
|
|
244
|
-
}).then(
|
|
236
|
+
}).then(res =>{
|
|
245
237
|
if(res.data.code == '0') {
|
|
246
|
-
this.watermark = await this.getknowledgeBaseStructure(item.knowledgeId);
|
|
247
|
-
this.watermark.source = item.source;
|
|
248
238
|
this.previewHref = res.data.data;
|
|
249
239
|
this.sourceFileType = url.substring(url.lastIndexOf('.'))
|
|
250
240
|
let isOhmPc = sessionStorage.getItem('isOhmPc')
|
|
@@ -257,18 +247,7 @@ export default {
|
|
|
257
247
|
}
|
|
258
248
|
this.$refs.previewPdf.fileType = type
|
|
259
249
|
this.$refs.previewPdf.tagIds = item.tagIds
|
|
260
|
-
this.$refs.previewPdf.isMessageRecord = this.isMessageRecord ? true : false
|
|
261
|
-
let index = url.indexOf("?");
|
|
262
|
-
let newFileInOssPath = url;
|
|
263
|
-
if (index !== -1){
|
|
264
|
-
newFileInOssPath = url.substring(0, url.indexOf("?"))
|
|
265
|
-
}
|
|
266
|
-
let fileName = newFileInOssPath.substring(newFileInOssPath.lastIndexOf('.'))
|
|
267
|
-
if (fileName === '.doc' || fileName === '.docx' || fileName === '.txt'|| fileName === '.html'){
|
|
268
|
-
this.$refs.previewPdf.fileName = fileName;
|
|
269
|
-
} else {
|
|
270
|
-
this.$refs.previewPdf.fileName = '';
|
|
271
|
-
}
|
|
250
|
+
this.$refs.previewPdf.isMessageRecord = this.isMessageRecord ? true : false
|
|
272
251
|
if(item.tagIds && item.tagIds.length != 0) {
|
|
273
252
|
this.$refs.previewPdf.loading = false
|
|
274
253
|
return
|
|
@@ -319,24 +298,6 @@ export default {
|
|
|
319
298
|
// return res.data
|
|
320
299
|
})
|
|
321
300
|
// return imgurl
|
|
322
|
-
},
|
|
323
|
-
async getknowledgeBaseStructure(knowledgeId) {
|
|
324
|
-
let watermark = {
|
|
325
|
-
textWatermarkValue:'',
|
|
326
|
-
visitorWatermarkValue:''
|
|
327
|
-
}
|
|
328
|
-
await this.$http.get("/knowledge-api/internal/knowledgeBaseStructure/" + knowledgeId).then( async res =>{
|
|
329
|
-
if(res.data) {
|
|
330
|
-
watermark.textWatermarkValue = await res.data.textWatermarkValue
|
|
331
|
-
if(res.data.visitorWatermark) {
|
|
332
|
-
let userInfo = sessionStorage.getItem('userInfo') || localStorage.getItem('userInfo')
|
|
333
|
-
if(userInfo && userInfo !== 'null') {
|
|
334
|
-
watermark.visitorWatermarkValue = JSON.parse(userInfo).realName
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
})
|
|
339
|
-
return watermark
|
|
340
301
|
}
|
|
341
302
|
}
|
|
342
303
|
}
|
|
@@ -447,8 +408,6 @@ export default {
|
|
|
447
408
|
}
|
|
448
409
|
}
|
|
449
410
|
.alc-box-introduction-previewImage {
|
|
450
|
-
width: 100%;
|
|
451
|
-
display: block;
|
|
452
411
|
overflow: hidden;
|
|
453
412
|
text-overflow: ellipsis;
|
|
454
413
|
display: -webkit-box;
|
|
@@ -12,15 +12,15 @@
|
|
|
12
12
|
<loading-process :dataNote="dataNote" :finished="finished"></loading-process>
|
|
13
13
|
</div>
|
|
14
14
|
</div> -->
|
|
15
|
-
|
|
15
|
+
<MyEditor></MyEditor>
|
|
16
16
|
<!-- <form-template
|
|
17
17
|
:formList="formList2"
|
|
18
18
|
@submitClick="submitClick"
|
|
19
19
|
></form-template> -->
|
|
20
|
-
|
|
20
|
+
<form-template
|
|
21
21
|
:formList="formList"
|
|
22
22
|
@submitClick="submitClick"
|
|
23
|
-
></form-template>
|
|
23
|
+
></form-template>
|
|
24
24
|
<!-- <form-template
|
|
25
25
|
:formList="formList3"
|
|
26
26
|
@submitClick="submitClick"
|
|
@@ -77,11 +77,11 @@
|
|
|
77
77
|
</template>
|
|
78
78
|
<script>
|
|
79
79
|
import TextMessage from '@/components/message/TextMessage'
|
|
80
|
-
|
|
80
|
+
import FormTemplate from "@/components/formTemplate";
|
|
81
81
|
|
|
82
82
|
/*import FormTemplate from "@/components/formTemplate";
|
|
83
83
|
import TextMessage from "@/components/message/TextMessage";*/
|
|
84
|
-
|
|
84
|
+
import MyEditor from '@/components/MyEditor'
|
|
85
85
|
// import FormTemplate from '@/components/formTemplate'
|
|
86
86
|
import AnswerRadio from './answerRadio'
|
|
87
87
|
// import TicketMessage from './message/TicketMessage'
|
|
@@ -119,7 +119,7 @@ export default {
|
|
|
119
119
|
// LoadingProcess,
|
|
120
120
|
// MsgLoading,
|
|
121
121
|
// ActionSatisfaction,
|
|
122
|
-
|
|
122
|
+
AssociationIntention,
|
|
123
123
|
/* VoiceComponent,*/
|
|
124
124
|
TicketMessage,
|
|
125
125
|
// AsserDeatils,
|
|
@@ -130,11 +130,12 @@ export default {
|
|
|
130
130
|
// VoiceCompontent,
|
|
131
131
|
AiGuide,
|
|
132
132
|
AnswerVoice,
|
|
133
|
-
|
|
133
|
+
FormTemplate,
|
|
134
134
|
// FormTemplate,
|
|
135
135
|
// FileType,
|
|
136
136
|
// ChatContent,
|
|
137
137
|
AnswerDocknowledge,
|
|
138
|
+
MyEditor
|
|
138
139
|
},
|
|
139
140
|
props: {
|
|
140
141
|
messages: Array
|
|
@@ -211,7 +212,7 @@ export default {
|
|
|
211
212
|
"knowledgeId": "658a93de63d378228271913a",
|
|
212
213
|
"knowledgePartId": "ypZaqYwBD3jzLtPbz5K8",
|
|
213
214
|
"from": "ppt_preview",
|
|
214
|
-
"introduction": "Spark是什么Spark 是一个开源的大数据处理引擎,它提供了一整套开发 API
|
|
215
|
+
"introduction": "Spark是什么Spark 是一个开源的大数据处理引擎,它提供了一整套开发 API,包括流计算和机器学习。它支持批处理和流处理。Spark 的一个显著特点是它能够在内存中进行迭代计算,从而加快数据处理速度。尽管 Spark 是用 Scala 开发的,但它也为 Java、Scala、Python 和 R 等高级编程语言提供了开发接口。",
|
|
215
216
|
"previewImage": "https://askbot-pdf-all.oss-cn-zhangjiakou.aliyuncs.com/31623ccfe9dd4957bbd59c5823878bbe/2023/12/27/03/39/08/658b9c477cf604285f7cb81d/pdf-image-1913302477976388839.png"
|
|
216
217
|
}
|
|
217
218
|
],
|
|
@@ -4652,7 +4653,6 @@ export default {
|
|
|
4652
4653
|
url:
|
|
4653
4654
|
'https://guoranopen-zjk.oss-cn-zhangjiakou.aliyuncs.com/2021/08/24/07/35/41221223-c180-4f3f-bdc8-94875b693965/WeChat_20210719215122.mp4',
|
|
4654
4655
|
videoFlag: false,
|
|
4655
|
-
nodownload: false,
|
|
4656
4656
|
videoUploadPercent: 0,
|
|
4657
4657
|
isShowUploadVideo: true,
|
|
4658
4658
|
recommend: {
|
|
@@ -0,0 +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
|
+
上传图片或附件
|
|
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
|
+
})
|
|
146
|
+
},
|
|
147
|
+
upload (file) {
|
|
148
|
+
return new Promise((resolve) => {
|
|
149
|
+
this.uploadFile(file, resolve)
|
|
150
|
+
})
|
|
151
|
+
},
|
|
152
|
+
uploadFile (file, resolve) {
|
|
153
|
+
let imgInfo = {
|
|
154
|
+
url: '',
|
|
155
|
+
}
|
|
156
|
+
let res = multipartUpload(
|
|
157
|
+
this.ossConfig,
|
|
158
|
+
file,
|
|
159
|
+
null,
|
|
160
|
+
imgInfo
|
|
161
|
+
);
|
|
162
|
+
res.then(resp => {
|
|
163
|
+
imgInfo.url = ossFileUrl(this.ossConfig, resp.name)
|
|
164
|
+
resolve({
|
|
165
|
+
name: resp.name,
|
|
166
|
+
default: imgInfo.url
|
|
167
|
+
})
|
|
168
|
+
})
|
|
169
|
+
},
|
|
170
|
+
fileUploadCallback (file, uid) {
|
|
171
|
+
this.$emit("fileUploadCallback", {
|
|
172
|
+
param: {
|
|
173
|
+
uid: uid,
|
|
174
|
+
type: 'pending',
|
|
175
|
+
name: file.name
|
|
176
|
+
}
|
|
177
|
+
})
|
|
178
|
+
this.upload(file).then(res => {
|
|
179
|
+
this.$emit("fileUploadCallback", {
|
|
180
|
+
param: {
|
|
181
|
+
uid: uid,
|
|
182
|
+
name: file.name,
|
|
183
|
+
type: 'success',
|
|
184
|
+
url: res.default
|
|
185
|
+
}
|
|
186
|
+
})
|
|
187
|
+
})
|
|
188
|
+
},
|
|
189
|
+
|
|
190
|
+
},
|
|
191
|
+
mounted () {
|
|
192
|
+
this.$nextTick(() => {
|
|
193
|
+
let myEditorContent = this.$refs.editorContent
|
|
194
|
+
console.log(myEditorContent, 'myEditorContent');
|
|
195
|
+
myEditorContent.addEventListener("paste", (e) => {
|
|
196
|
+
let { files } = e.clipboardData
|
|
197
|
+
console.log(files, e.clipboardData, 'filesfilesfilesfiles');
|
|
198
|
+
if (files.length > 0) {
|
|
199
|
+
for (let index = 0; index < files.length; index++) {
|
|
200
|
+
let uid = uuidv4()
|
|
201
|
+
if (files[index].type.indexOf('image') != -1) {
|
|
202
|
+
this.imgUploadCallback(files[index], uid, index)
|
|
203
|
+
e.preventDefault();
|
|
204
|
+
} else {
|
|
205
|
+
this.fileUploadCallback(files[index], uid)
|
|
206
|
+
e.preventDefault();
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
})
|
|
211
|
+
myEditorContent.addEventListener("dragenter", function () {
|
|
212
|
+
});
|
|
213
|
+
myEditorContent.addEventListener("dragover", function (e) {
|
|
214
|
+
e.preventDefault();
|
|
215
|
+
});
|
|
216
|
+
myEditorContent.addEventListener("drop", (e) => {
|
|
217
|
+
e.preventDefault();
|
|
218
|
+
let files = e.dataTransfer.files; // 这个就相当于文件上传组件
|
|
219
|
+
if (files.length > 0) {
|
|
220
|
+
for (let index = 0; index < files.length; index++) {
|
|
221
|
+
let uid = uuidv4()
|
|
222
|
+
if (files[index].type.indexOf('image') != -1) {
|
|
223
|
+
this.imgUploadCallback(files[index], uid, index)
|
|
224
|
+
e.preventDefault();
|
|
225
|
+
} else {
|
|
226
|
+
this.fileUploadCallback(files[index], uid)
|
|
227
|
+
e.preventDefault();
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}, false);
|
|
232
|
+
})
|
|
233
|
+
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
</script>
|
|
237
|
+
|
|
238
|
+
<style lang="less" scoped>
|
|
239
|
+
.my_editor {
|
|
240
|
+
width: 100%;
|
|
241
|
+
border: 1px solid #e0e6f7;
|
|
242
|
+
border-radius: 9px !important;
|
|
243
|
+
background: #ffffff;
|
|
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: #366aff;
|
|
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: #b3b3b3;
|
|
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: #366aff;
|
|
309
|
+
font-size: 14px;
|
|
310
|
+
border-bottom: 1px solid #e0e6f7;
|
|
311
|
+
|
|
312
|
+
.button {
|
|
313
|
+
padding: 5px 8px;
|
|
314
|
+
background: #ffffff;
|
|
315
|
+
border: none;
|
|
316
|
+
border-radius: 2px;
|
|
317
|
+
svg {
|
|
318
|
+
fill: #366aff;
|
|
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 #366aff;
|
|
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
|
+
</style>
|