feat:个人中心页完成
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { BrowserRouter, Routes, Route } from 'react-router-dom';
|
import { BrowserRouter, Routes, Route } from 'react-router-dom';
|
||||||
|
import LayoutWrapper from './components/LayoutWrapper';
|
||||||
import Home from './pages/Home';
|
import Home from './pages/Home';
|
||||||
import Login from './pages/login/Login';
|
import Login from './pages/login/Login';
|
||||||
import Devices from './pages/devices/Devices';
|
import Devices from './pages/devices/Devices';
|
||||||
@@ -23,28 +24,30 @@ import Content from './pages/content/Content';
|
|||||||
function App() {
|
function App() {
|
||||||
return (
|
return (
|
||||||
<BrowserRouter>
|
<BrowserRouter>
|
||||||
<Routes>
|
<LayoutWrapper>
|
||||||
<Route path="/" element={<Home />} />
|
<Routes>
|
||||||
<Route path="/login" element={<Login />} />
|
<Route path="/" element={<Home />} />
|
||||||
<Route path="/devices" element={<Devices />} />
|
<Route path="/login" element={<Login />} />
|
||||||
<Route path="/devices/:id" element={<DeviceDetail />} />
|
<Route path="/devices" element={<Devices />} />
|
||||||
<Route path="/wechat-accounts" element={<WechatAccounts />} />
|
<Route path="/devices/:id" element={<DeviceDetail />} />
|
||||||
<Route path="/wechat-accounts/:id" element={<WechatAccountDetail />} />
|
<Route path="/wechat-accounts" element={<WechatAccounts />} />
|
||||||
<Route path="/workspace" element={<Workspace />} />
|
<Route path="/wechat-accounts/:id" element={<WechatAccountDetail />} />
|
||||||
<Route path="/workspace/auto-group/:id" element={<AutoGroupDetail />} />
|
<Route path="/workspace" element={<Workspace />} />
|
||||||
<Route path="/workspace/moments-sync" element={<MomentsSync />} />
|
<Route path="/workspace/auto-group/:id" element={<AutoGroupDetail />} />
|
||||||
<Route path="/workspace/moments-sync/:id" element={<MomentsSyncDetail />} />
|
<Route path="/workspace/moments-sync" element={<MomentsSync />} />
|
||||||
<Route path="/workspace/traffic-distribution" element={<TrafficDistribution />} />
|
<Route path="/workspace/moments-sync/:id" element={<MomentsSyncDetail />} />
|
||||||
<Route path="/workspace/traffic-distribution/:id" element={<TrafficDistributionDetail />} />
|
<Route path="/workspace/traffic-distribution" element={<TrafficDistribution />} />
|
||||||
<Route path="/scenarios" element={<Scenarios />} />
|
<Route path="/workspace/traffic-distribution/:id" element={<TrafficDistributionDetail />} />
|
||||||
<Route path="/profile" element={<Profile />} />
|
<Route path="/scenarios" element={<Scenarios />} />
|
||||||
<Route path="/plans" element={<Plans />} />
|
<Route path="/profile" element={<Profile />} />
|
||||||
<Route path="/orders" element={<Orders />} />
|
<Route path="/plans" element={<Plans />} />
|
||||||
<Route path="/traffic-pool" element={<TrafficPool />} />
|
<Route path="/orders" element={<Orders />} />
|
||||||
<Route path="/contact-import" element={<ContactImport />} />
|
<Route path="/traffic-pool" element={<TrafficPool />} />
|
||||||
<Route path="/content" element={<Content />} />
|
<Route path="/contact-import" element={<ContactImport />} />
|
||||||
{/* 你可以继续添加更多路由 */}
|
<Route path="/content" element={<Content />} />
|
||||||
</Routes>
|
{/* 你可以继续添加更多路由 */}
|
||||||
|
</Routes>
|
||||||
|
</LayoutWrapper>
|
||||||
</BrowserRouter>
|
</BrowserRouter>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
38
nkebao/src/components/BottomNav.tsx
Normal file
38
nkebao/src/components/BottomNav.tsx
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { Link, useLocation } from 'react-router-dom';
|
||||||
|
import { Home, Users, User, Briefcase } from 'lucide-react';
|
||||||
|
|
||||||
|
const navItems = [
|
||||||
|
{ href: "/", icon: Home, label: "首页" },
|
||||||
|
{ href: "/scenarios", icon: Users, label: "场景获客" },
|
||||||
|
{ href: "/workspace", icon: Briefcase, label: "工作台" },
|
||||||
|
{ href: "/profile", icon: User, label: "我的" },
|
||||||
|
];
|
||||||
|
|
||||||
|
export default function BottomNav() {
|
||||||
|
const location = useLocation();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<nav className="fixed bottom-0 left-0 right-0 bg-white border-t border-gray-200 z-50">
|
||||||
|
<div className="w-full mx-auto flex justify-around">
|
||||||
|
{navItems.map((item) => {
|
||||||
|
const IconComponent = item.icon;
|
||||||
|
const isActive = location.pathname === item.href;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Link
|
||||||
|
key={item.href}
|
||||||
|
to={item.href}
|
||||||
|
className={`flex flex-col items-center py-2 px-3 ${
|
||||||
|
isActive ? "text-blue-500" : "text-gray-500"
|
||||||
|
}`}
|
||||||
|
>
|
||||||
|
<IconComponent className="w-6 h-6" />
|
||||||
|
<span className="text-xs mt-1">{item.label}</span>
|
||||||
|
</Link>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
);
|
||||||
|
}
|
||||||
24
nkebao/src/components/LayoutWrapper.tsx
Normal file
24
nkebao/src/components/LayoutWrapper.tsx
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { useLocation } from 'react-router-dom';
|
||||||
|
import BottomNav from './BottomNav';
|
||||||
|
|
||||||
|
interface LayoutWrapperProps {
|
||||||
|
children: React.ReactNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function LayoutWrapper({ children }: LayoutWrapperProps) {
|
||||||
|
const location = useLocation();
|
||||||
|
|
||||||
|
// 只在四个主页显示底部导航栏:首页、场景获客、工作台和我的
|
||||||
|
const mainPages = ["/", "/scenarios", "/workspace", "/profile"];
|
||||||
|
const showBottomNav = mainPages.includes(location.pathname);
|
||||||
|
|
||||||
|
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]">
|
||||||
|
{children}
|
||||||
|
{showBottomNav && <BottomNav />}
|
||||||
|
</main>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -147,7 +147,7 @@ export default function Home() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex-1 overflow-y-auto pb-16 bg-gray-50">
|
<div className="flex-1 overflow-y-auto pb-20 bg-gray-50">
|
||||||
<header className="sticky top-0 z-10 bg-white border-b">
|
<header className="sticky top-0 z-10 bg-white border-b">
|
||||||
<div className="flex justify-between items-center p-4">
|
<div className="flex justify-between items-center p-4">
|
||||||
<h1 className="text-xl font-semibold text-blue-600">存客宝</h1>
|
<h1 className="text-xl font-semibold text-blue-600">存客宝</h1>
|
||||||
|
|||||||
Reference in New Issue
Block a user