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
18acb150
Commit
18acb150
authored
Dec 09, 2022
by
leon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: popup data add swipe
parent
09cd0288
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
185 additions
and
91 deletions
+185
-91
HorizontalBar.vue
components/HorizontalBar/HorizontalBar.vue
+3
-2
ModelData.vue
components/ModelData/ModelData.vue
+177
-87
index.vue
pages/index/index.vue
+5
-2
No files found.
components/HorizontalBar/HorizontalBar.vue
View file @
18acb150
...
@@ -91,10 +91,11 @@ export default {
...
@@ -91,10 +91,11 @@ export default {
current
:
event
.
dataIndex
,
current
:
event
.
dataIndex
,
urls
:
urls
urls
:
urls
})
})
}
else
if
(
popup
)
{
}
else
if
(
popup
)
{
uni
.
$emit
(
'showBarDetail'
,
{
uni
.
$emit
(
'showBarDetail'
,
{
popupShow
:
true
,
popupShow
:
true
,
popupData
:
data
[
event
.
dataIndex
],
popupData
:
data
,
currentIndex
:
event
.
dataIndex
,
customRender
customRender
})
})
}
else
{
}
else
{
...
...
components/ModelData/ModelData.vue
View file @
18acb150
<
template
>
<
template
>
<u-modal
<u-modal
class=
"model-data"
v-model=
"popupShow"
:closeOnClickOverlay=
"true"
title=
"明细"
@
close=
"close"
class=
"model-data"
@
confirm=
"close"
>
v-model=
"popupShow"
<view
class=
"slot-content"
@
touchstart=
"touchStart"
@
touchmove=
"touchMove"
@
touchend=
"touchEnd"
:closeOnClickOverlay=
"true"
:animation=
"animationData"
>
title=
"明细"
<view
v-for=
"(val, key) in popupObject"
class=
"data-view"
>
@
close=
"close"
<view
class=
"data-key ellipsis"
>
{{
key
}}
</view>
@
confirm=
"close"
<template
v-if=
"customRender[key] === 'picture'"
>
>
<u-image
:height=
"100"
mode=
"aspectFit"
:src=
"val"
crossOrigin=
"anonymous"
style=
"width: 100%"
<view
class=
"slot-content"
>
@
click=
"seeImage(key)"
></u-image>
<view
v-for=
"(val, key) in popupData"
class=
"data-view"
>
</
template
>
<view
class=
"data-key ellipsis"
>
{{
key
}}
</view>
<view
v-else
class=
"data-val ellipsis"
>
{{ val }}
</view>
<template
v-if=
"customRender[key] === 'picture'"
>
</view>
<u-image
</view>
:height=
"100"
</u-modal>
mode=
"aspectFit"
</template>
:src=
"val"
crossOrigin=
"anonymous"
<
script
>
style=
"width: 100%"
export
default
{
@
click=
"seeImage(val)"
name
:
'ModelData'
,
></u-image>
data
()
{
</
template
>
return
{
<view
v-else
class=
"data-val ellipsis"
>
{{ val }}
</view>
// popupObject: {},
</view>
startX
:
0
,
//滑动开始x轴位置
</view>
startY
:
0
,
//滑动开始y轴位置
</u-modal>
moveX
:
0
,
//滑动的x轴距离
</template>
moveY
:
0
,
//滑动的y轴距离
like_state
:
0
,
//-1:左滑,0:没滑动,1:右滑
<
script
>
animationData
:
{},
export
default
{
index
:
0
,
name
:
'ModelData'
,
}
data
()
{
},
return
{}
props
:
{
},
popupData
:
{
props
:
{
type
:
Array
,
popupData
:
{
default
:
()
=>
[]
type
:
Object
,
},
default
:
()
=>
{}
currentIndex
:
{
},
tyep
:
Number
,
popupShow
:
{
default
:
0
type
:
Boolean
,
},
default
:
false
popupShow
:
{
},
type
:
Boolean
,
customRender
:
{
default
:
false
type
:
Object
,
},
default
:
()
=>
{}
customRender
:
{
}
type
:
Object
,
},
default
:
()
=>
{}
methods
:
{
}
close
()
{
},
uni
.
$emit
(
'showBarDetail'
,
{
created
()
{
popupShow
:
false
,
this
.
animation
=
uni
.
createAnimation
({
popupData
:
{}
timingFunction
:
'ease'
,
})
duration
:
120
},
})
seeImage
(
url
)
{
},
uni
.
previewImage
({
computed
:
{
current
:
0
,
popupObject
:
{
urls
:
[
url
]
get
()
{
})
this
.
index
=
this
.
currentIndex
}
return
this
.
popupData
[
this
.
currentIndex
]
}
},
}
set
(
val
)
{
</
script
>
return
val
}
<
style
scoped
>
}
.model-data
{
},
position
:
relative
;
methods
:
{
z-index
:
9999999
;
close
()
{
}
uni
.
$emit
(
'showBarDetail'
,
{
.slot-content
{
popupShow
:
false
,
margin
:
10px
;
popupData
:
[]
font-size
:
12px
;
})
border
:
1px
solid
#eee
;
},
border-radius
:
5px
;
seeImage
(
key
)
{
}
var
images
=
[]
.data-view
{
this
.
popupData
.
forEach
(
item
=>
{
display
:
flex
;
images
.
push
(
item
[
key
])
align-self
:
center
;
})
border-bottom
:
1px
solid
#eee
;
uni
.
previewImage
({
padding
:
5px
;
current
:
this
.
index
,
}
urls
:
images
.data-key
{
})
min-width
:
28%
;
},
margin-right
:
10px
;
touchStart
(
event
)
{
border-right
:
1px
solid
#eee
;
this
.
startX
=
event
.
touches
[
0
].
pageX
;
}
this
.
startY
=
event
.
touches
[
0
].
pageY
;
},
touchMove
(
event
)
{
var
currentX
=
event
.
touches
[
0
].
pageX
;
var
currentY
=
event
.
touches
[
0
].
pageY
;
var
moveX
=
currentX
-
this
.
startX
;
var
moveY
=
currentY
-
this
.
startY
;
var
state
=
0
;
//-1:左滑,0:没滑动,1:右滑
// //左右方向滑动
if
(
Math
.
abs
(
moveX
)
>
Math
.
abs
(
moveY
))
{
if
(
moveX
<
-
10
)
{
state
=
1
;
}
else
if
(
moveX
>
10
)
{
state
=
-
1
;
}
}
this
.
like_state
=
state
;
this
.
moveX
=
moveX
;
this
.
moveY
=
moveY
;
},
touchEnd
(
event
)
{
if
(
Math
.
abs
(
this
.
moveX
)
>
60
&&
this
.
like_state
!=
-
100
)
{
var
state
=
this
.
like_state
this
.
like_state
=
-
100
//设置这个数是为了避免滑动之后点击不走touchMove而产生的不正常滑动
//这里放需要进行的业务逻辑
if
(
state
===
1
&&
this
.
index
<
this
.
popupData
.
length
-
1
)
{
this
.
animation
.
translateX
(
'-100%'
).
step
()
.
opacity
(
0
).
step
({
duration
:
10
})
.
translateX
(
'100%'
).
step
({
duration
:
10
})
.
translateX
(
0
).
opacity
(
1
).
step
()
this
.
animationData
=
this
.
animation
.
export
()
// 为避免uniapp动画只有第一次生效,必须延迟删除动画实例数据
setTimeout
(()
=>
{
this
.
animationData
=
{}
},
250
)
this
.
index
+=
1
}
if
(
state
===
-
1
&&
this
.
index
>
0
)
{
this
.
animation
.
translateX
(
'100%'
).
step
()
.
opacity
(
0
).
step
({
duration
:
10
})
.
translateX
(
'-100%'
).
step
({
duration
:
10
})
.
translateX
(
0
).
opacity
(
1
).
step
()
this
.
animationData
=
this
.
animation
.
export
()
// 为避免uniapp动画只有第一次生效,必须延迟删除动画实例数据
setTimeout
(()
=>
{
this
.
animationData
=
{}
},
250
)
this
.
index
-=
1
}
this
.
$set
(
this
.
popupObject
,
''
,
this
.
popupData
[
this
.
index
])
}
}
}
}
</
script
>
<
style
scoped
>
.model-data
{
position
:
relative
;
z-index
:
9999999
;
}
.slot-content
{
margin
:
10px
;
font-size
:
12px
;
border
:
1px
solid
#eee
;
border-radius
:
5px
;
}
.data-view
{
display
:
flex
;
align-self
:
center
;
border-bottom
:
1px
solid
#eee
;
padding
:
5px
;
}
.data-key
{
min-width
:
28%
;
margin-right
:
10px
;
border-right
:
1px
solid
#eee
;
}
</
style
>
</
style
>
pages/index/index.vue
View file @
18acb150
...
@@ -64,6 +64,7 @@
...
@@ -64,6 +64,7 @@
style=
"position: relative;z-index: 99999;"
style=
"position: relative;z-index: 99999;"
:popupShow=
"popupShow"
:popupShow=
"popupShow"
:popupData=
"popupData"
:popupData=
"popupData"
:currentIndex=
"currentIndex"
:customRender=
"customRender"
:customRender=
"customRender"
></ModelData>
></ModelData>
</view>
</view>
...
@@ -80,7 +81,8 @@
...
@@ -80,7 +81,8 @@
horizontalBarHeight
:
0
,
horizontalBarHeight
:
0
,
popupShow
:
false
,
popupShow
:
false
,
popupData
:
{},
popupData
:
{},
customRender
:
{}
customRender
:
{},
currentIndex
:
0
}
}
},
},
computed
:
{
computed
:
{
...
@@ -156,9 +158,10 @@
...
@@ -156,9 +158,10 @@
that
.
horizontalBarHeight
=
height
that
.
horizontalBarHeight
=
height
})
})
uni
.
$on
(
'showBarDetail'
,
data
=>
{
uni
.
$on
(
'showBarDetail'
,
data
=>
{
const
{
popupShow
,
popupData
,
customRender
}
=
data
const
{
popupShow
,
popupData
,
customRender
,
currentIndex
}
=
data
that
.
popupShow
=
popupShow
that
.
popupShow
=
popupShow
that
.
popupData
=
popupData
that
.
popupData
=
popupData
that
.
currentIndex
=
currentIndex
that
.
customRender
=
customRender
that
.
customRender
=
customRender
})
})
},
},
...
...
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