jufubao-forms 1.0.0-beta1

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