@kengic/uni 0.5.1 → 0.5.2-beta.1
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/dist/uni/uni-ui/uni-badge/uni-badge.vue +222 -219
- package/dist/uni/uni-ui/uni-breadcrumb/uni-breadcrumb.vue +29 -29
- package/dist/uni/uni-ui/uni-breadcrumb-item/uni-breadcrumb-item.vue +88 -88
- package/dist/uni/uni-ui/uni-calendar/calendar.js +936 -532
- package/dist/uni/uni-ui/uni-calendar/i18n/en.json +10 -10
- package/dist/uni/uni-ui/uni-calendar/i18n/index.js +8 -7
- package/dist/uni/uni-ui/uni-calendar/i18n/zh-Hans.json +10 -10
- package/dist/uni/uni-ui/uni-calendar/i18n/zh-Hant.json +10 -10
- package/dist/uni/uni-ui/uni-calendar/uni-calendar-item.vue +190 -168
- package/dist/uni/uni-ui/uni-calendar/uni-calendar.vue +459 -459
- package/dist/uni/uni-ui/uni-calendar/util.js +324 -340
- package/dist/uni/uni-ui/uni-card/uni-card.vue +8 -1
- package/dist/uni/uni-ui/uni-col/uni-col.vue +294 -287
- package/dist/uni/uni-ui/uni-collapse/uni-collapse.vue +139 -140
- package/dist/uni/uni-ui/uni-collapse-item/uni-collapse-item.vue +381 -378
- package/dist/uni/uni-ui/uni-combox/uni-combox.vue +280 -272
- package/dist/uni/uni-ui/uni-countdown/i18n/en.json +4 -4
- package/dist/uni/uni-ui/uni-countdown/i18n/index.js +8 -7
- package/dist/uni/uni-ui/uni-countdown/i18n/zh-Hans.json +4 -4
- package/dist/uni/uni-ui/uni-countdown/i18n/zh-Hant.json +4 -4
- package/dist/uni/uni-ui/uni-countdown/uni-countdown.vue +249 -257
- package/dist/uni/uni-ui/uni-data-checkbox/uni-data-checkbox.vue +832 -813
- package/dist/uni/uni-ui/uni-data-picker/keypress.js +42 -42
- package/dist/uni/uni-ui/uni-data-picker/uni-data-picker.vue +535 -516
- package/dist/uni/uni-ui/uni-data-pickerview/uni-data-picker.js +623 -618
- package/dist/uni/uni-ui/uni-data-pickerview/uni-data-pickerview.vue +293 -288
- package/dist/uni/uni-ui/uni-data-select/uni-data-select.vue +495 -509
- package/dist/uni/uni-ui/uni-dateformat/date-format.js +181 -184
- package/dist/uni/uni-ui/uni-dateformat/uni-dateformat.vue +81 -82
- package/dist/uni/uni-ui/uni-datetime-picker/calendar-item.vue +176 -170
- package/dist/uni/uni-ui/uni-datetime-picker/calendar.vue +926 -920
- package/dist/uni/uni-ui/uni-datetime-picker/i18n/en.json +20 -20
- package/dist/uni/uni-ui/uni-datetime-picker/i18n/index.js +8 -7
- package/dist/uni/uni-ui/uni-datetime-picker/i18n/zh-Hans.json +21 -21
- package/dist/uni/uni-ui/uni-datetime-picker/i18n/zh-Hant.json +21 -21
- package/dist/uni/uni-ui/uni-datetime-picker/time-picker.vue +921 -926
- package/dist/uni/uni-ui/uni-datetime-picker/uni-datetime-picker.vue +1059 -1012
- package/dist/uni/uni-ui/uni-datetime-picker/util.js +366 -377
- package/dist/uni/uni-ui/uni-drawer/keypress.js +42 -42
- package/dist/uni/uni-ui/uni-drawer/uni-drawer.vue +176 -167
- package/dist/uni/uni-ui/uni-easyinput/common.js +40 -42
- package/dist/uni/uni-ui/uni-easyinput/uni-easyinput.vue +628 -547
- package/dist/uni/uni-ui/uni-fab/uni-fab.vue +507 -483
- package/dist/uni/uni-ui/uni-fav/i18n/en.json +2 -2
- package/dist/uni/uni-ui/uni-fav/i18n/index.js +8 -7
- package/dist/uni/uni-ui/uni-fav/i18n/zh-Hans.json +2 -2
- package/dist/uni/uni-ui/uni-fav/i18n/zh-Hant.json +2 -2
- package/dist/uni/uni-ui/uni-fav/uni-fav.vue +155 -147
- package/dist/uni/uni-ui/uni-file-picker/choose-and-upload-file.js +172 -198
- package/dist/uni/uni-ui/uni-file-picker/uni-file-picker.vue +636 -634
- package/dist/uni/uni-ui/uni-file-picker/upload-file.vue +294 -293
- package/dist/uni/uni-ui/uni-file-picker/upload-image.vue +267 -270
- package/dist/uni/uni-ui/uni-file-picker/utils.js +81 -82
- package/dist/uni/uni-ui/uni-forms/uni-forms.vue +360 -372
- package/dist/uni/uni-ui/uni-forms/utils.js +170 -174
- package/dist/uni/uni-ui/uni-forms/validate.js +447 -456
- package/dist/uni/uni-ui/uni-forms-item/uni-forms-item.vue +497 -497
- package/dist/uni/uni-ui/uni-goods-nav/i18n/en.json +4 -4
- package/dist/uni/uni-ui/uni-goods-nav/i18n/index.js +8 -7
- package/dist/uni/uni-ui/uni-goods-nav/i18n/zh-Hans.json +4 -4
- package/dist/uni/uni-ui/uni-goods-nav/i18n/zh-Hant.json +4 -4
- package/dist/uni/uni-ui/uni-goods-nav/uni-goods-nav.vue +238 -222
- package/dist/uni/uni-ui/uni-grid/uni-grid.vue +134 -134
- package/dist/uni/uni-ui/uni-grid-item/uni-grid-item.vue +121 -119
- package/dist/uni/uni-ui/uni-group/uni-group.vue +121 -121
- package/dist/uni/uni-ui/uni-icons/icons.js +1170 -1168
- package/dist/uni/uni-ui/uni-icons/uni-icons.vue +91 -86
- package/dist/uni/uni-ui/uni-icons/uniicons.css +166 -166
- package/dist/uni/uni-ui/uni-indexed-list/uni-indexed-list-item.vue +129 -129
- package/dist/uni/uni-ui/uni-indexed-list/uni-indexed-list.vue +352 -347
- package/dist/uni/uni-ui/uni-link/uni-link.vue +134 -119
- package/dist/uni/uni-ui/uni-list/uni-list.vue +119 -110
- package/dist/uni/uni-ui/uni-list/uni-refresh.vue +14 -14
- package/dist/uni/uni-ui/uni-list/uni-refresh.wxs +14 -14
- package/dist/uni/uni-ui/uni-list-ad/uni-list-ad.vue +101 -95
- package/dist/uni/uni-ui/uni-list-chat/uni-list-chat.scss +18 -18
- package/dist/uni/uni-ui/uni-list-chat/uni-list-chat.vue +602 -586
- package/dist/uni/uni-ui/uni-list-item/uni-list-item.vue +507 -503
- package/dist/uni/uni-ui/uni-load-more/i18n/en.json +3 -3
- package/dist/uni/uni-ui/uni-load-more/i18n/index.js +8 -7
- package/dist/uni/uni-ui/uni-load-more/i18n/zh-Hans.json +3 -3
- package/dist/uni/uni-ui/uni-load-more/i18n/zh-Hant.json +3 -3
- package/dist/uni/uni-ui/uni-load-more/uni-load-more.vue +402 -392
- package/dist/uni/uni-ui/uni-nav-bar/uni-nav-bar.vue +328 -330
- package/dist/uni/uni-ui/uni-nav-bar/uni-status-bar.vue +17 -17
- package/dist/uni/uni-ui/uni-notice-bar/uni-notice-bar.vue +422 -401
- package/dist/uni/uni-ui/uni-number-box/uni-number-box.vue +211 -205
- package/dist/uni/uni-ui/uni-pagination/i18n/en.json +3 -3
- package/dist/uni/uni-ui/uni-pagination/i18n/es.json +3 -3
- package/dist/uni/uni-ui/uni-pagination/i18n/fr.json +3 -3
- package/dist/uni/uni-ui/uni-pagination/i18n/index.js +12 -11
- package/dist/uni/uni-ui/uni-pagination/i18n/zh-Hans.json +3 -3
- package/dist/uni/uni-ui/uni-pagination/i18n/zh-Hant.json +3 -3
- package/dist/uni/uni-ui/uni-pagination/uni-pagination.vue +450 -433
- package/dist/uni/uni-ui/uni-popup/uni-popup.vue +404 -404
- package/dist/uni/uni-ui/uni-popup-dialog/keypress.js +42 -42
- package/dist/uni/uni-ui/uni-popup-dialog/uni-popup-dialog.vue +1 -0
- package/dist/uni/uni-ui/uni-popup-message/uni-popup-message.vue +126 -125
- package/dist/uni/uni-ui/uni-popup-share/uni-popup-share.vue +172 -172
- package/dist/uni/uni-ui/uni-rate/uni-rate.vue +343 -347
- package/dist/uni/uni-ui/uni-row/uni-row.vue +180 -182
- package/dist/uni/uni-ui/uni-scss/changelog.md +11 -4
- package/dist/uni/uni-ui/uni-scss/package.json +73 -73
- package/dist/uni/uni-ui/uni-scss/readme.md +2 -1
- package/dist/uni/uni-ui/uni-scss/styles/setting/_border.scss +2 -2
- package/dist/uni/uni-ui/uni-scss/styles/setting/_color.scss +46 -47
- package/dist/uni/uni-ui/uni-scss/styles/setting/_radius.scss +49 -49
- package/dist/uni/uni-ui/uni-scss/styles/setting/_space.scss +52 -53
- package/dist/uni/uni-ui/uni-scss/styles/setting/_styles.scss +142 -147
- package/dist/uni/uni-ui/uni-scss/styles/setting/_text.scss +20 -20
- package/dist/uni/uni-ui/uni-scss/styles/setting/_variables.scss +111 -95
- package/dist/uni/uni-ui/uni-scss/styles/tools/functions.scss +28 -18
- package/dist/uni/uni-ui/uni-scss/theme.scss +10 -7
- package/dist/uni/uni-ui/uni-scss/variables.scss +42 -24
- package/dist/uni/uni-ui/uni-search-bar/i18n/en.json +3 -3
- package/dist/uni/uni-ui/uni-search-bar/i18n/index.js +8 -7
- package/dist/uni/uni-ui/uni-search-bar/i18n/zh-Hans.json +2 -2
- package/dist/uni/uni-ui/uni-search-bar/i18n/zh-Hant.json +2 -2
- package/dist/uni/uni-ui/uni-search-bar/uni-search-bar.vue +290 -281
- package/dist/uni/uni-ui/uni-section/uni-section.vue +149 -146
- package/dist/uni/uni-ui/uni-segmented-control/uni-segmented-control.vue +141 -131
- package/dist/uni/uni-ui/uni-steps/uni-steps.vue +255 -236
- package/dist/uni/uni-ui/uni-swipe-action/uni-swipe-action.vue +51 -51
- package/dist/uni/uni-ui/uni-swipe-action-item/bindingx.js +276 -282
- package/dist/uni/uni-ui/uni-swipe-action-item/isPC.js +10 -10
- package/dist/uni/uni-ui/uni-swipe-action-item/mpalipay.js +182 -187
- package/dist/uni/uni-ui/uni-swipe-action-item/mpother.js +235 -244
- package/dist/uni/uni-ui/uni-swipe-action-item/mpwxs.js +70 -75
- package/dist/uni/uni-ui/uni-swipe-action-item/render.js +238 -247
- package/dist/uni/uni-ui/uni-swipe-action-item/uni-swipe-action-item.vue +387 -313
- package/dist/uni/uni-ui/uni-swipe-action-item/wx.wxs +206 -215
- package/dist/uni/uni-ui/uni-swiper-dot/uni-swiper-dot.vue +241 -197
- package/dist/uni/uni-ui/uni-table/uni-table.vue +445 -447
- package/dist/uni/uni-ui/uni-tag/uni-tag.vue +234 -244
- package/dist/uni/uni-ui/uni-tbody/uni-tbody.vue +20 -23
- package/dist/uni/uni-ui/uni-td/uni-td.vue +79 -80
- package/dist/uni/uni-ui/uni-th/filter-dropdown.vue +510 -503
- package/dist/uni/uni-ui/uni-th/uni-th.vue +289 -273
- package/dist/uni/uni-ui/uni-thead/uni-thead.vue +115 -114
- package/dist/uni/uni-ui/uni-title/uni-title.vue +151 -154
- package/dist/uni/uni-ui/uni-tooltip/uni-tooltip.vue +55 -60
- package/dist/uni/uni-ui/uni-tr/table-checkbox.vue +162 -163
- package/dist/uni/uni-ui/uni-tr/uni-tr.vue +158 -157
- package/dist/uni/uni-ui/uni-transition/createAnimation.js +130 -113
- package/dist/uni/uni-ui/uni-transition/uni-transition.vue +274 -272
- package/package.json +1 -1
|
@@ -1,360 +1,344 @@
|
|
|
1
|
-
import CALENDAR from './calendar.js'
|
|
1
|
+
import CALENDAR from './calendar.js';
|
|
2
2
|
|
|
3
3
|
class Calendar {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
* @param {Object} date
|
|
29
|
-
*/
|
|
30
|
-
setDate(date) {
|
|
31
|
-
this.selectDate = this.getDate(date)
|
|
32
|
-
this._getWeek(this.selectDate.fullDate)
|
|
33
|
-
}
|
|
4
|
+
constructor({ date, selected, startDate, endDate, range } = {}) {
|
|
5
|
+
// 当前日期
|
|
6
|
+
this.date = this.getDate(new Date()); // 当前初入日期
|
|
7
|
+
// 打点信息
|
|
8
|
+
this.selected = selected || [];
|
|
9
|
+
// 范围开始
|
|
10
|
+
this.startDate = startDate;
|
|
11
|
+
// 范围结束
|
|
12
|
+
this.endDate = endDate;
|
|
13
|
+
this.range = range;
|
|
14
|
+
// 多选状态
|
|
15
|
+
this.cleanMultipleStatus();
|
|
16
|
+
// 每周日期
|
|
17
|
+
this.weeks = {};
|
|
18
|
+
// this._getWeek(this.date.fullDate)
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* 设置日期
|
|
22
|
+
* @param {Object} date
|
|
23
|
+
*/
|
|
24
|
+
setDate(date) {
|
|
25
|
+
this.selectDate = this.getDate(date);
|
|
26
|
+
this._getWeek(this.selectDate.fullDate);
|
|
27
|
+
}
|
|
34
28
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
29
|
+
/**
|
|
30
|
+
* 清理多选状态
|
|
31
|
+
*/
|
|
32
|
+
cleanMultipleStatus() {
|
|
33
|
+
this.multipleStatus = {
|
|
34
|
+
before: '',
|
|
35
|
+
after: '',
|
|
36
|
+
data: [],
|
|
37
|
+
};
|
|
38
|
+
}
|
|
45
39
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
40
|
+
/**
|
|
41
|
+
* 重置开始日期
|
|
42
|
+
*/
|
|
43
|
+
resetSatrtDate(startDate) {
|
|
44
|
+
// 范围开始
|
|
45
|
+
this.startDate = startDate;
|
|
46
|
+
}
|
|
52
47
|
|
|
53
|
-
|
|
48
|
+
/**
|
|
49
|
+
* 重置结束日期
|
|
50
|
+
*/
|
|
51
|
+
resetEndDate(endDate) {
|
|
52
|
+
// 范围结束
|
|
53
|
+
this.endDate = endDate;
|
|
54
|
+
}
|
|
54
55
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
56
|
+
/**
|
|
57
|
+
* 获取任意时间
|
|
58
|
+
*/
|
|
59
|
+
getDate(date, AddDayCount = 0, str = 'day') {
|
|
60
|
+
if (!date) {
|
|
61
|
+
date = new Date();
|
|
62
|
+
}
|
|
63
|
+
if (typeof date !== 'object') {
|
|
64
|
+
date = date.replace(/-/g, '/');
|
|
65
|
+
}
|
|
66
|
+
const dd = new Date(date);
|
|
67
|
+
switch (str) {
|
|
68
|
+
case 'day':
|
|
69
|
+
dd.setDate(dd.getDate() + AddDayCount); // 获取AddDayCount天后的日期
|
|
70
|
+
break;
|
|
71
|
+
case 'month':
|
|
72
|
+
if (dd.getDate() === 31 && AddDayCount > 0) {
|
|
73
|
+
dd.setDate(dd.getDate() + AddDayCount);
|
|
74
|
+
} else {
|
|
75
|
+
const preMonth = dd.getMonth();
|
|
76
|
+
dd.setMonth(preMonth + AddDayCount); // 获取AddDayCount天后的日期
|
|
77
|
+
const nextMonth = dd.getMonth();
|
|
78
|
+
// 处理 pre 切换月份目标月份为2月没有当前日(30 31) 切换错误问题
|
|
79
|
+
if (AddDayCount < 0 && preMonth !== 0 && nextMonth - preMonth > AddDayCount) {
|
|
80
|
+
dd.setMonth(nextMonth + (nextMonth - preMonth + AddDayCount));
|
|
81
|
+
}
|
|
82
|
+
// 处理 next 切换月份目标月份为2月没有当前日(30 31) 切换错误问题
|
|
83
|
+
if (AddDayCount > 0 && nextMonth - preMonth > AddDayCount) {
|
|
84
|
+
dd.setMonth(nextMonth - (nextMonth - preMonth - AddDayCount));
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
break;
|
|
88
|
+
case 'year':
|
|
89
|
+
dd.setFullYear(dd.getFullYear() + AddDayCount); // 获取AddDayCount天后的日期
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
92
|
+
const y = dd.getFullYear();
|
|
93
|
+
const m = dd.getMonth() + 1 < 10 ? '0' + (dd.getMonth() + 1) : dd.getMonth() + 1; // 获取当前月份的日期,不足10补0
|
|
94
|
+
const d = dd.getDate() < 10 ? '0' + dd.getDate() : dd.getDate(); // 获取当前几号,不足10补0
|
|
95
|
+
return {
|
|
96
|
+
fullDate: y + '-' + m + '-' + d,
|
|
97
|
+
year: y,
|
|
98
|
+
month: m,
|
|
99
|
+
date: d,
|
|
100
|
+
day: dd.getDay(),
|
|
101
|
+
};
|
|
102
|
+
}
|
|
62
103
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
break
|
|
98
|
-
}
|
|
99
|
-
const y = dd.getFullYear()
|
|
100
|
-
const m = dd.getMonth() + 1 < 10 ? '0' + (dd.getMonth() + 1) : dd.getMonth() + 1 // 获取当前月份的日期,不足10补0
|
|
101
|
-
const d = dd.getDate() < 10 ? '0' + dd.getDate() : dd.getDate() // 获取当前几号,不足10补0
|
|
102
|
-
return {
|
|
103
|
-
fullDate: y + '-' + m + '-' + d,
|
|
104
|
-
year: y,
|
|
105
|
-
month: m,
|
|
106
|
-
date: d,
|
|
107
|
-
day: dd.getDay()
|
|
108
|
-
}
|
|
109
|
-
}
|
|
104
|
+
/**
|
|
105
|
+
* 获取上月剩余天数
|
|
106
|
+
*/
|
|
107
|
+
_getLastMonthDays(firstDay, full) {
|
|
108
|
+
let dateArr = [];
|
|
109
|
+
for (let i = firstDay; i > 0; i--) {
|
|
110
|
+
const beforeDate = new Date(full.year, full.month - 1, -i + 1).getDate();
|
|
111
|
+
dateArr.push({
|
|
112
|
+
date: beforeDate,
|
|
113
|
+
month: full.month - 1,
|
|
114
|
+
lunar: this.getlunar(full.year, full.month - 1, beforeDate),
|
|
115
|
+
disable: true,
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
return dateArr;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* 获取本月天数
|
|
122
|
+
*/
|
|
123
|
+
_currentMonthDys(dateData, full) {
|
|
124
|
+
let dateArr = [];
|
|
125
|
+
let fullDate = this.date.fullDate;
|
|
126
|
+
for (let i = 1; i <= dateData; i++) {
|
|
127
|
+
let nowDate = full.year + '-' + (full.month < 10 ? full.month : full.month) + '-' + (i < 10 ? '0' + i : i);
|
|
128
|
+
// 是否今天
|
|
129
|
+
let isDay = fullDate === nowDate;
|
|
130
|
+
// 获取打点信息
|
|
131
|
+
let info =
|
|
132
|
+
this.selected &&
|
|
133
|
+
this.selected.find((item) => {
|
|
134
|
+
if (this.dateEqual(nowDate, item.date)) {
|
|
135
|
+
return item;
|
|
136
|
+
}
|
|
137
|
+
});
|
|
110
138
|
|
|
139
|
+
// 日期禁用
|
|
140
|
+
let disableBefore = true;
|
|
141
|
+
let disableAfter = true;
|
|
142
|
+
if (this.startDate) {
|
|
143
|
+
// let dateCompBefore = this.dateCompare(this.startDate, fullDate)
|
|
144
|
+
// disableBefore = this.dateCompare(dateCompBefore ? this.startDate : fullDate, nowDate)
|
|
145
|
+
disableBefore = this.dateCompare(this.startDate, nowDate);
|
|
146
|
+
}
|
|
111
147
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
})
|
|
148
|
+
if (this.endDate) {
|
|
149
|
+
// let dateCompAfter = this.dateCompare(fullDate, this.endDate)
|
|
150
|
+
// disableAfter = this.dateCompare(nowDate, dateCompAfter ? this.endDate : fullDate)
|
|
151
|
+
disableAfter = this.dateCompare(nowDate, this.endDate);
|
|
152
|
+
}
|
|
153
|
+
let multiples = this.multipleStatus.data;
|
|
154
|
+
let checked = false;
|
|
155
|
+
let multiplesStatus = -1;
|
|
156
|
+
if (this.range) {
|
|
157
|
+
if (multiples) {
|
|
158
|
+
multiplesStatus = multiples.findIndex((item) => {
|
|
159
|
+
return this.dateEqual(item, nowDate);
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
if (multiplesStatus !== -1) {
|
|
163
|
+
checked = true;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
let data = {
|
|
167
|
+
fullDate: nowDate,
|
|
168
|
+
year: full.year,
|
|
169
|
+
date: i,
|
|
170
|
+
multiple: this.range ? checked : false,
|
|
171
|
+
beforeMultiple: this.dateEqual(this.multipleStatus.before, nowDate),
|
|
172
|
+
afterMultiple: this.dateEqual(this.multipleStatus.after, nowDate),
|
|
173
|
+
month: full.month,
|
|
174
|
+
lunar: this.getlunar(full.year, full.month, i),
|
|
175
|
+
disable: !(disableBefore && disableAfter),
|
|
176
|
+
isDay,
|
|
177
|
+
};
|
|
178
|
+
if (info) {
|
|
179
|
+
data.extraInfo = info;
|
|
180
|
+
}
|
|
146
181
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
182
|
+
dateArr.push(data);
|
|
183
|
+
}
|
|
184
|
+
return dateArr;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* 获取下月天数
|
|
188
|
+
*/
|
|
189
|
+
_getNextMonthDays(surplus, full) {
|
|
190
|
+
let dateArr = [];
|
|
191
|
+
for (let i = 1; i < surplus + 1; i++) {
|
|
192
|
+
dateArr.push({
|
|
193
|
+
date: i,
|
|
194
|
+
month: Number(full.month) + 1,
|
|
195
|
+
lunar: this.getlunar(full.year, Number(full.month) + 1, i),
|
|
196
|
+
disable: true,
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
return dateArr;
|
|
200
|
+
}
|
|
155
201
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
return this.dateEqual(item, nowDate)
|
|
168
|
-
})
|
|
169
|
-
}
|
|
170
|
-
if (multiplesStatus !== -1) {
|
|
171
|
-
checked = true
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
let data = {
|
|
175
|
-
fullDate: nowDate,
|
|
176
|
-
year: full.year,
|
|
177
|
-
date: i,
|
|
178
|
-
multiple: this.range ? checked : false,
|
|
179
|
-
beforeMultiple: this.dateEqual(this.multipleStatus.before, nowDate),
|
|
180
|
-
afterMultiple: this.dateEqual(this.multipleStatus.after, nowDate),
|
|
181
|
-
month: full.month,
|
|
182
|
-
lunar: this.getlunar(full.year, full.month, i),
|
|
183
|
-
disable: !(disableBefore && disableAfter),
|
|
184
|
-
isDay
|
|
185
|
-
}
|
|
186
|
-
if (info) {
|
|
187
|
-
data.extraInfo = info
|
|
188
|
-
}
|
|
202
|
+
/**
|
|
203
|
+
* 获取当前日期详情
|
|
204
|
+
* @param {Object} date
|
|
205
|
+
*/
|
|
206
|
+
getInfo(date) {
|
|
207
|
+
if (!date) {
|
|
208
|
+
date = new Date();
|
|
209
|
+
}
|
|
210
|
+
const dateInfo = this.canlender.find((item) => item.fullDate === this.getDate(date).fullDate);
|
|
211
|
+
return dateInfo;
|
|
212
|
+
}
|
|
189
213
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
disable: true
|
|
205
|
-
})
|
|
206
|
-
}
|
|
207
|
-
return dateArr
|
|
208
|
-
}
|
|
214
|
+
/**
|
|
215
|
+
* 比较时间大小
|
|
216
|
+
*/
|
|
217
|
+
dateCompare(startDate, endDate) {
|
|
218
|
+
// 计算截止时间
|
|
219
|
+
startDate = new Date(startDate.replace('-', '/').replace('-', '/'));
|
|
220
|
+
// 计算详细项的截止时间
|
|
221
|
+
endDate = new Date(endDate.replace('-', '/').replace('-', '/'));
|
|
222
|
+
if (startDate <= endDate) {
|
|
223
|
+
return true;
|
|
224
|
+
} else {
|
|
225
|
+
return false;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
209
228
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
229
|
+
/**
|
|
230
|
+
* 比较时间是否相等
|
|
231
|
+
*/
|
|
232
|
+
dateEqual(before, after) {
|
|
233
|
+
// 计算截止时间
|
|
234
|
+
before = new Date(before.replace('-', '/').replace('-', '/'));
|
|
235
|
+
// 计算详细项的截止时间
|
|
236
|
+
after = new Date(after.replace('-', '/').replace('-', '/'));
|
|
237
|
+
if (before.getTime() - after.getTime() === 0) {
|
|
238
|
+
return true;
|
|
239
|
+
} else {
|
|
240
|
+
return false;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
221
243
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
244
|
+
/**
|
|
245
|
+
* 获取日期范围内所有日期
|
|
246
|
+
* @param {Object} begin
|
|
247
|
+
* @param {Object} end
|
|
248
|
+
*/
|
|
249
|
+
geDateAll(begin, end) {
|
|
250
|
+
var arr = [];
|
|
251
|
+
var ab = begin.split('-');
|
|
252
|
+
var ae = end.split('-');
|
|
253
|
+
var db = new Date();
|
|
254
|
+
db.setFullYear(ab[0], ab[1] - 1, ab[2]);
|
|
255
|
+
var de = new Date();
|
|
256
|
+
de.setFullYear(ae[0], ae[1] - 1, ae[2]);
|
|
257
|
+
var unixDb = db.getTime() - 24 * 60 * 60 * 1000;
|
|
258
|
+
var unixDe = de.getTime() - 24 * 60 * 60 * 1000;
|
|
259
|
+
for (var k = unixDb; k <= unixDe; ) {
|
|
260
|
+
k = k + 24 * 60 * 60 * 1000;
|
|
261
|
+
arr.push(this.getDate(new Date(parseInt(k))).fullDate);
|
|
262
|
+
}
|
|
263
|
+
return arr;
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* 计算阴历日期显示
|
|
267
|
+
*/
|
|
268
|
+
getlunar(year, month, date) {
|
|
269
|
+
return CALENDAR.solar2lunar(year, month, date);
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* 设置打点
|
|
273
|
+
*/
|
|
274
|
+
setSelectInfo(data, value) {
|
|
275
|
+
this.selected = value;
|
|
276
|
+
this._getWeek(data);
|
|
277
|
+
}
|
|
236
278
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
before = new Date(before.replace('-', '/').replace('-', '/'))
|
|
243
|
-
// 计算详细项的截止时间
|
|
244
|
-
after = new Date(after.replace('-', '/').replace('-', '/'))
|
|
245
|
-
if (before.getTime() - after.getTime() === 0) {
|
|
246
|
-
return true
|
|
247
|
-
} else {
|
|
248
|
-
return false
|
|
249
|
-
}
|
|
250
|
-
}
|
|
279
|
+
/**
|
|
280
|
+
* 获取多选状态
|
|
281
|
+
*/
|
|
282
|
+
setMultiple(fullDate) {
|
|
283
|
+
let { before, after } = this.multipleStatus;
|
|
251
284
|
|
|
285
|
+
if (!this.range) return;
|
|
286
|
+
if (before && after) {
|
|
287
|
+
this.multipleStatus.before = '';
|
|
288
|
+
this.multipleStatus.after = '';
|
|
289
|
+
this.multipleStatus.data = [];
|
|
290
|
+
} else {
|
|
291
|
+
if (!before) {
|
|
292
|
+
this.multipleStatus.before = fullDate;
|
|
293
|
+
} else {
|
|
294
|
+
this.multipleStatus.after = fullDate;
|
|
295
|
+
if (this.dateCompare(this.multipleStatus.before, this.multipleStatus.after)) {
|
|
296
|
+
this.multipleStatus.data = this.geDateAll(this.multipleStatus.before, this.multipleStatus.after);
|
|
297
|
+
} else {
|
|
298
|
+
this.multipleStatus.data = this.geDateAll(this.multipleStatus.after, this.multipleStatus.before);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
this._getWeek(fullDate);
|
|
303
|
+
}
|
|
252
304
|
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
*/
|
|
283
|
-
setSelectInfo(data, value) {
|
|
284
|
-
this.selected = value
|
|
285
|
-
this._getWeek(data)
|
|
286
|
-
}
|
|
305
|
+
/**
|
|
306
|
+
* 获取每周数据
|
|
307
|
+
* @param {Object} dateData
|
|
308
|
+
*/
|
|
309
|
+
_getWeek(dateData) {
|
|
310
|
+
const { year, month } = this.getDate(dateData);
|
|
311
|
+
let firstDay = new Date(year, month - 1, 1).getDay();
|
|
312
|
+
let currentDay = new Date(year, month, 0).getDate();
|
|
313
|
+
let dates = {
|
|
314
|
+
lastMonthDays: this._getLastMonthDays(firstDay, this.getDate(dateData)), // 上个月末尾几天
|
|
315
|
+
currentMonthDys: this._currentMonthDys(currentDay, this.getDate(dateData)), // 本月天数
|
|
316
|
+
nextMonthDays: [], // 下个月开始几天
|
|
317
|
+
weeks: [],
|
|
318
|
+
};
|
|
319
|
+
let canlender = [];
|
|
320
|
+
const surplus = 42 - (dates.lastMonthDays.length + dates.currentMonthDys.length);
|
|
321
|
+
dates.nextMonthDays = this._getNextMonthDays(surplus, this.getDate(dateData));
|
|
322
|
+
canlender = canlender.concat(dates.lastMonthDays, dates.currentMonthDys, dates.nextMonthDays);
|
|
323
|
+
let weeks = {};
|
|
324
|
+
// 拼接数组 上个月开始几天 + 本月天数+ 下个月开始几天
|
|
325
|
+
for (let i = 0; i < canlender.length; i++) {
|
|
326
|
+
if (i % 7 === 0) {
|
|
327
|
+
weeks[parseInt(i / 7)] = new Array(7);
|
|
328
|
+
}
|
|
329
|
+
weeks[parseInt(i / 7)][i % 7] = canlender[i];
|
|
330
|
+
}
|
|
331
|
+
this.canlender = canlender;
|
|
332
|
+
this.weeks = weeks;
|
|
333
|
+
}
|
|
287
334
|
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
} = this.multipleStatus
|
|
296
|
-
|
|
297
|
-
if (!this.range) return
|
|
298
|
-
if (before && after) {
|
|
299
|
-
this.multipleStatus.before = ''
|
|
300
|
-
this.multipleStatus.after = ''
|
|
301
|
-
this.multipleStatus.data = []
|
|
302
|
-
} else {
|
|
303
|
-
if (!before) {
|
|
304
|
-
this.multipleStatus.before = fullDate
|
|
305
|
-
} else {
|
|
306
|
-
this.multipleStatus.after = fullDate
|
|
307
|
-
if (this.dateCompare(this.multipleStatus.before, this.multipleStatus.after)) {
|
|
308
|
-
this.multipleStatus.data = this.geDateAll(this.multipleStatus.before, this.multipleStatus.after);
|
|
309
|
-
} else {
|
|
310
|
-
this.multipleStatus.data = this.geDateAll(this.multipleStatus.after, this.multipleStatus.before);
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
this._getWeek(fullDate)
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
/**
|
|
318
|
-
* 获取每周数据
|
|
319
|
-
* @param {Object} dateData
|
|
320
|
-
*/
|
|
321
|
-
_getWeek(dateData) {
|
|
322
|
-
const {
|
|
323
|
-
year,
|
|
324
|
-
month
|
|
325
|
-
} = this.getDate(dateData)
|
|
326
|
-
let firstDay = new Date(year, month - 1, 1).getDay()
|
|
327
|
-
let currentDay = new Date(year, month, 0).getDate()
|
|
328
|
-
let dates = {
|
|
329
|
-
lastMonthDays: this._getLastMonthDays(firstDay, this.getDate(dateData)), // 上个月末尾几天
|
|
330
|
-
currentMonthDys: this._currentMonthDys(currentDay, this.getDate(dateData)), // 本月天数
|
|
331
|
-
nextMonthDays: [], // 下个月开始几天
|
|
332
|
-
weeks: []
|
|
333
|
-
}
|
|
334
|
-
let canlender = []
|
|
335
|
-
const surplus = 42 - (dates.lastMonthDays.length + dates.currentMonthDys.length)
|
|
336
|
-
dates.nextMonthDays = this._getNextMonthDays(surplus, this.getDate(dateData))
|
|
337
|
-
canlender = canlender.concat(dates.lastMonthDays, dates.currentMonthDys, dates.nextMonthDays)
|
|
338
|
-
let weeks = {}
|
|
339
|
-
// 拼接数组 上个月开始几天 + 本月天数+ 下个月开始几天
|
|
340
|
-
for (let i = 0; i < canlender.length; i++) {
|
|
341
|
-
if (i % 7 === 0) {
|
|
342
|
-
weeks[parseInt(i / 7)] = new Array(7)
|
|
343
|
-
}
|
|
344
|
-
weeks[parseInt(i / 7)][i % 7] = canlender[i]
|
|
345
|
-
}
|
|
346
|
-
this.canlender = canlender
|
|
347
|
-
this.weeks = weeks
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
//静态方法
|
|
351
|
-
// static init(date) {
|
|
352
|
-
// if (!this.instance) {
|
|
353
|
-
// this.instance = new Calendar(date);
|
|
354
|
-
// }
|
|
355
|
-
// return this.instance;
|
|
356
|
-
// }
|
|
335
|
+
//静态方法
|
|
336
|
+
// static init(date) {
|
|
337
|
+
// if (!this.instance) {
|
|
338
|
+
// this.instance = new Calendar(date);
|
|
339
|
+
// }
|
|
340
|
+
// return this.instance;
|
|
341
|
+
// }
|
|
357
342
|
}
|
|
358
343
|
|
|
359
|
-
|
|
360
|
-
export default Calendar
|
|
344
|
+
export default Calendar;
|