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
bfefd08c
Commit
bfefd08c
authored
Feb 16, 2020
by
fengzhaoyu
Browse files
Options
Browse Files
Download
Plain Diff
暂存
parents
bc378e98
a075e286
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
107 additions
and
57 deletions
+107
-57
http.js
api/http.js
+3
-0
index.axml
pages/index/index.axml
+38
-32
index.js
pages/index/index.js
+62
-23
index.json
pages/index/index.json
+4
-2
No files found.
api/http.js
View file @
bfefd08c
...
@@ -26,6 +26,9 @@ export default function http (data) {
...
@@ -26,6 +26,9 @@ export default function http (data) {
login
().
then
(
res
=>
{
login
().
then
(
res
=>
{
getApp
().
globalData
.
token
=
res
.
data
.
data
.
accessToken
.
access_token
//'3a025eee-15ae-4805-9214-fe0599d47f17' //
getApp
().
globalData
.
token
=
res
.
data
.
data
.
accessToken
.
access_token
//'3a025eee-15ae-4805-9214-fe0599d47f17' //
// getApp().globalData.token = "157bad88-d68b-4d80-bec1-375f3756a398"
// getApp().globalData.token = "157bad88-d68b-4d80-bec1-375f3756a398"
// =======
// getApp().globalData.token = res.data.data.accessToken.access_token
// >>>>>>> a075e286c28564b6fc88185eaa17672b9d65efcb
getApp
().
globalData
.
name
=
res
.
data
.
data
.
oapiUser
.
name
getApp
().
globalData
.
name
=
res
.
data
.
data
.
oapiUser
.
name
getApp
().
globalData
.
userid
=
res
.
data
.
data
.
oapiUser
.
userid
getApp
().
globalData
.
userid
=
res
.
data
.
data
.
oapiUser
.
userid
getApp
().
globalData
.
avatar
=
res
.
data
.
data
.
oapiUser
.
avatar
getApp
().
globalData
.
avatar
=
res
.
data
.
data
.
oapiUser
.
avatar
...
...
pages/index/index.axml
View file @
bfefd08c
<view>
<scroll-view a:if="{{todayStr !== ''}}" scroll-y="{{true}}" upper-threshold="50" lower-threshold="50" onScrollToLower="lower" style="height: 100vh;" scroll-into-view="{{todayStr}}">
<block a:for="{{scheduleList}}">
<block a:for="{{scheduleList}}" a:for-item="scheduleYearList">
<block a:if="{{item.type == 'year'}}">
<block a:for="{{scheduleYearList}}">
<view class="month">
<block a:if="{{item.type == 'year'}}">
{{item.value}}年
<view class="month" onTap="changMd">
</view>
{{item.value}}年
</block>
<block a:elif="{{item.type == 'month'}}">
<view class="month">
{{item.value}}月
</view>
</block>
<block a:elif="{{item.type == 'week'}}">
<view class="week">
<view class="manyWeeks">
{{item.value}}
</view>
</view>
</view>
</block>
</block>
<block a:elif="{{item.type == 'month'}}">
<block a:elif="{{item.type == 'day'}}">
<view class="month">
<view class="date">
{{item.value}}月
<view class="dateTime">
</view>
<view>
</block>
{{item.value.week}}
<block a:elif="{{item.type == 'week'}}" >
<view class="week" id="{{item.dayStr}}">
<view class="manyWeeks">
{{item.value}}
</view>
</view>
<text>{{item.value.day}}</text>
</view>
</view>
<view class="dataSchedule">
</block>
<view a:for="{{item.value.value}}" a:for-item="item2" data-id="{{item2.id}}" class="overdue" onTap="nextDetail">
<block a:elif="{{item.type == 'day'}}">
<view class="dataScheduleName">
<view class="date">
{{item2.title}}
<view class="dateTime">
<view>
{{item.value.week}}
</view>
</view>
<view class="dataScheduleTime">
<text>{{item.value.day}}</text>
{{item2.startTime}} - {{item2.endTime}}
</view>
<view class="dataSchedule">
<view a:for="{{item.value.value}}" a:for-item="item2" data-id="{{item2.id}}" class="{{ item2.isBeOverdue ? 'overdue' : item2.confirmAttendance === 0 ? 'cancel' : '' }}" onTap="nextDetail">
<view class="dataScheduleName">
{{item2.title}}{{item2.num ? '' : `(第${item2.isFewDays}天,共${item2.duration}天)`}}
</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>
</view>
</view>
</view>
</
view
>
</
block
>
</block>
</block>
</block>
</block>
</view>
</
scroll-
view>
<view class="createSchedule " onTap="nextPage">
<view class="createSchedule " onTap="nextPage">
+
+
</view>
</view>
\ No newline at end of file
pages/index/index.js
View file @
bfefd08c
...
@@ -2,17 +2,20 @@ import { getHomeUserSchedule } from '../../api/request.js'
...
@@ -2,17 +2,20 @@ import { getHomeUserSchedule } from '../../api/request.js'
Page
({
Page
({
data
:
{
data
:
{
AllScheduleList
:
[],
AllScheduleList
:
[],
scheduleList
:
[]
scheduleList
:
[],
todayStr
:
''
,
thisYear
:
''
,
maxYear
:
''
,
minYear
:
''
},
},
onLoad
(
query
)
{
onLoad
(
query
)
{
// 页面加载
// 页面加载
dd
.
setNavigationBar
({
title
:
'首页'
})
},
},
onReady
()
{
onReady
()
{
let
data
=
{
},
onShow
()
{
// 页面显示
let
data
=
{
"startTime"
:
"2020-01-01 00:00:00"
,
"startTime"
:
"2020-01-01 00:00:00"
,
"endTime"
:
"2025-12-30 23:59:59"
"endTime"
:
"2025-12-30 23:59:59"
}
}
...
@@ -23,16 +26,23 @@ Page({
...
@@ -23,16 +26,23 @@ Page({
},
()
=>
{
},
()
=>
{
let
now
=
new
Date
()
let
now
=
new
Date
()
let
year
=
now
.
getFullYear
();
let
year
=
now
.
getFullYear
();
let
scheduleList
=
this
.
returnScheduleList
(
year
);
let
scheduleList
=
[];
for
(
let
i
=
0
;
i
<=
year
-
2019
;
i
++
)
{
console
.
log
(
2019
+
i
)
scheduleList
.
push
(
that
.
returnScheduleList
(
2019
+
i
))
}
const
today
=
new
Date
()
const
finalDate
=
new
Date
(
today
)
finalDate
.
setDate
(
today
.
getDate
()
-
today
.
getDay
())
that
.
setData
({
that
.
setData
({
scheduleList
:
scheduleList
scheduleList
:
scheduleList
,
todayStr
:
finalDate
.
toLocaleDateString
(),
thisYear
:
year
,
maxYear
:
year
})
})
})
})
})
})
},
},
onShow
()
{
// 页面显示
},
returnScheduleList
(
year
)
{
returnScheduleList
(
year
)
{
let
that
=
this
let
that
=
this
let
weekList
=
[
'周日'
,
'周一'
,
'周二'
,
'周三'
,
'周四'
,
'周五'
,
'周六'
]
let
weekList
=
[
'周日'
,
'周一'
,
'周二'
,
'周三'
,
'周四'
,
'周五'
,
'周六'
]
...
@@ -68,7 +78,7 @@ Page({
...
@@ -68,7 +78,7 @@ Page({
})
})
}
}
}
}
let
num
=
6
-
new
Date
(
year
,
0
,
36
6
).
getDate
()
let
num
=
6
-
new
Date
(
year
,
0
,
36
5
).
getDate
()
for
(
let
i
=
0
;
i
<=
num
;
i
++
)
{
for
(
let
i
=
0
;
i
<=
num
;
i
++
)
{
DateMap
.
set
(
`
${
new
Date
(
year
,
0
,
366
+
i
).
toLocaleDateString
()}
`
,
{
DateMap
.
set
(
`
${
new
Date
(
year
,
0
,
366
+
i
).
toLocaleDateString
()}
`
,
{
scheduleList
:
[]
scheduleList
:
[]
...
@@ -80,16 +90,27 @@ Page({
...
@@ -80,16 +90,27 @@ Page({
let
date2
=
this
.
data
.
AllScheduleList
[
y
].
endTime
.
slice
(
0
,
10
).
replace
(
/-/g
,
'/'
)
let
date2
=
this
.
data
.
AllScheduleList
[
y
].
endTime
.
slice
(
0
,
10
).
replace
(
/-/g
,
'/'
)
let
count
=
this
.
count
(
date1
,
date2
)
let
count
=
this
.
count
(
date1
,
date2
)
if
(
count
==
0
)
{
if
(
count
==
0
)
{
DateMap
.
get
(
`
${
new
Date
(
this
.
data
.
AllScheduleList
[
y
].
startTime
.
replace
(
/-/g
,
'/'
)).
toLocaleDateString
()}
`
).
scheduleList
.
push
(
this
.
data
.
AllScheduleList
[
y
])
DateMap
.
get
(
`
${
new
Date
(
this
.
data
.
AllScheduleList
[
y
].
startTime
.
replace
(
/-/g
,
'/'
)).
toLocaleDateString
()}
`
).
scheduleList
.
push
({
...
this
.
data
.
AllScheduleList
[
y
],
thisDayStartTime
:
this
.
data
.
AllScheduleList
[
y
].
startTime
.
slice
(
11
,
16
),
thisDayEndTime
:
this
.
data
.
AllScheduleList
[
y
].
endTime
.
slice
(
11
,
16
),
isBeOverdue
:
new
Date
().
getTime
()
>
new
Date
(
this
.
data
.
AllScheduleList
[
y
].
endTime
.
replace
(
/-/g
,
'/'
)).
getTime
()
?
true
:
false
})
}
else
{
}
else
{
for
(
let
j
=
0
;
j
<=
count
;
j
++
)
{
for
(
let
j
=
0
;
j
<=
count
;
j
++
)
{
let
time
=
new
Date
();
let
time
=
new
Date
(
date1
);
time
.
setDate
(
time
.
getDate
()
+
j
)
time
.
setDate
(
time
.
getDate
()
+
j
)
// let finalDate = day.setDate(day.getDate()+j)
if
(
DateMap
.
get
(
new
Date
(
time
.
getFullYear
(),
time
.
getMonth
(),
time
.
getDate
()).
toLocaleDateString
())){
DateMap
.
get
(
new
Date
(
time
.
getFullYear
(),
time
.
getMonth
()
+
1
,
time
.
getDate
()).
toLocaleDateString
()).
scheduleList
.
push
({
DateMap
.
get
(
new
Date
(
time
.
getFullYear
(),
time
.
getMonth
(),
time
.
getDate
()).
toLocaleDateString
()).
scheduleList
.
push
({
...
this
.
data
.
AllScheduleList
[
y
],
...
this
.
data
.
AllScheduleList
[
y
],
number
:
j
+
1
isfirstDayOrEndDay
:
j
===
0
?
'0'
:
j
===
count
?
'2'
:
'1'
,
// 0 第一天,1中间的天,2结束的天
})
thisDayStartTime
:
this
.
data
.
AllScheduleList
[
y
].
startTime
.
slice
(
11
,
16
),
thisDayEndTime
:
this
.
data
.
AllScheduleList
[
y
].
endTime
.
slice
(
11
,
16
),
isFewDays
:
j
+
1
,
duration
:
count
+
1
,
isBeOverdue
:
new
Date
().
getTime
()
>
new
Date
(
this
.
data
.
AllScheduleList
[
y
].
endTime
.
replace
(
/-/g
,
'/'
)).
getTime
()
?
true
:
false
})
}
}
}
}
}
}
}
...
@@ -100,9 +121,9 @@ Page({
...
@@ -100,9 +121,9 @@ Page({
type
:
'year'
,
type
:
'year'
,
value
:
year
value
:
year
})
})
console
.
log
(
DateMap
)
DateMap
.
forEach
(
function
(
value
,
key
,
map
)
{
DateMap
.
forEach
(
function
(
value
,
key
,
map
)
{
console
.
log
(
key
)
if
(
new
Date
(
key
).
getDay
()
===
0
&&
that
.
count
(
key
,
new
Date
(
year
,
0
,
isLeapYear
?
366
:
365
).
toLocaleDateString
())
>
7
)
{
if
(
new
Date
(
key
).
getDay
()
===
0
&&
that
.
count
(
new
Date
(
key
),
new
Date
(
year
,
0
,
isLeapYear
?
366
:
365
)
>=
7
))
{
listWeek
=
listWeek
+
1
listWeek
=
listWeek
+
1
if
(
new
Date
(
key
).
getMonth
()
!==
listMonth
)
{
if
(
new
Date
(
key
).
getMonth
()
!==
listMonth
)
{
listMonth
=
new
Date
(
key
).
getMonth
()
listMonth
=
new
Date
(
key
).
getMonth
()
...
@@ -119,6 +140,7 @@ Page({
...
@@ -119,6 +140,7 @@ Page({
DateList
.
push
({
DateList
.
push
({
type
:
'week'
,
type
:
'week'
,
value
:
`第
${
listWeek
}
周,
${
rangeMonth1
+
1
}
月
${
rangeDay1
}
日 -
${
rangeMonth2
==
rangeMonth1
?
''
:
rangeMonth2
+
1
+
'月'
}${
rangeDay2
}
日`
,
value
:
`第
${
listWeek
}
周,
${
rangeMonth1
+
1
}
月
${
rangeDay1
}
日 -
${
rangeMonth2
==
rangeMonth1
?
''
:
rangeMonth2
+
1
+
'月'
}${
rangeDay2
}
日`
,
dayStr
:
key
})
})
}
else
{
}
else
{
let
rangeYear1
=
new
Date
(
key
).
getFullYear
()
let
rangeYear1
=
new
Date
(
key
).
getFullYear
()
...
@@ -130,13 +152,21 @@ Page({
...
@@ -130,13 +152,21 @@ Page({
DateList
.
push
({
DateList
.
push
({
type
:
'week'
,
type
:
'week'
,
value
:
`第
${
listWeek
}
周,
${
rangeMonth1
+
1
}
月
${
rangeDay1
}
日 -
${
rangeMonth2
==
rangeMonth1
?
''
:
rangeMonth2
+
1
+
'月'
}${
rangeDay2
}
日`
,
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
))
{
}
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
listWeek
=
1
DateList
.
push
({
DateList
.
push
({
type
:
'week'
,
type
:
'week'
,
value
:
listWeek
value
:
`第
${
listWeek
}
周,
${
rangeMonth1
+
1
}
月
${
rangeDay1
}
日 -
${
rangeMonth2
==
rangeMonth1
?
''
:
rangeMonth2
+
1
+
'月'
}${
rangeDay2
}
日`
,
dayStr
:
key
})
})
}
}
if
(
value
.
scheduleList
.
length
!==
0
)
{
if
(
value
.
scheduleList
.
length
!==
0
)
{
...
@@ -188,6 +218,15 @@ Page({
...
@@ -188,6 +218,15 @@ Page({
nextDetail
(
e
)
{
nextDetail
(
e
)
{
let
id
=
e
.
target
.
dataset
.
id
let
id
=
e
.
target
.
dataset
.
id
dd
.
navigateTo
({
url
:
`./../scheduleDetail/scheduleDetail?id=
${
id
}
`
})
dd
.
navigateTo
({
url
:
`./../scheduleDetail/scheduleDetail?id=
${
id
}
`
})
},
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
})
}
}
});
});
pages/index/index.json
View file @
bfefd08c
{}
{
\ No newline at end of file
"defaultTitle"
:
"首页"
}
\ 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