zydx-plus 1.32.186 → 1.32.187

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.186",
3
+ "version": "1.32.187",
4
4
  "description": "Vue.js",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -166,4 +166,9 @@ input[name='check'] {
166
166
  }
167
167
  .subject-html :deep(p){
168
168
  margin: 2px 0;
169
+ }
170
+ .subject-html-title{
171
+ text-indent: 2em;
172
+ font-weight: bold;
173
+ font-size: 14px;
169
174
  }
@@ -6,7 +6,7 @@
6
6
  <div class="subject-title">
7
7
  <label>
8
8
  <input v-if="multipleShow" type="checkbox" :checked="item.checked" @change="checkboxChange($event,index)" name="check" />
9
- <span>{{ item.order }}.<em v-html="item.title"></em>
9
+ <span>{{ item.order }}.<em v-html="item.title"></em><em v-if="scoreShow">({{ item.score }}分)</em>
10
10
  <i class="subject-but" ref="subject">
11
11
  <b :style="{right: -item.right + 'px', top: item.top + 'px'}" v-if="butShow" ref="b">
12
12
  <button class="but" @click="modify(item)">修改</button>
@@ -29,7 +29,10 @@
29
29
  </div>
30
30
  </div>
31
31
  <div v-if="item.alist" class="subject-html">
32
- <div v-for="(item,index) in item.alist" v-html="item.amexontet"></div>
32
+ <div v-for="(item,index) in item.alist">
33
+ <div class="subject-html-title">{{ titleText }}{{ index + 1 }}</div>
34
+ <div class="subject-html-cont" v-html="item.annexContent"></div>
35
+ </div>
33
36
  </div>
34
37
  <div class="choice" v-if="item.testKey">
35
38
  <div class="choice-box" v-for="(ts,ind) in JSON.parse(item.testKey)">
@@ -83,6 +86,14 @@ export default {
83
86
  choice: {
84
87
  type: Boolean,
85
88
  default: false
89
+ },
90
+ titleText: {
91
+ type: String,
92
+ default: '材料'
93
+ },
94
+ scoreShow: {
95
+ type: Boolean,
96
+ default: false
86
97
  }
87
98
  },
88
99
  watch: {
@@ -95,7 +106,7 @@ export default {
95
106
  item.top = 0
96
107
  if(item.alist) {
97
108
  item.alist.map(x => {
98
- x.amexontet = json2html({node: "root",child: JSON.parse(x.amexontet)})
109
+ x.annexContent = json2html({node: "root",child: JSON.parse(x.annexContent)})
99
110
  return x
100
111
  })
101
112
  }
@@ -105,10 +116,11 @@ export default {
105
116
  const w = this.$refs.parer.offsetWidth
106
117
  for(let i = 0; i< this.$refs.subject.length; i++) {
107
118
  this.value[i].right = w - this.$refs.subject[i].offsetLeft
108
- if(this.value[i].right < this.$refs.b[i].offsetWidth) this.value[i].top = 25
119
+ if(this.$refs.b) {
120
+ if(this.value[i].right < this.$refs.b[i].offsetWidth) this.value[i].top = 25
121
+ }
109
122
  }
110
123
  })
111
- console.log(this.value)
112
124
  },
113
125
  immediate: true,
114
126
  },
@@ -4,7 +4,7 @@
4
4
  <slot></slot>
5
5
  </div>
6
6
  <div class="word-page" v-if="page">
7
- <div class="page-cont" v-for="(item,index) in htmlArr">
7
+ <div class="page-cont" v-for="(item,index) in htmlArr" :key="index">
8
8
  <div class="page-cont-html" v-html="item"></div>
9
9
  <div class="page-cont-num">{{ index + 1 }}/{{ htmlArr.length }}</div>
10
10
  </div>
@@ -19,7 +19,10 @@ export default {
19
19
  name: "zydx-paper",
20
20
  data() {
21
21
  return {
22
- htmlArr: []
22
+ htmlArr: [],
23
+ max: 823,
24
+ pHeight: 0,
25
+ html: ''
23
26
  }
24
27
  },
25
28
  props: {
@@ -43,35 +46,62 @@ export default {
43
46
  }
44
47
  }
45
48
  },
46
- mounted() {
47
- this.$nextTick(() => {
48
- this.init()
49
- })
50
- },
51
49
  methods: {
52
50
  init() {
53
- const slot = this.$slots.default()[0]
54
- let max = 1123
55
- let pHeight = 0
56
- let html = ''
57
- for (let i = 0; i < slot.children.length; i++) {
58
- const data = document.getElementsByClassName(slot.children[i].props.class)
59
- let text = data[0].offsetHeight
60
- if((pHeight + text) > max) {
61
- this.htmlArr.push(html)
62
- pHeight = 0
63
- html = ''
51
+ setTimeout(() => {
52
+ const data = document.getElementById('test').children[0].childNodes
53
+ this.children(data)
54
+ },0)
55
+ },
56
+ children(data) {
57
+ for (let i = 0; i < data.length; i++) {
58
+ let text = data[i].offsetHeight
59
+ if((this.pHeight + text) > this.max) {
60
+ this.propsClass(data[i].children)
61
+ }else {
62
+ this.pHeight += text
63
+ this.html += data[i].outerHTML
64
64
  }
65
- pHeight += text
66
- html += data[0].outerHTML
67
- if(i === slot.children.length - 1) {
68
- this.htmlArr.push(html)
69
- pHeight = 0
70
- html = ''
65
+ if(i === data.length - 1) {
66
+ this.htmlArr.push(this.html)
67
+ this.pHeight = 0
68
+ this.html = ''
71
69
  break
72
70
  }
73
71
  }
74
72
  },
73
+ propsClass(data) {
74
+ for (let i = 0; i < data.length; i++) {
75
+ let text = data[i].offsetHeight
76
+ if((this.pHeight + text) > this.max) {
77
+ if(data[i].children.length === 0) {
78
+ this.htmlArr.push(this.html)
79
+ this.pHeight = 0
80
+ this.html = ''
81
+ this.pHeight += text
82
+ this.html += data[i].outerHTML
83
+ }else {
84
+ this.propsClass(data[i].children)
85
+ }
86
+ }else {
87
+ this.pHeight += text
88
+ this.html += data[i].outerHTML
89
+ }
90
+ }
91
+ },
92
+ propsClass2(data) {
93
+ for (let i = 0; i < data.length; i++) {
94
+ let text = data[i].offsetHeight
95
+ console.log(data[i])
96
+ if((this.pHeight + text) > this.max) {
97
+ this.htmlArr.push(this.html)
98
+ this.pHeight = 0
99
+ this.html = ''
100
+ }
101
+ this.pHeight += text
102
+ this.html += data[i].outerHTML
103
+ }
104
+ },
75
105
  exportToWord() {
76
106
  const wrap = document.getElementById('test')
77
107
  const config = {
package/src/index.js CHANGED
@@ -77,7 +77,7 @@ function install(app) {
77
77
  }
78
78
 
79
79
  export default {
80
- version: '1.32.186',
80
+ version: '1.32.187',
81
81
  install,
82
82
  Calendar,
83
83
  Message,