This commit is contained in:
wushumin
2026-05-11 15:28:27 +08:00
commit 9aac78b8da
289 changed files with 67193 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
import type { Router } from "vue-router";
let appRouter: Router | null = null;
export function setAppRouter(router: Router) {
appRouter = router;
}
export function goToAdminLogin() {
if (appRouter) {
if (appRouter.currentRoute.value.name !== "login") {
appRouter.replace({ name: "login" });
}
return;
}
if (window.location.hash !== "#/login") {
window.history.replaceState({}, "", "/#/login");
window.dispatchEvent(new PopStateEvent("popstate"));
}
}
export function goToAdminHome() {
if (appRouter) {
appRouter.replace({ name: "dashboard" });
return;
}
if (window.location.hash !== "#/dashboard") {
window.history.replaceState({}, "", "/#/dashboard");
window.dispatchEvent(new PopStateEvent("popstate"));
}
}