R110/A2,A3 补齐手机和PC路由分流
这个提交包含在:
@@ -36,3 +36,88 @@ export function shouldPreferMobileWorkplace() {
|
||||
export function resolveDefaultWorkspacePath() {
|
||||
return shouldPreferMobileWorkplace() ? "/mobile" : "/portal";
|
||||
}
|
||||
|
||||
function encodeSegment(value: string) {
|
||||
return encodeURIComponent(value);
|
||||
}
|
||||
|
||||
export function resolveMobileEquivalentPath(pathname: string, search = "") {
|
||||
const normalizedPath = pathname.replace(/\/+$/, "") || "/";
|
||||
|
||||
if (normalizedPath === "/" || normalizedPath === "/portal" || normalizedPath === "/dashboard") {
|
||||
return "/mobile";
|
||||
}
|
||||
|
||||
if (normalizedPath === "/notifications") {
|
||||
return "/mobile/notifications";
|
||||
}
|
||||
|
||||
if (normalizedPath === "/settings/profile") {
|
||||
return "/mobile/profile";
|
||||
}
|
||||
|
||||
if (normalizedPath === "/reimbursements" || normalizedPath === "/reimbursements/dashboard") {
|
||||
return "/mobile/reimbursements";
|
||||
}
|
||||
|
||||
const reimbursementPrintMatch = normalizedPath.match(/^\/reimbursements\/([^/]+)\/print$/);
|
||||
if (reimbursementPrintMatch?.[1]) {
|
||||
return `/mobile/reimbursements/${encodeSegment(reimbursementPrintMatch[1])}`;
|
||||
}
|
||||
|
||||
const reimbursementDetailMatch = normalizedPath.match(/^\/reimbursements\/([^/]+)$/);
|
||||
if (reimbursementDetailMatch?.[1]) {
|
||||
return `/mobile/reimbursements/${encodeSegment(reimbursementDetailMatch[1])}`;
|
||||
}
|
||||
|
||||
if (normalizedPath === "/leave-requests") {
|
||||
return "/mobile/leave";
|
||||
}
|
||||
|
||||
if (normalizedPath === "/invoice-pool") {
|
||||
return "/mobile/capture";
|
||||
}
|
||||
|
||||
const workflowTaskMatch = normalizedPath.match(/^\/workflow\/tasks\/([^/]+)$/);
|
||||
if (workflowTaskMatch?.[1]) {
|
||||
return `/mobile/approvals?${new URLSearchParams({ taskId: workflowTaskMatch[1] }).toString()}`;
|
||||
}
|
||||
|
||||
if (normalizedPath === "/workflow/tasks") {
|
||||
return "/mobile/approvals";
|
||||
}
|
||||
|
||||
if (normalizedPath === "/assets" || normalizedPath === "/inventory-checks") {
|
||||
return "/mobile/assets/scan";
|
||||
}
|
||||
|
||||
if (
|
||||
normalizedPath.startsWith("/system") ||
|
||||
normalizedPath.startsWith("/people") ||
|
||||
normalizedPath.startsWith("/organization") ||
|
||||
normalizedPath.startsWith("/payroll") ||
|
||||
normalizedPath.startsWith("/performance")
|
||||
) {
|
||||
return "/mobile/me";
|
||||
}
|
||||
|
||||
if (
|
||||
normalizedPath.startsWith("/projects") ||
|
||||
normalizedPath.startsWith("/contracts-registry") ||
|
||||
normalizedPath.startsWith("/purchase-requests") ||
|
||||
normalizedPath.startsWith("/travel-requests") ||
|
||||
normalizedPath.startsWith("/payment-batches") ||
|
||||
normalizedPath.startsWith("/ap-operations") ||
|
||||
normalizedPath.startsWith("/weekly-reports") ||
|
||||
normalizedPath.startsWith("/todos") ||
|
||||
normalizedPath.startsWith("/team") ||
|
||||
normalizedPath.startsWith("/attendance") ||
|
||||
normalizedPath.startsWith("/budgets") ||
|
||||
normalizedPath.startsWith("/announcements") ||
|
||||
normalizedPath.startsWith("/delegations")
|
||||
) {
|
||||
return "/mobile";
|
||||
}
|
||||
|
||||
return search ? `${pathname}${search}` : pathname;
|
||||
}
|
||||
|
||||
在新工单中引用
屏蔽一个用户