This commit is contained in:
Your Name
2026-04-16 13:05:07 +08:00
commit 32efff1670
99 changed files with 9974 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
import { createRouter, createWebHashHistory, RouteRecordRaw } from "vue-router";
import { useAuthStore } from "@/stores/auth";
const routes: RouteRecordRaw[] = [
{
path: "/login",
name: "login",
component: () => import("@/views/auth/LoginView.vue"),
meta: { public: true, title: "登录" }
},
{
path: "/",
component: () => import("@/layouts/MainLayout.vue"),
children: [
{ path: "", redirect: "/dashboard" },
{ path: "dashboard", name: "dashboard", component: () => import("@/views/dashboard/DashboardView.vue"), meta: { title: "概览" } },
{ path: "runtime", name: "runtime", component: () => import("@/views/runtime/RuntimeView.vue"), meta: { title: "运行中心" } },
{ path: "settings", name: "settings", component: () => import("@/views/settings/SettingsView.vue"), meta: { title: "系统设置" } },
{ path: "imports", name: "imports", component: () => import("@/views/imports/ImportsView.vue"), meta: { title: "域名导入" } },
{ path: "detect", name: "detect", component: () => import("@/views/detect/DetectView.vue"), meta: { title: "检测控制" } },
{ path: "domains", name: "domains", component: () => import("@/views/domains/DomainsView.vue"), meta: { title: "域名筛选" } },
{ path: "exports", name: "exports", component: () => import("@/views/exports/ExportsView.vue"), meta: { title: "导出中心" } },
{ path: "logs", name: "logs", component: () => import("@/views/logs/LogsView.vue"), meta: { title: "日志诊断" } }
]
}
];
const router = createRouter({
history: createWebHashHistory(),
routes,
scrollBehavior: () => ({ top: 0, left: 0 })
});
router.beforeEach((to) => {
const authStore = useAuthStore();
const title = import.meta.env.VITE_APP_TITLE || "domainCheck 管理后台";
document.title = to.meta?.title ? `${String(to.meta.title)} - ${title}` : title;
if (to.meta?.public) {
return true;
}
if (!authStore.token) {
return "/login";
}
return true;
});
export default router;