refactor(router): 重构路由配置和底部导航栏逻辑
- 调整路由路径和图标配置,优化页面导航结构 - 根据用户角色动态显示不同的底部导航栏选项 - 清理个人中心页面的无用代码,简化界面
This commit is contained in:
parent
03a01e93b1
commit
d610d3cebc
|
|
@ -1,22 +1,45 @@
|
||||||
<script setup lang="ts">
|
<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 tabbarItemList = computed(() => {
|
||||||
const routes = router.getRoutes()
|
if (wxStore.isCabinetAdmin) {
|
||||||
return routes.filter(route => route.meta.layout?.tabbar?.showTabbar
|
return [{
|
||||||
&& route.path !== '/cabinet'
|
title: '柜机管理',
|
||||||
&& route.path!== '/approval/list'
|
icon: 'manager-o',
|
||||||
&& route.path!== '/approvalAsset/list'
|
path: '/cabinet'
|
||||||
)
|
}, {
|
||||||
.map(route => ({
|
title: '审批中心',
|
||||||
title: route.meta.title,
|
icon: 'records-o',
|
||||||
icon: route.meta.layout?.tabbar?.icon,
|
path: '/approval/list'
|
||||||
path: route.path
|
}, {
|
||||||
}))
|
title: '我的',
|
||||||
})
|
icon: 'user-o',
|
||||||
|
path: '/'
|
||||||
import { useWxStoreOutside } from '@/pinia/stores/wx'
|
}]
|
||||||
const wxStore = useWxStoreOutside()
|
} else {
|
||||||
|
return [{
|
||||||
|
title: '我的',
|
||||||
|
icon: 'user-o',
|
||||||
|
path: '/'
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,7 @@ wxStore.refreshBalance();
|
||||||
<van-col span="24">
|
<van-col span="24">
|
||||||
<div class="section-title text-sm font-bold pb-2">个人中心</div>
|
<div class="section-title text-sm font-bold pb-2">个人中心</div>
|
||||||
</van-col>
|
</van-col>
|
||||||
<van-col span="8">
|
<!-- <van-col span="8">
|
||||||
<div class="custom-btn" @click="router.push('/order-list')">
|
<div class="custom-btn" @click="router.push('/order-list')">
|
||||||
<van-icon name="orders-o" size="20px" />
|
<van-icon name="orders-o" size="20px" />
|
||||||
<span>订单列表</span>
|
<span>订单列表</span>
|
||||||
|
|
@ -114,7 +114,7 @@ wxStore.refreshBalance();
|
||||||
<van-icon name="orders-o" size="20px" />
|
<van-icon name="orders-o" size="20px" />
|
||||||
<span>我的柜子</span>
|
<span>我的柜子</span>
|
||||||
</div>
|
</div>
|
||||||
</van-col>
|
</van-col> -->
|
||||||
<van-col span="8">
|
<van-col span="8">
|
||||||
<div class="custom-btn" @click="showBindDialog = true">
|
<div class="custom-btn" @click="showBindDialog = true">
|
||||||
<van-icon name="friends-o" size="20px" />
|
<van-icon name="friends-o" size="20px" />
|
||||||
|
|
@ -127,7 +127,7 @@ wxStore.refreshBalance();
|
||||||
<span>商品管理</span>
|
<span>商品管理</span>
|
||||||
</div>
|
</div>
|
||||||
</van-col> -->
|
</van-col> -->
|
||||||
<van-col span="8">
|
<!-- <van-col span="8">
|
||||||
<div v-if="wxStore.isCabinetAdmin" class="custom-btn" @click="router.push('/cabinet')">
|
<div v-if="wxStore.isCabinetAdmin" class="custom-btn" @click="router.push('/cabinet')">
|
||||||
<van-icon name="manager-o" size="20px" />
|
<van-icon name="manager-o" size="20px" />
|
||||||
<span>柜机管理</span>
|
<span>柜机管理</span>
|
||||||
|
|
@ -138,14 +138,14 @@ wxStore.refreshBalance();
|
||||||
<van-icon name="comment-o" size="20px" />
|
<van-icon name="comment-o" size="20px" />
|
||||||
<span>审批中心</span>
|
<span>审批中心</span>
|
||||||
</div>
|
</div>
|
||||||
</van-col>
|
</van-col> -->
|
||||||
<van-col span="8">
|
<van-col span="8">
|
||||||
<div v-if="wxStore.isCabinetAdmin" class="custom-btn" @click="router.push('/approvalAsset/list')">
|
<div v-if="wxStore.isCabinetAdmin" class="custom-btn" @click="router.push('/approvalAsset/list')">
|
||||||
<van-icon name="comment-o" size="20px" />
|
<van-icon name="comment-o" size="20px" />
|
||||||
<span>耗材核销</span>
|
<span>耗材核销</span>
|
||||||
</div>
|
</div>
|
||||||
</van-col>
|
</van-col>
|
||||||
<!-- <van-col span="8"></van-col> -->
|
<van-col span="8"></van-col>
|
||||||
</van-row>
|
</van-row>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -119,7 +119,7 @@ export const routes: RouteRecordRaw[] = [
|
||||||
},
|
},
|
||||||
tabbar: {
|
tabbar: {
|
||||||
showTabbar: true,
|
showTabbar: true,
|
||||||
icon: "home-o"
|
icon: "manager-o"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -138,7 +138,7 @@ export const routes: RouteRecordRaw[] = [
|
||||||
},
|
},
|
||||||
tabbar: {
|
tabbar: {
|
||||||
showTabbar: true,
|
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"),
|
component: () => import("@/pages/product/ProductList.vue"),
|
||||||
name: "ProductList",
|
name: "ProductList",
|
||||||
meta: {
|
meta: {
|
||||||
|
|
@ -194,14 +194,14 @@ export const routes: RouteRecordRaw[] = [
|
||||||
showLeftArrow: false
|
showLeftArrow: false
|
||||||
},
|
},
|
||||||
tabbar: {
|
tabbar: {
|
||||||
showTabbar: true,
|
showTabbar: false,
|
||||||
icon: "home-o"
|
icon: "home-o"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/me",
|
path: "/",
|
||||||
component: () => import("@/pages/me/index.vue"),
|
component: () => import("@/pages/me/index.vue"),
|
||||||
name: "Me",
|
name: "Me",
|
||||||
meta: {
|
meta: {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue