From 00a7a61df86db969f2ba61c508d02ba4709ce3d4 Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期五, 05 六月 2026 10:09:06 +0800
Subject: [PATCH] 改bug
---
small-program/components/custom-tabbar/custom-tabbar.vue | 45 ++++++++++++++++++++++++++++++++++++---------
1 files changed, 36 insertions(+), 9 deletions(-)
diff --git a/small-program/components/custom-tabbar/custom-tabbar.vue b/small-program/components/custom-tabbar/custom-tabbar.vue
index 8de2fe5..720b4e1 100644
--- a/small-program/components/custom-tabbar/custom-tabbar.vue
+++ b/small-program/components/custom-tabbar/custom-tabbar.vue
@@ -3,10 +3,11 @@
<view class="custom-tabbar" :style="{ paddingBottom: safeAreaBottom + 'px' }">
<view class="tabbar-item" v-for="(item, index) in tabList" :key="index" @click="switchTab(item)">
<image class="tabbar-icon" :src="currentIndex === index ? item.selectedIconPath : item.iconPath" mode="aspectFit"></image>
- <text class="tabbar-text" :class="{ active: currentIndex === index }">{{ item.text }}</text>
+ <text class="tabbar-text" :class="{ active: currentIndex === index, shop: userType === 1 }">{{ item.text }}</text>
</view>
</view>
<view class="tabbar-placeholder" :style="{ height: '100px' }"></view>
+ <auth-login :show="showLogin" @close="showLogin = false"></auth-login>
</view>
</template>
@@ -17,6 +18,8 @@
data() {
return {
safeAreaBottom: 0,
+ showLogin: false,
+ currentPath: '',
memberTabList: [
{
text: '棣栭〉',
@@ -48,7 +51,7 @@
text: '棣栭〉',
pagePath: '/shop/pages/store-home/store-home',
iconPath: '/static/icon/nav_home@2x.png',
- selectedIconPath: '/static/icon/nav_home_sel@2x.png'
+ selectedIconPath: '/static/shopTabbar/nav_home_sel@2x.png'
},
{
text: '閽卞寘',
@@ -60,25 +63,22 @@
text: '娑堟伅',
pagePath: '/shop/pages/message/message',
iconPath: '/static/icon/nav_xiaoxi@2x.png',
- selectedIconPath: '/static/icon/nav_xiaoxi_sel@2x.png'
+ selectedIconPath: '/static/shopTabbar/nav_xiaoxi_sel@2x.png'
},
{
text: '鎴戠殑',
pagePath: '/shop/pages/mine/mine',
iconPath: '/static/icon/nav_wode@2x.png',
- selectedIconPath: '/static/icon/nav_wode_sel@2x.png'
+ selectedIconPath: '/static/shopTabbar/nav_wode_sel@2x.png'
}
]
}
},
computed: {
- ...mapState(['userType']),
+ ...mapState(['userType', 'token']),
currentIndex() {
- const pages = getCurrentPages()
- const currentPage = pages[pages.length - 1]
- const currentPath = '/' + currentPage.route
const list = this.tabList
- const index = list.findIndex(item => item.pagePath === currentPath)
+ const index = list.findIndex(item => item.pagePath === this.currentPath)
return index > -1 ? index : 0
},
tabList() {
@@ -90,13 +90,36 @@
},
created() {
this.getSafeAreaBottom()
+ this.updateCurrentPath()
+ },
+ onShow() {
+ this.updateCurrentPath()
+ },
+ watch: {
+ userType() {
+ this.$forceUpdate()
+ }
+ },
+ activated() {
+ this.$forceUpdate()
},
methods: {
getSafeAreaBottom() {
const systemInfo = uni.getSystemInfoSync()
this.safeAreaBottom = systemInfo.safeAreaInsets.bottom || 0
},
+ updateCurrentPath() {
+ const pages = getCurrentPages()
+ if (pages.length > 0) {
+ const currentPage = pages[pages.length - 1]
+ this.currentPath = '/' + currentPage.route
+ }
+ },
switchTab(item) {
+ if (item.pagePath === '/pages/itinerary/itinerary' && !this.token) {
+ this.showLogin = true
+ return
+ }
const currentPath = getCurrentPages()[getCurrentPages().length - 1].$page.fullPath
if (this.userType === 1) {
if (currentPath !== item.pagePath) {
@@ -163,5 +186,9 @@
&.active {
color: #1ba8fa;
}
+
+ &.shop.active {
+ color: #004096;
+ }
}
</style>
--
Gitblit v1.9.3