zydx-plus 1.32.198 → 1.32.200

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.198",
3
+ "version": "1.32.200",
4
4
  "description": "Vue.js",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -41,7 +41,7 @@
41
41
  <div class="complete" v-if="!readOnly && toolbar.length > 0">
42
42
  <button class="but" v-if="butShow" @click="confirm">完成</button>
43
43
  </div>
44
- <div class="read-only" v-if="page&&readOnly">
44
+ <div class="read-only" v-if="page&&readOnly" :style="{width: (wit + 20) + 'px'}">
45
45
  <div class="editing-header" v-if="signMenuShow">
46
46
  <img :src="menusData('signMenu')?.ico" alt=""/>
47
47
  <span>{{ menusData('signMenu')?.text }}</span>
@@ -166,7 +166,7 @@ export default {
166
166
  this.editableShow = false
167
167
  this.readOnlyPage()
168
168
  }
169
- }, 100)
169
+ }, 300)
170
170
  }
171
171
  },
172
172
  deep: true,
@@ -355,6 +355,7 @@ export default {
355
355
  this.htmlArr = []
356
356
  const data = document.querySelectorAll('.editing-cont')[0].childNodes[0].childNodes
357
357
  this.wit = document.getElementsByClassName('editor-content')[0].offsetWidth
358
+ if(this.wit > 900) this.wit = 900
358
359
  let max = this.wit * 1.4
359
360
  let pHeight = 0
360
361
  let html = ''
@@ -9,7 +9,7 @@
9
9
  </div>
10
10
  </div>
11
11
  <div class="mp4" v-if="fileType === 'mp4'">
12
- <video :src="url" controls></video>
12
+ <video id="video" :src="url" controls></video>
13
13
  </div>
14
14
  <div class="mp3" v-if="fileType === 'mp3'">
15
15
  <audio :src="url" controls></audio>
@@ -43,7 +43,7 @@ export default {
43
43
  svgArr: [],
44
44
  container: null,
45
45
  pdfPages: 0,
46
- loading: true,
46
+ loading: false,
47
47
  repeat: false,
48
48
  idArr: []
49
49
  }
@@ -66,15 +66,15 @@ export default {
66
66
  immediate: true
67
67
  }
68
68
  },
69
- mounted() {
70
- this.repeatInit()
71
- },
72
69
  methods: {
73
70
  repeatInit() {
74
71
  if (this.repeat) return // 防止重复加载
75
72
  this.repeat = true
76
- this.loading = true
77
73
  this.fileType = this.url.split('.').pop()
74
+ if(this.fileType === 'pdf' || this.fileType === 'docx' || this.fileType === 'xlsx') {
75
+ this.loading = true
76
+ }
77
+ // if(this.fileType === 'mp4') this.videoFun()
78
78
  if (this.fileType === 'pdf') this.init()
79
79
  setTimeout(() => {
80
80
  this.repeat = false
@@ -83,6 +83,12 @@ export default {
83
83
  renderedHandler() {
84
84
  this.loading = false
85
85
  },
86
+ videoFun() {
87
+ const video = document.getElementById('video')
88
+ video.addEventListener('loadeddata', function() {
89
+ console.log(video);
90
+ });
91
+ },
86
92
  init() {
87
93
  let that = this
88
94
  const loadingTask = PdfJs.getDocument(this.url)
@@ -138,10 +144,18 @@ export default {
138
144
  position: relative;
139
145
  }
140
146
  .mp4,.mp3{
141
- width: 100%;
147
+ max-width: 100%;
148
+ height: 100%;
149
+ display: flex;
150
+ align-items: center;
142
151
  }
143
152
  .mp4 video,.mp3 audio{
144
153
  width: 100%;
154
+ max-height: 100%;
155
+ }
156
+ .ppt{
157
+ width: 100%;
158
+ height: 100%;
145
159
  }
146
160
  .view-pdf{
147
161
  text-align: center;
@@ -8,7 +8,6 @@
8
8
  </template>
9
9
 
10
10
  <script>
11
- import {json2html} from "html2json";
12
11
 
13
12
  export default {
14
13
  name: "zydx-tab",
@@ -89,6 +89,7 @@
89
89
  .subject-title{
90
90
  flex: 1;
91
91
  position: relative;
92
+ line-height: 26px;
92
93
  }
93
94
  .subject-title label{
94
95
  display: inline-block;
@@ -171,7 +172,10 @@ input[name='check'] {
171
172
  text-indent: 2em;
172
173
  font-weight: bold;
173
174
  font-size: 14px;
175
+ line-height: 26px;
174
176
  }
175
177
  .subject-html-cont{
176
178
  text-align: justify;
179
+ line-height: 26px;
180
+ text-indent: 2em;
177
181
  }
@@ -35,9 +35,9 @@
35
35
  </div>
36
36
  </div>
37
37
  <div class="choice" v-if="item.testKey">
38
- <div class="choice-box" v-for="(ts,ind) in JSON.parse(item.testKey)">
38
+ <div class="choice-box" v-for="(ts,ind) in item.testKey">
39
39
  <label>
40
- <input :disabled="disabled" @change="answerChange($event,item,JSON.parse(item.testKey),index)" :type="ques(item.quesType)?'radio':'checkbox'" :name="index" />
40
+ <input :disabled="disabled" :checked="ts.checked" @change="answerChange($event,item,index)" :type="ques(item.quesType)?'radio':'checkbox'" :name="index" />
41
41
  <span>{{ ts.index }}. {{ ts.content[0] }}</span>
42
42
  </label>
43
43
  </div>
@@ -100,7 +100,7 @@ export default {
100
100
  data: {
101
101
  handler: function (val, oldVal) {
102
102
  this.value = val
103
- this.value.map((item,index) => {
103
+ this.value.map((item,index) => { // 转换html
104
104
  item.choice = true
105
105
  item.right = 0
106
106
  item.top = 0
@@ -110,14 +110,31 @@ export default {
110
110
  return x
111
111
  })
112
112
  }
113
+ if(item.testKey) {
114
+ item.testKey = JSON.parse(item.testKey).map(x => {
115
+ if(this.ques(item.quesType)) { // 判断是否单选
116
+ x.checked = x.index === item?.answer;
117
+ }else {
118
+ for(let i=0; i<item?.answer?.length; i++) {
119
+ if(x.index === item.answer[i]) {
120
+ x.checked = true
121
+ break
122
+ }else {
123
+ x.checked = false
124
+ }
125
+ }
126
+ }
127
+ return x
128
+ })
129
+ }
113
130
  return item
114
131
  })
115
- this.$nextTick(() => {
116
- const w = this.$refs.parer.offsetWidth
132
+ this.$nextTick(() => { // 保证所有的数据都渲染完毕
133
+ const w = this.$refs.parer.offsetWidth // 获取父级宽度
117
134
  for(let i = 0; i< this.$refs.subject.length; i++) {
118
135
  this.value[i].right = w - this.$refs.subject[i].offsetLeft
119
136
  if(this.$refs.b && this.$refs.b.length > 0) {
120
- if(this.value[i].right < this.$refs.b[i].offsetWidth) this.value[i].top = 25
137
+ if(this.value[i].right < this.$refs.b[i].offsetWidth) this.value[i].top = 25 // 判断是否换行
121
138
  }
122
139
  }
123
140
  })
@@ -133,17 +150,17 @@ export default {
133
150
  },
134
151
  emits: ['change','modify','del','changeAll','replaceData','choiceData','answer'],
135
152
  methods: {
136
- answerChange(e,v,n,id) {
153
+ answerChange(e,v,id) {
137
154
  let answerArr = []
138
155
  const ids = document.getElementsByName(id)
139
156
  ids.forEach((x,index) => {
140
157
  if(x.checked) {
141
- answerArr.push(n[index])
158
+ answerArr.push(v.testKey[index].index)
142
159
  }
143
160
  })
144
161
  this.$emit('answer',{
145
162
  ...v,
146
- answer: answerArr
163
+ answer: this.ques(v.quesType)? answerArr[0]: answerArr
147
164
  })
148
165
  },
149
166
  checkboxChange(e,index) {
@@ -165,9 +182,8 @@ export default {
165
182
  },
166
183
  styleText(v) {
167
184
  if(!v || v === 'null') return
168
- const data = JSON.parse(v)
169
- for(let i=0; i< data.length; i++) {
170
- if(data[i].content[0].length > 20) {
185
+ for(let i=0; i< v.length; i++) {
186
+ if(v[i].content[0].length > 20) {
171
187
  return true
172
188
  }
173
189
  }
@@ -57,6 +57,7 @@ export default {
57
57
  },
58
58
  methods: {
59
59
  init() {
60
+ if(!this.page) return
60
61
  this.htmlArr = []
61
62
  this.pHeight = 0
62
63
  this.html = ''
package/src/index.js CHANGED
@@ -77,7 +77,7 @@ function install(app) {
77
77
  }
78
78
 
79
79
  export default {
80
- version: '1.32.198',
80
+ version: '1.32.200',
81
81
  install,
82
82
  Calendar,
83
83
  Message,