Files
JayuCloud/.codex-tmp/edge-home-desktop-shell-nav-fixed2/Default/Cache/Cache_Data/f_000005
T

348 lines
40 KiB
Plaintext
Raw Normal View History

2026-05-29 13:30:56 +08:00
import.meta.env = {"BASE_URL": "/", "DEV": true, "MODE": "development", "PROD": false, "SSR": false, "VITE_ADMIN_API_BASE_URL": "/admin/api", "VITE_API_BASE_URL": "/api", "VITE_DEV_PROXY_TARGET": "http://127.0.0.1:80"};import { createRouter, createWebHistory } from "/node_modules/.vite/deps/vue-router.js?v=e2549d3d";
import {
canAccessAdminRoute,
clearAdminBootstrapSession,
ensureAdminAuthBootstrap,
getAdminBootstrapSnapshot,
resolveAdminLandingPath
} from "/src/utils/admin-auth-bootstrap.ts";
const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
routes: [
{
path: "/",
name: "auth",
component: () => import("/src/views/AuthView.vue?t=1780022706943"),
meta: { requiresAuth: false, hideNav: true, isAdmin: false }
},
{
path: "/home",
name: "home",
component: () => import("/src/views/HomeView.vue?t=1780025129387"),
meta: { requiresAuth: false, isAdmin: false }
},
{
path: "/products",
name: "products",
component: () => import("/src/views/ProductListView.vue?t=1780025815410"),
meta: { requiresAuth: false, isAdmin: false }
},
{
path: "/product/:id",
name: "product-detail",
component: () => import("/src/views/ProductDetailView.vue?t=1780025173812"),
meta: { requiresAuth: false, hideNav: true, isAdmin: false }
},
{
path: "/cart",
name: "cart",
component: () => import("/src/views/CartView.vue?t=1780023437871"),
meta: { requiresAuth: true, isAdmin: false }
},
{
path: "/profile",
name: "profile",
component: () => import("/src/views/ProfileView.vue?t=1780023297116"),
meta: { requiresAuth: true, isAdmin: false }
},
{
path: "/shop/:id",
name: "shop-detail",
component: () => import("/src/views/ShopDetailView.vue?t=1780023027479"),
meta: { requiresAuth: false, hideNav: true, isAdmin: false }
},
{
path: "/artist/:id",
name: "artist-profile",
component: () => import("/src/views/ArtistProfileView.vue"),
meta: { requiresAuth: false, hideNav: true, isAdmin: false }
},
{
path: "/wishlist",
name: "wishlist",
component: () => import("/src/views/WishlistView.vue?t=1780022972718"),
meta: { requiresAuth: true, isAdmin: false }
},
{
path: "/orders",
name: "orders",
component: () => import("/src/views/OrderView.vue?t=1780023405857"),
meta: { requiresAuth: true, hideNav: true, isAdmin: false }
},
{
path: "/orders/:id",
name: "order-detail",
component: () => import("/src/views/OrderDetailView.vue"),
meta: { requiresAuth: true, hideNav: true, isAdmin: false }
},
{
path: "/after-sales",
name: "after-sales",
component: () => import("/src/views/AfterSalesView.vue"),
meta: { requiresAuth: true, hideNav: true, isAdmin: false }
},
{
path: "/after-sale/apply",
name: "after-sale-apply",
component: () => import("/src/views/AfterSaleApplyView.vue"),
meta: { requiresAuth: true, hideNav: true, isAdmin: false }
},
{
path: "/service-progress",
name: "service-progress",
component: () => import("/src/views/ServiceProgressView.vue"),
meta: { requiresAuth: true, hideNav: true, isAdmin: false }
},
{
path: "/help",
name: "help",
component: () => import("/src/views/HelpView.vue?t=1780022741952"),
meta: { requiresAuth: false, hideNav: true, isAdmin: false }
},
{
path: "/artist-orders",
name: "artist-orders",
component: () => import("/src/views/ArtistOrderView.vue"),
meta: { requiresAuth: true, hideNav: true, isAdmin: false, permissionCode: "order:view" }
},
{
path: "/artist-calendar",
name: "artist-calendar",
component: () => import("/src/views/ArtistCalendarView.vue"),
meta: { requiresAuth: true, hideNav: true, isAdmin: false, permissionCode: "order:view" }
},
{
path: "/settings",
name: "settings",
component: () => import("/src/views/SettingsView.vue?t=1780022647981"),
meta: { requiresAuth: true, hideNav: true, isAdmin: false }
},
{
path: "/settings/account",
name: "account-settings",
component: () => import("/src/views/AccountSettingsView.vue"),
meta: { requiresAuth: true, hideNav: true, isAdmin: false }
},
{
path: "/settings/password",
name: "password-settings",
component: () => import("/src/views/PasswordSettingsView.vue"),
meta: { requiresAuth: true, hideNav: true, isAdmin: false }
},
{
path: "/coupons",
name: "coupons",
component: () => import("/src/views/CouponView.vue?t=1780022683446"),
meta: { requiresAuth: true, isAdmin: false, hideNav: true }
},
{
path: "/vip-center",
name: "vip-center",
component: () => import("/src/views/VipCenterView.vue?t=1780022887694"),
meta: { requiresAuth: true, isAdmin: false, hideNav: true }
},
{
path: "/notifications",
name: "notifications",
component: () => import("/src/views/NotificationsView.vue?t=1780022921379"),
meta: { requiresAuth: true, isAdmin: false, hideNav: true }
},
{
path: "/admin/login",
name: "admin-login",
component: () => import("/src/views/admin/AdminLoginView.vue"),
meta: { requiresAuth: false, isAdmin: true, hideNav: true }
},
{
path: "/admin",
component: () => import("/src/views/admin/AdminLayout.vue"),
meta: { requiresAuth: true, isAdmin: true, hideNav: true },
children: [
{
path: "",
name: "admin",
component: () => import("/src/views/admin/HomeView.vue"),
meta: { requiresAuth: true, isAdmin: true, hideNav: true }
},
{
path: "dashboard",
name: "admin-dashboard",
component: () => import("/src/views/admin/DashboardView.vue"),
meta: { requiresAuth: true, isAdmin: true, hideNav: true, permissionCode: "dashboard:view" }
},
{
path: "users",
name: "admin-users",
component: () => import("/src/views/admin/UsersView.vue"),
meta: { requiresAuth: true, isAdmin: true, hideNav: true, permissionCode: "user:view" }
},
{
path: "products",
name: "admin-products",
component: () => import("/src/views/admin/ProductsView.vue"),
meta: { requiresAuth: true, isAdmin: true, hideNav: true, permissionCode: "product:view" }
},
{
path: "coupons",
name: "admin-coupons",
component: () => import("/src/views/admin/CouponsView.vue"),
meta: { requiresAuth: true, isAdmin: true, hideNav: true, permissionCode: "coupon:view" }
},
{
path: "comments",
name: "admin-comments",
component: () => import("/src/views/admin/CommentsView.vue"),
meta: { requiresAuth: true, isAdmin: true, hideNav: true, permissionCode: "comment:view" }
},
{
path: "shops",
name: "admin-shops",
component: () => import("/src/views/admin/ShopsView.vue?t=1780018240912"),
meta: { requiresAuth: true, isAdmin: true, hideNav: true, permissionCode: "shop:view" }
},
{
path: "permissions",
name: "admin-permissions",
component: () => import("/src/views/admin/PermissionsView.vue"),
meta: { requiresAuth: true, isAdmin: true, hideNav: true, permissionCode: "permission:view" }
},
{
path: "orders",
name: "admin-orders",
component: () => import("/src/views/admin/OrdersView.vue"),
meta: { requiresAuth: true, isAdmin: true, hideNav: true, permissionCode: "order:view" }
},
{
path: "schedules",
name: "admin-schedules",
component: () => import("/src/views/admin/SchedulesView.vue"),
meta: { requiresAuth: true, isAdmin: true, hideNav: true, permissionCode: "schedule:view" }
},
{
path: "after-sales",
name: "admin-after-sales",
component: () => import("/src/views/admin/AfterSalesView.vue"),
meta: { requiresAuth: true, isAdmin: true, hideNav: true, permissionCode: "after_sale:view" }
},
{
path: "inventory",
name: "admin-inventory",
component: () => import("/src/views/admin/InventoryView.vue"),
meta: { requiresAuth: true, isAdmin: true, hideNav: true, permissionCode: "inventory:view" }
},
{
path: "campaigns",
name: "admin-campaigns",
component: () => import("/src/views/admin/CampaignsView.vue"),
meta: { requiresAuth: true, isAdmin: true, hideNav: true, permissionCode: "campaign:view" }
},
{
path: "manage",
name: "admin-manage",
component: () => import("/src/views/admin/ManageView.vue"),
meta: { requiresAuth: true, isAdmin: true, hideNav: true }
},
{
path: "profile",
name: "admin-profile",
component: () => import("/src/views/admin/ProfileView.vue"),
meta: { requiresAuth: true, isAdmin: true, hideNav: true }
},
{
path: "tags",
name: "admin-tags",
component: () => import("/src/views/admin/TagsView.vue"),
meta: { requiresAuth: true, isAdmin: true, hideNav: true, permissionCode: "tag:view" }
},
{
path: "nail-artists",
name: "admin-nail-artists",
component: () => import("/src/views/admin/NailArtistsView.vue"),
meta: { requiresAuth: true, isAdmin: true, hideNav: true, permissionCode: "nail_artist:view" }
},
{
path: "messages",
name: "admin-messages",
component: () => import("/src/views/admin/SystemMessagesView.vue"),
meta: { requiresAuth: true, isAdmin: true, hideNav: true, permissionCode: "message:view" }
},
{
path: "announcements",
name: "admin-announcements",
component: () => import("/src/views/admin/AnnouncementsView.vue"),
meta: { requiresAuth: true, isAdmin: true, hideNav: true, permissionCode: "announcement:view" }
},
{
path: "vip-recharge-plans",
name: "admin-vip-recharge-plans",
component: () => import("/src/views/admin/VipRechargePlansView.vue"),
meta: { requiresAuth: true, isAdmin: true, hideNav: true, permissionCode: "user:vip:manage" }
},
{
path: "messagehub-push-configs",
name: "admin-messagehub-push-configs",
component: () => import("/src/views/admin/MessageHubPushConfigsView.vue"),
meta: { requiresAuth: true, isAdmin: true, hideNav: true, permissionCode: "messagehub:config:manage" }
},
{
path: "legal-agreements",
name: "admin-legal-agreements",
component: () => import("/src/views/admin/LegalAgreementsView.vue"),
meta: { requiresAuth: true, isAdmin: true, hideNav: true, permissionCode: "legal_agreement:manage" }
}
]
},
{
path: "/:pathMatch(.*)*",
name: "not-found",
component: () => import("/src/views/NotFoundView.vue?t=1780022708627"),
meta: { requiresAuth: false, hideNav: true, isAdmin: false }
}
]
});
router.beforeEach(async (to) => {
const isAdminRoute = Boolean(to.meta.isAdmin);
const requiresAuth = Boolean(to.meta.requiresAuth);
if (isAdminRoute) {
const snapshot = getAdminBootstrapSnapshot();
if (to.path === "/admin/login") {
if (!snapshot.token || !snapshot.userInfo) {
return true;
}
const state = await ensureAdminAuthBootstrap();
return state === "ready" ? resolveAdminLandingPath() : true;
}
if (requiresAuth && (!snapshot.token || !snapshot.userInfo)) {
clearAdminBootstrapSession();
return "/admin/login";
}
const bootstrapState = await ensureAdminAuthBootstrap();
if (bootstrapState !== "ready") {
return "/admin/login";
}
if (!canAccessAdminRoute(to.path, to.meta.permissionCode)) {
return resolveAdminLandingPath();
}
return true;
}
const token = localStorage.getItem("accessToken") || sessionStorage.getItem("accessToken");
if (requiresAuth && !token) {
return "/";
}
if (to.path === "/" && token) {
return "/home";
}
if (requiresAuth && token) {
const userInfo = localStorage.getItem("userInfo");
if (!userInfo) {
localStorage.removeItem("accessToken");
localStorage.removeItem("refreshToken");
sessionStorage.removeItem("accessToken");
return "/";
}
}
return true;
});
export default router;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGNyZWF0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