Commit 3e2c2adf by liang ce

修改日程js

parent a9de2203
......@@ -8,8 +8,8 @@
</view>
</view>
<scroll-view class="indexScrollView" scroll-y="{{true}}" style="background: #FFFFFF" lower-threshold="1000" onScrollToLower="lower" scroll-into-view="{{todayStr}}">
<block a:for="{{scheduleList}}" a:for-item="scheduleYearList">
<block a:for="{{scheduleYearList}}">
<!--<block a:for="{{scheduleList}}" a:for-item="scheduleYearList"> -->
<block a:for="{{scheduleList}}">
<block a:if="{{item.type == 'year'}}">
<view class="month">
{{item.value}}年
......@@ -92,7 +92,7 @@
</view>
</block>
</block>
</block>
<!--</block> -->
</scroll-view>
<popup show="{{show}}" onClose="closePop" position="left">
<view class="sidebarContent" catchTap="preventSort">
......
......@@ -62,13 +62,17 @@ create.Component({
let now = new Date();
let year = now.getFullYear();
let scheduleList = [];
for (let i = 0; i <= year - 2019; i++) {
scheduleList.push(that.returnScheduleList(2019 + i));
for (let i = -1; i <= year - 2020; i++) {
scheduleList.push.apply(
scheduleList,
that.returnScheduleList(2020 + i)
);
}
let scheduleList2 = scheduleList;
// 第一次加载
const finalDate = new Date();
that.setData({
scheduleList: scheduleList,
scheduleList: scheduleList2,
todayStr: finalDate.toLocaleDateString(),
thisYear: year,
maxYear: year
......@@ -156,30 +160,36 @@ create.Component({
item.excludePlanDates.split(",")
);
rule.all().map(item2 => {
let excludeDate = getFormatDate(item2, "yyyyMMdd", "-");
let time = new Date(item2);
time.setHours(time.getHours() - 8);
let startTime =
getFormatDate(time, "yyyyMMdd") +
" " +
item.recurrenceModel.startTime;
let endTime = new Date(
getFormatDate(time, "yyyyMMdd") +
" " +
item.recurrenceModel.startTime
);
let excludeDate = getFormatDate(time, "yyyyMMdd", "-");
let hasExclude =
excludeDateList.scheduleList.indexOf(excludeDate) === -1;
if (
new Date(item2).getTime() < excludeDateList.templateList &&
new Date(time).getTime() < excludeDateList.templateList &&
hasExclude
) {
let startTime =
getFormatDate(item2, "yyyyMMdd") +
" " +
item.recurrenceModel.startTime;
let endTime = new Date(startTime);
endTime.setMinutes(
endTime.getMinutes() + item.recurrenceModel.duration
);
scheduleMap.set(
`${new Date(item2).toLocaleDateString()}/${item.id}`,
`${new Date(time).toLocaleDateString()}/${item.id}`,
{
confirmAttendance: item.confirmAttendance,
endTime: getFormatDate(endTime, "yyyyMMdd HH:mm:ss"),
scheduleTemplateId: item.id,
startTime: startTime,
title: item.title,
planDate: getFormatDate(item2, "yyyyMMdd", "-")
planDate: getFormatDate(time, "yyyyMMdd", "-")
}
);
}
......@@ -255,6 +265,7 @@ create.Component({
if (i <= 7 && new Date(year, 0, i).getDay() === 0) {
isFirstWeek = true;
}
` `;
// 是第一个月第一个周一
if (isFirstWeek) {
DateMap.set(`${new Date(year, 0, i).toLocaleDateString()}`, {
......@@ -263,11 +274,17 @@ create.Component({
}
}
// 跨年的那几天不是周一的
let num = 6 - new Date(year, 0, 366).getDay();
let num =
6 - new Date(year, 0, isLeapYear).getDay() === 6
? 0
: 6 - new Date(year, 0, isLeapYear).getDay();
for (let i = 0; i <= num; i++) {
DateMap.set(`${new Date(year, 0, 366 + i).toLocaleDateString()}`, {
DateMap.set(
`${new Date(year, 0, isLeapYear + i).toLocaleDateString()}`,
{
scheduleList: []
});
}
);
}
let AllScheduleList = this.getCalendarList();
// 遍历所有日程
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment