diff --git a/web/src/layouts/backend/index.vue b/web/src/layouts/backend/index.vue index e23b8611..3bc95f63 100644 --- a/web/src/layouts/backend/index.vue +++ b/web/src/layouts/backend/index.vue @@ -8,7 +8,6 @@ import { useRoute } from 'vue-router' import Default from '/@/layouts/container/default.vue' import Classic from '/@/layouts/container/classic.vue' import Streamline from '/@/layouts/container/streamline.vue' -import menus from '/@/mock/router.json' // 模拟api请求数据 import { computed, onBeforeMount, onUnmounted } from 'vue' import { Session } from '/@/utils/storage' import { index } from '/@/api/backend' diff --git a/web/src/mock/router.json b/web/src/mock/router.json deleted file mode 100644 index 12030fd0..00000000 --- a/web/src/mock/router.json +++ /dev/null @@ -1,164 +0,0 @@ -[ - { - "title": "控制台", - "path": "/admin/dashboard", - "type": "tab", - "icon": "fa fa-tachometer", - "keepAlive": "dashboard" - }, - { - "title": "常规管理", - "path": "/admin/routine", - "type": "tab", - "icon": "fa fa-cogs", - "keepAlive": false, - "children": [ - { - "title": "系统设置", - "path": "/admin/routine/config", - "type": "tab", - "icon": "fa fa-cogs", - "keepAlive": false - }, - { - "title": "个人资料", - "path": "/admin/routine/adminInfo", - "type": "tab", - "icon": "fa fa-user", - "keepAlive": true - } - ] - }, - { - "title": "菜单管理", - "path": "/admin/auth/menu", - "type": "tab", - "icon": "fa fa-cogs", - "keepAlive": false - }, - { - "title": "表格示例", - "path": "/admin/table", - "type": "tab", - "icon": "fa fa-cogs", - "keepAlive": false - }, - { - "title": "百度", - "path": "https://baidu.com", - "type": "link", - "children": [ - { - "title": "系统设置1", - "path": "/admin/routine/config/111", - "type": "tab", - "icon": "fa fa-cogs", - "keepAlive": false - }, - { - "title": "系统设置2", - "path": "/admin/routine/config/222", - "type": "tab", - "icon": "fa fa-cogs", - "keepAlive": false - } - ] - }, - { - "title": "简书", - "path": "https://www.jianshu.com/p/120eaf50331c", - "type": "iframe", - "icon": "fa fa-address-book" - }, - { - "title": "系统设置3", - "path": "/admin/routine/config/3", - "type": "tab", - "icon": "fa fa-address-book", - "keepAlive": false - }, - { - "title": "系统设置4", - "path": "/admin/routine/config/4", - "type": "tab", - "icon": "fa fa-address-book", - "keepAlive": false - }, - { - "title": "系统设置5", - "path": "/admin/routine/config/5", - "type": "tab", - "icon": "fa fa-address-book", - "keepAlive": false - }, - { - "title": "系统设置6", - "path": "/admin/routine/config/6", - "type": "tab", - "icon": "fa fa-address-book", - "keepAlive": false - }, - { - "title": "系统设置7", - "path": "/admin/routine/config/7", - "type": "tab", - "icon": "fa fa-address-book", - "keepAlive": false - }, - { - "title": "系统设置8", - "path": "/admin/routine/config/8", - "type": "tab", - "icon": "fa fa-address-book", - "keepAlive": false - }, - { - "title": "系统设置9", - "path": "/admin/routine/config/9", - "type": "tab", - "icon": "fa fa-address-book", - "keepAlive": false - }, - { - "title": "系统设置10", - "path": "/admin/routine/config/10", - "type": "tab", - "icon": "fa fa-address-book", - "keepAlive": false - }, - { - "title": "系统设置11", - "path": "/admin/routine/config/11", - "type": "tab", - "icon": "fa fa-address-book", - "keepAlive": false - }, - { - "title": "系统设置12", - "path": "/admin/routine/config/12", - "type": "tab", - "icon": "fa fa-address-book", - "keepAlive": false - }, - { - "title": "系统设置13", - "path": "/admin/routine/config/13", - "type": "tab", - "icon": "fa fa-address-book", - "keepAlive": false - }, - { - "title": "系统设置14", - "path": "/admin/routine/config/14", - "type": "tab", - "icon": "fa fa-address-book", - "keepAlive": false - }, - { - "title": "系统设置15", - "path": "/admin/routine/config/15", - "type": "tab", - "icon": "fa fa-address-book", - "keepAlive": false - } -] diff --git a/web/src/utils/common.ts b/web/src/utils/common.ts index e960aa5b..f0ba7c4b 100644 --- a/web/src/utils/common.ts +++ b/web/src/utils/common.ts @@ -110,6 +110,9 @@ export const handleAdminRoute = (routes: any) => { const handleMenuRule = (routes: any, pathPrefix = '/') => { let menuRule = [] for (const key in routes) { + if (routes[key].extend == 'add_rules_only') { + continue + } if (routes[key].type == 'menu' || routes[key].type == 'menu_dir') { routes[key].type = routes[key].menu_type routes[key].keepAlive = routes[key].name @@ -131,6 +134,9 @@ const handleMenuRule = (routes: any, pathPrefix = '/') => { export const addRouteAll = (viewsComponent: Record, routes: any, parentName: string) => { for (const idx in routes) { + if (routes[idx].extend == 'add_menu_only') { + continue + } if (routes[idx].type == 'menu' && routes[idx].menu_type == 'tab' && viewsComponent[routes[idx].component].default) { addRouteItem(viewsComponent, routes[idx], parentName) }