Skip to content

Commit 783f8f6

Browse files
committed
Add NotFound page and README
1 parent 2b17e65 commit 783f8f6

4 files changed

Lines changed: 164 additions & 0 deletions

File tree

README.md

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
# HumanOS - 人类测评平台
2+
3+
[![GitHub Pages](https://img.shields.io/badge/部署-GitHub Pages-blue?style=flat-square)](https://badhope.github.io/humanity)
4+
[![React](https://img.shields.io/badge/React-18-blue?style=flat-square)](https://reactjs.org/)
5+
[![TypeScript](https://img.shields.io/badge/TypeScript-5-blue?style=flat-square)](https://www.typescriptlang.org/)
6+
[![Vite](https://img.shields.io/badge/Vite-5-blue?style=flat-square)](https://vitejs.dev/)
7+
8+
## 项目简介
9+
10+
HumanOS 是一个专业的心理测评静态网站应用,聚合心理测评、人格测试、认知能力、价值观与职业倾向等多维度人类测评。
11+
12+
## 技术栈
13+
14+
- **前端框架**: React 18 + TypeScript
15+
- **构建工具**: Vite 5
16+
- **路由**: React Router v6
17+
- **状态管理**: Zustand
18+
- **本地数据库**: Dexie.js (IndexedDB)
19+
- **样式**: Tailwind CSS
20+
- **动画**: Framer Motion + GSAP + Three.js
21+
- **图表**: Recharts + D3.js + Chart.js
22+
- **UI 组件**: Radix UI
23+
- **图标**: Lucide React
24+
- **动画效果**: Lottie React
25+
26+
## 快速开始
27+
28+
### 安装依赖
29+
30+
```bash
31+
npm install
32+
```
33+
34+
### 本地开发
35+
36+
```bash
37+
npm run dev
38+
```
39+
40+
访问 `http://localhost:5173`
41+
42+
### 生产构建
43+
44+
```bash
45+
npm run build
46+
```
47+
48+
构建产物在 `dist/` 目录
49+
50+
### 预览构建
51+
52+
```bash
53+
npm run preview
54+
```
55+
56+
## 部署到 GitHub Pages
57+
58+
项目已配置 GitHub Actions,push 到 `main` 分支后自动部署。
59+
60+
部署地址: https://badhope.github.io/humanity/
61+
62+
## 项目结构
63+
64+
```
65+
src/
66+
├── components/ # UI 组件
67+
│ ├── 3d/ # Three.js 3D 背景
68+
│ ├── atoms/ # 基础原子组件
69+
│ ├── charts/ # 图表组件
70+
│ └── molecules/ # 分子组件
71+
├── features/ # 功能模块
72+
│ ├── animation/ # 动画配置
73+
│ ├── assessment/ # 测评引擎
74+
│ ├── storage/ # 数据库
75+
│ └── theme/ # 主题管理
76+
├── pages/ # 页面
77+
├── shared/ # 共享资源
78+
│ ├── constants/ # 常量
79+
│ ├── types/ # 类型定义
80+
│ └── utils/ # 工具函数
81+
├── store/ # Zustand 状态管理
82+
└── styles/ # 全局样式
83+
```
84+
85+
## 页面路由
86+
87+
| 路径 | 页面 |
88+
|------|------|
89+
| `/` | 首页 |
90+
| `/categories` | 测评分类 |
91+
| `/assessments/:category` | 测评列表 |
92+
| `/quiz/:assessmentId` | 答题页面 |
93+
| `/results/:assessmentId` | 结果页面 |
94+
| `/profile` | 个人中心 |
95+
96+
## 功能特性
97+
98+
- ✨ 深色/浅色主题切换
99+
- 🎨 动画强度可调节(支持减少动画模式)
100+
- 📊 多维度测评结果分析
101+
- 📱 响应式设计
102+
- 💾 本地数据存储(保护隐私)
103+
- 🚀 GitHub Pages 自动部署
104+
105+
## License
106+
107+
MIT

src/App.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import AssessmentList from '@/pages/AssessmentList';
88
import Quiz from '@/pages/Quiz';
99
import Results from '@/pages/Results';
1010
import Profile from '@/pages/Profile';
11+
import NotFound from '@/pages/NotFound';
1112
import { ImmersiveBackground } from '@/components/3d/ImmersiveBackground';
1213

1314
function App() {
@@ -67,6 +68,14 @@ function App() {
6768
</PageTransition>
6869
}
6970
/>
71+
<Route
72+
path="*"
73+
element={
74+
<PageTransition>
75+
<NotFound />
76+
</PageTransition>
77+
}
78+
/>
7079
</Routes>
7180
</AnimatePresence>
7281
</div>

src/pages/NotFound.tsx

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import React from 'react';
2+
import { Link } from 'react-router-dom';
3+
import { motion } from 'framer-motion';
4+
import { Home, ArrowLeft } from 'lucide-react';
5+
import { Button, Card } from '@/components/atoms';
6+
7+
const NotFound: React.FC = () => {
8+
return (
9+
<div className="relative flex min-h-screen flex-col items-center justify-center px-4 py-12">
10+
<div className="relative z-10 mx-auto max-w-md text-center">
11+
<motion.div
12+
initial={{ opacity: 0, y: 20 }}
13+
animate={{ opacity: 1, y: 0 }}
14+
transition={{ duration: 0.5 }}
15+
>
16+
<Card className="p-8">
17+
<div className="mb-6 text-8xl font-bold text-primary-500">404</div>
18+
<h1 className="mb-4 text-2xl font-bold text-gray-900 dark:text-white">
19+
页面不存在
20+
</h1>
21+
<p className="mb-8 text-gray-600 dark:text-gray-400">
22+
抱歉,您访问的页面不存在或已被移除。
23+
</p>
24+
<div className="flex flex-col gap-4">
25+
<Link to="/">
26+
<Button size="lg" leftIcon={<Home className="w-5 h-5" />} className="w-full">
27+
返回首页
28+
</Button>
29+
</Link>
30+
<Button
31+
variant="outline"
32+
size="lg"
33+
leftIcon={<ArrowLeft className="w-5 h-5" />}
34+
onClick={() => window.history.back()}
35+
className="w-full"
36+
>
37+
返回上一页
38+
</Button>
39+
</div>
40+
</Card>
41+
</motion.div>
42+
</div>
43+
</div>
44+
);
45+
};
46+
47+
export default NotFound;

src/pages/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ export { default as AssessmentList } from './AssessmentList';
44
export { default as Quiz } from './Quiz';
55
export { default as Results } from './Results';
66
export { default as Profile } from './Profile';
7+
export { default as NotFound } from './NotFound';

0 commit comments

Comments
 (0)