LDF 收口本地页面路由门禁
这个提交包含在:
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
在新工单中引用
屏蔽一个用户