Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
jz_Travel
Project
Project
Details
Activity
Releases
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
zhengke
jz_Travel
Commits
eba58ed8
Commit
eba58ed8
authored
Feb 21, 2025
by
罗超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化
parent
cca67d1c
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
184 additions
and
1441 deletions
+184
-1441
index.vue
components/tabbar/index.vue
+79
-299
index.vue
pages/index/index.vue
+105
-1142
No files found.
components/tabbar/index.vue
View file @
eba58ed8
<
style
scoped
>
.tabbarMain
{
height
:
100
upx
;
position
:
fixed
;
z-index
:
50
;
flex
:
1
;
bottom
:
0
;
left
:
0
;
right
:
0
;
z-index
:
99999999
;
border-top
:
1
upx
solid
#ddd
;
padding-top
:
96
rpx
;
background
:
#fff
;
}
.tabbarMainIphone
{
height
:
156
upx
;
padding-bottom
:
64
upx
;
}
.tabBtnMina
{
width
:
750
upx
;
height
:
88
upx
;
position
:
absolute
;
z-index
:
2
;
bottom
:
0
;
flex-direction
:
row
;
display
:
flex
;
left
:
0
;
right
:
0
;
z-index
:
99999999
;
}
.tabBtnMinaIphone
{
height
:
156
upx
;
padding-bottom
:
64
upx
;
}
.imgse
{
height
:
48
upx
;
width
:
48
upx
;
}
.txtBtn
{
font-size
:
24
upx
;
color
:
#666666
;
}
.txtBtnSel
{
font-size
:
24
upx
;
color
:
#333333
;
}
.itmMain
{
width
:
150
upx
;
flex
:
1
;
justify-content
:
center
;
align-items
:
center
;
display
:
flex
;
flex-direction
:
column
;
}
.imgseTs
{
width
:
150
upx
;
height
:
140
upx
;
margin-bottom
:
90
upx
;
position
:
relative
;
z-index
:
1
;
bottom
:
0
upx
;
}
.btnfixMin
{
width
:
750
upx
;
height
:
178
upx
;
position
:
absolute
;
z-index
:
1
;
bottom
:
0
;
}
.btnfixMinIphone
{
bottom
:
64
upx
;
}
.fixTpm
{
width
:
150
upx
;
height
:
140
upx
;
flex-direction
:
row
;
justify-content
:
center
;
align-items
:
center
;
position
:
relative
;
z-index
:
0
;
}
.imgseTsAnds
{
width
:
150
upx
;
height
:
150
upx
;
position
:
fixed
;
z-index
:
1
;
bottom
:
10
upx
;
border-radius
:
150
upx
;
}
</
style
>
<
template
>
<
template
>
<view
<view
class=
"tabbarMain"
:style=
"
{paddingBottom: `${bottomSafeHeight}px`}" v-if="navs.length">
class=
"tabbarMain bar-box"
<view
class=
"tabBtnMina"
>
:class=
"[flagTypeInfo ? 'tabbarMainIphone' : '']"
<view
v-if=
"navs && navs.length > 0"
class=
"itmMain"
>
v-for=
"(x, i) in navs"
<view
:key=
"i"
class=
"tabBtnMina"
:class=
"[flagTypeInfo ? 'tabBtnMinaIphone' : '']"
mode=
""
>
<view
class=
"itmMain"
v-for=
"(x, i) in navs"
:key=
"i"
@
click
.
stop=
"goUrl(x.url)"
@
click
.
stop=
"goUrl(x.url)"
>
>
<image
<image
class=
"imgse"
class=
"imgse"
:fade-show=
"false"
:src=
"active === i ? x.active_icon : x.icon"
v-if=
"active != i"
mode=
"aspectFit"
mode=
"aspectFit"
:src=
"x.icon"
/>
></image>
<text
class=
"txtBtn"
:style=
"
{ color: active == i ? x.active_color : x.color }">
<image
{{
x
.
text
}}
class=
"imgse"
</text>
:fade-show=
"false"
v-if=
"active === i"
mode=
"aspectFit"
:src=
"x.active_icon"
></image>
<text
class=
"txtBtn"
:style=
"
{ color: active == i ? x.active_color : x.color }"
>
{{
x
.
text
}}
</text
>
</view>
</view>
</view>
</view>
</view>
</view>
</
template
>
</
template
>
<
script
>
<
script
>
export
default
{
export
default
{
data
()
{
data
()
{
return
{
return
{
active
:
0
,
active
:
0
,
platforms
:
""
,
leftWidth
:
0
,
flagTypeInfo
:
false
,
navs
:
[],
navs
:
[],
crtPath
:
""
,
bottomSafeHeight
:
0
,
currentPath
:
''
};
};
},
},
created
()
{
},
mounted
()
{
mounted
()
{
this
.
flagTypeInfo
=
this
.
$uiConfig
.
is_bang
;
this
.
navs
=
uni
.
getStorageSync
(
"navs"
)
||
[]
let
tempSystem
=
uni
.
getSystemInfoSync
();
this
.
calcSafeArea
()
this
.
platforms
=
tempSystem
.
platform
;
this
.
activeHandler
()
this
.
$nextTick
(()
=>
{
// #ifdef APP-NVUE || APP-PLUS || APP-PLUS-NVUE ||APP-VUE
if
(
this
.
platforms
==
"android"
)
{
let
temp
=
this
.
$refs
.
leftWidth
;
this
.
leftWidth
=
tempSystem
.
screenWidth
/
2
;
}
// #endif
});
if
(
uni
.
getStorageSync
(
"navs"
))
{
this
.
navs
=
uni
.
getStorageSync
(
"navs"
)
??
[];
}
else
{
setTimeout
(()
=>
{
this
.
navs
=
uni
.
getStorageSync
(
"navs"
)
??
[];
this
.
activeHandler
();
},
3000
);
}
this
.
activeHandler
();
},
},
methods
:
{
methods
:
{
calcSafeArea
()
{
const
{
safeAreaInsets
}
=
uni
.
getSystemInfoSync
()
this
.
bottomSafeHeight
=
safeAreaInsets
.
bottom
>
0
?
safeAreaInsets
.
bottom
:
10
},
activeHandler
()
{
activeHandler
()
{
let
t
=
getCurrentPages
();
const
pages
=
getCurrentPages
()
const
currentPage
=
pages
[
pages
.
length
-
1
]
// #ifdef MP-WEIXIN
const
query
=
currentPage
.
options
let
query
=
t
[
t
.
length
-
1
].
__displayReporter
.
query
;
const
queryString
=
Object
.
keys
(
query
)
let
queryString
=
""
;
.
map
(
key
=>
`
${
key
}
=
${
query
[
key
]}
`
)
for
(
var
k
in
query
)
{
.
join
(
'&'
)
queryString
+=
`&
${
k
}
=
${
query
[
k
]}
`
;
this
.
currentPath
=
`/
${
currentPage
.
route
}${
queryString
?
'?'
+
queryString
:
''
}
`
}
if
(
queryString
!=
""
)
{
this
.
navs
.
forEach
((
item
,
index
)
=>
{
queryString
=
"?"
+
queryString
.
substring
(
1
,
queryString
.
length
);
if
(
this
.
currentPath
===
item
.
url
)
{
}
this
.
active
=
index
this
.
crtPath
=
"/"
+
t
[
t
.
length
-
1
].
route
+
queryString
;
// #endif
// #ifdef MP-ALIPAY
this
.
crtPath
=
t
[
t
.
length
-
1
].
$page
.
fullPath
;
// #endif
this
.
navs
.
forEach
((
x
,
i
)
=>
{
if
(
x
.
url
==
this
.
crtPath
)
{
this
.
active
=
i
;
}
}
})
;
})
},
},
goUrl
(
url
)
{
goUrl
(
url
)
{
if
(
this
.
crtPath
!=
url
)
{
if
(
this
.
currentPath
!==
url
)
{
uni
.
redirectTo
({
uni
.
redirectTo
({
url
})
url
:
url
,
});
}
else
{
}
else
{
uni
.
reLaunch
({
uni
.
reLaunch
({
url
:
url
,
url
});
})
}
}
}
,
}
}
,
}
}
;
}
</
script
>
</
script
>
<!-- <template>
<view class="bar-box">
<div class="bar-box-line">
<view class="bar-item" v-for="(x,i) in menus" @click="changeMenuHandler(x)">
<i class="icon iconfont" :class="[x.icon]" v-if="current != x.page"></i>
<view class="acitve" v-else>
{{x.name}}
</view>
</view>
</div>
</view>
</template>
<script>
export default {
data() {
return {
menus: [],
current: ''
};
},
mounted() {
let pages = getCurrentPages()
this.current = "/" + pages[pages.length - 1].route ? ? ''
this.menus = [{
name: '首页',
icon: 'icon-home',
page: '/pages/index/index'
},
{
name: '订单',
icon: 'icon-Work',
page: '/pages/jiuzhai/jz_MyOrder'
},
{
name: '我的',
icon: 'icon-my1',
page: '/pages/user-center/user-center'
}
]
},
methods: {
changeMenuHandler(menu) {
this.current = menu.page
if (menu.page.indexOf('pages') != -1) {
uni.redirectTo({
url: menu.page
})
}
}
}
}
</script>
-->
<
style
>
<
style
>
/* 在线链接服务仅供平台体验和调试使用,平台不承诺服务的稳定性,企业客户需下载字体包自行发布使用并做好备份。 */
.tabbarMain
{
@font-face
{
position
:
fixed
;
font-family
:
"nav-font"
;
z-index
:
999
;
src
:
url("//at.alicdn.com/wf/webfont/MQHUV6e56ce5/tcIItWsk6dTo.woff2")
format
(
"woff2"
),
bottom
:
0
;
url("//at.alicdn.com/wf/webfont/MQHUV6e56ce5/RZzswoFvsjUs.woff")
format
(
"woff"
);
left
:
0
;
font-display
:
swap
;
right
:
0
;
}
background
:
#fff
;
border-top
:
1
rpx
solid
#E0E0E0
;
.bar-box
{
padding
:
20
rpx
0
0
;
padding-bottom
:
env
(
safe-area-inset-bottom
);
}
background-color
:
#FFF
;
border-top-left-radius
:
20
rpx
;
border-top-right-radius
:
20
rpx
;
box-shadow
:
0
0
6px
rgba
(
0
,
0
,
0
,
.12
);
position
:
fixed
;
z-index
:
50
;
flex
:
1
;
bottom
:
0
;
left
:
0
;
right
:
0
;
z-index
:
99999999
;
}
.bar-box-line
{
display
:
flex
;
flex-direction
:
row
;
flex-wrap
:
nowrap
;
align-items
:
center
;
padding
:
20
upx
0
30
upx
;
}
.bar-box-line.uninset
{
padding
:
20
upx
0
40
upx
;
}
.bar-box-line.inset
{
.tabBtnMina
{
padding
:
20
upx
0
;
display
:
flex
;
}
flex-direction
:
row
;
}
.bar-box-line
.bar-item
{
.itmMain
{
flex
:
1
;
flex
:
1
;
width
:
1p
x
;
display
:
fle
x
;
text-align
:
center
;
flex-direction
:
column
;
color
:
#abadb9
;
align-items
:
center
;
position
:
relative
;
justify-content
:
center
;
}
}
.bar-box-line
.bar-item
.icon
{
.imgse
{
font-size
:
50
rpx
;
width
:
48
rpx
;
}
height
:
48
rpx
;
}
.bar-box-line
.bar-item
.acitve
{
.txtBtn
{
font-size
:
32
rpx
;
font-size
:
20
rpx
;
font-weight
:
bold
;
color
:
#666
;
color
:
#1F2429
;
margin-top
:
8
rpx
;
text-align
:
center
;
line-height
:
1
;
font-family
:
nav-font
;
}
}
.bar-box-line
.bar-item
.acitve
::after
{
.txtBtnSel
{
display
:
inline-block
;
color
:
#333
;
content
:
' '
;
font-size
:
24
rpx
;
width
:
4px
;
}
height
:
4px
;
</
style
>
border-radius
:
4px
;
\ No newline at end of file
background-color
:
#1F2429
;
position
:
absolute
;
left
:
calc
(
50%
-
2px
);
top
:
60
rpx
;
}
</
style
>
pages/index/index.vue
View file @
eba58ed8
This diff is collapsed.
Click to expand it.
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