mirror of
https://github.com/vbenjs/vue-vben-admin.git
synced 2025-08-27 14:47:28 +08:00
initial commit
This commit is contained in:
42
src/router/routes/index.ts
Normal file
42
src/router/routes/index.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
import type { AppRouteRecordRaw, AppRouteModule } from '/@/router/types';
|
||||
|
||||
import { DEFAULT_LAYOUT_COMPONENT, PAGE_NOT_FOUND_ROUTE, REDIRECT_ROUTE } from '../constant';
|
||||
import { genRouteModule } from '/@/utils/helper/routeHelper';
|
||||
|
||||
import LoginRoute from './modules/sys';
|
||||
// demo
|
||||
import exceptionDemo from './modules/demo/exception';
|
||||
import dashboardDemo from './modules/demo/dashboard';
|
||||
import iframeDemo from './modules/demo/iframe';
|
||||
import compDemo from './modules/demo/comp';
|
||||
import permissionDemo from './modules/demo/permission';
|
||||
import featDemo from './modules/demo/feat';
|
||||
|
||||
const routeModuleList: AppRouteModule[] = [
|
||||
exceptionDemo,
|
||||
dashboardDemo,
|
||||
iframeDemo,
|
||||
compDemo,
|
||||
featDemo,
|
||||
permissionDemo,
|
||||
];
|
||||
|
||||
export const asyncRoutes = [
|
||||
REDIRECT_ROUTE,
|
||||
PAGE_NOT_FOUND_ROUTE,
|
||||
...genRouteModule(routeModuleList),
|
||||
];
|
||||
// 主框架根路由
|
||||
export const RootRoute: AppRouteRecordRaw = {
|
||||
path: '/',
|
||||
name: 'Root',
|
||||
component: DEFAULT_LAYOUT_COMPONENT,
|
||||
redirect: '/dashboard',
|
||||
meta: {
|
||||
title: 'Root',
|
||||
},
|
||||
children: [],
|
||||
};
|
||||
|
||||
// 基础路由 不用权限
|
||||
export const basicRoutes = [LoginRoute, RootRoute];
|
247
src/router/routes/modules/demo/comp.ts
Normal file
247
src/router/routes/modules/demo/comp.ts
Normal file
@@ -0,0 +1,247 @@
|
||||
import type { AppRouteModule } from '/@/router/types';
|
||||
|
||||
import { PAGE_LAYOUT_COMPONENT } from '/@/router/constant';
|
||||
|
||||
export default {
|
||||
layout: {
|
||||
path: '/comp',
|
||||
name: 'Comp',
|
||||
component: PAGE_LAYOUT_COMPONENT,
|
||||
redirect: '/comp/basic',
|
||||
meta: {
|
||||
icon: 'ant-design:home-outlined',
|
||||
title: '组件',
|
||||
},
|
||||
},
|
||||
|
||||
routes: [
|
||||
{
|
||||
path: '/basic',
|
||||
name: 'BasicDemo',
|
||||
component: () => import('/@/views/demo/comp/button/index.vue'),
|
||||
meta: {
|
||||
title: '基础组件',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: '/icon',
|
||||
name: 'IconDemo',
|
||||
component: () => import('/@/views/demo/comp/icon/index.vue'),
|
||||
meta: {
|
||||
title: '图标',
|
||||
},
|
||||
},
|
||||
// form
|
||||
{
|
||||
path: '/form',
|
||||
name: 'FormDemo',
|
||||
redirect: '/comp/form/basic',
|
||||
meta: {
|
||||
title: '表单组件',
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: 'basic',
|
||||
name: 'FormBasicDemo',
|
||||
component: () => import('/@/views/demo/form/index.vue'),
|
||||
meta: {
|
||||
title: '基础表单',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'useForm',
|
||||
name: 'UseFormDemo',
|
||||
component: () => import('/@/views/demo/form/UseForm.vue'),
|
||||
meta: {
|
||||
title: 'useForm',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'refForm',
|
||||
name: 'RefFormDemo',
|
||||
component: () => import('/@/views/demo/form/RefForm.vue'),
|
||||
meta: {
|
||||
title: 'RefForm',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'advancedForm',
|
||||
name: 'AdvancedFormDemo',
|
||||
component: () => import('/@/views/demo/form/AdvancedForm.vue'),
|
||||
meta: {
|
||||
title: '可收缩表单',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'ruleForm',
|
||||
name: 'RuleFormDemo',
|
||||
component: () => import('/@/views/demo/form/RuleForm.vue'),
|
||||
meta: {
|
||||
title: '表单验证',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'dynamicForm',
|
||||
name: 'DynamicFormDemo',
|
||||
component: () => import('/@/views/demo/form/DynamicForm.vue'),
|
||||
meta: {
|
||||
title: '动态表单',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'customerForm',
|
||||
name: 'CustomerFormDemo',
|
||||
component: () => import('/@/views/demo/form/CustomerForm.vue'),
|
||||
meta: {
|
||||
title: '自定义组件',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: '/tree',
|
||||
name: 'TreeDemo',
|
||||
redirect: '/comp/tree/basic',
|
||||
meta: {
|
||||
title: '树组件',
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: 'basic',
|
||||
name: 'BasicTreeDemo',
|
||||
component: () => import('/@/views/demo/tree/index.vue'),
|
||||
meta: {
|
||||
title: '基础树',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'editTree',
|
||||
name: 'EditTreeDemo',
|
||||
component: () => import('/@/views/demo/tree/EditTree.vue'),
|
||||
meta: {
|
||||
title: '右键示例',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'actionTree',
|
||||
name: 'ActionTreeDemo',
|
||||
component: () => import('/@/views/demo/tree/ActionTree.vue'),
|
||||
meta: {
|
||||
title: '函数操作示例',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: '/scroll',
|
||||
name: 'ScrollDemo',
|
||||
redirect: '/comp/scroll/basic',
|
||||
meta: {
|
||||
title: '滚动组件',
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: 'basic',
|
||||
name: 'BasicScrollDemo',
|
||||
component: () => import('/@/views/demo/comp/scroll/index.vue'),
|
||||
meta: {
|
||||
title: '基础滚动',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'action',
|
||||
name: 'ActionScrollDemo',
|
||||
component: () => import('/@/views/demo/comp/scroll/Action.vue'),
|
||||
meta: {
|
||||
title: '滚动函数',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'virtualScroll',
|
||||
name: 'VirtualScrollDemo',
|
||||
component: () => import('/@/views/demo/comp/scroll/VirtualScroll.vue'),
|
||||
meta: {
|
||||
title: '虚拟滚动',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
{
|
||||
path: '/modal',
|
||||
name: 'ModalDemo',
|
||||
component: () => import('/@/views/demo/comp/modal/index.vue'),
|
||||
meta: {
|
||||
title: '弹窗扩展',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: '/drawer',
|
||||
name: 'DrawerDemo',
|
||||
component: () => import('/@/views/demo/comp/drawer/index.vue'),
|
||||
meta: {
|
||||
title: '抽屉扩展',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: '/desc',
|
||||
name: 'DescDemo',
|
||||
component: () => import('/@/views/demo/comp/desc/index.vue'),
|
||||
meta: {
|
||||
title: '详情组件',
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
path: '/verify',
|
||||
name: 'VerifyDemo',
|
||||
redirect: '/comp/verify/drag',
|
||||
meta: {
|
||||
title: '验证组件',
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: 'drag',
|
||||
name: 'VerifyDragDemo',
|
||||
component: () => import('/@/views/demo/comp/verify/index.vue'),
|
||||
meta: {
|
||||
title: '拖拽校验',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'rotate',
|
||||
name: 'VerifyRotateDemo',
|
||||
component: () => import('/@/views/demo/comp/verify/Rotate.vue'),
|
||||
meta: {
|
||||
title: '图片还原',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
//
|
||||
{
|
||||
path: '/click-out-side',
|
||||
name: 'ClickOutSideDemo',
|
||||
component: () => import('/@/views/demo/comp/click-out-side/index.vue'),
|
||||
meta: {
|
||||
title: 'ClickOutSide组件',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: '/qrcode',
|
||||
name: 'QrCodeDemo',
|
||||
component: () => import('/@/views/demo/comp/qrcode/index.vue'),
|
||||
meta: {
|
||||
title: '二维码组件',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: '/strength-meter',
|
||||
name: 'StrengthMeterDemo',
|
||||
component: () => import('/@/views/demo/comp/strength-meter/index.vue'),
|
||||
meta: {
|
||||
title: '密码强度组件',
|
||||
},
|
||||
},
|
||||
],
|
||||
} as AppRouteModule;
|
28
src/router/routes/modules/demo/dashboard.ts
Normal file
28
src/router/routes/modules/demo/dashboard.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import type { AppRouteModule } from '/@/router/types';
|
||||
|
||||
import { PAGE_LAYOUT_COMPONENT } from '/@/router/constant';
|
||||
|
||||
export default {
|
||||
layout: {
|
||||
path: '/dashboard',
|
||||
name: 'Dashboard',
|
||||
component: PAGE_LAYOUT_COMPONENT,
|
||||
redirect: '/dashboard/welcome',
|
||||
meta: {
|
||||
icon: 'ant-design:home-outlined',
|
||||
title: 'Dashboard',
|
||||
},
|
||||
},
|
||||
|
||||
routes: [
|
||||
{
|
||||
path: '/welcome',
|
||||
name: 'Welcome',
|
||||
component: () => import('/@/views/dashboard/welcome/index.vue'),
|
||||
meta: {
|
||||
title: '欢迎页',
|
||||
affix: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
} as AppRouteModule;
|
77
src/router/routes/modules/demo/exception.ts
Normal file
77
src/router/routes/modules/demo/exception.ts
Normal file
@@ -0,0 +1,77 @@
|
||||
import type { AppRouteModule } from '/@/router/types';
|
||||
|
||||
import { PAGE_LAYOUT_COMPONENT } from '/@/router/constant';
|
||||
import { ExceptionEnum } from '/@/enums/exceptionEnum';
|
||||
|
||||
const ExceptionPage = () => import('/@/views/sys/exception/Exception');
|
||||
|
||||
export default {
|
||||
layout: {
|
||||
path: '/exception',
|
||||
name: 'ExceptionPage',
|
||||
component: PAGE_LAYOUT_COMPONENT,
|
||||
redirect: '/exception/404',
|
||||
meta: {
|
||||
icon: 'ant-design:exception-outlined',
|
||||
title: '异常页',
|
||||
},
|
||||
},
|
||||
|
||||
routes: [
|
||||
{
|
||||
path: '/404',
|
||||
name: 'PageNotFound',
|
||||
component: ExceptionPage,
|
||||
props: {
|
||||
status: ExceptionEnum.PAGE_NOT_FOUND,
|
||||
},
|
||||
meta: {
|
||||
title: '404',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: '/500',
|
||||
name: 'ServiceError',
|
||||
component: ExceptionPage,
|
||||
props: {
|
||||
status: ExceptionEnum.ERROR,
|
||||
},
|
||||
meta: {
|
||||
title: '500',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: '/net-work-error',
|
||||
name: 'NetWorkError',
|
||||
component: ExceptionPage,
|
||||
props: {
|
||||
status: ExceptionEnum.NET_WORK_ERROR,
|
||||
},
|
||||
meta: {
|
||||
title: '网络错误',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: '/page-time-out',
|
||||
name: 'PageTimeOut',
|
||||
component: ExceptionPage,
|
||||
props: {
|
||||
status: ExceptionEnum.PAGE_TIMEOUT,
|
||||
},
|
||||
meta: {
|
||||
title: '页面超时',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: '/not-data',
|
||||
name: 'NotData',
|
||||
component: ExceptionPage,
|
||||
props: {
|
||||
status: ExceptionEnum.PAGE_NOT_DATA,
|
||||
},
|
||||
meta: {
|
||||
title: '无数据',
|
||||
},
|
||||
},
|
||||
],
|
||||
} as AppRouteModule;
|
83
src/router/routes/modules/demo/feat.ts
Normal file
83
src/router/routes/modules/demo/feat.ts
Normal file
@@ -0,0 +1,83 @@
|
||||
import type { AppRouteModule } from '/@/router/types';
|
||||
|
||||
import { PAGE_LAYOUT_COMPONENT } from '/@/router/constant';
|
||||
|
||||
export default {
|
||||
layout: {
|
||||
path: '/feat',
|
||||
name: 'FeatDemo',
|
||||
component: PAGE_LAYOUT_COMPONENT,
|
||||
redirect: '/feat/tabs',
|
||||
meta: {
|
||||
icon: 'ant-design:home-outlined',
|
||||
title: 'Feat',
|
||||
},
|
||||
},
|
||||
|
||||
routes: [
|
||||
{
|
||||
path: '/tabs',
|
||||
name: 'TabsDemo',
|
||||
component: () => import('/@/views/demo/feat/tabs/index.vue'),
|
||||
meta: {
|
||||
title: '标签页操作',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: '/context-menu',
|
||||
name: 'ContextMenuDemo',
|
||||
component: () => import('/@/views/demo/feat/context-menu/index.vue'),
|
||||
meta: {
|
||||
title: '右键菜单',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: '/img-preview',
|
||||
name: 'ImgPreview',
|
||||
component: () => import('/@/views/demo/feat/img-preview/index.vue'),
|
||||
meta: {
|
||||
title: '图片预览',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: '/copy',
|
||||
name: 'CopyDemo',
|
||||
component: () => import('/@/views/demo/feat/copy/index.vue'),
|
||||
meta: {
|
||||
title: '剪切板',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: '/msg',
|
||||
name: 'MsgDemo',
|
||||
component: () => import('/@/views/demo/feat/msg/index.vue'),
|
||||
meta: {
|
||||
title: '消息提示',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: '/i18n',
|
||||
name: 'I18nDemo',
|
||||
component: () => import('/@/views/demo/feat/i18n/index.vue'),
|
||||
meta: {
|
||||
title: '国际化',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: '/watermark',
|
||||
name: 'WatermarkDemo',
|
||||
component: () => import('/@/views/demo/feat/watermark/index.vue'),
|
||||
meta: {
|
||||
title: '水印',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: '/full-screen',
|
||||
name: 'FullScreenDemo',
|
||||
component: () => import('/@/views/demo/feat/full-screen/index.vue'),
|
||||
meta: {
|
||||
title: '全屏',
|
||||
},
|
||||
},
|
||||
],
|
||||
} as AppRouteModule;
|
47
src/router/routes/modules/demo/iframe.ts
Normal file
47
src/router/routes/modules/demo/iframe.ts
Normal file
@@ -0,0 +1,47 @@
|
||||
import type { AppRouteModule } from '/@/router/types';
|
||||
|
||||
import { PAGE_LAYOUT_COMPONENT } from '/@/router/constant';
|
||||
const IFrame = () => import('/@/views/sys/iframe/FrameBlank.vue');
|
||||
|
||||
export default {
|
||||
layout: {
|
||||
path: '/frame',
|
||||
name: 'Frame',
|
||||
component: PAGE_LAYOUT_COMPONENT,
|
||||
redirect: '/frame/antv',
|
||||
meta: {
|
||||
icon: 'ant-design:home-outlined',
|
||||
title: '外部页面',
|
||||
},
|
||||
},
|
||||
|
||||
routes: [
|
||||
{
|
||||
path: '/antv',
|
||||
name: 'Antv',
|
||||
component: IFrame,
|
||||
meta: {
|
||||
frameSrc: 'https://2x.antdv.com/docs/vue/introduce-cn/',
|
||||
title: 'antVue文档(内嵌)',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: '/doc',
|
||||
name: 'Doc',
|
||||
component: IFrame,
|
||||
meta: {
|
||||
frameSrc: 'https://vvbin.cn/docs/',
|
||||
title: '项目文档(内嵌)',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: '/docExternal',
|
||||
name: 'DocExternal',
|
||||
component: IFrame,
|
||||
meta: {
|
||||
externalLink: 'https://vvbin.cn/docs/',
|
||||
title: '项目文档(外链)',
|
||||
},
|
||||
},
|
||||
],
|
||||
} as AppRouteModule;
|
82
src/router/routes/modules/demo/permission.ts
Normal file
82
src/router/routes/modules/demo/permission.ts
Normal file
@@ -0,0 +1,82 @@
|
||||
import type { AppRouteModule } from '/@/router/types';
|
||||
|
||||
import { PAGE_LAYOUT_COMPONENT } from '/@/router/constant';
|
||||
import { RoleEnum } from '/@/enums/roleEnum';
|
||||
|
||||
export default {
|
||||
layout: {
|
||||
path: '/permission',
|
||||
name: 'Permission',
|
||||
component: PAGE_LAYOUT_COMPONENT,
|
||||
redirect: '/permission/front',
|
||||
meta: {
|
||||
icon: 'ant-design:home-outlined',
|
||||
title: '权限管理',
|
||||
},
|
||||
},
|
||||
|
||||
routes: [
|
||||
{
|
||||
path: '/front',
|
||||
name: 'PermissionFrontDemo',
|
||||
meta: {
|
||||
title: '基于前端权限',
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: 'page',
|
||||
component: () => import('/@/views/demo/permission/front/index.vue'),
|
||||
meta: {
|
||||
title: '页面权限',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'btn',
|
||||
component: () => import('/@/views/demo/permission/front/Btn.vue'),
|
||||
meta: {
|
||||
title: '按钮权限',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'auth-pageA',
|
||||
component: () => import('/@/views/demo/permission/front/AuthPageA.vue'),
|
||||
meta: {
|
||||
title: '权限测试页A',
|
||||
roles: [RoleEnum.SUPER],
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'auth-pageB',
|
||||
component: () => import('/@/views/demo/permission/front/AuthPageB.vue'),
|
||||
meta: {
|
||||
title: '权限测试页B',
|
||||
roles: [RoleEnum.TEST],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: '/back',
|
||||
name: 'PermissionBackDemo',
|
||||
meta: {
|
||||
title: '基于后台权限',
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: 'page',
|
||||
component: () => import('/@/views/demo/permission/back/index.vue'),
|
||||
meta: {
|
||||
title: '页面权限',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'btn',
|
||||
component: () => import('/@/views/demo/permission/back/Btn.vue'),
|
||||
meta: {
|
||||
title: '按钮权限',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
} as AppRouteModule;
|
12
src/router/routes/modules/sys.ts
Normal file
12
src/router/routes/modules/sys.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import type { AppRouteRecordRaw } from '/@/router/types';
|
||||
|
||||
const routes: AppRouteRecordRaw = {
|
||||
path: '/login',
|
||||
name: 'Login',
|
||||
component: () => import('/@/views/sys/login/Login.vue'),
|
||||
meta: {
|
||||
title: '登录',
|
||||
},
|
||||
};
|
||||
|
||||
export default routes;
|
Reference in New Issue
Block a user