Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
schedule
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fengzhaoyu
schedule
Commits
0d665535
Commit
0d665535
authored
Mar 31, 2020
by
liang ce
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
首页去详情页参数
parent
622be814
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
331 deletions
+26
-331
scheduleList.axml
PageComponents/scheduleList/scheduleList.axml
+1
-1
scheduleList.js
PageComponents/scheduleList/scheduleList.js
+25
-330
No files found.
PageComponents/scheduleList/scheduleList.axml
View file @
0d665535
...
...
@@ -4,7 +4,7 @@
</view>
<view class="index">
<view a:if="{{true}}">
<scroll-view class="indexScrollView" a:if="{{todayStr !== ''}}" scroll-y="{{true}}"
upper-threshold="50" lower-threshold="1000" onScrollToLower="lower" onScroll="onScroll
" scroll-into-view="{{todayStr}}">
<scroll-view class="indexScrollView" a:if="{{todayStr !== ''}}" scroll-y="{{true}}"
lower-threshold="1000" onScrollToLower="lower
" scroll-into-view="{{todayStr}}">
<block a:for="{{scheduleList}}" a:for-item="scheduleYearList">
<block a:for="{{scheduleYearList}}">
<block a:if="{{item.type == 'year'}}">
...
...
PageComponents/scheduleList/scheduleList.js
View file @
0d665535
...
...
@@ -117,12 +117,14 @@ 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
)}
`
})
nextDetail
:
throttle
(
function
(
e
)
{
let
item
=
e
.
target
.
dataset
.
item
;
dd
.
navigateTo
({
url
:
`./../editMeeting/editMeeting?scheduleItem=
${
JSON
.
stringify
(
item
)}
`
});
},
1000
),
closePop
()
{
this
.
setData
({
...
...
@@ -203,6 +205,7 @@ Component({
confirmAttendance
:
item
.
confirmAttendance
,
endTime
:
getFormatDate
(
endTime
,
"yyyyMMdd HH:mm:ss"
),
id
:
item
.
id
,
scheduleTemplateId
:
item
.
scheduleTemplateId
,
startTime
:
startTime
,
title
:
item
.
title
,
planDate
:
getFormatDate
(
item2
,
"yyyyMMdd"
)
...
...
@@ -230,6 +233,7 @@ Component({
confirmAttendance
:
item
.
confirmAttendance
,
endTime
:
getFormatDate
(
endTime
,
"yyyyMMdd HH:mm:ss"
),
id
:
item
.
id
,
scheduleTemplateId
:
item
.
scheduleTemplateId
,
startTime
:
startTime
,
title
:
item
.
title
,
planDate
:
getFormatDate
(
item2
,
"yyyyMMdd"
)
...
...
@@ -254,7 +258,7 @@ Component({
);
}
});
scheduleMap
.
forEach
(
function
(
value
,
key
,
map
)
{
scheduleMap
.
forEach
(
function
(
value
,
key
,
map
)
{
scheduleList
.
push
(
value
);
});
return
scheduleList
;
...
...
@@ -262,29 +266,6 @@ Component({
return
[];
}
},
returnMonthActionAndEndDate
(
year
,
month
,
date
)
{
let
days
=
this
.
returnDayMany
(
year
,
month
,
date
);
let
startDay
=
new
Date
(
year
,
month
,
1
).
getDay
()
===
0
?
1
:
7
-
new
Date
(
year
,
month
,
1
).
getDay
()
+
1
;
let
endDay
=
days
+
7
-
new
Date
(
year
,
month
,
days
).
getDay
();
return
{
startDay
:
startDay
,
endDay
:
endDay
};
},
// 生成一月内的渲染数据
returnMonthMap
(
year
,
month
,
date
)
{
let
monthDay
=
this
.
returnMonthActionAndEndDate
(
year
,
month
,
date
);
let
monthMap
=
new
Map
();
for
(
let
i
=
monthDay
.
startDay
;
i
<
monthDay
.
endDay
;
i
++
)
{
monthMap
.
set
(
`
${
new
Date
(
year
,
month
,
i
).
toLocaleDateString
()}
`
,
{
scheduleList
:
[]
});
}
return
monthMap
;
},
returnScheduleList
(
year
)
{
let
that
=
this
;
let
weekList
=
[
"周日"
,
"周一"
,
"周二"
,
"周三"
,
"周四"
,
"周五"
,
"周六"
];
...
...
@@ -334,7 +315,9 @@ Component({
let
AllScheduleList
=
this
.
getCalendarList
();
// 遍历所有日程
for
(
let
y
=
0
;
y
<
AllScheduleList
.
length
;
y
++
)
{
let
date1
=
AllScheduleList
[
y
].
startTime
.
slice
(
0
,
10
).
replace
(
/-/g
,
"/"
);
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
);
// 不跨天
...
...
@@ -357,7 +340,9 @@ Component({
thisDayEndTime
:
AllScheduleList
[
y
].
endTime
.
slice
(
11
,
16
),
isBeOverdue
:
new
Date
().
getTime
()
>
new
Date
(
AllScheduleList
[
y
].
endTime
.
replace
(
/-/g
,
"/"
)).
getTime
()
new
Date
(
AllScheduleList
[
y
].
endTime
.
replace
(
/-/g
,
"/"
)
).
getTime
()
?
true
:
false
});
...
...
@@ -411,7 +396,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
(
...
...
@@ -459,7 +444,10 @@ Component({
}
}
else
if
(
new
Date
(
key
).
getDay
()
===
0
&&
that
.
count
(
new
Date
(
key
),
new
Date
(
year
,
0
,
isLeapYear
?
366
:
365
)
<
7
)
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
();
...
...
@@ -507,8 +495,6 @@ Component({
});
}
if
(
value
.
scheduleList
.
length
===
0
&&
key
===
thisDay
)
{
console
.
log
(
key
);
console
.
log
(
111111
);
DateList
.
push
({
type
:
"thisDay"
,
value
:
{
...
...
@@ -525,179 +511,6 @@ Component({
});
return
DateList
;
},
// returnScheduleList(date) {
// let that = this;
// let argumentsDate = new Date(date);
// let year = argumentsDate.getFullYear();
// let month = argumentsDate.getMonth();
// let day = argumentsDate.getDate();
// let calendarList = this.getCalendarList();
// let monthMap = this.returnMonthMap(year, month, day);
// let weekList = ["周日", "周一", "周二", "周三", "周四", "周五", "周六"];
// // 遍历所有日程
// for (let y = 0; y < calendarList.length; y++) {
// let date1 = calendarList[y].startTime.slice(0, 10).replace(/-/g, "/");
// let date2 = calendarList[y].endTime.slice(0, 10).replace(/-/g, "/");
// let count = this.count(date1, date2);
// // 不跨天
// if (count == 0) {
// // 每年的第一周和跨天的那几天有日程就push进去
// if (
// monthMap.get(
// `${new Date(
// calendarList[y].startTime.replace(/-/g, "/")
// ).toLocaleDateString()}`
// )
// ) {
// monthMap
// .get(
// `${new Date(
// calendarList[y].startTime.replace(/-/g, "/")
// ).toLocaleDateString()}`
// )
// .scheduleList.push({
// ...calendarList[y],
// thisDayStartTime: calendarList[y].startTime.slice(11, 16),
// thisDayEndTime: calendarList[y].endTime.slice(11, 16),
// isBeOverdue:
// new Date().getTime() >
// new Date(calendarList[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 (
// monthMap.get(
// new Date(
// time.getFullYear(),
// time.getMonth(),
// time.getDate()
// ).toLocaleDateString()
// )
// ) {
// monthMap
// .get(
// new Date(
// time.getFullYear(),
// time.getMonth(),
// time.getDate()
// ).toLocaleDateString()
// )
// .scheduleList.push({
// ...calendarList[y],
// isfirstDayOrEndDay: j === 0 ? "0" : j === count ? "2" : "1", // 0 第一天,1中间的天,2结束的天
// thisDayStartTime: calendarList[y].startTime.slice(11, 16),
// thisDayEndTime: calendarList[y].endTime.slice(11, 16),
// isFewDays: j + 1,
// duration: count + 1,
// isBeOverdue:
// new Date().getTime() >
// new Date(
// calendarList[y].endTime.replace(/-/g, "/")
// ).getTime()
// ? true
// : false
// });
// }
// }
// }
// }
// let DateList = [];
// // 第一个月的第一天
// let thisDay = new Date().toLocaleDateString();
// monthMap.forEach(function(value, key, map) {
// if (new Date(key).getDay() === 0) {
// 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: `第${that.getYearWeek(key)}周,${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) {
// 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
// }
// });
// }
// });
// DateList.unshift({
// type: "month",
// value: month + 1
// });
// if (month === 0) {
// DateList.unshift({
// type: "year",
// value: year
// });
// }
// return DateList;
// },
// 获取今天是每个月的第几周
getYearWeek
(
date
)
{
/*
date1是当前日期
date2是当年第一天
d是当前日期是今年第多少天
用d + 当前年的第一天的周差距的和在除以7就是本年第几周
*/
var
date1
=
new
Date
(
date
);
var
date2
=
new
Date
(
date1
.
getFullYear
(),
0
,
1
);
var
d
=
Math
.
round
((
date1
.
valueOf
()
-
date2
.
valueOf
())
/
86400000
);
return
Math
.
ceil
((
d
+
(
date2
.
getDay
()
+
1
-
1
))
/
7
);
},
// 是否跨天 返回跨天数
count
(
date1
,
date2
)
{
var
date1
=
new
Date
(
date1
);
...
...
@@ -707,133 +520,15 @@ Component({
(
1000
*
60
*
60
*
24
);
/*不用考虑闰年否*/
return
date
;
},
// 返回指定月份天数
returnDayMany
(
year
,
month
,
date
)
{
var
selectedDate
=
new
Date
(
year
,
month
,
date
);
var
selectedMonth
=
selectedDate
.
getMonth
()
+
1
;
selectedDate
.
setMonth
(
selectedMonth
);
selectedDate
.
setDate
(
0
);
return
selectedDate
.
getDate
();
},
onScroll
(
e
)
{
// console.log(e);
// if (!this.data.scrollHeight || !this.data.timeStamp) {
// this.setData({
// scrollHeight: e.detail.scrollTop,
// timeStamp: e.timeStamp
// });
// } else {
// let height = e.detail.scrollTop - this.data.scrollHeight;
// let time = e.timeStamp - this.data.timeStamp;
// let v = height / time;
// console.log(v);
// this.setData({
// scrollHeight: e.detail.scrollTop,
// timeStamp: e.timeStamp
// });
// }
},
// onScrollToUpper() {
// let that = this;
// let now = new Date(this.data.pageStartTime);
// let year = now.getFullYear();
// let month = now.getMonth() + 1;
// let day = now.getDate();
// let parmsDate = this.returnMonthActionAndEndDate(year, month - 1, day);
// let startTime = getFormatDate(
// new Date(year, month - 1, parmsDate.startDay),
// "yyyyMMdd",
// "-"
// );
// let endTime = getFormatDate(
// new Date(year, month - 1, parmsDate.endDay),
// "yyyyMMdd",
// "-"
// );
// let data = {
// startTime: `${startTime} 00:00:00`,
// endTime: `${endTime} 23:59:59`
// };
// getHomeUserSchedule1(data).then(res => {
// this.setData(
// {
// response: res.data.data
// },
// () => {
// let scheduleList = [...this.data.scheduleList];
// let forDate = new Date(year, month, 1);
// scheduleList.unshift.apply(
// scheduleList,
// that.returnScheduleList(forDate.toLocaleDateString())
// );
// this.setData({
// scheduleList: scheduleList,
// pageStartTime: new Date(year, month - 2, 1).toLocaleDateString()
// });
// }
// );
// });
// },
lower
()
{
let
year
=
this
.
data
.
maxYear
+
1
let
DateList
=
this
.
returnScheduleList
(
year
)
this
.
data
.
scheduleList
.
push
(
DateList
)
let
scheduleList
=
[...
this
.
data
.
scheduleList
]
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
})
},
loadMoreDate
()
{
for
(
let
i
=
0
;
i
<
10
;
i
++
)
{
let
now
=
new
Date
(
this
.
data
.
pageEndTime
);
let
year
=
now
.
getFullYear
();
let
month
=
now
.
getMonth
()
+
1
;
let
day
=
now
.
getDate
();
let
parmsDate
=
this
.
returnMonthActionAndEndDate
(
year
,
month
+
1
,
day
);
let
forDate
=
new
Date
(
year
,
month
,
1
);
let
scheduleList
=
this
.
returnScheduleList
(
forDate
.
toLocaleDateString
()
);
this
.
$spliceData
({
scheduleList
:
[
this
.
data
.
scheduleList
.
length
,
0
,
scheduleList
],
pageEndTime
:
new
Date
(
year
,
month
,
1
).
toLocaleDateString
()
});
this
.
setData
({
pageEndTime
:
new
Date
(
year
,
month
,
1
).
toLocaleDateString
()
});
}
// let startTime = getFormatDate(
// new Date(year, month + 1, parmsDate.startDay),
// "yyyyMMdd",
// "-"
// );
// let endTime = getFormatDate(
// new Date(year, month + 1, parmsDate.endDay),
// "yyyyMMdd",
// "-"
// );
// let data = {
// startTime: `${startTime} 00:00:00`,
// endTime: `${endTime} 23:59:59`
// };
// getHomeUserSchedule1(data).then(res => {
// that.setData(
// {
// response: res.data.data
// },
// () => {
// let forDate = new Date(year, month, 1);
// let scheduleList = that.returnScheduleList(
// forDate.toLocaleDateString()
// );
// that.$spliceData({
// scheduleList: [that.data.scheduleList.length, 0, scheduleList],
// pageEndTime: new Date(year, month, 1).toLocaleDateString()
// });
// }
// );
// });
}
}
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment