发布需要校验实名认证

This commit is contained in:
yml
2026-05-24 23:00:28 +08:00
parent c13bacbc3e
commit fd73bb39be
2 changed files with 29 additions and 3 deletions
+6 -3
View File
@@ -140,7 +140,7 @@ const router = createRouter({
path: "/seller/listings/create",
name: "seller-listing-create",
component: () => import("@/views/seller/SellerListingCreateView.vue"),
meta: { requiresAuth: true },
meta: { requiresAuth: true, requiresRealname: true },
},
{
path: "/seller/handoffs",
@@ -253,18 +253,21 @@ router.beforeEach(async (to) => {
if (to.meta.requiresRealname) {
const session = useSessionStore();
const loginPath = to.path.startsWith("/m") ? "/m/login" : "/login";
const realnamePath = to.path.startsWith("/m") ? "/m/realname" : "/realname";
if (session.realnameStatus !== "verified") {
try {
await session.loadMe();
} catch {
if (!localStorage.getItem("access_token")) {
return { path: "/m/login", query: { redirect: to.fullPath } };
return { path: loginPath, query: { redirect: to.fullPath } };
}
}
}
if (session.realnameStatus !== "verified") {
return { path: "/m/realname", query: { redirect: to.fullPath } };
return { path: realnamePath, query: { redirect: to.fullPath } };
}
}