R110/A2,A3 补齐手机和PC路由分流

这个提交包含在:
2026-05-08 02:25:14 +08:00
父节点 3354608e20
当前提交 ee59ecfc45
共修改 9 个文件,包含 298 行新增和 17 行删除
+6 -3
查看文件
@@ -6,11 +6,14 @@ import { Sidebar } from "../components/navigation/Sidebar";
import { Topbar } from "../components/navigation/Topbar";
import { resolvePageMeta } from "../features/navigation/schema";
import { writeRecentVisit } from "../lib/recentVisits";
import { shouldPreferMobileWorkplace } from "../lib/runtimeContext";
import { resolveMobileEquivalentPath, shouldPreferMobileWorkplace } from "../lib/runtimeContext";
export function AppShellLayout() {
const location = useLocation();
const isMobileRoute = location.pathname.startsWith("/mobile");
const mobileEquivalentPath = !isMobileRoute && shouldPreferMobileWorkplace()
? resolveMobileEquivalentPath(location.pathname, location.search)
: null;
useEffect(() => {
const pathname = location.pathname;
@@ -20,8 +23,8 @@ export function AppShellLayout() {
writeRecentVisit(pathname, resolvePageMeta(pathname).title);
}, [location.pathname]);
if (location.pathname === "/portal" && shouldPreferMobileWorkplace()) {
return <Navigate to="/mobile" replace />;
if (mobileEquivalentPath && mobileEquivalentPath !== `${location.pathname}${location.search}`) {
return <Navigate to={mobileEquivalentPath} replace />;
}
return (