实现路由管理系统

- 创建 router.js 统一管理路由配置
- App.jsx 重构为使用 RouterProvider
- 创建 pages 目录结构:
  - Layout.jsx: 主布局组件,包含 header 和 footer
  - Home.jsx: 首页实验列表(原 App.jsx 内容)
  - ExperimentDetail.jsx: 实验详情页,展示完整实验信息
  - NotFound.jsx: 404 页面
- 实现页面导航功能:
  - 点击实验项目可跳转到详情页
  - 详情页支持返回列表
  - 完善的错误处理和 404 页面
- 实验详情页功能:
  - 展示实验目标、步骤、注意事项
  - 实验信息卡片(时长、难度、类型)
  - 交互式按钮(开始实验、下载资料)
- 所有代码通过 ESLint 检查

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
zhongyidianandClaude committed 2025-10-16 23:25:17 +08:00
1 parent 7a577d8010
commit 6b84a5ed98
6 files changed
+400 -113

No files matched your search

+37
View File
@@ -0,0 +1,37 @@
import { Link } from 'react-router-dom';
import { Home, ArrowLeft } from 'lucide-react';
export default function NotFound() {
return (
<div className="max-w-2xl mx-auto text-center">
<div className="bg-white rounded-xl shadow-lg p-12">
<div className="mb-8">
<h1 className="text-9xl font-bold text-indigo-600 mb-4">404</h1>
<h2 className="text-3xl font-bold text-gray-800 mb-2">
页面未找到
</h2>
<p className="text-gray-600 text-lg">
抱歉,您访问的页面不存在或已被移除。
</p>
</div>
<div className="flex flex-col sm:flex-row gap-4 justify-center">
<Link
to="/"
className="inline-flex items-center justify-center gap-2 px-6 py-3 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700 transition-colors font-semibold"
>
<Home size={20} />
返回首页
</Link>
<button
onClick={() => window.history.back()}
className="inline-flex items-center justify-center gap-2 px-6 py-3 border-2 border-indigo-600 text-indigo-600 rounded-lg hover:bg-indigo-50 transition-colors font-semibold"
>
<ArrowLeft size={20} />
返回上一页
</button>
</div>
</div>
</div>
);
}