@10yun/cv-mobile-ui 0.5.3 → 0.5.5

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.
Files changed (38) hide show
  1. package/package.json +1 -1
  2. package/ui-cv/{cv-button/cv-button.vue → cv-btn-base/cv-btn-base.vue} +19 -14
  3. package/ui-cv/cv-checkbox-group/cv-checkbox-group.vue +89 -56
  4. package/ui-cv/cv-checkbox-opt-base/cv-checkbox-opt-base.vue +43 -3
  5. package/ui-cv/cv-checkbox-opt-tag/cv-checkbox-opt-tag.vue +6 -2
  6. package/ui-cv/cv-code-sms/cv-code-sms.vue +34 -24
  7. package/ui-cv/cv-date-base/cv-date-base.vue +27 -6
  8. package/ui-cv/cv-datetime-base/cv-datetime-base.vue +31 -7
  9. package/ui-cv/cv-datetime5-base/cv-datetime5-base.vue +24 -7
  10. package/ui-cv/cv-dialog-share/cv-dialog-share.vue +2 -0
  11. package/ui-cv/cv-editor-quill/cv-editor-quill.vue +14 -13
  12. package/ui-cv/cv-form-base/cv-form-base.vue +1 -1
  13. package/ui-cv/cv-form-item/cv-form-item.vue +5 -2
  14. package/ui-cv/cv-geo-local/cv-geo-local.vue +118 -27
  15. package/ui-cv/{cv-picker-region/cv-picker-region.vue → cv-geo-region/cv-geo-region.vue} +30 -8
  16. package/ui-cv/cv-input-digit/cv-input-digit.vue +69 -13
  17. package/ui-cv/cv-input-idcard/cv-input-idcard.vue +70 -14
  18. package/ui-cv/cv-input-number/cv-input-number.vue +56 -13
  19. package/ui-cv/cv-input-password/cv-input-password.vue +66 -12
  20. package/ui-cv/cv-input-text/cv-input-text.vue +74 -7
  21. package/ui-cv/cv-picker1/cv-picker1.vue +28 -4
  22. package/ui-cv/cv-picker2/cv-picker2.vue +34 -11
  23. package/ui-cv/cv-picker3/cv-picker3.vue +41 -16
  24. package/ui-cv/cv-radio-group/cv-radio-group.vue +35 -13
  25. package/ui-cv/cv-radio-opt-base/cv-radio-opt-base.vue +37 -3
  26. package/ui-cv/cv-radio-opt-tag/cv-radio-opt-tag.vue +1 -1
  27. package/ui-cv/cv-rate/cv-rate.vue +24 -15
  28. package/ui-cv/cv-search/cv-search.vue +7 -1
  29. package/ui-cv/cv-specs/cv-specs.vue +13 -13
  30. package/ui-cv/cv-switch/cv-switch.vue +24 -16
  31. package/ui-cv/cv-textarea/cv-textarea.vue +18 -12
  32. package/ui-cv/cv-time-base/cv-time-base.vue +30 -3
  33. package/ui-cv/cv-treaty/cv-treaty.vue +18 -13
  34. package/ui-cv/cv-upload-avatar/cv-upload-avatar.vue +12 -5
  35. package/ui-cv/cv-upload-image/cv-upload-image.vue +21 -10
  36. package/ui-cv/cv-input-btn/cv-input-btn.vue +0 -124
  37. package/ui-cv/mixins/mixins-input.js +0 -75
  38. package/ui-cv/mixins/mixins-picker.js +0 -34
@@ -25,15 +25,12 @@
25
25
  @cancel="bindPickerCancel"
26
26
  >
27
27
  <view class="cv-time-base-text" v-if="localVal_time != ''">{{ localVal_time }}</view>
28
- <view class="cv-picker-item-placeholder" v-else>{{ placeholder }}</view>
28
+ <view class="cv-picker-item-placeholder" v-else>{{ placeholder2 }}</view>
29
29
  </picker>
30
30
  </view>
31
31
  </template>
32
-
33
32
  <script>
34
- import MixinsPicker from '../mixins/mixins-picker.js';
35
33
  export default {
36
- mixins: [MixinsPicker],
37
34
  name: 'cvPickerDatetime',
38
35
  props: {
39
36
  //默认输入框
@@ -41,6 +38,10 @@ export default {
41
38
  type: String,
42
39
  default: ''
43
40
  },
41
+ modelValue: {
42
+ type: String,
43
+ default: ''
44
+ },
44
45
  startDate: {
45
46
  type: String,
46
47
  default: ''
@@ -60,11 +61,22 @@ export default {
60
61
  fields: {
61
62
  type: String,
62
63
  default: 'day'
64
+ },
65
+ // 占位符
66
+ placeholder: {
67
+ type: String,
68
+ default: '请选择日期'
69
+ },
70
+ // 占位符
71
+ placeholder2: {
72
+ type: String,
73
+ default: '请选择时间'
63
74
  }
64
75
  },
65
76
  watch: {
66
- value(newValue) {
77
+ value(newVal) {
67
78
  this.localVal = this.value;
79
+ this.localVal = newVal;
68
80
  this.localVal_date = this.localVal.split(' ')[0] || '';
69
81
  this.localVal_time = this.localVal.split(' ')[1] || '';
70
82
  }
@@ -78,11 +90,16 @@ export default {
78
90
  };
79
91
  },
80
92
  created() {
81
- this.localVal = this.value;
93
+ this.localVal = this.doValueGet();
82
94
  this.localVal_date = this.localVal.split(' ')[0] || '';
83
95
  this.localVal_time = this.localVal.split(' ')[1] || '';
84
96
  },
85
97
  methods: {
98
+ doValueGet() {
99
+ if (this.value === '') return this.modelValue;
100
+ if (this.modelValue === '') return this.value;
101
+ return this.value;
102
+ },
86
103
  bindTimeChange: function (e) {
87
104
  let value = e.detail.value;
88
105
  this.localVal_time = value;
@@ -93,10 +110,17 @@ export default {
93
110
  this.localVal_date = value;
94
111
  this.mergeDateTime();
95
112
  },
113
+ bindPickerCancel() {
114
+ this.iconTop = false;
115
+ },
96
116
  mergeDateTime() {
97
117
  this.localVal = this.localVal_date + ' ' + this.localVal_time;
98
- this.$emit('input', this.localVal);
99
118
  this.iconTop = false;
119
+ this.$emit('input', this.localVal);
120
+ this.$emit('update:modelValue', this.localVal);
121
+ },
122
+ changeIconTop() {
123
+ this.iconTop = true;
100
124
  }
101
125
  }
102
126
  };
@@ -17,19 +17,18 @@
17
17
  </picker>
18
18
  </view>
19
19
  </template>
20
-
21
20
  <script>
22
- import MixinsPicker from '../mixins/mixins-picker.js';
23
21
  export default {
24
- mixins: [MixinsPicker],
25
22
  name: 'cvPickerDatetime5',
26
23
  props: {
27
24
  //默认输入框内容
28
25
  value: {
29
26
  type: String,
30
- default: () => {
31
- return '';
32
- }
27
+ default: ''
28
+ },
29
+ modelValue: {
30
+ type: String,
31
+ default: ''
33
32
  },
34
33
  dataType: {
35
34
  type: String,
@@ -46,12 +45,21 @@ export default {
46
45
  end: {
47
46
  type: String,
48
47
  default: ''
48
+ },
49
+ // 占位符
50
+ placeholder: {
51
+ type: String,
52
+ default: '请选择'
49
53
  }
50
54
  },
51
55
  watch: {
52
56
  value(newVal) {
53
57
  this.localVal = newVal;
54
58
  this.itemsSortOut();
59
+ },
60
+ modelValue(newVal) {
61
+ this.localVal = newVal;
62
+ this.itemsSortOut();
55
63
  }
56
64
  },
57
65
  data() {
@@ -74,7 +82,7 @@ export default {
74
82
  };
75
83
  },
76
84
  created() {
77
- this.localVal = this.value;
85
+ this.localVal = this.doValueGet();
78
86
  this.localDataType = this.dataType != 'value' ? 'text' : 'value';
79
87
  this.localJoint = this.joint;
80
88
 
@@ -84,6 +92,11 @@ export default {
84
92
  this.itemsSortOut();
85
93
  },
86
94
  methods: {
95
+ doValueGet() {
96
+ if (this.value === '') return this.modelValue;
97
+ if (this.modelValue === '') return this.value;
98
+ return this.value;
99
+ },
87
100
  initReginData(data) {
88
101
  let localData = [];
89
102
  for (const key in data) {
@@ -377,6 +390,9 @@ export default {
377
390
  this.updatelocalVal();
378
391
  this.iconTop = false;
379
392
  },
393
+ changeIconTop() {
394
+ this.iconTop = true;
395
+ },
380
396
  /* 取消选择 */
381
397
  onCancel(e) {
382
398
  this.iconTop = false;
@@ -444,6 +460,7 @@ export default {
444
460
  ':' +
445
461
  lastDatetimeArr[4];
446
462
  this.$emit('input', this.localVal);
463
+ this.$emit('update:modelValue', this.localVal);
447
464
  }
448
465
  }
449
466
  };
@@ -61,6 +61,7 @@ export default {
61
61
  this.shareClass = 'show';
62
62
  this.localIsShow = 1;
63
63
  this.$emit('input', this.localIsShow);
64
+ this.$emit('update:modelValue', this.localIsShow);
64
65
  },
65
66
  shareDiaHide() {
66
67
  this.shareClass = 'hide';
@@ -69,6 +70,7 @@ export default {
69
70
  this.shareClass = 'none';
70
71
  }, 150);
71
72
  this.$emit('input', this.localIsShow);
73
+ this.$emit('update:modelValue', this.localIsShow);
72
74
  }
73
75
  }
74
76
  };
@@ -149,28 +149,19 @@ export default {
149
149
  components: {
150
150
  helangCompress
151
151
  },
152
- name: 'cvEditor',
153
- inject: {
154
- cvFormGroup: {
155
- default() {
156
- return null;
157
- }
158
- }
159
- },
152
+ name: 'cvEditorQuill',
160
153
  props: {
161
154
  value: {
162
155
  type: String,
163
156
  default: ''
164
157
  },
165
- tip: {
158
+ modelValue: {
166
159
  type: String,
167
160
  default: ''
168
161
  },
169
162
  placeholder: {
170
163
  type: String,
171
- default() {
172
- return '开始输入...';
173
- }
164
+ default: '开始输入...'
174
165
  },
175
166
  upload: {
176
167
  type: Object,
@@ -196,10 +187,14 @@ export default {
196
187
  value(newVal) {
197
188
  this.localVal = newVal;
198
189
  this.setContents();
190
+ },
191
+ modelValue(newVal) {
192
+ this.localVal = newVal;
193
+ this.setContents();
199
194
  }
200
195
  },
201
196
  created() {
202
- this.localVal = this.value;
197
+ this.localVal = this.doValueGet();
203
198
  /* uni.loadFontFace({
204
199
  family: 'Pacifico',
205
200
  source: 'url("https://sungd.github.io/Pacifico.ttf")'
@@ -207,6 +202,11 @@ export default {
207
202
  // console.log(this.upload)
208
203
  },
209
204
  methods: {
205
+ doValueGet() {
206
+ if (this.value === '') return this.modelValue;
207
+ if (this.modelValue === '') return this.value;
208
+ return this.value;
209
+ },
210
210
  onBlur(e) {
211
211
  this.getContents();
212
212
  },
@@ -216,6 +216,7 @@ export default {
216
216
  success: (res) => {
217
217
  this.localVal = res.html;
218
218
  this.$emit('input', this.localVal);
219
+ this.$emit('update:modelValue', this.localVal);
219
220
  }
220
221
  });
221
222
  },
@@ -265,9 +265,9 @@ export default {
265
265
  }
266
266
  });
267
267
 
268
+ this.$emit('reset', event);
268
269
  this.$emit('input', this.formData);
269
270
  this.$emit('update:modelValue', this.formData);
270
- this.$emit('reset', event);
271
271
  },
272
272
 
273
273
  /**
@@ -451,7 +451,8 @@ export default {
451
451
  align-items: center;
452
452
  width: 65px;
453
453
  padding: 5px 0;
454
- height: 36px;
454
+ min-height: 36px;
455
+ font-weight: 500;
455
456
  }
456
457
 
457
458
  .cv-form-item__label .label-text {
@@ -467,11 +468,13 @@ export default {
467
468
  /* #ifndef APP-NVUE */
468
469
  width: 100%;
469
470
  box-sizing: border-box;
470
- min-height: 36px;
471
+ min-height: 40px;
471
472
  /* #endif */
472
473
  flex: 1;
473
474
  display: flex;
474
475
  align-items: center;
476
+ justify-content: space-between;
477
+ flex-direction: row;
475
478
  }
476
479
 
477
480
  .label-icon {
@@ -1,9 +1,10 @@
1
1
  <template>
2
2
  <view class="cv-geo-local-wrap">
3
- <view class="cv-geo-local" ref="onEmpty">
3
+ <view class="cv-geo-local-info" ref="onEmpty">
4
4
  <textarea
5
- class="cv-geo-local-item"
5
+ class="cv-geo-local-content"
6
6
  v-model="localVal"
7
+ :value="localVal"
7
8
  :maxlength="maxlength"
8
9
  :placeholder="placeholder"
9
10
  placeholder-class="cv-geo-local-placeholder"
@@ -16,41 +17,60 @@
16
17
  </view>
17
18
  <view class="cv-geo-local-map" v-if="isShowMap">
18
19
  <map
19
- style="width: 100%; height: 342rpx"
20
+ style="width: 100%; height: 170px"
20
21
  :longitude="map_location.longitude"
21
22
  :latitude="map_location.latitude"
22
- :scale="scale"
23
+ :scale="localScale"
23
24
  show-location
24
25
  :markers="markers"
25
26
  ></map>
26
27
  </view>
27
28
  </view>
28
29
  </template>
29
-
30
30
  <script>
31
- import MixinsInput from '../mixins/mixins-input.js';
32
31
  export default {
33
- mixins: [MixinsInput],
34
32
  name: 'cvGeoLocal',
35
33
  options: {
36
34
  addGlobalClass: true
37
35
  },
38
36
  props: {
37
+ value: {
38
+ type: [Number, String],
39
+ default: ''
40
+ },
41
+ modelValue: {
42
+ type: [Number, String],
43
+ default: ''
44
+ },
39
45
  placeholder: {
40
- type: String,
41
- default: '小区、门牌号等'
46
+ type: [String],
47
+ default: '请输入定位地址'
48
+ },
49
+ disabled: {
50
+ type: [Boolean],
51
+ default: false
52
+ },
53
+ clearable: {
54
+ type: [Boolean],
55
+ default: false
56
+ },
57
+ maxlength: {
58
+ type: [Number, String],
59
+ default: 5
42
60
  },
43
61
  isShowMap: {
44
62
  type: Boolean,
45
- default() {
46
- return false;
47
- }
63
+ default: false
48
64
  },
49
65
  location: {
50
66
  type: Object,
51
67
  default() {
52
68
  return {};
53
69
  }
70
+ },
71
+ scale: {
72
+ type: [Number, String],
73
+ default: 14
54
74
  }
55
75
  },
56
76
  watch: {
@@ -69,7 +89,15 @@ export default {
69
89
  this.initLocation();
70
90
  }
71
91
  },
72
- value(n) {
92
+ value(newVal) {
93
+ this.localVal = newVal;
94
+ if (this.isShowMap) {
95
+ console.log('change:value');
96
+ this.initLocation();
97
+ }
98
+ },
99
+ modelValue(newVal) {
100
+ this.localVal = newVal;
73
101
  if (this.isShowMap) {
74
102
  console.log('change:value');
75
103
  this.initLocation();
@@ -78,37 +106,92 @@ export default {
78
106
  },
79
107
  data() {
80
108
  return {
109
+ localStyle: '',
110
+ localVal: '',
81
111
  markers: [],
82
112
  //当前选择的位置
83
- scale: 12,
113
+ localScale: 14,
84
114
  map_location: {
85
- longitude: 116.397486,
86
- latitude: 39.90865
87
- }
115
+ longitude: 119.296411,
116
+ latitude: 26.074286
117
+ },
118
+ parentObj: null
88
119
  };
89
120
  },
90
121
  created() {
122
+ this.localVal = this.doValueGet();
123
+ this.localScale = this.scale;
91
124
  this.initLocation();
92
125
  },
126
+ mounted() {
127
+ this.parentObj = this.getParent();
128
+ this._itemStyle();
129
+ console.log(this.parentObj);
130
+ },
93
131
  methods: {
132
+ doValueGet() {
133
+ if (this.value === '') return this.modelValue;
134
+ if (this.modelValue === '') return this.value;
135
+ return this.value;
136
+ },
137
+ /**
138
+ * 获取父元素实例
139
+ */
140
+ getParent(name = 'cvFormItem') {
141
+ let parent = this.$parent;
142
+ let parentName = parent.$options.name;
143
+ while (parentName !== name) {
144
+ parent = parent.$parent;
145
+ if (!parent) return false;
146
+ parentName = parent.$options.name;
147
+ }
148
+ return parent;
149
+ },
150
+ _itemStyle() {
151
+ /**计算label宽度 */
152
+ let styleWidth = '';
153
+ if (this.parentObj.labelPosition) {
154
+ styleWidth = 'width:calc( 100% - 33px);';
155
+ } else {
156
+ let itemWidth = this.parentObj.labelWidth || 70;
157
+ styleWidth = `width:calc( 100% - 33px - ${itemWidth}px);`;
158
+ }
159
+ this.localStyle = styleWidth;
160
+ },
161
+ onBlur(e) {
162
+ this.localVal = e.detail.value;
163
+ this.funcOnInput();
164
+ },
165
+ funcOnInput(e) {
166
+ console.log('-----funcOnInput---', this.localVal);
167
+ this.$emit('input', this.localVal);
168
+ this.$emit('update:modelValue', this.localVal);
169
+ },
170
+ /* 监听自己清除按钮点击事件 */
171
+ onEmpty() {
172
+ this.localVal = '';
173
+ this.funcOnInput();
174
+ },
94
175
  initLocation() {
95
176
  if (this.location.longitude && this.location.latitude) {
96
177
  this.map_location = this.location;
97
178
  }
98
- if (this.value) {
99
- this.$set(this.map_location, 'address', this.value);
179
+ console.log('--', this.map_location);
180
+ if (this.localVal) {
181
+ this.$set(this.map_location, 'address', this.localVal);
100
182
  }
101
183
  },
102
184
  chooseLocation() {
103
185
  uni.chooseLocation({
104
186
  keyword: '小区 写字楼', //搜索关键字,仅App平台支持
105
187
  success: (res) => {
188
+ console.log(res);
106
189
  if (res.errMsg == 'chooseLocation:ok') {
107
- this.localVal = res.address;
190
+ this.localVal = res.address || '';
108
191
  this.map_location = { ...res };
109
- this.scale = 16;
192
+ this.localScale = 16;
110
193
  this.$emit('location', { ...res });
111
- this.$emit('input', this.localVal);
194
+ this.funcOnInput();
112
195
  }
113
196
  }
114
197
  });
@@ -138,9 +221,18 @@ export default {
138
221
  <style>
139
222
  .cv-geo-local-wrap {
140
223
  display: contents;
224
+ display: flex;
225
+ flex-direction: column;
226
+ width: 100%;
227
+ }
228
+ .cv-geo-local-info {
229
+ display: flex;
230
+ flex-direction: row;
231
+ justify-content: space-between;
232
+ align-items: center;
141
233
  }
142
- .cv-geo-local-item {
143
- min-height: 60px;
234
+ .cv-geo-local-content {
235
+ min-height: 46px;
144
236
  line-height: 1.5em;
145
237
  font-size: 14px;
146
238
  padding: 7px 30px 0 0;
@@ -148,8 +240,8 @@ export default {
148
240
  }
149
241
  .cv-geo-local-rtip {
150
242
  color: #999;
151
- width: 50rpx;
152
- padding: 10rpx 0rpx 10rpx 0;
243
+ width: 25px;
244
+ padding: 5 0 5 0;
153
245
  position: absolute;
154
246
  right: 0;
155
247
  top: -7px;
@@ -167,7 +259,6 @@ export default {
167
259
  right: 3px;
168
260
  }
169
261
  .cv-geo-local-map {
170
- padding: 10px 15px;
171
262
  background-color: #ffffff;
172
263
  }
173
264
  </style>
@@ -20,20 +20,20 @@
20
20
  </picker>
21
21
  </view>
22
22
  </template>
23
-
24
23
  <script>
25
- import MixinsPicker from '../mixins/mixins-picker.js';
26
24
  import province from '../dict/area-province.js';
27
25
  import city from '../dict/area-city.js';
28
26
  import county from '../dict/area-county.js';
29
27
  export default {
30
- mixins: [MixinsPicker],
31
28
  name: 'cvPickerRegion',
32
29
  props: {
33
- //默认输入框内容
34
30
  value: {
35
- type: Array,
36
- default: () => {}
31
+ type: [Array, Object],
32
+ default: () => []
33
+ },
34
+ modelValue: {
35
+ type: [Array, Object],
36
+ default: () => []
37
37
  },
38
38
  dataType: {
39
39
  type: String,
@@ -42,18 +42,27 @@ export default {
42
42
  joint: {
43
43
  type: String,
44
44
  default: ''
45
+ },
46
+ // 占位符
47
+ placeholder: {
48
+ type: String,
49
+ default: '请选择'
45
50
  }
46
51
  },
47
52
  watch: {
48
53
  value(newVal) {
49
54
  this.localVal = newVal;
50
55
  this.itemsSortOut();
56
+ },
57
+ modelValue(newVal) {
58
+ this.localVal = newVal;
59
+ this.itemsSortOut();
51
60
  }
52
61
  },
53
62
  data() {
54
63
  return {
55
64
  iconTop: false,
56
- localVal: '',
65
+ localVal: [],
57
66
  range_data: [], //弹窗临时数组
58
67
  last_range_data: [], //最终显示页面数组
59
68
  items_index: [0, 0, 0], //当前下标
@@ -67,11 +76,20 @@ export default {
67
76
  };
68
77
  },
69
78
  created() {
70
- this.localVal = this.value;
79
+ this.localVal = this.doValueGet();
71
80
  this.localDataType = this.dataType != 'value' ? 'text' : 'value';
72
81
  this.itemsSortOut();
73
82
  },
74
83
  methods: {
84
+ doValueGet() {
85
+ if (this.value === '' || (Array.prototype.isPrototypeOf(this.value) && this.value.length === 0)) {
86
+ return this.modelValue;
87
+ }
88
+ if (this.modelValue === '' || (Array.prototype.isPrototypeOf(this.modelValue) && this.modelValue.length === 0)) {
89
+ return this.value;
90
+ }
91
+ return this.value;
92
+ },
75
93
  initReginData(data) {
76
94
  let localData = [];
77
95
  for (const key in data) {
@@ -137,6 +155,9 @@ export default {
137
155
  this.updatelocalVal();
138
156
  this.iconTop = false;
139
157
  },
158
+ changeIconTop() {
159
+ this.iconTop = true;
160
+ },
140
161
  /* 取消选择 */
141
162
  onCancel(e) {
142
163
  this.iconTop = false;
@@ -188,6 +209,7 @@ export default {
188
209
  value[2] = this.range_data[2][items_index[2]].value;
189
210
  }
190
211
  this.$emit('input', value);
212
+ this.$emit('update:modelValue', value);
191
213
 
192
214
  // 把选中的3个数组传递出去
193
215