feat: 修改获取路由列表
This commit is contained in:
@ -1,17 +1,10 @@
|
|||||||
/*
|
|
||||||
* @Author: rd 1344903914@qq.com
|
|
||||||
* @Date: 2025-07-08 11:22:05
|
|
||||||
* @LastEditors: rd 1344903914@qq.com
|
|
||||||
* @LastEditTime: 2025-07-08 14:06:41
|
|
||||||
* @FilePath: /lingji-work-fe/src/stores/modules/side-bar/constants.ts
|
|
||||||
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
||||||
*/
|
|
||||||
import { MENU_GROUP_IDS } from '@/router/constants';
|
import { MENU_GROUP_IDS } from '@/router/constants';
|
||||||
export const MENU_LIST = [
|
export const MENU_LIST = [
|
||||||
{
|
{
|
||||||
id: MENU_GROUP_IDS.WORK_BENCH_ID,
|
id: MENU_GROUP_IDS.WORK_BENCH_ID,
|
||||||
name: '工作台',
|
name: '工作台',
|
||||||
pathName: 'Home',
|
pathName: 'Home',
|
||||||
|
pathNames: ['Home'],
|
||||||
requiresAuth: false,
|
requiresAuth: false,
|
||||||
permissionKey: '', // 权限key,如果为空,则表示该菜单不需要权限,与后端约定
|
permissionKey: '', // 权限key,如果为空,则表示该菜单不需要权限,与后端约定
|
||||||
},
|
},
|
||||||
@ -24,26 +17,32 @@ export const MENU_LIST = [
|
|||||||
{
|
{
|
||||||
name: '行业热门话题洞察',
|
name: '行业热门话题洞察',
|
||||||
pathName: 'DataEngineHotTranslation',
|
pathName: 'DataEngineHotTranslation',
|
||||||
|
pathNames: ['DataEngineHotTranslation'],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '行业词云',
|
name: '行业词云',
|
||||||
pathName: 'DataEngineHotCloud',
|
pathName: 'DataEngineHotCloud',
|
||||||
|
pathNames: ['DataEngineHotCloud'],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '行业关键词动向',
|
name: '行业关键词动向',
|
||||||
pathName: 'DataEngineKeyWord',
|
pathName: 'DataEngineKeyWord',
|
||||||
|
pathNames: ['DataEngineKeyWord'],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '用户痛点观察',
|
name: '用户痛点观察',
|
||||||
pathName: 'DataEngineUserPainPoints',
|
pathName: 'DataEngineUserPainPoints',
|
||||||
|
pathNames: ['DataEngineUserPainPoints'],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '重点品牌动向',
|
name: '重点品牌动向',
|
||||||
pathName: 'DataEngineKeyBrandMovement',
|
pathName: 'DataEngineKeyBrandMovement',
|
||||||
|
pathNames: ['DataEngineKeyBrandMovement'],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '用户画像',
|
name: '用户画像',
|
||||||
pathName: 'DataEngineUserPersona',
|
pathName: 'DataEngineUserPersona',
|
||||||
|
pathNames: ['DataEngineUserPersona'],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@ -56,18 +55,27 @@ export const MENU_LIST = [
|
|||||||
{
|
{
|
||||||
name: '品牌资产管理',
|
name: '品牌资产管理',
|
||||||
pathName: 'RepositoryBrandMaterials',
|
pathName: 'RepositoryBrandMaterials',
|
||||||
|
pathNames: ['RepositoryBrandMaterials'],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '账号资源中心',
|
name: '账号资源中心',
|
||||||
pathName: 'MediaAccountAccountManagement',
|
pathName: 'MediaAccountAccountManagement',
|
||||||
|
pathNames: ['MediaAccountAccountManagement', 'MediaAccountAccountDashboard', 'MediaAccountAccountDetails'],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '投放资源中心',
|
name: '投放资源中心',
|
||||||
pathName: 'PutAccountAccountManagement',
|
pathName: 'PutAccountAccountManagement',
|
||||||
|
pathNames: [
|
||||||
|
'PutAccountAccountData',
|
||||||
|
'PutAccountAccountDashboard',
|
||||||
|
'PutAccountInvestmentGuidelines',
|
||||||
|
'guideDetail',
|
||||||
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '智能方案管理',
|
name: '智能方案管理',
|
||||||
pathName: 'IntelligentSolutionBusinessAnalysisReport',
|
pathName: 'IntelligentSolutionBusinessAnalysisReport',
|
||||||
|
pathNames: ['IntelligentSolutionBusinessAnalysisReport', 'IntelligentSolutionCompetitiveProductAnalysisReport'],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|||||||
@ -93,16 +93,12 @@ export const useUserStore = defineStore('user', {
|
|||||||
menuList.forEach((item) => {
|
menuList.forEach((item) => {
|
||||||
if (item.children && item.children.length > 0) {
|
if (item.children && item.children.length > 0) {
|
||||||
item.children.forEach((child: any) => {
|
item.children.forEach((child: any) => {
|
||||||
const matchedRoute = appRoutes.find((route: any) => route.name === child.pathName);
|
const matchedRoute = appRoutes.filter((route: any) => child.pathNames.includes(route.name));
|
||||||
if (matchedRoute) {
|
this.allowAccessRoutes.push(...matchedRoute);
|
||||||
this.allowAccessRoutes.push(matchedRoute);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
const matchedRoute = appRoutes.find((route: any) => route.name === item.pathName);
|
const matchedRoute = appRoutes.filter((route: any) => item.pathNames.includes(route.name));
|
||||||
if (matchedRoute) {
|
this.allowAccessRoutes.push(...matchedRoute);
|
||||||
this.allowAccessRoutes.push(matchedRoute);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user