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
a075e286
Commit
a075e286
authored
5 years ago
by
liang ce
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
首页修改
parent
da36a40a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
105 additions
and
59 deletions
+105
-59
http.js
api/http.js
+1
-2
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 @
a075e286
...
...
@@ -24,8 +24,7 @@ export default function http (data) {
}
else
{
return
new
Promise
((
resolve
,
rejects
)
=>
{
login
().
then
(
res
=>
{
// 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
=
res
.
data
.
data
.
accessToken
.
access_token
getApp
().
globalData
.
name
=
res
.
data
.
data
.
oapiUser
.
name
getApp
().
globalData
.
userid
=
res
.
data
.
data
.
oapiUser
.
userid
getApp
().
globalData
.
avatar
=
res
.
data
.
data
.
oapiUser
.
avatar
...
...
This diff is collapsed.
Click to expand it.
pages/index/index.axml
View file @
a075e286
<view>
<block a:for="{{scheduleList}}">
<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">
<view class="manyWeeks">
{{item.value}}
<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}}" a:for-item="scheduleYearList">
<block a:for="{{scheduleYearList}}">
<block a:if="{{item.type == 'year'}}">
<view class="month" onTap="changMd">
{{item.value}}年
</view>
</view>
</block>
<block a:elif="{{item.type == 'day'}}">
<view class="date">
<view class="dateTime">
<view>
{{item.value.week}}
</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>
<text>{{item.value.day}}</text>
</view>
<view class="dataSchedule">
<view a:for="{{item.value.value}}" a:for-item="item2" data-id="{{item2.id}}" class="overdue" onTap="nextDetail">
<view class="dataScheduleName">
{{item2.title}}
</block>
<block a:elif="{{item.type == 'day'}}">
<view class="date">
<view class="dateTime">
<view>
{{item.value.week}}
</view>
<view class="dataScheduleTime">
{{item2.startTime}} - {{item2.endTime}}
<text>{{item.value.day}}</text>
</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
>
</
block
>
</block>
</block>
</view>
</
scroll-
view>
<view class="createSchedule " onTap="nextPage">
+
</view>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
pages/index/index.js
View file @
a075e286
...
...
@@ -2,17 +2,20 @@ import { getHomeUserSchedule } from '../../api/request.js'
Page
({
data
:
{
AllScheduleList
:
[],
scheduleList
:
[]
scheduleList
:
[],
todayStr
:
''
,
thisYear
:
''
,
maxYear
:
''
,
minYear
:
''
},
onLoad
(
query
)
{
// 页面加载
dd
.
setNavigationBar
({
title
:
'首页'
})
},
onReady
()
{
let
data
=
{
},
onShow
()
{
// 页面显示
let
data
=
{
"startTime"
:
"2020-01-01 00:00:00"
,
"endTime"
:
"2025-12-30 23:59:59"
}
...
...
@@ -23,16 +26,23 @@ Page({
},
()
=>
{
let
now
=
new
Date
()
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
({
scheduleList
:
scheduleList
scheduleList
:
scheduleList
,
todayStr
:
finalDate
.
toLocaleDateString
(),
thisYear
:
year
,
maxYear
:
year
})
})
})
},
onShow
()
{
// 页面显示
},
returnScheduleList
(
year
)
{
let
that
=
this
let
weekList
=
[
'周日'
,
'周一'
,
'周二'
,
'周三'
,
'周四'
,
'周五'
,
'周六'
]
...
...
@@ -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
++
)
{
DateMap
.
set
(
`
${
new
Date
(
year
,
0
,
366
+
i
).
toLocaleDateString
()}
`
,
{
scheduleList
:
[]
...
...
@@ -80,16 +90,27 @@ Page({
let
date2
=
this
.
data
.
AllScheduleList
[
y
].
endTime
.
slice
(
0
,
10
).
replace
(
/-/g
,
'/'
)
let
count
=
this
.
count
(
date1
,
date2
)
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
{
for
(
let
j
=
0
;
j
<=
count
;
j
++
)
{
let
time
=
new
Date
();
let
time
=
new
Date
(
date1
);
time
.
setDate
(
time
.
getDate
()
+
j
)
// let finalDate = day.setDate(day.getDate()+j)
DateMap
.
get
(
new
Date
(
time
.
getFullYear
(),
time
.
getMonth
()
+
1
,
time
.
getDate
()).
toLocaleDateString
()).
scheduleList
.
push
({
...
this
.
data
.
AllScheduleList
[
y
],
number
:
j
+
1
})
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
({
...
this
.
data
.
AllScheduleList
[
y
],
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({
type
:
'year'
,
value
:
year
})
console
.
log
(
DateMap
)
DateMap
.
forEach
(
function
(
value
,
key
,
map
)
{
console
.
log
(
key
)
if
(
new
Date
(
key
).
getDay
()
===
0
&&
that
.
count
(
new
Date
(
key
),
new
Date
(
year
,
0
,
isLeapYear
?
366
:
365
)
>=
7
))
{
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
()
...
...
@@ -119,6 +140,7 @@ Page({
DateList
.
push
({
type
:
'week'
,
value
:
`第
${
listWeek
}
周,
${
rangeMonth1
+
1
}
月
${
rangeDay1
}
日 -
${
rangeMonth2
==
rangeMonth1
?
''
:
rangeMonth2
+
1
+
'月'
}${
rangeDay2
}
日`
,
dayStr
:
key
})
}
else
{
let
rangeYear1
=
new
Date
(
key
).
getFullYear
()
...
...
@@ -130,13 +152,21 @@ Page({
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
value
:
`第
${
listWeek
}
周,
${
rangeMonth1
+
1
}
月
${
rangeDay1
}
日 -
${
rangeMonth2
==
rangeMonth1
?
''
:
rangeMonth2
+
1
+
'月'
}${
rangeDay2
}
日`
,
dayStr
:
key
})
}
if
(
value
.
scheduleList
.
length
!==
0
)
{
...
...
@@ -188,6 +218,15 @@ Page({
nextDetail
(
e
)
{
let
id
=
e
.
target
.
dataset
.
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
})
}
});
This diff is collapsed.
Click to expand it.
pages/index/index.json
View file @
a075e286
{}
\ No newline at end of file
{
"defaultTitle"
:
"首页"
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
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