refactor(projects): 精简版+动态路由权限初步

This commit is contained in:
Soybean
2022-01-03 22:20:10 +08:00
parent 7a0648dba5
commit de2057f141
354 changed files with 2053 additions and 22117 deletions

View File

@ -1,29 +0,0 @@
import type { RouteRecordRaw } from 'vue-router';
import { setSingleRoute } from '@/utils';
import { BasicLayout } from '@/layouts';
import { About } from '@/views';
import { getRouteConst, routeName } from '../constant';
const { name, path, title } = getRouteConst('about');
const about: RouteRecordRaw = setSingleRoute({
route: {
name,
path,
component: About,
meta: {
title,
requiresAuth: true,
keepAlive: true,
icon: 'fluent:book-information-24-regular'
}
},
container: BasicLayout,
containerMeta: {
title,
order: 7
},
notFoundName: routeName('not-found')
});
export default about;

View File

@ -1,50 +0,0 @@
import type { RouteRecordRaw } from 'vue-router';
import { BasicLayout } from '@/layouts';
import { ComponentButton, ComponentCard, ComponentTable } from '@/views';
import { routeName, routePath, routeTitle } from '../constant';
const component: RouteRecordRaw = {
name: routeName('component'),
path: routePath('component'),
component: BasicLayout,
redirect: { name: routeName('component_button') },
meta: {
title: routeTitle('component'),
icon: 'fluent:app-store-24-regular',
order: 4
},
children: [
{
name: routeName('component_button'),
path: routePath('component_button'),
component: ComponentButton,
meta: {
title: routeTitle('component_button'),
requiresAuth: true,
keepAlive: true
}
},
{
name: routeName('component_card'),
path: routePath('component_card'),
component: ComponentCard,
meta: {
title: routeTitle('component_card'),
requiresAuth: true,
keepAlive: true
}
},
{
name: routeName('component_table'),
path: routePath('component_table'),
component: ComponentTable,
meta: {
title: routeTitle('component_table'),
requiresAuth: true,
keepAlive: true
}
}
]
};
export default component;

View File

@ -1,40 +0,0 @@
import type { RouteRecordRaw } from 'vue-router';
import { BasicLayout } from '@/layouts';
import { DashboardAnalysis, DashboardWorkbench } from '@/views';
import { routeName, routePath, routeTitle } from '../constant';
const dashboard: RouteRecordRaw = {
name: routeName('dashboard'),
path: routePath('dashboard'),
component: BasicLayout,
redirect: { name: routeName('dashboard_analysis') },
meta: {
title: routeTitle('dashboard'),
icon: 'carbon:dashboard',
order: 1
},
children: [
{
name: routeName('dashboard_analysis'),
path: routePath('dashboard_analysis'),
component: DashboardAnalysis,
meta: {
keepAlive: true,
requiresAuth: true,
title: routeTitle('dashboard_analysis')
}
},
{
name: routeName('dashboard_workbench'),
path: routePath('dashboard_workbench'),
component: DashboardWorkbench,
meta: {
keepAlive: true,
requiresAuth: true,
title: routeTitle('dashboard_workbench')
}
}
]
};
export default dashboard;

View File

@ -1,62 +0,0 @@
import type { RouteRecordRaw } from 'vue-router';
import { BasicLayout, BlankLayout } from '@/layouts';
import { DocumentVue, DocumentVite, DocumentNaive } from '@/views';
import { routeName, routePath, routeTitle } from '../constant';
const document: RouteRecordRaw = {
name: routeName('document'),
path: routePath('document'),
component: BasicLayout,
redirect: { name: routeName('document_vue') },
meta: {
requiresAuth: true,
title: routeTitle('document'),
icon: 'carbon:document',
order: 2
},
children: [
{
name: routeName('document_vue'),
path: routePath('document_vue'),
component: DocumentVue,
meta: {
requiresAuth: true,
title: routeTitle('document_vue'),
fullPage: true,
keepAlive: true
}
},
{
name: routeName('document_vite'),
path: routePath('document_vite'),
component: DocumentVite,
meta: {
requiresAuth: true,
title: routeTitle('document_vite'),
fullPage: true
}
},
{
name: routeName('document_naive'),
path: routePath('document_naive'),
component: DocumentNaive,
meta: {
requiresAuth: true,
title: routeTitle('document_naive'),
fullPage: true
}
},
{
name: routeName('document_project'),
path: routePath('document_project'),
component: BlankLayout,
meta: {
requiresAuth: true,
title: routeTitle('document_project'),
fullPage: true
}
}
]
};
export default document;

View File

@ -1,51 +0,0 @@
import type { RouteRecordRaw } from 'vue-router';
import { BasicLayout } from '@/layouts';
import { NoPermission, NotFound, ServiceError } from '@/views';
import { routeName, routePath, routeTitle } from '../constant';
const exception: RouteRecordRaw = {
name: routeName('exception'),
path: routePath('exception'),
component: BasicLayout,
redirect: { name: routeName('exception_403') },
meta: {
requiresAuth: true,
title: routeTitle('exception'),
icon: 'ant-design:exception-outlined',
order: 5
},
children: [
{
name: routeName('exception_403'),
path: routePath('exception_403'),
component: NoPermission,
meta: {
requiresAuth: true,
title: routeTitle('exception_403'),
fullPage: true
}
},
{
name: routeName('exception_404'),
path: routePath('exception_404'),
component: NotFound,
meta: {
requiresAuth: true,
title: routeTitle('exception_404'),
fullPage: true
}
},
{
name: routeName('exception_500'),
path: routePath('exception_500'),
component: ServiceError,
meta: {
requiresAuth: true,
title: routeTitle('exception_500'),
fullPage: true
}
}
]
};
export default exception;

View File

@ -1,8 +0,0 @@
import { transformRouteModules } from '@/utils';
import type { ImportedRouteModules } from '@/interface';
const modules = import.meta.globEager('./*.ts') as ImportedRouteModules;
const customRoutes = transformRouteModules(modules);
export default customRoutes;

View File

@ -1,41 +0,0 @@
import type { RouteRecordRaw } from 'vue-router';
import { BasicLayout } from '@/layouts';
import MultiMenuFirstSecond from '@/views/multi-menu/first/second/index.vue';
import { routeName, routePath, routeTitle } from '../constant';
const multiMenu: RouteRecordRaw = {
name: routeName('multi-menu'),
path: routePath('multi-menu'),
component: BasicLayout,
redirect: { name: routeName('multi-menu_first') },
meta: {
title: routeTitle('multi-menu'),
icon: 'carbon:menu',
order: 6
},
children: [
{
name: routeName('multi-menu_first'),
path: routePath('multi-menu_first'),
redirect: { name: routeName('multi-menu_first_second') },
meta: {
title: routeTitle('multi-menu_first')
},
children: [
{
name: routeName('multi-menu_first_second'),
path: routePath('multi-menu_first_second'),
component: MultiMenuFirstSecond,
meta: {
title: routeTitle('multi-menu_first_second'),
requiresAuth: true,
keepAlive: true,
fullPage: true
}
}
]
}
]
};
export default multiMenu;

View File

@ -1,118 +0,0 @@
import type { RouteRecordRaw } from 'vue-router';
import { BasicLayout } from '@/layouts';
import {
PluginMap,
PluginVideo,
PluginEditorQuill,
PluginEditorMarkdown,
PluginSwiper,
PluginCopy,
PluginIcon,
PluginPrint
} from '@/views';
import { routeName, routePath, routeTitle } from '../constant';
const plugin: RouteRecordRaw = {
name: routeName('plugin'),
path: routePath('plugin'),
component: BasicLayout,
redirect: { name: routeName('plugin_map') },
meta: {
requiresAuth: true,
title: routeTitle('plugin'),
icon: 'clarity:plugin-line',
order: 3
},
children: [
{
name: routeName('plugin_map'),
path: routePath('plugin_map'),
component: PluginMap,
meta: {
requiresAuth: true,
title: routeTitle('plugin_map'),
fullPage: true
}
},
{
name: routeName('plugin_video'),
path: routePath('plugin_video'),
component: PluginVideo,
meta: {
requiresAuth: true,
title: routeTitle('plugin_video'),
fullPage: true
}
},
{
name: routeName('plugin_editor'),
path: routePath('plugin_editor'),
redirect: { name: routeName('plugin_editor_quill') },
meta: {
title: routeTitle('plugin_editor')
},
children: [
{
name: routeName('plugin_editor_quill'),
path: routePath('plugin_editor_quill'),
component: PluginEditorQuill,
meta: {
requiresAuth: true,
title: routeTitle('plugin_editor_quill'),
fullPage: true
}
},
{
name: routeName('plugin_editor_markdown'),
path: routePath('plugin_editor_markdown'),
component: PluginEditorMarkdown,
meta: {
requiresAuth: true,
title: routeTitle('plugin_editor_markdown'),
fullPage: true
}
}
]
},
{
name: routeName('plugin_swiper'),
path: routePath('plugin_swiper'),
component: PluginSwiper,
meta: {
requiresAuth: true,
title: routeTitle('plugin_swiper')
}
},
{
name: routeName('plugin_copy'),
path: routePath('plugin_copy'),
component: PluginCopy,
meta: {
requiresAuth: true,
title: routeTitle('plugin_copy'),
fullPage: true
}
},
{
name: routeName('plugin_icon'),
path: routePath('plugin_icon'),
component: PluginIcon,
meta: {
requiresAuth: true,
title: routeTitle('plugin_icon')
}
},
{
name: routeName('plugin_print'),
path: routePath('plugin_print'),
component: PluginPrint,
meta: {
requiresAuth: true,
title: routeTitle('plugin_print')
}
}
]
};
export default plugin;

View File

@ -1,28 +0,0 @@
import type { RouteRecordRaw } from 'vue-router';
import { setSingleRoute } from '@/utils';
import { BlankLayout } from '@/layouts';
import { Website } from '@/views';
import { getRouteConst, routeName } from '../constant';
const { name, path, title } = getRouteConst('website');
const website: RouteRecordRaw = setSingleRoute({
route: {
name,
path,
component: Website,
meta: {
title,
icon: 'codicon:remote-explorer',
notAsMenu: true
}
},
container: BlankLayout,
containerMeta: {
title,
order: 8
},
notFoundName: routeName('not-found')
});
export default website;