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
41aa6707
Commit
41aa6707
authored
Dec 13, 2022
by
leon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: popup data view style
parent
02580396
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
264 additions
and
244 deletions
+264
-244
HorizontalBar.vue
components/HorizontalBar/HorizontalBar.vue
+1
-1
ModelData.vue
components/ModelData/ModelData.vue
+37
-20
NormalTabs.vue
components/NormalTabs/NormalTabs.vue
+226
-223
No files found.
components/HorizontalBar/HorizontalBar.vue
View file @
41aa6707
components/ModelData/ModelData.vue
View file @
41aa6707
...
@@ -27,7 +27,7 @@
...
@@ -27,7 +27,7 @@
moveY
:
0
,
//滑动的y轴距离
moveY
:
0
,
//滑动的y轴距离
like_state
:
0
,
//-1:左滑,0:没滑动,1:右滑
like_state
:
0
,
//-1:左滑,0:没滑动,1:右滑
animationData
:
{},
animationData
:
{},
index
:
0
,
index
:
-
1
,
}
}
},
},
props
:
{
props
:
{
...
@@ -57,7 +57,6 @@
...
@@ -57,7 +57,6 @@
computed
:
{
computed
:
{
popupObject
:
{
popupObject
:
{
get
()
{
get
()
{
this
.
index
=
this
.
currentIndex
return
this
.
popupData
[
this
.
currentIndex
]
return
this
.
popupData
[
this
.
currentIndex
]
},
},
set
(
val
)
{
set
(
val
)
{
...
@@ -73,11 +72,16 @@
...
@@ -73,11 +72,16 @@
}
}
}
}
},
},
methods
:
{
methods
:
{
close
()
{
close
()
{
this
.
index
=
-
1
this
.
$emit
(
'close'
)
this
.
$emit
(
'close'
)
},
},
seeImage
(
key
)
{
seeImage
(
key
)
{
if
(
this
.
index
===
-
1
)
{
this
.
index
=
this
.
currentIndex
}
var
images
=
[]
var
images
=
[]
this
.
popupData
.
forEach
(
item
=>
{
this
.
popupData
.
forEach
(
item
=>
{
images
.
push
(
item
[
key
])
images
.
push
(
item
[
key
])
...
@@ -86,8 +90,14 @@
...
@@ -86,8 +90,14 @@
current
:
this
.
index
,
current
:
this
.
index
,
urls
:
images
urls
:
images
})
})
// 图片查看弹窗会使页面close,所以需要把index置为-1
this
.
index
=
-
1
},
},
touchStart
(
event
)
{
touchStart
(
event
)
{
if
(
this
.
index
===
-
1
)
{
this
.
index
=
this
.
currentIndex
}
this
.
startX
=
event
.
touches
[
0
].
pageX
;
this
.
startX
=
event
.
touches
[
0
].
pageX
;
this
.
startY
=
event
.
touches
[
0
].
pageY
;
this
.
startY
=
event
.
touches
[
0
].
pageY
;
},
},
...
@@ -99,9 +109,9 @@
...
@@ -99,9 +109,9 @@
var
state
=
0
;
//-1:左滑,0:没滑动,1:右滑
var
state
=
0
;
//-1:左滑,0:没滑动,1:右滑
// //左右方向滑动
// //左右方向滑动
if
(
Math
.
abs
(
moveX
)
>
Math
.
abs
(
moveY
))
{
if
(
Math
.
abs
(
moveX
)
>
Math
.
abs
(
moveY
))
{
if
(
moveX
<
-
1
0
)
{
if
(
moveX
<
-
4
0
)
{
state
=
1
;
state
=
1
;
}
else
if
(
moveX
>
1
0
)
{
}
else
if
(
moveX
>
4
0
)
{
state
=
-
1
;
state
=
-
1
;
}
}
}
}
...
@@ -110,17 +120,18 @@
...
@@ -110,17 +120,18 @@
this
.
moveY
=
moveY
;
this
.
moveY
=
moveY
;
},
},
touchEnd
(
event
)
{
touchEnd
(
event
)
{
if
(
Math
.
abs
(
this
.
moveX
)
>
60
&&
this
.
like_state
!=
-
100
)
{
if
(
Math
.
abs
(
this
.
moveX
)
>
40
&&
this
.
like_state
!=
-
100
)
{
console
.
log
(
"this index = "
,
this
.
index
)
var
state
=
this
.
like_state
var
state
=
this
.
like_state
this
.
like_state
=
-
100
//设置这个数是为了避免滑动之后点击不走touchMove而产生的不正常滑动
this
.
like_state
=
-
100
//设置这个数是为了避免滑动之后点击不走touchMove而产生的不正常滑动
//这里放需要进行的业务逻辑
//这里放需要进行的业务逻辑
if
(
state
===
1
&&
this
.
index
<
this
.
popupData
.
length
-
1
)
{
if
(
state
===
1
&&
this
.
index
<
this
.
popupData
.
length
-
1
)
{
this
.
animation
.
translateX
(
'-100%'
).
step
()
this
.
animation
.
translateX
(
'-100%'
).
step
()
.
opacity
(
0
).
step
({
.
opacity
(
0
).
step
({
duration
:
1
0
duration
:
5
0
})
})
.
translateX
(
'100%'
).
step
({
.
translateX
(
'100%'
).
step
({
duration
:
1
0
duration
:
5
0
})
})
.
translateX
(
0
).
opacity
(
1
).
step
()
.
translateX
(
0
).
opacity
(
1
).
step
()
...
@@ -130,14 +141,17 @@
...
@@ -130,14 +141,17 @@
this
.
animationData
=
{}
this
.
animationData
=
{}
},
250
)
},
250
)
this
.
index
+=
1
this
.
index
+=
1
// this.popupObject = this.popupData[this.index]
this
.
$set
(
this
.
popupObject
,
''
,
this
.
popupData
[
this
.
index
])
console
.
log
(
"end this index = "
,
this
.
index
)
}
}
if
(
state
===
-
1
&&
this
.
index
>
0
)
{
if
(
state
===
-
1
&&
this
.
index
>
0
)
{
this
.
animation
.
translateX
(
'100%'
).
step
()
this
.
animation
.
translateX
(
'100%'
).
step
()
.
opacity
(
0
).
step
({
.
opacity
(
0
).
step
({
duration
:
1
0
duration
:
5
0
})
})
.
translateX
(
'-100%'
).
step
({
.
translateX
(
'-100%'
).
step
({
duration
:
1
0
duration
:
5
0
})
})
.
translateX
(
0
).
opacity
(
1
).
step
()
.
translateX
(
0
).
opacity
(
1
).
step
()
...
@@ -147,8 +161,11 @@
...
@@ -147,8 +161,11 @@
this
.
animationData
=
{}
this
.
animationData
=
{}
},
250
)
},
250
)
this
.
index
-=
1
this
.
index
-=
1
}
// this.popupObject = this.popupData[this.index]
this
.
$set
(
this
.
popupObject
,
''
,
this
.
popupData
[
this
.
index
])
this
.
$set
(
this
.
popupObject
,
''
,
this
.
popupData
[
this
.
index
])
console
.
log
(
"end this index = "
,
this
.
index
)
}
console
.
log
(
"popupObject = "
,
this
.
popupObject
)
}
}
}
}
}
}
...
...
components/NormalTabs/NormalTabs.vue
View file @
41aa6707
<
template
>
<
template
>
<view
class=
"normal-tabs"
>
<view
class=
"normal-tabs"
>
<u-tabs
<u-tabs
v-if=
"elementInfo.option.tabs.type === 'radio'"
:list=
"elementData.dataList.series"
:is-scroll=
"false"
v-if=
"elementInfo.option.tabs.type === 'radio'"
:current=
"currentTabs"
:active-color=
"elementInfo.option.tabs.activeColor"
:list=
"elementData.dataList.series"
:inactive-color=
"elementInfo.option.tabs.color"
:bg-color=
"elementInfo.option.tabs.backgroundColor"
:is-scroll=
"false"
@
change=
"handleTabsChange"
></u-tabs>
:current=
"currentTabs"
:active-color=
"elementInfo.option.tabs.activeColor"
:inactive-color=
"elementInfo.option.tabs.color"
:bg-color=
"elementInfo.option.tabs.backgroundColor"
@
change=
"handleTabsChange"
></u-tabs>
<template
v-if=
"elementInfo.option.tabs.type === 'select'"
>
<template
v-if=
"elementInfo.option.tabs.type === 'select'"
>
<view
class=
"input-group"
>
<view
class=
"input-group"
>
<u-input
<u-input
v-model=
"selectValue"
type=
"select"
border=
"true"
v-model=
"tabsValue"
:placeholder=
"elementInfo.option.tabs.placeholder"
@
click=
"show = true"
/>
type=
"select"
<u-icon
class=
"close-icon"
v-if=
"tabsValue && elementInfo.option.tabs.allowClear"
name=
"close-circle"
border=
"true"
@
click
.
prevent
.
stop=
"handleClearValue"
></u-icon>
:placeholder=
"elementInfo.option.tabs.placeholder"
@
click=
"show = true"
/>
<u-icon
class=
"close-icon"
v-if=
"tabsValue && elementInfo.option.tabs.allowClear"
name=
"close-circle"
@
click
.
prevent
.
stop=
"handleClearValue"
></u-icon>
</view>
</view>
<u-select
<u-select
v-model=
"show"
:default-value=
"defaultValue"
:list=
"elementData.dataList.series"
v-model=
"show"
:safe-area-inset-bottom=
"true"
label-name=
"name"
:z-index=
"zIndex"
@
confirm=
"handleSelectChange"
>
:default-value=
"defaultValue"
</u-select>
:list=
"elementData.dataList.series"
:safe-area-inset-bottom=
"true"
label-name=
"name"
@
confirm=
"handleSelectChange"
></u-select>
</
template
>
</
template
>
<swiper
<swiper
v-if=
"elementInfo.option.tabs.type === 'group'"
class=
"tab-swiper"
v-if=
"elementInfo.option.tabs.type === 'group'"
:indicator-dots=
"tabsGroup.length > 1"
:style=
"[tabsStyle]"
:indicator-color=
"'#ccc'"
class=
"tab-swiper"
:indicator-active-color=
"elementInfo.option.tabs.backgroundColor"
>
:indicator-dots=
"tabsGroup.length > 1"
<swiper-item
class=
"tab-group"
v-for=
"(item, index) in tabsGroup"
:key=
"index"
>
:style=
"[tabsStyle]"
<view
class=
"tab-item"
:class=
"[tabsValue == tab.value ? 'active' : '']"
v-for=
"tab in item"
:indicator-color=
"'#ccc'"
:key=
"tab.value"
@
click=
"handleChangeTabValue(tab.value)"
>
:indicator-active-color=
"elementInfo.option.tabs.backgroundColor"
>
<swiper-item
class=
"tab-group"
v-for=
"(item, index) in tabsGroup"
:key=
"index"
>
<view
class=
"tab-item"
:class=
"[tabsValue == tab.value ? 'active' : '']"
v-for=
"tab in item"
:key=
"tab.value"
@
click=
"handleChangeTabValue(tab.value)"
>
{{ tab.name }}
{{ tab.name }}
</view>
</view>
</swiper-item>
</swiper-item>
...
@@ -65,8 +31,8 @@
...
@@ -65,8 +31,8 @@
</template>
</template>
<
script
>
<
script
>
import
echartElementData
from
'@/mixins/echartElementData.js'
import
echartElementData
from
'@/mixins/echartElementData.js'
export
default
{
export
default
{
name
:
'NormalTabs'
,
name
:
'NormalTabs'
,
mixins
:
[
echartElementData
],
mixins
:
[
echartElementData
],
data
()
{
data
()
{
...
@@ -74,6 +40,8 @@ export default {
...
@@ -74,6 +40,8 @@ export default {
currentTabs
:
0
,
currentTabs
:
0
,
show
:
false
,
show
:
false
,
tabsValue
:
''
,
tabsValue
:
''
,
selectValue
:
''
,
zIndex
:
0
,
defaultValue
:
[
0
]
defaultValue
:
[
0
]
}
}
},
},
...
@@ -87,7 +55,10 @@ export default {
...
@@ -87,7 +55,10 @@ export default {
},
},
computed
:
{
computed
:
{
tabsGroup
()
{
tabsGroup
()
{
const
{
type
,
count
}
=
this
.
elementInfo
.
option
.
tabs
const
{
type
,
count
}
=
this
.
elementInfo
.
option
.
tabs
if
(
type
===
'group'
)
{
if
(
type
===
'group'
)
{
return
this
.
$u
.
common
.
chunk
(
return
this
.
$u
.
common
.
chunk
(
this
.
elementData
.
dataList
.
series
,
this
.
elementData
.
dataList
.
series
,
...
@@ -123,6 +94,15 @@ export default {
...
@@ -123,6 +94,15 @@ export default {
methods
:
{
methods
:
{
initChart
()
{
initChart
()
{
this
.
tabsValue
=
this
.
elementInfo
.
option
.
tabs
.
defaultValue
this
.
tabsValue
=
this
.
elementInfo
.
option
.
tabs
.
defaultValue
if
(
this
.
elementInfo
.
option
.
tabs
.
type
===
'select'
)
{
for
(
var
i
=
0
;
i
<
this
.
elementData
.
dataList
.
series
.
length
;
i
++
)
{
const
item
=
this
.
elementData
.
dataList
.
series
[
i
]
if
(
item
.
value
===
this
.
tabsValue
||
item
.
value
===
parseInt
(
this
.
tabsValue
))
{
this
.
selectValue
=
item
.
name
this
.
zIndex
=
i
}
}
}
},
},
setTabsValue
(
index
=
0
)
{
setTabsValue
(
index
=
0
)
{
this
.
currentTabs
=
index
this
.
currentTabs
=
index
...
@@ -134,6 +114,8 @@ export default {
...
@@ -134,6 +114,8 @@ export default {
this
.
tabsValueChange
()
this
.
tabsValueChange
()
},
},
handleSelectChange
(
e
)
{
handleSelectChange
(
e
)
{
console
.
log
(
e
)
this
.
selectValue
=
e
[
0
].
label
this
.
tabsValue
=
e
[
0
].
value
this
.
tabsValue
=
e
[
0
].
value
this
.
defaultValue
[
0
]
=
[
this
.
defaultValue
[
0
]
=
[
this
.
elementData
.
dataList
.
series
.
findIndex
(
this
.
elementData
.
dataList
.
series
.
findIndex
(
...
@@ -155,7 +137,11 @@ export default {
...
@@ -155,7 +137,11 @@ export default {
* 改变选项卡的值
* 改变选项卡的值
*/
*/
tabsValueChange
()
{
tabsValueChange
()
{
const
{
index
,
paramName
,
data
}
=
this
.
elementInfo
.
child
const
{
index
,
paramName
,
data
}
=
this
.
elementInfo
.
child
if
(
this
.
elementInfo
.
child
.
type
===
'param'
)
{
if
(
this
.
elementInfo
.
child
.
type
===
'param'
)
{
uni
.
$emit
(
'handleLinkParams'
,
{
uni
.
$emit
(
'handleLinkParams'
,
{
index
,
index
,
...
@@ -169,8 +155,21 @@ export default {
...
@@ -169,8 +155,21 @@ export default {
if
(
element
.
name
==
this
.
tabsValue
)
showData
.
push
(
element
.
comp
)
if
(
element
.
name
==
this
.
tabsValue
)
showData
.
push
(
element
.
comp
)
if
(
element
.
name
!=
this
.
tabsValue
)
hideData
.
push
(
element
.
comp
)
if
(
element
.
name
!=
this
.
tabsValue
)
hideData
.
push
(
element
.
comp
)
})
})
uni
.
$emit
(
'handleLinkComp'
,
{
showData
,
hideData
})
uni
.
$emit
(
'handleLinkComp'
,
{
showData
,
hideData
})
}
}
},
getSelectLabel
(
value
)
{
var
label
=
value
this
.
elementData
.
dataList
.
series
.
forEach
(
item
=>
{
if
(
item
.
value
===
value
)
{
console
.
log
(
item
)
label
=
item
.
name
}
})
return
label
}
}
},
},
watch
:
{
watch
:
{
...
@@ -181,17 +180,18 @@ export default {
...
@@ -181,17 +180,18 @@ export default {
immediate
:
true
immediate
:
true
}
}
}
}
}
}
</
script
>
</
script
>
<
style
scoped
lang=
"scss"
>
<
style
scoped
lang=
"scss"
>
.tab-group
{
.tab-group
{
display
:
flex
!
important
;
display
:
flex
!
important
;
align-items
:
flex-start
;
align-items
:
flex-start
;
flex-wrap
:
wrap
;
flex-wrap
:
wrap
;
width
:
100%
;
width
:
100%
;
}
}
.tab-item
{
.tab-item
{
width
:
var
(
--
width
);
width
:
var
(
--
width
);
margin
:
1%
;
margin
:
1%
;
font-size
:
var
(
--
font-size
);
font-size
:
var
(
--
font-size
);
...
@@ -205,20 +205,23 @@ export default {
...
@@ -205,20 +205,23 @@ export default {
white-space
:
nowrap
;
white-space
:
nowrap
;
text-align
:
center
;
text-align
:
center
;
cursor
:
pointer
;
cursor
:
pointer
;
&
.active
{
&
.active
{
color
:
var
(
--
active-color
);
color
:
var
(
--
active-color
);
background
:
var
(
--
background-color
);
background
:
var
(
--
background-color
);
border-color
:
var
(
--
background-color
);
border-color
:
var
(
--
background-color
);
}
}
}
}
.input-group
{
.input-group
{
position
:
relative
;
position
:
relative
;
}
}
.close-icon
{
.close-icon
{
position
:
absolute
;
position
:
absolute
;
right
:
5px
;
right
:
5px
;
top
:
50%
;
top
:
50%
;
transform
:
translateY
(
-50%
);
transform
:
translateY
(
-50%
);
z-index
:
2
;
z-index
:
2
;
}
}
</
style
>
</
style
>
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