[tag] 增加了一些路由
This commit is contained in:
parent
84b54a02a4
commit
647cc31a8e
Binary file not shown.
|
After Width: | Height: | Size: 744 KiB |
|
|
@ -28,14 +28,22 @@ const iconMap: Record<ExceptionType, string> = {
|
|||
'500': 'service-error'
|
||||
};
|
||||
|
||||
const textMap: Record<ExceptionType, string> = {
|
||||
'403': '403 Forbidden',
|
||||
'404': '404 Not Found',
|
||||
'500': '500 Internal Server Error'
|
||||
};
|
||||
|
||||
const icon = computed(() => iconMap[props.type]);
|
||||
const text = computed(() => textMap[props.type]);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="size-full min-h-520px flex-col-center gap-24px overflow-hidden">
|
||||
<div class="flex text-400px text-primary">
|
||||
<!-- <div class="flex text-400px text-primary">
|
||||
<SvgIcon :local-icon="icon" />
|
||||
</div>
|
||||
</div> -->
|
||||
<h3 class="text-18px text-primary font-500">{{ text }}</h3>
|
||||
<AButton type="primary" @click="routerPushByKey('root')">{{ $t('common.backToHome') }}</AButton>
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ defineOptions({
|
|||
|
||||
<template>
|
||||
<div class="size-72px overflow-hidden rd-1/2">
|
||||
<img src="@/assets/imgs/soybean.jpg" class="size-full" />
|
||||
<img src="@/assets/imgs/SubwayAdmin.jpg" class="size-full" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
|
|
|||
|
|
@ -192,7 +192,12 @@ const local: App.I18n.Schema = {
|
|||
exception: '异常页',
|
||||
exception_403: '403',
|
||||
exception_404: '404',
|
||||
exception_500: '500'
|
||||
exception_500: '500',
|
||||
orders: "工单管理",
|
||||
employee: "人员管理",
|
||||
facility: "设施管理",
|
||||
plan: "计划管理",
|
||||
department: "部门管理"
|
||||
},
|
||||
page: {
|
||||
login: {
|
||||
|
|
@ -255,7 +260,7 @@ const local: App.I18n.Schema = {
|
|||
devDep: '开发依赖'
|
||||
},
|
||||
home: {
|
||||
greeting: '早安,{userName}, 今天又是充满活力的一天!',
|
||||
greeting: '欢迎您,{userName}',
|
||||
weatherDesc: '今日多云转晴,20℃ - 25℃!',
|
||||
projectCount: '项目数',
|
||||
todo: '待办',
|
||||
|
|
|
|||
|
|
@ -21,6 +21,9 @@ export const views: Record<LastLevelRouteKey, RouteComponent | (() => Promise<Ro
|
|||
"iframe-page": () => import("@/views/_builtin/iframe-page/[url].vue"),
|
||||
login: () => import("@/views/_builtin/login/index.vue"),
|
||||
about: () => import("@/views/about/index.vue"),
|
||||
department: () => import("@/views/department/index.vue"),
|
||||
employee: () => import("@/views/employee/index.vue"),
|
||||
facility: () => import("@/views/facility/index.vue"),
|
||||
"function_hide-child_one": () => import("@/views/function/hide-child/one/index.vue"),
|
||||
"function_hide-child_three": () => import("@/views/function/hide-child/three/index.vue"),
|
||||
"function_hide-child_two": () => import("@/views/function/hide-child/two/index.vue"),
|
||||
|
|
@ -36,5 +39,7 @@ export const views: Record<LastLevelRouteKey, RouteComponent | (() => Promise<Ro
|
|||
manage_user: () => import("@/views/manage/user/index.vue"),
|
||||
"multi-menu_first_child": () => import("@/views/multi-menu/first_child/index.vue"),
|
||||
"multi-menu_second_child_home": () => import("@/views/multi-menu/second_child_home/index.vue"),
|
||||
orders: () => import("@/views/orders/index.vue"),
|
||||
plan: () => import("@/views/plan/index.vue"),
|
||||
"user-center": () => import("@/views/user-center/index.vue"),
|
||||
};
|
||||
|
|
|
|||
|
|
@ -50,6 +50,33 @@ export const generatedRoutes: GeneratedRoute[] = [
|
|||
order: 10
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'department',
|
||||
path: '/department',
|
||||
component: 'layout.base$view.department',
|
||||
meta: {
|
||||
title: 'department',
|
||||
i18nKey: 'route.department'
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'employee',
|
||||
path: '/employee',
|
||||
component: 'layout.base$view.employee',
|
||||
meta: {
|
||||
title: 'employee',
|
||||
i18nKey: 'route.employee'
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'facility',
|
||||
path: '/facility',
|
||||
component: 'layout.base$view.facility',
|
||||
meta: {
|
||||
title: 'facility',
|
||||
i18nKey: 'route.facility'
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'function',
|
||||
path: '/function',
|
||||
|
|
@ -330,6 +357,24 @@ export const generatedRoutes: GeneratedRoute[] = [
|
|||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'orders',
|
||||
path: '/orders',
|
||||
component: 'layout.base$view.orders',
|
||||
meta: {
|
||||
title: 'orders',
|
||||
i18nKey: 'route.orders'
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'plan',
|
||||
path: '/plan',
|
||||
component: 'layout.base$view.plan',
|
||||
meta: {
|
||||
title: 'plan',
|
||||
i18nKey: 'route.plan'
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'user-center',
|
||||
path: '/user-center',
|
||||
|
|
|
|||
|
|
@ -179,6 +179,9 @@ const routeMap: RouteMap = {
|
|||
"404": "/404",
|
||||
"500": "/500",
|
||||
"about": "/about",
|
||||
"department": "/department",
|
||||
"employee": "/employee",
|
||||
"facility": "/facility",
|
||||
"function": "/function",
|
||||
"function_hide-child": "/function/hide-child",
|
||||
"function_hide-child_one": "/function/hide-child/one",
|
||||
|
|
@ -203,6 +206,8 @@ const routeMap: RouteMap = {
|
|||
"multi-menu_second": "/multi-menu/second",
|
||||
"multi-menu_second_child": "/multi-menu/second/child",
|
||||
"multi-menu_second_child_home": "/multi-menu/second/child/home",
|
||||
"orders": "/orders",
|
||||
"plan": "/plan",
|
||||
"user-center": "/user-center"
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -9,49 +9,49 @@ import { transformElegantRoutesToVueRoutes } from '../elegant/transform';
|
|||
* @link https://github.com/soybeanjs/elegant-router?tab=readme-ov-file#custom-route
|
||||
*/
|
||||
const customRoutes: CustomRoute[] = [
|
||||
{
|
||||
name: 'exception',
|
||||
path: '/exception',
|
||||
component: 'layout.base',
|
||||
meta: {
|
||||
title: 'exception',
|
||||
i18nKey: 'route.exception',
|
||||
icon: 'ant-design:exception-outlined',
|
||||
order: 7
|
||||
},
|
||||
children: [
|
||||
{
|
||||
name: 'exception_403',
|
||||
path: '/exception/403',
|
||||
component: 'view.403',
|
||||
meta: {
|
||||
title: 'exception_403',
|
||||
i18nKey: 'route.exception_403',
|
||||
icon: 'ic:baseline-block'
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'exception_404',
|
||||
path: '/exception/404',
|
||||
component: 'view.404',
|
||||
meta: {
|
||||
title: 'exception_404',
|
||||
i18nKey: 'route.exception_404',
|
||||
icon: 'ic:baseline-web-asset-off'
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'exception_500',
|
||||
path: '/exception/500',
|
||||
component: 'view.500',
|
||||
meta: {
|
||||
title: 'exception_500',
|
||||
i18nKey: 'route.exception_500',
|
||||
icon: 'ic:baseline-wifi-off'
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
// {
|
||||
// name: 'exception',
|
||||
// path: '/exception',
|
||||
// component: 'layout.base',
|
||||
// meta: {
|
||||
// title: 'exception',
|
||||
// i18nKey: 'route.exception',
|
||||
// icon: 'ant-design:exception-outlined',
|
||||
// order: 7
|
||||
// },
|
||||
// children: [
|
||||
// {
|
||||
// name: 'exception_403',
|
||||
// path: '/exception/403',
|
||||
// component: 'view.403',
|
||||
// meta: {
|
||||
// title: 'exception_403',
|
||||
// i18nKey: 'route.exception_403',
|
||||
// icon: 'ic:baseline-block'
|
||||
// }
|
||||
// },
|
||||
// {
|
||||
// name: 'exception_404',
|
||||
// path: '/exception/404',
|
||||
// component: 'view.404',
|
||||
// meta: {
|
||||
// title: 'exception_404',
|
||||
// i18nKey: 'route.exception_404',
|
||||
// icon: 'ic:baseline-web-asset-off'
|
||||
// }
|
||||
// },
|
||||
// {
|
||||
// name: 'exception_500',
|
||||
// path: '/exception/500',
|
||||
// component: 'view.500',
|
||||
// meta: {
|
||||
// title: 'exception_500',
|
||||
// i18nKey: 'route.exception_500',
|
||||
// icon: 'ic:baseline-wifi-off'
|
||||
// }
|
||||
// }
|
||||
// ]
|
||||
// },
|
||||
{
|
||||
name: 'document',
|
||||
path: '/document',
|
||||
|
|
|
|||
|
|
@ -0,0 +1,193 @@
|
|||
import type { CustomRoute, ElegantConstRoute, ElegantRoute } from '@elegant-router/types';
|
||||
import { generatedRoutes } from '../elegant/routes';
|
||||
import { layouts, views } from '../elegant/imports';
|
||||
import { transformElegantRoutesToVueRoutes } from '../elegant/transform';
|
||||
|
||||
/**
|
||||
* custom routes
|
||||
*
|
||||
* @link https://github.com/soybeanjs/elegant-router?tab=readme-ov-file#custom-route
|
||||
*/
|
||||
const customRoutes: CustomRoute[] = [
|
||||
{
|
||||
name: 'exception',
|
||||
path: '/exception',
|
||||
component: 'layout.base',
|
||||
meta: {
|
||||
title: 'exception',
|
||||
i18nKey: 'route.exception',
|
||||
icon: 'ant-design:exception-outlined',
|
||||
order: 7
|
||||
},
|
||||
children: [
|
||||
{
|
||||
name: 'exception_403',
|
||||
path: '/exception/403',
|
||||
component: 'view.403',
|
||||
meta: {
|
||||
title: 'exception_403',
|
||||
i18nKey: 'route.exception_403',
|
||||
icon: 'ic:baseline-block'
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'exception_404',
|
||||
path: '/exception/404',
|
||||
component: 'view.404',
|
||||
meta: {
|
||||
title: 'exception_404',
|
||||
i18nKey: 'route.exception_404',
|
||||
icon: 'ic:baseline-web-asset-off'
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'exception_500',
|
||||
path: '/exception/500',
|
||||
component: 'view.500',
|
||||
meta: {
|
||||
title: 'exception_500',
|
||||
i18nKey: 'route.exception_500',
|
||||
icon: 'ic:baseline-wifi-off'
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'document',
|
||||
path: '/document',
|
||||
component: 'layout.base',
|
||||
meta: {
|
||||
title: 'document',
|
||||
i18nKey: 'route.document',
|
||||
order: 2,
|
||||
icon: 'mdi:file-document-multiple-outline'
|
||||
},
|
||||
children: [
|
||||
{
|
||||
name: 'document_antd',
|
||||
path: '/document/antd',
|
||||
component: 'view.iframe-page',
|
||||
props: {
|
||||
url: 'https://antdv.com/components/overview-cn'
|
||||
},
|
||||
meta: {
|
||||
title: 'document_antd',
|
||||
i18nKey: 'route.document_antd',
|
||||
order: 7,
|
||||
icon: 'logos:ant-design'
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'document_naive',
|
||||
path: '/document/naive',
|
||||
component: 'view.iframe-page',
|
||||
props: {
|
||||
url: 'https://www.naiveui.com/zh-CN/os-theme/docs/introduction'
|
||||
},
|
||||
meta: {
|
||||
title: 'document_naive',
|
||||
i18nKey: 'route.document_naive',
|
||||
order: 6,
|
||||
icon: 'logos:naiveui'
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'document_project',
|
||||
path: '/document/project',
|
||||
component: 'view.iframe-page',
|
||||
props: {
|
||||
url: 'https://docs.soybeanjs.cn/zh'
|
||||
},
|
||||
meta: {
|
||||
title: 'document_project',
|
||||
i18nKey: 'route.document_project',
|
||||
order: 1,
|
||||
localIcon: 'logo'
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'document_project-link',
|
||||
path: '/document/project-link',
|
||||
component: 'view.iframe-page',
|
||||
meta: {
|
||||
title: 'document_project-link',
|
||||
i18nKey: 'route.document_project-link',
|
||||
order: 2,
|
||||
localIcon: 'logo',
|
||||
href: 'https://docs.soybeanjs.cn/zh'
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'document_unocss',
|
||||
path: '/document/unocss',
|
||||
component: 'view.iframe-page',
|
||||
props: {
|
||||
url: 'https://unocss.dev/'
|
||||
},
|
||||
meta: {
|
||||
title: 'document_unocss',
|
||||
i18nKey: 'route.document_unocss',
|
||||
order: 5,
|
||||
icon: 'logos:unocss'
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'document_vite',
|
||||
path: '/document/vite',
|
||||
component: 'view.iframe-page',
|
||||
props: {
|
||||
url: 'https://cn.vitejs.dev/'
|
||||
},
|
||||
meta: {
|
||||
title: 'document_vite',
|
||||
i18nKey: 'route.document_vite',
|
||||
order: 4,
|
||||
icon: 'logos:vitejs'
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'document_vue',
|
||||
path: '/document/vue',
|
||||
component: 'view.iframe-page',
|
||||
props: {
|
||||
url: 'https://cn.vuejs.org/'
|
||||
},
|
||||
meta: {
|
||||
title: 'document_vue',
|
||||
i18nKey: 'route.document_vue',
|
||||
order: 3,
|
||||
icon: 'logos:vue'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
/** create routes when the auth route mode is static */
|
||||
export function createStaticRoutes() {
|
||||
const constantRoutes: ElegantRoute[] = [];
|
||||
|
||||
const authRoutes: ElegantRoute[] = [];
|
||||
|
||||
[...customRoutes, ...generatedRoutes].forEach(item => {
|
||||
if (item.meta?.constant) {
|
||||
constantRoutes.push(item);
|
||||
} else {
|
||||
authRoutes.push(item);
|
||||
}
|
||||
});
|
||||
|
||||
return {
|
||||
constantRoutes,
|
||||
authRoutes
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Get auth vue routes
|
||||
*
|
||||
* @param routes Elegant routes
|
||||
*/
|
||||
export function getAuthVueRoutes(routes: ElegantConstRoute[]) {
|
||||
return transformElegantRoutesToVueRoutes(routes, layouts, views);
|
||||
}
|
||||
|
|
@ -33,6 +33,9 @@ declare module "@elegant-router/types" {
|
|||
"404": "/404";
|
||||
"500": "/500";
|
||||
"about": "/about";
|
||||
"department": "/department";
|
||||
"employee": "/employee";
|
||||
"facility": "/facility";
|
||||
"function": "/function";
|
||||
"function_hide-child": "/function/hide-child";
|
||||
"function_hide-child_one": "/function/hide-child/one";
|
||||
|
|
@ -57,6 +60,8 @@ declare module "@elegant-router/types" {
|
|||
"multi-menu_second": "/multi-menu/second";
|
||||
"multi-menu_second_child": "/multi-menu/second/child";
|
||||
"multi-menu_second_child_home": "/multi-menu/second/child/home";
|
||||
"orders": "/orders";
|
||||
"plan": "/plan";
|
||||
"user-center": "/user-center";
|
||||
};
|
||||
|
||||
|
|
@ -105,12 +110,17 @@ declare module "@elegant-router/types" {
|
|||
| "404"
|
||||
| "500"
|
||||
| "about"
|
||||
| "department"
|
||||
| "employee"
|
||||
| "facility"
|
||||
| "function"
|
||||
| "home"
|
||||
| "iframe-page"
|
||||
| "login"
|
||||
| "manage"
|
||||
| "multi-menu"
|
||||
| "orders"
|
||||
| "plan"
|
||||
| "user-center"
|
||||
>;
|
||||
|
||||
|
|
@ -136,6 +146,9 @@ declare module "@elegant-router/types" {
|
|||
| "iframe-page"
|
||||
| "login"
|
||||
| "about"
|
||||
| "department"
|
||||
| "employee"
|
||||
| "facility"
|
||||
| "function_hide-child_one"
|
||||
| "function_hide-child_three"
|
||||
| "function_hide-child_two"
|
||||
|
|
@ -151,6 +164,8 @@ declare module "@elegant-router/types" {
|
|||
| "manage_user"
|
||||
| "multi-menu_first_child"
|
||||
| "multi-menu_second_child_home"
|
||||
| "orders"
|
||||
| "plan"
|
||||
| "user-center"
|
||||
>;
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
<script setup lang="ts"></script>
|
||||
|
||||
<template>
|
||||
<div>department</div>
|
||||
</template>
|
||||
|
||||
<style scoped></style>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<script setup lang="ts"></script>
|
||||
|
||||
<template>
|
||||
<div>employee</div>
|
||||
</template>
|
||||
|
||||
<style scoped></style>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<script setup lang="ts"></script>
|
||||
|
||||
<template>
|
||||
<div>facility</div>
|
||||
</template>
|
||||
|
||||
<style scoped></style>
|
||||
|
|
@ -40,13 +40,13 @@ const statisticData = computed<StatisticData[]>(() => [
|
|||
<ACol :span="24" :md="18">
|
||||
<div class="flex-y-center">
|
||||
<div class="size-72px shrink-0 overflow-hidden rd-1/2">
|
||||
<img src="@/assets/imgs/soybean.jpg" class="size-full" />
|
||||
<img src="@/assets/imgs/SubwayAdmin.jpg" class="size-full" />
|
||||
</div>
|
||||
<div class="pl-12px">
|
||||
<h3 class="text-18px font-semibold">
|
||||
{{ $t('page.home.greeting', { userName: authStore.userInfo.userName }) }}
|
||||
</h3>
|
||||
<p class="text-#999 leading-30px">{{ $t('page.home.weatherDesc') }}</p>
|
||||
<!-- <p class="text-#999 leading-30px">{{ $t('page.home.weatherDesc') }}</p> -->
|
||||
</div>
|
||||
</div>
|
||||
</ACol>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
<script setup lang="ts"></script>
|
||||
|
||||
<template>
|
||||
<div>orders</div>
|
||||
</template>
|
||||
|
||||
<style scoped></style>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<script setup lang="ts"></script>
|
||||
|
||||
<template>
|
||||
<div>plan</div>
|
||||
</template>
|
||||
|
||||
<style scoped></style>
|
||||
Loading…
Reference in New Issue