zydx-plus 1.32.192 → 1.32.194
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
CHANGED
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
<img :src="menusData('signMenu')?.ico" alt=""/>
|
|
36
36
|
<span>{{ menusData('signMenu')?.text }}</span>
|
|
37
37
|
</div>
|
|
38
|
-
<editor-content
|
|
38
|
+
<editor-content class="editing-cont" :editor="editor"></editor-content>
|
|
39
39
|
</div>
|
|
40
40
|
</div>
|
|
41
41
|
<div class="complete" v-if="!readOnly && toolbar.length > 0">
|
|
@@ -59,6 +59,12 @@
|
|
|
59
59
|
<button class="but" @click="imgCancel">取消</button>
|
|
60
60
|
</div>
|
|
61
61
|
</div>
|
|
62
|
+
<div v-if="loading" class="loading-back">
|
|
63
|
+
<div class="loading-cont">
|
|
64
|
+
<div class="loadings">Loading</div>
|
|
65
|
+
</div>
|
|
66
|
+
</div>
|
|
67
|
+
<div class="down-html" id="test" v-html="htmlArr2"></div>
|
|
62
68
|
</div>
|
|
63
69
|
</template>
|
|
64
70
|
|
|
@@ -98,7 +104,9 @@ export default {
|
|
|
98
104
|
imgType: '', // 图片类型
|
|
99
105
|
htmlArr: [],
|
|
100
106
|
editableShow: true,
|
|
101
|
-
wit: 0
|
|
107
|
+
wit: 0,
|
|
108
|
+
htmlArr2: [],
|
|
109
|
+
loading: false
|
|
102
110
|
}
|
|
103
111
|
},
|
|
104
112
|
props: {
|
|
@@ -248,8 +256,9 @@ export default {
|
|
|
248
256
|
},
|
|
249
257
|
emits: ['confirm', 'enclosure'],
|
|
250
258
|
methods: {
|
|
251
|
-
signMenu() { // 签名菜单
|
|
259
|
+
signMenu(next) { // 签名菜单
|
|
252
260
|
this.signMenuShow = !this.signMenuShow
|
|
261
|
+
next(this.signMenuShow)
|
|
253
262
|
},
|
|
254
263
|
titleMenu(next) { // 标题菜单
|
|
255
264
|
next(this.classShow('title'))
|
|
@@ -269,7 +278,8 @@ export default {
|
|
|
269
278
|
classShow(v) {
|
|
270
279
|
if(!this.readOnly) return
|
|
271
280
|
let state = false
|
|
272
|
-
const
|
|
281
|
+
const ed = document.getElementsByClassName('z-editor')[0]
|
|
282
|
+
const cls = ed.getElementsByClassName(v)
|
|
273
283
|
for (let i = 0; i < cls.length; i++) {
|
|
274
284
|
if (cls[i].style.display === 'none') {
|
|
275
285
|
cls[i].style.display = 'block'
|
|
@@ -282,19 +292,66 @@ export default {
|
|
|
282
292
|
this.readOnlyPage()
|
|
283
293
|
return state
|
|
284
294
|
},
|
|
295
|
+
// 下载word
|
|
285
296
|
exportToWord() {
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
297
|
+
let that = this
|
|
298
|
+
that.loading = true
|
|
299
|
+
that.htmlArr2 = ''
|
|
300
|
+
let arr = []
|
|
301
|
+
let imgArr = []
|
|
302
|
+
let imgIndex = 0
|
|
303
|
+
const data = document.querySelectorAll('.editing-cont')[0].childNodes[0].childNodes
|
|
304
|
+
for (let i = 0; i < data.length; i++) {
|
|
305
|
+
if(data[i].firstChild.localName === 'img') {
|
|
306
|
+
that.imgBase64(data[i]).then(res => {
|
|
307
|
+
imgArr.push(res)
|
|
308
|
+
})
|
|
309
|
+
arr.push(imgIndex)
|
|
310
|
+
imgIndex++
|
|
311
|
+
}else {
|
|
312
|
+
arr.push(data[i].outerHTML)
|
|
313
|
+
}
|
|
294
314
|
}
|
|
295
|
-
|
|
315
|
+
setTimeout(() => {
|
|
316
|
+
for (let i = 0; i < arr.length; i++) {
|
|
317
|
+
if(typeof arr[i] === 'number') {
|
|
318
|
+
that.htmlArr2 += imgArr[arr[i]]
|
|
319
|
+
}else {
|
|
320
|
+
that.htmlArr2 += arr[i]
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
setTimeout(() => {
|
|
324
|
+
const wrap = document.getElementById('test')
|
|
325
|
+
const config = {
|
|
326
|
+
addStyle: true, // 是否导出样式,默认为true,此操作会将所有样式转换成行内样式导出
|
|
327
|
+
fileName: this.fileName, // 导出文件名
|
|
328
|
+
// toImg:['.editor-img'], // 页面哪些部分需要转化成图片,例如echart图表之类
|
|
329
|
+
success() {
|
|
330
|
+
that.loading = false
|
|
331
|
+
} // 完成之后回调,一般页面篇幅比较大,时间比较长
|
|
332
|
+
}
|
|
333
|
+
exportWord(wrap, config)
|
|
334
|
+
},100)
|
|
335
|
+
},1000)
|
|
336
|
+
|
|
296
337
|
},
|
|
297
|
-
|
|
338
|
+
imgBase64 (data) {
|
|
339
|
+
return new Promise((res, rej) => {
|
|
340
|
+
const img = new Image()
|
|
341
|
+
img.src = data.firstChild.src
|
|
342
|
+
img.crossOrigin= 'anonymous' // 解决跨域
|
|
343
|
+
img.onload = function () {
|
|
344
|
+
const canvas = document.createElement('canvas')
|
|
345
|
+
canvas.width = img.width
|
|
346
|
+
canvas.height = img.height
|
|
347
|
+
const ctx = canvas.getContext('2d')
|
|
348
|
+
ctx.drawImage(img, 0, 0, img.width, img.height)
|
|
349
|
+
const dataURL = canvas.toDataURL('image/png')
|
|
350
|
+
res(`<p class="img-cont"><img class="editor-img" src="${dataURL}" alt="" /></p>`)
|
|
351
|
+
}
|
|
352
|
+
})
|
|
353
|
+
},
|
|
354
|
+
readOnlyPage() { // 只读分页
|
|
298
355
|
this.htmlArr = []
|
|
299
356
|
const data = document.querySelectorAll('.editing-cont')[0].childNodes[0].childNodes
|
|
300
357
|
this.wit = document.getElementsByClassName('editor-content')[0].offsetWidth
|
|
@@ -456,8 +513,13 @@ export default {
|
|
|
456
513
|
})
|
|
457
514
|
} else {
|
|
458
515
|
up.customInsert(res, (data) => {
|
|
459
|
-
const
|
|
516
|
+
const cla = this.randomId()
|
|
517
|
+
const html = `<p class="imgCont ${cla}"><img src="${data}" alt="" /></p>`
|
|
460
518
|
this.editor.chain().focus().insertContentAt(this.selection(), html).run()
|
|
519
|
+
if(this.selection() <= 6) this.selectionClass2(cla)
|
|
520
|
+
if(this.selectionClass(cla)) {
|
|
521
|
+
this.editor.chain().focus().insertContentAt(this.selection(), '<p></p>').run()
|
|
522
|
+
}
|
|
461
523
|
})
|
|
462
524
|
}
|
|
463
525
|
up.onSuccess(file, res) // 上传成功回调
|
|
@@ -497,8 +559,40 @@ export default {
|
|
|
497
559
|
imgConfirm() {
|
|
498
560
|
this.imgPop = false
|
|
499
561
|
if (this.imgUrl === '') return
|
|
500
|
-
const
|
|
562
|
+
const cla = this.randomId()
|
|
563
|
+
const html = `<p class="imgCont ${cla}"><img src="${this.imgUrl}" alt="" /></p>`
|
|
501
564
|
this.editor.chain().focus().insertContentAt(this.selection(), html).run()
|
|
565
|
+
if(this.selection() <= 6) this.selectionClass2(cla)
|
|
566
|
+
if(this.selectionClass(cla)) {
|
|
567
|
+
this.editor.chain().focus().insertContentAt(this.selection(), '<p></p>').run()
|
|
568
|
+
}
|
|
569
|
+
},
|
|
570
|
+
randomId() {
|
|
571
|
+
const id = Math.random().toString(36).substr(2)
|
|
572
|
+
return id.replace(/[0-9]/g, '')
|
|
573
|
+
},
|
|
574
|
+
// 查询class
|
|
575
|
+
selectionClass(v) {
|
|
576
|
+
const json = this.editor.getJSON()
|
|
577
|
+
for (let i = 0; i < json.content.length; i++) {
|
|
578
|
+
const val = json.content[i].attrs?.titleId?.split(' ')[1]
|
|
579
|
+
if (val === v) {
|
|
580
|
+
if(json.content[i+1] === undefined) return true
|
|
581
|
+
break
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
return false
|
|
585
|
+
},
|
|
586
|
+
selectionClass2(v) {
|
|
587
|
+
const json = this.editor.getJSON()
|
|
588
|
+
for (let i = 0; i < json.content.length; i++) {
|
|
589
|
+
const val = json.content[i].attrs?.titleId?.split(' ')[1]
|
|
590
|
+
if (val === v) {
|
|
591
|
+
json.content.splice(i - 1, 1)
|
|
592
|
+
this.editor?.commands.setContent(json)
|
|
593
|
+
break
|
|
594
|
+
}
|
|
595
|
+
}
|
|
502
596
|
},
|
|
503
597
|
// 取消图片地址
|
|
504
598
|
imgCancel() {
|
|
@@ -698,6 +792,24 @@ export default {
|
|
|
698
792
|
</script>
|
|
699
793
|
|
|
700
794
|
<style scoped>
|
|
795
|
+
:deep(.ProseMirror-separator) {
|
|
796
|
+
display: none !important;
|
|
797
|
+
}
|
|
798
|
+
.down-html{
|
|
799
|
+
position: fixed;
|
|
800
|
+
top: -9999px;
|
|
801
|
+
left: 0;
|
|
802
|
+
z-index: -1;
|
|
803
|
+
width: 798px;
|
|
804
|
+
padding: 100px;
|
|
805
|
+
background-color: #fff;
|
|
806
|
+
box-sizing: border-box;
|
|
807
|
+
border: 1px solid #ccc;
|
|
808
|
+
margin: 10px 10px 20px 10px;
|
|
809
|
+
}
|
|
810
|
+
.down-html :deep(img){
|
|
811
|
+
padding: 5px 0;
|
|
812
|
+
}
|
|
701
813
|
.read-only {
|
|
702
814
|
position: relative;
|
|
703
815
|
margin: 0 auto;
|
|
@@ -749,6 +861,9 @@ label {
|
|
|
749
861
|
:deep(.editor-img) {
|
|
750
862
|
max-width: 100%;
|
|
751
863
|
}
|
|
864
|
+
:deep(.imgCont) {
|
|
865
|
+
line-height: 0 !important;
|
|
866
|
+
}
|
|
752
867
|
|
|
753
868
|
.img-pop {
|
|
754
869
|
position: absolute;
|
|
@@ -824,7 +939,10 @@ label {
|
|
|
824
939
|
}
|
|
825
940
|
|
|
826
941
|
.editing-cont :deep(p) {
|
|
827
|
-
line-height:
|
|
942
|
+
line-height: 30px;
|
|
943
|
+
}
|
|
944
|
+
.editing-cont :deep(img) {
|
|
945
|
+
padding: 5px 0;
|
|
828
946
|
}
|
|
829
947
|
|
|
830
948
|
li {
|
|
@@ -922,4 +1040,50 @@ li {
|
|
|
922
1040
|
width: 794px;
|
|
923
1041
|
min-height: 1123px;
|
|
924
1042
|
}
|
|
1043
|
+
.loading-back{
|
|
1044
|
+
position: absolute;
|
|
1045
|
+
top: 0;
|
|
1046
|
+
left: 0;
|
|
1047
|
+
right: 0;
|
|
1048
|
+
bottom: 0;
|
|
1049
|
+
z-index: 100;
|
|
1050
|
+
display: flex;
|
|
1051
|
+
align-items: center;
|
|
1052
|
+
}
|
|
1053
|
+
.loading-cont{
|
|
1054
|
+
display: inline-block;
|
|
1055
|
+
margin: 0 auto;
|
|
1056
|
+
}
|
|
1057
|
+
.loadings {
|
|
1058
|
+
display: inline-block;
|
|
1059
|
+
font-size: 28px;
|
|
1060
|
+
font-family: Arial, Helvetica, sans-serif;
|
|
1061
|
+
font-weight: bold;
|
|
1062
|
+
color: #fff;
|
|
1063
|
+
text-shadow: 0 0 2px #ff3d00, 0 0 1px #ff3d00, 0 0 1px #ff3d00;
|
|
1064
|
+
letter-spacing: 2px;
|
|
1065
|
+
position: relative;
|
|
1066
|
+
}
|
|
1067
|
+
|
|
1068
|
+
.loadings::after {
|
|
1069
|
+
content: "Loading";
|
|
1070
|
+
position: absolute;
|
|
1071
|
+
left: 0;
|
|
1072
|
+
top: 0;
|
|
1073
|
+
color: #ff3d00;
|
|
1074
|
+
width: 0%;
|
|
1075
|
+
height: 100%;
|
|
1076
|
+
overflow: hidden;
|
|
1077
|
+
animation: loading-animation 6s linear infinite;
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1080
|
+
@keyframes loading-animation {
|
|
1081
|
+
0% {
|
|
1082
|
+
width: 0;
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
100% {
|
|
1086
|
+
width: 100%;
|
|
1087
|
+
}
|
|
1088
|
+
}
|
|
925
1089
|
</style>
|
|
@@ -264,6 +264,10 @@ export default {
|
|
|
264
264
|
return x
|
|
265
265
|
})
|
|
266
266
|
},
|
|
267
|
+
randomId() { // 生成随机id
|
|
268
|
+
const id = Math.random().toString(36).substr(2)
|
|
269
|
+
return id.replace(/[0-9]/g, '')
|
|
270
|
+
},
|
|
267
271
|
del(index) {
|
|
268
272
|
if(this.uploadAttData[index].name === undefined) {
|
|
269
273
|
this.uploadAttData[index].active = false
|
|
@@ -339,26 +343,36 @@ export default {
|
|
|
339
343
|
},
|
|
340
344
|
imgHtml(data) {
|
|
341
345
|
const url = this.uploadImage.url + data
|
|
342
|
-
const
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
},
|
|
351
|
-
tag: 'img',
|
|
352
|
-
node: "element",
|
|
353
|
-
}],
|
|
354
|
-
}
|
|
355
|
-
]
|
|
356
|
-
this.insertContent(html)
|
|
346
|
+
const cla = this.randomId()
|
|
347
|
+
const html = `<p class="imgCont ${cla}"><img src="${url}" alt="" /></p>`
|
|
348
|
+
this.editor.chain().focus().insertContentAt(this.selection(),html).run()
|
|
349
|
+
console.log(this.selection())
|
|
350
|
+
if(this.selection() <= 6) this.selectionClass2(cla)
|
|
351
|
+
if(this.selectionClass(cla)) {
|
|
352
|
+
this.editor.chain().focus().insertContentAt(this.selection(), '<p></p>').run()
|
|
353
|
+
}
|
|
357
354
|
},
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
355
|
+
// 查询class
|
|
356
|
+
selectionClass(v) {
|
|
357
|
+
const json = this.editor.getJSON()
|
|
358
|
+
for (let i = 0; i < json.content.length; i++) {
|
|
359
|
+
const val = json.content[i].attrs?.titleId?.split(' ')[1]
|
|
360
|
+
if (val === v) {
|
|
361
|
+
if(json.content[i+1] === undefined) return true
|
|
362
|
+
break
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
return false
|
|
366
|
+
},
|
|
367
|
+
selectionClass2(v) {
|
|
368
|
+
const json = this.editor.getJSON()
|
|
369
|
+
for (let i = 0; i < json.content.length; i++) {
|
|
370
|
+
const val = json.content[i].attrs?.titleId?.split(' ')[1]
|
|
371
|
+
if (val === v) {
|
|
372
|
+
json.content.splice(i - 1, 1)
|
|
373
|
+
this.editor?.commands.setContent(json)
|
|
374
|
+
break
|
|
375
|
+
}
|
|
362
376
|
}
|
|
363
377
|
},
|
|
364
378
|
enclosureContent(v) {
|
|
@@ -423,21 +437,27 @@ export default {
|
|
|
423
437
|
</script>
|
|
424
438
|
|
|
425
439
|
<style scoped>
|
|
440
|
+
:deep(.imgCont) {
|
|
441
|
+
line-height: 0 !important;
|
|
442
|
+
}
|
|
443
|
+
:deep(.ProseMirror-separator) {
|
|
444
|
+
display: none !important;
|
|
445
|
+
}
|
|
426
446
|
.editor :deep(h1) {
|
|
427
|
-
line-height:
|
|
447
|
+
line-height: 30px;
|
|
428
448
|
font-size: 18px;
|
|
429
449
|
}
|
|
430
450
|
.editor :deep(h2) {
|
|
431
|
-
line-height:
|
|
451
|
+
line-height: 30px;
|
|
432
452
|
font-size: 16px;
|
|
433
453
|
}
|
|
434
454
|
.editor :deep(h3) {
|
|
435
|
-
line-height:
|
|
455
|
+
line-height: 30px;
|
|
436
456
|
font-size: 14px;
|
|
437
457
|
}
|
|
438
458
|
.editor :deep(p) {
|
|
439
459
|
font-size: 14px;
|
|
440
|
-
line-height:
|
|
460
|
+
line-height: 30px;
|
|
441
461
|
}
|
|
442
462
|
:deep(.ProseMirror) p.is-editor-empty:first-child::before {
|
|
443
463
|
content: attr(data-placeholder);
|
|
@@ -457,7 +477,8 @@ export default {
|
|
|
457
477
|
pointer-events: none;
|
|
458
478
|
}
|
|
459
479
|
:deep(.editor-img){
|
|
460
|
-
max-width: 100
|
|
480
|
+
max-width: calc(100% - 4em);
|
|
481
|
+
padding: 2px 0;
|
|
461
482
|
}
|
|
462
483
|
.editor-but{
|
|
463
484
|
text-align: right;
|
|
@@ -512,12 +533,12 @@ export default {
|
|
|
512
533
|
padding: 5px 0;
|
|
513
534
|
}
|
|
514
535
|
.ed-cont{
|
|
515
|
-
padding:
|
|
536
|
+
padding: 5px 0 0;
|
|
516
537
|
}
|
|
517
538
|
.editor{
|
|
518
539
|
border-radius: 3px;
|
|
519
|
-
padding: 10px;
|
|
520
540
|
outline: none;
|
|
541
|
+
text-indent: 2em;
|
|
521
542
|
}
|
|
522
543
|
.editor img{
|
|
523
544
|
max-width: 100%;
|
|
@@ -176,8 +176,12 @@ export default {
|
|
|
176
176
|
},
|
|
177
177
|
getContent() {
|
|
178
178
|
let arr = []
|
|
179
|
+
let state = false
|
|
179
180
|
for(let i=0; i< this.question.length; i++) {
|
|
180
|
-
if(this.question[i].allScore === '-' || this.question[i].count === '-')
|
|
181
|
+
if(this.question[i].allScore === '-' || this.question[i].count === '-') {
|
|
182
|
+
state = true
|
|
183
|
+
continue;
|
|
184
|
+
}
|
|
181
185
|
arr.push({
|
|
182
186
|
...this.question[i],
|
|
183
187
|
easyScore: this.question[i].easy? this.question[i].easyScore: '',
|
|
@@ -191,6 +195,7 @@ export default {
|
|
|
191
195
|
return {
|
|
192
196
|
data: arr,
|
|
193
197
|
total: this.totalNum,
|
|
198
|
+
state: state
|
|
194
199
|
}
|
|
195
200
|
},
|
|
196
201
|
// 添加数据
|