chore: 配置前端 Vite 环境,搭建全局路由结构与基础样式
This commit is contained in:
@ -1,23 +1,35 @@
|
||||
import { BrowserRouter, Routes, Route } from "react-router-dom";
|
||||
import { BrowserRouter, Routes, Route, Navigate } from "react-router-dom";
|
||||
|
||||
function Home() {
|
||||
return (
|
||||
<div className="flex min-h-screen items-center justify-center bg-gray-50">
|
||||
<h1 className="text-2xl font-bold text-gray-800">
|
||||
工厂生产流转管理系统
|
||||
</h1>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
import AppLayout from "./components/layout/AppLayout";
|
||||
import ScanPage from "./pages/ScanPage";
|
||||
import MyTasksPage from "./pages/MyTasksPage";
|
||||
import NotificationsPage from "./pages/NotificationsPage";
|
||||
import ProfilePage from "./pages/ProfilePage";
|
||||
|
||||
function App() {
|
||||
import AdminLayout from "./components/layout/AdminLayout";
|
||||
import AdminDashboard from "./pages/admin/AdminDashboard";
|
||||
import AdminProductsPage from "./pages/admin/AdminProductsPage";
|
||||
|
||||
export default function App() {
|
||||
return (
|
||||
<BrowserRouter>
|
||||
<Routes>
|
||||
<Route path="/" element={<Home />} />
|
||||
{/* 移动端 */}
|
||||
<Route path="/" element={<Navigate to="/scan" replace />} />
|
||||
<Route element={<AppLayout />}>
|
||||
<Route path="/scan" element={<ScanPage />} />
|
||||
<Route path="/tasks" element={<MyTasksPage />} />
|
||||
<Route path="/notifications" element={<NotificationsPage />} />
|
||||
<Route path="/profile" element={<ProfilePage />} />
|
||||
</Route>
|
||||
|
||||
{/* PC 管理端 */}
|
||||
<Route path="/admin" element={<Navigate to="/admin/dashboard" replace />} />
|
||||
<Route element={<AdminLayout />}>
|
||||
<Route path="/admin/dashboard" element={<AdminDashboard />} />
|
||||
<Route path="/admin/products" element={<AdminProductsPage />} />
|
||||
</Route>
|
||||
</Routes>
|
||||
</BrowserRouter>
|
||||
);
|
||||
}
|
||||
|
||||
export default App;
|
||||
|
||||
@ -1 +1,36 @@
|
||||
@import "tailwindcss";
|
||||
|
||||
/* ============================================================
|
||||
移动端安全区适配(刘海屏 / 底部指示条)
|
||||
TailwindCSS v4 自定义 utility
|
||||
============================================================ */
|
||||
|
||||
@utility pt-safe {
|
||||
padding-top: max(1rem, env(safe-area-inset-top));
|
||||
}
|
||||
|
||||
@utility pb-safe {
|
||||
padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
|
||||
}
|
||||
|
||||
/* ============================================================
|
||||
全局基样式
|
||||
============================================================ */
|
||||
|
||||
html {
|
||||
/* 防止 iOS Safari 橡皮筋效果导致误触导航 */
|
||||
overscroll-behavior: none;
|
||||
}
|
||||
|
||||
body {
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
/* 禁止用户缩放(移动端 PWA 常用) */
|
||||
touch-action: manipulation;
|
||||
}
|
||||
|
||||
/* 隐藏默认的滚动条(移动端无滚动条更干净) */
|
||||
::-webkit-scrollbar {
|
||||
width: 0;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user