zydx-plus 1.32.292 → 1.32.294

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zydx-plus",
3
- "version": "1.32.292",
3
+ "version": "1.32.294",
4
4
  "description": "Vue.js",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -199,7 +199,7 @@ let buttonNames = {
199
199
  lowLevel: {
200
200
  default: "setTask",
201
201
  setTask: '布置任务',
202
- duplicate: '违纪查重',
202
+ // duplicate: '违纪查重',
203
203
  teacherReview: '教师评价',
204
204
  studentReview: '同学互评',
205
205
  studyRecord: '学习记录',
@@ -335,7 +335,7 @@ let buttonNames = {
335
335
  default: "setTask",
336
336
  setTask: '布置任务',
337
337
  teacherAnswer: '教师答疑',
338
- duplicate: '违纪查重',
338
+ // duplicate: '违纪查重',
339
339
  teacherReview: '教师评价',
340
340
  studentReview: '同学互评',
341
341
  studyRecord: '学习记录',
@@ -381,7 +381,7 @@ let buttonNames = {
381
381
  lowLevel: {
382
382
  default: "setTask",
383
383
  setTask: '布置任务',
384
- duplicate: '违纪查重',
384
+ // duplicate: '违纪查重',
385
385
  teacherReview: '教师评价',
386
386
  studentReview: '同学互评',
387
387
  studyRecord: '学习记录',
@@ -648,7 +648,7 @@ let buttonNames = {
648
648
  default: "setTask",
649
649
  setTask: '布置任务',
650
650
  // groupStudy: '小组学习',
651
- duplicate: '违纪查重',
651
+ // duplicate: '违纪查重',
652
652
  teacherReview: '教师评价',
653
653
  studentReview: '同学互评',
654
654
  studyRecord: '学习记录',
@@ -9,8 +9,23 @@
9
9
  <img :src="imgArr[(oneIndex === 'right')? pageIndex-1: pageIndex]" alt=""/>
10
10
  </div>
11
11
  <div class="wrap-can" ref="wrapCan">
12
- <canvas @mousedown="mouseDown" @mousemove="mouseMove" :id="id"></canvas>
13
- <!-- <div class="cursor" :style="cursorRounded"></div>-->
12
+ <canvas @click.stop="turnText" class="wrap-can-one" @mousedown.stop="mouseDown" @mousemove.stop="mouseMove" :id="id"></canvas>
13
+ <canvas :id="`${id}2`"></canvas>
14
+ <div
15
+ v-show="state === 'text'&&textY2>0&&textX2>0"
16
+ class="text-frame"
17
+ @mousedown.stop="textMouseDown"
18
+ @dblclick="textDblclick"
19
+ :style="{
20
+ top: textY2/sratio + 'px',
21
+ left: textX2/sratio + 'px',
22
+ 'min-height': textHeight +'px',
23
+ border: `1px dashed ${color}`,
24
+ 'min-width': textWidth + 'px',
25
+ cursor: contenteditable? 'text': 'move'
26
+ }">
27
+ <div class="text-input" ref="textInput" :style="{'font-size': fontSize + 'px',color: color}" :contenteditable="contenteditable"></div>
28
+ </div>
14
29
  </div>
15
30
  </div>
16
31
  <div class="page-but-left" :style="{cursor: pageIndex === 1?'default':'pointer'}"
@@ -28,6 +43,82 @@
28
43
  </button>
29
44
  </div>
30
45
  </div>
46
+ <div class="flip-tool" @click="flipTool" :style="{height: flipToolShow? '600px': '25px', overflow: flipToolShow2? 'visible':'hidden'}">
47
+ <div class="tool-text" v-if="!flipToolShow">
48
+ <span>阅读笔</span>
49
+ </div>
50
+ <div class="tool-list" :style="{transform: `translateY(${flipToolShow? '0':'-130%'})`}">
51
+ <div v-if="setShow" class="set" :style="{top: top + 'px'}">
52
+ <div class="set-list set-text" v-if="state === 'text'">
53
+ <span>文字字号</span>
54
+ <em v-for="(item) in textData" :style="{color: fontSize === Number(item)? 'rgba(198, 76, 16, 1)': '#000'}" @click.stop="textSizeTap(item)">{{ item }}</em>
55
+ </div>
56
+ <div class="set-list" v-else>
57
+ <span>线条粗细</span>
58
+ <em v-for="(item) in strokeData" :style="{color: lineWidth === Number(item)? 'rgba(198, 76, 16, 1)': '#000'}" @click.stop="strokeTap(item)">{{ item }}</em>
59
+ </div>
60
+ <div class="set-list">
61
+ <span>线条颜色</span>
62
+ <i v-for="(item) in strokeColor" @click.stop="strokeColTap(item)" :style="{'background-color': item === color? '#fff': item, border: `4px solid ${item}`}"></i>
63
+ </div>
64
+ </div>
65
+ <div class="tool-item" :class="{'tool-item-active': state === null}" @click.stop="mouse">
66
+ <div class="tool-item-img">
67
+ <img src="./img/shubiao.png" alt=""/>
68
+ </div>
69
+ </div>
70
+ <div class="tool-item" :class="{'tool-item-active': state === 'brush'}" @click.stop="brush">
71
+ <div class="tool-item-img">
72
+ <img src="./img/huabi.png" alt=""/>
73
+ </div>
74
+ </div>
75
+ <div class="tool-item" :class="{'tool-item-active': state === 'text'}" @click.stop="textTap">
76
+ <div class="tool-item-img">
77
+ <img src="./img/wenzi.png" alt=""/>
78
+ </div>
79
+ </div>
80
+ <div class="tool-item" :class="{'tool-item-active': state === 'rectangle'}" @click.stop="rectangleTap">
81
+ <div class="tool-item-img">
82
+ <img src="./img/juxing.png" alt=""/>
83
+ </div>
84
+ </div>
85
+ <div class="tool-item" :class="{'tool-item-active': state === 'circula'}" @click.stop="circularTap">
86
+ <div class="tool-item-img">
87
+ <img src="./img/yuan.png" alt=""/>
88
+ </div>
89
+ </div>
90
+ <div class="tool-item" :class="{'tool-item-active': state === 'straight'}" @click.stop="straightTap">
91
+ <div class="tool-item-img">
92
+ <img src="./img/jian.png" alt=""/>
93
+ </div>
94
+ </div>
95
+ <div class="tool-item" :class="{'tool-item-active': state === 'arrow'}" @click.stop="arrowTap">
96
+ <div class="tool-item-img">
97
+ <img src="./img/jiantou.png" alt=""/>
98
+ </div>
99
+ </div>
100
+ <div class="tool-item" @click.stop="backward">
101
+ <div class="tool-item-img">
102
+ <img src="./img/houtui.png" alt=""/>
103
+ </div>
104
+ </div>
105
+ <div class="tool-item" @click.stop="preserve">
106
+ <div class="tool-item-img">
107
+ <img src="./img/baocun.png" alt=""/>
108
+ </div>
109
+ </div>
110
+ <div class="tool-item" @click.stop="empty">
111
+ <div class="tool-item-img">
112
+ <img src="./img/xiangpi.png" alt=""/>
113
+ </div>
114
+ </div>
115
+ <div class="tool-item">
116
+ <div class="tool-item-img">
117
+ <img src="./img/guanbi.png" alt=""/>
118
+ </div>
119
+ </div>
120
+ </div>
121
+ </div>
31
122
  <div v-if="loading" class="loading-back">
32
123
  <div class="loading-cont">
33
124
  <div class="loadings">Loading</div>
@@ -40,6 +131,7 @@
40
131
  import * as PdfJs from 'pdfjs-dist/legacy/build/pdf.js' // 注意导入的写法d
41
132
  PdfJs.GlobalWorkerOptions.workerSrc = require('pdfjs-dist/build/pdf.worker.entry')
42
133
  const jsdelivr = '/zydx/static/cmaps/'
134
+
43
135
  export default {
44
136
  name: "zydx-flip",
45
137
  data() {
@@ -71,6 +163,33 @@ export default {
71
163
  ctx: null,
72
164
  lineWidth: 2,
73
165
  points: [],
166
+ setShow: false,
167
+ flipToolShow2: false,
168
+ flipToolShow: false,
169
+ strokeData: ['1', '2', '3', '4', '5', '6', '7'], // 画笔数据
170
+ strokeColor: ['#000', '#f00', '#0f0', '#00f', '#f0f', '#ff0', '#0ff'], // 画笔颜色
171
+ textData: ['14', '16', '18', '20', '22', '24'], // 文本数据
172
+ color: '#000',
173
+ text: '',
174
+ state: null,
175
+ top: 0,
176
+ fontSize: 14,
177
+ textX: 0,
178
+ textY: 0,
179
+ textX2: 0,
180
+ textY2: 0,
181
+ textStart: false,
182
+ contenteditable: false,
183
+ linkId: null,
184
+ pointsSelect: [],
185
+ checkDrawing: false,
186
+ checkX: 0,
187
+ checkY: 0,
188
+ textWidth: 0,
189
+ textHeight: 0,
190
+ textDownX: 0,
191
+ textDownY: 0,
192
+ textMoveStart: false,
74
193
  }
75
194
  },
76
195
  props: {
@@ -144,15 +263,269 @@ export default {
144
263
  emits: ['flip','updateData'],
145
264
  mounted() {
146
265
  this.id = 'canvas-wrap' + Math.random().toString(36).substr(2)
266
+ window.addEventListener('keydown', this.handleKeyEvent)
147
267
  // 在画板以外松开鼠标后冻结画笔
148
268
  document.onmouseup = () => {
149
- if (this.isDrawing) this.mouseUp()
269
+ if (this.isDrawing || this.checkDrawing) this.mouseUp()
270
+ this.textMoveStart = false
150
271
  }
151
272
  },
273
+ beforeDestroy() {
274
+ window.removeEventListener('keydown', this.handleKeyEvent)
275
+ },
152
276
  methods: {
277
+ handleKeyEvent(e) {
278
+ const {key} = e
279
+ if (key === 'Backspace' || key === 'Delete') {
280
+ this.backward()
281
+ }
282
+ },
283
+ empty() {
284
+ this.setShow = false
285
+ this.points = []
286
+ this.clearRect(true)
287
+ },
288
+ preserve() {
289
+ this.setShow = false
290
+ this.$emit('updateData', this.points)
291
+ },
292
+ // 后退
293
+ backward() {
294
+ this.setShow = false
295
+ if(this.points.length === 0) return
296
+ if(this.points[this.points.length - 1].type === 'line') {
297
+ const id = this.points[this.points.length - 1].id
298
+ for(let i = 0; i < this.points.length; i++) {
299
+ if(this.points[i].id === id) {
300
+ this.points.splice(i,1)
301
+ i--
302
+ }
303
+ }
304
+ }else {
305
+ this.points.pop()
306
+ }
307
+ this.clearRect()
308
+ },
309
+ // 鼠标
310
+ mouse() {
311
+ this.state = null
312
+ this.setShow = false
313
+ },
314
+ // 画笔
315
+ brush() {
316
+ this.state = 'brush'
317
+ this.setShow = true
318
+ this.top = 60
319
+ },
320
+ // 文字字号
321
+ textSizeTap(v) {
322
+ this.fontSize = Number(v)
323
+ },
324
+ // 矩形
325
+ rectangleTap() {
326
+ this.state = 'rectangle'
327
+ this.setShow = true
328
+ this.top = 60*3
329
+ },
330
+ // 圆形
331
+ circularTap() {
332
+ this.state = 'circular'
333
+ this.setShow = true
334
+ this.top = 60*4
335
+ },
336
+ // 直线
337
+ straightTap() {
338
+ this.state = 'straight'
339
+ this.setShow = true
340
+ this.top = 60*5
341
+ },
342
+ // 箭头
343
+ arrowTap() {
344
+ this.state = 'arrow'
345
+ this.setShow = true
346
+ this.top = 60*6
347
+ },
348
+ // 文字
349
+ textTap() {
350
+ this.state = 'text'
351
+ this.setShow = true
352
+ this.top = 60*2
353
+ this.textStart = true
354
+ this.textX2 = 0
355
+ this.textY2 = 0
356
+ this.textWidth = 100
357
+ this.textHeight = this.fontSize + 1
358
+ this.$refs.textInput.innerText = ''
359
+ },
360
+ flipTool() {
361
+ this.setShow = false
362
+ this.textShow = false
363
+ this.flipToolShow = !this.flipToolShow
364
+ if(this.flipToolShow) {
365
+ setTimeout(() => {
366
+ this.flipToolShow2 = true
367
+ }, 600)
368
+ } else {
369
+ this.flipToolShow2 = false
370
+ }
371
+ },
372
+ strokeColTap(v) {
373
+ this.color = v
374
+ },
375
+ strokeTap(v) {
376
+ this.lineWidth = Number(v)
377
+ },
378
+ // 查询当前点击的图形
379
+ checkDown(e) {
380
+ e = e || event
381
+ e.preventDefault()
382
+ let obj = {
383
+ x: e.offsetX*this.sratio,
384
+ y: e.offsetY*this.sratio
385
+ }
386
+ this.checkX = obj.x
387
+ this.checkY = obj.y
388
+ this.pointsSelect = []
389
+ for(let i = 0; i < this.points.length; i++) {
390
+ if (this.points[i].index === this.pageIndex) {
391
+ const x1 = this.points[i].x*this.scales/this.points[i].scale
392
+ const y1 = this.points[i].y*this.scales/this.points[i].scale
393
+ // 判断点击的是否是圆
394
+ if(this.points[i]?.type === 'circular') {
395
+ const x2 = this.points[i].x*this.scales/this.points[i].scale + this.points[i].width*this.scales/this.points[i].scale
396
+ const y2 = this.points[i].y*this.scales/this.points[i].scale + this.points[i].width*this.scales/this.points[i].scale
397
+ const a = Math.sqrt(Math.pow(x1-obj.x,1.65)+Math.pow(y1-obj.y,1.65))
398
+ const b = Math.sqrt(Math.pow(x2-obj.x,1.65)+Math.pow(y2-obj.y,1.65))
399
+ const c = Math.sqrt(Math.pow(x1-obj.x,1.65)+Math.pow(y2-obj.y,1.65))
400
+ const d = Math.sqrt(Math.pow(x2-obj.x,1.65)+Math.pow(y1-obj.y,1.65))
401
+ const e = this.points[i].width*this.scales/this.points[i].scale/2
402
+ if(a <= e || b <= e || c <= e || d <= e) {
403
+ this.pointsSelect.push(this.points[i])
404
+ this.circularProcessing(this.points[i],{x:0,y:0})
405
+ this.points.splice(i,1)
406
+ }
407
+ }
408
+ if(this.points[i]?.type === 'text') {
409
+ // 取最长的一行文字
410
+ let len = 0
411
+ this.points[i].text.forEach(item => {
412
+ if(item.length > len) len = item.length
413
+ })
414
+ const x2 = this.points[i].x*this.scales/this.points[i].scale + len*this.points[i].size*this.sratio
415
+ const y2 = this.points[i].y*this.scales/this.points[i].scale + len*this.points[i].size*this.sratio
416
+ if(obj.x >= x1 && obj.x <= x2 && obj.y >= y1 && obj.y <= y2) {
417
+ this.state = 'text'
418
+ this.textX2 = x1
419
+ this.textY2 = y1
420
+ this.textWidth = 'auto'
421
+ this.color = this.points[i].color
422
+ this.textHeight = this.points[i].text.length*this.points[i].size + 1
423
+ this.$refs.textInput.innerText = this.points[i].text.join('\n')
424
+ this.points.splice(i,1)
425
+ this.clearRect()
426
+ }
427
+ }
428
+ if(this.points[i]?.type === 'rectangle') {
429
+ const x2 = this.points[i].x*this.scales/this.points[i].scale + this.points[i].width*this.scales/this.points[i].scale
430
+ const y2 = this.points[i].y*this.scales/this.points[i].scale + this.points[i].height*this.scales/this.points[i].scale
431
+ if(obj.x >= x1 && obj.x <= x2 && obj.y >= y1 && obj.y <= y2) {
432
+ this.pointsSelect.push(this.points[i])
433
+ this.rectangleProcessing(this.points[i],{x:0,y:0})
434
+ this.points.splice(i,1)
435
+ }
436
+ }
437
+ if(this.points[i]?.type === 'line') {
438
+ const x2 = this.points[i+1]?this.points[i+1].x*this.scales/this.points[i].scale:0
439
+ const y2 = this.points[i+1]?this.points[i+1].y*this.scales/this.points[i].scale:0
440
+ const x3 = obj.x
441
+ const y3 = obj.y
442
+ const a = Math.abs((x1-x2)*(y1-y3)-(x1-x3)*(y1-y2))
443
+ const b = Math.sqrt(Math.pow(x1-x2,2)+Math.pow(y1-y2,2))
444
+ const c = Math.sqrt(Math.pow(x1-x3,2)+Math.pow(y1-y3,2))
445
+ const d = Math.sqrt(Math.pow(x2-x3,2)+Math.pow(y2-y3,2))
446
+ if(a/b <= 5 && c <= b && d <= b) {
447
+ const id = this.points[i].id
448
+ for(let j=0; j<this.points.length; j++) {
449
+ if(this.points[j].id === id) {
450
+ this.pointsSelect.push(this.points[j])
451
+ this.lineProcessing(this.points[j],this.points[j+1],{x:0,y:0})
452
+ this.points.splice(j,1)
453
+ j--
454
+ }
455
+ }
456
+ }
457
+ }
458
+ if(this.points[i]?.type === 'straight' || this.points[i]?.type === 'arrow') {
459
+ const x2 = this.points[i].x2*this.scales/this.points[i].scale
460
+ const y2 = this.points[i].y2*this.scales/this.points[i].scale
461
+ const x3 = obj.x
462
+ const y3 = obj.y
463
+ const a = Math.abs((x1-x2)*(y1-y3)-(x1-x3)*(y1-y2))
464
+ const b = Math.sqrt(Math.pow(x1-x2,2)+Math.pow(y1-y2,2))
465
+ const c = Math.sqrt(Math.pow(x1-x3,2)+Math.pow(y1-y3,2))
466
+ const d = Math.sqrt(Math.pow(x2-x3,2)+Math.pow(y2-y3,2))
467
+ if(a/b <= 5 && c <= b && d <= b) {
468
+ this.pointsSelect.push(this.points[i])
469
+ if(this.points[i].type === 'straight') {
470
+ this.straightProcessing(this.points[i],{x:0,y:0})
471
+ }else {
472
+ this.arrowProcessing(this.points[i],{x:0,y:0})
473
+ }
474
+ this.points.splice(i,1)
475
+ }
476
+ }
477
+ }
478
+ }
479
+ },
480
+ checkMove(e) {
481
+ if(this.pointsSelect.length === 0) return
482
+ let obj = {
483
+ x: e.offsetX*this.sratio - this.checkX,
484
+ y: e.offsetY*this.sratio - this.checkY
485
+ }
486
+ this.clearRect()
487
+ for(let i=0; i<this.pointsSelect.length; i++) {
488
+ if(this.pointsSelect[i].type === 'line') {
489
+ this.lineProcessing(this.pointsSelect[i],this.pointsSelect[i+1],obj)
490
+ }
491
+ if(this.pointsSelect[i].type === 'rectangle') {
492
+ this.rectangleProcessing(this.pointsSelect[i],obj)
493
+ }
494
+ if(this.pointsSelect[i].type === 'straight') {
495
+ this.straightProcessing(this.pointsSelect[i],obj)
496
+ }
497
+ if(this.pointsSelect[i].type === 'arrow') {
498
+ this.arrowProcessing(this.pointsSelect[i],obj)
499
+ }
500
+ if(this.pointsSelect[i].type === 'circular') {
501
+ this.circularProcessing(this.pointsSelect[i],obj)
502
+ }
503
+ }
504
+ },
505
+ checkUp(e) {
506
+ let obj = {
507
+ x: e.offsetX*this.sratio - this.checkX,
508
+ y: e.offsetY*this.sratio - this.checkY
509
+ }
510
+ for(let i=0; i<this.pointsSelect.length; i++) {
511
+ this.pointsSelect[i].x = this.pointsSelect[i].x + obj.x
512
+ this.pointsSelect[i].y = this.pointsSelect[i].y + obj.y
513
+ if(this.pointsSelect[i].type === 'straight' || this.pointsSelect[i].type === 'arrow') {
514
+ this.pointsSelect[i].x2 = this.pointsSelect[i].x2 + obj.x
515
+ this.pointsSelect[i].y2 = this.pointsSelect[i].y2 + obj.y
516
+ }
517
+ this.points.push(this.pointsSelect[i])
518
+ }
519
+ },
153
520
  mouseDown (e) {
521
+ this.setShow = false
154
522
  e = e || event
155
523
  e.preventDefault()
524
+ if(this.state === null) {
525
+ this.checkDrawing = true
526
+ this.checkDown(e)
527
+ return
528
+ }
156
529
  this.isDrawing = true
157
530
  let obj = {
158
531
  x: e.offsetX*this.sratio,
@@ -160,9 +533,26 @@ export default {
160
533
  }
161
534
  this.drawStart(obj)
162
535
  },
536
+ textDblclick() {
537
+ if(!this.contenteditable) this.contenteditable = true
538
+ },
539
+ textMouseDown(e) {
540
+ e = e || event
541
+ this.textDownX = e.offsetX
542
+ this.textDownY = e.offsetY
543
+ this.textMoveStart = true
544
+ },
163
545
  mouseMove (e) {
164
546
  e = e || event
165
547
  e.preventDefault()
548
+ if(this.textMoveStart) {
549
+ this.textX2 = e.offsetX*this.sratio - this.textDownX
550
+ this.textY2 = e.offsetY*this.sratio - this.textDownY
551
+ }
552
+ if(this.state === null) {
553
+ if(this.checkDrawing) this.checkMove(e)
554
+ return
555
+ }
166
556
  if (this.isDrawing) {
167
557
  let obj = {
168
558
  x: e.offsetX*this.sratio,
@@ -174,6 +564,11 @@ export default {
174
564
  mouseUp (e) {
175
565
  e = e || event
176
566
  e.preventDefault()
567
+ if(this.state === null) {
568
+ this.checkDrawing = false
569
+ this.checkUp(e)
570
+ return
571
+ }
177
572
  let obj = {
178
573
  x: e.offsetX*this.sratio,
179
574
  y: e.offsetY*this.sratio
@@ -185,52 +580,349 @@ export default {
185
580
  drawStart (obj) {
186
581
  obj.index = this.pageIndex
187
582
  obj.start = 'start'
188
- obj.scale = this.scales
583
+ this.linkId = Math.random().toString(36).substr(2)
189
584
  this.startX = obj.x
190
585
  this.startY = obj.y
586
+ if(this.textStart) {
587
+ this.textX2 = obj.x
588
+ this.textY2 = obj.y
589
+ this.contenteditable = true
590
+ this.setShow = false
591
+ setTimeout(() => {
592
+ this.textStart = false
593
+ },500)
594
+ }
595
+ this.textX = obj.x
596
+ this.textY = obj.y
597
+ if(this.state === 'brush') this.line(obj)
598
+ if(this.state === 'rectangle') this.rectangle(obj)
599
+ if(this.state === 'circular') this.circular(obj)
600
+ if(this.state === 'straight') this.straight(obj)
601
+ if(this.state === 'arrow') this.arrow(obj)
602
+ },
603
+ drawEnd (obj) {
604
+ obj.index = this.pageIndex
605
+ obj.start = 'end'
606
+ if(this.state === 'brush') this.line(obj)
607
+ if(this.state === 'rectangle') this.rectangle(obj,'end')
608
+ if(this.state === 'circular') this.circular(obj,'end')
609
+ if(this.state === 'straight') this.straight(obj,'end')
610
+ if(this.state === 'arrow') this.arrow(obj,'end')
611
+ },
612
+ drawMove (obj) {
613
+ obj.index = this.pageIndex
614
+ obj.start = 'move'
615
+ if(this.state === 'brush') this.line(obj)
616
+ if(this.state === 'rectangle') this.rectangle(obj)
617
+ if(this.state === 'circular') this.circular(obj)
618
+ if(this.state === 'straight') this.straight(obj)
619
+ if(this.state === 'arrow') this.arrow(obj)
620
+ this.startY = obj.y
621
+ this.startX = obj.x
622
+ },
623
+ turnText() {
624
+ if(this.textStart) return
625
+ if(this.state === 'text') {
626
+ const text = this.$refs.textInput.innerText
627
+ this.contenteditable = false
628
+ this.state = null
629
+ if(text === '') return
630
+ this.addText(text)
631
+ }
632
+ },
633
+ // 添加文字
634
+ addText(v) {
635
+ let obj = {}
636
+ obj.index = this.pageIndex
637
+ obj.type = 'text'
638
+ obj.scale = this.scales
639
+ obj.color = this.color
640
+ obj.size = this.fontSize
641
+ obj.id = this.linkId
642
+ // 解析换行
643
+ const arr = v.split('\n')
644
+ for(let i = 0; i < arr.length; i++) {
645
+ this.ctx.beginPath();
646
+ this.ctx.font = `${this.fontSize*this.sratio}px 黑体`;
647
+ this.ctx.fillStyle = this.color;
648
+ this.ctx.fillText(arr[i],this.textX2,this.textY2 + this.fontSize*this.sratio*i + this.fontSize*this.sratio);
649
+ this.ctx.stroke()
650
+ this.ctx.closePath()
651
+ }
652
+ this.points.push({
653
+ x: this.textX2,
654
+ y: this.textY2,
655
+ text: arr,
656
+ index: obj.index,
657
+ type: obj.type,
658
+ scale: obj.scale,
659
+ id: obj.id,
660
+ color: obj.color,
661
+ size: obj.size,
662
+ })
663
+ },
664
+ // 画箭头
665
+ arrow(obj,type) {
666
+ obj.index = this.pageIndex
667
+ obj.type = 'arrow'
668
+ obj.scale = this.scales
669
+ obj.color = this.color
670
+ obj.border = this.lineWidth
671
+ obj.id = this.linkId
672
+ const angle = Math.atan2(this.textY - obj.y, this.textX - obj.x) * 180 / Math.PI
673
+ const angle1 = (angle + 20) * Math.PI / 180
674
+ const angle2 = (angle - 20) * Math.PI / 180
675
+ const topX = 30 * Math.cos(angle1)
676
+ const topY = 30 * Math.sin(angle1)
677
+ const botX = 30 * Math.cos(angle2)
678
+ const botY = 30 * Math.sin(angle2)
679
+ this.clearRect()
680
+ this.ctx.beginPath();
681
+ this.ctx.lineWidth = this.lineWidth * this.sratio
682
+ this.ctx.strokeStyle = this.color
683
+ let arrowX, arrowY
684
+ this.ctx.moveTo(this.textX, this.textY);
685
+ this.ctx.lineTo(obj.x, obj.y);
686
+ arrowX = obj.x + topX
687
+ arrowY = obj.y + topY
688
+ this.ctx.moveTo(arrowX, arrowY);
689
+ this.ctx.lineTo(obj.x, obj.y)
690
+ arrowX = obj.x + botX;
691
+ arrowY = obj.y + botY;
692
+ this.ctx.lineTo(arrowX, arrowY)
693
+ this.ctx.stroke()
694
+ this.ctx.closePath()
695
+ if(type === 'end') {
696
+ this.points.push({
697
+ x: this.textX,
698
+ y: this.textY,
699
+ x2: obj.x,
700
+ y2: obj.y,
701
+ index: obj.index,
702
+ type: obj.type,
703
+ scale: obj.scale,
704
+ id: obj.id,
705
+ color: obj.color,
706
+ border: obj.border,
707
+ })
708
+ }
709
+ },
710
+ // 画直线
711
+ straight(obj,type) {
712
+ obj.index = this.pageIndex
713
+ obj.type = 'straight'
714
+ obj.scale = this.scales
715
+ obj.color = this.color
716
+ obj.border = this.lineWidth
717
+ obj.id = this.linkId
718
+ this.clearRect()
191
719
  this.ctx.beginPath()
192
- this.ctx.strokeStyle = 'red'
193
- this.ctx.moveTo(this.startX, this.startY)
720
+ this.ctx.lineWidth = this.lineWidth * this.sratio
721
+ this.ctx.strokeStyle = this.color
722
+ this.ctx.moveTo(this.textX, this.textY)
194
723
  this.ctx.lineTo(obj.x, obj.y)
195
- this.ctx.lineCap = 'round'
196
- this.ctx.lineJoin = 'round'
724
+ this.ctx.stroke()
725
+ this.ctx.closePath()
726
+ if(type === 'end') {
727
+ this.points.push({
728
+ x: this.textX,
729
+ y: this.textY,
730
+ x2: obj.x,
731
+ y2: obj.y,
732
+ index: obj.index,
733
+ type: obj.type,
734
+ scale: obj.scale,
735
+ id: obj.id,
736
+ color: obj.color,
737
+ border: obj.border,
738
+ })
739
+ }
740
+ },
741
+ // 画圆
742
+ circular(obj,type) {
743
+ if(obj.x-this.textX <= 0) return
744
+ obj.index = this.pageIndex
745
+ obj.type = 'circular'
746
+ obj.scale = this.scales
747
+ obj.color = this.color
748
+ obj.border = this.lineWidth
749
+ obj.id = this.linkId
750
+ this.clearRect()
751
+ this.ctx.beginPath()
197
752
  this.ctx.lineWidth = this.lineWidth * this.sratio
753
+ this.ctx.strokeStyle = this.color
754
+ this.ctx.moveTo(obj.x,this.textY)
755
+ this.ctx.arc(this.textX, this.textY, obj.x-this.textX, 0, 2 * Math.PI, false);
198
756
  this.ctx.stroke()
199
757
  this.ctx.closePath()
200
- this.points.push(obj)
758
+ if(type === 'end') {
759
+ this.points.push({
760
+ x: this.textX,
761
+ y: this.textY,
762
+ width: obj.x-this.textX,
763
+ index: obj.index,
764
+ type: obj.type,
765
+ scale: obj.scale,
766
+ id: obj.id,
767
+ color: obj.color,
768
+ border: obj.border,
769
+ })
770
+ }
201
771
  },
202
- drawEnd (obj) {
772
+ // 画矩形
773
+ rectangle(obj,type) {
203
774
  obj.index = this.pageIndex
204
- obj.start = 'end'
775
+ obj.type = 'rectangle'
205
776
  obj.scale = this.scales
777
+ obj.color = this.color
778
+ obj.border = this.lineWidth
779
+ obj.id = this.linkId
780
+ this.clearRect()
206
781
  this.ctx.beginPath()
207
- this.ctx.strokeStyle = 'red'
208
- this.ctx.moveTo(this.startX, this.startY)
209
- this.ctx.lineTo(obj.x, obj.y)
210
- this.ctx.lineCap = 'round'
211
- this.ctx.lineJoin = 'round'
782
+ this.ctx.lineWidth = this.lineWidth * this.sratio
783
+ this.ctx.strokeStyle = this.color
784
+ this.ctx.rect(this.textX, this.textY, obj.x-this.textX, obj.y-this.textY);
212
785
  this.ctx.stroke()
213
786
  this.ctx.closePath()
214
- this.points.push(obj)
215
- this.$emit('updateData', this.points)
787
+ if(type === 'end') {
788
+ this.points.push({
789
+ x: this.textX,
790
+ y: this.textY,
791
+ width: obj.x-this.textX,
792
+ height: obj.y-this.textY,
793
+ index: obj.index,
794
+ type: obj.type,
795
+ scale: obj.scale,
796
+ id: obj.id,
797
+ color: obj.color,
798
+ border: obj.border,
799
+ })
800
+ }
216
801
  },
217
- drawMove (obj) {
802
+ // 画线
803
+ line(obj) {
218
804
  obj.index = this.pageIndex
219
- obj.start = 'move'
805
+ obj.type = 'line'
220
806
  obj.scale = this.scales
807
+ obj.color = this.color
808
+ obj.border = this.lineWidth
809
+ obj.id = this.linkId
221
810
  this.ctx.beginPath()
811
+ this.ctx.strokeStyle = this.color
812
+ this.ctx.lineWidth = this.lineWidth * this.sratio
222
813
  this.ctx.moveTo(this.startX, this.startY)
223
814
  this.ctx.lineTo(obj.x, obj.y)
224
- this.ctx.strokeStyle = 'red'
225
- this.ctx.lineWidth = this.lineWidth * this.sratio
226
815
  this.ctx.lineCap = 'round'
227
816
  this.ctx.lineJoin = 'round'
228
817
  this.ctx.stroke()
229
818
  this.ctx.closePath()
230
- this.startY = obj.y
231
- this.startX = obj.x
232
819
  this.points.push(obj)
233
820
  },
821
+ clearRect(v) {
822
+ const width = this.canvasStyle.widthCanvas
823
+ const height = this.canvasStyle.heightCanvas
824
+ this.ctx.clearRect(0, 0, width, height)
825
+ if(v) return
826
+ this.processing()
827
+ },
828
+ lineProcessing(data,data2,v) {
829
+ this.ctx.beginPath()
830
+ this.ctx.moveTo(data.x*this.scales/data.scale + v.x,data.y*this.scales/data.scale + v.y)
831
+ if(data.start !== 'end') {
832
+ this.ctx.lineTo(data2.x*this.scales/data2.scale + v.x, data2.y*this.scales/data2.scale + v.y)
833
+ }
834
+ this.ctx.strokeStyle = data.color
835
+ this.ctx.lineCap = 'round'
836
+ this.ctx.lineJoin = 'round'
837
+ this.ctx.lineWidth = data.border * this.sratio
838
+ this.ctx.stroke()
839
+ this.ctx.closePath()
840
+ },
841
+ rectangleProcessing(data,v) {
842
+ this.ctx.beginPath()
843
+ this.ctx.lineWidth = data.border * this.sratio
844
+ this.ctx.strokeStyle = data.color
845
+ this.ctx.strokeRect(data.x*this.scales/data.scale + v.x, data.y*this.scales/data.scale + v.y, data.width*this.scales/data.scale, data.height*this.scales/data.scale);
846
+ this.ctx.stroke()
847
+ this.ctx.closePath()
848
+ },
849
+ circularProcessing(data,v) {
850
+ this.ctx.beginPath()
851
+ this.ctx.lineWidth = data.border * this.sratio
852
+ this.ctx.strokeStyle = data.color
853
+ this.ctx.arc(data.x*this.scales/data.scale + v.x, data.y*this.scales/data.scale + v.y, data.width*this.scales/data.scale, 0, 2 * Math.PI, false);
854
+ this.ctx.stroke()
855
+ this.ctx.closePath()
856
+ },
857
+ straightProcessing(data,v) {
858
+ this.ctx.beginPath()
859
+ this.ctx.lineWidth = data.border * this.sratio
860
+ this.ctx.strokeStyle = data.color
861
+ this.ctx.moveTo(data.x*this.scales/data.scale + v.x, data.y*this.scales/data.scale + v.y)
862
+ this.ctx.lineTo(data.x2*this.scales/data.scale + v.x, data.y2*this.scales/data.scale + v.y)
863
+ this.ctx.stroke()
864
+ this.ctx.closePath()
865
+ },
866
+ arrowProcessing(data,v) {
867
+ const angle = Math.atan2(data.y*this.scales/data.scale - data.y2*this.scales/data.scale, data.x*this.scales/data.scale - data.x2*this.scales/data.scale) * 180 / Math.PI
868
+ const angle1 = (angle + 20) * Math.PI / 180
869
+ const angle2 = (angle - 20) * Math.PI / 180
870
+ const topX = 30 * Math.cos(angle1)
871
+ const topY = 30 * Math.sin(angle1)
872
+ const botX = 30 * Math.cos(angle2)
873
+ const botY = 30 * Math.sin(angle2)
874
+ this.ctx.beginPath();
875
+ this.ctx.lineWidth = data.border * this.sratio
876
+ this.ctx.strokeStyle = data.color
877
+ let arrowX, arrowY
878
+ this.ctx.moveTo(data.x2*this.scales/data.scale + v.x, data.y2*this.scales/data.scale + v.y);
879
+ this.ctx.lineTo(data.x*this.scales/data.scale + v.x, data.y*this.scales/data.scale + v.y);
880
+ arrowX = data.x2*this.scales/data.scale + topX + v.x
881
+ arrowY = data.y2*this.scales/data.scale + topY + v.y
882
+ this.ctx.moveTo(arrowX, arrowY);
883
+ this.ctx.lineTo(data.x2*this.scales/data.scale + v.x, data.y2*this.scales/data.scale + v.y)
884
+ arrowX = data.x2*this.scales/data.scale + botX + v.x;
885
+ arrowY = data.y2*this.scales/data.scale + botY + v.y;
886
+ this.ctx.lineTo(arrowX, arrowY)
887
+ this.ctx.stroke()
888
+ this.ctx.closePath()
889
+ },
890
+ textProcessing(data,v) {
891
+ const arr = data.text
892
+ for(let i = 0; i < arr.length; i++) {
893
+ this.ctx.beginPath();
894
+ this.ctx.font = `${data.size*this.sratio}px 黑体`;
895
+ this.ctx.fillStyle = data.color;
896
+ this.ctx.fillText(arr[i],data.x*this.scales/data.scale + v.x,data.y*this.scales/data.scale + v.y + data.size*this.sratio*i + data.size*this.sratio);
897
+ this.ctx.stroke()
898
+ this.ctx.closePath()
899
+ }
900
+ },
901
+ // 处理数据
902
+ processing() {
903
+ for(let i = 0; i < this.points.length; i++) {
904
+ if(this.points[i].index === this.pageIndex) {
905
+ if(this.points[i].type === 'line') {
906
+ this.lineProcessing(this.points[i],this.points[i+1],{x:0,y:0})
907
+ }
908
+ if(this.points[i].type === 'rectangle') {
909
+ this.rectangleProcessing(this.points[i],{x:0,y:0})
910
+ }
911
+ if(this.points[i].type === 'circular') {
912
+ this.circularProcessing(this.points[i],{x:0,y:0})
913
+ }
914
+ if(this.points[i].type === 'straight') {
915
+ this.straightProcessing(this.points[i],{x:0,y:0})
916
+ }
917
+ if(this.points[i].type === 'arrow') {
918
+ this.arrowProcessing(this.points[i],{x:0,y:0})
919
+ }
920
+ if(this.points[i].type === 'text') {
921
+ this.textProcessing(this.points[i],{x:0,y:0})
922
+ }
923
+ }
924
+ }
925
+ },
234
926
  flipLeft(e, v) {
235
927
  if (e > this.pdfPages) {
236
928
  this.pageIndex = this.pdfPages
@@ -264,6 +956,7 @@ export default {
264
956
  }
265
957
  },
266
958
  readPdf(n) {
959
+ this.mouse()
267
960
  if (this.source === '' || this.source === undefined || this.source === null) return
268
961
  let that = this
269
962
  if(n !== 1) that.loading = true
@@ -279,19 +972,27 @@ export default {
279
972
  that.pdfPages = pdf.numPages // 获取pdf文件的总页数
280
973
  pdf.getPage(that.pageIndex).then(function (page) {
281
974
  let canvas = document.getElementById(that.id)
975
+ let canvas2 = document.getElementById(`${that.id}2`)
282
976
  that.ctx = canvas.getContext('2d');
977
+ let ctx2 = canvas2.getContext('2d');
283
978
  let viewport = page.getViewport({scale: that.scales})
284
979
  canvas.width = viewport.width * that.sratio
285
980
  canvas.height = viewport.height * that.sratio
286
981
  canvas.style.width = viewport.width + 'px'
287
982
  canvas.style.height = viewport.height + 'px'
983
+ canvas2.width = viewport.width * that.sratio
984
+ canvas2.height = viewport.height * that.sratio
985
+ canvas2.style.width = viewport.width + 'px'
986
+ canvas2.style.height = viewport.height + 'px'
288
987
  that.canvasStyle = {
289
988
  width: viewport.width + 'px',
290
989
  height: viewport.height + 'px',
291
- marginLeft: -(viewport.width / 2) + 'px'
990
+ marginLeft: -(viewport.width / 2) + 'px',
991
+ widthCanvas: viewport.width * that.sratio,
992
+ heightCanvas: viewport.height * that.sratio
292
993
  }
293
994
  let renderContext = {
294
- canvasContext: that.ctx,
995
+ canvasContext: ctx2,
295
996
  viewport: viewport,
296
997
  transform: [2, 0, 0, 2, 0, 0] //这里会进行放大,解决模糊问题
297
998
  }
@@ -309,22 +1010,8 @@ export default {
309
1010
  that.flipRights = false
310
1011
  that.flipLefts = false
311
1012
  that.oneShow = false
312
- that.imgArr[that.pageIndex] = canvas.toDataURL('image/jpeg', 1)
313
- for(let i = 0; i < that.points.length; i++) {
314
- if(that.points[i].index === that.pageIndex) {
315
- that.ctx.beginPath()
316
- that.ctx.moveTo(that.points[i].x*that.scales/that.points[i].scale,that.points[i].y*that.scales/that.points[i].scale)
317
- if(that.points[i].start !== 'end') {
318
- that.ctx.lineTo(that.points[i+1].x*that.scales/that.points[i].scale, that.points[i+1].y*that.scales/that.points[i].scale)
319
- }
320
- that.ctx.strokeStyle = 'red'
321
- that.ctx.lineCap = 'round'
322
- that.ctx.lineJoin = 'round'
323
- that.ctx.lineWidth = that.lineWidth * that.sratio
324
- that.ctx.stroke()
325
- that.ctx.closePath()
326
- }
327
- }
1013
+ that.imgArr[that.pageIndex] = canvas2.toDataURL('image/jpeg', 1)
1014
+ that.processing()
328
1015
  }, 1000)
329
1016
  })
330
1017
  })
@@ -334,21 +1021,152 @@ export default {
334
1021
  </script>
335
1022
 
336
1023
  <style scoped>
337
- .cursor{
338
- position: fixed;
1024
+ .set-text em{
1025
+ width: 20px !important;
1026
+ font-size: 12px !important;
1027
+ }
1028
+ .wrap-can-one{
1029
+ position: absolute;
339
1030
  top: 0;
340
1031
  left: 0;
341
- z-index: 9999;
342
- width: 15px;
343
- height: 15px;
344
- margin-top: -7px;
345
- margin-left: -7px;
346
- cursor: none;
347
- transition: all 0s ease-in-out;
348
- background: url("data:image/png;base64,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") no-repeat 0 0;
349
- background-size: 100% 100%;
1032
+ z-index: 10;
1033
+ }
1034
+ .text-frame{
1035
+ position: absolute;
1036
+ z-index: 10;
1037
+ display: inline-block;
1038
+ line-height: 1.1;
1039
+ user-select: none;
1040
+ transition: all 0s;
1041
+ }
1042
+ .text-input{
1043
+ width: 100%;
1044
+ height: 100%;
1045
+ }
1046
+ .flip-tool{
1047
+ position: absolute;
1048
+ top: 0;
1049
+ right: 0;
1050
+ z-index: 200;
1051
+ box-shadow: 0 0 10px rgba(0,0,0,.2);
1052
+ border-bottom-left-radius: 10px;
1053
+ border-bottom-right-radius: 10px;
1054
+ transition: all 0.5s;
1055
+ }
1056
+ .tool-text{
1057
+ width: 50px;
1058
+ background-color: #fff;
1059
+ text-align: center;
1060
+ border-bottom-left-radius: 10px;
1061
+ border-bottom-right-radius: 10px;
1062
+ line-height: 25px;
1063
+ cursor: pointer;
1064
+ font-size: 12px;
1065
+ color: rgba(198, 76, 16, 1);
1066
+ }
1067
+ .tool-list{
1068
+ width: 50px;
1069
+ background-color: #fff;
1070
+ border-bottom-left-radius: 10px;
1071
+ border-bottom-right-radius: 10px;
1072
+ cursor: pointer;
1073
+ position: relative;
1074
+ text-align: center;
1075
+ padding: 18px 0;
1076
+ transition: all 0.5s;
350
1077
  user-select: none;
351
1078
  }
1079
+ .tool-item{
1080
+ padding: 18px 0;
1081
+ position: relative;
1082
+ }
1083
+ .tool-item-img{
1084
+ overflow: hidden;
1085
+ }
1086
+ .tool-item img {
1087
+ width: 30%;
1088
+ display: block;
1089
+ margin: 0 auto;
1090
+ }
1091
+ .tool-item:hover img{
1092
+ filter: drop-shadow(40px 0 rgba(198, 76, 16, 1));
1093
+ margin-left: -22px;
1094
+ }
1095
+ .tool-item-active img {
1096
+ filter: drop-shadow(40px 0 rgba(198, 76, 16, 1));
1097
+ margin-left: -22px;
1098
+ }
1099
+ .set {
1100
+ position: absolute;
1101
+ right: 40px;
1102
+ width: 280px;
1103
+ background-color: #fff;
1104
+ border-radius: 10px;
1105
+ box-shadow: 0 0 5px 3px rgba(0, 0, 0, 0.3);
1106
+ padding: 10px;
1107
+ z-index: 1;
1108
+ }
1109
+
1110
+ .set-list {
1111
+ padding: 5px 0;
1112
+ font-size: 15px;
1113
+ }
1114
+
1115
+ .set-list:after {
1116
+ content: '';
1117
+ display: block;
1118
+ clear: both;
1119
+ }
1120
+
1121
+ .set-list span {
1122
+ margin-right: 10px;
1123
+ float: left;
1124
+ }
1125
+
1126
+ .set-list em {
1127
+ font-style: normal;
1128
+ font-size: 15px;
1129
+ width: 16px;
1130
+ display: inline-block;
1131
+ margin-right: 10px;
1132
+ text-align: center;
1133
+ }
1134
+
1135
+ .set-list em:hover {
1136
+ color: rgba(198, 76, 16, 1);
1137
+ }
1138
+
1139
+ .set-list i {
1140
+ display: inline-block;
1141
+ width: 16px;
1142
+ height: 16px;
1143
+ background-color: #000;
1144
+ margin: 2px 10px 0 0;
1145
+ float: left;
1146
+ box-sizing: border-box;
1147
+ }
1148
+
1149
+ .set-list input {
1150
+ width: calc(100% - 60px);
1151
+ height: 22px;
1152
+ border: 1px solid #ccc;
1153
+ border-radius: 5px;
1154
+ padding: 0 10px;
1155
+ box-sizing: border-box;
1156
+ float: left;
1157
+ }
1158
+ .but {
1159
+ margin-left: 5px;
1160
+ font-size: 12px;
1161
+ background-color: transparent;
1162
+ border: 1px solid #000;
1163
+ border-radius: 3px;
1164
+ padding: 2px 5px;
1165
+ cursor: pointer;
1166
+ min-width: 60px;
1167
+ height: 21px;
1168
+ margin-right: 20px;
1169
+ }
352
1170
  /*动画部分*/
353
1171
  /*I'm the home page动画*/
354
1172
  .flip-animation-start {
@@ -399,7 +1217,7 @@ export default {
399
1217
  left: 50%;
400
1218
  right: 0;
401
1219
  bottom: 0;
402
- z-index: 1;
1220
+ z-index: 2;
403
1221
  }
404
1222
 
405
1223
  .wrap-one img {
@@ -436,7 +1254,7 @@ export default {
436
1254
  top: 0;
437
1255
  bottom: 0;
438
1256
  left: 0;
439
- z-index: 1;
1257
+ z-index: 50;
440
1258
  width: 8%;
441
1259
  }
442
1260
 
@@ -445,7 +1263,7 @@ export default {
445
1263
  top: 0;
446
1264
  bottom: 0;
447
1265
  right: 0;
448
- z-index: 1;
1266
+ z-index: 50;
449
1267
  width: 8%;
450
1268
  }
451
1269
 
@@ -6,11 +6,11 @@
6
6
  <div class="subject-title" :class="{'padd': item.top !== 0}" v-if="item.subject">
7
7
  <input v-if="multipleShow" type="checkbox" :checked="item.checked" @change="checkboxChange($event,index)"
8
8
  name="check"/>
9
- <span>{{ item.order ? item.order : index + 1 }}{{ item.order === ' ' ? '' : '.' }}<em
9
+ <span :style="{'font-weight': titleCrude?700:'normal'}">{{ item.order ? item.order : index + 1 }}{{ item.order === ' ' ? '' : '.' }}<em
10
10
  v-html="item.title"></em><em v-if="scoreShow">({{ item.score }}分)</em>
11
11
  <i class="subject-but" ref="subject">
12
12
  <b :style="{right: -item.right + 'px', top: item.top + 'px'}" ref="b">
13
- <button class="but" :disabled="it.disabled" v-for="(it) in item.customBut" :class="{'buts-actives': it.active,'buts-disabled': it.disabled}" @click="customButTap(it,item)">{{ it.active? it.nameActive: it.name }}</button>
13
+ <button class="but" :disabled="it.disabled" v-for="(it) in item.customBut" :class="{'buts-actives': it.active&&it.butStart,'buts-disabled': it.disabled}" @click="customButTap(it,item)">{{ it.active? it.nameActive: it.name }}</button>
14
14
  </b>
15
15
  </i>
16
16
  </span>
@@ -20,7 +20,7 @@
20
20
  <div v-for="(it,ind) in item.alist">
21
21
  <div v-if="it.annexType === '0'">
22
22
  <div class="subject-html-title">{{ titleText }}{{ ind + 1 }}</div>
23
- <div class="subject-html-cont" v-html="annexHtml(it.annexContent)"></div>
23
+ <div class="subject-html-cont" v-html="it.annexContent"></div>
24
24
  </div>
25
25
  </div>
26
26
  </div>
@@ -86,6 +86,10 @@ export default {
86
86
  type: Boolean,
87
87
  default: false
88
88
  },
89
+ titleCrude: {
90
+ type: Boolean,
91
+ default: false
92
+ },
89
93
  },
90
94
  watch: {
91
95
  data: {
@@ -139,9 +143,6 @@ export default {
139
143
  })
140
144
  })
141
145
  },
142
- annexHtml(x) {
143
- return json2html({node: "root", child: typeof x === 'string' ? JSON.parse(x) : x})
144
- },
145
146
  init() {
146
147
  const val = JSON.parse(JSON.stringify(this.data))
147
148
  this.value = val.map((item, index) => { // 转换html
@@ -151,6 +152,12 @@ export default {
151
152
  item.open = item.open !== undefined ? item.open : true
152
153
  item.error = item.error !== undefined ? item.error : false
153
154
  item.subject = item.subject !== undefined ? item.subject : true
155
+ if (item.alist) {
156
+ item.alist.map(x => {
157
+ x.annexContent = json2html({node: "root", child: typeof x.annexContent === 'string' ? JSON.parse(x.annexContent) : x.annexContent})
158
+ return x
159
+ })
160
+ }
154
161
  if (item.testKey) {
155
162
  item.testKey = typeof item.testKey === 'string' ? JSON.parse(item.testKey) : item.testKey
156
163
  let judge = item?.judgeAnswer
@@ -20,7 +20,7 @@
20
20
  <div class="subject-title" v-if="item.subject">
21
21
  <input v-if="multipleShow" type="checkbox" :checked="item.checked" @change="checkboxChange($event,index)"
22
22
  name="check"/>
23
- <span>{{ item.order ? item.order : index + 1 }}{{ item.order === ' ' ? '' : '.' }}<em
23
+ <span :style="{'font-weight': titleCrude?700:'normal'}">{{ item.order ? item.order : index + 1 }}{{ item.order === ' ' ? '' : '.' }}<em
24
24
  v-html="item.title"></em><em v-if="scoreShow">({{ item.score }}分)</em>
25
25
  <i class="subject-but" ref="subject">
26
26
  <b :style="{right: -item.right + 'px', top: item.top + 'px'}" v-if="butShow" ref="b">
@@ -228,7 +228,11 @@ export default {
228
228
  customBut:{
229
229
  type: Array,
230
230
  default: []
231
- }
231
+ },
232
+ titleCrude: {
233
+ type: Boolean,
234
+ default: false
235
+ },
232
236
  },
233
237
  watch: {
234
238
  data: {
@@ -297,7 +301,7 @@ export default {
297
301
  item.error = item.error !== undefined ? item.error : false
298
302
  if (item.alist) {
299
303
  item.alist.map(x => {
300
- x.annexContent = json2html({node: "root", child: JSON.parse(x.annexContent)})
304
+ x.annexContent = json2html({node: "root", child: typeof x.annexContent === 'string' ? JSON.parse(x.annexContent) : x.annexContent})
301
305
  return x
302
306
  })
303
307
  }
package/src/index.js CHANGED
@@ -81,7 +81,7 @@ function install(app) {
81
81
  }
82
82
 
83
83
  export default {
84
- version: '1.32.292',
84
+ version: '1.32.294',
85
85
  install,
86
86
  Calendar,
87
87
  Message,