GPU_Web/src/router/index.ts
2025-11-25 14:49:18 +08:00

142 lines
3.6 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// src/router/index.ts
import { createRouter, createWebHistory, RouteRecordRaw } from "vue-router";
import Layout from "@/components/Layout.vue";
import { Components } from "ant-design-vue/es/date-picker/generatePicker";
const routes: RouteRecordRaw[] = [
{
path: "/",
// component: HomeView // 这个页面独立不使用Layout
redirect: "/layout/home",
},
{
path: "/login",
name: "Login",
component: () => import("@/views/login/index.vue"),
},
{
path: "/404",
name: "404",
component: () => import("@/views/404.vue"),
},
{
path: "/:pathMatch(.*)*",
name: "NotFound",
component: () => import("@/views/404.vue"),
},
{
path: "/layout",
name: "Layout",
component: () => import("@/views/layout/index.vue"),
children: [
{
path: "home",
name: "LayoutHome",
component: () => import("@/views/home/index.vue"),
},
{
path: "admin",
name: "Admin",
component: () => import("@/views/admin/index.vue"),
children: [
{
path: "",
redirect: "home",
},
{
path: "home",
name: "AdminHome",
component: () => import("@/views/admin/home/index.vue"),
},
{
path: "instance",
name: "Instance",
component: () => import("@/views/admin/instance/index.vue"),
},
{
path: "instanceCreate",
name: "InstanceCreate",
component: () => import("@/views/admin/instanceCreate/index.vue"),
},
{
path: "fileStore",
name: "FileStore",
component: () => import("@/views/admin/fileStore/index.vue"),
},
{
path: "history",
name: "History",
component: () => import("@/views/admin/account/history/index.vue"),
},
{
path: "security",
name: "Security",
component: () => import("@/views/admin/account/security/index.vue"),
},
{
path: "realnameAuth",
name: "RealnameAuth",
component: () => import("@/views/admin/account/realnameAuth/index.vue"),
},
{
path: "enterRealAuth",
name: "EnterRealAuth",
component: () => import("@/views/admin/account/enterRealAuth/index.vue"),
},
{
path: "image",
name: "Image",
component: () => import("@/views/admin/image/index.vue"),
},
],
},
],
},
// {
// path: '/fileStore',
// name: 'FileStore',
// component: Layout, // 使用Layout包装FileStore
// children: [
// {
// path: '', // 空路径,访问 /fileStore 时显示FileStore组件
// name: 'FileStoreContent',
// component: FileStore
// },
// {
// path: '/accountSecurity',
// name: 'AccountSecurity',
// component: AccountSecurity
// },
// {
// path: '/accountHistory',
// name: 'AccountHistory',
// component: AccountHistory
// }
// ]
// },
// // 可以继续添加其他使用Layout的路由
// {
// path: '/container',
// name: 'Container',
// component: Layout,
// children: [
// {
// path: '',
// name: 'ContainerContent',
// component: () => import('@/views/controlPanel/container/index.vue')
// }
// ]
// }
];
const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
routes,
});
export default router;