refactor(router): 重构路由配置和底部导航栏逻辑

- 调整路由路径和图标配置,优化页面导航结构
- 根据用户角色动态显示不同的底部导航栏选项
- 清理个人中心页面的无用代码,简化界面
This commit is contained in:
dzq 2025-11-26 09:55:10 +08:00
parent 03a01e93b1
commit d610d3cebc
3 changed files with 49 additions and 26 deletions

View File

@ -1,22 +1,45 @@
<script setup lang="ts">
const router = useRouter()
import { useWxStoreOutside } from '@/pinia/stores/wx';
const router = useRouter();
const wxStore = useWxStoreOutside();
// const tabbarItemList = computed(() => {
// const routes = router.getRoutes()
// return routes.filter(route => route.meta.layout?.tabbar?.showTabbar
// && route.path!== '/approvalAsset/list'
// && route.path!== '/productList'
// )
// .map(route => ({
// title: route.meta.title,
// icon: route.meta.layout?.tabbar?.icon,
// path: route.path
// }))
// });
const tabbarItemList = computed(() => {
const routes = router.getRoutes()
return routes.filter(route => route.meta.layout?.tabbar?.showTabbar
&& route.path !== '/cabinet'
&& route.path!== '/approval/list'
&& route.path!== '/approvalAsset/list'
)
.map(route => ({
title: route.meta.title,
icon: route.meta.layout?.tabbar?.icon,
path: route.path
}))
})
import { useWxStoreOutside } from '@/pinia/stores/wx'
const wxStore = useWxStoreOutside()
if (wxStore.isCabinetAdmin) {
return [{
title: '柜机管理',
icon: 'manager-o',
path: '/cabinet'
}, {
title: '审批中心',
icon: 'records-o',
path: '/approval/list'
}, {
title: '我的',
icon: 'user-o',
path: '/'
}]
} else {
return [{
title: '我的',
icon: 'user-o',
path: '/'
}]
}
});
</script>
<template>

View File

@ -103,7 +103,7 @@ wxStore.refreshBalance();
<van-col span="24">
<div class="section-title text-sm font-bold pb-2">个人中心</div>
</van-col>
<van-col span="8">
<!-- <van-col span="8">
<div class="custom-btn" @click="router.push('/order-list')">
<van-icon name="orders-o" size="20px" />
<span>订单列表</span>
@ -114,7 +114,7 @@ wxStore.refreshBalance();
<van-icon name="orders-o" size="20px" />
<span>我的柜子</span>
</div>
</van-col>
</van-col> -->
<van-col span="8">
<div class="custom-btn" @click="showBindDialog = true">
<van-icon name="friends-o" size="20px" />
@ -127,7 +127,7 @@ wxStore.refreshBalance();
<span>商品管理</span>
</div>
</van-col> -->
<van-col span="8">
<!-- <van-col span="8">
<div v-if="wxStore.isCabinetAdmin" class="custom-btn" @click="router.push('/cabinet')">
<van-icon name="manager-o" size="20px" />
<span>柜机管理</span>
@ -138,14 +138,14 @@ wxStore.refreshBalance();
<van-icon name="comment-o" size="20px" />
<span>审批中心</span>
</div>
</van-col>
</van-col> -->
<van-col span="8">
<div v-if="wxStore.isCabinetAdmin" class="custom-btn" @click="router.push('/approvalAsset/list')">
<van-icon name="comment-o" size="20px" />
<span>耗材核销</span>
</div>
</van-col>
<!-- <van-col span="8"></van-col> -->
<van-col span="8"></van-col>
</van-row>
</div>

View File

@ -119,7 +119,7 @@ export const routes: RouteRecordRaw[] = [
},
tabbar: {
showTabbar: true,
icon: "home-o"
icon: "manager-o"
}
}
}
@ -138,7 +138,7 @@ export const routes: RouteRecordRaw[] = [
},
tabbar: {
showTabbar: true,
icon: "home-o"
icon: "records-o"
}
}
}
@ -182,7 +182,7 @@ export const routes: RouteRecordRaw[] = [
}
}, */
{
path: "/",
path: "/productList",
component: () => import("@/pages/product/ProductList.vue"),
name: "ProductList",
meta: {
@ -194,14 +194,14 @@ export const routes: RouteRecordRaw[] = [
showLeftArrow: false
},
tabbar: {
showTabbar: true,
showTabbar: false,
icon: "home-o"
}
}
}
},
{
path: "/me",
path: "/",
component: () => import("@/pages/me/index.vue"),
name: "Me",
meta: {