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
6c3cc310
Commit
6c3cc310
authored
Apr 15, 2020
by
xiexiaoqin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 日程算法bug修复 页面优化
parent
d7d0558a
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
91 additions
and
125 deletions
+91
-125
taskList.acss
components/taskList/taskList.acss
+1
-1
createMeeting.js
pages/createMeeting/createMeeting.js
+1
-0
meetingDetail.js
pages/meetingDetail/meetingDetail.js
+1
-0
scheduleList.acss
pages/scheduleList/scheduleList.acss
+9
-70
scheduleList.axml
pages/scheduleList/scheduleList.axml
+7
-3
scheduleList.js
pages/scheduleList/scheduleList.js
+72
-51
No files found.
components/taskList/taskList.acss
View file @
6c3cc310
...
...
@@ -11,7 +11,7 @@
.task-list>.task-box {
background: rgba(255, 255, 255, 1);
border-radius: 8rpx;
box-shadow: 0 0 8rpx 0rpx rgba(0, 0, 0, 0.
14
);
box-shadow: 0 0 8rpx 0rpx rgba(0, 0, 0, 0.
08
);
padding: 0 16rpx;
height: 80rpx;
color: rgba(27, 38, 61, 1);
...
...
pages/createMeeting/createMeeting.js
View file @
6c3cc310
...
...
@@ -106,6 +106,7 @@ create.Page({
},
// 初始化
reset
()
{
this
.
$store
.
data
.
indexNeedUpdate
=
false
;
this
.
$store
.
data
.
roomId
=
''
this
.
$store
.
data
.
participatorList
=
[]
this
.
$store
.
data
.
participatorUserId
=
[]
...
...
pages/meetingDetail/meetingDetail.js
View file @
6c3cc310
...
...
@@ -328,6 +328,7 @@ create.Page({
},
// 初始化
reset
()
{
this
.
$store
.
data
.
indexNeedUpdate
=
false
;
this
.
$store
.
data
.
roomId
=
''
this
.
$store
.
data
.
participatorList
=
[]
this
.
$store
.
data
.
originUsers
=
[]
...
...
pages/scheduleList/scheduleList.acss
View file @
6c3cc310
...
...
@@ -59,59 +59,6 @@
line-height: 24rpx;
}
.fileIcon {
width: 64rpx;
height: 64rpx;
margin-right: 12rpx;
line-height: 64rpx;
}
.fileMsg {
flex: 1;
}
.fileName {
font-size: 28rpx;
color: #191F25;
letter-spacing: 0;
line-height: 32rpx;
margin-bottom: 8rpx;
}
.fileSize {
opacity: 0.56;
font-size: 24rpx;
color: #191F25;
letter-spacing: 0;
line-height: 24rpx;
}
.task {
border: 1px solid #F5F6F7;
box-shadow: 0 0 8rpx 0 rgba(0, 0, 0, 0.04);
border-radius: 8rpx;
padding: 0 16rpx;
display: flex;
align-items: center;
justify-content: space-between;
width: 100%;
height: 76rpx;
}
.taskName text {
font-size: 28rpx;
color: #1B263D;
line-height: 28rpx;
flex: 1;
}
.userLogo {
border-radius: 50%;
width: 48rpx;
height: 48rpx;
background: red;
}
.placedTop {
width: 84rpx;
height: 84rpx;
...
...
@@ -172,9 +119,6 @@
}
.scheduleHeader {
/* position: fixed;
top: 0;
left: 0; */
width: 100%;
height: 88rpx;
background: #FFFFFF;
...
...
@@ -182,12 +126,16 @@
padding: 0 32rpx;
display: flex;
justify-content: space-between;
box-shadow: 0 1rpx
8rpx 0
rgba(0, 0, 0, 0.04);
box-shadow: 0 1rpx
10rpx 2rpx
rgba(0, 0, 0, 0.04);
z-index: 9;
position: relative;
}
.scheduleHeader view:nth-of-type(1) {
flex: 1;
color: rgba(10, 10, 10, 1);
font-size: 40rpx;
font-weight: bold;
}
.scheduleHeader view:nth-of-type(2) {
...
...
@@ -195,16 +143,6 @@
height: 40rpx;
}
.sidebar {
position: fixed;
left: -750rpx;
top: 0;
width: 750rpx;
height: 100%;
/* background: rgba(0, 0, 0, 0.19); */
z-index: 99;
}
.headerIcon {
position: relative;
}
...
...
@@ -224,6 +162,7 @@
font-size: 44rpx;
color: rgba(27, 38, 61, 0.4);
}
.year, .month, .week, .date {
height: 96rpx;
font-size: 48rpx;
...
...
@@ -444,9 +383,9 @@
.iconicon_days {
position: absolute;
left:
5
rpx;
top:
8
rpx;
font-size:
30
rpx;
left:
7
rpx;
top:
10
rpx;
font-size:
27
rpx;
}
.tabBarView .iconicon_days {
...
...
pages/scheduleList/scheduleList.axml
View file @
6c3cc310
...
...
@@ -3,7 +3,7 @@
<import src="../../template/affairBlank/index.axml"/>
<view class="{{isStopBodyScroll ? 'scroll-lock' : ''}}" onTap="closeSwipe" onTouchStart="closeSwipe" onTouchMove="closeSwipe" onTouchEnd="closeSwipe">
<block a:if="{{!listLoading}}">
<scroll-view a:if="{{dynamicList.length > 0}}" scroll-y="{{true}}" lower-threshold="{{
6
00}}" class="dynamicBox" onScrollToLower="onScrollToLower">
<scroll-view a:if="{{dynamicList.length > 0}}" scroll-y="{{true}}" lower-threshold="{{
4
00}}" class="dynamicBox" onScrollToLower="onScrollToLower">
<view class="dynamicList">
<swipe onSetBodyDisableScroll="setBodyDisableScroll" rightWidth="{{ 78 }}" leftWidth="{{ 0 }}" a:for="{{dynamicList}}" class="dynamicContent" key="{{item.scheduleId}}">
<view class="dynamicDetails">
...
...
@@ -53,7 +53,7 @@
</view>
</view>
</view>
<scroll-view class="indexScrollView" scroll-y="{{true}}" onScroll="scroll" lower-threshold="
400
" onScrollToLower="lower" scroll-into-view="{{todayStr}}">
<scroll-view class="indexScrollView" scroll-y="{{true}}" onScroll="scroll" lower-threshold="
{{400}}
" onScrollToLower="lower" scroll-into-view="{{todayStr}}">
<block a:for="{{scheduleList}}" key="{{item.dateStr}}">
<!-- 年 -->
<block a:if="{{item.type == 'year'}}">
...
...
@@ -129,7 +129,11 @@
<view onTap="changeTabBar" data-tabbar='1' data-title='日程'>
<view class="tabBarView tabBarView2 {{$data.tabBarIndex === '1' ? 'ischooseTabBar' : ''}}">
<view class="iconfont iconicon_Calendarbox1">
<text class="iconfont iconicon_days iconicon_days{{iconDay}}">
<text a:if="{{offset == 'before'}}" class="iconfont iconicon_days iconicon_Packup">
</text>
<text a:elif="{{offset == 'next'}}" class="iconfont iconicon_days iconicon_open">
</text>
<text a:else class="iconfont iconicon_days iconicon_days{{iconDay}}">
</text>
</view>
<view>日程</view>
...
...
pages/scheduleList/scheduleList.js
View file @
6c3cc310
...
...
@@ -18,6 +18,7 @@ let maxYear = currentDate.getFullYear() + 1;
let
DateMap
=
getDateMap
(
minYear
,
maxYear
);
const
weekList
=
[
"周日"
,
"周一"
,
"周二"
,
"周三"
,
"周四"
,
"周五"
,
"周六"
];
import
create
from
"dd-store"
;
create
.
Page
({
data
:
{
$data
:
null
,
...
...
@@ -26,6 +27,7 @@ create.Page({
todayStr
:
toLocaleDateString
(
currentDate
),
currentData
:
toLocaleDateString
(
currentDate
),
currentDataIndex
:
0
,
offset
:
'stop'
,
show
:
false
,
loading
:
true
,
traceTime
:
'1970-03-01 00:00:00'
,
...
...
@@ -41,6 +43,8 @@ create.Page({
currentPage
:
1
,
firstPage
:
1
,
scheduleList
:
[],
timer
:
null
,
isFirstLoad
:
true
,
onShow
()
{
if
(
this
.
$store
.
data
.
indexNeedUpdate
)
{
//优化:如果是重复会议重新算,单次会议往DateMap中添加
...
...
@@ -213,8 +217,8 @@ 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
);
this
.
currentPage
=
this
.
firstPage
+
2
;
this
.
firstPage
=
Math
.
floor
(
i
/
this
.
pageSize
)
-
2
;
this
.
currentPage
=
Math
.
floor
(
i
/
this
.
pageSize
)
+
2
;
break
}
}
...
...
@@ -278,11 +282,21 @@ create.Page({
// 根据接口返回数据生成填充DateMap
setDateMapByResponse
(
response
)
{
if
(
response
)
{
const
repeatIdList
=
[];
//重复会议的ID
// 处理单次会议 scheduleList
const
scheduleListWithTemplateId
=
[];
response
.
scheduleList
.
forEach
(
item
=>
{
// 有scheduleTemplateId则是虚拟会议转成实体会议,需要替换rrule生成的模板会议
if
(
item
.
scheduleTemplateId
)
{
scheduleListWithTemplateId
.
push
(
item
);
}
else
{
this
.
setDateMapValue
(
new
Date
(
item
.
startTime
.
replace
(
/-/g
,
'/'
)),
new
Date
(
item
.
endTime
.
replace
(
/-/g
,
'/'
)),
item
);
}
});
// 处理重复会议 templateList
console
.
log
(
'deal templateList'
)
response
.
templateList
.
forEach
(
item
=>
{
repeatIdList
.
push
(
item
.
id
)
//日程会议
const
itemScheduleList
=
scheduleListWithTemplateId
.
filter
(
it
=>
it
.
scheduleTemplateId
==
item
.
id
);
// 生成rrules规则
const
initialTimeList
=
item
.
initialTime
.
split
(
'-'
);
const
startTimeList
=
item
.
startTime
.
split
(
":"
);
...
...
@@ -290,6 +304,19 @@ create.Page({
const
rule
=
RRule
.
fromString
(
`
${
item
.
recurrenceModel
.
recurrenceRule
}
;DTSTART=
${
DTSTART
}
`
);
const
setDateMapValueAll
=
(
startTime
,
endTime
,
item
)
=>
{
//如果有日程会议则用日程会议替换
let
replaceItem
=
[];
if
(
itemScheduleList
.
length
>
0
)
{
replaceItem
=
itemScheduleList
.
filter
(
it
=>
it
.
planDate
==
getFormatDate
(
startTime
,
"yyyyMMdd"
,
"-"
))
}
if
(
replaceItem
.
length
>
0
)
{
this
.
setDateMapValue
(
new
Date
(
replaceItem
[
0
].
startTime
.
replace
(
/-/g
,
'/'
)),
new
Date
(
replaceItem
[
0
].
endTime
.
replace
(
/-/g
,
'/'
)),
replaceItem
[
0
]);
}
else
{
this
.
setDateMapValue
(
startTime
,
endTime
,
item
,
'repeat'
);
}
}
// 需要剔除某一天
if
(
item
.
excludePlanDates
)
{
const
excludeData
=
getExcludeDate
(
item
.
excludePlanDates
.
split
(
","
));
...
...
@@ -299,10 +326,10 @@ create.Page({
// 生成结束时间
const
endTime
=
new
Date
(
startTime
);
endTime
.
setMinutes
(
endTime
.
getMinutes
()
+
item
.
recurrenceModel
.
duration
);
// 剔除规则
// 剔除规则
: 时间小于futureTime 时间不在单个排除日期里面
if
(
startTime
.
getTime
()
<
excludeData
.
minFutureTime
&&
excludeData
.
excludeDateList
.
indexOf
(
getFormatDate
(
startTime
,
"yyyyMMdd"
,
"-"
))
===
-
1
)
{
this
.
setDateMapValue
(
startTime
,
endTime
,
item
,
'repeat'
);
!
excludeData
.
excludeDateList
.
includes
(
getFormatDate
(
startTime
,
"yyyyMMdd"
,
"-"
))
)
{
setDateMapValueAll
(
startTime
,
endTime
,
item
);
}
});
}
...
...
@@ -314,29 +341,12 @@ create.Page({
// 生成结束时间
const
endTime
=
new
Date
(
startTime
);
endTime
.
setMinutes
(
endTime
.
getMinutes
()
+
item
.
recurrenceModel
.
duration
);
this
.
setDateMapValue
(
startTime
,
endTime
,
item
,
'repeat'
);
setDateMapValueAll
(
startTime
,
endTime
,
item
);
});
}
});
console
.
log
(
'deal scheduleList'
)
// 处理单次会议 scheduleList
response
.
scheduleList
.
forEach
(
item
=>
{
// if (!item.scheduleTemplateId) {
// this.setDateMapValue(new Date(item.startTime.replace(/-/g, '/')), new Date(item.endTime.replace(/-/g, '/')), item);
// }
// 有scheduleTemplateId则是虚拟会议转成实体会议,需要替换rrule生成的模板会议
if
(
repeatIdList
.
includes
(
item
.
scheduleTemplateId
))
{
const
list
=
DateMap
.
get
(
toLocaleDateString
(
new
Date
(
item
.
planDate
.
replace
(
/-/g
,
'/'
))))
||
[];
list
.
forEach
((
o
,
index
)
=>
{
if
(
o
.
scheduleTemplateId
==
item
.
scheduleTemplateId
)
{
list
.
splice
(
index
,
1
);
}
});
}
this
.
setDateMapValue
(
new
Date
(
item
.
startTime
.
replace
(
/-/g
,
'/'
)),
new
Date
(
item
.
endTime
.
replace
(
/-/g
,
'/'
)),
item
);
});
}
},
//日程数据
...
...
@@ -429,40 +439,43 @@ create.Page({
},
onPullDownRefresh
()
{
if
(
this
.
$store
.
data
.
tabBarIndex
==
'0'
)
{
this
.
getPages
(
1
);
dd
.
stopPullDownRefresh
();
return
}
//到顶部的时候才下拉加载数据,否则定位距离太长
if
(
this
.
scrollTop
!==
0
)
{
//
日程页面
到顶部的时候才下拉加载数据,否则定位距离太长
if
(
this
.
$store
.
data
.
tabBarIndex
==
'1'
&&
this
.
scrollTop
!==
0
)
{
dd
.
stopPullDownRefresh
();
return
}
const
todayStr
=
this
.
data
.
scheduleList
[
0
].
dateStr
;
//
const todayStr = this.data.scheduleList[0].dateStr;
if
(
this
.
firstPage
>
0
)
{
this
.
firstPage
--
;
this
.
currentPage
--
;
this
.
setData
({
todayStr
:
''
,
scheduleList
:
this
.
scheduleList
.
slice
(
this
.
firstPage
*
this
.
pageSize
,
this
.
currentPage
*
this
.
pageSize
)
},
()
=>
{
this
.
setData
({
todayStr
:
t
oday
Str
todayStr
:
t
his
.
data
.
scheduleList
[
this
.
pageSize
-
1
].
date
Str
});
dd
.
stopPullDownRefresh
();
});
}
else
{
minYear
--
;
const
yearData
=
getBlankList
(
minYear
);
this
.
scheduleList
.
unshift
(...
yearData
);
this
.
totalPages
=
Math
.
ceil
(
this
.
scheduleList
.
length
/
this
.
pageSize
);
this
.
currentPage
=
Math
.
floor
(
yearData
.
length
*
2
/
this
.
pageSize
);
this
.
setData
({
todayStr
:
''
,
scheduleList
:
this
.
scheduleList
.
slice
(
0
,
this
.
currentPage
*
this
.
pageSize
),
//加载一年的数据重定位可能会有点问题,重置一下
currentData
:
todayStr
,
currentDataIndex
:
yearData
.
length
scheduleList
:
this
.
scheduleList
.
slice
(
0
,
yearData
.
length
*
2
),
},
()
=>
{
this
.
setData
({
todayStr
:
todayStr
//加载一年的数据重定位可能会有点问题,重置一下
currentData
:
this
.
scheduleList
[
yearData
.
length
-
1
].
dateStr
,
currentDataIndex
:
yearData
.
length
-
1
,
todayStr
:
this
.
scheduleList
[
yearData
.
length
-
1
].
dateStr
});
dd
.
stopPullDownRefresh
()
})
...
...
@@ -481,18 +494,6 @@ create.Page({
i
++
}
return
i
// for (let i = 0; i < this.data.scheduleList.length; i++) {
// if (this.data.scheduleList[i].type.indexOf('day') !== '-1') {
// height += this.dateHeight
// } else {
// height += this.otherHeight
// }
// if (height >= scrollTop) {
// index = i;
// break;
// }
// }
// return index
},
scroll
(
e
)
{
//计算有偏差
...
...
@@ -527,8 +528,26 @@ create.Page({
})
}
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
(
offset
==
'next'
)
{
for
(
let
i
=
this
.
data
.
currentDataIndex
;
i
<
rect
[
0
].
length
;
i
++
)
{
...
...
@@ -544,7 +563,8 @@ create.Page({
}
}
else
if
(
offset
==
'before'
)
{
for
(
let
i
=
this
.
data
.
currentDataIndex
;
i
>
0
;
i
--
)
{
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
])
{
this
.
setData
({
...
...
@@ -560,7 +580,7 @@ create.Page({
},
//判断滚动方向
getScrollOffset
(
scrollTop
)
{
let
offset
=
''
;
let
offset
=
'
stop
'
;
if
(
scrollTop
>
this
.
scrollTop
)
{
//向下滚动
offset
=
'next'
...
...
@@ -568,9 +588,9 @@ create.Page({
//向上滚动
offset
=
'before'
}
//给scrollTop重新赋值
this
.
scrollTop
=
scrollTop
;
return
offset
},
closePop
()
{
this
.
setData
({
...
...
@@ -621,6 +641,7 @@ create.Page({
if
(
this
.
isFirstLoad
)
{
this
.
backToToday
();
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