@10yun/cv-mobile-ui 0.4.2 → 0.4.3

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 (166) hide show
  1. package/package.json +1 -1
  2. package/ui-uni/amap-wx/js/util.js +166 -158
  3. package/ui-uni/page-foot/page-foot.vue +38 -0
  4. package/ui-uni/page-head/page-head.vue +16 -0
  5. package/ui-uni/product.vue +52 -52
  6. package/ui-uni/u-charts/u-charts.js +743 -1092
  7. package/ui-uni/u-link/u-link.vue +59 -0
  8. package/ui-uni/uni-badge/uni-badge.vue +250 -0
  9. package/ui-uni/uni-calendar/calendar.js +546 -0
  10. package/ui-uni/uni-calendar/uni-calendar-item.vue +171 -0
  11. package/ui-uni/uni-calendar/uni-calendar.vue +504 -0
  12. package/{ui-cv/cv-calendar → ui-uni/uni-calendar}/util.js +0 -0
  13. package/ui-uni/uni-card/uni-card.vue +420 -0
  14. package/ui-uni/uni-col/uni-col.vue +2968 -0
  15. package/ui-uni/uni-collapse/uni-collapse.vue +146 -0
  16. package/ui-uni/uni-collapse-item/uni-collapse-item.vue +378 -0
  17. package/ui-uni/uni-combox/uni-combox.vue +237 -0
  18. package/ui-uni/uni-countdown/uni-countdown.vue +234 -0
  19. package/ui-uni/uni-data-checkbox/uni-data-checkbox.vue +792 -0
  20. package/{ui-cv/cv-data-indexed-list → ui-uni/uni-data-indexed-list}/clientdb.js +0 -0
  21. package/ui-uni/uni-data-indexed-list/uni-data-indexed-list-item.vue +142 -0
  22. package/ui-uni/uni-data-indexed-list/uni-data-indexed-list.vue +364 -0
  23. package/{ui-cv/cv-data-picker → ui-uni/uni-data-picker}/keypress.js +0 -0
  24. package/ui-uni/uni-data-picker/uni-data-picker.vue +468 -0
  25. package/{ui-cv/cv-data-pickerview/cv-data-picker.js → ui-uni/uni-data-pickerview/uni-data-picker.js} +0 -0
  26. package/ui-uni/uni-data-pickerview/uni-data-pickerview.vue +298 -0
  27. package/{ui-cv/cv-dateformat → ui-uni/uni-dateformat}/date-format.js +0 -0
  28. package/ui-uni/uni-dateformat/uni-dateformat.vue +88 -0
  29. package/{ui-cv/cv-datetime-picker → ui-uni/uni-datetime-picker}/calendar-item.vue +0 -0
  30. package/{ui-cv/cv-datetime-picker → ui-uni/uni-datetime-picker}/calendar.js +0 -0
  31. package/ui-uni/uni-datetime-picker/calendar.vue +747 -0
  32. package/{ui-cv/cv-datetime-picker → ui-uni/uni-datetime-picker}/keypress.js +0 -0
  33. package/ui-uni/uni-datetime-picker/time-picker.vue +899 -0
  34. package/ui-uni/uni-datetime-picker/uni-datetime-picker.vue +874 -0
  35. package/{ui-cv/cv-datetime-picker → ui-uni/uni-datetime-picker}/util.js +0 -0
  36. package/ui-uni/uni-drawer/keypress.js +45 -0
  37. package/ui-uni/uni-drawer/uni-drawer.vue +178 -0
  38. package/{ui-cv/cv-easyinput → ui-uni/uni-easyinput}/common.js +0 -0
  39. package/ui-uni/uni-easyinput/uni-easyinput.vue +438 -0
  40. package/ui-uni/uni-fab/uni-fab.vue +443 -0
  41. package/{ui-cv/cv-fab/cv-fab.vue.bak → ui-uni/uni-fab/uni-fab.vue.bak} +2 -2
  42. package/ui-uni/uni-fav/uni-fav.vue +136 -0
  43. package/{ui-cv/cv-file-picker → ui-uni/uni-file-picker}/choose-and-upload-file.js +0 -0
  44. package/ui-uni/uni-file-picker/uni-file-picker.vue +614 -0
  45. package/{ui-cv/cv-file-picker → ui-uni/uni-file-picker}/upload-file.vue +0 -0
  46. package/{ui-cv/cv-file-picker → ui-uni/uni-file-picker}/upload-image.vue +0 -0
  47. package/{ui-cv/cv-file-picker → ui-uni/uni-file-picker}/utils.js +0 -0
  48. package/ui-uni/uni-forms/uni-forms.vue +467 -0
  49. package/ui-uni/uni-forms/validate.js +486 -0
  50. package/ui-uni/uni-forms-item/uni-forms-item.vue +500 -0
  51. package/{ui-cv/cv-goods-nav/cv-goods-nav.vue → ui-uni/uni-goods-nav/uni-goods-nav.vue} +1 -1
  52. package/ui-uni/uni-grid/uni-grid.vue +141 -0
  53. package/ui-uni/uni-grid-item/uni-grid-item.vue +123 -0
  54. package/ui-uni/uni-group/uni-group.vue +123 -0
  55. package/ui-uni/uni-icons/icons.js +132 -0
  56. package/ui-uni/uni-icons/uni-icons.vue +72 -0
  57. package/{ui-cv/cv-icon2 → ui-uni/uni-icons}/uni.ttf +0 -0
  58. package/ui-uni/uni-indexed-list/uni-indexed-list-item.vue +142 -0
  59. package/ui-uni/uni-indexed-list/uni-indexed-list.vue +357 -0
  60. package/ui-uni/uni-link/uni-link.vue +117 -0
  61. package/ui-uni/uni-list/uni-list.vue +107 -0
  62. package/ui-uni/uni-list/uni-refresh.vue +65 -0
  63. package/{ui-cv/cv-list → ui-uni/uni-list}/uni-refresh.wxs +0 -0
  64. package/ui-uni/uni-list-ad/uni-list-ad.vue +106 -0
  65. package/{ui-cv/cv-list-chat/cv-list-chat.scss → ui-uni/uni-list-chat/uni-list-chat.scss} +0 -0
  66. package/{ui-cv/cv-list-chat/cv-list-chat.vue → ui-uni/uni-list-chat/uni-list-chat.vue} +0 -0
  67. package/ui-uni/uni-list-item/uni-list-item.vue +428 -0
  68. package/ui-uni/uni-load-more/uni-load-more.vue +366 -0
  69. package/ui-uni/uni-nav-bar/uni-nav-bar.vue +244 -0
  70. package/{ui-cv/cv-nav-bar/cv-status-bar.vue → ui-uni/uni-nav-bar/uni-status-bar.vue} +0 -0
  71. package/ui-uni/uni-notice-bar/uni-notice-bar.vue +394 -0
  72. package/ui-uni/uni-number-box/uni-number-box.vue +224 -0
  73. package/ui-uni/uni-pagination/uni-pagination.vue +376 -0
  74. package/{ui-cv/cv-popup → ui-uni/uni-popup}/keypress.js +0 -0
  75. package/{ui-cv/cv-popup → ui-uni/uni-popup}/popup.js +0 -0
  76. package/ui-uni/uni-popup/uni-popup.vue +412 -0
  77. package/{ui-cv/cv-popup-dialog → ui-uni/uni-popup-dialog}/keypress.js +0 -0
  78. package/{ui-cv/cv-popup-dialog/cv-popup-dialog.vue → ui-uni/uni-popup-dialog/uni-popup-dialog.vue} +0 -0
  79. package/ui-uni/uni-popup-message/uni-popup-message.vue +143 -0
  80. package/{ui-cv/cv-popup-share/cv-popup-share.vue → ui-uni/uni-popup-share/uni-popup-share.vue} +0 -0
  81. package/ui-uni/uni-rate/uni-rate.vue +357 -0
  82. package/ui-uni/uni-row/uni-row.vue +155 -0
  83. package/ui-uni/uni-search-bar/uni-search-bar.vue +262 -0
  84. package/{ui-cv/cv-section/cv-section.vue → ui-uni/uni-section/uni-section.vue} +0 -0
  85. package/{ui-cv/cv-segmented-control/cv-segmented-control.vue → ui-uni/uni-segmented-control/uni-segmented-control.vue} +0 -0
  86. package/{ui-cv/cv-status-bar/cv-status-bar.vue → ui-uni/uni-status-bar/uni-status-bar.vue} +0 -0
  87. package/ui-uni/uni-steps/uni-steps.vue +250 -0
  88. package/{ui-cv/cv-swipe-action/cv-swipe-action.vue → ui-uni/uni-swipe-action/uni-swipe-action.vue} +0 -0
  89. package/{ui-cv/cv-swipe-action-item → ui-uni/uni-swipe-action-item}/bindingx.js +0 -0
  90. package/{ui-cv/cv-swipe-action-item → ui-uni/uni-swipe-action-item}/index.wxs +0 -0
  91. package/{ui-cv/cv-swipe-action-item → ui-uni/uni-swipe-action-item}/isPC.js +0 -0
  92. package/{ui-cv/cv-swipe-action-item → ui-uni/uni-swipe-action-item}/mpalipay.js +0 -0
  93. package/{ui-cv/cv-swipe-action-item → ui-uni/uni-swipe-action-item}/mpother.js +0 -0
  94. package/{ui-cv/cv-swipe-action-item → ui-uni/uni-swipe-action-item}/mpwxs.js +0 -0
  95. package/{ui-cv/cv-swipe-action-item/cv-swipe-action-item.vue → ui-uni/uni-swipe-action-item/uni-swipe-action-item.vue} +0 -0
  96. package/ui-uni/uni-swiper-dot/uni-swiper-dot.vue +205 -0
  97. package/ui-uni/uni-table/uni-table.vue +455 -0
  98. package/ui-uni/uni-tag/uni-tag.vue +283 -0
  99. package/ui-uni/uni-tbody/uni-tbody.vue +30 -0
  100. package/ui-uni/uni-td/uni-td.vue +88 -0
  101. package/{ui-cv/cv-test/cv-test.vue → ui-uni/uni-test/uni-test.vue} +0 -0
  102. package/{ui-cv/cv-th → ui-uni/uni-th}/filter-dropdown.vue +0 -0
  103. package/ui-uni/uni-th/uni-th.vue +259 -0
  104. package/ui-uni/uni-thead/uni-thead.vue +114 -0
  105. package/ui-uni/uni-title/uni-title.vue +171 -0
  106. package/{ui-cv/cv-tr → ui-uni/uni-tr}/table-checkbox.vue +0 -0
  107. package/ui-uni/uni-tr/uni-tr.vue +156 -0
  108. package/{ui-cv/cv-transition → ui-uni/uni-transition}/createAnimation.js +0 -0
  109. package/ui-uni/uni-transition/uni-transition.vue +287 -0
  110. package/ui-cv/cv-badge/cv-badge.vue +0 -249
  111. package/ui-cv/cv-calendar/calendar.js +0 -963
  112. package/ui-cv/cv-calendar/cv-calendar-item.vue +0 -198
  113. package/ui-cv/cv-calendar/cv-calendar.vue +0 -508
  114. package/ui-cv/cv-card/cv-card.vue +0 -427
  115. package/ui-cv/cv-col/cv-col.vue +0 -2965
  116. package/ui-cv/cv-collapse/cv-collapse.vue +0 -146
  117. package/ui-cv/cv-collapse-item/cv-collapse-item.vue +0 -395
  118. package/ui-cv/cv-combox/cv-combox.vue +0 -250
  119. package/ui-cv/cv-countdown/cv-countdown.vue +0 -245
  120. package/ui-cv/cv-data-checkbox/cv-data-checkbox.vue +0 -841
  121. package/ui-cv/cv-data-indexed-list/cv-data-indexed-list-item.vue +0 -154
  122. package/ui-cv/cv-data-indexed-list/cv-data-indexed-list.vue +0 -376
  123. package/ui-cv/cv-data-picker/cv-data-picker.vue +0 -486
  124. package/ui-cv/cv-data-pickerview/cv-data-pickerview.vue +0 -304
  125. package/ui-cv/cv-dateformat/cv-dateformat.vue +0 -86
  126. package/ui-cv/cv-datetime-picker/calendar.vue +0 -761
  127. package/ui-cv/cv-datetime-picker/cv-datetime-picker.vue +0 -958
  128. package/ui-cv/cv-datetime-picker/time-picker.vue +0 -907
  129. package/ui-cv/cv-drawer/cv-drawer.vue +0 -185
  130. package/ui-cv/cv-drawer/keypress.js +0 -45
  131. package/ui-cv/cv-easyinput/cv-easyinput.vue +0 -514
  132. package/ui-cv/cv-fab/cv-fab.vue +0 -465
  133. package/ui-cv/cv-fav/cv-fav.vue +0 -150
  134. package/ui-cv/cv-file-picker/cv-file-picker.vue +0 -619
  135. package/ui-cv/cv-form-base/cv-form-base.vue +0 -470
  136. package/ui-cv/cv-form-base/validate.js +0 -477
  137. package/ui-cv/cv-grid-group/cv-grid-group.vue +0 -148
  138. package/ui-cv/cv-grid-item/cv-grid-item.vue +0 -132
  139. package/ui-cv/cv-icon2/cv-icon2.vue +0 -78
  140. package/ui-cv/cv-icon2/icons.js +0 -132
  141. package/ui-cv/cv-indexed-list/cv-indexed-list-item.vue +0 -154
  142. package/ui-cv/cv-indexed-list/cv-indexed-list.vue +0 -371
  143. package/ui-cv/cv-link2/cv-link2.vue +0 -130
  144. package/ui-cv/cv-list/cv-list.vue +0 -107
  145. package/ui-cv/cv-list/cv-refresh.vue +0 -65
  146. package/ui-cv/cv-list-ad/cv-list-ad.vue +0 -113
  147. package/ui-cv/cv-list-item/cv-list-item.vue +0 -449
  148. package/ui-cv/cv-nav-bar/cv-nav-bar.vue +0 -256
  149. package/ui-cv/cv-notice-bar/cv-notice-bar.vue +0 -453
  150. package/ui-cv/cv-number-box/cv-number-box.vue +0 -223
  151. package/ui-cv/cv-pagination/cv-pagination.vue +0 -397
  152. package/ui-cv/cv-popup/cv-popup.vue +0 -429
  153. package/ui-cv/cv-popup-message/cv-popup-message.vue +0 -143
  154. package/ui-cv/cv-row/cv-row.vue +0 -157
  155. package/ui-cv/cv-search-bar/cv-search-bar.vue +0 -280
  156. package/ui-cv/cv-steps/cv-steps.vue +0 -293
  157. package/ui-cv/cv-swiper-dot/cv-swiper-dot.vue +0 -255
  158. package/ui-cv/cv-table/cv-table.vue +0 -460
  159. package/ui-cv/cv-tag/cv-tag.vue +0 -276
  160. package/ui-cv/cv-tbody/cv-tbody.vue +0 -28
  161. package/ui-cv/cv-td/cv-td.vue +0 -93
  162. package/ui-cv/cv-th/cv-th.vue +0 -270
  163. package/ui-cv/cv-thead/cv-thead.vue +0 -114
  164. package/ui-cv/cv-title/cv-title.vue +0 -168
  165. package/ui-cv/cv-tr/cv-tr.vue +0 -166
  166. package/ui-cv/cv-transition/cv-transition.vue +0 -279
@@ -1,198 +0,0 @@
1
- <template>
2
- <view
3
- class="uni-calendar-item__weeks-box"
4
- :class="{
5
- 'uni-calendar-item--disable': weeks.disable,
6
- 'uni-calendar-item--isDay': calendar.fullDate === weeks.fullDate && weeks.isDay,
7
- 'uni-calendar-item--checked': calendar.fullDate === weeks.fullDate && !weeks.isDay,
8
- 'uni-calendar-item--before-checked': weeks.beforeMultiple,
9
- 'uni-calendar-item--multiple': weeks.multiple,
10
- 'uni-calendar-item--after-checked': weeks.afterMultiple
11
- }"
12
- @click="choiceDate(weeks)"
13
- >
14
- <view class="uni-calendar-item__weeks-box-item">
15
- <text v-if="selected && weeks.extraInfo" class="uni-calendar-item__weeks-box-circle"></text>
16
- <text
17
- class="uni-calendar-item__weeks-box-text"
18
- :class="{
19
- 'uni-calendar-item--isDay-text': weeks.isDay,
20
- 'uni-calendar-item--isDay': calendar.fullDate === weeks.fullDate && weeks.isDay,
21
- 'uni-calendar-item--checked': calendar.fullDate === weeks.fullDate && !weeks.isDay,
22
- 'uni-calendar-item--before-checked': weeks.beforeMultiple,
23
- 'uni-calendar-item--multiple': weeks.multiple,
24
- 'uni-calendar-item--after-checked': weeks.afterMultiple,
25
- 'uni-calendar-item--disable': weeks.disable
26
- }"
27
- >
28
- {{ weeks.date }}
29
- </text>
30
- <text
31
- v-if="!lunar && !weeks.extraInfo && weeks.isDay"
32
- class="uni-calendar-item__weeks-lunar-text"
33
- :class="{
34
- 'uni-calendar-item--isDay-text': weeks.isDay,
35
- 'uni-calendar-item--isDay': calendar.fullDate === weeks.fullDate && weeks.isDay,
36
- 'uni-calendar-item--checked': calendar.fullDate === weeks.fullDate && !weeks.isDay,
37
- 'uni-calendar-item--before-checked': weeks.beforeMultiple,
38
- 'uni-calendar-item--multiple': weeks.multiple,
39
- 'uni-calendar-item--after-checked': weeks.afterMultiple
40
- }"
41
- >
42
- 今天
43
- </text>
44
- <text
45
- v-if="lunar && !weeks.extraInfo"
46
- class="uni-calendar-item__weeks-lunar-text"
47
- :class="{
48
- 'uni-calendar-item--isDay-text': weeks.isDay,
49
- 'uni-calendar-item--isDay': calendar.fullDate === weeks.fullDate && weeks.isDay,
50
- 'uni-calendar-item--checked': calendar.fullDate === weeks.fullDate && !weeks.isDay,
51
- 'uni-calendar-item--before-checked': weeks.beforeMultiple,
52
- 'uni-calendar-item--multiple': weeks.multiple,
53
- 'uni-calendar-item--after-checked': weeks.afterMultiple,
54
- 'uni-calendar-item--disable': weeks.disable
55
- }"
56
- >
57
- {{ weeks.isDay ? '今天' : weeks.lunar.IDayCn === '初一' ? weeks.lunar.IMonthCn : weeks.lunar.IDayCn }}
58
- </text>
59
- <text
60
- v-if="weeks.extraInfo && weeks.extraInfo.info"
61
- class="uni-calendar-item__weeks-lunar-text"
62
- :class="{
63
- 'uni-calendar-item--extra': weeks.extraInfo.info,
64
- 'uni-calendar-item--isDay-text': weeks.isDay,
65
- 'uni-calendar-item--isDay': calendar.fullDate === weeks.fullDate && weeks.isDay,
66
- 'uni-calendar-item--checked': calendar.fullDate === weeks.fullDate && !weeks.isDay,
67
- 'uni-calendar-item--before-checked': weeks.beforeMultiple,
68
- 'uni-calendar-item--multiple': weeks.multiple,
69
- 'uni-calendar-item--after-checked': weeks.afterMultiple,
70
- 'uni-calendar-item--disable': weeks.disable
71
- }"
72
- >
73
- {{ weeks.extraInfo.info }}
74
- </text>
75
- </view>
76
- </view>
77
- </template>
78
-
79
- <script>
80
- export default {
81
- emits: ['change'],
82
- props: {
83
- weeks: {
84
- type: Object,
85
- default() {
86
- return {};
87
- }
88
- },
89
- calendar: {
90
- type: Object,
91
- default: () => {
92
- return {};
93
- }
94
- },
95
- selected: {
96
- type: Array,
97
- default: () => {
98
- return [];
99
- }
100
- },
101
- lunar: {
102
- type: Boolean,
103
- default: false
104
- }
105
- },
106
- methods: {
107
- choiceDate(weeks) {
108
- this.$emit('change', weeks);
109
- }
110
- }
111
- };
112
- </script>
113
-
114
- <style scoped>
115
- .uni-calendar-item__weeks-box {
116
- flex: 1;
117
- /* #ifndef APP-NVUE */
118
- display: flex;
119
- /* #endif */
120
- flex-direction: column;
121
- justify-content: center;
122
- align-items: center;
123
- }
124
-
125
- .uni-calendar-item__weeks-box-text {
126
- font-size: 14px;
127
- color: #333;
128
- }
129
-
130
- .uni-calendar-item__weeks-lunar-text {
131
- font-size: 12px;
132
- color: #333;
133
- }
134
-
135
- .uni-calendar-item__weeks-box-item {
136
- position: relative;
137
- /* #ifndef APP-NVUE */
138
- display: flex;
139
- /* #endif */
140
- flex-direction: column;
141
- justify-content: center;
142
- align-items: center;
143
- width: 100rpx;
144
- height: 100rpx;
145
- }
146
-
147
- .uni-calendar-item__weeks-box-circle {
148
- position: absolute;
149
- top: 5px;
150
- right: 5px;
151
- width: 8px;
152
- height: 8px;
153
- border-radius: 8px;
154
- background-color: #dd524d;
155
- }
156
-
157
- .uni-calendar-item--disable {
158
- background-color: rgba(249, 249, 249, 0.3);
159
- color: #c0c0c0;
160
- }
161
-
162
- .uni-calendar-item--isDay-text {
163
- color: #007aff;
164
- }
165
-
166
- .uni-calendar-item--isDay {
167
- background-color: #007aff;
168
- opacity: 0.8;
169
- color: #fff;
170
- }
171
-
172
- .uni-calendar-item--extra {
173
- color: #dd524d;
174
- opacity: 0.8;
175
- }
176
-
177
- .uni-calendar-item--checked {
178
- background-color: #007aff;
179
- color: #fff;
180
- opacity: 0.8;
181
- }
182
-
183
- .uni-calendar-item--multiple {
184
- background-color: #007aff;
185
- color: #fff;
186
- opacity: 0.8;
187
- }
188
-
189
- .uni-calendar-item--before-checked {
190
- background-color: #ff5a5f;
191
- color: #fff;
192
- }
193
-
194
- .uni-calendar-item--after-checked {
195
- background-color: #ff5a5f;
196
- color: #fff;
197
- }
198
- </style>
@@ -1,508 +0,0 @@
1
- <template>
2
- <view class="uni-calendar">
3
- <view
4
- v-if="!insert && show"
5
- class="uni-calendar__mask"
6
- :class="{ 'uni-calendar--mask-show': aniMaskShow }"
7
- @click="clean"
8
- ></view>
9
- <view
10
- v-if="insert || show"
11
- class="uni-calendar__content"
12
- :class="{ 'uni-calendar--fixed': !insert, 'uni-calendar--ani-show': aniMaskShow }"
13
- >
14
- <view v-if="!insert" class="uni-calendar__header uni-calendar--fixed-top">
15
- <view class="uni-calendar__header-btn-box" @click="close">
16
- <text class="uni-calendar__header-text uni-calendar--fixed-width">取消</text>
17
- </view>
18
- <view class="uni-calendar__header-btn-box" @click="confirm">
19
- <text class="uni-calendar__header-text uni-calendar--fixed-width">确定</text>
20
- </view>
21
- </view>
22
- <view class="uni-calendar__header">
23
- <view class="uni-calendar__header-btn-box" @click.stop="pre">
24
- <view class="uni-calendar__header-btn uni-calendar--left"></view>
25
- </view>
26
- <picker mode="date" :value="date" fields="month" @change="bindDateChange">
27
- <text class="uni-calendar__header-text">{{ (nowDate.year || '') + '年' + (nowDate.month || '') + '月' }}</text>
28
- </picker>
29
- <view class="uni-calendar__header-btn-box" @click.stop="next">
30
- <view class="uni-calendar__header-btn uni-calendar--right"></view>
31
- </view>
32
- <text class="uni-calendar__backtoday" @click="backtoday">回到今天</text>
33
- </view>
34
- <view class="uni-calendar__box">
35
- <view v-if="showMonth" class="uni-calendar__box-bg">
36
- <text class="uni-calendar__box-bg-text">{{ nowDate.month }}</text>
37
- </view>
38
- <view class="uni-calendar__weeks">
39
- <view class="uni-calendar__weeks-day">
40
- <text class="uni-calendar__weeks-day-text">日</text>
41
- </view>
42
- <view class="uni-calendar__weeks-day">
43
- <text class="uni-calendar__weeks-day-text">一</text>
44
- </view>
45
- <view class="uni-calendar__weeks-day">
46
- <text class="uni-calendar__weeks-day-text">二</text>
47
- </view>
48
- <view class="uni-calendar__weeks-day">
49
- <text class="uni-calendar__weeks-day-text">三</text>
50
- </view>
51
- <view class="uni-calendar__weeks-day">
52
- <text class="uni-calendar__weeks-day-text">四</text>
53
- </view>
54
- <view class="uni-calendar__weeks-day">
55
- <text class="uni-calendar__weeks-day-text">五</text>
56
- </view>
57
- <view class="uni-calendar__weeks-day">
58
- <text class="uni-calendar__weeks-day-text">六</text>
59
- </view>
60
- </view>
61
- <view class="uni-calendar__weeks" v-for="(item, weekIndex) in weeks" :key="weekIndex">
62
- <view class="uni-calendar__weeks-item" v-for="(weeks, weeksIndex) in item" :key="weeksIndex">
63
- <calendar-item
64
- class="uni-calendar-item--hook"
65
- :weeks="weeks"
66
- :calendar="calendar"
67
- :selected="selected"
68
- :lunar="lunar"
69
- @change="choiceDate"
70
- ></calendar-item>
71
- </view>
72
- </view>
73
- </view>
74
- </view>
75
- </view>
76
- </template>
77
-
78
- <script>
79
- import Calendar from './util.js';
80
- import calendarItem from './cv-calendar-item.vue';
81
- /**
82
- * Calendar 日历
83
- * @description 日历组件可以查看日期,选择任意范围内的日期,打点操作。常用场景如:酒店日期预订、火车机票选择购买日期、上下班打卡等
84
- * @tutorial https://ext.dcloud.net.cn/plugin?id=56
85
- * @property {String} date 自定义当前时间,默认为今天
86
- * @property {Boolean} lunar 显示农历
87
- * @property {String} startDate 日期选择范围-开始日期
88
- * @property {String} endDate 日期选择范围-结束日期
89
- * @property {Boolean} range 范围选择
90
- * @property {Boolean} insert = [true|false] 插入模式,默认为false
91
- * @value true 弹窗模式
92
- * @value false 插入模式
93
- * @property {Boolean} clearDate = [true|false] 弹窗模式是否清空上次选择内容
94
- * @property {Array} selected 打点,期待格式[{date: '2019-06-27', info: '签到', data: { custom: '自定义信息', name: '自定义消息头',xxx:xxx... }}]
95
- * @property {Boolean} showMonth 是否选择月份为背景
96
- * @event {Function} change 日期改变,`insert :ture` 时生效
97
- * @event {Function} confirm 确认选择`insert :false` 时生效
98
- * @event {Function} monthSwitch 切换月份时触发
99
- * @example <uni-calendar :insert="true":lunar="true" :start-date="'2019-3-2'":end-date="'2019-5-20'"@change="change" />
100
- */
101
- export default {
102
- components: {
103
- calendarItem
104
- },
105
- emits: ['close', 'confirm', 'change', 'monthSwitch'],
106
- props: {
107
- date: {
108
- type: String,
109
- default: ''
110
- },
111
- selected: {
112
- type: Array,
113
- default() {
114
- return [];
115
- }
116
- },
117
- lunar: {
118
- type: Boolean,
119
- default: false
120
- },
121
- startDate: {
122
- type: String,
123
- default: ''
124
- },
125
- endDate: {
126
- type: String,
127
- default: ''
128
- },
129
- range: {
130
- type: Boolean,
131
- default: false
132
- },
133
- insert: {
134
- type: Boolean,
135
- default: true
136
- },
137
- showMonth: {
138
- type: Boolean,
139
- default: true
140
- },
141
- clearDate: {
142
- type: Boolean,
143
- default: true
144
- }
145
- },
146
- data() {
147
- return {
148
- show: false,
149
- weeks: [],
150
- calendar: {},
151
- nowDate: '',
152
- aniMaskShow: false
153
- };
154
- },
155
- watch: {
156
- date(newVal) {
157
- // this.cale.setDate(newVal)
158
- this.init(newVal);
159
- },
160
- startDate(val) {
161
- this.cale.resetSatrtDate(val);
162
- },
163
- endDate(val) {
164
- this.cale.resetEndDate(val);
165
- },
166
- selected(newVal) {
167
- this.cale.setSelectInfo(this.nowDate.fullDate, newVal);
168
- this.weeks = this.cale.weeks;
169
- }
170
- },
171
- created() {
172
- // 获取日历方法实例
173
- this.cale = new Calendar({
174
- // date: new Date(),
175
- selected: this.selected,
176
- startDate: this.startDate,
177
- endDate: this.endDate,
178
- range: this.range
179
- });
180
- // 选中某一天
181
- // this.cale.setDate(this.date)
182
- this.init(this.date);
183
- // this.setDay
184
- },
185
- methods: {
186
- // 取消穿透
187
- clean() {},
188
- bindDateChange(e) {
189
- const value = e.detail.value + '-1';
190
- console.log(this.cale.getDate(value));
191
- this.init(value);
192
- },
193
- /**
194
- * 初始化日期显示
195
- * @param {Object} date
196
- */
197
- init(date) {
198
- this.cale.setDate(date);
199
- this.weeks = this.cale.weeks;
200
- this.nowDate = this.calendar = this.cale.getInfo(date);
201
- },
202
- /**
203
- * 打开日历弹窗
204
- */
205
- open() {
206
- // 弹窗模式并且清理数据
207
- if (this.clearDate && !this.insert) {
208
- this.cale.cleanMultipleStatus();
209
- // this.cale.setDate(this.date)
210
- this.init(this.date);
211
- }
212
- this.show = true;
213
- this.$nextTick(() => {
214
- setTimeout(() => {
215
- this.aniMaskShow = true;
216
- }, 50);
217
- });
218
- },
219
- /**
220
- * 关闭日历弹窗
221
- */
222
- close() {
223
- this.aniMaskShow = false;
224
- this.$nextTick(() => {
225
- setTimeout(() => {
226
- this.show = false;
227
- this.$emit('close');
228
- }, 300);
229
- });
230
- },
231
- /**
232
- * 确认按钮
233
- */
234
- confirm() {
235
- this.setEmit('confirm');
236
- this.close();
237
- },
238
- /**
239
- * 变化触发
240
- */
241
- change() {
242
- if (!this.insert) return;
243
- this.setEmit('change');
244
- },
245
- /**
246
- * 选择月份触发
247
- */
248
- monthSwitch() {
249
- let { year, month } = this.nowDate;
250
- this.$emit('monthSwitch', {
251
- year,
252
- month: Number(month)
253
- });
254
- },
255
- /**
256
- * 派发事件
257
- * @param {Object} name
258
- */
259
- setEmit(name) {
260
- let { year, month, date, fullDate, lunar, extraInfo } = this.calendar;
261
- this.$emit(name, {
262
- range: this.cale.multipleStatus,
263
- year,
264
- month,
265
- date,
266
- fulldate: fullDate,
267
- lunar,
268
- extraInfo: extraInfo || {}
269
- });
270
- },
271
- /**
272
- * 选择天触发
273
- * @param {Object} weeks
274
- */
275
- choiceDate(weeks) {
276
- if (weeks.disable) return;
277
- this.calendar = weeks;
278
- // 设置多选
279
- this.cale.setMultiple(this.calendar.fullDate);
280
- this.weeks = this.cale.weeks;
281
- this.change();
282
- },
283
- /**
284
- * 回到今天
285
- */
286
- backtoday() {
287
- console.log(this.cale.getDate(new Date()).fullDate);
288
- let date = this.cale.getDate(new Date()).fullDate;
289
- // this.cale.setDate(date)
290
- this.init(date);
291
- this.change();
292
- },
293
- /**
294
- * 上个月
295
- */
296
- pre() {
297
- const preDate = this.cale.getDate(this.nowDate.fullDate, -1, 'month').fullDate;
298
- this.setDate(preDate);
299
- this.monthSwitch();
300
- },
301
- /**
302
- * 下个月
303
- */
304
- next() {
305
- const nextDate = this.cale.getDate(this.nowDate.fullDate, +1, 'month').fullDate;
306
- this.setDate(nextDate);
307
- this.monthSwitch();
308
- },
309
- /**
310
- * 设置日期
311
- * @param {Object} date
312
- */
313
- setDate(date) {
314
- this.cale.setDate(date);
315
- this.weeks = this.cale.weeks;
316
- this.nowDate = this.cale.getInfo(date);
317
- }
318
- }
319
- };
320
- </script>
321
-
322
- <style scoped>
323
- .uni-calendar {
324
- /* #ifndef APP-NVUE */
325
- display: flex;
326
- /* #endif */
327
- flex-direction: column;
328
- }
329
-
330
- .uni-calendar__mask {
331
- position: fixed;
332
- bottom: 0;
333
- top: 0;
334
- left: 0;
335
- right: 0;
336
- background-color: rgba(0, 0, 0, 0.4);
337
- transition-property: opacity;
338
- transition-duration: 0.3s;
339
- opacity: 0;
340
- /* #ifndef APP-NVUE */
341
- z-index: 99;
342
- /* #endif */
343
- }
344
-
345
- .uni-calendar--mask-show {
346
- opacity: 1;
347
- }
348
-
349
- .uni-calendar--fixed {
350
- position: fixed;
351
- bottom: calc(var(--window-bottom));
352
- left: 0;
353
- right: 0;
354
- transition-property: transform;
355
- transition-duration: 0.3s;
356
- transform: translateY(460px);
357
- /* #ifndef APP-NVUE */
358
- z-index: 99;
359
- /* #endif */
360
- }
361
-
362
- .uni-calendar--ani-show {
363
- transform: translateY(0);
364
- }
365
-
366
- .uni-calendar__content {
367
- background-color: #fff;
368
- }
369
-
370
- .uni-calendar__header {
371
- position: relative;
372
- /* #ifndef APP-NVUE */
373
- display: flex;
374
- /* #endif */
375
- flex-direction: row;
376
- justify-content: center;
377
- align-items: center;
378
- height: 50px;
379
- border-bottom-color: #e5e5e5;
380
- border-bottom-style: solid;
381
- border-bottom-width: 1px;
382
- }
383
-
384
- .uni-calendar--fixed-top {
385
- /* #ifndef APP-NVUE */
386
- display: flex;
387
- /* #endif */
388
- flex-direction: row;
389
- justify-content: space-between;
390
- border-top-color: #e5e5e5;
391
- border-top-style: solid;
392
- border-top-width: 1px;
393
- }
394
-
395
- .uni-calendar--fixed-width {
396
- width: 50px;
397
- }
398
-
399
- .uni-calendar__backtoday {
400
- position: absolute;
401
- right: 0;
402
- top: 25rpx;
403
- padding: 0 5px;
404
- padding-left: 10px;
405
- height: 25px;
406
- line-height: 25px;
407
- font-size: 12px;
408
- border-top-left-radius: 25px;
409
- border-bottom-left-radius: 25px;
410
- color: #333;
411
- background-color: #f1f1f1;
412
- }
413
-
414
- .uni-calendar__header-text {
415
- text-align: center;
416
- width: 100px;
417
- font-size: 14px;
418
- color: #333;
419
- }
420
-
421
- .uni-calendar__header-btn-box {
422
- /* #ifndef APP-NVUE */
423
- display: flex;
424
- /* #endif */
425
- flex-direction: row;
426
- align-items: center;
427
- justify-content: center;
428
- width: 50px;
429
- height: 50px;
430
- }
431
-
432
- .uni-calendar__header-btn {
433
- width: 10px;
434
- height: 10px;
435
- border-left-color: #808080;
436
- border-left-style: solid;
437
- border-left-width: 2px;
438
- border-top-color: #555555;
439
- border-top-style: solid;
440
- border-top-width: 2px;
441
- }
442
-
443
- .uni-calendar--left {
444
- transform: rotate(-45deg);
445
- }
446
-
447
- .uni-calendar--right {
448
- transform: rotate(135deg);
449
- }
450
-
451
- .uni-calendar__weeks {
452
- position: relative;
453
- /* #ifndef APP-NVUE */
454
- display: flex;
455
- /* #endif */
456
- flex-direction: row;
457
- }
458
-
459
- .uni-calendar__weeks-item {
460
- flex: 1;
461
- }
462
-
463
- .uni-calendar__weeks-day {
464
- flex: 1;
465
- /* #ifndef APP-NVUE */
466
- display: flex;
467
- /* #endif */
468
- flex-direction: column;
469
- justify-content: center;
470
- align-items: center;
471
- height: 45px;
472
- border-bottom-color: #f5f5f5;
473
- border-bottom-style: solid;
474
- border-bottom-width: 1px;
475
- }
476
-
477
- .uni-calendar__weeks-day-text {
478
- font-size: 14px;
479
- }
480
-
481
- .uni-calendar__box {
482
- position: relative;
483
- }
484
-
485
- .uni-calendar__box-bg {
486
- /* #ifndef APP-NVUE */
487
- display: flex;
488
- /* #endif */
489
- justify-content: center;
490
- align-items: center;
491
- position: absolute;
492
- top: 0;
493
- left: 0;
494
- right: 0;
495
- bottom: 0;
496
- }
497
-
498
- .uni-calendar__box-bg-text {
499
- font-size: 200px;
500
- font-weight: bold;
501
- color: #999;
502
- opacity: 0.1;
503
- text-align: center;
504
- /* #ifndef APP-NVUE */
505
- line-height: 1;
506
- /* #endif */
507
- }
508
- </style>