@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,761 +0,0 @@
1
- <template>
2
- <view class="uni-calendar" @mouseleave="leaveCale">
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 class="uni-calendar__header">
15
- <view v-if="left" class="uni-calendar__header-btn-box" @click.stop="pre">
16
- <view class="uni-calendar__header-btn uni-calendar--left"></view>
17
- </view>
18
- <picker mode="date" :value="date" fields="month" @change="bindDateChange">
19
- <text class="uni-calendar__header-text">{{ (nowDate.year || '') + '年' + (nowDate.month || '') + '月' }}</text>
20
- </picker>
21
- <view v-if="right" class="uni-calendar__header-btn-box" @click.stop="next">
22
- <view class="uni-calendar__header-btn uni-calendar--right"></view>
23
- </view>
24
- <!-- <text class="uni-calendar__backtoday" @click="backtoday">回到今天</text> -->
25
- </view>
26
- <view class="uni-calendar__box">
27
- <view v-if="showMonth" class="uni-calendar__box-bg">
28
- <text class="uni-calendar__box-bg-text">{{ nowDate.month }}</text>
29
- </view>
30
- <view class="uni-calendar__weeks">
31
- <view class="uni-calendar__weeks-day">
32
- <text class="uni-calendar__weeks-day-text">日</text>
33
- </view>
34
- <view class="uni-calendar__weeks-day">
35
- <text class="uni-calendar__weeks-day-text">一</text>
36
- </view>
37
- <view class="uni-calendar__weeks-day">
38
- <text class="uni-calendar__weeks-day-text">二</text>
39
- </view>
40
- <view class="uni-calendar__weeks-day">
41
- <text class="uni-calendar__weeks-day-text">三</text>
42
- </view>
43
- <view class="uni-calendar__weeks-day">
44
- <text class="uni-calendar__weeks-day-text">四</text>
45
- </view>
46
- <view class="uni-calendar__weeks-day">
47
- <text class="uni-calendar__weeks-day-text">五</text>
48
- </view>
49
- <view class="uni-calendar__weeks-day">
50
- <text class="uni-calendar__weeks-day-text">六</text>
51
- </view>
52
- </view>
53
- <view class="uni-calendar__weeks" v-for="(item, weekIndex) in weeks" :key="weekIndex">
54
- <view class="uni-calendar__weeks-item" v-for="(weeks, weeksIndex) in item" :key="weeksIndex">
55
- <calendar-item
56
- class="uni-calendar-item--hook"
57
- :weeks="weeks"
58
- :calendar="calendar"
59
- :selected="selected"
60
- :lunar="lunar"
61
- :checkHover="range"
62
- @change="choiceDate"
63
- @handleMouse="handleMouse"
64
- ></calendar-item>
65
- </view>
66
- </view>
67
- </view>
68
- <view v-if="!insert && !range && typeHasTime" class="uni-date-changed uni-calendar--fixed-top" style="padding: 0 40px">
69
- <text class="uni-date-changed--time-date">{{ tempSingleDate ? tempSingleDate : '选择日期' }}</text>
70
- <time-picker
71
- type="time"
72
- :start="reactStartTime"
73
- :end="reactEndTime"
74
- v-model="time"
75
- :disabled="!tempSingleDate"
76
- :border="false"
77
- class="time-picker-style"
78
- ></time-picker>
79
- </view>
80
-
81
- <view v-if="!insert && range && typeHasTime" class="uni-date-changed uni-calendar--fixed-top">
82
- <view class="uni-date-changed--time-start">
83
- <text class="uni-date-changed--time-date">{{ tempRange.before ? tempRange.before : '开始日期' }}</text>
84
- <time-picker
85
- type="time"
86
- :start="reactStartTime"
87
- v-model="timeRange.startTime"
88
- :border="false"
89
- :disabled="!tempRange.before"
90
- class="time-picker-style"
91
- ></time-picker>
92
- </view>
93
- <cv-icon2 type="arrowthinright" color="#999" style="line-height: 50px"></cv-icon2>
94
- <view class="uni-date-changed--time-end">
95
- <text class="uni-date-changed--time-date">{{ tempRange.after ? tempRange.after : '结束日期' }}</text>
96
- <time-picker
97
- type="time"
98
- :end="reactEndTime"
99
- v-model="timeRange.endTime"
100
- :border="false"
101
- :disabled="!tempRange.after"
102
- class="time-picker-style"
103
- ></time-picker>
104
- </view>
105
- </view>
106
-
107
- <view v-if="!insert" class="uni-date-changed uni-calendar__header" @click="confirm">
108
- <!-- <view class="uni-calendar__header-btn-box" @click="close">
109
- <text class="uni-calendar__header-text uni-calendar--fixed-width">取消</text>
110
- </view> -->
111
- <view class="uni-calendar__header-btn-box">
112
- <text class="uni-calendar__button-text uni-calendar--fixed-width">确定</text>
113
- </view>
114
- </view>
115
- </view>
116
- </view>
117
- </template>
118
-
119
- <script>
120
- import Calendar from './util.js';
121
- import calendarItem from './calendar-item.vue';
122
- import timePicker from './time-picker.vue';
123
- /**
124
- * Calendar 日历
125
- * @description 日历组件可以查看日期,选择任意范围内的日期,打点操作。常用场景如:酒店日期预订、火车机票选择购买日期、上下班打卡等
126
- * @tutorial https://ext.dcloud.net.cn/plugin?id=56
127
- * @property {String} date 自定义当前时间,默认为今天
128
- * @property {Boolean} lunar 显示农历
129
- * @property {String} startDate 日期选择范围-开始日期
130
- * @property {String} endDate 日期选择范围-结束日期
131
- * @property {Boolean} range 范围选择
132
- * @property {Boolean} insert = [true|false] 插入模式,默认为false
133
- * @value true 弹窗模式
134
- * @value false 插入模式
135
- * @property {Boolean} clearDate = [true|false] 弹窗模式是否清空上次选择内容
136
- * @property {Array} selected 打点,期待格式[{date: '2019-06-27', info: '签到', data: { custom: '自定义信息', name: '自定义消息头',xxx:xxx... }}]
137
- * @property {Boolean} showMonth 是否选择月份为背景
138
- * @event {Function} change 日期改变,`insert :ture` 时生效
139
- * @event {Function} confirm 确认选择`insert :false` 时生效
140
- * @event {Function} monthSwitch 切换月份时触发
141
- * @example <uni-calendar :insert="true":lunar="true" :start-date="'2019-3-2'":end-date="'2019-5-20'"@change="change" />
142
- */
143
- export default {
144
- components: {
145
- calendarItem,
146
- timePicker
147
- },
148
- props: {
149
- date: {
150
- type: String,
151
- default: ''
152
- },
153
- defTime: {
154
- type: [String, Object],
155
- default: ''
156
- },
157
- selectableTimes: {
158
- type: [Object],
159
- default() {
160
- return {};
161
- }
162
- },
163
- selected: {
164
- type: Array,
165
- default() {
166
- return [];
167
- }
168
- },
169
- lunar: {
170
- type: Boolean,
171
- default: false
172
- },
173
- startDate: {
174
- type: String,
175
- default: ''
176
- },
177
- endDate: {
178
- type: String,
179
- default: ''
180
- },
181
- range: {
182
- type: Boolean,
183
- default: false
184
- },
185
- typeHasTime: {
186
- type: Boolean,
187
- default: false
188
- },
189
- insert: {
190
- type: Boolean,
191
- default: true
192
- },
193
- showMonth: {
194
- type: Boolean,
195
- default: true
196
- },
197
- clearDate: {
198
- type: Boolean,
199
- default: true
200
- },
201
- left: {
202
- type: Boolean,
203
- default: true
204
- },
205
- right: {
206
- type: Boolean,
207
- default: true
208
- },
209
- checkHover: {
210
- type: Boolean,
211
- default: true
212
- },
213
- pleStatus: {
214
- type: Object,
215
- default() {
216
- return {
217
- before: '',
218
- after: '',
219
- data: [],
220
- fulldate: ''
221
- };
222
- }
223
- }
224
- },
225
- data() {
226
- return {
227
- show: false,
228
- weeks: [],
229
- calendar: {},
230
- nowDate: '',
231
- aniMaskShow: false,
232
- firstEnter: true,
233
- time: this.defTime ? this.defTime : '',
234
- timeRange: {
235
- startTime: this.defTime.start ? this.defTime.start : '',
236
- endTime: this.defTime.end ? this.defTime.end : ''
237
- },
238
- tempSingleDate: this.date,
239
- tempRange: {
240
- before: '',
241
- after: ''
242
- }
243
- };
244
- },
245
- watch: {
246
- date: {
247
- immediate: true,
248
- handler(newVal, oldVal) {
249
- if (!this.range)
250
- setTimeout(() => {
251
- this.init(newVal);
252
- }, 100);
253
- }
254
- },
255
- startDate(val) {
256
- this.cale.resetSatrtDate(val);
257
- this.cale.setDate(this.nowDate.fullDate);
258
- this.weeks = this.cale.weeks;
259
- },
260
- endDate(val) {
261
- this.cale.resetEndDate(val);
262
- this.cale.setDate(this.nowDate.fullDate);
263
- this.weeks = this.cale.weeks;
264
- },
265
- selected(newVal) {
266
- this.cale.setSelectInfo(this.nowDate.fullDate, newVal);
267
- this.weeks = this.cale.weeks;
268
- },
269
- pleStatus: {
270
- immediate: true,
271
- handler(newVal, oldVal) {
272
- const { before, after, fulldate, which } = newVal;
273
- this.tempRange.before = before;
274
- this.tempRange.after = after;
275
- setTimeout(() => {
276
- if (fulldate) {
277
- this.cale.setHoverMultiple(fulldate);
278
- if (before && after) {
279
- this.cale.lastHover = true;
280
- if (this.rangeWithinMonth(after, before)) return;
281
- this.setDate(before);
282
- }
283
- if (!before && !after) {
284
- this.cale.setMultiple(fulldate);
285
- this.setDate(this.nowDate.fullDate);
286
- this.calendar.fullDate = '';
287
- this.cale.lastHover = false;
288
- }
289
- } else {
290
- this.cale.setDefaultMultiple(before, after);
291
- if (which === 'left') {
292
- this.setDate(before);
293
- this.weeks = this.cale.weeks;
294
- } else {
295
- this.setDate(after);
296
- this.weeks = this.cale.weeks;
297
- }
298
- this.cale.lastHover = true;
299
- }
300
- }, 16);
301
- }
302
- }
303
- },
304
- computed: {
305
- reactStartTime() {
306
- const activeDate = this.range ? this.tempRange.before : this.calendar.fullDate;
307
- const res = activeDate === this.startDate ? this.selectableTimes.start : '';
308
- return res;
309
- },
310
- reactEndTime() {
311
- const activeDate = this.range ? this.tempRange.after : this.calendar.fullDate;
312
- const res = activeDate === this.endDate ? this.selectableTimes.end : '';
313
- return res;
314
- }
315
- },
316
- created() {
317
- // 获取日历方法实例
318
- this.cale = new Calendar({
319
- // date: new Date(),
320
- selected: this.selected,
321
- startDate: this.startDate,
322
- endDate: this.endDate,
323
- range: this.range
324
- // multipleStatus: this.pleStatus
325
- });
326
- // 选中某一天
327
- // this.cale.setDate(this.date)
328
-
329
- this.init(this.date);
330
- // this.setDay
331
- },
332
- methods: {
333
- leaveCale() {
334
- this.firstEnter = true;
335
- },
336
- handleMouse(weeks) {
337
- if (weeks.disable) return;
338
- if (this.cale.lastHover) return;
339
- let { before, after } = this.cale.multipleStatus;
340
- if (!before) return;
341
- this.calendar = weeks;
342
- // 设置范围选
343
- this.cale.setHoverMultiple(this.calendar.fullDate);
344
- this.weeks = this.cale.weeks;
345
- // hover时,进入一个日历,更新另一个
346
- if (this.firstEnter) {
347
- this.$emit('firstEnterCale', this.cale.multipleStatus);
348
- this.firstEnter = false;
349
- }
350
- },
351
- rangeWithinMonth(A, B) {
352
- const [yearA, monthA] = A.split('-');
353
- const [yearB, monthB] = B.split('-');
354
- return yearA === yearB && monthA === monthB;
355
- },
356
-
357
- // 取消穿透
358
- clean() {
359
- this.close();
360
- },
361
-
362
- bindDateChange(e) {
363
- const value = e.detail.value + '-1';
364
- console.log(this.cale.getDate(value));
365
- this.init(value);
366
- },
367
- /**
368
- * 初始化日期显示
369
- * @param {Object} date
370
- */
371
- init(date) {
372
- this.cale.setDate(date);
373
- this.weeks = this.cale.weeks;
374
- this.nowDate = this.calendar = this.cale.getInfo(date);
375
- },
376
- // choiceDate(weeks) {
377
- // if (weeks.disable) return
378
- // this.calendar = weeks
379
- // // 设置多选
380
- // this.cale.setMultiple(this.calendar.fullDate, true)
381
- // this.weeks = this.cale.weeks
382
- // this.tempSingleDate = this.calendar.fullDate
383
- // this.tempRange.before = this.cale.multipleStatus.before
384
- // this.tempRange.after = this.cale.multipleStatus.after
385
- // this.change()
386
- // },
387
- /**
388
- * 打开日历弹窗
389
- */
390
- open() {
391
- // 弹窗模式并且清理数据
392
- if (this.clearDate && !this.insert) {
393
- this.cale.cleanMultipleStatus();
394
- // this.cale.setDate(this.date)
395
- this.init(this.date);
396
- }
397
- this.show = true;
398
- this.$nextTick(() => {
399
- setTimeout(() => {
400
- this.aniMaskShow = true;
401
- }, 50);
402
- });
403
- },
404
- /**
405
- * 关闭日历弹窗
406
- */
407
- close() {
408
- this.aniMaskShow = false;
409
- this.$nextTick(() => {
410
- setTimeout(() => {
411
- this.show = false;
412
- this.$emit('close');
413
- }, 300);
414
- });
415
- },
416
- /**
417
- * 确认按钮
418
- */
419
- confirm() {
420
- this.setEmit('confirm');
421
- this.close();
422
- },
423
- /**
424
- * 变化触发
425
- */
426
- change() {
427
- if (!this.insert) return;
428
- this.setEmit('change');
429
- },
430
- /**
431
- * 选择月份触发
432
- */
433
- monthSwitch() {
434
- let { year, month } = this.nowDate;
435
- this.$emit('monthSwitch', {
436
- year,
437
- month: Number(month)
438
- });
439
- },
440
- /**
441
- * 派发事件
442
- * @param {Object} name
443
- */
444
- setEmit(name) {
445
- let { year, month, date, fullDate, lunar, extraInfo } = this.calendar;
446
- this.$emit(name, {
447
- range: this.cale.multipleStatus,
448
- year,
449
- month,
450
- date,
451
- time: this.time,
452
- timeRange: this.timeRange,
453
- fulldate: fullDate,
454
- lunar,
455
- extraInfo: extraInfo || {}
456
- });
457
- },
458
- /**
459
- * 选择天触发
460
- * @param {Object} weeks
461
- */
462
- choiceDate(weeks) {
463
- if (weeks.disable) return;
464
- this.calendar = weeks;
465
- // 设置多选
466
- this.cale.setMultiple(this.calendar.fullDate, true);
467
- this.weeks = this.cale.weeks;
468
- this.tempSingleDate = this.calendar.fullDate;
469
- this.tempRange.before = this.cale.multipleStatus.before;
470
- this.tempRange.after = this.cale.multipleStatus.after;
471
- this.change();
472
- },
473
- /**
474
- * 回到今天
475
- */
476
- backtoday() {
477
- console.log(this.cale.getDate(new Date()).fullDate);
478
- let date = this.cale.getDate(new Date()).fullDate;
479
- // this.cale.setDate(date)
480
- this.init(date);
481
- this.change();
482
- },
483
- /**
484
- * 比较时间大小
485
- */
486
- dateCompare(startDate, endDate) {
487
- // 计算截止时间
488
- startDate = new Date(startDate.replace('-', '/').replace('-', '/'));
489
- // 计算详细项的截止时间
490
- endDate = new Date(endDate.replace('-', '/').replace('-', '/'));
491
- if (startDate <= endDate) {
492
- return true;
493
- } else {
494
- return false;
495
- }
496
- },
497
- /**
498
- * 上个月
499
- */
500
- pre() {
501
- const preDate = this.cale.getDate(this.nowDate.fullDate, -1, 'month').fullDate;
502
- this.setDate(preDate);
503
- this.monthSwitch();
504
- },
505
- /**
506
- * 下个月
507
- */
508
- next() {
509
- const nextDate = this.cale.getDate(this.nowDate.fullDate, +1, 'month').fullDate;
510
- this.setDate(nextDate);
511
- this.monthSwitch();
512
- },
513
- /**
514
- * 设置日期
515
- * @param {Object} date
516
- */
517
- setDate(date) {
518
- this.cale.setDate(date);
519
- this.weeks = this.cale.weeks;
520
- this.nowDate = this.cale.getInfo(date);
521
- }
522
- }
523
- };
524
- </script>
525
-
526
- <style scoped>
527
- .uni-calendar {
528
- /* #ifndef APP-NVUE */
529
- display: flex;
530
- /* #endif */
531
- flex-direction: column;
532
- }
533
-
534
- .uni-calendar__mask {
535
- position: fixed;
536
- bottom: 0;
537
- top: 0;
538
- left: 0;
539
- right: 0;
540
- background-color: rgba(0, 0, 0, 0.4);
541
- transition-property: opacity;
542
- transition-duration: 0.3s;
543
- opacity: 0;
544
- /* #ifndef APP-NVUE */
545
- z-index: 99;
546
- /* #endif */
547
- }
548
-
549
- .uni-calendar--mask-show {
550
- opacity: 1;
551
- }
552
-
553
- .uni-calendar--fixed {
554
- position: fixed;
555
- bottom: calc(var(--window-bottom));
556
- left: 0;
557
- right: 0;
558
- transition-property: transform;
559
- transition-duration: 0.3s;
560
- transform: translateY(460px);
561
- /* #ifndef APP-NVUE */
562
- z-index: 99;
563
- /* #endif */
564
- }
565
-
566
- .uni-calendar--ani-show {
567
- transform: translateY(0);
568
- }
569
-
570
- .uni-calendar__content {
571
- background-color: #fff;
572
- }
573
-
574
- .uni-calendar__header {
575
- position: relative;
576
- /* #ifndef APP-NVUE */
577
- display: flex;
578
- /* #endif */
579
- flex-direction: row;
580
- justify-content: center;
581
- align-items: center;
582
- height: 50px;
583
- }
584
-
585
- .uni-calendar--fixed-top {
586
- /* #ifndef APP-NVUE */
587
- display: flex;
588
- /* #endif */
589
- flex-direction: row;
590
- justify-content: space-between;
591
- border-top-color: #e5e5e5;
592
- border-top-style: solid;
593
- border-top-width: 1px;
594
- }
595
-
596
- .uni-calendar--fixed-width {
597
- width: 50px;
598
- }
599
-
600
- .uni-calendar__backtoday {
601
- position: absolute;
602
- right: 0;
603
- top: 25rpx;
604
- padding: 0 5px;
605
- padding-left: 10px;
606
- height: 25px;
607
- line-height: 25px;
608
- font-size: 12px;
609
- border-top-left-radius: 25px;
610
- border-bottom-left-radius: 25px;
611
- color: #333;
612
- background-color: #f1f1f1;
613
- }
614
-
615
- .uni-calendar__header-text {
616
- text-align: center;
617
- width: 100px;
618
- font-size: 14px;
619
- color: #333;
620
- }
621
-
622
- .uni-calendar__button-text {
623
- text-align: center;
624
- width: 100px;
625
- font-size: 14px;
626
- color: #007aff;
627
- /* #ifndef APP-NVUE */
628
- letter-spacing: 3px;
629
- /* #endif */
630
- }
631
-
632
- .uni-calendar__header-btn-box {
633
- /* #ifndef APP-NVUE */
634
- display: flex;
635
- /* #endif */
636
- flex-direction: row;
637
- align-items: center;
638
- justify-content: center;
639
- width: 50px;
640
- height: 50px;
641
- }
642
-
643
- .uni-calendar__header-btn {
644
- width: 10px;
645
- height: 10px;
646
- border-left-color: #808080;
647
- border-left-style: solid;
648
- border-left-width: 2px;
649
- border-top-color: #555555;
650
- border-top-style: solid;
651
- border-top-width: 2px;
652
- }
653
-
654
- .uni-calendar--left {
655
- transform: rotate(-45deg);
656
- }
657
-
658
- .uni-calendar--right {
659
- transform: rotate(135deg);
660
- }
661
-
662
- .uni-calendar__weeks {
663
- position: relative;
664
- /* #ifndef APP-NVUE */
665
- display: flex;
666
- /* #endif */
667
- flex-direction: row;
668
- }
669
-
670
- .uni-calendar__weeks-item {
671
- flex: 1;
672
- }
673
-
674
- .uni-calendar__weeks-day {
675
- flex: 1;
676
- /* #ifndef APP-NVUE */
677
- display: flex;
678
- /* #endif */
679
- flex-direction: column;
680
- justify-content: center;
681
- align-items: center;
682
- height: 45px;
683
- border-bottom-color: #f5f5f5;
684
- border-bottom-style: solid;
685
- border-bottom-width: 1px;
686
- }
687
-
688
- .uni-calendar__weeks-day-text {
689
- font-size: 14px;
690
- }
691
-
692
- .uni-calendar__box {
693
- position: relative;
694
- }
695
-
696
- .uni-calendar__box-bg {
697
- /* #ifndef APP-NVUE */
698
- display: flex;
699
- /* #endif */
700
- justify-content: center;
701
- align-items: center;
702
- position: absolute;
703
- top: 0;
704
- left: 0;
705
- right: 0;
706
- bottom: 0;
707
- }
708
-
709
- .uni-calendar__box-bg-text {
710
- font-size: 200px;
711
- font-weight: bold;
712
- color: #999;
713
- opacity: 0.1;
714
- text-align: center;
715
- /* #ifndef APP-NVUE */
716
- line-height: 1;
717
- /* #endif */
718
- }
719
-
720
- .uni-date-changed {
721
- padding: 0 10px;
722
- text-align: center;
723
- color: #333;
724
- border-top-color: #e5e5e5;
725
- border-top-style: solid;
726
- border-top-width: 1px;
727
- flex: 1;
728
- }
729
-
730
- .uni-date-changed--time-start {
731
- /* #ifndef APP-NVUE */
732
- display: flex;
733
- /* #endif */
734
- align-items: center;
735
- }
736
-
737
- .uni-date-changed--time-end {
738
- /* #ifndef APP-NVUE */
739
- display: flex;
740
- /* #endif */
741
- align-items: center;
742
- }
743
-
744
- .uni-date-changed--time-date {
745
- color: #999;
746
- line-height: 50px;
747
- }
748
-
749
- .time-picker-style {
750
- width: 62px;
751
- /* #ifndef APP-NVUE */
752
- display: flex;
753
- /* #endif */
754
- justify-content: center;
755
- align-items: center;
756
- }
757
-
758
- .mr-10 {
759
- margin-right: 10px;
760
- }
761
- </style>