perf: 优化menu组件逻辑、登陆页面交互样式
This commit is contained in:
@ -146,7 +146,7 @@ export default defineComponent({
|
||||
}
|
||||
.arco-menu-title {
|
||||
color: var(--Text-2, #3c4043);
|
||||
font-family: 'PuHuiTi-Regular';
|
||||
font-family: 'PuHuiTi-Medium';
|
||||
font-size: 16px;
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
|
||||
@ -9,6 +9,7 @@ import { MENU_GROUP_IDS } from '@/router/constants';
|
||||
import router from '@/router';
|
||||
import { useRoute } from 'vue-router';
|
||||
import ExitAccountModal from '@/components/_base/exit-account-modal/index.vue';
|
||||
import { appRoutes } from '@/router/routes';
|
||||
|
||||
interface MenuItem {
|
||||
name: string;
|
||||
@ -56,21 +57,31 @@ const handleSelect = (index: any) => {
|
||||
}
|
||||
};
|
||||
|
||||
const flattenRoutes = (routes: any, parentPath = ''): any[] => {
|
||||
let result: any[] = [];
|
||||
for (const route of routes) {
|
||||
const fullPath = route.path.startsWith('/') ? route.path : parentPath.replace(/\/$/, '') + '/' + route.path;
|
||||
if (route.children && route.children.length) {
|
||||
result = result.concat(flattenRoutes(route.children, fullPath));
|
||||
} else {
|
||||
result.push({ ...route, fullPath });
|
||||
}
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
const handleDopdownClick = (index: any, ind: any) => {
|
||||
const { children } = lists.value[index];
|
||||
const indPath = children[ind] as any;
|
||||
if (indPath.name === '行业热门话题洞察') {
|
||||
router.push('/dataEngine/hotTranslation');
|
||||
} else if (indPath.name === '行业词云') {
|
||||
router.push('/dataEngine/hotCloud');
|
||||
} else if (indPath.name === '行业关键词动向') {
|
||||
router.push('/dataEngine/keyWord');
|
||||
} else if (indPath.name === '用户痛点观察') {
|
||||
router.push('/dataEngine/userPainPoints');
|
||||
} else if (indPath.name === '重点品牌动向') {
|
||||
router.push('/dataEngine/keyBrandMovement');
|
||||
} else if (indPath.name === '用户画像') {
|
||||
router.push('/dataEngine/userPersona');
|
||||
const indPath = children[ind];
|
||||
|
||||
const allChildren = flattenRoutes(appRoutes);
|
||||
|
||||
const target = allChildren.find((item) => item.meta && item.meta.menuId === indPath.id);
|
||||
|
||||
if (target) {
|
||||
router.push(target.fullPath);
|
||||
} else {
|
||||
console.warn('未找到对应的菜单路由', indPath.id);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user