fusions-ui 1.2.4 → 1.2.7

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 (176) hide show
  1. package/components/fu-avatar/fu-avatar.vue +4 -2
  2. package/components/fu-avatar/props.js +52 -15
  3. package/components/fu-avatar-group/fu-avatar-group.vue +3 -2
  4. package/components/fu-avatar-group/props.js +31 -9
  5. package/components/fu-badge/fu-badge.vue +8 -14
  6. package/components/fu-badge/props.js +56 -16
  7. package/components/fu-banner-arc/fu-banner-arc.vue +4 -5
  8. package/components/fu-banner-arc/props.js +15 -4
  9. package/components/fu-button/fu-button.vue +18 -20
  10. package/components/fu-button/props.js +108 -35
  11. package/components/fu-cell/fu-cell.vue +9 -8
  12. package/components/fu-cell-group/fu-cell-group.vue +2 -1
  13. package/components/fu-cell-group/props.js +7 -2
  14. package/components/fu-checkbox/fu-checkbox.vue +5 -4
  15. package/components/fu-checkbox/props.js +51 -14
  16. package/components/fu-code-input/fu-code-input.vue +10 -6
  17. package/components/fu-code-input/props.js +66 -17
  18. package/components/fu-code-verify/fu-code-verify.vue +9 -5
  19. package/components/fu-code-verify/props.js +64 -17
  20. package/components/fu-collapse/fu-collapse.vue +10 -3
  21. package/components/fu-collapse/props.js +9 -3
  22. package/components/fu-collapse-item/fu-collapse-item.vue +45 -31
  23. package/components/fu-collapse-item/props.js +49 -16
  24. package/components/fu-countdown/fu-countdown.vue +2 -1
  25. package/components/fu-countdown/props.js +15 -4
  26. package/components/fu-datetime-picker/fu-datetime-picker.vue +6 -5
  27. package/components/fu-datetime-picker/props.js +91 -25
  28. package/components/fu-form/fu-form.vue +2 -1
  29. package/components/fu-form/props.js +34 -6
  30. package/components/fu-form-item/fu-form-item.vue +26 -33
  31. package/components/fu-form-item/props.js +30 -8
  32. package/components/fu-grid/fu-grid.vue +16 -17
  33. package/components/fu-grid/props.js +20 -5
  34. package/components/fu-grid-item/fu-grid-item.vue +31 -35
  35. package/components/fu-grid-item/props.js +11 -3
  36. package/components/fu-icon/fu-icon.vue +110 -0
  37. package/components/fu-icon/fuicon.css +584 -0
  38. package/components/{fu-icons/icons.js → fu-icon/fuicon.js} +1031 -1031
  39. package/components/{fu-icons/fuicons.ttf → fu-icon/fuicon.ttf} +0 -0
  40. package/components/fu-icon/props.js +55 -0
  41. package/components/fu-image/fu-image.vue +15 -10
  42. package/components/fu-image/props.js +69 -18
  43. package/components/fu-index-anchor/fu-index-anchor.vue +6 -5
  44. package/components/fu-index-anchor/props.js +20 -6
  45. package/components/fu-index-item/fu-index-item.vue +4 -4
  46. package/components/fu-index-list/fu-index-list.vue +9 -9
  47. package/components/fu-index-list/props.js +19 -6
  48. package/components/fu-input/fu-input.vue +54 -68
  49. package/components/fu-input/props.js +145 -53
  50. package/components/fu-keyboard/fu-keyboard.vue +19 -9
  51. package/components/fu-keyboard/keyboard-car.vue +33 -22
  52. package/components/fu-keyboard/keyboard-number.vue +17 -9
  53. package/components/fu-keyboard/props.js +66 -17
  54. package/components/fu-line/fu-line.vue +17 -13
  55. package/components/fu-line/props.js +30 -5
  56. package/components/fu-link/fu-link.vue +14 -8
  57. package/components/fu-link/props.js +22 -7
  58. package/components/fu-loading/fu-loading.vue +32 -27
  59. package/components/fu-loading/props.js +28 -8
  60. package/components/fu-loading-more/fu-loading-more.vue +19 -23
  61. package/components/fu-loading-more/props.js +27 -13
  62. package/components/fu-modal/fu-modal.vue +11 -6
  63. package/components/fu-modal/props.js +61 -17
  64. package/components/{fu-nav-bar/fu-nav-bar.vue → fu-navbar/fu-navbar.vue} +37 -44
  65. package/components/fu-notice-bar/fu-notice-bar.vue +10 -8
  66. package/components/fu-notice-bar/notice-column.vue +187 -122
  67. package/components/fu-notice-bar/notice-row.vue +85 -28
  68. package/components/fu-notice-bar/props.js +83 -22
  69. package/components/fu-number-box/fu-number-box.vue +26 -28
  70. package/components/fu-number-box/props.js +37 -11
  71. package/components/fu-parse/fu-parse.vue +0 -1
  72. package/components/fu-picker/fu-picker.vue +22 -17
  73. package/components/fu-picker/props.js +70 -19
  74. package/components/fu-popup/fu-popup.vue +38 -43
  75. package/components/fu-popup/props.js +34 -9
  76. package/components/fu-progress/fu-progress.vue +3 -2
  77. package/components/fu-progress/props.js +36 -9
  78. package/components/fu-rate/fu-rate.vue +40 -32
  79. package/components/fu-rate/props.js +47 -13
  80. package/components/fu-read-more/fu-read-more.vue +19 -14
  81. package/components/fu-read-more/props.js +68 -46
  82. package/components/fu-ribbon/fu-ribbon.vue +8 -7
  83. package/components/fu-ribbon/props.js +15 -4
  84. package/components/fu-scroll-list/fu-scroll-list.vue +18 -34
  85. package/components/fu-scroll-list/props.js +19 -10
  86. package/components/fu-search/fu-search.vue +13 -18
  87. package/components/fu-search/props.js +69 -17
  88. package/components/fu-section/fu-section.vue +19 -22
  89. package/components/fu-section/props.js +30 -4
  90. package/components/fu-sign-board/fu-sign-board.vue +34 -17
  91. package/components/fu-sign-board/props.js +15 -5
  92. package/components/fu-skeleton/fu-skeleton.vue +8 -12
  93. package/components/fu-skeleton/props.js +15 -4
  94. package/components/fu-steps/fu-steps.vue +3 -2
  95. package/components/fu-steps/props.js +23 -7
  96. package/components/fu-steps-item/fu-steps-item.vue +3 -3
  97. package/components/fu-steps-item/props.js +15 -5
  98. package/components/fu-sticky/fu-sticky.vue +3 -3
  99. package/components/fu-sticky/props.js +21 -7
  100. package/components/fu-subsection/fu-subsection.vue +29 -22
  101. package/components/fu-subsection/props.js +40 -10
  102. package/components/fu-swipe-action-item/bindingx.js +1 -1
  103. package/components/fu-swipe-action-item/fu-swipe-action-item.vue +134 -123
  104. package/components/fu-swipe-action-item/mpwxs.js +1 -1
  105. package/components/fu-swipe-action-item/props.js +22 -6
  106. package/components/fu-swiper/fu-swiper.vue +29 -27
  107. package/components/fu-swiper/props.js +81 -25
  108. package/components/fu-switch/fu-switch.vue +20 -12
  109. package/components/fu-switch/props.js +48 -13
  110. package/components/fu-tabs/fu-tabs.vue +36 -33
  111. package/components/fu-tabs/props.js +46 -13
  112. package/components/fu-tag/fu-tag.vue +24 -21
  113. package/components/fu-tag/props.js +63 -17
  114. package/components/fu-text/fu-text.vue +72 -33
  115. package/components/fu-text/props.js +85 -27
  116. package/components/fu-text/value.js +6 -6
  117. package/components/fu-textarea/fu-textarea.vue +13 -17
  118. package/components/fu-textarea/props.js +103 -30
  119. package/components/fu-timeaxis/fu-timeaxis.vue +1 -1
  120. package/components/fu-timeaxis-item/fu-timeaxis-item.vue +8 -4
  121. package/components/fu-transition/fu-transition.vue +48 -49
  122. package/components/fu-transition/props.js +21 -0
  123. package/components/fu-upload/fu-upload.vue +3 -1
  124. package/components/fu-upload/props.js +67 -19
  125. package/components/fu-upload/upload-file.vue +31 -18
  126. package/components/fu-upload/upload-image.vue +37 -19
  127. package/components/fu-vtabs/fu-vtabs.vue +6 -4
  128. package/components/fu-vtabs/props.js +50 -15
  129. package/components/fu-waterfall/fu-waterfall.vue +11 -9
  130. package/components/fu-waterfall/props.js +37 -15
  131. package/index.js +17 -24
  132. package/index.scss +9 -7
  133. package/libs/config/config.js +16 -9
  134. package/libs/function/applyEven.js +9 -9
  135. package/libs/function/check.js +81 -89
  136. package/libs/function/{index.js → common.js} +5 -5
  137. package/libs/function/message.js +0 -27
  138. package/libs/mixin/mixin.js +26 -21
  139. package/libs/{utils/min.router.config.js → route/min.route.config.js} +7 -7
  140. package/libs/{utils/router.config.js → route/route.config.js} +10 -11
  141. package/libs/{css/main.scss → style/common.scss} +50 -87
  142. package/libs/style/style.h5.scss +8 -0
  143. package/libs/style/style.mp.scss +15 -0
  144. package/package.json +1 -1
  145. package/components/fu-calendar/calendar-item.vue +0 -214
  146. package/components/fu-calendar/calendar.js +0 -546
  147. package/components/fu-calendar/fu-calendar.vue +0 -536
  148. package/components/fu-calendar/i18n/en.json +0 -12
  149. package/components/fu-calendar/i18n/index.js +0 -8
  150. package/components/fu-calendar/i18n/zh-Hans.json +0 -12
  151. package/components/fu-calendar/i18n/zh-Hant.json +0 -12
  152. package/components/fu-calendar/util.js +0 -360
  153. package/components/fu-date-picker/calendar-item.vue +0 -177
  154. package/components/fu-date-picker/calendar.vue +0 -917
  155. package/components/fu-date-picker/fu-date-picker.vue +0 -1069
  156. package/components/fu-date-picker/i18n/en.json +0 -22
  157. package/components/fu-date-picker/i18n/index.js +0 -8
  158. package/components/fu-date-picker/i18n/zh-Hans.json +0 -22
  159. package/components/fu-date-picker/i18n/zh-Hant.json +0 -22
  160. package/components/fu-date-picker/props.js +0 -68
  161. package/components/fu-date-picker/time-picker.vue +0 -924
  162. package/components/fu-date-picker/util.js +0 -419
  163. package/components/fu-icons/fu-icons.vue +0 -102
  164. package/components/fu-icons/fuicons.css +0 -585
  165. package/components/fu-landscape/fu-landscape.vue +0 -167
  166. package/components/fu-landscape/props.js +0 -64
  167. package/components/fu-tabbar/fu-tabbar.vue +0 -333
  168. package/components/fu-tabbar/props.js +0 -78
  169. package/libs/css/style.h5.scss +0 -35
  170. package/libs/css/style.mp.scss +0 -50
  171. package/libs/utils/util.js +0 -58
  172. /package/components/{fu-nav-bar → fu-navbar}/props.js +0 -0
  173. /package/components/{fu-nav-bar → fu-navbar}/status-bar.vue +0 -0
  174. /package/{components/fu-datetime-picker → libs/function}/dayjs.js +0 -0
  175. /package/libs/{css → style}/color.scss +0 -0
  176. /package/libs/{css/component.scss → style/components.scss} +0 -0
@@ -1,917 +0,0 @@
1
- <template>
2
- <view class="fu-calendar" @mouseleave="leaveCale">
3
- <view class="fu-calendar__mask" :class="{'fu-calendar--mask-show':aniMaskShow}" @click="maskClick" v-if="!insert && show"></view>
4
-
5
- <view
6
- class="fu-calendar__content"
7
- :class="{'fu-calendar--fixed':!insert,'fu-calendar--ani-show':aniMaskShow, 'fu-calendar__content-mobile': aniMaskShow}"
8
- v-if="insert || show">
9
- <view class="fu-calendar__header" :class="{'fu-calendar__header-mobile' :!insert}">
10
- <view class="fu-calendar__header-btn-box" @click.stop="changeMonth('pre')">
11
- <view class="fu-calendar__header-btn fu-calendar--left"></view>
12
- </view>
13
-
14
- <picker mode="date" :value="date" fields="month" @change="bindDateChange">
15
- <text class="fu-calendar__header-text">{{ (nowDate.year||'') + yearText + ( nowDate.month||'') + monthText}}</text>
16
- </picker>
17
-
18
- <view class="fu-calendar__header-btn-box" @click.stop="changeMonth('next')">
19
- <view class="fu-calendar__header-btn fu-calendar--right"></view>
20
- </view>
21
-
22
- <view class="dialog-close" @click="close" v-if="!insert">
23
- <view class="dialog-close-plus" data-id="close"></view>
24
- <view class="dialog-close-plus dialog-close-rotate" data-id="close"></view>
25
- </view>
26
- </view>
27
- <view class="fu-calendar__box">
28
- <view class="fu-calendar__box-bg" v-if="showMonth">
29
- <text class="fu-calendar__box-bg-text">{{nowDate.month}}</text>
30
- </view>
31
-
32
- <view class="fu-calendar__weeks" style="padding-bottom: 7px;">
33
- <view class="fu-calendar__weeks-day">
34
- <text class="fu-calendar__weeks-day-text">{{SUNText}}</text>
35
- </view>
36
- <view class="fu-calendar__weeks-day">
37
- <text class="fu-calendar__weeks-day-text">{{MONText}}</text>
38
- </view>
39
- <view class="fu-calendar__weeks-day">
40
- <text class="fu-calendar__weeks-day-text">{{TUEText}}</text>
41
- </view>
42
- <view class="fu-calendar__weeks-day">
43
- <text class="fu-calendar__weeks-day-text">{{WEDText}}</text>
44
- </view>
45
- <view class="fu-calendar__weeks-day">
46
- <text class="fu-calendar__weeks-day-text">{{THUText}}</text>
47
- </view>
48
- <view class="fu-calendar__weeks-day">
49
- <text class="fu-calendar__weeks-day-text">{{FRIText}}</text>
50
- </view>
51
- <view class="fu-calendar__weeks-day">
52
- <text class="fu-calendar__weeks-day-text">{{SATText}}</text>
53
- </view>
54
- </view>
55
-
56
- <view class="fu-calendar__weeks" v-for="(item,weekIndex) in weeks" :key="weekIndex">
57
- <view class="fu-calendar__weeks-item" v-for="(weeks,weeksIndex) in item" :key="weeksIndex">
58
- <calendar-item class="fu-calendar-item--hook" :weeks="weeks" :calendar="calendar"
59
- :selected="selected" :checkHover="range" @change="choiceDate" @handleMouse="handleMouse">
60
- </calendar-item>
61
- </view>
62
- </view>
63
- </view>
64
-
65
- <view
66
- class="fu-date-changed fu-calendar--fixed-top"
67
- style="padding: 0 80px;"
68
- v-if="!insert && !range && hasTime">
69
- <view class="fu-date-changed--time-date">{{tempSingleDate ? tempSingleDate : selectDateText}}</view>
70
- <time-picker
71
- class="time-picker-style"
72
- v-model="time"
73
- type="time"
74
- :start="timepickerStartTime"
75
- :end="timepickerEndTime"
76
- :disabled="!tempSingleDate"
77
- :border="false"
78
- :hide-second="hideSecond">
79
- </time-picker>
80
- </view>
81
-
82
- <view class="fu-date-changed fu-calendar--fixed-top" v-if="!insert && range && hasTime">
83
- <view class="fu-date-changed--time-start">
84
- <view class="fu-date-changed--time-date">{{tempRange.before ? tempRange.before : startDateText}}</view>
85
- <time-picker
86
- class="time-picker-style"
87
- v-model="timeRange.startTime"
88
- type="time"
89
- :start="timepickerStartTime"
90
- :border="false"
91
- :hide-second="hideSecond"
92
- :disabled="!tempRange.before">
93
- </time-picker>
94
- </view>
95
- <view style="line-height: 50px;">
96
- <fu-icons name="arrow-right" color="#999"></fu-icons>
97
- </view>
98
- <view class="fu-date-changed--time-end">
99
- <view class="fu-date-changed--time-date">{{tempRange.after ? tempRange.after : endDateText}}</view>
100
- <time-picker
101
- class="time-picker-style"
102
- v-model="timeRange.endTime"
103
- type="time"
104
- :end="timepickerEndTime"
105
- :border="false"
106
- :hide-second="hideSecond"
107
- :disabled="!tempRange.after">
108
- </time-picker>
109
- </view>
110
- </view>
111
-
112
- <view v-if="!insert" class="fu-date-changed fu-date-btn--ok">
113
- <view class="fu-datetime-picker--btn" @click="confirm">{{confirmText}}</view>
114
- </view>
115
- </view>
116
- </view>
117
- </template>
118
-
119
- <script>
120
- import calendarItem from './calendar-item.vue'
121
- import timePicker from './time-picker.vue'
122
- import { initVueI18n } from '@dcloudio/uni-i18n'
123
- import i18nMessages from './i18n/index.js'
124
- const { t } = initVueI18n(i18nMessages)
125
- import {
126
- Calendar,
127
- getDate,
128
- getTime
129
- } from './util.js'
130
- /**
131
- * Calendar 日历
132
- * @description 日历组件可以查看日期,选择任意范围内的日期,打点操作。常用场景如:酒店日期预订、火车机票选择购买日期、上下班打卡等
133
- * @property {String} date 自定义当前时间,默认为今天
134
- * @property {String} startDate 日期选择范围-开始日期
135
- * @property {String} endDate 日期选择范围-结束日期
136
- * @property {Boolean} range 范围选择
137
- * @property {Boolean} insert = [true|false] 插入模式,默认为false
138
- * @value true 弹窗模式
139
- * @value false 插入模式
140
- * @property {Boolean} clearDate = [true|false] 弹窗模式是否清空上次选择内容
141
- * @property {Array} selected 打点,期待格式[{date: '2019-06-27', info: '签到', data: { custom: '自定义信息', name: '自定义消息头',xxx:xxx... }}]
142
- * @property {Boolean} showMonth 是否选择月份为背景
143
- * @property {String} defaultValue 选择器打开时默认显示的时间
144
- * @event {Function} change 日期改变,`insert :ture` 时生效
145
- * @event {Function} confirm 确认选择`insert :false` 时生效
146
- * @event {Function} monthSwitch 切换月份时触发
147
- * @example <fu-calendar :insert="true" :start-date="'2019-3-2'":end-date="'2019-5-20'"@change="change" />
148
- */
149
- export default {
150
- components: {
151
- calendarItem,
152
- timePicker
153
- },
154
- emits: ['change', 'confirm', 'monthSwitch', 'firstEnterCale', 'maskClose', 'close'],
155
- props: {
156
- date: {
157
- type: String,
158
- default: ''
159
- },
160
- defTime: {
161
- type: [String, Object],
162
- default: ''
163
- },
164
- selectableTimes: {
165
- type: [Object],
166
- default () {
167
- return {}
168
- }
169
- },
170
- selected: {
171
- type: Array,
172
- default () {
173
- return []
174
- }
175
- },
176
- startDate: {
177
- type: String,
178
- default: ''
179
- },
180
- endDate: {
181
- type: String,
182
- default: ''
183
- },
184
- startPlaceholder: {
185
- type: String,
186
- default: ''
187
- },
188
- endPlaceholder: {
189
- type: String,
190
- default: ''
191
- },
192
- range: {
193
- type: Boolean,
194
- default: false
195
- },
196
- hasTime: {
197
- type: Boolean,
198
- default: false
199
- },
200
- insert: {
201
- type: Boolean,
202
- default: true
203
- },
204
- showMonth: {
205
- type: Boolean,
206
- default: true
207
- },
208
- clearDate: {
209
- type: Boolean,
210
- default: true
211
- },
212
- checkHover: {
213
- type: Boolean,
214
- default: true
215
- },
216
- hideSecond: {
217
- type: [Boolean],
218
- default: false
219
- },
220
- pleStatus: {
221
- type: Object,
222
- default () {
223
- return {
224
- before: '',
225
- after: '',
226
- data: [],
227
- fulldate: ''
228
- }
229
- }
230
- },
231
- defaultValue: {
232
- type: [String, Object, Array],
233
- default: ''
234
- }
235
- },
236
- data() {
237
- return {
238
- show: false,
239
- weeks: [],
240
- calendar: {},
241
- nowDate: {},
242
- aniMaskShow: false,
243
- firstEnter: true,
244
- time: '',
245
- timeRange: {
246
- startTime: '',
247
- endTime: ''
248
- },
249
- tempSingleDate: '',
250
- tempRange: {
251
- before: '',
252
- after: ''
253
- }
254
- }
255
- },
256
- watch: {
257
- date: {
258
- immediate: true,
259
- handler(newVal) {
260
- if (!this.range) {
261
- this.tempSingleDate = newVal;
262
- setTimeout(() => {
263
- this.init(newVal)
264
- }, 100)
265
- }
266
- }
267
- },
268
- defTime: {
269
- immediate: true,
270
- handler(newVal) {
271
- if (!this.range) {
272
- this.time = newVal;
273
- } else {
274
- this.timeRange.startTime = newVal.start;
275
- this.timeRange.endTime = newVal.end;
276
- }
277
- }
278
- },
279
- startDate(val) {
280
- // 字节小程序 watch 早于 created
281
- if (!this.cale) return
282
- this.cale.setStartDate(val)
283
- this.cale.setDate(this.nowDate.fullDate)
284
- this.weeks = this.cale.weeks;
285
- },
286
- endDate(val) {
287
- // 字节小程序 watch 早于 created
288
- if (!this.cale) return
289
- this.cale.setEndDate(val)
290
- this.cale.setDate(this.nowDate.fullDate)
291
- this.weeks = this.cale.weeks;
292
- },
293
- selected(newVal) {
294
- // 字节小程序 watch 早于 created
295
- if (!this.cale) return
296
- this.cale.setSelectInfo(this.nowDate.fullDate, newVal)
297
- this.weeks = this.cale.weeks;
298
- },
299
- pleStatus: {
300
- immediate: true,
301
- handler(newVal) {
302
- const {
303
- before,
304
- after,
305
- fulldate,
306
- which
307
- } = newVal;
308
- this.tempRange.before = before;
309
- this.tempRange.after = after;
310
- setTimeout(() => {
311
- if (fulldate) {
312
- this.cale.setHoverMultiple(fulldate)
313
- if (before && after) {
314
- this.cale.lastHover = true;
315
- if (this.rangeWithinMonth(after, before)) return
316
- this.setDate(before)
317
- } else {
318
- this.cale.setMultiple(fulldate)
319
- this.setDate(this.nowDate.fullDate)
320
- this.calendar.fullDate = '';
321
- this.cale.lastHover = false;
322
- }
323
- } else {
324
- // 字节小程序 watch 早于 created
325
- if (!this.cale) return
326
- this.cale.setDefaultMultiple(before, after)
327
- if (which === 'left' && before) {
328
- this.setDate(before)
329
- this.weeks = this.cale.weeks;
330
- } else if (after) {
331
- this.setDate(after)
332
- this.weeks = this.cale.weeks;
333
- }
334
- this.cale.lastHover = true;
335
- }
336
- }, 16)
337
- }
338
- }
339
- },
340
- computed: {
341
- timepickerStartTime() {
342
- const activeDate = this.range ? this.tempRange.before : this.calendar.fullDate;
343
- return activeDate === this.startDate ? this.selectableTimes.start : '';
344
- },
345
- timepickerEndTime() {
346
- const activeDate = this.range ? this.tempRange.after : this.calendar.fullDate;
347
- return activeDate === this.endDate ? this.selectableTimes.end : '';
348
- },
349
- /**
350
- * for i18n
351
- */
352
- selectDateText() {
353
- return t("fu-datetime-picker.selectDate")
354
- },
355
- startDateText() {
356
- return this.startPlaceholder || t("fu-datetime-picker.startDate")
357
- },
358
- endDateText() {
359
- return this.endPlaceholder || t("fu-datetime-picker.endDate")
360
- },
361
- okText() {
362
- return t("fu-datetime-picker.ok")
363
- },
364
- yearText() {
365
- return t("fu-datetime-picker.year")
366
- },
367
- monthText() {
368
- return t("fu-datetime-picker.month")
369
- },
370
- MONText() {
371
- return t("fu-calender.MON")
372
- },
373
- TUEText() {
374
- return t("fu-calender.TUE")
375
- },
376
- WEDText() {
377
- return t("fu-calender.WED")
378
- },
379
- THUText() {
380
- return t("fu-calender.THU")
381
- },
382
- FRIText() {
383
- return t("fu-calender.FRI")
384
- },
385
- SATText() {
386
- return t("fu-calender.SAT")
387
- },
388
- SUNText() {
389
- return t("fu-calender.SUN")
390
- },
391
- confirmText() {
392
- return t("fu-calender.confirm")
393
- },
394
- },
395
- created() {
396
- // 获取日历方法实例
397
- this.cale = new Calendar({
398
- selected: this.selected,
399
- startDate: this.startDate,
400
- endDate: this.endDate,
401
- range: this.range,
402
- });
403
- // 选中某一天
404
- this.init(this.date)
405
- },
406
- methods: {
407
- leaveCale() {
408
- this.firstEnter = true;
409
- },
410
-
411
- handleMouse(weeks) {
412
- if (weeks.disable) return
413
- if (this.cale.lastHover) return
414
- let {
415
- before,
416
- after
417
- } = this.cale.multipleStatus;
418
- if (!before) return
419
- this.calendar = weeks;
420
- // 设置范围选
421
- this.cale.setHoverMultiple(this.calendar.fullDate)
422
- this.weeks = this.cale.weeks;
423
- // hover时,进入一个日历,更新另一个
424
- if (this.firstEnter) {
425
- this.$emit('firstEnterCale', this.cale.multipleStatus)
426
- this.firstEnter = false;
427
- }
428
- },
429
-
430
- rangeWithinMonth(A, B) {
431
- const [yearA, monthA] = A.split('-');
432
- const [yearB, monthB] = B.split('-');
433
- return yearA === yearB && monthA === monthB
434
- },
435
-
436
- // 蒙版点击事件
437
- maskClick() {
438
- this.close()
439
- this.$emit('maskClose')
440
- },
441
-
442
- clearCalender() {
443
- if (this.range) {
444
- this.timeRange.startTime = '';
445
- this.timeRange.endTime = '';
446
- this.tempRange.before = '';
447
- this.tempRange.after = '';
448
- this.cale.multipleStatus.before = '';
449
- this.cale.multipleStatus.after = '';
450
- this.cale.multipleStatus.data = [];
451
- this.cale.lastHover = false;
452
- } else {
453
- this.time = '';
454
- this.tempSingleDate = '';
455
- }
456
- this.calendar.fullDate = '';
457
- this.setDate(new Date())
458
- },
459
-
460
- bindDateChange(e) {
461
- const value = e.detail.value + '-1';
462
- this.setDate(value)
463
- },
464
-
465
- /**
466
- * 初始化日期显示
467
- * @param {Object} date
468
- */
469
- init(date) {
470
- // 字节小程序 watch 早于 created
471
- if (!this.cale) return
472
- this.cale.setDate(date || new Date())
473
- this.weeks = this.cale.weeks;
474
- this.nowDate = this.cale.getInfo(date);
475
- this.calendar = {
476
- ...this.nowDate
477
- };
478
- if (!date) {
479
- // 优化date为空默认不选中今天
480
- this.calendar.fullDate = '';
481
- if (this.defaultValue && !this.range) {
482
- // 暂时只支持移动端非范围选择
483
- const defaultDate = new Date(this.defaultValue);
484
- const fullDate = getDate(defaultDate);
485
- const year = defaultDate.getFullYear();
486
- const month = defaultDate.getMonth() + 1;
487
- const date = defaultDate.getDate();
488
- const day = defaultDate.getDay();
489
- this.calendar = {
490
- fullDate,
491
- year,
492
- month,
493
- date,
494
- day
495
- };
496
- this.tempSingleDate = fullDate;
497
- this.time = getTime(defaultDate, this.hideSecond)
498
- }
499
- }
500
- },
501
-
502
- /**
503
- * 打开日历弹窗
504
- */
505
- open() {
506
- // 弹窗模式并且清理数据
507
- if (this.clearDate && !this.insert) {
508
- this.cale.cleanMultipleStatus()
509
- this.init(this.date)
510
- }
511
- this.show = true;
512
- this.$nextTick(() => {
513
- setTimeout(() => {
514
- this.aniMaskShow = true;
515
- }, 50)
516
- })
517
- },
518
-
519
- /**
520
- * 关闭日历弹窗
521
- */
522
- close() {
523
- this.aniMaskShow = false;
524
- this.$nextTick(() => {
525
- setTimeout(() => {
526
- this.show = false
527
- this.$emit('close')
528
- }, 300)
529
- })
530
- },
531
-
532
- /**
533
- * 确认按钮
534
- */
535
- confirm() {
536
- this.setEmit('confirm')
537
- this.close()
538
- },
539
-
540
- /**
541
- * 变化触发
542
- */
543
- change() {
544
- if (!this.insert) return
545
- this.setEmit('change')
546
- },
547
-
548
- /**
549
- * 选择月份触发
550
- */
551
- monthSwitch() {
552
- let {
553
- year,
554
- month
555
- } = this.nowDate;
556
- this.$emit('monthSwitch', {
557
- year,
558
- month: Number(month)
559
- })
560
- },
561
-
562
- /**
563
- * 派发事件
564
- * @param {Object} name
565
- */
566
- setEmit(name) {
567
- if (!this.range) {
568
- if (!this.calendar.fullDate) {
569
- this.calendar = this.cale.getInfo(new Date());
570
- this.tempSingleDate = this.calendar.fullDate;
571
- }
572
- if (this.hasTime && !this.time) {
573
- this.time = getTime(new Date(), this.hideSecond);
574
- }
575
- }
576
- let {
577
- year,
578
- month,
579
- date,
580
- fullDate,
581
- extraInfo
582
- } = this.calendar;
583
- this.$emit(name, {
584
- range: this.cale.multipleStatus,
585
- year,
586
- month,
587
- date,
588
- time: this.time,
589
- timeRange: this.timeRange,
590
- fulldate: fullDate,
591
- extraInfo: extraInfo || {}
592
- })
593
- },
594
-
595
- /**
596
- * 选择天触发
597
- * @param {Object} weeks
598
- */
599
- choiceDate(weeks) {
600
- if (weeks.disable) return
601
- this.calendar = weeks;
602
- this.calendar.userChecked = true;
603
- // 设置多选
604
- this.cale.setMultiple(this.calendar.fullDate, true)
605
- this.weeks = this.cale.weeks;
606
- this.tempSingleDate = this.calendar.fullDate;
607
- const beforeDate = new Date(this.cale.multipleStatus.before).getTime();
608
- const afterDate = new Date(this.cale.multipleStatus.after).getTime();
609
- if (beforeDate > afterDate && afterDate) {
610
- this.tempRange.before = this.cale.multipleStatus.after;
611
- this.tempRange.after = this.cale.multipleStatus.before;
612
- } else {
613
- this.tempRange.before = this.cale.multipleStatus.before;
614
- this.tempRange.after = this.cale.multipleStatus.after;
615
- }
616
- this.change()
617
- },
618
-
619
- changeMonth(type) {
620
- let newDate
621
- if (type === 'pre') {
622
- newDate = this.cale.getPreMonthObj(this.nowDate.fullDate).fullDate;
623
- } else if (type === 'next') {
624
- newDate = this.cale.getNextMonthObj(this.nowDate.fullDate).fullDate;
625
- }
626
-
627
- this.setDate(newDate)
628
- this.monthSwitch()
629
- },
630
-
631
- /**
632
- * 设置日期
633
- * @param {Object} date
634
- */
635
- setDate(date) {
636
- this.cale.setDate(date)
637
- this.weeks = this.cale.weeks;
638
- this.nowDate = this.cale.getInfo(date);
639
- }
640
- }
641
- }
642
- </script>
643
-
644
- <style lang="scss" scoped>
645
- @import '../../libs/css/component.scss';
646
- @import '../../libs/css/color.scss';
647
-
648
- .fu-calendar {
649
- @include flex(column);
650
- }
651
-
652
- .fu-calendar__mask {
653
- position: fixed;
654
- bottom: 0;
655
- top: 0;
656
- left: 0;
657
- right: 0;
658
- background-color: rgba(0, 0, 0, 0.4);
659
- transition-property: opacity;
660
- transition-duration: 0.3s;
661
- opacity: 0;
662
- /* #ifndef APP-NVUE */
663
- z-index: 99;
664
- /* #endif */
665
- }
666
-
667
- .fu-calendar--mask-show {
668
- opacity: 1
669
- }
670
-
671
- .fu-calendar--fixed {
672
- position: fixed;
673
- bottom: calc(var(--window-bottom));
674
- left: 0;
675
- right: 0;
676
- transition-property: transform;
677
- transition-duration: 0.3s;
678
- transform: translateY(460px);
679
- /* #ifndef APP-NVUE */
680
- z-index: 99;
681
- /* #endif */
682
- }
683
-
684
- .fu-calendar--ani-show {
685
- transform: translateY(0);
686
- }
687
-
688
- .fu-calendar__content {
689
- background-color: #ffffff;
690
- }
691
-
692
- .fu-calendar__content-mobile {
693
- border-top-left-radius: 10px;
694
- border-top-right-radius: 10px;
695
- box-shadow: 0px 0px 5px 3px rgba(0, 0, 0, 0.1);
696
- }
697
-
698
- .fu-calendar__header {
699
- position: relative;
700
- @include flex(row);
701
- justify-content: center;
702
- align-items: center;
703
- height: 50px;
704
- }
705
-
706
- .fu-calendar__header-mobile {
707
- padding: 10px;
708
- padding-bottom: 0;
709
- }
710
-
711
- .fu-calendar--fixed-top {
712
- @include flex(row);
713
- justify-content: space-between;
714
- border-top-color: rgba(0, 0, 0, 0.4);
715
- border-top-style: solid;
716
- border-top-width: 1px;
717
- }
718
-
719
- .fu-calendar--fixed-width {
720
- width: 50px;
721
- }
722
-
723
- .fu-calendar__backtoday {
724
- position: absolute;
725
- right: 0;
726
- top: 25rpx;
727
- padding: 0 5px;
728
- padding-left: 10px;
729
- height: 25px;
730
- line-height: 25px;
731
- font-size: 12px;
732
- border-top-left-radius: 25px;
733
- border-bottom-left-radius: 25px;
734
- color: #ffffff;
735
- background-color: #f1f1f1;
736
- }
737
-
738
- .fu-calendar__header-text {
739
- text-align: center;
740
- width: 100px;
741
- font-size: 15px;
742
- color: #666666;
743
- }
744
-
745
- .fu-calendar__button-text {
746
- text-align: center;
747
- width: 100px;
748
- font-size: 14px;
749
- color: $fu-primary;
750
- /* #ifndef APP-NVUE */
751
- letter-spacing: 3px;
752
- /* #endif */
753
- }
754
-
755
- .fu-calendar__header-btn-box {
756
- @include flex(row);
757
- align-items: center;
758
- justify-content: center;
759
- width: 50px;
760
- height: 50px;
761
- }
762
-
763
- .fu-calendar__header-btn {
764
- width: 9px;
765
- height: 9px;
766
- border-left-color: #808080;
767
- border-left-style: solid;
768
- border-left-width: 1px;
769
- border-top-color: #555555;
770
- border-top-style: solid;
771
- border-top-width: 1px;
772
- }
773
-
774
- .fu-calendar--left {
775
- transform: rotate(-45deg);
776
- }
777
-
778
- .fu-calendar--right {
779
- transform: rotate(135deg);
780
- }
781
-
782
-
783
- .fu-calendar__weeks {
784
- @include flex(row);
785
- position: relative;
786
- }
787
-
788
- .fu-calendar__weeks-item {
789
- flex: 1;
790
- }
791
-
792
- .fu-calendar__weeks-day {
793
- flex: 1;
794
- @include flex(column);
795
- justify-content: center;
796
- align-items: center;
797
- height: 40px;
798
- border-bottom-color: #F5F5F5;
799
- border-bottom-style: solid;
800
- border-bottom-width: 1px;
801
- }
802
-
803
- .fu-calendar__weeks-day-text {
804
- font-size: 12px;
805
- color: #B2B2B2;
806
- }
807
-
808
- .fu-calendar__box {
809
- position: relative;
810
- padding-bottom: 7px;
811
- }
812
-
813
- .fu-calendar__box-bg {
814
- @include flex;
815
- justify-content: center;
816
- align-items: center;
817
- position: absolute;
818
- top: 0;
819
- left: 0;
820
- right: 0;
821
- bottom: 0;
822
- }
823
-
824
- .fu-calendar__box-bg-text {
825
- font-size: 200px;
826
- font-weight: bold;
827
- color: #999;
828
- opacity: 0.1;
829
- text-align: center;
830
- /* #ifndef APP-NVUE */
831
- line-height: 1;
832
- /* #endif */
833
- }
834
-
835
- .fu-date-changed {
836
- padding: 0 10px;
837
- text-align: center;
838
- color: #333;
839
- border-top-color: #DCDCDC;
840
- border-top-style: solid;
841
- border-top-width: 1px;
842
- flex: 1;
843
- }
844
-
845
- .fu-date-btn--ok {
846
- padding: 20px 15px;
847
- }
848
-
849
- .fu-date-changed--time-start {
850
- @include flex;
851
- align-items: center;
852
- }
853
-
854
- .fu-date-changed--time-end {
855
- @include flex;
856
- align-items: center;
857
- }
858
-
859
- .fu-date-changed--time-date {
860
- color: #999999;
861
- line-height: 50px;
862
- /* #ifdef MP-TOUTIAO */
863
- font-size: 16px;
864
- /* #endif */
865
- margin-right: 5px;
866
- }
867
-
868
- .time-picker-style {
869
- @include flex;
870
- justify-content: center;
871
- align-items: center
872
- }
873
-
874
- .mr-10 {
875
- margin-right: 10px;
876
- }
877
-
878
- .dialog-close {
879
- position: absolute;
880
- top: 0;
881
- right: 0;
882
- bottom: 0;
883
- @include flex(row);
884
- align-items: center;
885
- padding: 0 25px;
886
- margin-top: 10px;
887
- }
888
-
889
- .dialog-close-plus {
890
- width: 16px;
891
- height: 2px;
892
- background-color: #737987;
893
- border-radius: 2px;
894
- transform: rotate(45deg);
895
- }
896
-
897
- .dialog-close-rotate {
898
- position: absolute;
899
- transform: rotate(-45deg);
900
- }
901
-
902
- .fu-datetime-picker--btn {
903
- border-radius: 100px;
904
- height: 40px;
905
- line-height: 40px;
906
- background-color: $fu-primary;
907
- color: #fff;
908
- font-size: 16px;
909
- letter-spacing: 2px;
910
- }
911
-
912
- /* #ifndef APP-NVUE */
913
- .fu-datetime-picker--btn:active {
914
- opacity: 0.7;
915
- }
916
- /* #endif */
917
- </style>