Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
E
ec-report-refactor
Project
Project
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
lihuizhen
ec-report-refactor
Commits
b43c3de2
Commit
b43c3de2
authored
May 26, 2022
by
DESKTOP-K893UGN\A
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:详情页左右滑动切换
parent
dedf6563
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
63 additions
and
43 deletions
+63
-43
details.vue
pages/details/details.vue
+56
-2
scrollview.vue
pages/details/scrollview.vue
+0
-40
reports.vue
pages/reports/reports.vue
+7
-1
No files found.
pages/details/details.vue
View file @
b43c3de2
<
template
>
<view
class=
"viewport-wrapper"
:style=
"[styleObject]"
>
<view
class=
"viewport-wrapper"
:style=
"[styleObject]"
@
touchstart
.
stop=
"handleTouchstart"
@
touchend
.
stop=
"handleTouchend"
>
<template
v-for=
"(element, index) in reportInfo.list"
>
<view
class=
"view-element"
...
...
@@ -64,6 +64,8 @@
return
{
reportInfo
:
{},
detailId
:
""
,
idList
:
[],
indexs
:
0
,
timename
:
null
,
pageScrollTop
:
0
,
horizontalBarHeight
:
0
...
...
@@ -95,6 +97,8 @@
},
onLoad
(
option
)
{
this
.
detailId
=
option
.
id
this
.
idList
=
option
.
idList
.
split
(
","
)
this
.
indexs
=
this
.
idList
.
findIndex
((
item
)
=>
item
===
this
.
detailId
)
this
.
getReportCharts
()
},
onShow
()
{
...
...
@@ -220,14 +224,64 @@
return
item
})
}
},
/**
* 获取鼠标、手指初始位置
*/
handleTouchstart
(
e
)
{
this
.
startTime
=
Date
.
now
();
this
.
startX
=
e
.
changedTouches
[
0
].
clientX
;
this
.
startY
=
e
.
changedTouches
[
0
].
clientY
;
},
/**
* 计算鼠标、手指偏移方向
*/
handleTouchend
(
e
)
{
const
endTime
=
Date
.
now
();
const
length
=
this
.
lengths
-
1
;
const
endX
=
e
.
changedTouches
[
0
].
clientX
;
const
endY
=
e
.
changedTouches
[
0
].
clientY
;
const
differ
=
Math
.
abs
(
endY
-
this
.
startY
);
const
dirvalX
=
endX
-
this
.
startX
;
// 纵轴偏移量不得超过 30,否则默认页面进行滚动操作
if
(
differ
<=
30
)
{
// 按下时长不得超过 2秒,X轴滑动距离必须大于 40
if
(
endTime
-
this
.
startTime
>
2000
||
Math
.
abs
(
dirvalX
)
<=
40
)
{
return
};
// 判断滑动方向
if
(
dirvalX
>
0
)
{
this
.
indexs
--
;
if
(
this
.
indexs
<=
0
)
this
.
indexs
=
0
;
}
else
if
(
dirvalX
<
0
){
this
.
indexs
++
;
if
(
this
.
indexs
>=
length
)
this
.
indexs
=
length
;
}
this
.
handlePage
()
}
},
/**
* 跳转到indexs页面
*/
handlePage
()
{
var
idstr
=
this
.
idList
[
this
.
indexs
]
const
url
=
"/pages/details/details?id="
+
idstr
+
"&idList="
+
this
.
idList
console
.
log
(
url
)
uni
.
redirectTo
({
url
:
url
})
}
},
onPullDownRefresh
()
{
this
.
getReportCharts
()
},
onPageScroll
(
res
)
{
this
.
pageScrollTop
=
res
.
scrollTop
}
,
}
}
</
script
>
...
...
pages/details/scrollview.vue
deleted
100644 → 0
View file @
dedf6563
<
template
>
<scroll-view
scroll-x=
"true"
>
<block
v-for=
"(item,index) in idlist"
>
<view>
123
</view>
</block>
</scroll-view>
</
template
>
<
script
>
export
default
{
data
()
{
return
{
detailId
:
""
,
idlist
:[]
}
},
computed
:
{
},
onLoad
(
option
)
{
this
.
detailId
=
option
.
id
this
.
idList
=
option
.
ids
.
split
(
","
)
console
.
log
(
this
.
detailId
)
console
.
log
(
this
.
idList
)
},
onShow
()
{
},
onUnload
()
{
},
methods
:
{
},
}
</
script
>
<
style
>
</
style
>
pages/reports/reports.vue
View file @
b43c3de2
...
...
@@ -67,7 +67,13 @@
// 点击查看
onClick
(
item
)
{
const
url
=
"/pages/details/details?id="
+
item
.
id
var
idList
=
[]
for
(
var
i
=
0
;
i
<
this
.
reportList
.
length
;
i
++
){
var
obj
=
this
.
reportList
[
i
]
idList
.
push
(
obj
.
id
)
}
const
url
=
"/pages/details/details?id="
+
item
.
id
+
"&idList="
+
idList
console
.
log
(
url
)
uni
.
navigateTo
({
url
:
url
})
...
...
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