zydx-plus 1.32.190 → 1.32.192

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.190",
3
+ "version": "1.32.192",
4
4
  "description": "Vue.js",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -105,7 +105,7 @@ export default {
105
105
  },
106
106
  computed: {
107
107
  position() {
108
- return `transform: translate(${this.x}px, ${this.y}px);width:${this.footRightOffset}px;height:${this.footDownOffset}px;`;
108
+ return `top:${this.y}px;left:${this.x}px;width:${this.footRightOffset}px;height:${this.footDownOffset}px;`;
109
109
  },
110
110
  },
111
111
  emits: ['dragStatus','close','enlarge'],
@@ -18,10 +18,10 @@ export function butJson (editor,data) {
18
18
  {name: '(左)黑体5号', key: 'blackLeft5'},
19
19
  ],
20
20
  html: {
21
- blackCenter4: `<p data-signId="title-1" class="${randomId()}" style="text-align: center;"><span style="font-weight: 700;color: rgb(0, 0, 0);font-size: 16px;font-family: SimHei">${menusData(data,'titleMenu').text}</span></p>`,
22
- blackLeft4: `<p data-signId="title-2" class="${randomId()}" style="text-align: left;"><span style="font-weight: 700;color: rgb(0, 0, 0);font-size: 16px;font-family: SimHei">${menusData(data,'titleMenu').text}</span></p>`,
23
- blackCenter5: `<p data-signId="title-3" class="${randomId()}" style="text-align: center;"><span style="font-weight: 700;color: rgb(0, 0, 0);font-size: 14px;font-family: SimHei">${menusData(data,'titleMenu').text}</span></p>`,
24
- blackLeft5: `<p data-signId="title-4" class="${randomId()}" style="text-align: left;"><span style="font-weight: 700;color: rgb(0, 0, 0);font-size: 14px;font-family: SimHei">${menusData(data,'titleMenu').text}</span></p>`,
21
+ blackCenter4: `<p data-signId="title-1" class="title ${randomId()}" style="text-align: center;"><span style="font-weight: 700;color: rgb(0, 0, 0);font-size: 16px;font-family: SimHei">${menusData(data,'titleMenu').text}</span></p>`,
22
+ blackLeft4: `<p data-signId="title-2" class="title ${randomId()}" style="text-align: left;"><span style="font-weight: 700;color: rgb(0, 0, 0);font-size: 16px;font-family: SimHei">${menusData(data,'titleMenu').text}</span></p>`,
23
+ blackCenter5: `<p data-signId="title-3" class="title ${randomId()}" style="text-align: center;"><span style="font-weight: 700;color: rgb(0, 0, 0);font-size: 14px;font-family: SimHei">${menusData(data,'titleMenu').text}</span></p>`,
24
+ blackLeft5: `<p data-signId="title-4" class="title ${randomId()}" style="text-align: left;"><span style="font-weight: 700;color: rgb(0, 0, 0);font-size: 14px;font-family: SimHei">${menusData(data,'titleMenu').text}</span></p>`,
25
25
  }
26
26
  },
27
27
  textMenu: {
@@ -32,8 +32,8 @@ export function butJson (editor,data) {
32
32
  {name: '楷体5号', key: 'regular5'},
33
33
  ],
34
34
  html: {
35
- Song5: `<p style="text-align: left;"><span style="color: rgb(0, 0, 0);font-size: 14px;font-family: SimSun">请输入正文</span></p>`,
36
- regular5: `<p style="text-align: left;"><span style="color: rgb(0, 0, 0);font-size: 14px;font-family: KaiTi">请输入正文</span></p>`,
35
+ Song5: `<p class="text" style="text-align: left;"><span style="color: rgb(0, 0, 0);font-size: 14px;font-family: SimSun">请输入正文</span></p>`,
36
+ regular5: `<p class="text" style="text-align: left;"><span style="color: rgb(0, 0, 0);font-size: 14px;font-family: KaiTi">请输入正文</span></p>`,
37
37
  }
38
38
  },
39
39
  redMenu: {
@@ -46,7 +46,7 @@ export function butJson (editor,data) {
46
46
  name: '添加作者',
47
47
  key: 'authorMenu',
48
48
  menuKeys: [],
49
- html: `<p <p contenteditable="false" data-signId="author" style="text-align: center;"><span style="color: rgb(0, 0, 0);font-size: 14px;">${menusData(data,'authorMenu').text}</span></p>`
49
+ html: `<p contenteditable="false" class="author" data-signId="author" style="text-align: center;"><span style="color: rgb(0, 0, 0);font-size: 14px;">${menusData(data,'authorMenu').text}</span></p>`
50
50
  },
51
51
  subjectMenu: {
52
52
  name: '添加题目',
@@ -70,13 +70,13 @@ export function butJson (editor,data) {
70
70
  name: '关键词',
71
71
  key: 'keywordMenu',
72
72
  menuKeys: [],
73
- html: `<p><span style="color: rgb(0, 0, 0);font-size: 14px;font-weight: 700;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;关键词:</span><span style="color: rgb(0, 0, 0);font-size: 14px;font-family: KaiTi">关键词内容...</span></p>`
73
+ html: `<p class="keyword"><span style="color: rgb(0, 0, 0);font-size: 14px;font-weight: 700;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;关键词:</span><span style="color: rgb(0, 0, 0);font-size: 14px;font-family: KaiTi">关键词内容...</span></p>`
74
74
  },
75
75
  abstractMenu: {
76
76
  name: '添加摘要',
77
77
  key: 'abstractMenu',
78
78
  menuKeys: [],
79
- html: `<p><span style="color: rgb(0, 0, 0);font-size: 14px;font-weight: 700;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;摘要:</span><span style="color: rgb(0, 0, 0);font-size: 14px;font-family: KaiTi">摘要内容...</span></p>`
79
+ html: `<p class="abstract"><span style="color: rgb(0, 0, 0);font-size: 14px;font-weight: 700;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;摘要:</span><span style="color: rgb(0, 0, 0);font-size: 14px;font-family: KaiTi">摘要内容...</span></p>`
80
80
  },
81
81
  literatureMenu: {
82
82
  name: '添加文献',
@@ -29,7 +29,7 @@
29
29
  </div>
30
30
  </div>
31
31
  </div>
32
- <div class="editor-content" v-show="editableShow">
32
+ <div class="editor-content" :class="{'editor-content-show': !editableShow}">
33
33
  <div class="editing">
34
34
  <div class="editing-header" v-if="signMenuShow">
35
35
  <img :src="menusData('signMenu')?.ico" alt=""/>
@@ -46,7 +46,7 @@
46
46
  <img :src="menusData('signMenu')?.ico" alt=""/>
47
47
  <span>{{ menusData('signMenu')?.text }}</span>
48
48
  </div>
49
- <div class="read-only-page" v-for="(item,index) in htmlArr">
49
+ <div class="read-only-page" :style="{height: wit * 1.4 + 'px',width: wit + 'px'}" v-for="(item,index) in htmlArr">
50
50
  <div class="read-only-p" v-html="item"></div>
51
51
  <div class="read-only-a">{{ index + 1 }}/{{ htmlArr.length }}</div>
52
52
  </div>
@@ -97,7 +97,8 @@ export default {
97
97
  imgUrl: '', // 图片地址
98
98
  imgType: '', // 图片类型
99
99
  htmlArr: [],
100
- editableShow: true
100
+ editableShow: true,
101
+ wit: 0
101
102
  }
102
103
  },
103
104
  props: {
@@ -169,7 +170,7 @@ export default {
169
170
  })
170
171
  if (this.page) {
171
172
  this.editableShow = !e
172
- this.readOnlyPage()
173
+ this.readOnlyPage() // 只读分页
173
174
  }
174
175
  },
175
176
  deep: true
@@ -247,6 +248,40 @@ export default {
247
248
  },
248
249
  emits: ['confirm', 'enclosure'],
249
250
  methods: {
251
+ signMenu() { // 签名菜单
252
+ this.signMenuShow = !this.signMenuShow
253
+ },
254
+ titleMenu(next) { // 标题菜单
255
+ next(this.classShow('title'))
256
+ },
257
+ authorMenu(next) { // 作者菜单
258
+ next(this.classShow('author'))
259
+ },
260
+ abstractMenu(next) { // 摘要菜单
261
+ next(this.classShow('abstract'))
262
+ },
263
+ keywordMenu(next) { // 关键词菜单
264
+ next(this.classShow('keyword'))
265
+ },
266
+ textMenu(next) { // 文本菜单
267
+ next(this.classShow('text'))
268
+ },
269
+ classShow(v) {
270
+ if(!this.readOnly) return
271
+ let state = false
272
+ const cls = document.getElementsByClassName(v)
273
+ for (let i = 0; i < cls.length; i++) {
274
+ if (cls[i].style.display === 'none') {
275
+ cls[i].style.display = 'block'
276
+ state = false
277
+ } else {
278
+ cls[i].style.display = 'none'
279
+ state = true
280
+ }
281
+ }
282
+ this.readOnlyPage()
283
+ return state
284
+ },
250
285
  exportToWord() {
251
286
  const wrap = document.getElementById('test')
252
287
  const config = {
@@ -262,10 +297,20 @@ export default {
262
297
  readOnlyPage() {
263
298
  this.htmlArr = []
264
299
  const data = document.querySelectorAll('.editing-cont')[0].childNodes[0].childNodes
265
- let max = 950
300
+ this.wit = document.getElementsByClassName('editor-content')[0].offsetWidth
301
+ let max = this.wit * 1.4 - 200
266
302
  let pHeight = 0
267
303
  let html = ''
268
304
  for (let i = 0; i < data.length; i++) {
305
+ if(data[i].firstChild.localName === 'img') {
306
+ const img = data[i].firstChild
307
+ const imgHeight = img.offsetHeight
308
+ if((pHeight + imgHeight) > max) {
309
+ this.htmlArr.push(html)
310
+ pHeight = 0
311
+ html = ''
312
+ }
313
+ }
269
314
  let text = data[i].offsetHeight
270
315
  if (data[i].dataset?.signid === 'ack') {
271
316
  this.htmlArr.push(html)
@@ -274,14 +319,16 @@ export default {
274
319
  }
275
320
  if ((pHeight + text) > max) {
276
321
  const {start, end} = this.rows(data[i], max - pHeight)
277
- html += `<p>${start}</p>`
322
+ html += `<p>${start.data}</p>`
278
323
  this.htmlArr.push(html)
279
324
  pHeight = 0
280
325
  html = ''
281
- html += `<p>${end}</p>`
326
+ html += `<p>${end.data}</p>`
327
+ pHeight = end.size
328
+ }else {
329
+ pHeight += text
330
+ html += data[i].outerHTML
282
331
  }
283
- pHeight += text + 5
284
- html += data[i].outerHTML
285
332
  if (i === data.length - 1) {
286
333
  this.htmlArr.push(html)
287
334
  pHeight = 0
@@ -294,13 +341,17 @@ export default {
294
341
  let size = parseInt(window.getComputedStyle(data, null).fontSize)
295
342
  let line = parseInt(window.getComputedStyle(data, null).lineHeight)
296
343
  let width = data.offsetWidth
344
+ let height = data.offsetHeight
297
345
  let rows = Math.round(num / line) // 行数
298
346
  let text = data.innerText
299
- let len = this.measureText(text,size)
300
- let textLen = Math.round((width / (len/text.length)) * rows)
347
+ let len = this.measureText(text,size) // 文本宽度
348
+ let textLen = Math.round((width / (len/text.length)) * rows) // 文本长度
301
349
  let start = text.slice(0, textLen)
302
350
  let end = text.slice(textLen)
303
- return {start, end}
351
+ return {
352
+ start: {data: start, size: num},
353
+ end: {data: end, size: height - num}
354
+ }
304
355
  },
305
356
  measureText (text, fontSize=10) {
306
357
  text = String(text);
@@ -649,19 +700,17 @@ export default {
649
700
  <style scoped>
650
701
  .read-only {
651
702
  position: relative;
652
- width: 794px;
653
703
  margin: 0 auto;
654
704
  }
655
705
 
656
706
  .read-only-page {
657
707
  width: 100%;
658
- height: 1123px;
659
708
  padding: 100px;
660
709
  background-color: #fff;
661
710
  box-sizing: border-box;
662
711
  position: relative;
663
- box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
664
- margin: 20px 0;
712
+ border: 1px solid #ccc;
713
+ margin: 10px 10px 20px 10px;
665
714
  }
666
715
 
667
716
  .read-only-p {
@@ -675,7 +724,7 @@ export default {
675
724
 
676
725
  .read-only-a {
677
726
  position: absolute;
678
- bottom: 25px;
727
+ bottom: 70px;
679
728
  left: 50%;
680
729
  z-index: 1;
681
730
  font-size: 14px;
@@ -746,7 +795,7 @@ label {
746
795
  .editing-header {
747
796
  position: absolute;
748
797
  top: 10px;
749
- left: 10px;
798
+ left: 20px;
750
799
  display: flex;
751
800
  z-index: 1;
752
801
  }
@@ -853,6 +902,12 @@ li {
853
902
  margin: 10px;
854
903
  border: 1px solid rgba(204, 204, 204, 1);
855
904
  }
905
+ .editor-content-show{
906
+ position: fixed;
907
+ top: -9999px;
908
+ left: 0;
909
+ z-index: -1;
910
+ }
856
911
 
857
912
  .editing {
858
913
  width: 794px;
package/src/index.js CHANGED
@@ -77,7 +77,7 @@ function install(app) {
77
77
  }
78
78
 
79
79
  export default {
80
- version: '1.32.190',
80
+ version: '1.32.192',
81
81
  install,
82
82
  Calendar,
83
83
  Message,