Files
frontend/README.md
Mikuisnotavailable 957e7d9a15 我忘了改啥了
2025-10-26 00:19:23 +08:00

117 lines
2.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# CarrotSkin Web 应用
## 项目简介
CarrotSkin 是一个 Minecraft 皮肤站 Web 应用,提供皮肤上传、管理和分享功能。
## 技术栈
- **前端框架**: Next.js 14
- **UI 组件**: React + Tailwind CSS
- **后端**: Go + Gin (CarrotSkin Backend)
- **API 网关**: APIgateway
## 主要功能
- 用户认证与授权
- 邮箱验证码验证系统
- 皮肤上传与预览
- 角色中心管理
- 自定义测试工具
## API 接口信息
### 邮箱验证码接口
**正确的API接口格式基于后端代码分析**
```
POST /api/v1/auth/send-code
Content-Type: application/json
```
**请求参数:**
```json
{
"email": "user@example.com",
"type": "register" // 可选值: register, reset_password, change_email
}
```
**验证码规则:**
- 6位数字验证码
- Redis存储有效期10分钟
- 限制每分钟只能发送1次
- 后端实现文件internal/handler/auth_handler.go 和 internal/service/verification_service.go
### 其他重要API接口
**认证相关:**
- `POST /api/v1/auth/register` - 用户注册(需邮箱验证码)
- `POST /api/v1/auth/login` - 用户登录(支持用户名/邮箱)
- `POST /api/v1/auth/reset-password` - 重置密码(需验证码)
**用户相关(需认证):**
- `GET /api/v1/user/profile` - 获取用户信息
- `PUT /api/v1/user/profile` - 更新用户信息(头像、密码)
- `POST /api/v1/user/change-email` - 更换邮箱(需验证码)
**材质管理:**
- `GET /api/v1/texture` - 搜索材质
- `GET /api/v1/texture/:id` - 获取材质详情
- `POST /api/v1/texture` - 创建材质记录
- `PUT /api/v1/texture/:id` - 更新材质
## 环境配置
### 环境变量
在项目根目录创建 `.env.local` 文件,配置以下环境变量:
```
NEXT_PUBLIC_API_URL=******
```
## 开发指南
### 安装依赖
```bash
npm install
```
### 开发模式运行
```bash
npm run dev
```
### 构建生产版本
```bash
npm run build
npm start
```
## 测试工具
项目包含以下测试工具页面:
- **验证码测试工具**: `/verify-code-test`
- 支持API调用和本地模拟两种模式
- 提供详细的请求日志和错误诊断
- **API测试工具**: `/api-tester`
- 用于测试自定义API端点
- 支持多种HTTP方法
## 注意事项
1. 确保环境变量 `NEXT_PUBLIC_API_URL` 配置正确
2. 验证码功能依赖后端服务正常运行
3. 测试模式选择本地模拟可以在无后端服务的情况下进行前端功能测试
4. 完整的后端API文档可在 `测试用/backed/backed/README_back.md` 文件中查看
## 许可证
MIT