sadais-piui 1.2.7-beta23 → 1.2.7-beta26

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.
@@ -56,8 +56,12 @@ export default {
56
56
  }
57
57
  },
58
58
  watch: {
59
- needInit() {
60
- this.init()
59
+ needInit: {
60
+ deep: true,
61
+ immediate: false,
62
+ handler(value) {
63
+ this.init()
64
+ }
61
65
  },
62
66
  // 当父组件需要子组件需要共享的参数发生了变化,手动通知子组件
63
67
  parentData() {
@@ -75,9 +79,11 @@ export default {
75
79
  methods: {
76
80
  // 重新初始化一次内部的所有子元素
77
81
  init() {
78
- this.children.map(child => {
79
- child.init()
80
- })
82
+ console.log('折叠面板初始化')
83
+ this.children &&
84
+ this.children.map(child => {
85
+ child.init()
86
+ })
81
87
  },
82
88
  /**
83
89
  * collapse-item被点击时触发,由collapse统一处理各子组件的状态
@@ -263,7 +263,7 @@ export default {
263
263
  data() {
264
264
  return {
265
265
  initialValue: '', // 初始值
266
- validateState: '', // 是否校验成功
266
+ validateState: 'success', // 是否校验成功
267
267
  validateMessage: '' // 校验失败的提示语
268
268
  }
269
269
  },
@@ -400,7 +400,7 @@ export default {
400
400
  // 从pi-form的rules属性中,取出当前pi-form-item的校验规则
401
401
  getRules() {
402
402
  // 父组件的所有规则
403
- const parentRules = this._parent && (this._parent.validRules || this._parent.rules)
403
+ const parentRules = this._parent && this._parent.validRules
404
404
  const rules = parentRules ? parentRules[this.prop] : []
405
405
  return [].concat(rules || [])
406
406
  },
@@ -423,6 +423,9 @@ export default {
423
423
  return new Promise((resolve, reject) => {
424
424
  const rules = this.getFilteredRule(trigger)
425
425
  if (!this.prop || !rules || rules.length === 0) {
426
+ this.validateState = 'success'
427
+ this.validateMessage = ''
428
+ console.log(TAG, '字段无需校验', this.prop)
426
429
  return resolve(_getResolve())
427
430
  }
428
431
  const fieldValue = this._parent ? this._parent.model[this.prop] : undefined
@@ -45,7 +45,7 @@
45
45
  name="item"
46
46
  :item="item"
47
47
  :index="index"
48
- :length="getItems.length"
48
+ :length="getItemsLength"
49
49
  :active="index < val"
50
50
  >
51
51
  <view>{{ item.name }}</view>
@@ -250,7 +250,8 @@ export default {
250
250
  this.direction === 'column' &&
251
251
  this.itemsRect.length &&
252
252
  this.iconsRect.length &&
253
- (this.itemsRect.length === 1 || index < this.itemsRect.length - 1)
253
+ (this.itemsRect.length === 1 || index < this.itemsRect.length - 1) &&
254
+ (this.iconsRect.length === 1 || index < this.iconsRect.length - 1)
254
255
  ) {
255
256
  // 动态计算线的位置和高度
256
257
  item.lineStyle.top = `${this.iconsRect[index].top -
@@ -264,6 +265,9 @@ export default {
264
265
  }
265
266
  return item
266
267
  })
268
+ },
269
+ getItemsLength() {
270
+ return this.items.length
267
271
  }
268
272
  },
269
273
  watch: {
@@ -283,7 +287,13 @@ export default {
283
287
  if (!this.items?.length) return
284
288
  this.iconsRect = await this.$pi.common.queryRect(this, '.step-icon-inner', true)
285
289
  this.itemsRect = await this.$pi.common.queryRect(this, '.pi-steps-item', true)
286
- console.log(TAG, '计算.pi-steps布局', this.itemsRect, this.iconsRect)
290
+ if (this.iconsRect.length !== this.itemsRect.length) {
291
+ setTimeout(() => {
292
+ this.init()
293
+ }, 200)
294
+ } else {
295
+ console.log(TAG, '计算.pi-steps布局', this.itemsRect, this.iconsRect)
296
+ }
287
297
  }
288
298
  }
289
299
  }
@@ -1,14 +1,14 @@
1
1
  <!--
2
2
  * @Author: zhangzhenfei
3
3
  * @Date: 2021-08-13 11:31:57
4
- * @LastEditTime: 2022-04-12 09:11:41
4
+ * @LastEditTime: 2022-07-21 11:25:37
5
5
  * @LastEditors: zhangzhenfei
6
6
  * @Description: 图片上传组件
7
- * @FilePath: \hfmp-checkin-frontc:\Users\feilin\workspace\sadais\piui-awesome\src\piui\components\pi-upload-img\index.vue
7
+ * @FilePath: /dt-weitibao-console/Users/feilin/workspace/piui/piui-awesome/src/piui/components/pi-upload-img/index.vue
8
8
  -->
9
9
 
10
10
  <template>
11
- <view class="pi-upload-img" :style="[customStyle]" :class="[customClass]">
11
+ <view class="pi-upload-img pi-pd-top-12" :style="[customStyle]" :class="[customClass]">
12
12
  <!-- 已上传图片展示 -->
13
13
  <view
14
14
  v-for="(img, index) in getImgs"
@@ -305,13 +305,29 @@ export default {
305
305
  return this.$pi.lang.isString(this.val)
306
306
  },
307
307
  getImgs() {
308
+ if (this.val === null || this.val === undefined) {
309
+ return []
310
+ }
308
311
  return this.isValString ? (this.val ? [this.val] : []) : this.val.filter(img => img)
309
312
  },
310
313
  getItemStyle() {
311
- return this.$pi.lang.mergeDeep(uploadImg.itemStyle, this.itemStyle)
314
+ const style = {
315
+ width: this.getSize,
316
+ height: this.getSize
317
+ }
318
+ const uploadStyle = this.$pi.lang.mergeDeep(uploadImg.itemStyle, this.itemStyle)
319
+ return this.$pi.lang.mergeDeep(style, uploadStyle)
320
+ },
321
+ getSize() {
322
+ return this.$pi.common.addUnit(this.size)
312
323
  },
313
324
  getUploadBtnStyle() {
314
- return this.$pi.lang.mergeDeep(uploadImg.uploadBtnStyle, this.uploadBtnStyle)
325
+ const style = {
326
+ width: this.getSize,
327
+ height: this.getSize
328
+ }
329
+ const uploadBtnStyle = this.$pi.lang.mergeDeep(uploadImg.uploadBtnStyle, this.uploadBtnStyle)
330
+ return this.$pi.lang.mergeDeep(style, uploadBtnStyle)
315
331
  },
316
332
  getUploadIcon() {
317
333
  return this.$pi.lang.mergeDeep(uploadImg.uploadIcon, this.uploadIcon)
@@ -1,10 +1,10 @@
1
1
  /*
2
2
  * @Author: zhangzhenfei
3
3
  * @Date: 2021-08-13 11:29:02
4
- * @LastEditTime: 2021-11-17 10:07:54
4
+ * @LastEditTime: 2022-07-21 11:20:15
5
5
  * @LastEditors: zhangzhenfei
6
6
  * @Description: 图片上传
7
- * @FilePath: /piui-awesome/src/piui/config/upload-img.js
7
+ * @FilePath: /dt-weitibao-console/Users/feilin/workspace/piui/piui-awesome/src/piui/config/uploadImg.js
8
8
  */
9
9
  import icon from './icon.js'
10
10
  import cropOption from './imgCropper.js'
@@ -18,18 +18,14 @@ export default {
18
18
  formData: {}, // 上传表单额外数据,对象形式(默认值:{})
19
19
  name: 'file', // 上传的文件字段名
20
20
  itemStyle: {
21
- width: '160rpx',
22
- height: '160rpx',
23
21
  borderRadius: '8rpx'
24
22
  }, // 单个文件额外样式,对象形式(默认值:{})
25
23
  uploadBtnStyle: {
26
- width: '160rpx',
27
- height: '160rpx',
28
24
  background: '#f3f3f3',
29
25
  borderRadius: '8rpx'
30
26
  },
31
27
  imageMode: 'aspectFill', // 上传图片模式,默认值:aspectFill
32
- size: '80', // 上传区域尺寸(半径)
28
+ size: '160', // 上传区域尺寸(半径)
33
29
  previewFullImage: true, // 是否在点击预览图后展示全屏图片预览
34
30
  deletable: true, // 是否可以删除上传的文件
35
31
  disabled: false, // 是否禁用上传
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sadais-piui",
3
- "version": "1.2.7beta23",
3
+ "version": "1.2.7beta26",
4
4
  "description": "piui组件库",
5
5
  "main": "index.js",
6
6
  "scripts": {