Commit d4e6ea06 by xiexiaoqin

首页日程动画

parent 6d4b7eb6
...@@ -129,9 +129,9 @@ ...@@ -129,9 +129,9 @@
<view onTap="changeTabBar" data-tabbar='1' data-title='日程'> <view onTap="changeTabBar" data-tabbar='1' data-title='日程'>
<view class="tabBarView tabBarView2 {{$data.tabBarIndex === '1' ? 'ischooseTabBar' : ''}}"> <view class="tabBarView tabBarView2 {{$data.tabBarIndex === '1' ? 'ischooseTabBar' : ''}}">
<view class="iconfont iconicon_Calendarbox1"> <view class="iconfont iconicon_Calendarbox1">
<text a:if="{{offset == 'before'}}" class="iconfont iconicon_days iconicon_Packup"> <text a:if="{{offset == 'before'}}" class="iconfont iconicon_days iconicon_open">
</text> </text>
<text a:elif="{{offset == 'next'}}" class="iconfont iconicon_days iconicon_open"> <text a:elif="{{offset == 'next'}}" class="iconfont iconicon_days iconicon_Packup">
</text> </text>
<text a:else class="iconfont iconicon_days iconicon_days{{iconDay}}"> <text a:else class="iconfont iconicon_days iconicon_days{{iconDay}}">
</text> </text>
......
...@@ -49,6 +49,7 @@ create.Page({ ...@@ -49,6 +49,7 @@ create.Page({
blankDataLengthAfter: 0, blankDataLengthAfter: 0,
minYear: minYear, minYear: minYear,
maxYear: maxYear, maxYear: maxYear,
todayIndex: 0,
onShow() { onShow() {
//如果是重复会议重新算 //如果是重复会议重新算
if (this.$store.data.indexNeedUpdate) { if (this.$store.data.indexNeedUpdate) {
...@@ -226,6 +227,7 @@ create.Page({ ...@@ -226,6 +227,7 @@ create.Page({
for (let i = 0; i < scheduleList.length; i++) { for (let i = 0; i < scheduleList.length; i++) {
if (scheduleList[i].dateStr == toLocaleDateString(currentDate)) { if (scheduleList[i].dateStr == toLocaleDateString(currentDate)) {
const centerPage = Math.floor(i / this.pageSize); const centerPage = Math.floor(i / this.pageSize);
this.todayIndex = i;
// firstPage转为4的倍数,一次下拉加载40条 // firstPage转为4的倍数,一次下拉加载40条
const firstPage = centerPage - 2; const firstPage = centerPage - 2;
this.firstPage = firstPage % 4 == 0 ? firstPage : firstPage - firstPage % 4; this.firstPage = firstPage % 4 == 0 ? firstPage : firstPage - firstPage % 4;
...@@ -483,6 +485,7 @@ create.Page({ ...@@ -483,6 +485,7 @@ create.Page({
this.minYear--; this.minYear--;
const yearData = getBlankList(this.minYear); const yearData = getBlankList(this.minYear);
this.blankDataLength += yearData.length; this.blankDataLength += yearData.length;
this.todayIndex += yearData.length;
this.scheduleList.unshift(...yearData); this.scheduleList.unshift(...yearData);
this.totalPages = Math.ceil(this.scheduleList.length / this.pageSize); this.totalPages = Math.ceil(this.scheduleList.length / this.pageSize);
this.currentPage = Math.floor(yearData.length * 2 / this.pageSize); this.currentPage = Math.floor(yearData.length * 2 / this.pageSize);
...@@ -547,27 +550,47 @@ create.Page({ ...@@ -547,27 +550,47 @@ create.Page({
}) })
} }
if (this.timer) { // if (this.timer) {
clearTimeout(this.timer) // clearTimeout(this.timer)
} // }
this.timer = setTimeout(() => { // this.timer = setTimeout(() => {
this.setData({ // this.setData({
offset: 'stop' // offset: 'stop'
}) // })
}, 500) // }, 500)
//每次计算偏移值 //每次计算偏移值
const offset = this.getScrollOffset(e.detail.scrollTop); const offset = this.getScrollOffset(e.detail.scrollTop);
if (this.data.offset !== offset) { // if (this.data.offset !== offset) {
if (!this.resetToview) { // if (!this.resetToview) {
this.setData({ // this.setData({
offset // offset
}); // });
} // }
this.resetToview = false // this.resetToview = false
} // }
dd.createSelectorQuery().selectAll('.li').boundingClientRect().exec((rect) => { 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' })
}
}
if (offset == 'next') { if (offset == 'next') {
for (let i = this.data.currentDataIndex; i < rect[0].length; i++) { for (let i = this.data.currentDataIndex; i < rect[0].length; i++) {
if (rect[0][i].top > 0) { if (rect[0][i].top > 0) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment