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

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