zydx-plus 1.32.235 → 1.32.236

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.235",
3
+ "version": "1.32.236",
4
4
  "description": "Vue.js",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -148,6 +148,15 @@ export default {
148
148
  let pHeight = 0
149
149
  let html = ''
150
150
  for (let i = 0; i < data.length; i++) {
151
+ if(data[i].firstChild.localName === 'img') {
152
+ const img = data[i].firstChild
153
+ const imgHeight = img.offsetHeight
154
+ if((pHeight + imgHeight) > max) {
155
+ this.htmlArr.push(html)
156
+ pHeight = 0
157
+ html = ''
158
+ }
159
+ }
151
160
  let text = data[i].offsetHeight
152
161
  if ((pHeight + text) > max) {
153
162
  const {start, end, size} = this.rows(data[i], max - pHeight)
@@ -13,7 +13,7 @@
13
13
  <div class="subject">
14
14
  <div class="subject-title" v-if="item.subject">
15
15
  <input v-if="multipleShow" type="checkbox" :checked="item.checked" @change="checkboxChange($event,index)" name="check" />
16
- <span>{{ item.order? item.order: index + 1 }}.<em v-html="item.title"></em><em v-if="scoreShow">({{ item.score }}分)</em>
16
+ <span>{{ item.order? item.order: index + 1 }}{{ item.order === ' '? '': '.' }}}<em v-html="item.title"></em><em v-if="scoreShow">({{ item.score }}分)</em>
17
17
  <i class="subject-but" ref="subject">
18
18
  <b :style="{right: -item.right + 'px', top: item.top + 'px'}" v-if="butShow" ref="b">
19
19
  <button class="but" @click="modify(item)">修改</button>
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <div class="word-cont">
3
- <div class="word-slot" :style="page?style:{}" id="test">
3
+ <div class="word-slot" :style="page?style:{}" :ref="'test'+id">
4
4
  <slot></slot>
5
5
  </div>
6
6
  <!-- <div class="answer">-->
@@ -15,7 +15,7 @@
15
15
  <!-- </div>-->
16
16
  <!-- </div>-->
17
17
  <!-- </div>-->
18
- <div class="word-page" v-if="page">
18
+ <div class="word-page" :ref="'wordPage'+id" v-if="page">
19
19
  <div class="page-cont" v-for="(item,index) in htmlArr" :key="index" :style="{'z-index': zIndex}">
20
20
  <div class="page-cont-html" v-html="item" :style="{padding: padding?'100px':'100px 0', 'padding-top': index === 0?'10px': '100px'}"></div>
21
21
  <div class="page-cont-num">{{ index + 1 }}/{{ htmlArr.length }}</div>
@@ -41,7 +41,8 @@ export default {
41
41
  max: 0,
42
42
  pHeight: 0,
43
43
  html: '',
44
- loading: false
44
+ loading: false,
45
+ id: null
45
46
  }
46
47
  },
47
48
  props: {
@@ -73,17 +74,24 @@ export default {
73
74
  }
74
75
  }
75
76
  },
77
+ mounted() {
78
+ this.id = this.randomId()
79
+ },
76
80
  methods: {
81
+ randomId() { // 生成随机id
82
+ const id = Math.random().toString(36).substr(2)
83
+ return id.replace(/[0-9]/g, '')
84
+ },
77
85
  init() {
78
86
  if(!this.page) return
79
87
  this.htmlArr = []
80
88
  this.pHeight = 0
81
89
  this.html = ''
82
90
  setTimeout(() => {
83
- const data = document.getElementById('test').children[0].childNodes
84
- this.max = (document.getElementsByClassName('word-page')[0].offsetWidth * 1.4) - 320
91
+ const data = this.$refs[`test${this.id}`].children[0].childNodes
92
+ this.max = (this.$refs[`wordPage${this.id}`].offsetWidth * 1.4) - 200
85
93
  this.children(data)
86
- },0)
94
+ },100)
87
95
  },
88
96
  children(data) {
89
97
  for (let i = 0; i < data.length; i++) {
@@ -116,7 +124,7 @@ export default {
116
124
  for (let i = 0; i < data.length; i++) {
117
125
  let text = data[i].offsetHeight
118
126
  if((this.pHeight + text) > this.max) {
119
- if(data[i].children.length === 0 || data[i].className.indexOf('paper-choice') !== -1) {
127
+ if(data[i].children.length < 3 || data[i].className.indexOf('paper-choice') !== -1 || data[i].localName === 'table') {
120
128
  this.htmlArr.push(this.html)
121
129
  this.pHeight = 0
122
130
  this.html = ''
package/src/index.js CHANGED
@@ -79,7 +79,7 @@ function install(app) {
79
79
  }
80
80
 
81
81
  export default {
82
- version: '1.32.235',
82
+ version: '1.32.236',
83
83
  install,
84
84
  Calendar,
85
85
  Message,