feat(components): 新增自定义 TabBar 组件

- 添加 m-tabBar 组件,用于替换原生 TabBar
- 在各个页面中集成 m-tabBar 组件
- 调整页面样式以适应新的 TabBar
- 移除 pages.json 中的原生 TabBar 配置
lu_quan_dev
Tuzki 12 months ago
parent 53669d5448
commit f400808ac6
  1. 122
      components/m-tabBar/mTabBar.vue
  2. 32
      pages.json
  3. 6
      pages/fuwu/fuwu.vue
  4. 187
      pages/index/index.vue
  5. 36
      pages/personcenter/personcenter.vue
  6. 78
      pages/zhoubian/zhoubian/zhoubian.vue
  7. 3
      static/ancss/an.css
  8. BIN
      static/animg/index/active-nav-bg.png
  9. 2
      subPageA/personcenter/aboutus.vue
  10. 4
      subPageA/personcenter/middlePage.vue
  11. 2
      subPageB/jiqiren/jiqiren/zhinengjiqiren.vue

@ -0,0 +1,122 @@
<template>
<view class="container">
<view class="tab-bar-box">
<view class="tab-bar-item" v-for="(item, index) in menu" :class="{ 'active': activeIndex == index }"
@click="handleClick(item.path)">
<view class="bar-icon">
<image class="bar-img" :src="activeIndex == index ? item.iconA : item.icon"></image>
</view>
<view class="bar-text">
{{ item.name }}
</view>
</view>
</view>
</view>
</template>
<script>
export default {
props: {
activeIndex: {
type: Number,
default: 0
}
},
data() {
return {
menu: [
{
name: '首页',
path: '/pages/index/index',
index: 0,
icon: 'https://eluyou.ailuquan.cn/upload/image/2024/mapIcon/daolan/tabBar/home.png',
iconA: 'https://eluyou.ailuquan.cn/upload/image/2024/mapIcon/daolan/tabBar/home_active.png'
},
{
name: '附近',
path: '/pages/zhoubian/zhoubian/zhoubian',
index: 1,
icon: 'https://eluyou.ailuquan.cn/upload/image/2024/mapIcon/daolan/tabBar/fujin.png',
iconA: 'https://eluyou.ailuquan.cn/upload/image/2024/mapIcon/daolan/tabBar/fujin_active.png'
},
{
name: '服务',
path: '/pages/fuwu/fuwu',
index: 2,
icon: 'https://eluyou.ailuquan.cn/upload/image/2024/mapIcon/daolan/tabBar/fuwu.png',
iconA: 'https://eluyou.ailuquan.cn/upload/image/2024/mapIcon/daolan/tabBar/fuwu_active.png'
},
{
name: '我的',
path: '/pages/personcenter/personcenter',
index: 3,
icon: 'https://eluyou.ailuquan.cn/upload/image/2024/mapIcon/daolan/tabBar/my.png',
iconA: 'https://eluyou.ailuquan.cn/upload/image/2024/mapIcon/daolan/tabBar/my_active.png'
}
]
};
},
methods: {
handleClick(path) {
uni.reLaunch({
url: path
})
}
}
};
</script>
<style scoped
lang="scss">
.container {
width: 90%;
height: 110rpx;
background: #FFFFFF;
box-shadow: 0rpx 6rpx 30rpx 0rpx rgba(6, 0, 1, 0.15);
border-radius: 55rpx;
position: fixed;
z-index: 9;
bottom: 50rpx;
left: 50%;
transform: translateX(-50%);
.tab-bar-box {
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: space-evenly;
.tab-bar-item {
height: fit-content;
padding: 15rpx;
display: flex;
flex-direction: column;
align-items: center;
font-size: 20rpx;
color: #A1A7AD;
.bar-icon {
width: 40rpx;
height: 40rpx;
.bar-img {
width: 100%;
height: 100%;
}
}
.bar-text{
margin-top: 5rpx;
}
}
.active {
font-family: Source Han Sans SC;
font-weight: 400;
font-size: 20rpx;
color: #0983FF;
}
}
}
</style>

@ -489,37 +489,5 @@
"navigationBarTitleText": "E鹿悦游",
"navigationBarBackgroundColor": "#f7f7f7",
"backgroundColor": "#f5f5f5"
},
"tabBar": {
"color": "#666",
"selectedColor": "#1677ff",
"borderStyle": "black",
"backgroundColor": "#fefefe",
"list": [
{
"pagePath": "pages/index/index",
"iconPath": "static/animg/bar/home.png",
"selectedIconPath": "static/animg/bar/home_active.png",
"text": "首页"
},
{
"pagePath": "pages/zhoubian/zhoubian/zhoubian",
"iconPath": "static/animg/bar/fujin.png",
"selectedIconPath": "static/animg/bar/fujin_active.png",
"text": "附近"
},
{
"pagePath": "pages/fuwu/fuwu",
"iconPath": "static/animg/bar/fuwu.png",
"selectedIconPath": "static/animg/bar/fuwu_active.png",
"text": "服务"
},
{
"pagePath": "pages/personcenter/personcenter",
"iconPath": "static/animg/bar/my.png",
"selectedIconPath": "static/animg/bar/my_active.png",
"text": "我的"
}
]
}
}

@ -103,15 +103,17 @@
</view>
</view>
<f-login></f-login>
<m-tabBar :activeIndex="2"></m-tabBar>
</view>
</template>
<script>
import uniNavBar from '@/uni_modules/uni-nav-bar/components/uni-nav-bar/uni-nav-bar.vue'
import mTabBar from "@/components/m-tabBar/mTabBar.vue";
export default {
components: {
uniNavBar
uniNavBar, mTabBar
},
data() {
return {};
@ -149,7 +151,7 @@ export default {
}
else if (type == "zhoubian") {
uni.switchTab({
uni.reLaunch({
url: "/pages/zhoubian/zhoubian/zhoubian",
});
} else if (type == "wenchuang") {

@ -1,10 +1,10 @@
<template>
<view>
<scroll-view class="scroll-boxs" @scroll="onScroll" scroll-y="true">
<view class="home_pic_static">
<view class="home_pic_static" id="home_pic_static">
<view class="swiper-box">
<u-swiper :interval="5000" :blur="blur" @change="e => current = e.current" :height="500" :list="images" :autoplay="autoplay"
@click="clickSwiper" :circular='true' :indicator="true" :easingFunction="'easeOutCubic'">
<u-swiper :interval="5000" :blur="blur" @change="e => current = e.current" :height="500" :list="images"
:autoplay="autoplay" @click="clickSwiper" :circular='true' :indicator="true" :easingFunction="'easeOutCubic'">
<view slot="indicator" class="indicator">
<view class="indicator__dot" v-for="(item, index) in images" :key="index"
:class="[index === current && 'indicator__dot--active']">
@ -15,18 +15,18 @@
</view>
<view class="home_serch_1"
:style="{ '-webkit-backdrop-filter': 'blur(' + blur + ')', 'backdrop-filter': 'blur(' + blur + ')', 'height': height }">
<view class="home_serch_1" id="home_serch_1"
:style="{ '-webkit-backdrop-filter': 'blur(' + blur + ')', 'backdrop-filter': 'blur(' + blur + ')', 'height': height + 'px' }">
<view class="weather-box">
<weather :show-location="false" ref="locationAndWeather" />
<weather :show-location="false" />
</view>
<view class="sch_2" @click="gotoSearch">
<view class="sch_2" style="height: 42rpx" @click="gotoSearch">
<image src="https://eluyou.ailuquan.cn/upload/image/2024/mapIcon/daolan/icon-search_2.png"></image>
<span>景区/酒店/美食</span>
<span class="sch_2_span">景区/酒店/美食</span>
</view>
</view>
<view class="no-fixed-box">
<view class="m-bankuai">
<view class="m-bankuai" id="m-bankuai">
<view class="home_nav">
<view class="dy_fx fx_warp_n h_nav_box">
<view class="w_25" hover-class="checkActive">
@ -62,7 +62,7 @@
<view class="w_25" hover-class="checkActive">
<view class="kua_nav" @click="goToPages('youji')">
<image src="/static/animg/index/strategy-guide.png" class="at_size_1"></image>
<view class="at_t">攻略游记</view>
<view class="at_t">文旅攻略</view>
</view>
</view>
</view>
@ -87,8 +87,16 @@
</view>
</view>
</view>
<view class="guanggao-swiper" id="guanggao-swiper">
<u-swiper :interval="3000" :list="guanggaoList" :autoplay="autoplay" @click="clickSwiper" :circular='true'
:indicator="true" :easingFunction="'easeOutCubic'">
</u-swiper>
</view>
<view class="quanyi-box" @click="goQuanyi" id="quanyi-box">
<image mode="widthFix" src="https://eluyou.ailuquan.cn/upload/image/2024/mapIcon/daolan/quanyi.png"></image>
</view>
<view class="amt_30">
<view class="an_box an_sch">
<view class="an_box an_sch" id="news-box">
<view class="dy_fx">
<view class="tips">鹿泉<span class="m-red">新闻</span></view>
<view class="fx_1 aml_30 amr_30 m-tips">
@ -106,7 +114,8 @@
</view>
</view>
<!-- 滑动nav -->
<view class="m-slide-nav">
<view class="m-slide-nav" :class="isFixed ? 'slide-nav-fixed' : ''"
:style="{ 'top': isFixed ? height + 'px' : '' }">
<view :class="['m-slide-item', currIndex == index ? 'curr' : '']" v-for="(item, index) in slideNav"
@tap="changeIndex(index)">
{{ item }}
@ -197,7 +206,7 @@
</view>
</scroll-view>
<m-tabBar :activeIndex="0"></m-tabBar>
<f-login></f-login>
</view>
</template>
@ -205,10 +214,12 @@
<script>
import weather from "@/uni_modules/jr-weather/components/jr-weather/jr-weather.vue";
import Uswiper from "@/uni_modules/uview-ui/components/u-swiper/u-swiper.vue"
import mTabBar from "@/components/m-tabBar/mTabBar.vue";
export default {
components: {
weather,
Uswiper
Uswiper,
mTabBar
},
data() {
return {
@ -258,6 +269,11 @@ export default {
a: 0,
b: 1,
images: [],
guanggaoList: [
{
url: 'https://eluyou.ailuquan.cn/upload/image/2024/mapIcon/daolan/guanggao.png'
}
],
cla: "swp_1_img dhua",
cla2: "swp_1_img dhua2",
clas: ["swp_1_img dhua", "swp_1_img dhua2"],
@ -267,12 +283,14 @@ export default {
scrollTop: 0,
blur: 0,
height: 'fit-content',
isFixed: false,
sumHeight:1000
};
},
onReady() {
let menuButtonInfo = uni.getMenuButtonBoundingClientRect()
this.height = menuButtonInfo.height + menuButtonInfo.top + "px";
console.log(menuButtonInfo.height, 'menuButtonInfo.height')
this.height = menuButtonInfo.height + menuButtonInfo.top;
},
onLoad(option) {
var that = this;
@ -337,14 +355,56 @@ export default {
},
methods: {
clickSwiper(e) {
console.log('点击轮播图', e)
uni.showToast({
title: "功能正在开发中~",
icon: "none",
duration: 2000,
});
},
goQuanyi() {
uni.showToast({
title: "功能正在开发中~",
icon: "none",
duration: 2000,
});
},
onScroll(event) {
// const query = uni.createSelectorQuery().in(this);
// let sumHeight = 0
// //
// query
// .select('#home_serch_1')
// .boundingClientRect()
// .select('#m-bankuai')
// .boundingClientRect()
// .select('#guanggao-swiper')
// .boundingClientRect()
// .select('#quanyi-box')
// .boundingClientRect()
// .select('#home_pic_static')
// .boundingClientRect().
// select('#news-box')
// .boundingClientRect()
// .exec((results) => {
// results.forEach((data) => {
// if (data) {
// sumHeight += data.height;
// }
// });
// this.sumHeight = sumHeight;
// console.log(':', sumHeight);
// });
// console.log(event.detail.scrollTop, 'event.detail.scrollTop')
// if (event.detail.scrollTop >= this.sumHeight) {
// this.isFixed = true;
// } else {
// this.isFixed = false;
// }
this.scrollTop = event.detail.scrollTop;
if(this.scrollTop > 150){
if (this.scrollTop > 150) {
this.autoplay = false;
}else{
} else {
this.autoplay = true;
}
this.updateBackgroundColor();
@ -695,12 +755,13 @@ export default {
overflow-x: scroll;
display: flex;
align-items: center;
justify-content: space-around;
padding: 0 20rpx;
position: relative;
margin-top: 20rpx;
.m-slide-item {
width: 33%;
width: fit-content;
font-family: Source Han Sans SC;
font-weight: 400;
font-size: 30rpx;
@ -717,45 +778,49 @@ export default {
.curr {
scale: 1.1;
background-image: url("@/static/animg/index/active-nav-bg.png");
background-repeat: no-repeat;
background-size: 30%;
background-position: 50% 15px;
padding-bottom: 10px;
position: relative;
&::after {
content: "";
width: 50rpx;
height: 60rpx;
background-image: url("https://eluyou.ailuquan.cn/upload/image/2024/mapIcon/daolan/lu.png");
background-size: contain;
background-repeat: no-repeat;
background-position: center;
position: absolute;
left: -15rpx;
top: -15rpx;
z-index: -1;
}
&::before {
content: "";
width: 80%;
height: 10rpx;
background: linear-gradient(-90deg, rgba(9, 131, 255, 0) 0%, #0983FF 100%);
border-radius: 5rpx;
position: absolute;
bottom: 8rpx;
left: 50%;
transform: translateX(-50%);
z-index: -1;
}
}
}
.slide-nav-fixed {
position: fixed;
}
.m-slide-nav::-webkit-scrollbar {
display: none;
}
.m-slide-nav::before {
content: "";
width: 143rpx;
height: 100%;
position: absolute;
left: 0;
top: 0;
background-image: url("@/static/animg/index/left-bg.png");
background-repeat: no-repeat;
background-size: contain;
background-position: center;
z-index: 0;
}
.m-slide-nav::after {
content: "";
width: 340rpx;
height: 100%;
position: absolute;
right: 0;
top: 0;
background-image: url("https://eluyou.ailuquan.cn/upload/image/2024/mapIcon/daolan/right-bg.png");
background-repeat: no-repeat;
background-size: contain;
background-position: center;
z-index: 0;
}
.an_box {
margin-bottom: 0rpx !important;
@ -841,7 +906,7 @@ export default {
.tit {
width: fit-content;
margin-top: 18rpx;
margin-left: 23rpx;
margin-left: 26rpx;
font-weight: bolder;
}
}
@ -980,6 +1045,20 @@ export default {
.no-fixed-box {
position: relative;
top: 500px;
background-color: #fff
background-color: #fff;
.guanggao-swiper {
margin: 20rpx 30rpx 0;
}
.quanyi-box {
margin: 30rpx 0 0;
height: fit-content;
image {
width: 100%;
}
}
}
</style>

@ -53,6 +53,10 @@
</view>
</view>
<view class="share-box">
<image src="https://eluyou.ailuquan.cn/upload/image/2024/mapIcon/daolan/share.png"></image>
<button class="btns" open-type="share" plain></button>
</view>
<view class="m-my-menu-list">
<view class="btn-item" hover-class="active-btn" @click="goPage('yijian')">
<view class="btn-img">
@ -103,6 +107,7 @@
</view>
</view>
<f-login></f-login>
<m-tabBar :activeIndex="3"></m-tabBar>
</view>
</template>
@ -111,7 +116,13 @@ import {
mapState,
mapMutations
} from 'vuex';
import mTabBar from "@/components/m-tabBar/mTabBar.vue";
export default {
components: {
mTabBar
},
data() {
return {
haedBg: this.$config.ROOTPATH + "/upload/image/2024/mapIcon/daolan/mybg.png"
@ -398,7 +409,7 @@ export default {
display: flex;
align-items: center;
border-radius: 25rpx;
padding: 30rpx 30rpx;
padding: 20rpx 30rpx;
.btns {
background-color: unset;
@ -482,4 +493,27 @@ export default {
margin-top: 32rpx;
margin-bottom: 28rpx;
}
.share-box{
padding: 0 20rpx;
margin-bottom: 20rpx;
height: 120rpx;
position: relative;
image{
width: 100%;
height: 100%;
}
.btns{
width: 100%;
height: 100%;
position: absolute;
left: 0;
top: 0;
z-index: 99;
background-color: transparent;
border: none;
}
}
</style>

@ -5,6 +5,14 @@
:latitude="latitude" :longitude="longitude" :markers="covers"></map>
</view>
<view class="top-nav">
<view class="ico-box" :class="chose == 'scenic' ? 'curr' : ''" @click="selectIcon('scenic')">
<image class="cb" :src="scenic"></image>
<view class="ico-text">景区</view>
</view>
<view class="ico-box" :class="chose == 'hotel' ? 'curr' : ''" @click="selectIcon('hotel')">
<image class="cb" :src="hotel"></image>
<view class="ico-text">酒店</view>
</view>
<view class="ico-box" :class="chose == 'toilet' ? 'curr' : ''" @click="selectIcon('toilet')">
<image class="cb" :src="toilet"></image>
<view class="ico-text">找厕所</view>
@ -21,14 +29,6 @@
<image class="cb" :src="pano"></image>
<view class="ico-text">派出所</view>
</view>
<view class="ico-box" :class="chose == 'scenic' ? 'curr' : ''" @click="selectIcon('scenic')">
<image class="cb" :src="scenic"></image>
<view class="ico-text">景区</view>
</view>
<view class="ico-box" :class="chose == 'hotel' ? 'curr' : ''" @click="selectIcon('hotel')">
<image class="cb" :src="hotel"></image>
<view class="ico-text">酒店</view>
</view>
</view>
<view>
<view class="tan" v-if="isShow" :style="{ height: height_2 + 'px' }">
@ -56,7 +56,7 @@
<image class="ot" src="/static/animg/daolan/other.png"></image>
<text class="other">其他</text>
</view>
</view>
</view>
<view class="pop-content" v-if="visualDialog" :class="visualDialog ? 'show' : 'unShow'">
@ -87,17 +87,21 @@
</uni-popup> -->
</view>
<m-tabBar :activeIndex="1"></m-tabBar>
</view>
</template>
<script>
import uniPopup from "@/uni_modules/uni-popup/components/uni-popup/uni-popup.vue";
import uniIcon from "@/uni_modules/uni-icons/components/uni-icons/uni-icons.vue";
import mTabBar from "@/components/m-tabBar/mTabBar.vue";
var that;
var mapId = "map";
export default {
components: {
uniPopup,
uniIcon,
mTabBar
},
data() {
that = this;
@ -144,6 +148,9 @@ export default {
netType: true,
};
},
onShow(){
uni.hideHomeButton()
},
onLoad() {
var that = this;
this.$util.getNetworkType(
@ -811,7 +818,7 @@ export default {
.ico-text {
font-family: Source Han Sans SC;
font-weight: 400;
font-size: 20rpx;
font-size: 24rpx;
color: #1b1b1b;
}
@ -891,7 +898,7 @@ export default {
left: 0;
right: 0;
width: 100%;
z-index: 3;
z-index: 11;
bottom: 0rpx;
.top-daohang {
@ -926,28 +933,28 @@ export default {
}
.daohang {
width: 120rpx;
height: fit-content;
background: linear-gradient(-90deg, #0983FF, #57ABFF);
border-radius: 38rpx;
font-family: Source Han Sans SC;
font-weight: 400;
font-size: 30rpx;
color: #FFFFFF;
display: flex;
align-items: center;
justify-content: space-between;
padding: 10rpx 15px;
margin-right: 20rpx;
.ot {
width: 20rpx;
height: 20rpx;
margin-right: 10rpx;
}
width: 120rpx;
height: fit-content;
background: linear-gradient(-90deg, #0983FF, #57ABFF);
border-radius: 38rpx;
font-family: Source Han Sans SC;
font-weight: 400;
font-size: 30rpx;
color: #FFFFFF;
display: flex;
align-items: center;
justify-content: space-between;
padding: 10rpx 15px;
margin-right: 20rpx;
.ot {
width: 20rpx;
height: 20rpx;
margin-right: 10rpx;
}
}
.address {
font-family: Source Han Sans SC;
font-weight: 400;
@ -961,10 +968,11 @@ export default {
margin-top: 20rpx;
margin-left: 40rpx;
.ot{
.ot {
height: 20rpx;
width: 20rpx;
}
}
.other {
font-family: Source Han Sans SC;
font-weight: 400;
@ -974,7 +982,7 @@ export default {
margin-left: 10rpx;
}
}
}
@ -999,8 +1007,8 @@ export default {
border: 1rpx solid transparent;
display: flex;
justify-content: center;
padding: 15rpx 25rpx;
width: 120rpx;
padding: 15rpx 15rpx;
width: 130rpx;
flex: none;
position: relative;

@ -392,6 +392,9 @@ s首页菜单
height: 30rpx;
margin-right: 15rpx;
}
.sch_2_span{
font-size: 22rpx;
}
.xi_icn {
width: 36rpx;
height: 36rpx;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

@ -29,7 +29,7 @@ export default {
},
onLoad(options) {
if (options.isRedirect == '1') {
uni.switchTab({
uni.reLaunch({
url: '/pages/personcenter'
});
}

@ -7,7 +7,7 @@
onLoad(options) {
if(options.type == "person"){
this.$param.user_info = options;
uni.switchTab({
uni.reLaunch({
url:"/pages/personcenter"
})
}else if(options.type == "scenicdetail"){
@ -15,7 +15,7 @@
url:"/subPageA/scenic/scenicdetial/scenicdetial?unionid="+options.unionid+"&nickname="+options.nickname+"&headimgurl="+options.headimgurl+"&openid="+options.openid+"&suitid="+options.suitid+"&guid="+options.guid
})
}else{
uni.switchTab({
uni.reLaunch({
url:"/pages/personcenter"
})
}

@ -151,7 +151,7 @@ innerAudioContext.autoplay = true;
this.textbut = false;
},
goToIndex:function(){
uni.switchTab({
uni.reLaunch({
url: "/pages/index/index"
})
},

Loading…
Cancel
Save