zydx-plus 1.32.235 → 1.32.237

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.237",
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,21 +1,21 @@
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
- <!-- <div class="answer">-->
7
- <!-- <div class="answer-max">-->
8
- <!-- <div class="answer-title">一、单选题《共2题,合计20分)</div>-->
9
- <!-- <div class="answer-list">-->
10
- <!-- <div class="answer-list-title">1.我们从分享时机、分享形式、分享动机、分享场量4个来聊聊了社交分享]的那些事儿在常用的杜交分享姐件中,微信 (微信好友和朋友西) 、微、QQ?</div>-->
11
- <!-- <div class="answer-const">-->
12
- <!-- <div class="answer-const-title">参考答案:</div>-->
13
- <!-- <div class="answer-const-text">A.景4个址度来聊聊 社交分享] 的那些事儿在常用的社交分享组件中,微信《微信好友和朋友圈) 、微博、QQ</div>-->
14
- <!-- </div>-->
15
- <!-- </div>-->
16
- <!-- </div>-->
17
- <!-- </div>-->
18
- <div class="word-page" v-if="page">
6
+ <!-- <div class="answer">-->
7
+ <!-- <div class="answer-max">-->
8
+ <!-- <div class="answer-title">一、单选题《共2题,合计20分)</div>-->
9
+ <!-- <div class="answer-list">-->
10
+ <!-- <div class="answer-list-title">1.我们从分享时机、分享形式、分享动机、分享场量4个来聊聊了社交分享]的那些事儿在常用的杜交分享姐件中,微信 (微信好友和朋友西) 、微、QQ?</div>-->
11
+ <!-- <div class="answer-const">-->
12
+ <!-- <div class="answer-const-title">参考答案:</div>-->
13
+ <!-- <div class="answer-const-text">A.景4个址度来聊聊 社交分享] 的那些事儿在常用的社交分享组件中,微信《微信好友和朋友圈) 、微博、QQ</div>-->
14
+ <!-- </div>-->
15
+ <!-- </div>-->
16
+ <!-- </div>-->
17
+ <!-- </div>-->
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,23 +74,30 @@ 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) - 300
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++) {
90
98
  let mar = this.marginCal(data[i])
91
99
  let text = data[i].offsetHeight + mar
92
- if((this.pHeight + text) > this.max) {
100
+ if((this.pHeight + text) > (this.htmlArr.length === 0? this.max: this.max - 100)) {
93
101
  this.propsClass(data[i].children)
94
102
  }else {
95
103
  this.pHeight += text
@@ -114,9 +122,10 @@ export default {
114
122
  },
115
123
  propsClass(data) {
116
124
  for (let i = 0; i < data.length; i++) {
117
- let text = data[i].offsetHeight
118
- if((this.pHeight + text) > this.max) {
119
- if(data[i].children.length === 0 || data[i].className.indexOf('paper-choice') !== -1) {
125
+ let mar = this.marginCal(data[i])
126
+ let text = data[i].offsetHeight + mar
127
+ if((this.pHeight + text) > (this.htmlArr.length === 0? this.max: this.max - 100)) {
128
+ if(data[i].children.length === 0 || data[i].className.indexOf('paper-choice') !== -1 || data[i].localName === 'table') {
120
129
  this.htmlArr.push(this.html)
121
130
  this.pHeight = 0
122
131
  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.237',
83
83
  install,
84
84
  Calendar,
85
85
  Message,