chuangte_bike_newxcx/page_shanghu/components/tab-bar/tab-bar.vue

166 lines
5.0 KiB
Vue
Raw Normal View History

2025-04-01 21:35:30 +08:00
<template>
<view class="cont">
<view class="tab" @tap.stop="changeTabbar(0)">
2025-12-20 14:29:10 +08:00
<image src="https://api.ccttiot.com/smartmeter/img/static/u6fuq1szGMLmkcv5VQXM" mode="" v-show="indexs!=0"></image>
<image src="https://api.ccttiot.com/smartmeter/img/static/u32eknPAKCj8uPUS0hZE" mode="" v-show="indexs==0"></image>
2025-04-01 21:35:30 +08:00
<view class="txt" :class="indexs==0?'act1':''" >工作台</view>
</view>
<view class="tab" @tap.stop="changeTabbar(1)">
2025-12-20 14:29:10 +08:00
<image src="https://api.ccttiot.com/smartmeter/img/static/uIgOSoj6pRjPbiq7yxT5" mode="" v-show="indexs!=1"></image>
<image src="https://api.ccttiot.com/smartmeter/img/static/uvEJsaNT3zNm414Zqwk3" mode="" v-show="indexs==1"></image>
<view class="txt" :class="indexs==1?'act1':''" >车辆</view>
2025-04-01 21:35:30 +08:00
</view>
<view class="tab" @tap.stop="changeTabbar(2)">
2025-12-20 14:29:10 +08:00
<image src="https://api.ccttiot.com/smartmeter/img/static/uhYr3Q8qXwhA5iF8ycSE" mode="" v-show="indexs!=2"></image>
<image src="https://api.ccttiot.com/smartmeter/img/static/uSzWy6AkAAZKt9Ba62pB" mode="" v-show="indexs==2"></image>
2025-04-01 21:35:30 +08:00
<view class="txt" :class="indexs==2?'act1':''">地图</view>
</view>
<view class="tab" @tap.stop="changeTabbar(3)">
2025-12-20 14:29:10 +08:00
<image src="https://api.ccttiot.com/smartmeter/img/static/ux3v5fFIGSRiWN3RELnf" mode="" v-show="indexs!=3"></image>
<image src="https://api.ccttiot.com/smartmeter/img/static/uC7zgK8bYA06IXkS7LaT" mode="" v-show="indexs==3"></image>
2025-04-01 21:35:30 +08:00
<view class="txt" :class="indexs==3?'act1':''">订单</view>
</view>
2025-12-20 14:29:10 +08:00
<view class="tab" style="position: relative;z-index: 2;" @tap.stop="changeTabbar(4)">
<image src="https://api.ccttiot.com/smartmeter/img/static/uEdWHXV4r8Hdodsz4z6B" mode="" v-show="indexs!=4"></image>
<image src="https://api.ccttiot.com/smartmeter/img/static/uWRC03TXuhO1UiTI4TFN" mode="" v-show="indexs==4"></image>
<image v-show="indexs==4" style="position: absolute;top: -15rpx;right: -26rpx;width: 156rpx;height: 130rpx;z-index: -1;" src="https://api.ccttiot.com/smartmeter/img/static/uevEQDn3Gt6vjTcwQ4g2" mode=""></image>
<view class="txt" :class="indexs==4?'act2':''">我的</view>
</view>
2025-04-01 21:35:30 +08:00
<!-- <view class="u-page">
</view> -->
<!-- 与包裹页面所有内容的元素u-page同级且在它的下方 -->
<!-- <u-tabbar v-model="current" :list="list" icon-size='40rpx' active-color='#3996fd' inactive-color="#c8c7cb"></u-tabbar> -->
</view>
</template>
<script>
export default {
props: {
indexs: [Number, String], //题目id
},
data() {
return {
currentTabbarIndex: 0,
// 自定义底栏对应页面的加载情况
tabberPageLoadFlag: [],
ispop: false,
}
},
mounted() {
this.currentTabbarIndex = this.indexs
// const index = Number(this.indexs || 0)
// // 根据底部tabbar菜单列表设置对应页面的加载情况
// for (let i = 0; i < 5; i++) {
// this.tabberPageLoadFlag.push(i === index)
// }
// this.changeTabbar(index)
},
methods:{
changeTabbar(index) {
let that =this
if (this.currentTabbarIndex === index) return
// this._switchTabbarPage(index)
if(index==0){
uni.redirectTo({
url:'/page_shanghu/guanli/admin_worke',
routeType: 'wx://modal',
success() {
that.currentTabbarIndex = index
}
})
console.log('点击了',index);
}else if(index==2){
uni.redirectTo({
url:'/page_shanghu/admin_index',
routeType: 'wx://modal',
success() {
that.currentTabbarIndex = index
}
})
}else if(index==3){
uni.redirectTo({
url:'/page_shanghu/guanli/admin_order',
routeType: 'wx://modal',
success() {
that.currentTabbarIndex = index
}
})
}else if(index == 1){
uni.redirectTo({
2025-12-20 14:29:10 +08:00
url:'/page_shanghu/qbcheliang',
routeType: 'wx://modal',
success() {
that.currentTabbarIndex = index
}
})
}else if(index == 4){
uni.redirectTo({
url:'/page_shanghu/shmy',
2025-04-01 21:35:30 +08:00
routeType: 'wx://modal',
success() {
that.currentTabbarIndex = index
}
})
}
},
}
}
</script>
<style lang="scss" scoped>
2025-09-22 17:08:55 +08:00
::v-deep.u-tabbar__content__item__button {
2025-04-01 21:35:30 +08:00
top: 20rpx !important;
}
2025-09-22 17:08:55 +08:00
::v-deep.u-tabbar {
2025-04-01 21:35:30 +08:00
.u-tabbar__content__item:nth-child(2) {
.u-tabbar__content__item__button {
width: 32rpx !important;
}
}
}
.cont {
padding: 15rpx 0 30rpx;
position: fixed;
// left: 60rpx;
bottom: 0rpx;
width: 750rpx;
height: 130rpx;
background: #FFFFFF;
box-shadow: 0rpx 16rpx 40rpx 0rpx rgba(53, 140, 255, 0.1);
// border-radius: 60rpx;
display: flex;
// align-items: center;
justify-content: space-around;
2025-12-20 14:29:10 +08:00
// border-top: 2rpx solid #95989D;
2025-04-01 21:35:30 +08:00
.tab{
width: 100rpx;
display: flex;
flex-wrap: wrap;
justify-content: center;
image{
2025-12-20 14:29:10 +08:00
width: 56rpx;
height: 56rpx;
2025-04-01 21:35:30 +08:00
}
.txt{
text-align: center;
width: 100%;
margin-top: 4rpx;
font-size: 20rpx;
font-family: HarmonyOS Sans SC, HarmonyOS Sans SC;
font-weight: 400;
color: #95989D;
}
.act1{
2025-12-20 14:29:10 +08:00
color: #3D3D3D;
}
.act2{
color: #fff;
2025-04-01 21:35:30 +08:00
}
}
}
</style>