@10yun/cv-mobile-ui 0.5.62 → 0.5.63

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 (67) hide show
  1. package/package.json +1 -1
  2. package/plugins/uni-extend.js +10 -10
  3. package/ui-fireui/components/u-action-sheet/u-action-sheet.vue +46 -16
  4. package/ui-fireui/components/u-alert/u-alert.vue +11 -5
  5. package/ui-fireui/components/u-badge/u-badge.vue +52 -69
  6. package/ui-fireui/components/u-bottom-navigation/u-bottom-navigation.vue +28 -20
  7. package/ui-fireui/components/u-bottom-popup/u-bottom-popup.vue +40 -11
  8. package/ui-fireui/components/u-bubble-popup/u-bubble-popup.vue +3 -6
  9. package/ui-fireui/components/u-button/u-button.vue +262 -259
  10. package/ui-fireui/components/u-calendar/u-calendar.vue +227 -44
  11. package/ui-fireui/components/u-calendar/u-calendar2.js +562 -0
  12. package/ui-fireui/components/u-card/u-card.vue +50 -32
  13. package/ui-fireui/components/u-cascade-selection/u-cascade-selection.vue +197 -74
  14. package/ui-fireui/components/u-circular-progress/u-circular-progress.vue +324 -0
  15. package/ui-fireui/components/u-clipboard2/tui-clipboard.js +53 -0
  16. package/ui-fireui/components/u-collapse/u-collapse.vue +8 -8
  17. package/ui-fireui/components/u-config/index.js +129 -0
  18. package/ui-fireui/components/u-count-down/u-count-down.vue +124 -19
  19. package/ui-fireui/components/u-datetime/u-datetime.vue +416 -176
  20. package/ui-fireui/components/u-divider/u-divider.vue +3 -3
  21. package/ui-fireui/components/u-drawer/u-drawer.vue +55 -12
  22. package/ui-fireui/components/u-dropdown-list/u-dropdown-list.vue +103 -0
  23. package/ui-fireui/components/u-fab/u-fab.vue +344 -0
  24. package/ui-fireui/components/u-footer/u-footer.vue +148 -0
  25. package/ui-fireui/components/u-grid/u-grid.vue +2 -8
  26. package/ui-fireui/components/u-grid-item/u-grid-item.vue +22 -5
  27. package/ui-fireui/components/u-icon/u-icon-new.js +190 -0
  28. package/ui-fireui/components/u-icon/u-icon-new.vue +100 -0
  29. package/ui-fireui/components/u-image-cropper/u-image-cropper.vue +1144 -0
  30. package/ui-fireui/components/u-image-group/u-image-group.vue +164 -0
  31. package/ui-fireui/components/u-keyboard/u-keyboard.vue +3 -2
  32. package/ui-fireui/components/u-keyboard-input/u-keyboard-input.vue +1 -1
  33. package/ui-fireui/components/u-list-cell/u-list-cell.vue +82 -72
  34. package/ui-fireui/components/u-list-view/u-list-view.vue +33 -8
  35. package/ui-fireui/components/u-loading/u-loading.vue +107 -27
  36. package/ui-fireui/components/u-loadmore/u-loadmore.vue +21 -3
  37. package/ui-fireui/components/u-modal/u-modal.vue +140 -176
  38. package/ui-fireui/components/u-navigation-bar/u-navigation-bar.vue +121 -28
  39. package/ui-fireui/components/u-no-data/u-no-data.vue +58 -20
  40. package/ui-fireui/components/u-nomore/u-nomore.vue +5 -4
  41. package/ui-fireui/components/u-numberbox/u-numberbox.vue +88 -45
  42. package/ui-fireui/components/u-picture-cropper/u-picture-cropper.vue +94 -36
  43. package/ui-fireui/components/u-picture-cropper/u-picture-cropper.wxs +27 -17
  44. package/ui-fireui/components/u-rate/u-rate.vue +197 -0
  45. package/ui-fireui/components/u-round-progress/u-round-progress.vue +62 -42
  46. package/ui-fireui/components/u-scroll-top/u-scroll-top.vue +4 -3
  47. package/ui-fireui/components/u-section/u-section.vue +149 -0
  48. package/ui-fireui/components/u-skeleton/u-skeleton.vue +37 -6
  49. package/ui-fireui/components/u-steps/u-steps.vue +110 -27
  50. package/ui-fireui/components/u-sticky/u-sticky.vue +35 -21
  51. package/ui-fireui/components/u-sticky-wxs/u-sticky-wxs.vue +7 -4
  52. package/ui-fireui/components/u-sticky-wxs/u-sticky.wxs +39 -36
  53. package/ui-fireui/components/u-swipe-action/u-swipe-action.vue +76 -19
  54. package/ui-fireui/components/u-tabbar/u-tabbar.vue +71 -38
  55. package/ui-fireui/components/u-tabs/u-tabs.vue +133 -51
  56. package/ui-fireui/components/u-tag/u-tag.vue +109 -226
  57. package/ui-fireui/components/u-time-axis/u-time-axis.vue +1 -1
  58. package/ui-fireui/components/u-timeaxis-item/u-timeaxis-item.vue +1 -1
  59. package/ui-fireui/components/u-tips/u-tips.vue +35 -15
  60. package/ui-fireui/components/u-toast/u-toast.vue +9 -5
  61. package/ui-fireui/components/u-top-dropdown/u-top-dropdown.vue +8 -6
  62. package/ui-fireui/components/u-upload/u-upload-old.vue +462 -0
  63. package/ui-fireui/components/u-upload/u-upload.vue +648 -446
  64. package/ui-fireui/components/u-white-space/u-white-space.vue +68 -0
  65. package/ui-fireui/components/u-wing-blank/u-wing-blank.vue +100 -0
  66. package/uview-plus/libs/ctocode/index.js +1 -0
  67. package/uview-plus/libs/ctocode/richText.js +0 -1
@@ -1,95 +1,107 @@
1
1
  <template>
2
- <view class="up-datetime-picker">
2
+ <view class="up-datetime-picker" :style="{ zIndex }">
3
3
  <view
4
- class="up-mask"
5
- :class="{ 'up-mask-show': isShow }"
4
+ class="up-datetime__mask"
5
+ :class="{ 'up-datetime__mask-show': isShow }"
6
+ :style="{ zIndex: getMaskZIndex }"
6
7
  @touchmove.stop.prevent="stop"
7
8
  catchtouchmove="stop"
8
- @tap="hide"
9
+ @tap="maskClick"
9
10
  ></view>
10
- <view class="up-header" :class="{ 'up-show': isShow }">
11
- <view class="up-picker-header" :class="{ 'up-date-radius': radius }" @touchmove.stop.prevent="stop" catchtouchmove="stop">
12
- <view class="up-btn-picker" :style="{ color: cancelColor }" hover-class="up-opacity" :hover-stay-time="150" @click="hide">
11
+ <view class="up-datetime__header" :class="{ 'up-show': isShow }" :style="{ zIndex: getPickerZIndex }">
12
+ <view
13
+ class="up-picker-header"
14
+ :class="{ 'up-date-radius': radius }"
15
+ :style="{ backgroundColor: headerBackground }"
16
+ @touchmove.stop.prevent="stop"
17
+ catchtouchmove="stop"
18
+ >
19
+ <view class="up-btn-picker" :style="{ color: cancelColor }" hover-class="up-opacity" :hover-stay-time="150" @tap="hide">
13
20
  取消
14
21
  </view>
15
- <view class="up-btn-picker" :style="{ color: color }" hover-class="up-opacity" :hover-stay-time="150" @click="btnFix">
22
+ <view class="up-pickerdate__title" :style="{ fontSize: titleSize + 'rpx', color: titleColor }">{{ title }}</view>
23
+ <view class="up-btn-picker" :style="{ color: getColor }" hover-class="up-opacity" :hover-stay-time="150" @tap="btnFix">
16
24
  确定
17
25
  </view>
18
26
  </view>
19
- <view class="up-date-header" v-if="unitTop">
20
- <view class="up-date-unit" v-if="type < 4 || type == 7">年</view>
21
- <view class="up-date-unit" v-if="type < 4 || type == 7">月</view>
22
- <view class="up-date-unit" v-if="type == 1 || type == 2 || type == 7">日</view>
23
- <view class="up-date-unit" v-if="type == 1 || type == 4 || type == 5 || type == 7">时</view>
24
- <view class="up-date-unit" v-if="type == 1 || type > 3">分</view>
25
- <view class="up-date-unit" v-if="type > 4">秒</view>
27
+ <view class="up-date-header" :style="{ backgroundColor: unitBackground }" v-if="unitTop">
28
+ <view class="up-date-unit" v-if="type < 4 || type == 7 || type == 8">年</view>
29
+ <view class="up-date-unit" v-if="(type < 4 && type > 0) || type == 7 || type == 8">月</view>
30
+ <view class="up-date-unit" v-if="type == 1 || type == 2 || type == 7 || type == 8">日</view>
31
+ <view class="up-date-unit" v-if="type == 1 || type == 4 || type == 5 || type == 7 || type == 8">时</view>
32
+ <view class="up-date-unit" v-if="(type == 1 || type > 3) && type != 8">分</view>
33
+ <view class="up-date-unit" v-if="type > 4 && type != 8">秒</view>
26
34
  </view>
27
- <view class="up-picker-body">
28
- <picker-view :value="value" @change="change" class="up-picker-view">
29
- <picker-view-column v-if="!reset && (type < 4 || type == 7)">
35
+ <view
36
+ @touchstart.stop="pickerstart"
37
+ class="up-date__picker-body"
38
+ :style="{ backgroundColor: bodyBackground, height: height + 'rpx' }"
39
+ >
40
+ <picker-view :key="type" :immediate-change="immediate" :value="value" @change="change" class="up-datetime__picker-view">
41
+ <picker-view-column v-if="type < 4 || type == 7 || type == 8">
30
42
  <view
31
- class="up-column-item"
43
+ class="up-date__column-item"
32
44
  :class="{ 'up-font-size_32': !unitTop && type == 7 }"
33
45
  v-for="(item, index) in years"
34
46
  :key="index"
35
47
  >
36
48
  {{ item }}
37
- <text class="up-unit-text" v-if="!unitTop">年</text>
49
+ <text class="up-date__unit-text" v-if="!unitTop">年</text>
38
50
  </view>
39
51
  </picker-view-column>
40
- <picker-view-column v-if="!reset && (type < 4 || type == 7)">
52
+ <picker-view-column v-if="(type < 4 && type > 0) || type == 7 || type == 8">
41
53
  <view
42
- class="up-column-item"
54
+ class="up-date__column-item"
43
55
  :class="{ 'up-font-size_32': !unitTop && type == 7 }"
44
56
  v-for="(item, index) in months"
45
57
  :key="index"
46
58
  >
47
59
  {{ formatNum(item) }}
48
- <text class="up-unit-text" v-if="!unitTop">月</text>
60
+ <text class="up-date__unit-text" v-if="!unitTop">月</text>
49
61
  </view>
50
62
  </picker-view-column>
51
- <picker-view-column v-if="!reset && (type == 1 || type == 2 || type == 7)">
63
+ <picker-view-column v-if="type == 1 || type == 2 || type == 7 || type == 8">
52
64
  <view
53
- class="up-column-item"
65
+ class="up-date__column-item"
54
66
  :class="{ 'up-font-size_32': !unitTop && type == 7 }"
55
67
  v-for="(item, index) in days"
56
68
  :key="index"
57
69
  >
58
70
  {{ formatNum(item) }}
59
- <text class="up-unit-text" v-if="!unitTop">日</text>
71
+ <text class="up-date__unit-text" v-if="!unitTop">日</text>
60
72
  </view>
61
73
  </picker-view-column>
62
- <picker-view-column v-if="!reset && (type == 1 || type == 4 || type == 5 || type == 7)">
74
+ <picker-view-column v-if="type == 1 || type == 4 || type == 5 || type == 7 || type == 8">
63
75
  <view
64
- class="up-column-item"
76
+ class="up-date__column-item"
65
77
  :class="{ 'up-font-size_32': !unitTop && type == 7 }"
66
78
  v-for="(item, index) in hours"
67
79
  :key="index"
68
80
  >
69
81
  {{ formatNum(item) }}
70
- <text class="up-unit-text" v-if="!unitTop">时</text>
82
+ <text class="up-date__unit-text" v-if="!unitTop">时</text>
71
83
  </view>
72
84
  </picker-view-column>
73
- <picker-view-column v-if="!reset && (type == 1 || type > 3)">
85
+ <picker-view-column v-if="(type == 1 || type > 3) && type != 8">
74
86
  <view
75
- class="up-column-item"
87
+ class="up-date__column-item"
76
88
  :class="{ 'up-font-size_32': !unitTop && type == 7 }"
77
89
  v-for="(item, index) in minutes"
78
90
  :key="index"
79
91
  >
80
92
  {{ formatNum(item) }}
81
- <text class="up-unit-text" v-if="!unitTop">分</text>
93
+ <text class="up-date__unit-text" v-if="!unitTop">分</text>
82
94
  </view>
83
95
  </picker-view-column>
84
- <picker-view-column v-if="!reset && type > 4">
96
+ <picker-view-column v-if="type > 4 && type != 8">
85
97
  <view
86
- class="up-column-item"
98
+ class="up-date__column-item"
87
99
  :class="{ 'up-font-size_32': !unitTop && type == 7 }"
88
100
  v-for="(item, index) in seconds"
89
101
  :key="index"
90
102
  >
91
103
  {{ formatNum(item) }}
92
- <text class="up-unit-text" v-if="!unitTop">秒</text>
104
+ <text class="up-date__unit-text" v-if="!unitTop">秒</text>
93
105
  </view>
94
106
  </picker-view-column>
95
107
  </picker-view>
@@ -100,11 +112,12 @@
100
112
 
101
113
  <script>
102
114
  export default {
103
- name: 'fuiDatetime',
115
+ name: 'tuiDatetime',
116
+ emits: ['cancel', 'confirm'],
104
117
  props: {
105
- //1-日期+时间(年月日+时分) 2-日期(年月日) 3-日期(年月) 4-时间(时分) 5-时分秒 6-分秒 7-年月日 时分秒
118
+ //0-年 1-日期+时间(年月日+时分) 2-日期(年月日) 3-日期(年月) 4-时间(时分) 5-时分秒 6-分秒 7-年月日 时分秒 8-年月日+小时
106
119
  type: {
107
- type: Number,
120
+ type: [Number, String],
108
121
  default: 1
109
122
  },
110
123
  //年份区间
@@ -117,6 +130,39 @@ export default {
117
130
  type: Number,
118
131
  default: 2050
119
132
  },
133
+ hoursData: {
134
+ type: Array,
135
+ default() {
136
+ return [];
137
+ }
138
+ },
139
+ minutesData: {
140
+ type: Array,
141
+ default() {
142
+ return [];
143
+ }
144
+ },
145
+ secondsData: {
146
+ type: Array,
147
+ default() {
148
+ return [];
149
+ }
150
+ },
151
+ //显示标题
152
+ title: {
153
+ type: String,
154
+ default: ''
155
+ },
156
+ //标题字体大小
157
+ titleSize: {
158
+ type: [Number, String],
159
+ default: 34
160
+ },
161
+ //标题字体颜色
162
+ titleColor: {
163
+ type: String,
164
+ default: '#333'
165
+ },
120
166
  //"取消"字体颜色
121
167
  cancelColor: {
122
168
  type: String,
@@ -125,7 +171,7 @@ export default {
125
171
  //"确定"字体颜色
126
172
  color: {
127
173
  type: String,
128
- default: '#5677fc'
174
+ default: ''
129
175
  },
130
176
  //设置默认显示日期 2019-08-01 || 2019-08-01 17:01 || 2019/08/01
131
177
  setDateTime: {
@@ -141,10 +187,43 @@ export default {
141
187
  radius: {
142
188
  type: Boolean,
143
189
  default: false
190
+ },
191
+ //头部背景色
192
+ headerBackground: {
193
+ type: String,
194
+ default: '#fff'
195
+ },
196
+ //根据实际调整,不建议使用深颜色
197
+ bodyBackground: {
198
+ type: String,
199
+ default: '#fff'
200
+ },
201
+ //单位置顶时,单位条背景色
202
+ unitBackground: {
203
+ type: String,
204
+ default: '#fff'
205
+ },
206
+ height: {
207
+ type: [Number, String],
208
+ default: 520
209
+ },
210
+ //点击遮罩 是否可关闭
211
+ maskClosable: {
212
+ type: Boolean,
213
+ default: true
214
+ },
215
+ zIndex: {
216
+ type: [Number, String],
217
+ default: 998
144
218
  }
145
219
  },
146
220
  data() {
221
+ let immediate = true;
222
+ // #ifdef MP-TOUTIAO
223
+ immediate = false;
224
+ // #endif
147
225
  return {
226
+ immediate,
148
227
  isShow: false,
149
228
  years: [],
150
229
  months: [],
@@ -160,19 +239,34 @@ export default {
160
239
  second: 0,
161
240
  startDate: '',
162
241
  endDate: '',
163
- value: [0, 0, 0, 0, 0, 0],
164
- reset: false
242
+ value: [],
243
+ isEnd: true,
244
+ isChange: false,
245
+ isSelect: false
165
246
  };
166
247
  },
167
248
  mounted() {
168
- this.initData();
249
+ this.$nextTick(() => {
250
+ setTimeout(() => {
251
+ this.initData();
252
+ }, 20);
253
+ });
169
254
  },
170
255
  computed: {
171
256
  yearOrMonth() {
172
257
  return `${this.year}-${this.month}`;
173
258
  },
174
259
  propsChange() {
175
- return `${this.setDateTime}-${this.type}-${this.startYear}-${this.endYear}`;
260
+ return `${this.type}-${this.startYear}-${this.endYear}-${this.hoursData}-${this.minutesData}-${this.secondsData}`;
261
+ },
262
+ getColor() {
263
+ return this.color || (uni && uni.$tui && uni.$tui.color.primary) || '#5677fc';
264
+ },
265
+ getMaskZIndex() {
266
+ return Number(this.zIndex) + 1;
267
+ },
268
+ getPickerZIndex() {
269
+ return Number(this.zIndex) + 2;
176
270
  }
177
271
  },
178
272
  watch: {
@@ -180,10 +274,21 @@ export default {
180
274
  this.setDays();
181
275
  },
182
276
  propsChange() {
183
- this.reset = true;
184
- setTimeout(() => {
185
- this.initData();
186
- }, 10);
277
+ if (this.isChange) return;
278
+ this.isChange = true;
279
+ this.$nextTick(() => {
280
+ setTimeout(() => {
281
+ this.isChange = false;
282
+ this.initData();
283
+ }, 50);
284
+ });
285
+ },
286
+ setDateTime(val) {
287
+ if (val && val !== true) {
288
+ setTimeout(() => {
289
+ this.initData();
290
+ }, 20);
291
+ }
187
292
  }
188
293
  },
189
294
  methods: {
@@ -195,29 +300,58 @@ export default {
195
300
  return Array.from(new Array(end + 1).keys()).slice(start);
196
301
  },
197
302
  getIndex(arr, val) {
303
+ if (!arr || arr.length === 0 || val === undefined) return 0;
198
304
  let index = arr.indexOf(val);
199
- return ~index ? index : 0;
305
+ return index == -1 ? 0 : index;
306
+ },
307
+ getCharCount(str) {
308
+ let regex = new RegExp('/', 'g');
309
+ let result = str.match(regex);
310
+ return !result ? 0 : result.length;
200
311
  },
201
312
  //日期时间处理
202
313
  initSelectValue() {
203
- let fdate = this.setDateTime.replace(/\-/g, '/');
204
- fdate = fdate && fdate.indexOf('/') == -1 ? `2020/01/01 ${fdate}` : fdate;
314
+ let fdate = '';
315
+ if (this.setDateTime && this.setDateTime !== true) {
316
+ fdate = this.setDateTime.replace(/\-/g, '/');
317
+ if (this.type == 3 && this.getCharCount(fdate) === 1) {
318
+ fdate += '/01';
319
+ } else if (this.type == 0) {
320
+ fdate += '/01/01';
321
+ }
322
+ fdate = fdate && fdate.indexOf('/') == -1 ? `2023/01/01 ${fdate}` : fdate;
323
+ }
205
324
  let time = null;
206
325
  if (fdate) time = new Date(fdate);
207
326
  else time = new Date();
208
- this.year = time.getFullYear();
209
- this.month = time.getMonth() + 1;
210
- this.day = time.getDate();
211
- this.hour = time.getHours();
212
- this.minute = time.getMinutes();
213
- this.second = time.getSeconds();
327
+ let year = time.getFullYear();
328
+ if (year > this.endYear) {
329
+ year = this.endYear;
330
+ } else if (year < this.startYear) {
331
+ year = this.startYear;
332
+ }
333
+ const month = time.getMonth() + 1;
334
+ const day = time.getDate();
335
+ const hour = time.getHours();
336
+ const minute = time.getMinutes();
337
+ const second = time.getSeconds();
338
+ this.year = year;
339
+ this.month = month;
340
+ this.day = day;
341
+ this.hour = hour;
342
+ this.minute = minute;
343
+ this.second = second;
344
+
345
+ return [year, month, day, hour, minute, second];
214
346
  },
215
347
  initData() {
216
- this.initSelectValue();
217
- this.reset = false;
218
- switch (this.type) {
348
+ const def = this.initSelectValue();
349
+ const type = Number(this.type);
350
+ switch (type) {
351
+ case 0:
352
+ this.setYears();
353
+ break;
219
354
  case 1:
220
- this.value = [0, 0, 0, 0, 0];
221
355
  this.setYears();
222
356
  this.setMonths();
223
357
  this.setDays();
@@ -225,34 +359,28 @@ export default {
225
359
  this.setMinutes();
226
360
  break;
227
361
  case 2:
228
- this.value = [0, 0, 0];
229
362
  this.setYears();
230
363
  this.setMonths();
231
364
  this.setDays();
232
365
  break;
233
366
  case 3:
234
- this.value = [0, 0];
235
367
  this.setYears();
236
368
  this.setMonths();
237
369
  break;
238
370
  case 4:
239
- this.value = [0, 0];
240
371
  this.setHours();
241
372
  this.setMinutes();
242
373
  break;
243
374
  case 5:
244
- this.value = [0, 0, 0];
245
375
  this.setHours();
246
376
  this.setMinutes();
247
377
  this.setSeconds();
248
378
  break;
249
379
  case 6:
250
- this.value = [0, 0];
251
380
  this.setMinutes();
252
381
  this.setSeconds();
253
382
  break;
254
383
  case 7:
255
- this.value = [0, 0, 0, 0, 0, 0];
256
384
  this.setYears();
257
385
  this.setMonths();
258
386
  this.setDays();
@@ -260,61 +388,122 @@ export default {
260
388
  this.setMinutes();
261
389
  this.setSeconds();
262
390
  break;
391
+ case 8:
392
+ this.setYears();
393
+ this.setMonths();
394
+ this.setDays();
395
+ this.setHours();
396
+ break;
263
397
  default:
264
398
  break;
265
399
  }
400
+ this.$nextTick(() => {
401
+ setTimeout(() => {
402
+ this.setDefaultValues(def);
403
+ }, 50);
404
+ });
405
+ },
406
+ setDefaultValues(def) {
407
+ let vals = [];
408
+ // 1-年月日+时分 2-年月日 3-年月 4-时分 5-时分秒 6-分秒 7-年月日 时分秒 8-年月日+小时
409
+ const year = this.getIndex(this.years, def[0]);
410
+
411
+ const month = this.getIndex(this.months, def[1]);
412
+ const day = this.getIndex(this.days, def[2]);
413
+ const hour = this.getIndex(this.hours, def[3]);
414
+ const minute = this.getIndex(this.minutes, def[4]);
415
+ const second = this.getIndex(this.seconds, def[5]);
416
+
417
+ // console.log(year, month, day, hour, minute, second)
418
+ const type = Number(this.type);
419
+ switch (type) {
420
+ case 0:
421
+ vals = [year];
422
+ case 1:
423
+ vals = [year, month, day, hour, minute];
424
+ break;
425
+ case 2:
426
+ vals = [year, month, day];
427
+ break;
428
+ case 3:
429
+ vals = [year, month];
430
+ break;
431
+ case 4:
432
+ vals = [hour, minute];
433
+ break;
434
+ case 5:
435
+ vals = [hour, minute, second];
436
+ break;
437
+ case 6:
438
+ vals = [minute, second];
439
+ break;
440
+ case 7:
441
+ vals = [year, month, day, hour, minute, second];
442
+ break;
443
+ case 8:
444
+ vals = [year, month, day, hour];
445
+ break;
446
+ default:
447
+ break;
448
+ }
449
+ if (this.value.join(',') === vals.join(',')) return;
450
+ setTimeout(() => {
451
+ this.value = vals;
452
+ }, 150);
266
453
  },
267
454
  setYears() {
268
455
  this.years = this.generateArray(this.startYear, this.endYear);
269
- setTimeout(() => {
270
- this.value[0] = this.getIndex(this.years, this.year);
271
- }, 8);
272
456
  },
273
457
  setMonths() {
274
458
  this.months = this.generateArray(1, 12);
275
- setTimeout(() => {
276
- this.value[1] = this.getIndex(this.months, this.month);
277
- }, 8);
278
459
  },
279
460
  setDays() {
280
461
  if (this.type == 3 || this.type == 4) return;
281
462
  let totalDays = new Date(this.year, this.month, 0).getDate();
463
+ totalDays = !totalDays || totalDays < 1 ? 1 : totalDays;
282
464
  this.days = this.generateArray(1, totalDays);
283
- setTimeout(() => {
284
- this.value[2] = this.getIndex(this.days, this.day);
285
- }, 8);
286
465
  },
287
466
  setHours() {
288
- this.hours = this.generateArray(0, 23);
289
- setTimeout(() => {
290
- let index = this.type == 5 || this.type == 7 ? this.value.length - 3 : this.value.length - 2;
291
- this.value[index] = this.getIndex(this.hours, this.hour);
292
- }, 8);
467
+ if (this.hoursData && this.hoursData.length > 0) {
468
+ this.hours = this.hoursData;
469
+ } else {
470
+ this.hours = this.generateArray(0, 23);
471
+ }
293
472
  },
294
473
  setMinutes() {
295
- this.minutes = this.generateArray(0, 59);
296
- setTimeout(() => {
297
- let index = this.type > 4 ? this.value.length - 2 : this.value.length - 1;
298
- this.value[index] = this.getIndex(this.minutes, this.minute);
299
- }, 8);
474
+ if (this.minutesData && this.minutesData.length > 0) {
475
+ this.minutes = this.minutesData;
476
+ } else {
477
+ this.minutes = this.generateArray(0, 59);
478
+ }
300
479
  },
301
480
  setSeconds() {
302
- this.seconds = this.generateArray(0, 59);
303
- setTimeout(() => {
304
- this.value[this.value.length - 1] = this.getIndex(this.seconds, this.second);
305
- }, 8);
481
+ if (this.secondsData && this.secondsData.length > 0) {
482
+ this.seconds = this.secondsData;
483
+ } else {
484
+ this.seconds = this.generateArray(0, 59);
485
+ }
306
486
  },
307
487
  show() {
308
488
  setTimeout(() => {
309
489
  this.isShow = true;
310
- }, 50);
490
+ }, 250);
311
491
  },
312
492
  hide() {
313
493
  this.isShow = false;
494
+ this.$emit('cancel', {});
495
+ },
496
+ maskClick() {
497
+ if (!this.maskClosable) return;
498
+ this.hide();
314
499
  },
315
500
  change(e) {
316
501
  this.value = e.detail.value;
317
- switch (this.type) {
502
+ const type = Number(this.type);
503
+ switch (type) {
504
+ case 0:
505
+ this.year = this.years[this.value[0]];
506
+ break;
318
507
  case 1:
319
508
  this.year = this.years[this.value[0]];
320
509
  this.month = this.months[this.value[1]];
@@ -352,84 +541,126 @@ export default {
352
541
  this.minute = this.minutes[this.value[4]];
353
542
  this.second = this.seconds[this.value[5]];
354
543
  break;
544
+ case 8:
545
+ this.year = this.years[this.value[0]];
546
+ this.month = this.months[this.value[1]];
547
+ this.day = this.days[this.value[2]];
548
+ this.hour = this.hours[this.value[3]];
549
+ break;
550
+ default:
551
+ break;
552
+ }
553
+ this.isEnd = true;
554
+ },
555
+ selectResult() {
556
+ let result = {};
557
+ let year = this.year;
558
+ let month = this.formatNum(this.month || 0);
559
+ let day = this.formatNum(this.day || 0);
560
+ let hour = this.formatNum(this.hour || 0);
561
+ let minute = this.formatNum(this.minute || 0);
562
+ let second = this.formatNum(this.second || 0);
563
+ const type = Number(this.type);
564
+ switch (type) {
565
+ case 0:
566
+ result = {
567
+ year: year,
568
+ result: year
569
+ };
570
+ break;
571
+ case 1:
572
+ result = {
573
+ year: year,
574
+ month: month,
575
+ day: day,
576
+ hour: hour,
577
+ minute: minute,
578
+ result: `${year}-${month}-${day} ${hour}:${minute}`
579
+ };
580
+ break;
581
+ case 2:
582
+ result = {
583
+ year: year,
584
+ month: month,
585
+ day: day,
586
+ result: `${year}-${month}-${day}`
587
+ };
588
+ break;
589
+ case 3:
590
+ result = {
591
+ year: year,
592
+ month: month,
593
+ result: `${year}-${month}`
594
+ };
595
+ break;
596
+ case 4:
597
+ result = {
598
+ hour: hour,
599
+ minute: minute,
600
+ result: `${hour}:${minute}`
601
+ };
602
+ break;
603
+ case 5:
604
+ result = {
605
+ hour: hour,
606
+ minute: minute,
607
+ second: second,
608
+ result: `${hour}:${minute}:${second}`
609
+ };
610
+ break;
611
+ case 6:
612
+ result = {
613
+ minute: minute,
614
+ second: second,
615
+ result: `${minute}:${second}`
616
+ };
617
+ break;
618
+ case 7:
619
+ result = {
620
+ year: year,
621
+ month: month,
622
+ day: day,
623
+ hour: hour,
624
+ minute: minute,
625
+ second: second,
626
+ result: `${year}-${month}-${day} ${hour}:${minute}:${second}`
627
+ };
628
+ break;
629
+ case 8:
630
+ result = {
631
+ year: year,
632
+ month: month,
633
+ day: day,
634
+ hour: hour,
635
+ result: `${year}-${month}-${day} ${hour}:00`
636
+ };
637
+ break;
355
638
  default:
356
639
  break;
357
640
  }
641
+ this.$emit('confirm', result);
642
+ },
643
+ waitFix(index = 0) {
644
+ if (this.isEnd) {
645
+ this.selectResult();
646
+ } else {
647
+ index++;
648
+ if (index >= 20) {
649
+ this.isEnd = true;
650
+ }
651
+ setTimeout(() => {
652
+ this.waitFix(index);
653
+ }, 50);
654
+ }
358
655
  },
359
656
  btnFix() {
360
657
  setTimeout(() => {
361
- let result = {};
362
- let year = this.year;
363
- let month = this.formatNum(this.month || 0);
364
- let day = this.formatNum(this.day || 0);
365
- let hour = this.formatNum(this.hour || 0);
366
- let minute = this.formatNum(this.minute || 0);
367
- let second = this.formatNum(this.second || 0);
368
- switch (this.type) {
369
- case 1:
370
- result = {
371
- year: year,
372
- month: month,
373
- day: day,
374
- hour: hour,
375
- minute: minute,
376
- result: `${year}-${month}-${day} ${hour}:${minute}`
377
- };
378
- break;
379
- case 2:
380
- result = {
381
- year: year,
382
- month: month,
383
- day: day,
384
- result: `${year}-${month}-${day}`
385
- };
386
- break;
387
- case 3:
388
- result = {
389
- year: year,
390
- month: month,
391
- result: `${year}-${month}`
392
- };
393
- break;
394
- case 4:
395
- result = {
396
- hour: hour,
397
- minute: minute,
398
- result: `${hour}:${minute}`
399
- };
400
- break;
401
- case 5:
402
- result = {
403
- hour: hour,
404
- minute: minute,
405
- second: second,
406
- result: `${hour}:${minute}:${second}`
407
- };
408
- break;
409
- case 6:
410
- result = {
411
- minute: minute,
412
- second: second,
413
- result: `${minute}:${second}`
414
- };
415
- break;
416
- case 7:
417
- result = {
418
- year: year,
419
- month: month,
420
- day: day,
421
- hour: hour,
422
- minute: minute,
423
- second: second,
424
- result: `${year}-${month}-${day} ${hour}:${minute}:${second}`
425
- };
426
- break;
427
- default:
428
- break;
429
- }
430
- this.$emit('confirm', result);
658
+ this.waitFix();
431
659
  this.hide();
432
660
  }, 80);
661
+ },
662
+ pickerstart() {
663
+ this.isEnd = false;
433
664
  }
434
665
  }
435
666
  };
@@ -438,17 +669,15 @@ export default {
438
669
  <style scoped>
439
670
  .up-datetime-picker {
440
671
  position: relative;
441
- z-index: 999;
442
672
  }
443
673
 
444
- .up-picker-view {
674
+ .up-datetime__picker-view {
445
675
  height: 100%;
446
676
  box-sizing: border-box;
447
677
  }
448
678
 
449
- .up-mask {
679
+ .up-datetime__mask {
450
680
  position: fixed;
451
- z-index: 9998;
452
681
  top: 0;
453
682
  right: 0;
454
683
  bottom: 0;
@@ -459,17 +688,17 @@ export default {
459
688
  transition: all 0.3s ease-in-out;
460
689
  }
461
690
 
462
- .up-mask-show {
691
+ .up-datetime__mask-show {
463
692
  visibility: visible !important;
464
693
  opacity: 1 !important;
465
694
  }
466
695
 
467
- .up-header {
468
- z-index: 9999;
696
+ .up-datetime__header {
469
697
  position: fixed;
470
698
  bottom: 0;
471
699
  left: 0;
472
700
  width: 100%;
701
+ opacity: 0;
473
702
  transition: all 0.3s ease-in-out;
474
703
  transform: translateY(100%);
475
704
  }
@@ -480,10 +709,8 @@ export default {
480
709
  display: flex;
481
710
  align-items: center;
482
711
  justify-content: space-between;
483
- background-color: #fff;
484
712
  font-size: 26rpx;
485
713
  line-height: 26rpx;
486
- color: #555;
487
714
  /* #ifdef MP */
488
715
  box-shadow: 0 15rpx 10rpx -15rpx #efefef;
489
716
  /* #endif */
@@ -501,6 +728,7 @@ export default {
501
728
 
502
729
  .up-show {
503
730
  transform: translateY(0);
731
+ opacity: 1;
504
732
  }
505
733
 
506
734
  .up-picker-header {
@@ -512,7 +740,6 @@ export default {
512
740
  align-items: center;
513
741
  box-sizing: border-box;
514
742
  font-size: 32rpx;
515
- background-color: #fff;
516
743
  position: relative;
517
744
  }
518
745
 
@@ -533,14 +760,13 @@ export default {
533
760
  left: 0;
534
761
  }
535
762
 
536
- .up-picker-body {
763
+ .up-date__picker-body {
537
764
  width: 100%;
538
- height: 520rpx;
765
+ /* height: 520rpx; */
539
766
  overflow: hidden;
540
- background-color: #fff;
541
767
  }
542
768
 
543
- .up-column-item {
769
+ .up-date__column-item {
544
770
  display: flex;
545
771
  align-items: center;
546
772
  justify-content: center;
@@ -552,7 +778,7 @@ export default {
552
778
  font-size: 32rpx !important;
553
779
  }
554
780
 
555
- .up-unit-text {
781
+ .up-date__unit-text {
556
782
  font-size: 24rpx !important;
557
783
  padding-left: 8rpx;
558
784
  }
@@ -562,9 +788,23 @@ export default {
562
788
  box-sizing: border-box;
563
789
  text-align: center;
564
790
  text-decoration: none;
791
+ flex-shrink: 0;
792
+ /* #ifdef H5 */
793
+ cursor: pointer;
794
+ /* #endif */
565
795
  }
566
796
 
567
797
  .up-opacity {
568
798
  opacity: 0.5;
569
799
  }
800
+
801
+ .up-pickerdate__title {
802
+ white-space: nowrap;
803
+ overflow: hidden;
804
+ text-overflow: ellipsis;
805
+ flex: 1;
806
+ padding: 0 30rpx;
807
+ box-sizing: border-box;
808
+ text-align: center;
809
+ }
570
810
  </style>