feat: 登录跳转多标签页面

This commit is contained in:
duanshuwen
2025-11-18 22:10:04 +08:00
parent a0d8b07f67
commit 492ad76c42
5 changed files with 134 additions and 93 deletions

View File

@@ -2,7 +2,7 @@ import { createRouter, createWebHistory } from "vue-router";
const routes = [
{
path: "/",
path: "/login",
name: "Login",
component: () => import("@/views/login/index.vue"),
},
@@ -27,10 +27,10 @@ const router = createRouter({
router.beforeEach((to, _from, next) => {
const token = localStorage.getItem("token");
if (to.meta && (to.meta as any).requiresAuth && !token) {
next({ path: "/" });
next({ path: "/login" });
return;
}
if (to.path === "/" && token) {
if (token && to.path !== "/browser") {
next({ path: "/browser" });
return;
}