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
5644cfff
Commit
5644cfff
authored
Apr 10, 2020
by
xiexiaoqin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
scheduleList
parent
a15b1efd
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
152 additions
and
3 deletions
+152
-3
myDynamic.json
PageComponents/myDynamic/myDynamic.json
+1
-1
package-lock.json
package-lock.json
+0
-0
package.json
package.json
+1
-0
schedule.js
pages/scheduleList/schedule.js
+138
-0
scheduleList.axml
pages/scheduleList/scheduleList.axml
+1
-1
scheduleList.js
pages/scheduleList/scheduleList.js
+0
-0
scheduleList.json
pages/scheduleList/scheduleList.json
+4
-1
utils.js
utils/utils.js
+7
-0
No files found.
PageComponents/myDynamic/myDynamic.json
View file @
5644cfff
{
"component"
:
true
,
"
disableScroll"
:
true
,
"
allowsBounceVertical"
:
"NO"
,
"usingComponents"
:
{
"task-list"
:
"../../components/taskList/taskList"
,
"file-list"
:
"../../components/fileList/fileList"
,
...
...
package-lock.json
View file @
5644cfff
This diff is collapsed.
Click to expand it.
package.json
View file @
5644cfff
{
"dependencies"
:
{
"
dd-store
"
:
"^1.8.4"
,
"
less
"
:
"^3.11.1"
,
"
rrule
"
:
"^2.6.4"
}
}
pages/scheduleList/schedule.js
0 → 100644
View file @
5644cfff
import
{
RRule
,
RRuleSet
,
rrulestr
}
from
"rrule"
;
import
{
padZero
}
from
"../../utils/utils"
;
export
function
getDateMap
(
minYear
,
maxYear
)
{
const
DateMap
=
new
Map
();
const
getOneYear
=
(
year
)
=>
{
const
yearDays
=
(
year
%
4
==
0
&&
year
%
100
!=
0
)
||
year
%
400
==
0
?
366
:
365
;
for
(
let
i
=
1
;
i
<=
yearDays
;
i
++
)
{
DateMap
.
set
(
new
Date
(
year
,
0
,
i
).
toLocaleDateString
(),
[]);
}
}
for
(
let
i
=
minYear
;
i
<=
maxYear
;
i
++
)
{
getOneYear
(
i
);
}
return
DateMap
}
// 返回删除的日期
/**
* 如果删除单次重复会议返回['2020-04-20'],
* 如果删除此次及以后重复会议返回['future2020-04-20']
*/
export
function
getExcludeDate
(
data
=
[])
{
const
excludeDateList
=
[];
const
futureList
=
[];
data
.
forEach
(
item
=>
{
//删除此次及以后
if
(
item
.
length
>
10
)
{
futureList
.
push
(
new
Date
(
item
.
slice
(
6
,
16
).
replace
(
/-/g
,
"/"
)).
getTime
());
}
//删除单次
else
{
excludeDateList
.
push
(
item
);
}
});
return
{
excludeDateList
,
minFutureTime
:
Math
.
min
(...
futureList
)
};
}
// 返回跨天数
export
function
getNextDateList
(
startTime
,
endTime
)
{
let
days
=
0
;
const
nextDateList
=
[];
if
(
startTime
.
getDate
()
!==
endTime
.
getDate
())
{
//同一个月
if
(
startTime
.
getMonth
()
!==
endTime
.
getMonth
())
{
days
=
endTime
.
getDate
()
-
startTime
.
getDate
();
}
//跨月
else
{
// 一个月份有多少天new Date(year, month, 0).getDate()
const
startMonth
=
new
Date
(
startTime
.
getFullYear
(),
startTime
.
getMonth
(),
0
).
getDate
();
days
=
startMonth
-
startTime
.
getDate
()
+
endTime
.
getDate
()
}
}
else
{
//跨一个月 不考虑
}
//返回跨天的日期数组
for
(
let
i
=
1
;
i
<=
days
;
i
++
)
{
const
newDate
=
new
Date
(
startTime
);
const
nextDate
=
new
Date
(
newDate
.
setDate
(
newDate
.
getDate
()
+
i
)).
toLocaleDateString
();
nextDateList
.
push
(
nextDate
)
}
return
nextDateList
}
export
function
getWeekNumber
(
year
,
month
,
days
)
{
const
isLeapYear
=
(
year
)
=>
(
year
%
400
==
0
)
||
(
year
%
4
==
0
&&
year
%
100
!=
0
)
const
getMonthDays
=
(
year
,
month
)
=>
[
31
,
null
,
31
,
30
,
31
,
30
,
31
,
31
,
30
,
31
,
30
,
31
][
month
]
||
(
isLeapYear
(
year
)
?
29
:
28
);
//那一天是那一年中的第多少天
for
(
var
i
=
0
;
i
<
month
;
i
++
)
{
days
+=
getMonthDays
(
year
,
i
);
}
//那一年第一天是星期几
var
yearFirstDay
=
new
Date
(
year
,
0
,
1
).
getDay
();
var
week
=
null
;
if
(
yearFirstDay
==
0
)
{
week
=
Math
.
ceil
(
days
/
7
);
}
else
{
days
-=
(
6
-
yearFirstDay
+
1
);
week
=
Math
.
ceil
(
days
/
7
);
}
return
week
;
}
export
function
getBlankList
(
year
)
{
const
dateMap
=
getDateMap
(
year
,
year
);
const
DateList
=
[];
dateMap
.
forEach
(
function
(
value
,
key
)
{
const
keyDate
=
new
Date
(
key
);
const
year
=
keyDate
.
getFullYear
();
const
month
=
keyDate
.
getMonth
();
const
date
=
keyDate
.
getDate
();
const
day
=
keyDate
.
getDay
();
// 生成年
if
(
month
===
0
&&
date
===
1
)
{
DateList
.
push
({
type
:
"year"
,
value
:
year
,
dateStr
:
`
${
year
}
`
});
}
//生成月
if
(
date
===
1
)
{
DateList
.
push
({
type
:
"month"
,
value
:
month
+
1
,
dateStr
:
`
${
year
}
/
${
month
+
1
}
`
});
}
//生成周
if
(
day
===
0
)
{
const
rangeDate
=
new
Date
(
year
,
month
,
date
+
6
);
const
rangeMonth2
=
new
Date
(
rangeDate
).
getMonth
();
const
rangeDay2
=
new
Date
(
rangeDate
).
getDate
();
DateList
.
push
({
type
:
"week"
,
value
:
`第
${
getWeekNumber
(
year
,
month
,
date
)}
周,
${
month
+
1
}
月
${
date
}
日 -
${
rangeMonth2
==
month
?
""
:
rangeMonth2
+
1
+
"月"
}${
rangeDay2
}
日`
,
dateStr
:
`
${
year
}
/
${
month
+
1
}
/
${
date
}
-week`
});
}
})
return
DateList
;
}
\ No newline at end of file
pages/scheduleList/scheduleList.axml
View file @
5644cfff
...
...
@@ -9,7 +9,7 @@
</view>
</view>
</view>
<scroll-view class="indexScrollView" scroll-y="{{true}}" style="background: #FFFFFF" lower-threshold="100" onScrollToLower="lower"
onScrollToUpper="upper"
scroll-into-view="{{todayStr}}">
<scroll-view class="indexScrollView" scroll-y="{{true}}" style="background: #FFFFFF" lower-threshold="100" onScrollToLower="lower" scroll-into-view="{{todayStr}}">
<block a:for="{{scheduleList}}" key="{{item.dateStr}}">
<!-- 年 -->
<block a:if="{{item.type == 'year'}}">
...
...
pages/scheduleList/scheduleList.js
View file @
5644cfff
This diff is collapsed.
Click to expand it.
pages/scheduleList/scheduleList.json
View file @
5644cfff
{
"allowsBounceVertical"
:
"YES"
,
"pullRefresh"
:
true
,
"usingComponents"
:
{
"popup"
:
"../../components/popup/index"
}
}
}
\ No newline at end of file
utils/utils.js
View file @
5644cfff
...
...
@@ -51,6 +51,8 @@ export function getFormatDate(time, format, symbol) {
:
`
${
year
}
/
${
month
}
/
${
day
}
`
;
}
else
if
(
format
===
"HH:mm:ss"
)
{
return
`
${
hour
}
:
${
minutes
}
:
${
seconds
}
`
;
}
else
if
(
format
===
"HH:mm"
)
{
return
`
${
hour
}
:
${
minutes
}
`
;
}
}
// 返回每个月的第一天
...
...
@@ -142,3 +144,7 @@ export function getCreateShowTime(createdTime) {
return
timeResule
}
export
function
padZero
(
val
)
{
return
(
"00"
+
val
).
slice
(
-
2
);
}
\ No newline at end of file
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