Commit 622be814 by fengzhaoyu

feat: 整合代码

parent b5a1f9c4
......@@ -3,7 +3,8 @@ import { getHomeUserSchedule1 } from "../../api/request";
import {
getFormatDate,
getCurrentMonthFirst,
getCurrentMonthLast
getCurrentMonthLast,
throttle
} from "../../utils/utils";
Component({
mixins: [],
......@@ -116,9 +117,13 @@ Component({
);
});
},
didUpdate() {},
didUnmount() {},
didUpdate() { },
didUnmount() { },
methods: {
nextDetail: throttle(function (e) {
let item = e.target.dataset.item
dd.navigateTo({ url: `./../editMeeting/editMeeting?scheduleItem=${JSON.stringify(item)}` })
}, 1000),
closePop() {
this.setData({
show: false
......@@ -249,7 +254,7 @@ Component({
);
}
});
scheduleMap.forEach(function(value, key, map) {
scheduleMap.forEach(function (value, key, map) {
scheduleList.push(value);
});
return scheduleList;
......@@ -406,7 +411,7 @@ Component({
value: year
});
let thisDay = new Date().toLocaleDateString();
DateMap.forEach(function(value, key, map) {
DateMap.forEach(function (value, key, map) {
if (
new Date(key).getDay() === 0 &&
that.count(
......
{
"pages": [
"demo/index/index",
"pages/index/index",
"pages/meetingDetail/meetingDetail",
"pages/excutorList/excutorList",
......
.tabBar{
height: 120rpx;
width: 100%;
background: url('../../assests/tabBarBg.png');
background-size: cover;
display: flex;
position: fixed;
left: 0;
bottom: 0;
padding-top: 4rpx;
/* box-shadow: 0 -4rpx 8rpx 0 rgba(0,0,0,0.04);
border-radius: 0 64rpx 0 64rpx 0 0 0; */
}
.tabBar>view{
flex: 1;
font-size: 28rpx;
}
.tabBar>view:nth-of-type(1){
text-align: left;
}
.tabBar>view:nth-of-type(2){
text-align: right;
}
.createMeeting{
position: absolute;
left: 50%;
top: 4rpx;
font-size: 32rpx;
border-radius: 50%;
height: 84rpx;
width: 84rpx;
background: #EA0C28;
box-shadow: 0 4px 7px 0 rgba(234,12,40,0.30);
margin-left: -42rpx;
color: #FFFFFF;
text-align: center;
display: flex;
align-items: center;
justify-content: center;
}
.createMeeting .iconfont{
font-size: 34rpx;
display: block
}
.tabBarView{
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
height: 116rpx;
}
.tabBarView text{
display: block;
color: rgba(10,10,10,.4)
}
.tabBarView text:nth-of-type(1){
width: 42rpx;
height: 42rpx;
font-size: 42rpx;
margin-bottom: 11rpx;
}
.tabBarView text:nth-of-type(2){
height: 10rpx;
font-size: 20rpx;
}
.ischooseTabBar text{
color: rgba(10,10,10,1) !important;
}
\ No newline at end of file
<view a:if="{{tabBarIndex === '0'}}">
<my-dynamic>
</my-dynamic>
</view>
<view a:if="{{tabBarIndex === '1'}}">
<my-schedule>
</my-schedule>
</view>
<view class="tabBar">
<view onTap="changeTabBar" data-tabbar='0'>
<view class="tabBarView {{tabBarIndex === '0' ? 'ischooseTabBar' : ''}}">
<text class="iconfont iconicon_dynamic"></text>
<text>动态</text>
</view>
</view>
<view onTap="changeTabBar" data-tabbar='1'>
<view class="tabBarView {{tabBarIndex === '1' ? 'ischooseTabBar' : ''}}">
<text class="iconfont iconicon_Calendarbox1"></text>
<text>日程</text>
</view>
</view>
<view class="createMeeting">
<text class="iconfont iconicon_add1"></text>
</view>
</view>
\ No newline at end of file
import { getFormatDate } from '../../utils/utils'
Page({
data: {
tabBarIndex: '1'
},
onLoad() {
},
// 修改tabBar
changeTabBar(e) {
this.setData({
tabBarIndex: e.currentTarget.dataset.tabbar
})
},
});
{
"usingComponents": {
"my-dynamic": "../../PageComponents/myDynamic/myDynamic",
"my-schedule": "../../PageComponents/scheduleList/scheduleList"
}
}
\ No newline at end of file
@import "../../assests/font/iconfont.acss";
page {
background: #fff;
font-family: PingFangSC-Regular;
font-size: 42rpx;
color: #191F25;
}
.scheduleList {
margin-bottom: 48rpx;
}
.month {
padding: 0 32rpx;
height: 48rpx;
line-height: 48rpx;
margin-bottom: 50rpx;
font-weight: bold;
font-family:'DINAlternate-Bold';
}
.manyWeeks {
font-size: 26rpx;
color: rgba(25, 31, 37, 0.56);
height: 37rpx;
padding-left: 120rpx;
line-height: 37rpx;
margin: 48rpx 0;
}
.date {
.tabBar {
height: 120rpx;
width: 100%;
background: url('../../assests/tabBarBg.png');
background-size: cover;
display: flex;
padding: 0 32rpx;
margin-bottom: 48rpx;
position: fixed;
left: 0;
bottom: 0;
padding-top: 4rpx;
/* box-shadow: 0 -4rpx 8rpx 0 rgba(0,0,0,0.04);
border-radius: 0 64rpx 0 64rpx 0 0 0; */
}
.dateTime {
margin-right: 34rpx;
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: center;
padding-top: 16rpx;
.tabBar>view {
flex: 1;
font-size: 28rpx;
}
.dateTime>view {
font-size: 22rpx;
line-height: 24rpx;
font-weight: bolder;
color: #191F25;
margin-bottom: 4rpx;
.tabBar>view:nth-of-type(1) {
text-align: left;
}
.dateTime>text {
margin-left: 3rpx;
font-family: DINAlternate-Bold;
font-size: 42rpx;
color: #191F25;
line-height: 42rpx;
.tabBar>view:nth-of-type(2) {
text-align: right;
}
.dataSchedule>view {
width: 604rpx;
border-radius: 8rpx;
font-size: 26rpx;
color: #0080FF;
height: 90rpx;
overflow: hidden;
background: #CFECFF;
margin-bottom: 16rpx;
}
.NoSchedule{
width: 604rpx;
border-radius: 8rpx;
font-size: 26rpx;
height: 90rpx;
padding-left: 16rpx;
box-sizing: border-box;
margin-bottom: 16rpx;
line-height: 0.9rem;
}
.NoSchedule > view:nth-of-type(1) text:nth-of-type(1) {
color: rgba(25,31,37,0.56);
}
.NoSchedule > view:nth-of-type(1) text:nth-of-type(2) {
color: #3296FA;
}
.dataSchedule {
position: relative;
}
.dataSchedule .overdue {
background: #F6F6F6;
color: rgba(25, 31, 37, 0.56);
}
.thisDay > view{
color: rgb(50, 150, 250);
}
.thisDay > text{
color: rgb(50, 150, 250);
}
.thisDayLine {
position: relative;
height: 2rpx;
background: #F25643;
width: 100%;
overflow: visible;
}
.dataSchedule .thisDayHavaMeeting {
height: 2rpx !important;
background: #F25643 !important;
overflow: visible !important;
position: absolute;
left: 0;
top: -8rpx;
}
.thisDayLine::after {
content: '';
.createMeeting {
position: absolute;
left: 0;
bottom: -3rpx;
width: 8rpx;
height: 8rpx;
left: 50%;
top: 4rpx;
font-size: 32rpx;
border-radius: 50%;
background: #F25643;
z-index: 99;
box-sizing: border-box;
}
.dataSchedule .cancel {
width: 602rpx;
overflow: hidden;
background: url(../../assests/cancel.png) center /100% 100%;
border: 1rpx solid rgba(25, 31, 37, 0.28);
color: rgba(25, 31, 37, 0.56);
height: 84rpx;
width: 84rpx;
background: #EA0C28;
box-shadow: 0 4px 7px 0 rgba(234, 12, 40, 0.30);
margin-left: -42rpx;
color: #FFFFFF;
text-align: center;
display: flex;
align-items: center;
justify-content: center;
}
.dataSchedule .cancel text{
text-decoration:line-through;
.createMeeting .iconfont {
font-size: 34rpx;
display: block
}
.dataSchedule>view>view {
margin-left: 16rpx;
.tabBarView {
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
height: 116rpx;
}
.dataScheduleName {
margin-top: 16rpx;
margin-bottom: 8rpx;
.tabBarView text {
display: block;
color: rgba(10, 10, 10, .4)
}
.dataSchedule>view:last-child {
margin-bottom: 0;
.tabBarView text:nth-of-type(1) {
width: 42rpx;
height: 42rpx;
font-size: 42rpx;
margin-bottom: 11rpx;
}
.dataScheduleTime {
font-size: 22rpx;
.tabBarView text:nth-of-type(2) {
height: 10rpx;
font-size: 20rpx;
}
.createSchedule {
vertical-align: top;
font-size: 40rpx;
width: 98rpx;
height: 98rpx;
border-radius: 50%;
position: fixed;
right: 32rpx;
bottom: 98rpx;
color: white;
text-align: center;
line-height: 98rpx;
background: #3296FA;
box-shadow: 0 8px 14px 0 rgba(50, 150, 250, 0.30);
}
.startPage {
position: fixed;
height: 100%;
top: 0;
width: 100%;
background:#fff;
}
.startPage>image {
width: 603rpx;
height: 444rpx;
vertical-align: top;
margin-top: 300rpx;
margin-left: 82rpx;
z-index: 9999999;
}
.startText {
margin-top: 80rpx;
text-align: center;
font-size: 46rpx;
}
.text1 {
margin-right: 32rpx;
.ischooseTabBar text {
color: rgba(10, 10, 10, 1) !important;
}
\ No newline at end of file
<!--<mw-select></mw-select> -->
版本号:151 版本
<view class="index">
<view >
<scroll-view a:if="{{todayStr !== ''}}" scroll-y="{{true}}" upper-threshold="50" lower-threshold="1000" onScrollToLower="lower" onScroll="onScroll" style="height: 100vh;" scroll-into-view="{{todayStr}}">
<block a:for="{{scheduleList}}" a:for-item="scheduleYearList">
<block a:for="{{scheduleYearList}}">
<block a:if="{{item.type == 'year'}}">
<view class="month">
{{item.value}}年
</view>
</block>
<block a:elif="{{item.type == 'month'}}">
<view class="month">
{{item.value}}月
</view>
</block>
<block a:elif="{{item.type == 'week'}}">
<view class="week" id="{{item.dayStr}}">
<view class="manyWeeks">
{{item.value}}
</view>
</view>
</block>
<block a:elif="{{item.type == 'day'}}">
<view class="date">
<view class="dateTime {{item.isThisDay}}">
<view>
{{item.value.week}}
</view>
<text>{{item.value.day}}</text>
</view>
<view class="dataSchedule">
<view a:for="{{item.value.value}}" a:for-item="item2" data-item="{{item2}}" class="{{ item2.isBeOverdue ? 'overdue' : item2.confirmAttendance === 0 ? 'cancel' : '' }}" onTap="nextDetail">
<view class="dataScheduleName">
<text>{{item2.title}}{{item2.isfirstDayOrEndDay ? `(第${item2.isFewDays}天,共${item2.duration}天)` : '' }}</text>
</view>
<view class="dataScheduleTime">
<text a:if="{{item2.isfirstDayOrEndDay && item2.isfirstDayOrEndDay === '0'}}">{{item2.thisDayStartTime}}</text>
<text a:elif="{{item2.isfirstDayOrEndDay && item2.isfirstDayOrEndDay === '1'}}">全天</text>
<text a:elif="{{item2.isfirstDayOrEndDay && item2.isfirstDayOrEndDay === '2'}}">直到{{item2.thisDayEndTime}}</text>
<text a:else>{{item2.thisDayStartTime}} - {{item2.thisDayEndTime}}</text>
</view>
</view>
</view>
</view>
</block>
<block a:elif="{{item.type == 'today'}}">
<view class="date" id="{{item.value.dateStr}}">
<view class="dateTime {{item.isThisDay}}">
<view style="color: rgb(50, 150, 250)">
{{item.value.week}}
</view>
<text style="color: rgb(50, 150, 250)">{{item.value.day}}</text>
</view>
<view class="dataSchedule">
<!--<view class="thisDayLine thisDayHavaMeeting" style="margin-bottom: 7.5rpx"></view> -->
<view a:for="{{item.value.value}}" a:for-item="item2" data-item="{{item2}}" class="{{ item2.isBeOverdue ? 'overdue' : item2.confirmAttendance === 0 ? 'cancel' : '' }}" onTap="nextDetail">
<view class="dataScheduleName">
<text>{{item2.title}}{{item2.isfirstDayOrEndDay ? `(第${item2.isFewDays}天,共${item2.duration}天)` : '' }}</text>
</view>
<view class="dataScheduleTime">
<text a:if="{{item2.isfirstDayOrEndDay && item2.isfirstDayOrEndDay === '0'}}">{{item2.thisDayStartTime}}</text>
<text a:elif="{{item2.isfirstDayOrEndDay && item2.isfirstDayOrEndDay === '1'}}">全天</text>
<text a:elif="{{item2.isfirstDayOrEndDay && item2.isfirstDayOrEndDay === '2'}}">直到{{item2.thisDayEndTime}}</text>
<text a:else>{{item2.thisDayStartTime}} - {{item2.thisDayEndTime}}</text>
</view>
</view>
</view>
</view>
</block>
<block a:elif="{{item.type == 'thisDay'}}">
<view class="date" id="{{item.value.dateStr}}">
<view class="dateTime thisDay">
<view>
{{item.value.week}}
</view>
<text>{{item.value.day}}</text>
</view>
<view class="NoSchedule">
<view>
<text>暂无日程安排,</text>
<text onTap="nextPage">创建日程</text>
<view a:if="{{tabBarIndex === '0'}}">
<my-dynamic>
</my-dynamic>
</view>
<view a:if="{{tabBarIndex === '1'}}">
<my-schedule>
</my-schedule>
</view>
<view class="tabBar">
<view onTap="changeTabBar" data-tabbar='0'>
<view class="tabBarView {{tabBarIndex === '0' ? 'ischooseTabBar' : ''}}">
<text class="iconfont iconicon_dynamic"></text>
<text>动态</text>
</view>
<!--<view class="thisDayLine"></view> -->
</view>
<view onTap="changeTabBar" data-tabbar='1'>
<view class="tabBarView {{tabBarIndex === '1' ? 'ischooseTabBar' : ''}}">
<text class="iconfont iconicon_Calendarbox1"></text>
<text>日程</text>
</view>
</block>
</block>
</block>
</scroll-view>
<view class="createSchedule iconfont iconjiahao " onTap="nextPage">
</view>
<view class="createMeeting" onTap="createMeeting">
<text class="iconfont iconicon_add1"></text>
</view>
<!--<view class="startPage"><image mode="scaleToFill" src="../../assests/startPage.png"/><view class="startText"><text class="text1">开会有益</text><text>快乐工作</text></view></view> -->
</view>
\ No newline at end of file
import { getHomeUserSchedule1 } from "../../api/request.js";
import { RRule, RRuleSet, rrulestr } from "rrule";
import { throttle } from "./../../utils/utils.js";
import {
getFormatDate,
getCurrentMonthFirst,
getCurrentMonthLast
} from "../../utils/utils";
import { getFormatDate } from '../../utils/utils'
Page({
data: {
response: "",
scheduleList: [],
todayStr: "",
thisYear: "",
maxYear: "",
minYear: "",
startPageOnLoad: false,
startPageOnShow: false,
isFirstLoad: true
tabBarIndex: '1'
},
onLoad(query) {
// 页面加载
this.setData({
startPageOnLoad: true
});
onLoad() {
},
onReady() {},
onScroll() {
// 修改tabBar
changeTabBar(e) {
this.setData({
todayStr: "00000"
});
},
onShow() {
// 页面显示
let data = {
startTime: "2020-01-01 00:00:00",
endTime: "2025-12-30 23:59:59"
};
let that = this;
getHomeUserSchedule1(data).then(res => {
that.setData(
{
response: res.data.data
},
() => {
let now = new Date();
let year = now.getFullYear();
let scheduleList = [];
for (let i = 0; i <= year - 2019; i++) {
scheduleList.push(that.returnScheduleList(2019 + i));
}
// 第一次加载
if (this.data.isFirstLoad) {
const today = new Date();
// finalDate 是用来定位到今天的
const finalDate = new Date(today);
// finalDate.setDate(today.getDate() - today.getDay())
that.setData({
scheduleList: scheduleList,
todayStr: finalDate.toLocaleDateString(),
thisYear: year,
maxYear: year,
canClick: true,
startPageOnShow: true,
isFirstLoad: false
});
} else {
that.setData({
scheduleList: scheduleList,
thisYear: year,
maxYear: year,
canClick: true,
startPageOnShow: true
});
}
}
);
});
tabBarIndex: e.currentTarget.dataset.tabbar
})
},
getCalendarList() {
let that = this;
// 定义map数据结构
let scheduleMap = new Map();
// 对规则内的
if (this.data.response) {
this.data.response.templateList.map(item => {
// TO DO 判断所获取的时间区间
// 将会议的年,月,日拆分,时分拆分,生成rrules规则
let terminateTimeList = item.initialTime.split("-"); //
let startTimeList = item.startTime.split(":");
let DTSTART = `${terminateTimeList[0]}${terminateTimeList[1]}${terminateTimeList[2]}T${startTimeList[0]}${startTimeList[1]}00Z`;
let rule = RRule.fromString(
`${item.recurrenceModel.recurrenceRule};DTSTART=${DTSTART}`
);
// 改变时区
rule.options.tzid = "Asia/Hong_Kong";
// 判断是否需要剔除某一天
if (item.excludePlanDates) {
// 拿到剔除日期的list
let excludeDateList = that.returnExcludeDate(
item.excludePlanDates.split(",")
);
rule.all().map(item2 => {
let excludeDate = getFormatDate(item2, "yyyyMMdd");
let hasExclude =
excludeDateList.scheduleList.indexOf(excludeDate) === -1;
if (
new Date(item2).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}`,
{
confirmAttendance: item.confirmAttendance,
endTime: getFormatDate(endTime, "yyyyMMdd HH:mm:ss"),
id: item.id,
startTime: startTime,
title: item.title,
planDate: getFormatDate(item2, "yyyyMMdd")
}
);
}
});
} else {
rule.all().map(item2 => {
let startTime =
getFormatDate(item2, "yyyyMMdd") +
" " +
item.recurrenceModel.startTime;
let endTime = new Date(
getFormatDate(item2, "yyyyMMdd") +
" " +
item.recurrenceModel.startTime
);
endTime.setMinutes(
endTime.getMinutes() + item.recurrenceModel.duration
);
scheduleMap.set(
`${new Date(item2).toLocaleDateString()}/${item.id}`,
{
confirmAttendance: item.confirmAttendance,
endTime: getFormatDate(endTime, "yyyyMMdd HH:mm:ss"),
id: item.id,
startTime: startTime,
title: item.title,
planDate: getFormatDate(item2, "yyyyMMdd")
}
);
});
}
});
let scheduleList = [];
this.data.response.scheduleList.map(item => {
if (!item.scheduleTemplateId) {
scheduleList.push(item);
} else if (
item.scheduleTemplateId &&
scheduleMap.get(
`${item.planDate.replace(/-/g, "/")}/${item.scheduleTemplateId}`
)
) {
scheduleMap.set(
`${item.planDate.replace(/-/g, "/")}/${item.scheduleTemplateId}`,
item
);
}
});
scheduleMap.forEach(function(value, key, map) {
scheduleList.push(value);
});
return scheduleList;
} else {
return [];
}
},
returnScheduleList(year) {
let that = this;
let weekList = ["周日", "周一", "周二", "周三", "周四", "周五", "周六"];
let DateMap = new Map();
let isLeapYear = (year % 4 == 0 && year % 100 != 0) || year % 400 == 0;
// 闰年
if (isLeapYear) {
let isFirstWeek = false;
for (let i = 1; i <= 366; i++) {
// 判断一月第一周的第一个周一
if (i <= 7 && new Date(year, 0, i).getDay() === 0) {
isFirstWeek = true;
}
// 是第一个月第一个周一
if (isFirstWeek) {
DateMap.set(`${new Date(year, 0, i).toLocaleDateString()}`, {
scheduleList: []
});
}
}
// 跨年的那几天不是周一的
let num = 6 - new Date(year, 0, 366).getDay();
for (let i = 0; i <= num; i++) {
DateMap.set(`${new Date(year, 0, 366 + i).toLocaleDateString()}`, {
scheduleList: []
});
}
} else {
let isFirstWeek = false;
for (let i = 1; i <= 365; i++) {
if (i <= 7 && new Date(year, 0, i).getDay() === 0) {
isFirstWeek = true;
}
if (isFirstWeek) {
DateMap.set(`${new Date(year, 0, i).toLocaleDateString()}`, {
scheduleList: []
});
}
}
let num = 6 - new Date(year, 0, 365).getDate();
for (let i = 0; i <= num; i++) {
DateMap.set(`${new Date(year, 0, 366 + i).toLocaleDateString()}`, {
scheduleList: []
});
}
}
let AllScheduleList = this.getCalendarList();
// 遍历所有日程
for (let y = 0; y < AllScheduleList.length; y++) {
let date1 = AllScheduleList[y].startTime.slice(0, 10).replace(/-/g, "/");
let date2 = AllScheduleList[y].endTime.slice(0, 10).replace(/-/g, "/");
let count = this.count(date1, date2);
// 不跨天
if (count == 0) {
// 每年的第一周和跨天的那几天有日程就push进去
if (
DateMap.get(
`${new Date(
AllScheduleList[y].startTime.replace(/-/g, "/")
).toLocaleDateString()}`
)
) {
DateMap.get(
`${new Date(
AllScheduleList[y].startTime.replace(/-/g, "/")
).toLocaleDateString()}`
).scheduleList.push({
...AllScheduleList[y],
thisDayStartTime: AllScheduleList[y].startTime.slice(11, 16),
thisDayEndTime: AllScheduleList[y].endTime.slice(11, 16),
isBeOverdue:
new Date().getTime() >
new Date(AllScheduleList[y].endTime.replace(/-/g, "/")).getTime()
? true
: false
});
}
}
// 跨天
else {
for (let j = 0; j <= count; j++) {
let time = new Date(date1);
time.setDate(time.getDate() + j);
if (
DateMap.get(
new Date(
time.getFullYear(),
time.getMonth(),
time.getDate()
).toLocaleDateString()
)
) {
DateMap.get(
new Date(
time.getFullYear(),
time.getMonth(),
time.getDate()
).toLocaleDateString()
).scheduleList.push({
...AllScheduleList[y],
isfirstDayOrEndDay: j === 0 ? "0" : j === count ? "2" : "1", // 0 第一天,1中间的天,2结束的天
thisDayStartTime: AllScheduleList[y].startTime.slice(11, 16),
thisDayEndTime: AllScheduleList[y].endTime.slice(11, 16),
isFewDays: j + 1,
duration: count + 1,
isBeOverdue:
new Date().getTime() >
new Date(
AllScheduleList[y].endTime.replace(/-/g, "/")
).getTime()
? true
: false
});
}
}
}
}
let DateList = [];
let listMonth = "";
// 第一个月的第一天
let listWeek = new Date(year, 0, 1).getDay() === 0 ? 0 : 1;
DateList.push({
type: "year",
value: year
});
let thisDay = new Date().toLocaleDateString();
DateMap.forEach(function(value, key, map) {
if (
new Date(key).getDay() === 0 &&
that.count(
key,
new Date(year, 0, isLeapYear ? 366 : 365).toLocaleDateString()
) > 7
) {
listWeek = listWeek + 1;
// 有此月份
if (new Date(key).getMonth() !== listMonth) {
listMonth = new Date(key).getMonth();
DateList.push({
type: "month",
value: new Date(key).getMonth() + 1
});
let rangeYear1 = new Date(key).getFullYear();
let rangeMonth1 = new Date(key).getMonth();
let rangeDay1 = new Date(key).getDate();
let rangeDate = new Date(rangeYear1, rangeMonth1, rangeDay1 + 6);
let rangeMonth2 = new Date(rangeDate).getMonth();
let rangeDay2 = new Date(rangeDate).getDate();
DateList.push({
type: "week",
value: `第${listWeek}周,${rangeMonth1 + 1}${rangeDay1}日 - ${
rangeMonth2 == rangeMonth1 ? "" : rangeMonth2 + 1 + "月"
}${rangeDay2}日`,
dayStr: key
});
}
// 没有此月份
else {
let rangeYear1 = new Date(key).getFullYear();
let rangeMonth1 = new Date(key).getMonth();
let rangeDay1 = new Date(key).getDate();
let rangeDate = new Date(rangeYear1, rangeMonth1, rangeDay1 + 6);
let rangeMonth2 = new Date(rangeDate).getMonth();
let rangeDay2 = new Date(rangeDate).getDate();
DateList.push({
type: "week",
value: `第${listWeek}周,${rangeMonth1 + 1}${rangeDay1}日 - ${
rangeMonth2 == rangeMonth1 ? "" : rangeMonth2 + 1 + "月"
}${rangeDay2}日`,
dayStr: key
});
}
} else if (
new Date(key).getDay() === 0 &&
that.count(new Date(key), new Date(year, 0, isLeapYear ? 366 : 365) < 7)
) {
let rangeYear1 = new Date(key).getFullYear();
let rangeMonth1 = new Date(key).getMonth();
let rangeDay1 = new Date(key).getDate();
let rangeDate = new Date(rangeYear1, rangeMonth1, rangeDay1 + 6);
let rangeMonth2 = new Date(rangeDate).getMonth();
let rangeDay2 = new Date(rangeDate).getDate();
listWeek = 1;
DateList.push({
type: "week",
value: `第${listWeek}周,${rangeMonth1 + 1}${rangeDay1}日 - ${
rangeMonth2 == rangeMonth1 ? "" : rangeMonth2 + 1 + "月"
}${rangeDay2}日`,
dayStr: key
});
}
// 有日程长度 并且不是今天
if (value.scheduleList.length !== 0 && key !== thisDay) {
DateList.push({
type: "day",
isThisDay: true,
value: {
value: value.scheduleList,
day:
new Date(key).getDate() < 10
? "0" + new Date(key).getDate()
: new Date(key).getDate(),
week: weekList[new Date(key).getDay()]
}
});
}
// 有日程长度,并且是今天
else if (value.scheduleList.length !== 0 && key === thisDay) {
DateList.push({
type: "today",
value: {
value: value.scheduleList,
day:
new Date(key).getDate() < 10
? "0" + new Date(key).getDate()
: new Date(key).getDate(),
week: weekList[new Date(key).getDay()],
dateStr: key
}
});
}
if (value.scheduleList.length === 0 && key === thisDay) {
console.log(key);
console.log(111111);
DateList.push({
type: "thisDay",
value: {
value: value.scheduleList,
day:
new Date(key).getDate() < 10
? "0" + new Date(key).getDate()
: new Date(key).getDate(),
week: weekList[new Date(key).getDay()],
dateStr: key
}
});
}
});
return DateList;
},
// 是否跨天 返回跨天数
count(date1, date2) {
var date1 = new Date(date1);
var date2 = new Date(date2);
var date =
(date2.getTime() - date1.getTime()) /
(1000 * 60 * 60 * 24); /*不用考虑闰年否*/
return date;
},
nextPage() {
createMeeting() {
// isClicked(this)
dd.navigateTo({ url: "./../createMeeting/createMeeting" });
},
nextDetail: throttle(function(e) {
let item = e.target.dataset.item;
// dd.navigateTo({ url: `./../editMeeting/editMeeting?scheduleItem=${JSON.stringify(item)}` });
dd.navigateTo({
url: `./../meetingDetail/meetingDetail?scheduleItem=${JSON.stringify(
item
)}`
});
}, 1000),
lower() {
let year = this.data.maxYear + 1;
let DateList = this.returnScheduleList(year);
this.data.scheduleList.push(DateList);
let scheduleList = [...this.data.scheduleList];
this.setData({
scheduleList: scheduleList,
maxYear: year
});
}
});
{
"defaultTitle": "首页",
"usingComponents": {
"popup": "../../components/popup/index",
"list": "../../components/list/list",
"hlist": "../../components/hList/hList",
"toast": "../../components/toast/toast",
"selectpopup": "../../components/selectPopup/selectPopup",
"meeting-time-picker": "../../components/meetingTimePicker/meetingTimePicker"
"my-dynamic": "../../PageComponents/myDynamic/myDynamic",
"my-schedule": "../../PageComponents/scheduleList/scheduleList"
}
}
\ No newline at end of file
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