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