Backend (authorization-service): - Add QueryAuthorizationsDto for query parameters (roleType, keyword, includeRevoked, page, limit) - Add queryAuthorizations method to fetch all authorizations with user info - Add GET /admin/authorizations endpoint for listing authorizations - Add POST /admin/authorizations/:id/revoke endpoint for revoking authorization Frontend (admin-web): - Add authorization.types.ts with RoleType, Authorization, and request types - Add authorizationService.ts for API calls (list, revoke, grant operations) - Add useAuthorizations.ts React Query hooks - Update authorization page to use real API data instead of mock data - Add loading/error states, pagination, and revoke reason display - Add new styles for loading, error, pagination, and date columns The authorization management page now displays all authorized users from the database with support for filtering by role type, status, and keyword search. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| nginx | ||
| public | ||
| scripts | ||
| src | ||
| .dockerignore | ||
| .env.development | ||
| .env.production | ||
| .eslintrc.json | ||
| .gitignore | ||
| .prettierrc | ||
| Dockerfile | ||
| README.md | ||
| deploy.sh | ||
| docker-compose.yml | ||
| next.config.ts | ||
| package-lock.json | ||
| package.json | ||
| tsconfig.json | ||
README.md
RWADurian Admin Web
榴莲认种管理后台 - Next.js 15 + TypeScript + SCSS
技术栈
- 框架: Next.js 15 (App Router)
- 语言: TypeScript
- 样式: SCSS Modules
- 状态管理: Redux Toolkit + Zustand
- UI 组件: Recharts (图表)
- 部署: Docker + Nginx
本地开发
环境要求
- Node.js 20+
- npm 或 yarn
安装依赖
npm install
启动开发服务器
npm run dev
构建
npm run build
npm start
Docker 部署
快速部署 (推荐)
项目已配置 Docker 一键部署方案,使用 Git 管理代码。
在服务器上部署:
# 1. 克隆项目 (首次)
git clone <repository-url>
cd rwadurian/frontend/admin-web
# 2. 或更新代码 (已有项目)
cd ~/rwadurian/frontend/admin-web
git pull
# 3. 赋予脚本执行权限
chmod +x scripts/*.sh deploy.sh nginx/*.sh
# 4. 一键部署 Docker 应用
./scripts/deploy.sh
# 5. 安装 Nginx + SSL (首次需要)
sudo ./nginx/install.sh
Docker 管理脚本
| 脚本 | 功能 |
|---|---|
./scripts/deploy.sh |
一键部署 (构建+启动) |
./scripts/build.sh |
仅构建镜像 |
./scripts/start.sh |
启动服务 |
./scripts/stop.sh |
停止服务 |
./scripts/restart.sh |
重启服务 |
./scripts/logs.sh |
查看实时日志 |
./scripts/status.sh |
查看服务状态 |
./scripts/health.sh |
健康检查 |
./scripts/clean.sh |
清理容器和镜像 |
使用原始 deploy.sh
# 启动服务
./deploy.sh start
# 停止服务
./deploy.sh stop
# 重启服务
./deploy.sh restart
# 查看日志
./deploy.sh logs
# 查看状态
./deploy.sh status
# 清理
./deploy.sh clean
自定义端口
PORT=8080 ./scripts/deploy.sh
Nginx 配置
前提条件
- 域名 DNS A 记录已指向服务器 IP
- 防火墙开放 80 和 443 端口
- Docker 应用已在 3000 端口运行
一键安装 (推荐)
cd nginx
sudo ./install.sh
脚本会自动完成:
- 系统更新
- 安装 Nginx
- 安装 Certbot
- 配置防火墙
- 申请 Let's Encrypt SSL 证书
- 配置 HTTPS 反向代理
手动配置
项目结构
admin-web/
├── src/
│ ├── app/ # Next.js App Router
│ │ ├── (auth)/ # 认证相关页面 (登录、注册)
│ │ ├── (dashboard)/ # 仪表板页面
│ │ └── api/ # API 路由
│ ├── components/ # React 组件
│ │ ├── common/ # 通用组件
│ │ ├── features/ # 功能组件
│ │ └── layout/ # 布局组件
│ ├── store/ # 状态管理
│ │ ├── redux/ # Redux Toolkit
│ │ └── zustand/ # Zustand stores
│ ├── services/ # API 服务
│ ├── utils/ # 工具函数
│ └── styles/ # 全局样式
├── public/ # 静态资源
├── nginx/ # Nginx 配置
│ ├── README.md # Nginx 部署文档
│ ├── install.sh # 一键安装脚本
│ ├── setup-ssl.sh # SSL 配置脚本
│ └── rwaadmin.szaiai.com.conf # Nginx 站点配置
├── scripts/ # Docker 管理脚本
├── Dockerfile # Docker 镜像构建
├── docker-compose.yml # Docker 编排
├── deploy.sh # 部署脚本
└── README.md # 本文档
环境变量
项目使用不同的环境配置文件:
.env.local- 本地开发.env.development- 开发环境.env.production- 生产环境
功能特性
- ✅ 用户管理
- ✅ 排行榜
- ✅ 权限管理
- ✅ 数据统计
- ✅ 系统设置
- ✅ 帮助中心
- ✅ 侧边栏收起/展开
- ✅ 响应式布局
- ✅ 健康检查 API
API 端点
GET /api/health- 健康检查
访问地址
- 本地开发: http://localhost:3000
- 生产环境: https://rwaadmin.szaiai.com
常见问题
1. Docker 构建失败
确保本地有 .next 和 node_modules 已添加到 .dockerignore
2. 502 Bad Gateway
检查 Docker 容器是否运行:
docker ps
./scripts/status.sh
3. SSL 证书申请失败
- 确认域名 DNS 解析正确
- 确认 80 端口可访问
- 查看错误日志:
sudo tail -f /var/log/letsencrypt/letsencrypt.log
许可证
MIT