feat: 登录模块完成

This commit is contained in:
许永平
2025-07-04 15:49:22 +08:00
parent aad2d055b7
commit 8de943d4a4
22 changed files with 1661 additions and 257 deletions

View File

@@ -2,6 +2,26 @@ import React from 'react';
import { useLocation } from 'react-router-dom';
import BottomNav from './BottomNav';
// 不需要底部导航的页面路径
const NO_BOTTOM_NAV_PATHS = [
'/login',
'/register',
'/forgot-password',
'/reset-password',
'/devices',
'/devices/',
'/wechat-accounts',
'/wechat-accounts/',
'/scenarios/new',
'/scenarios/',
'/plans/',
'/workspace/auto-group/',
'/workspace/moments-sync/',
'/workspace/traffic-distribution/',
'/404',
'/500'
];
interface LayoutWrapperProps {
children: React.ReactNode;
}
@@ -9,16 +29,23 @@ interface LayoutWrapperProps {
export default function LayoutWrapper({ children }: LayoutWrapperProps) {
const location = useLocation();
// 只在四个主页显示底部导航栏:首页、场景获客、工作台和我的
const mainPages = ["/", "/scenarios", "/workspace", "/profile"];
const showBottomNav = mainPages.includes(location.pathname);
// 检查当前路径是否需要底部导航
const shouldShowBottomNav = !NO_BOTTOM_NAV_PATHS.some(path =>
location.pathname.startsWith(path)
);
// 如果是登录页面,直接渲染内容(不显示底部导航)
if (location.pathname === '/login') {
return <>{children}</>;
}
// 其他页面显示底部导航
return (
<div className="mx-auto w-full">
<main className="w-full mx-auto bg-white min-h-screen flex flex-col relative lg:max-w-7xl xl:max-w-[1200px]">
<div className="flex flex-col h-screen">
<div className="flex-1 overflow-hidden">
{children}
{showBottomNav && <BottomNav />}
</main>
</div>
{shouldShowBottomNav && <BottomNav />}
</div>
);
}