zydx-plus 1.29.143 → 1.29.144

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.29.143",
3
+ "version": "1.29.144",
4
4
  "description": "Vue.js",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -29,7 +29,7 @@
29
29
  <div v-else>
30
30
  <div class="choice-list">
31
31
  <div class="list-title">
32
- <span>试题选项:</span>
32
+ <span><i>*</i>试题选项:</span>
33
33
  <button class="but" @click="addOption">增加选项</button>
34
34
  </div>
35
35
  <div class="list-cont">
@@ -152,12 +152,16 @@ export default {
152
152
  }
153
153
  }else {
154
154
  this.list.forEach(x => {
155
+ console.log(x.value)
155
156
  arr.push({
156
157
  index: x.letter,
157
- content: [x.value? x.value : '']
158
+ content: [x.value]
158
159
  })
159
160
  })
160
- return arr
161
+ return {
162
+ testKey: arr,
163
+ prompt: arr.filter(x => x.content[0] === '').length > 0
164
+ }
161
165
  }
162
166
  },
163
167
  add(str) { // 添加选项
@@ -236,6 +240,11 @@ export default {
236
240
  font-weight: bold;
237
241
  flex: 1;
238
242
  }
243
+ .list-title i{
244
+ color: red;
245
+ margin-right: 2px;
246
+ font-style: normal;
247
+ }
239
248
  .choice-title{
240
249
  display: flex;
241
250
  justify-content: center;
@@ -183,7 +183,13 @@ export default {
183
183
  color: 'rgba(84,150,136,1)',
184
184
  boldAct: false,
185
185
  italicAct: false,
186
- scribeAct: false
186
+ scribeAct: false,
187
+ defaultData: {
188
+ "data": {
189
+ "text": "根节点"
190
+ },
191
+ "children": []
192
+ }
187
193
  }
188
194
  },
189
195
  props: {
@@ -202,6 +208,18 @@ export default {
202
208
  },
203
209
  },
204
210
  watch: {
211
+ readOnly: {
212
+ handler: function (val, oldVal) {
213
+ this.mindMap?.setMode(val? 'readonly':'edit')
214
+ },
215
+ immediate: true
216
+ },
217
+ data: {
218
+ handler: function (val, oldVal) {
219
+ this.mindMap?.setData(val)
220
+ },
221
+ immediate: true
222
+ },
205
223
  sizeValue(e) { // 字号
206
224
  this.activeNodes.forEach(node => {
207
225
  node.setStyle('fontSize',e)
@@ -244,32 +262,31 @@ export default {
244
262
  },
245
263
  },
246
264
  mounted() {
247
- let mindSess = sessionStorage.getItem('mind')
248
- this.mindMap = new MindMap({
249
- el: document.getElementById('mindMapContainer'),
250
- enableFreeDrag: false, // 是否开启自由拖拽
251
- enableNodeTransitionMove: false, // 是否开启节点过渡动画
252
- layout: 'logicalStructure', // 节点布局方式
253
- maxHistoryCount: 100, // 最大历史记录数
254
- maxNodeCacheCount: 100, // 最大节点缓存数
255
- data: this.data
256
- });
257
- this.mindMap.setMode(this.readOnly ? 'readonly':'edit')
258
- this.mindMap.on('node_active', (node, activeNodeList) => {
259
- this.mindShow = node === null;
260
- })
261
- this.mindMap.on('back_forward', (index, len) => {
262
- this.retShow = index <= 0;
263
- this.forwardShow = index >= len - 1
264
- })
265
- this.mindMap.on('node_active', (node, activeNodeList) => {
266
- this.activeNodes = activeNodeList
267
- })
265
+ this.init()
268
266
  },
269
267
  methods: {
270
- // readOnly() {
271
- // this.mindMap.setMode(value ? 'readonly' : 'edit')
272
- // },
268
+ init() {
269
+ this.mindMap = new MindMap({
270
+ el: document.getElementById('mindMapContainer'),
271
+ enableFreeDrag: false, // 是否开启自由拖拽
272
+ enableNodeTransitionMove: false, // 是否开启节点过渡动画
273
+ layout: 'logicalStructure', // 节点布局方式
274
+ maxHistoryCount: 100, // 最大历史记录数
275
+ maxNodeCacheCount: 100, // 最大节点缓存数
276
+ data: Object.keys(this.data).length === 0? this.defaultData: this.data
277
+ });
278
+ this.mindMap.setMode(this.readOnly ? 'readonly':'edit')
279
+ this.mindMap.on('node_active', (node, activeNodeList) => {
280
+ this.mindShow = node === null;
281
+ })
282
+ this.mindMap.on('back_forward', (index, len) => {
283
+ this.retShow = index <= 0;
284
+ this.forwardShow = index >= len - 1
285
+ })
286
+ this.mindMap.on('node_active', (node, activeNodeList) => {
287
+ this.activeNodes = activeNodeList
288
+ })
289
+ },
273
290
  scribes() {
274
291
  this.scribeAct = !this.scribeAct
275
292
  this.activeNodes.forEach(node => {
@@ -320,11 +337,22 @@ export default {
320
337
  }
321
338
  this.mindMap.setLayout(layoutList)
322
339
  },
340
+ removeNode(data) {
341
+ if(data._node) {
342
+ delete data._node
343
+ }
344
+ if(data.children && data.children.length > 0) {
345
+ data.children.forEach(item => {
346
+ this.removeNode(item)
347
+ })
348
+ }
349
+ return data
350
+ },
323
351
  preservation() {
324
352
  let that = this
325
353
  that.mindMap.export('png',false,'123213', true).then(r => {
326
354
  that.$emit('preservation', {
327
- data: that.data,
355
+ data: that.removeNode(that.data),
328
356
  url: r
329
357
  })
330
358
  })
@@ -31,7 +31,7 @@
31
31
  <input class="file" :accept="item.accept" @change="fileTap($event,index)" type="file" />
32
32
  </label>
33
33
  </div>
34
- <div style="display: inline-block;" v-if="item.type === 'input'">
34
+ <div class="input-name" v-if="item.type === 'input'">
35
35
  <div v-if="item.number" class="number-input">
36
36
  <input type="number" @keypress="isNumberKey($event,index)"
37
37
  :placeholder="item.placeholder"
@@ -40,6 +40,7 @@
40
40
  </div>
41
41
  <input v-else type="text" :placeholder="item.placeholder" :maxlength="item.maxlength"
42
42
  v-model="item.value" :disabled="item.disabled"/>
43
+ <b>{{ item.tail }}</b>
43
44
  </div>
44
45
  <div style="display: inline-block;">
45
46
  <Select v-if="item.type === 'select'" :options="item.option"
@@ -251,4 +251,16 @@ font-size: 12px;
251
251
  cursor: pointer;
252
252
  min-width: 60px;
253
253
  display: inline-block;
254
+ }
255
+ .input-name{
256
+ display: inline-block;
257
+ position: relative;
258
+ }
259
+ .input-name b{
260
+ position: absolute;
261
+ top: 5px;
262
+ right: 10px;
263
+ z-index: 1;
264
+ font-size: 16px;
265
+ font-weight: normal;
254
266
  }
package/src/index.js CHANGED
@@ -69,7 +69,7 @@ function install(app) {
69
69
  }
70
70
 
71
71
  export default {
72
- version: '1.29.143',
72
+ version: '1.29.144',
73
73
  install,
74
74
  Calendar,
75
75
  Message,