121 lines
3.1 KiB
Vue
Raw Normal View History

<template>
2025-05-20 08:53:11 +08:00
<div class="brand-layout">
<el-container class="brand-layout-container">
<el-aside class="brand-aside-menu">
<!-- 菜单部分 -->
2025-05-22 10:38:36 +08:00
<el-menu v-model:open="openMenus" :default-active="activeMenu" class="brand-aside-menu" @select="handleSelect">
2025-05-21 13:44:54 +08:00
<el-menu-item index="apply">
<img :src="getAssetsFile('images/brand/Apply.png')" class="menu-icon" alt="申请图标" />
2025-05-20 13:32:43 +08:00
<span>使用申请</span>
2025-05-20 08:53:11 +08:00
</el-menu-item>
2025-05-22 10:38:36 +08:00
<el-sub-menu index="auth">
<template #title>
<img :src="getAssetsFile('images/brand/autho.png')" class="menu-icon" />
<span>授权管理</span>
</template>
<el-menu-item index="auth/record"> 授权记录 </el-menu-item>
<el-menu-item index="auth/system"> 品牌制度 </el-menu-item>
</el-sub-menu>
2025-05-21 13:44:54 +08:00
<el-menu-item index="monitor">
<img :src="getAssetsFile('images/brand/supervision.png')" class="menu-icon" alt="" />
2025-05-20 08:53:11 +08:00
<span>使用监管</span>
</el-menu-item>
</el-menu>
</el-aside>
2025-05-20 08:53:11 +08:00
<el-main class="brand-main">
2025-05-21 13:44:54 +08:00
<router-view />
2025-05-20 08:53:11 +08:00
</el-main>
</el-container>
</div>
</template>
2025-05-20 08:53:11 +08:00
<script setup>
2025-05-22 10:38:36 +08:00
import { ref, computed } from 'vue';
2025-05-21 13:44:54 +08:00
import { useRoute, useRouter } from 'vue-router';
import { getAssetsFile } from '@/utils/index.js';
2025-05-21 13:44:54 +08:00
const router = useRouter();
const route = useRoute();
2025-05-22 10:38:36 +08:00
const openMenus = ref(['auth']);
const menuMap = {
apply: ['brandApplyList'],
'auth/record': ['brandAuth'],
'auth/system': ['brandSystem'],
monitor: ['brandMonitor'],
};
// 获取当前菜单激活项
2025-05-21 13:44:54 +08:00
const activeMenu = computed(() => {
2025-05-22 10:38:36 +08:00
const matched = Object.entries(menuMap).find(([key, names]) => names.includes(route.name));
// console.log(matched[0]);
2025-05-22 10:38:36 +08:00
return matched ? matched[0] : '';
2025-05-21 13:44:54 +08:00
});
2025-05-20 08:53:11 +08:00
// 菜单切换处理
2025-05-21 13:44:54 +08:00
function handleSelect(index) {
router.push(`/sub-operation-service/brand/${index}`);
}
</script>
2025-05-20 08:53:11 +08:00
<style lang="scss" scoped>
.brand-layout {
width: 100%;
height: calc(100vh - 230px);
.brand-layout-container {
height: 100%;
width: $width-main;
margin: auto;
.brand-aside-menu {
2025-05-22 10:38:36 +08:00
background-color: #fff;
border-radius: 16px;
border-right: 0;
:deep(.el-menu-item),
:deep(.el-sub-menu__title) {
font-size: 18px !important;
margin: 8px 12px;
span {
margin-left: 8px;
}
.menu-icon {
width: 24px;
height: 24px;
}
}
:deep(.el-sub-menu) {
2025-05-20 08:53:11 +08:00
.el-menu-item {
2025-05-22 10:38:36 +08:00
font-size: 16px !important;
margin: 4px 12px;
line-height: 40px;
2025-05-20 08:53:11 +08:00
span {
2025-05-22 10:38:36 +08:00
margin-left: 12px;
2025-05-20 08:53:11 +08:00
}
}
}
2025-05-22 10:38:36 +08:00
:deep(.is-active) {
> .el-sub-menu__title,
&.el-menu-item {
color: #409eff !important;
background-color: #f5f7fa;
}
}
2025-05-20 08:53:11 +08:00
}
.brand-main {
width: calc(100% - 240px - 16px);
margin-left: 16px;
// background-color: #f0f0f0;
padding: 0;
}
.brand-main::-webkit-scrollbar {
display: none;
}
}
}
</style>