LDF 收口本地页面路由门禁

这个提交包含在:
2026-05-17 10:22:06 +08:00
父节点 ab80d481cb
当前提交 f38592c881
共修改 4 个文件,包含 22 行新增和 1 行删除
+4 -1
查看文件
@@ -11,7 +11,10 @@ import { resolveMobileEquivalentPath, shouldPreferMobileWorkplace } from "../lib
export function AppShellLayout() {
const location = useLocation();
const isMobileRoute = location.pathname.startsWith("/mobile");
const isMobileDeepRoute = /^\/mobile\/(?:reimbursements|approvals|leave|purchase-requests)\/[^/]+$/.test(location.pathname);
const mobileSearchParams = new URLSearchParams(location.search);
const isMobileDeepRoute =
/^\/mobile\/(?:reimbursements|approvals|leave|purchase-requests)\/[^/]+$/.test(location.pathname) ||
(location.pathname === "/mobile/approvals" && mobileSearchParams.has("taskId"));
const showMobileBottomNav = isMobileRoute && !isMobileDeepRoute;
const mobileEquivalentPath = !isMobileRoute && shouldPreferMobileWorkplace()
? resolveMobileEquivalentPath(location.pathname, location.search)
+4
查看文件
@@ -76,6 +76,10 @@ export function resolveMobileEquivalentPath(pathname: string, search = "") {
if (leaveRequestId) {
return `/mobile/leave/${encodeSegment(leaveRequestId)}`;
}
const action = searchParams.get("action") ?? searchParams.get("view");
if (action === "create" || action === "form") {
return "/mobile/leave?view=form";
}
return "/mobile/leave";
}
@@ -140,6 +140,11 @@ test.describe.serial("R110 手机和 PC 路由分流", () => {
await mobile.page.goto("/leave-requests");
await expect(mobile.page).toHaveURL(/\/mobile\/leave$/);
await expect(mobile.page.getByTestId("mobile-leave-records")).toBeVisible();
await expectNoPcShell(mobile.page);
await mobile.page.goto("/leave-requests?action=create");
await expect(mobile.page).toHaveURL(/\/mobile\/leave\?view=form$/);
await expect(mobile.page.getByTestId("mobile-leave-form")).toBeVisible();
await expectNoPcShell(mobile.page);