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
34fc0056
Commit
34fc0056
authored
Apr 17, 2020
by
xiexiaoqin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 修改日程日历的上下箭头表现
parent
166ed587
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
90 deletions
+52
-90
scheduleList.js
pages/scheduleList/scheduleList.js
+52
-90
No files found.
pages/scheduleList/scheduleList.js
View file @
34fc0056
...
...
@@ -63,10 +63,14 @@ create.Page({
if
(
this
.
$store
.
data
.
indexNeedUpdate
)
{
DateMap
=
getDateMap
(
this
.
minYear
,
this
.
maxYear
);
this
.
onLoad
();
this
.
$store
.
data
.
indexNeedUpdate
=
false
;
this
.
update
();
}
//单次会议往DateMap中添加
if
(
this
.
$store
.
data
.
onceMeetingContent
)
{
this
.
getScheduleList
(
this
.
$store
.
data
.
onceMeetingContent
,
"once"
);
this
.
$store
.
data
.
onceMeetingContent
=
null
;
this
.
update
();
}
},
onLoad
()
{
...
...
@@ -241,6 +245,9 @@ create.Page({
if
(
scheduleList
[
i
].
dateStr
==
toLocaleDateString
(
currentDate
))
{
const
centerPage
=
Math
.
floor
(
i
/
this
.
pageSize
);
this
.
todayIndex
=
i
;
this
.
setData
({
currentDataIndex
:
i
})
// firstPage转为4的倍数,一次下拉加载40条
const
firstPage
=
centerPage
-
2
;
this
.
firstPage
=
...
...
@@ -553,45 +560,7 @@ create.Page({
);
}
},
//计算高度
caculateHeight
(
scrollTop
)
{
let
height
=
0
;
let
i
=
0
;
while
(
height
<=
scrollTop
)
{
if
(
this
.
data
.
scheduleList
[
i
].
type
.
indexOf
(
"day"
)
!==
"-1"
)
{
height
+=
this
.
dateHeight
;
}
else
{
height
+=
this
.
otherHeight
;
}
i
++
;
}
return
i
;
},
scroll
(
e
)
{
//计算有偏差
// const index = this.caculateHeight(e.detail.scrollTop);
// console.log(index)
// if (this.data.scheduleList[index].dateStr.split('/')[1] !== this.data.currentData.split('/')[1]) {
// console.log('setDate: ' + this.data.scheduleList[index].dateStr)
// this.setData({
// currentData: this.data.scheduleList[index].dateStr
// })
// }
//循环次数过多
// dd.createSelectorQuery().selectAll('.li').boundingClientRect().exec((rect) => {
// for (let i = rect[0].length; i > 0; i--) {
// if (rect[0][i] && rect[0][i].top < 50) {
// if (this.data.scheduleList[i].dateStr.split('/')[1] !== this.data.currentData.split('/')[1]) {
// this.setData({
// currentData: this.data.scheduleList[i].dateStr,
// })
// }
// break;
// }
// }
// })
// 一次性惯性拉到顶速度跟不上,重置
if
(
e
.
detail
.
scrollTop
==
0
)
{
this
.
setData
({
...
...
@@ -599,48 +568,11 @@ create.Page({
currentDataIndex
:
0
});
}
// if (this.timer) {
// clearTimeout(this.timer)
// }
// this.timer = setTimeout(() => {
// this.setData({
// offset: 'stop'
// })
// }, 500)
//每次计算偏移值
const
offset
=
this
.
getScrollOffset
(
e
.
detail
.
scrollTop
);
// if (this.data.offset !== offset) {
// if (!this.resetToview) {
// this.setData({
// offset
// });
// }
// this.resetToview = false
// }
dd
.
createSelectorQuery
().
selectAll
(
'.li'
).
boundingClientRect
().
exec
((
rect
)
=>
{
if
(
rect
[
0
][
this
.
todayIndex
])
{
if
(
rect
[
0
][
this
.
todayIndex
].
top
<
50
&&
rect
[
0
][
this
.
todayIndex
].
top
>
20
)
{
if
(
this
.
data
.
offset
!==
'stop'
)
{
this
.
setData
({
offset
:
'stop'
})
}
}
else
if
(
rect
[
0
][
this
.
todayIndex
].
top
<
50
)
{
if
(
this
.
data
.
offset
!==
'next'
)
{
this
.
setData
({
offset
:
'next'
})
}
}
else
if
(
rect
[
0
][
this
.
todayIndex
].
top
>
20
)
{
if
(
this
.
data
.
offset
!==
'before'
)
{
this
.
setData
({
offset
:
'before'
})
}
}
}
else
{
if
(
this
.
data
.
offset
!==
'before'
)
{
this
.
setData
({
offset
:
'before'
})
}
}
//日程的上下箭头
this
.
setScrollOffset
(
rect
);
if
(
offset
==
'next'
)
{
for
(
let
i
=
this
.
data
.
currentDataIndex
;
i
<
rect
[
0
].
length
;
i
++
)
{
if
(
rect
[
0
][
i
].
top
>
0
)
{
...
...
@@ -650,19 +582,14 @@ create.Page({
currentDataIndex
:
i
})
}
break
;
}
}
}
else
if
(
offset
==
"before"
)
{
let
i
=
Math
.
min
(
this
.
data
.
currentDataIndex
,
this
.
data
.
scheduleList
.
length
-
1
);
let
i
=
Math
.
min
(
this
.
data
.
currentDataIndex
,
this
.
data
.
scheduleList
.
length
-
1
);
for
(;
i
>
0
;
i
--
)
{
if
(
rect
[
0
][
i
].
top
<
50
)
{
if
(
this
.
data
.
scheduleList
[
i
].
dateStr
.
split
(
"/"
)[
1
]
!==
this
.
data
.
currentData
.
split
(
"/"
)[
1
]
)
{
if
(
this
.
data
.
scheduleList
[
i
].
dateStr
.
split
(
"/"
)[
1
]
!==
this
.
data
.
currentData
.
split
(
"/"
)[
1
])
{
this
.
setData
({
currentData
:
this
.
data
.
scheduleList
[
i
].
dateStr
,
currentDataIndex
:
i
...
...
@@ -687,6 +614,28 @@ create.Page({
this
.
scrollTop
=
scrollTop
;
return
offset
;
},
setScrollOffset
(
rect
)
{
if
(
rect
[
0
][
this
.
todayIndex
])
{
if
(
rect
[
0
][
this
.
todayIndex
].
top
<=
50
&&
rect
[
0
][
this
.
todayIndex
].
top
>=
20
)
{
if
(
this
.
data
.
offset
!==
'stop'
)
{
this
.
setData
({
offset
:
'stop'
})
}
}
else
if
(
rect
[
0
][
this
.
todayIndex
].
top
<
50
)
{
if
(
this
.
data
.
offset
!==
'next'
)
{
this
.
setData
({
offset
:
'next'
})
}
}
else
if
(
rect
[
0
][
this
.
todayIndex
].
top
>
20
)
{
if
(
this
.
data
.
offset
!==
'before'
)
{
this
.
setData
({
offset
:
'before'
})
}
}
}
else
{
if
(
this
.
data
.
offset
!==
'before'
)
{
this
.
setData
({
offset
:
'before'
})
}
}
},
closePop
()
{
this
.
setData
({
show
:
false
...
...
@@ -733,7 +682,6 @@ create.Page({
});
}
}
//需要先清空todayStr再设置才有效
this
.
setData
(
{
...
...
@@ -756,13 +704,27 @@ create.Page({
dd
.
setNavigationBar
({
title
:
title
});
if
(
tabbar
==
"1"
&&
lastTimeTabBarIndex
==
tabbar
)
{
this
.
backToToday
();
}
if
(
this
.
isFirstLoad
)
{
this
.
backToToday
(
"first"
);
this
.
isFirstLoad
=
false
;
this
.
resetToview
=
true
;
}
if
(
lastTimeTabBarIndex
==
tabbar
)
{
if
(
tabbar
==
"1"
)
{
this
.
backToToday
();
}
}
else
{
//切换到动态页面时,日程重置成当前日期
if
(
tabbar
==
"0"
)
{
this
.
lastOffset
=
this
.
data
.
offset
;
this
.
setData
({
offset
:
'stop'
})
}
else
if
(
!
this
.
isFirstLoad
)
{
this
.
setData
({
offset
:
this
.
lastOffset
})
}
}
},
...
...
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