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
5c242a50
Commit
5c242a50
authored
Apr 16, 2020
by
xiexiaoqin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复和优化首页点击回到今天,增加上拉加载条数至40
parent
53ee4609
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
21 deletions
+46
-21
scheduleList.acss
pages/scheduleList/scheduleList.acss
+1
-1
scheduleList.js
pages/scheduleList/scheduleList.js
+45
-20
No files found.
pages/scheduleList/scheduleList.acss
View file @
5c242a50
...
...
@@ -126,7 +126,7 @@
padding: 0 32rpx;
display: flex;
justify-content: space-between;
box-shadow: 0
1rpx 10rpx 2
rpx rgba(0, 0, 0, 0.04);
box-shadow: 0
2rpx 10rpx 3
rpx rgba(0, 0, 0, 0.04);
z-index: 9;
position: relative;
}
...
...
pages/scheduleList/scheduleList.js
View file @
5c242a50
...
...
@@ -13,8 +13,8 @@ import {
getCreateShowTime
}
from
"../../utils/utils"
;
const
currentDate
=
new
Date
();
le
t
minYear
=
2020
;
le
t
maxYear
=
currentDate
.
getFullYear
()
+
1
;
cons
t
minYear
=
2020
;
cons
t
maxYear
=
currentDate
.
getFullYear
()
+
1
;
let
DateMap
=
getDateMap
(
minYear
,
maxYear
);
const
weekList
=
[
"周日"
,
"周一"
,
"周二"
,
"周三"
,
"周四"
,
"周五"
,
"周六"
];
import
create
from
"dd-store"
;
...
...
@@ -45,10 +45,14 @@ create.Page({
scheduleList
:
[],
timer
:
null
,
isFirstLoad
:
true
,
blankDataLength
:
0
,
blankDataLengthAfter
:
0
,
minYear
:
minYear
,
maxYear
:
maxYear
,
onShow
()
{
//如果是重复会议重新算
if
(
this
.
$store
.
data
.
indexNeedUpdate
)
{
DateMap
=
getDateMap
(
minYear
,
maxYear
);
DateMap
=
getDateMap
(
this
.
minYear
,
this
.
maxYear
);
this
.
onLoad
();
}
//单次会议往DateMap中添加
...
...
@@ -221,8 +225,11 @@ create.Page({
this
.
totalPages
=
Math
.
ceil
(
scheduleList
.
length
/
this
.
pageSize
);
for
(
let
i
=
0
;
i
<
scheduleList
.
length
;
i
++
)
{
if
(
scheduleList
[
i
].
dateStr
==
toLocaleDateString
(
currentDate
))
{
this
.
firstPage
=
Math
.
floor
(
i
/
this
.
pageSize
)
-
2
;
this
.
currentPage
=
Math
.
floor
(
i
/
this
.
pageSize
)
+
2
;
const
centerPage
=
Math
.
floor
(
i
/
this
.
pageSize
);
// firstPage转为4的倍数,一次下拉加载40条
const
firstPage
=
centerPage
-
2
;
this
.
firstPage
=
firstPage
%
4
==
0
?
firstPage
:
firstPage
-
firstPage
%
4
;
this
.
currentPage
=
centerPage
+
2
;
break
}
}
...
...
@@ -233,12 +240,6 @@ create.Page({
endTime
:
"2025-12-30 23:59:59"
}).
then
(
res
=>
{
this
.
getScheduleList
(
res
.
data
.
data
);
// this.getPagination(this.scheduleList);
// 第一次加载
// this.setData({
// scheduleList: this.scheduleList.slice(this.firstPage * this.pageSize, this.currentPage * this.pageSize),
// loading: false
// });
});
},
//生成DateMap值
...
...
@@ -445,8 +446,10 @@ create.Page({
});
}
else
{
//超出加载一年的数据
maxYear
++
;
this
.
scheduleList
.
push
(...
getBlankList
(
maxYear
));
this
.
maxYear
++
;
const
yearData
=
getBlankList
(
this
.
maxYear
);
this
.
blankDataLengthAfter
+=
yearData
.
length
;
this
.
scheduleList
.
push
(...
yearData
);
this
.
setData
({
scheduleList
:
this
.
scheduleList
.
slice
(
this
.
firstPage
*
this
.
pageSize
)
})
...
...
@@ -465,20 +468,21 @@ create.Page({
}
// const todayStr = this.data.scheduleList[0].dateStr;
if
(
this
.
firstPage
>
0
)
{
this
.
firstPage
--
;
this
.
currentPage
--
;
this
.
firstPage
-=
4
;
this
.
currentPage
-=
4
;
this
.
setData
({
todayStr
:
''
,
scheduleList
:
this
.
scheduleList
.
slice
(
this
.
firstPage
*
this
.
pageSize
,
this
.
currentPage
*
this
.
pageSize
)
},
()
=>
{
this
.
setData
({
todayStr
:
this
.
data
.
scheduleList
[
this
.
pageSize
-
1
].
dateStr
todayStr
:
this
.
data
.
scheduleList
[
this
.
pageSize
*
4
-
1
].
dateStr
});
dd
.
stopPullDownRefresh
();
});
}
else
{
minYear
--
;
const
yearData
=
getBlankList
(
minYear
);
this
.
minYear
--
;
const
yearData
=
getBlankList
(
this
.
minYear
);
this
.
blankDataLength
+=
yearData
.
length
;
this
.
scheduleList
.
unshift
(...
yearData
);
this
.
totalPages
=
Math
.
ceil
(
this
.
scheduleList
.
length
/
this
.
pageSize
);
this
.
currentPage
=
Math
.
floor
(
yearData
.
length
*
2
/
this
.
pageSize
);
...
...
@@ -627,7 +631,28 @@ create.Page({
)}
`
});
},
1000
),
backToToday
()
{
backToToday
(
type
)
{
if
(
!
type
)
{
//如果当前的日期还没加载出来点击无效,下拉积累数据过长可以去掉
const
isFindArr
=
this
.
data
.
scheduleList
.
filter
(
it
=>
it
.
dateStr
==
toLocaleDateString
(
currentDate
));
if
(
isFindArr
.
length
==
0
||
this
.
data
.
scheduleList
.
length
>
100
)
{
//去掉头部空数据
if
(
this
.
minYear
<
minYear
)
{
this
.
scheduleList
.
splice
(
0
,
this
.
blankDataLength
);
this
.
minYear
=
minYear
;
}
//去掉尾部数据
if
(
this
.
maxYear
>
maxYear
)
{
this
.
scheduleList
.
splice
(
-
this
.
blankDataLengthAfter
);
this
.
maxYear
=
maxYear
;
}
this
.
getPagination
(
this
.
scheduleList
);
this
.
setData
({
scheduleList
:
this
.
scheduleList
.
slice
(
this
.
firstPage
*
this
.
pageSize
,
this
.
currentPage
*
this
.
pageSize
)
});
}
}
//需要先清空todayStr再设置才有效
this
.
setData
(
{
...
...
@@ -654,7 +679,7 @@ create.Page({
this
.
backToToday
();
}
if
(
this
.
isFirstLoad
)
{
this
.
backToToday
();
this
.
backToToday
(
'first'
);
this
.
isFirstLoad
=
false
;
this
.
resetToview
=
true
;
}
...
...
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