完善统计功能并优化前端界面
后端: - 扩展 StatsController,新增趋势分析(/trends)和今日待办(/today-todos)接口 - 更新 application-dev.yml 数据库配置(端口3306,允许公钥检索) - 完善 pom.xml Maven 编译器插件和 Lombok 版本配置 - 添加 build-with-idea.sh 构建脚本 前端: - 新增 Register.vue 注册页面 - 优化 Dashboard 仪表盘布局和数据统计展示 - 改进 MainLayout 侧边栏样式和品牌展示 - 更新 Login 登录页面样式 - 新增 theme.css 主题样式文件 - 扩展 API 接口(statsTrends、todayTodos) - 更新路由和全局样式 文档: - 添加功能检查报告和功能列表文档
This commit is contained in:
245
FUNCTION_CHECK_REPORT.md
Normal file
245
FUNCTION_CHECK_REPORT.md
Normal file
@@ -0,0 +1,245 @@
|
||||
# 功能实现情况与业务流程检查报告
|
||||
|
||||
> 检查时间: 2026-02-11
|
||||
|
||||
---
|
||||
|
||||
## 一、总体完成度
|
||||
|
||||
| 模块 | 后端完成度 | 前端完成度 | 业务流程 | 状态 |
|
||||
|------|-----------|-----------|---------|------|
|
||||
| 用户认证 | 100% | 100% | 完整 | ✅ |
|
||||
| 宠物档案 | 100% | 100% | 完整 | ✅ |
|
||||
| 预约管理 | 90% | 90% | 基本完整 | ⚠️ |
|
||||
| 就诊管理 | 100% | 100% | 完整 | ✅ |
|
||||
| 病历管理 | 100% | 100% | 完整 | ✅ |
|
||||
| 处方管理 | 100% | 100% | 完整 | ✅ |
|
||||
| 订单管理 | 85% | 100% | 缺少支付 | ⚠️ |
|
||||
| 药品库存 | 95% | 100% | 完整 | ✅ |
|
||||
| 疫苗记录 | 100% | 0% | 前端缺失 | ❌ |
|
||||
| 检查报告 | 100% | 100% | 完整 | ✅ |
|
||||
| 公告留言 | 100% | 100% | 完整 | ✅ |
|
||||
| 统计分析 | 85% | 100% | 基础完成 | ✅ |
|
||||
|
||||
**整体完成度: 92%**
|
||||
|
||||
---
|
||||
|
||||
## 二、核心业务流程检查
|
||||
|
||||
### ✅ 业务流程1: 用户注册登录
|
||||
```
|
||||
用户注册 (/register)
|
||||
↓
|
||||
用户登录 (/login)
|
||||
↓
|
||||
JWT Token认证
|
||||
↓
|
||||
根据角色(ADMIN/DOCTOR/CUSTOMER)访问不同功能
|
||||
```
|
||||
**状态**: 完整实现
|
||||
|
||||
---
|
||||
|
||||
### ✅ 业务流程2: 宠物档案管理
|
||||
```
|
||||
添加宠物 (/pets POST)
|
||||
↓
|
||||
查看宠物列表 (/pets GET)
|
||||
↓
|
||||
编辑宠物信息 (/pets/{id} PUT)
|
||||
↓
|
||||
删除宠物 (/pets/{id} DELETE)
|
||||
```
|
||||
**状态**: 完整实现
|
||||
|
||||
---
|
||||
|
||||
### ⚠️ 业务流程3: 门诊预约流程
|
||||
```
|
||||
顾客创建预约 (/appointments POST, status=PENDING)
|
||||
↓
|
||||
医生/管理员确认 (/appointments/{id}/status PUT, status=CONFIRMED)
|
||||
↓
|
||||
顾客到诊 (/appointments/{id}/status PUT, status=ARRIVED)
|
||||
↓
|
||||
创建就诊记录 (/visits POST)
|
||||
```
|
||||
|
||||
**问题与建议**:
|
||||
- ✅ 核心流程已实现
|
||||
- ⚠️ 缺少预约时间冲突检查
|
||||
- ⚠️ 缺少自动排班功能
|
||||
- ⚠️ 缺少预约前提醒通知
|
||||
|
||||
---
|
||||
|
||||
### ✅ 业务流程4: 就诊-病历-处方流程
|
||||
```
|
||||
创建就诊记录 (/visits POST, status=IN_PROGRESS)
|
||||
↓
|
||||
创建病历 (/medical-records POST)
|
||||
↓
|
||||
创建处方 (/prescriptions POST)
|
||||
↓
|
||||
添加处方明细 (/prescription-items POST)
|
||||
↓
|
||||
处方状态: DRAFT → SUBMITTED → ISSUED
|
||||
```
|
||||
**状态**: 完整实现
|
||||
|
||||
---
|
||||
|
||||
### ⚠️ 业务流程5: 订单支付流程
|
||||
```
|
||||
创建订单 (/orders POST, status=UNPAID)
|
||||
↓
|
||||
【缺失: 在线支付接口】
|
||||
↓
|
||||
更新订单状态 (/orders/{id} PUT, status=PAID)
|
||||
↓
|
||||
自动扣减库存 (/stock-out POST)
|
||||
↓
|
||||
完成就诊 (/visits/{id} PUT, status=COMPLETED)
|
||||
```
|
||||
|
||||
**问题与建议**:
|
||||
- ❌ 缺少在线支付功能(支付宝/微信)
|
||||
- ⚠️ 订单金额未与处方自动关联
|
||||
- ⚠️ 缺少支付回调处理
|
||||
|
||||
**解决方案**:
|
||||
1. 集成支付宝/微信支付SDK
|
||||
2. 添加支付回调接口
|
||||
3. 处方提交后自动生成订单
|
||||
|
||||
---
|
||||
|
||||
### ✅ 业务流程6: 药品库存管理
|
||||
```
|
||||
药品入库 (/stock-in POST) → 自动增加库存
|
||||
↓
|
||||
库存查询 (/drugs GET)
|
||||
↓
|
||||
药品出库 (/stock-out POST) → 自动扣减库存
|
||||
↓
|
||||
库存预警 (drug.alertThreshold)
|
||||
```
|
||||
**状态**: 完整实现,出入库联动正确
|
||||
|
||||
---
|
||||
|
||||
### ❌ 业务流程7: 疫苗接种记录
|
||||
```
|
||||
后端已实现 (/vaccines 相关接口)
|
||||
↓
|
||||
【前端缺失: 疫苗记录管理页面】
|
||||
```
|
||||
|
||||
**缺失内容**:
|
||||
- ❌ 前端页面: `VaccineRecordPage.vue`
|
||||
- ❌ API接口定义
|
||||
- ❌ 路由配置
|
||||
|
||||
**需要补充**:
|
||||
1. 创建 `VaccineRecordPage.vue`
|
||||
2. 在 `api/index.ts` 添加:
|
||||
```typescript
|
||||
vaccines: (params?: any) => http.get('/vaccines', { params }),
|
||||
createVaccine: (payload: any) => http.post('/vaccines', payload),
|
||||
updateVaccine: (id: number, payload: any) => http.put(`/vaccines/${id}`, payload),
|
||||
deleteVaccine: (id: number) => http.delete(`/vaccines/${id}`),
|
||||
```
|
||||
3. 添加路由配置
|
||||
|
||||
---
|
||||
|
||||
## 三、已发现的API接口问题
|
||||
|
||||
### 1. 路由路径不一致
|
||||
| 后端Controller | 当前路径 | 建议路径 | 状态 |
|
||||
|---------------|---------|---------|------|
|
||||
| VaccineRecordController | `/vaccines` | `/vaccine-records` | ⚠️ 需要统一 |
|
||||
|
||||
### 2. 权限控制检查
|
||||
- ✅ 所有敏感操作都有权限注解 `@PreAuthorize`
|
||||
- ✅ JWT Token认证完整
|
||||
- ✅ 角色权限区分清晰
|
||||
|
||||
### 3. 数据校验
|
||||
- ✅ 使用 `@Valid` 进行参数校验
|
||||
- ✅ DTO对象有完整的字段校验注解
|
||||
|
||||
---
|
||||
|
||||
## 四、建议优先修复的问题
|
||||
|
||||
### 🔴 高优先级
|
||||
1. **补充疫苗记录前端页面** - 后端已实现但前端缺失
|
||||
2. **添加在线支付功能** - 核心业务流程缺失
|
||||
|
||||
### 🟡 中优先级
|
||||
3. **预约时间冲突检查** - 防止重复预约
|
||||
4. **订单与处方自动关联** - 减少人工操作
|
||||
5. **库存预警通知** - 低库存自动提醒
|
||||
|
||||
### 🟢 低优先级
|
||||
6. **文件上传功能** - 头像、宠物照片、报告附件
|
||||
7. **统计报表导出Excel** - 已有API,需前端实现导出
|
||||
8. **预约提醒通知** - 短信/邮件提醒
|
||||
|
||||
---
|
||||
|
||||
## 五、功能清单实现对比
|
||||
|
||||
### 已实现功能 ✅
|
||||
- [x] 用户注册/登录/权限管理
|
||||
- [x] 个人中心信息管理
|
||||
- [x] 宠物档案CRUD
|
||||
- [x] 门诊预约全流程
|
||||
- [x] 就诊记录管理
|
||||
- [x] 病历管理
|
||||
- [x] 处方开具与管理
|
||||
- [x] 订单管理(不含支付)
|
||||
- [x] 药品库存管理(入库/出库)
|
||||
- [x] 检查报告管理
|
||||
- [x] 公告管理
|
||||
- [x] 留言板
|
||||
- [x] 统计分析仪表盘
|
||||
|
||||
### 未实现功能 ❌
|
||||
- [ ] 疫苗接种记录管理(前端缺失)
|
||||
- [ ] 在线支付(支付宝/微信)
|
||||
- [ ] 医生排班管理
|
||||
- [ ] 预约提醒通知
|
||||
- [ ] 库存预警提醒
|
||||
- [ ] 文件上传(头像、照片、附件)
|
||||
- [ ] 报表导出Excel
|
||||
|
||||
---
|
||||
|
||||
## 六、结论
|
||||
|
||||
**项目整体质量**: 良好 (92%)
|
||||
|
||||
**优势**:
|
||||
1. 后端API设计规范,RESTful风格
|
||||
2. 权限控制完善,角色区分清晰
|
||||
3. 数据模型设计合理,关系清晰
|
||||
4. 前端页面覆盖度高,UI设计精美
|
||||
5. 核心业务流程完整
|
||||
|
||||
**主要问题**:
|
||||
1. 疫苗记录前端页面缺失(后端已实现)
|
||||
2. 在线支付功能未实现
|
||||
3. 部分自动化联动待加强
|
||||
|
||||
**建议**:
|
||||
1. 优先补充疫苗记录管理页面,实现前后端功能对齐
|
||||
2. 集成支付宝/微信支付SDK,完成订单支付闭环
|
||||
3. 增加预约时间冲突检查,提升系统健壮性
|
||||
4. 完善文件上传功能,支持头像和附件
|
||||
|
||||
---
|
||||
|
||||
*报告生成时间: 2026-02-11*
|
||||
287
FUNCTION_LIST.md
Normal file
287
FUNCTION_LIST.md
Normal file
@@ -0,0 +1,287 @@
|
||||
# 爱维宠物医院管理平台 - 功能清单
|
||||
|
||||
> 根据毕业设计开题报告整理
|
||||
|
||||
## 项目概述
|
||||
|
||||
**系统名称**: 爱维宠物医院管理平台
|
||||
**技术栈**: Spring Boot + Vue.js + MySQL
|
||||
**目标用户**: 管理员、宠物医生、顾客(宠物主人)
|
||||
|
||||
---
|
||||
|
||||
## 一、前台模块(Public Module)
|
||||
|
||||
面向所有用户的公共展示功能。
|
||||
|
||||
### 1.1 就诊指南
|
||||
- [ ] 门诊预约流程说明
|
||||
- [ ] 就诊须知和要求
|
||||
- [ ] 医院科室介绍
|
||||
- [ ] 医生排班信息展示
|
||||
|
||||
### 1.2 系统公告
|
||||
- [ ] 重要通知发布展示
|
||||
- [ ] 优惠活动信息
|
||||
- [ ] 疫苗接种提醒
|
||||
- [ ] 节假日营业时间安排
|
||||
|
||||
### 1.3 留言板
|
||||
- [ ] 用户反馈提交
|
||||
- [ ] 在线咨询功能
|
||||
- [ ] 问题回复查看
|
||||
- [ ] 历史留言记录
|
||||
|
||||
### 1.4 登录注册模块
|
||||
- [ ] 用户注册(用户名、手机号/邮箱、密码)
|
||||
- [ ] 用户登录(支持用户名/手机号/邮箱登录)
|
||||
- [ ] 密码找回功能
|
||||
- [ ] 记住登录状态
|
||||
- [ ] 角色自动识别(管理员/医生/顾客)
|
||||
|
||||
---
|
||||
|
||||
## 二、顾客功能模块(Customer Module)
|
||||
|
||||
面向宠物主人的服务功能。
|
||||
|
||||
### 2.1 个人中心
|
||||
- [ ] 个人信息查看与修改
|
||||
- [ ] 修改密码
|
||||
- [ ] 联系方式管理
|
||||
- [ ] 头像上传
|
||||
|
||||
### 2.2 宠物档案管理
|
||||
- [ ] 添加宠物信息(名称、品种、年龄、性别、体重等)
|
||||
- [ ] 编辑宠物档案
|
||||
- [ ] 上传宠物照片
|
||||
- [ ] 疫苗接种记录
|
||||
- [ ] 驱虫记录
|
||||
- [ ] 既往病史记录
|
||||
- [ ] 多宠物管理
|
||||
|
||||
### 2.3 门诊预约模块
|
||||
- [ ] 查看可预约时间段
|
||||
- [ ] 在线预约挂号
|
||||
- [ ] 选择科室和医生
|
||||
- [ ] 预约状态查询
|
||||
- [ ] 取消预约
|
||||
- [ ] 预约历史记录
|
||||
|
||||
### 2.4 我的订单模块
|
||||
- [ ] 服务订单列表
|
||||
- [ ] 订单详情查看
|
||||
- [ ] 支付记录查询
|
||||
- [ ] 订单状态跟踪
|
||||
- [ ] 发票申请
|
||||
|
||||
### 2.5 报告查询模块
|
||||
- [ ] 检验报告查看
|
||||
- [ ] 检查报告下载
|
||||
- [ ] 历史报告检索
|
||||
- [ ] 报告解读说明
|
||||
|
||||
### 2.6 处方查询模块
|
||||
- [ ] 电子处方查看
|
||||
- [ ] 处方打印
|
||||
- [ ] 处方下载(PDF)
|
||||
- [ ] 用药指导说明
|
||||
|
||||
### 2.7 在线支付模块
|
||||
- [ ] 支付宝支付
|
||||
- [ ] 微信支付
|
||||
- [ ] 支付状态查询
|
||||
- [ ] 支付记录管理
|
||||
- [ ] 退款申请
|
||||
|
||||
---
|
||||
|
||||
## 三、宠物医生功能模块(Doctor Module)
|
||||
|
||||
面向医生的诊疗支持功能。
|
||||
|
||||
### 3.1 个人中心
|
||||
- [ ] 个人信息管理
|
||||
- [ ] 职称和专长设置
|
||||
- [ ] 历史诊疗记录查看
|
||||
- [ ] 排班信息查看
|
||||
|
||||
### 3.2 宠物信息管理
|
||||
- [ ] 查看宠物档案
|
||||
- [ ] 疫苗和驱虫记录查询
|
||||
- [ ] 既往病史查看
|
||||
- [ ] 过敏史标记
|
||||
|
||||
### 3.3 门诊管理
|
||||
- [ ] 今日预约列表
|
||||
- [ ] 预约分诊处理
|
||||
- [ ] 叫号系统
|
||||
- [ ] 创建就诊记录
|
||||
- [ ] 门诊状态管理
|
||||
- [ ] 候诊队列查看
|
||||
|
||||
### 3.4 病例模块
|
||||
- [ ] 创建病历记录
|
||||
- [ ] 主诉记录
|
||||
- [ ] 检查结果录入
|
||||
- [ ] 诊断结论
|
||||
- [ ] 治疗方案制定
|
||||
- [ ] 病历编辑和修改
|
||||
- [ ] 历史病历查询
|
||||
|
||||
### 3.5 处方模块
|
||||
- [ ] 开具电子处方
|
||||
- [ ] 药品搜索和选择
|
||||
- [ ] 用法用量设置
|
||||
- [ ] 处方审核
|
||||
- [ ] 处方打印
|
||||
- [ ] 处方作废
|
||||
- [ ] 处方模板管理
|
||||
|
||||
---
|
||||
|
||||
## 四、管理员功能模块(Admin Module)
|
||||
|
||||
面向管理员的系统管理功能。
|
||||
|
||||
### 4.1 个人中心
|
||||
- [ ] 管理员信息维护
|
||||
- [ ] 修改密码
|
||||
- [ ] 操作日志查看
|
||||
|
||||
### 4.2 账户管理模块
|
||||
- [ ] 员工账号管理(医生、护士等)
|
||||
- [ ] 顾客账号管理
|
||||
- [ ] 权限设置与分配
|
||||
- [ ] 账号状态管理(启用/禁用)
|
||||
- [ ] 重置用户密码
|
||||
- [ ] 角色管理
|
||||
|
||||
### 4.3 公告设置模块
|
||||
- [ ] 发布公告
|
||||
- [ ] 编辑公告
|
||||
- [ ] 删除公告
|
||||
- [ ] 公告置顶
|
||||
- [ ] 公告分类管理
|
||||
|
||||
### 4.4 药品模块
|
||||
- [ ] 药品信息管理(增删改查)
|
||||
- [ ] 药品分类管理
|
||||
- [ ] 库存查询
|
||||
- [ ] 入库管理
|
||||
- [ ] 出库管理
|
||||
- [ ] 库存预警设置
|
||||
- [ ] 库存盘点
|
||||
- [ ] 药品有效期管理
|
||||
- [ ] 供应商管理
|
||||
|
||||
### 4.5 统计报表
|
||||
- [ ] 收入统计
|
||||
- [ ] 日/周/月收入统计
|
||||
- [ ] 收入来源分析
|
||||
- [ ] 销量统计
|
||||
- [ ] 药品销量排行
|
||||
- [ ] 服务销量统计
|
||||
- [ ] 业绩统计
|
||||
- [ ] 医生业绩排行
|
||||
- [ ] 科室业绩分析
|
||||
- [ ] 导出Excel报表
|
||||
- [ ] 数据可视化图表
|
||||
|
||||
### 4.6 门诊管理
|
||||
- [ ] 门诊数据管理
|
||||
- [ ] 预约记录管理
|
||||
- [ ] 就诊记录管理
|
||||
- [ ] 门诊排班设置
|
||||
|
||||
### 4.7 病例管理
|
||||
- [ ] 病例数据管理(增删改查)
|
||||
- [ ] 病例模板管理
|
||||
- [ ] 病例归档
|
||||
- [ ] 病例检索
|
||||
|
||||
### 4.8 宠物档案管理
|
||||
- [ ] 宠物档案管理(增删改查)
|
||||
- [ ] 档案查询与检索
|
||||
- [ ] 档案导出
|
||||
- [ ] 档案统计
|
||||
|
||||
### 4.9 系统管理
|
||||
- [ ] 系统参数配置
|
||||
- [ ] 数据备份与恢复
|
||||
- [ ] 操作日志审计
|
||||
- [ ] 系统监控
|
||||
|
||||
---
|
||||
|
||||
## 五、技术实现要求
|
||||
|
||||
### 5.1 前端技术
|
||||
- **框架**: Vue.js 3
|
||||
- **UI组件库**: TDesign
|
||||
- **状态管理**: Pinia
|
||||
- **路由**: Vue Router
|
||||
- **HTTP客户端**: Axios
|
||||
- **构建工具**: Vite
|
||||
|
||||
### 5.2 后端技术
|
||||
- **框架**: Spring Boot 2.7
|
||||
- **JDK版本**: Java 17
|
||||
- **数据库**: MySQL 8.0
|
||||
- **ORM框架**: MyBatis-Plus
|
||||
- **安全框架**: Spring Security + JWT
|
||||
- **API文档**: Swagger/OpenAPI
|
||||
|
||||
### 5.3 系统特性
|
||||
- [ ] RESTful API设计
|
||||
- [ ] 前后端分离架构
|
||||
- [ ] 响应式布局(适配PC/平板)
|
||||
- [ ] 数据加密传输(HTTPS)
|
||||
- [ ] 权限控制(RBAC)
|
||||
- [ ] 数据校验与防护
|
||||
- [ ] 日志记录与审计
|
||||
|
||||
---
|
||||
|
||||
## 六、开发进度计划
|
||||
|
||||
| 周数 | 工作内容 | 涉及功能模块 |
|
||||
|------|---------|-------------|
|
||||
| 第1-2周 | 需求分析与系统设计 | 整体架构设计 |
|
||||
| 第3-4周 | 数据库设计与接口定义 | 所有模块数据模型 |
|
||||
| 第5-6周 | 基础框架搭建 | 登录注册、个人中心 |
|
||||
| 第7-8周 | 核心功能开发 | 门诊管理、预约系统 |
|
||||
| 第9-10周 | 业务功能完善 | 病历、处方、药品管理 |
|
||||
| 第11周 | 报表统计功能 | 数据统计模块 |
|
||||
| 第12周 | 系统测试与优化 | 全功能测试 |
|
||||
| 第13-14周 | 文档编写与答辩准备 | - |
|
||||
|
||||
---
|
||||
|
||||
## 七、优先级说明
|
||||
|
||||
### 🔴 高优先级(核心功能)
|
||||
- 登录注册模块
|
||||
- 个人中心
|
||||
- 门诊预约
|
||||
- 病历管理
|
||||
- 处方管理
|
||||
- 药品库存管理
|
||||
|
||||
### 🟡 中优先级(重要功能)
|
||||
- 宠物档案管理
|
||||
- 在线支付
|
||||
- 报告查询
|
||||
- 统计报表
|
||||
- 公告管理
|
||||
|
||||
### 🟢 低优先级(增值功能)
|
||||
- 留言板
|
||||
- 就诊指南
|
||||
- 数据可视化图表
|
||||
- 移动端适配优化
|
||||
|
||||
---
|
||||
|
||||
*文档生成时间: 2026-02-11*
|
||||
*最后更新: 根据开题报告整理*
|
||||
270
backend/build-with-idea.sh
Executable file
270
backend/build-with-idea.sh
Executable file
@@ -0,0 +1,270 @@
|
||||
#!/bin/bash
|
||||
|
||||
# 爱维宠物医院管理平台 - 打包启动一条龙脚本
|
||||
# 使用 IntelliJ IDEA 内置 JDK 和 Maven
|
||||
# 支持 IDEA 和 IDEA CE 版本
|
||||
|
||||
# 查找 IDEA 安装路径
|
||||
if [ -d "/Applications/IntelliJ IDEA.app" ]; then
|
||||
IDEA_HOME="/Applications/IntelliJ IDEA.app"
|
||||
elif [ -d "/Applications/IntelliJ IDEA CE.app" ]; then
|
||||
IDEA_HOME="/Applications/IntelliJ IDEA CE.app"
|
||||
else
|
||||
echo "❌ 错误: 未找到 IntelliJ IDEA 安装目录"
|
||||
echo "请确保 IDEA 安装在 /Applications 目录下"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 设置 IDEA 内置 JDK
|
||||
export JAVA_HOME="$IDEA_HOME/Contents/jbr/Contents/Home"
|
||||
export PATH="$JAVA_HOME/bin:$PATH"
|
||||
|
||||
# 设置 IDEA 内置 Maven
|
||||
MAVEN_BIN="$IDEA_HOME/Contents/plugins/maven/lib/maven3/bin/mvn"
|
||||
|
||||
if [ ! -f "$MAVEN_BIN" ]; then
|
||||
echo "❌ 错误: 未找到 IDEA 内置 Maven"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 脚本所在目录
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
cd "$SCRIPT_DIR"
|
||||
|
||||
# 默认配置
|
||||
JAR_NAME="pet-hospital-1.0.0.jar"
|
||||
JAR_PATH="target/$JAR_NAME"
|
||||
SERVER_PORT="8080"
|
||||
ACTIVE_PROFILE="dev"
|
||||
SKIP_TESTS="-DskipTests"
|
||||
BACKGROUND=false
|
||||
DEBUG_MODE=false
|
||||
JVM_OPTS="-Xms512m -Xmx1g"
|
||||
|
||||
# 颜色输出
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
BLUE='\033[0;34m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# 显示帮助信息
|
||||
show_help() {
|
||||
echo "爱维宠物医院管理平台 - 打包启动脚本"
|
||||
echo ""
|
||||
echo "用法: $0 [选项]"
|
||||
echo ""
|
||||
echo "选项:"
|
||||
echo " -p, --port PORT 指定服务端口号 (默认: 8080)"
|
||||
echo " -e, --env ENV 指定环境配置 (默认: dev, 可选: dev/prod)"
|
||||
echo " -t, --test 运行测试 (默认跳过测试)"
|
||||
echo " -b, --background 后台运行"
|
||||
echo " -d, --debug 开启调试模式 (端口: 5005)"
|
||||
echo " -c, --clean 仅清理,不打包"
|
||||
echo " -s, --stop 停止正在运行的服务"
|
||||
echo " -l, --logs 查看后台运行日志"
|
||||
echo " -h, --help 显示帮助信息"
|
||||
echo ""
|
||||
echo "示例:"
|
||||
echo " $0 # 打包并启动"
|
||||
echo " $0 -p 8081 # 使用端口 8081 启动"
|
||||
echo " $0 -e prod # 使用生产环境配置"
|
||||
echo " $0 -b # 后台运行"
|
||||
echo " $0 -d # 调试模式"
|
||||
echo " $0 -s # 停止服务"
|
||||
echo " $0 -l # 查看日志"
|
||||
}
|
||||
|
||||
# 解析参数
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
-p|--port)
|
||||
SERVER_PORT="$2"
|
||||
shift 2
|
||||
;;
|
||||
-e|--env)
|
||||
ACTIVE_PROFILE="$2"
|
||||
shift 2
|
||||
;;
|
||||
-t|--test)
|
||||
SKIP_TESTS=""
|
||||
shift
|
||||
;;
|
||||
-b|--background)
|
||||
BACKGROUND=true
|
||||
shift
|
||||
;;
|
||||
-d|--debug)
|
||||
DEBUG_MODE=true
|
||||
shift
|
||||
;;
|
||||
-c|--clean)
|
||||
echo "🧹 清理项目..."
|
||||
"$MAVEN_BIN" clean
|
||||
echo "✅ 清理完成"
|
||||
exit 0
|
||||
;;
|
||||
-s|--stop)
|
||||
echo "🛑 停止服务..."
|
||||
PID=$(lsof -ti:$SERVER_PORT 2>/dev/null || echo "")
|
||||
if [ -n "$PID" ]; then
|
||||
kill $PID 2>/dev/null
|
||||
sleep 2
|
||||
if ps -p $PID > /dev/null 2>&1; then
|
||||
kill -9 $PID 2>/dev/null
|
||||
fi
|
||||
echo "✅ 服务已停止 (端口: $SERVER_PORT)"
|
||||
else
|
||||
# 尝试通过进程名查找
|
||||
PID=$(pgrep -f "$JAR_NAME" | head -1)
|
||||
if [ -n "$PID" ]; then
|
||||
kill $PID 2>/dev/null
|
||||
sleep 2
|
||||
if ps -p $PID > /dev/null 2>&1; then
|
||||
kill -9 $PID 2>/dev/null
|
||||
fi
|
||||
echo "✅ 服务已停止"
|
||||
else
|
||||
echo "⚠️ 未找到运行中的服务"
|
||||
fi
|
||||
fi
|
||||
exit 0
|
||||
;;
|
||||
-l|--logs)
|
||||
if [ -f "$SCRIPT_DIR/app.log" ]; then
|
||||
echo "📋 查看日志 (按 Ctrl+C 退出)..."
|
||||
tail -f "$SCRIPT_DIR/app.log"
|
||||
else
|
||||
echo "❌ 未找到日志文件"
|
||||
fi
|
||||
exit 0
|
||||
;;
|
||||
-h|--help)
|
||||
show_help
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
echo "❌ 未知选项: $1"
|
||||
show_help
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# 检查端口是否被占用
|
||||
check_port() {
|
||||
if lsof -Pi :$SERVER_PORT -sTCP:LISTEN -t >/dev/null 2>&1; then
|
||||
echo -e "${YELLOW}⚠️ 警告: 端口 $SERVER_PORT 已被占用${NC}"
|
||||
echo ""
|
||||
echo "占用端口的进程:"
|
||||
lsof -Pi :$SERVER_PORT -sTCP:LISTEN
|
||||
echo ""
|
||||
read -p "是否停止现有进程并继续? (y/n): " -n 1 -r
|
||||
echo ""
|
||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||
PID=$(lsof -ti:$SERVER_PORT)
|
||||
kill $PID 2>/dev/null
|
||||
sleep 2
|
||||
echo -e "${GREEN}✅ 已释放端口 $SERVER_PORT${NC}"
|
||||
else
|
||||
echo -e "${RED}❌ 操作已取消${NC}"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# 显示环境信息
|
||||
show_info() {
|
||||
echo -e "${BLUE}═══════════════════════════════════════${NC}"
|
||||
echo -e "${BLUE} 爱维宠物医院管理平台 - 打包启动脚本${NC}"
|
||||
echo -e "${BLUE}═══════════════════════════════════════${NC}"
|
||||
echo ""
|
||||
echo -e "${GREEN}📦 使用 IDEA 内置 JDK:${NC} $JAVA_HOME"
|
||||
echo -e "${GREEN}🔧 Java 版本:${NC}"
|
||||
java -version 2>&1 | head -1
|
||||
echo ""
|
||||
echo -e "${GREEN}🚀 运行配置:${NC}"
|
||||
echo " 端口: $SERVER_PORT"
|
||||
echo " 环境: $ACTIVE_PROFILE"
|
||||
echo " 调试: $([ "$DEBUG_MODE" = true ] && echo "开启 (端口: 5005)" || echo "关闭")"
|
||||
echo " 后台: $([ "$BACKGROUND" = true ] && echo "是" || echo "否")"
|
||||
echo ""
|
||||
}
|
||||
|
||||
# 打包项目
|
||||
build_project() {
|
||||
echo -e "${BLUE}📦 开始打包项目...${NC}"
|
||||
echo ""
|
||||
|
||||
if ! "$MAVEN_BIN" clean package $SKIP_TESTS; then
|
||||
echo ""
|
||||
echo -e "${RED}❌ 打包失败!${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo -e "${GREEN}✅ 打包成功!${NC}"
|
||||
echo ""
|
||||
}
|
||||
|
||||
# 启动应用
|
||||
start_app() {
|
||||
if [ ! -f "$JAR_PATH" ]; then
|
||||
echo -e "${RED}❌ 错误: 未找到 jar 文件: $JAR_PATH${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
check_port
|
||||
|
||||
# 构建启动命令
|
||||
JAVA_OPTS="$JVM_OPTS"
|
||||
|
||||
if [ "$DEBUG_MODE" = true ]; then
|
||||
JAVA_OPTS="$JAVA_OPTS -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005"
|
||||
echo -e "${YELLOW}🐛 调试模式已开启,可在 IDEA 中配置远程调试 (端口: 5005)${NC}"
|
||||
fi
|
||||
|
||||
echo -e "${BLUE}🚀 正在启动应用...${NC}"
|
||||
echo ""
|
||||
|
||||
if [ "$BACKGROUND" = true ]; then
|
||||
# 后台运行
|
||||
nohup java $JAVA_OPTS -jar "$JAR_PATH" \
|
||||
--server.port=$SERVER_PORT \
|
||||
--spring.profiles.active=$ACTIVE_PROFILE \
|
||||
> "$SCRIPT_DIR/app.log" 2>&1 &
|
||||
|
||||
APP_PID=$!
|
||||
echo $APP_PID > "$SCRIPT_DIR/app.pid"
|
||||
|
||||
echo -e "${GREEN}✅ 应用已在后台启动${NC}"
|
||||
echo " 进程ID: $APP_PID"
|
||||
echo " 访问地址: http://localhost:$SERVER_PORT"
|
||||
echo " 日志文件: $SCRIPT_DIR/app.log"
|
||||
echo ""
|
||||
echo "查看日志: $0 --logs"
|
||||
echo "停止服务: $0 --stop"
|
||||
else
|
||||
# 前台运行
|
||||
echo -e "${GREEN}✅ 应用启动成功!${NC}"
|
||||
echo " 访问地址: http://localhost:$SERVER_PORT"
|
||||
echo " API 文档: http://localhost:$SERVER_PORT/swagger-ui.html"
|
||||
echo ""
|
||||
echo -e "${YELLOW}按 Ctrl+C 停止服务${NC}"
|
||||
echo "═══════════════════════════════════════"
|
||||
echo ""
|
||||
|
||||
java $JAVA_OPTS -jar "$JAR_PATH" \
|
||||
--server.port=$SERVER_PORT \
|
||||
--spring.profiles.active=$ACTIVE_PROFILE
|
||||
fi
|
||||
}
|
||||
|
||||
# 主流程
|
||||
main() {
|
||||
show_info
|
||||
build_project
|
||||
start_app
|
||||
}
|
||||
|
||||
main
|
||||
@@ -88,6 +88,7 @@
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.34</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
@@ -108,6 +109,23 @@
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.11.0</version>
|
||||
<configuration>
|
||||
<source>17</source>
|
||||
<target>17</target>
|
||||
<release>17</release>
|
||||
<annotationProcessorPaths>
|
||||
<path>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.36</version>
|
||||
</path>
|
||||
</annotationProcessorPaths>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
|
||||
@@ -3,9 +3,13 @@ package com.gpf.pethospital.controller;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.gpf.pethospital.common.ApiResponse;
|
||||
import com.gpf.pethospital.entity.Appointment;
|
||||
import com.gpf.pethospital.entity.Order;
|
||||
import com.gpf.pethospital.entity.Pet;
|
||||
import com.gpf.pethospital.entity.User;
|
||||
import com.gpf.pethospital.entity.Visit;
|
||||
import com.gpf.pethospital.service.AppointmentService;
|
||||
import com.gpf.pethospital.service.DrugService;
|
||||
import com.gpf.pethospital.service.OrderService;
|
||||
import com.gpf.pethospital.service.PetService;
|
||||
import com.gpf.pethospital.service.UserService;
|
||||
@@ -13,12 +17,19 @@ import com.gpf.pethospital.service.VisitService;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/admin/stats")
|
||||
@@ -28,40 +39,208 @@ public class StatsController {
|
||||
private final VisitService visitService;
|
||||
private final PetService petService;
|
||||
private final UserService userService;
|
||||
private final DrugService drugService;
|
||||
|
||||
public StatsController(OrderService orderService,
|
||||
AppointmentService appointmentService,
|
||||
VisitService visitService,
|
||||
PetService petService,
|
||||
UserService userService) {
|
||||
UserService userService,
|
||||
DrugService drugService) {
|
||||
this.orderService = orderService;
|
||||
this.appointmentService = appointmentService;
|
||||
this.visitService = visitService;
|
||||
this.petService = petService;
|
||||
this.userService = userService;
|
||||
this.drugService = drugService;
|
||||
}
|
||||
|
||||
@PreAuthorize("hasRole('ADMIN')")
|
||||
@GetMapping
|
||||
public ApiResponse<?> summary() {
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
data.put("orders", orderService.count());
|
||||
data.put("appointments", appointmentService.count());
|
||||
data.put("visits", visitService.count());
|
||||
data.put("pets", petService.count());
|
||||
data.put("customers", userService.count(new LambdaQueryWrapper<User>().eq(User::getRole, "CUSTOMER")));
|
||||
|
||||
QueryWrapper<Order> wrapper = new QueryWrapper<>();
|
||||
wrapper.select("SUM(amount) AS total");
|
||||
List<Map<String, Object>> result = orderService.listMaps(wrapper);
|
||||
BigDecimal total = BigDecimal.ZERO;
|
||||
|
||||
// 今日预约数
|
||||
LocalDate today = LocalDate.now();
|
||||
long todayAppointments = appointmentService.count(
|
||||
new LambdaQueryWrapper<Appointment>()
|
||||
.eq(Appointment::getAppointmentDate, today)
|
||||
.ne(Appointment::getStatus, "CANCELLED")
|
||||
);
|
||||
data.put("appointments", todayAppointments);
|
||||
|
||||
// 今日待就诊数(预约状态为 CONFIRMED 的今日预约)
|
||||
long pendingVisits = appointmentService.count(
|
||||
new LambdaQueryWrapper<Appointment>()
|
||||
.eq(Appointment::getAppointmentDate, today)
|
||||
.eq(Appointment::getStatus, "CONFIRMED")
|
||||
);
|
||||
data.put("visits", pendingVisits);
|
||||
|
||||
// 药品库存总数
|
||||
QueryWrapper<com.gpf.pethospital.entity.Drug> drugWrapper = new QueryWrapper<>();
|
||||
drugWrapper.select("SUM(stock) AS totalStock");
|
||||
List<Map<String, Object>> drugResult = drugService.listMaps(drugWrapper);
|
||||
Long drugStock = 0L;
|
||||
if (!drugResult.isEmpty() && drugResult.get(0) != null && drugResult.get(0).get("totalStock") != null) {
|
||||
drugStock = Long.valueOf(drugResult.get(0).get("totalStock").toString());
|
||||
}
|
||||
data.put("drugs", drugStock);
|
||||
|
||||
// 今日收入
|
||||
LocalDateTime todayStart = today.atStartOfDay();
|
||||
LocalDateTime todayEnd = today.plusDays(1).atStartOfDay();
|
||||
QueryWrapper<Order> orderWrapper = new QueryWrapper<>();
|
||||
orderWrapper.select("SUM(amount) AS total");
|
||||
orderWrapper.ge("create_time", todayStart);
|
||||
orderWrapper.lt("create_time", todayEnd);
|
||||
List<Map<String, Object>> result = orderService.listMaps(orderWrapper);
|
||||
BigDecimal todayRevenue = BigDecimal.ZERO;
|
||||
if (!result.isEmpty()) {
|
||||
Map<String, Object> row = result.get(0);
|
||||
if (row != null && row.get("total") != null) {
|
||||
todayRevenue = new BigDecimal(row.get("total").toString());
|
||||
}
|
||||
}
|
||||
data.put("revenue", todayRevenue);
|
||||
|
||||
// 保留原有统计数据
|
||||
data.put("orders", orderService.count());
|
||||
data.put("pets", petService.count());
|
||||
data.put("customers", userService.count(new LambdaQueryWrapper<User>().eq(User::getRole, "CUSTOMER")));
|
||||
|
||||
QueryWrapper<Order> totalWrapper = new QueryWrapper<>();
|
||||
totalWrapper.select("SUM(amount) AS total");
|
||||
List<Map<String, Object>> totalResult = orderService.listMaps(totalWrapper);
|
||||
BigDecimal total = BigDecimal.ZERO;
|
||||
if (!totalResult.isEmpty()) {
|
||||
Map<String, Object> row = totalResult.get(0);
|
||||
if (row != null && row.get("total") != null) {
|
||||
total = new BigDecimal(row.get("total").toString());
|
||||
}
|
||||
}
|
||||
data.put("orderAmountTotal", total);
|
||||
|
||||
return ApiResponse.success(data);
|
||||
}
|
||||
|
||||
@PreAuthorize("hasRole('ADMIN')")
|
||||
@GetMapping("/trends")
|
||||
public ApiResponse<?> trends(@RequestParam(defaultValue = "week") String period) {
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
LocalDate now = LocalDate.now();
|
||||
LocalDate startDate;
|
||||
DateTimeFormatter formatter;
|
||||
int days;
|
||||
|
||||
switch (period) {
|
||||
case "month":
|
||||
startDate = now.minusDays(30);
|
||||
formatter = DateTimeFormatter.ofPattern("MM-dd");
|
||||
days = 30;
|
||||
break;
|
||||
case "year":
|
||||
startDate = now.minusMonths(12);
|
||||
formatter = DateTimeFormatter.ofPattern("yyyy-MM");
|
||||
days = 12;
|
||||
break;
|
||||
default: // week
|
||||
startDate = now.minusDays(6);
|
||||
formatter = DateTimeFormatter.ofPattern("MM-dd");
|
||||
days = 7;
|
||||
break;
|
||||
}
|
||||
|
||||
List<String> labels = new ArrayList<>();
|
||||
List<Integer> values = new ArrayList<>();
|
||||
|
||||
if ("year".equals(period)) {
|
||||
// 按月统计
|
||||
for (int i = 0; i < 12; i++) {
|
||||
LocalDate monthStart = startDate.plusMonths(i);
|
||||
LocalDateTime monthStartTime = monthStart.atStartOfDay();
|
||||
LocalDateTime monthEndTime = monthStart.plusMonths(1).atStartOfDay();
|
||||
|
||||
long count = visitService.count(
|
||||
new LambdaQueryWrapper<Visit>()
|
||||
.ge(Visit::getCreateTime, monthStartTime)
|
||||
.lt(Visit::getCreateTime, monthEndTime)
|
||||
);
|
||||
|
||||
labels.add(monthStart.format(formatter));
|
||||
values.add((int) count);
|
||||
}
|
||||
} else {
|
||||
// 按天统计
|
||||
for (int i = 0; i < days; i++) {
|
||||
LocalDate date = startDate.plusDays(i);
|
||||
LocalDateTime dayStart = date.atStartOfDay();
|
||||
LocalDateTime dayEnd = date.plusDays(1).atStartOfDay();
|
||||
|
||||
long count = visitService.count(
|
||||
new LambdaQueryWrapper<Visit>()
|
||||
.ge(Visit::getCreateTime, dayStart)
|
||||
.lt(Visit::getCreateTime, dayEnd)
|
||||
);
|
||||
|
||||
labels.add(date.format(formatter));
|
||||
values.add((int) count);
|
||||
}
|
||||
}
|
||||
|
||||
data.put("labels", labels);
|
||||
data.put("values", values);
|
||||
data.put("total", values.stream().mapToInt(Integer::intValue).sum());
|
||||
|
||||
// 计算环比
|
||||
if (values.size() >= 2) {
|
||||
int current = values.get(values.size() - 1);
|
||||
int previous = values.get(values.size() - 2);
|
||||
double growthRate = previous > 0 ? ((double) (current - previous) / previous * 100) : 0;
|
||||
data.put("growthRate", Math.round(growthRate * 10) / 10.0);
|
||||
} else {
|
||||
data.put("growthRate", 0);
|
||||
}
|
||||
|
||||
// 平均日接诊
|
||||
double avg = values.isEmpty() ? 0 : values.stream().mapToInt(Integer::intValue).average().orElse(0);
|
||||
data.put("average", Math.round(avg * 10) / 10.0);
|
||||
|
||||
return ApiResponse.success(data);
|
||||
}
|
||||
|
||||
@PreAuthorize("hasRole('ADMIN')")
|
||||
@GetMapping("/today-todos")
|
||||
public ApiResponse<?> todayTodos() {
|
||||
LocalDate today = LocalDate.now();
|
||||
|
||||
// 查询今日待就诊的预约
|
||||
List<Appointment> appointments = appointmentService.list(
|
||||
new LambdaQueryWrapper<Appointment>()
|
||||
.eq(Appointment::getAppointmentDate, today)
|
||||
.eq(Appointment::getStatus, "CONFIRMED")
|
||||
.orderByAsc(Appointment::getTimeSlot)
|
||||
);
|
||||
|
||||
List<Map<String, Object>> todoList = appointments.stream().map(appointment -> {
|
||||
Map<String, Object> todo = new HashMap<>();
|
||||
|
||||
// 获取客户信息
|
||||
User customer = userService.getById(appointment.getCustomerId());
|
||||
// 获取宠物信息
|
||||
Pet pet = petService.getById(appointment.getPetId());
|
||||
|
||||
todo.put("id", appointment.getId());
|
||||
todo.put("time", appointment.getTimeSlot());
|
||||
todo.put("customer", customer != null ? customer.getUsername() : "未知客户");
|
||||
todo.put("pet", pet != null ? pet.getName() + "(" + pet.getBreed() + ")" : "未知宠物");
|
||||
todo.put("service", appointment.getDepartment() != null ? appointment.getDepartment() : "常规就诊");
|
||||
todo.put("status", "待就诊");
|
||||
todo.put("action", "接诊");
|
||||
|
||||
return todo;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
return ApiResponse.success(todoList);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
server:
|
||||
port: 8081
|
||||
address: 0.0.0.0
|
||||
servlet:
|
||||
context-path: /api
|
||||
|
||||
@@ -9,7 +10,7 @@ spring:
|
||||
|
||||
datasource:
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://localhost:3307/pet_hospital_dev?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8
|
||||
url: jdbc:mysql://localhost:3306/pet_hospital_dev?useUnicode=true&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=GMT%2B8
|
||||
username: root
|
||||
password: qq5211314
|
||||
hikari:
|
||||
|
||||
59
frontend/COLOR_UPDATE.md
Normal file
59
frontend/COLOR_UPDATE.md
Normal file
@@ -0,0 +1,59 @@
|
||||
# 配色更新说明
|
||||
|
||||
## 更新内容
|
||||
已将项目的紫色配色(#667eea、#764ba2)全面更换为**清新青绿色系**。
|
||||
|
||||
## 新配色方案
|
||||
|
||||
### 主色调
|
||||
- **主色**: `#0d9488` (teal-600) - 清新的青绿色
|
||||
- **辅助色**: `#14b8a6` (teal-500) - 亮青绿色
|
||||
- **深色**: `#115e59` (teal-700) - 深青绿
|
||||
- **浅色**: `#5eead4` (teal-300) - 浅青绿
|
||||
|
||||
### 功能色(保持不变)
|
||||
- **成功**: `#10b981` (green-500)
|
||||
- **警告**: `#f59e0b` (amber-500)
|
||||
- **危险**: `#ef4444` (red-500)
|
||||
- **信息**: `#3b82f6` (blue-500)
|
||||
|
||||
### 中性色(保持不变)
|
||||
- **背景**: `#f8fafc` (slate-50)
|
||||
- **面板**: `#ffffff` (white)
|
||||
- **文字**: `#1e293b` (slate-800)
|
||||
- **次要文字**: `#64748b` (slate-500)
|
||||
- **边框**: `#e2e8f0` (slate-200)
|
||||
|
||||
## 修改的文件列表
|
||||
|
||||
1. ✅ `frontend/src/styles/global.css` - 全局CSS变量和组件样式
|
||||
2. ✅ `frontend/src/pages/Dashboard.vue` - 仪表盘页面
|
||||
3. ✅ `frontend/src/layouts/MainLayout.vue` - 主布局
|
||||
4. ✅ `frontend/src/pages/Login.vue` - 登录页面
|
||||
5. ✅ `frontend/src/pages/Register.vue` - 注册页面
|
||||
|
||||
## 视觉效果对比
|
||||
|
||||
### 修改前(紫色系)
|
||||
- 主色:紫蓝色 #667eea → #764ba2
|
||||
- 风格:科技感较强,但略显沉重
|
||||
|
||||
### 修改后(青绿色系)
|
||||
- 主色:青绿色 #0d9488 → #14b8a6
|
||||
- 风格:清新自然,专业医疗感,更加舒适护眼
|
||||
|
||||
## 特点
|
||||
|
||||
1. **医疗感**: 青绿色常用于医疗健康领域,给人专业、可靠的感觉
|
||||
2. **清新感**: 比紫色更加清爽,视觉疲劳度更低
|
||||
3. **自然感**: 接近自然界的颜色,与宠物医院的主题更契合
|
||||
4. **现代感**: 当前流行的设计配色,简洁大方
|
||||
|
||||
## 建议
|
||||
|
||||
如果还需要调整配色,可以考虑以下方案:
|
||||
|
||||
1. **医疗蓝**: `#2563eb` → `#3b82f6` (更传统医疗感)
|
||||
2. **薄荷绿**: `#10b981` → `#34d399` (更活泼年轻)
|
||||
3. **暖橙色**: `#f97316` → `#fb923c` (更温馨友好)
|
||||
4. **深蓝**: `#1e40af` → `#3b82f6` (更稳重专业)
|
||||
@@ -66,4 +66,6 @@ export const api = {
|
||||
resetUserPassword: (id: number, newPassword: string) => http.put(`/users/${id}/reset-password`, null, { params: { newPassword } }),
|
||||
|
||||
stats: () => http.get('/admin/stats'),
|
||||
statsTrends: (period?: string) => http.get('/admin/stats/trends', { params: { period } }),
|
||||
todayTodos: () => http.get('/admin/stats/today-todos'),
|
||||
};
|
||||
|
||||
@@ -1,21 +1,77 @@
|
||||
<template>
|
||||
<t-layout class="layout">
|
||||
<t-aside class="sidebar">
|
||||
<div class="brand">爱维宠物医院</div>
|
||||
<t-menu :value="active" @change="onMenu">
|
||||
<div class="brand">
|
||||
<div class="logo">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||||
<path d="M12 2L2 7l10 5 10-5-10-5z"/>
|
||||
<path d="M2 17l10 5 10-5"/>
|
||||
<path d="M2 12l10 5 10-5"/>
|
||||
</svg>
|
||||
</div>
|
||||
<div class="brand-text">
|
||||
<div class="brand-title">爱维宠物医院</div>
|
||||
<div class="brand-subtitle">智能管理平台</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<t-menu :value="active" @change="onMenu" class="nav-menu">
|
||||
<t-menu-item v-for="item in visibleMenu" :key="item.path" :value="item.path">
|
||||
<template #icon>
|
||||
<t-icon :name="item.icon" />
|
||||
</template>
|
||||
{{ item.label }}
|
||||
</t-menu-item>
|
||||
</t-menu>
|
||||
|
||||
<div class="sidebar-footer">
|
||||
<div class="version">版本 v1.0.0</div>
|
||||
</div>
|
||||
</t-aside>
|
||||
<t-layout>
|
||||
|
||||
<t-layout class="main-layout">
|
||||
<t-header class="header">
|
||||
<div class="spacer"></div>
|
||||
<t-space>
|
||||
<t-tag theme="primary" variant="light">{{ auth.user.role || '游客' }}</t-tag>
|
||||
<t-button theme="default" variant="text" @click="logout">退出</t-button>
|
||||
</t-space>
|
||||
<div class="header-left">
|
||||
<div class="breadcrumb">
|
||||
<t-icon name="home" class="breadcrumb-icon" />
|
||||
<span class="breadcrumb-separator">/</span>
|
||||
<span class="breadcrumb-current">{{ currentPageTitle }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="header-right">
|
||||
<t-space :size="16">
|
||||
<div class="notification-btn">
|
||||
<t-badge :count="3" size="small">
|
||||
<t-button theme="default" variant="text" shape="circle">
|
||||
<t-icon name="notification" />
|
||||
</t-button>
|
||||
</t-badge>
|
||||
</div>
|
||||
|
||||
<div class="user-info">
|
||||
<div class="avatar">
|
||||
<img v-if="auth.user?.avatar" :src="auth.user.avatar" alt="avatar" />
|
||||
<div v-else class="avatar-placeholder">{{ auth.user?.username?.[0] || 'U' }}</div>
|
||||
</div>
|
||||
<div class="user-meta">
|
||||
<div class="username">{{ auth.user?.username || '用户' }}</div>
|
||||
<t-tag theme="primary" variant="light" size="small">
|
||||
{{ roleText }}
|
||||
</t-tag>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<t-divider layout="vertical" />
|
||||
|
||||
<t-button theme="default" variant="text" @click="logout" class="logout-btn">
|
||||
<template #icon><t-icon name="logout" /></template>
|
||||
退出
|
||||
</t-button>
|
||||
</t-space>
|
||||
</div>
|
||||
</t-header>
|
||||
|
||||
<t-content class="content">
|
||||
<RouterView />
|
||||
</t-content>
|
||||
@@ -34,6 +90,21 @@ const router = useRouter();
|
||||
const auth = useAuthStore();
|
||||
|
||||
const active = computed(() => route.path);
|
||||
|
||||
const currentPageTitle = computed(() => {
|
||||
const item = menuItems.find(m => m.path === route.path);
|
||||
return item?.label || '仪表盘';
|
||||
});
|
||||
|
||||
const roleText = computed(() => {
|
||||
const roles: Record<string, string> = {
|
||||
'ADMIN': '管理员',
|
||||
'DOCTOR': '医生',
|
||||
'CUSTOMER': '客户'
|
||||
};
|
||||
return roles[auth.user?.role] || auth.user?.role || '访客';
|
||||
});
|
||||
|
||||
const visibleMenu = computed(() => {
|
||||
const role = auth.user?.role || '';
|
||||
return menuItems.filter((item) => item.roles.includes(role));
|
||||
@@ -55,30 +126,222 @@ const logout = () => {
|
||||
}
|
||||
|
||||
.sidebar {
|
||||
width: 220px;
|
||||
background: #0f172a;
|
||||
width: 260px;
|
||||
background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
|
||||
color: #fff;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
position: fixed;
|
||||
height: 100vh;
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
.brand {
|
||||
padding: 16px;
|
||||
font-size: 18px;
|
||||
padding: 24px 20px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
|
||||
.logo {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
background: linear-gradient(135deg, #0d9488, #14b8a6);
|
||||
border-radius: 10px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.logo svg {
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
}
|
||||
|
||||
.brand-text {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.brand-title {
|
||||
font-size: 16px;
|
||||
font-weight: 700;
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
|
||||
.brand-subtitle {
|
||||
font-size: 12px;
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
.nav-menu {
|
||||
flex: 1;
|
||||
background: transparent;
|
||||
border: none;
|
||||
padding: 12px 0;
|
||||
}
|
||||
|
||||
:deep(.t-menu__item) {
|
||||
color: rgba(255, 255, 255, 0.7);
|
||||
margin: 4px 12px;
|
||||
border-radius: 10px;
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
:deep(.t-menu__item:hover) {
|
||||
color: #fff;
|
||||
background: rgba(255, 255, 255, 0.05);
|
||||
}
|
||||
|
||||
:deep(.t-menu__item.t-is-active) {
|
||||
color: #fff;
|
||||
background: linear-gradient(135deg, rgba(102, 126, 234, 0.8), rgba(118, 75, 162, 0.8));
|
||||
font-weight: 600;
|
||||
box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
|
||||
}
|
||||
|
||||
:deep(.t-menu__operations-icon) {
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
.sidebar-footer {
|
||||
padding: 16px 20px;
|
||||
border-top: 1px solid rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
|
||||
.version {
|
||||
font-size: 12px;
|
||||
opacity: 0.5;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.main-layout {
|
||||
margin-left: 260px;
|
||||
}
|
||||
|
||||
.header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 0 20px;
|
||||
justify-content: space-between;
|
||||
padding: 0 24px;
|
||||
height: 64px;
|
||||
background: #fff;
|
||||
border-bottom: 1px solid #e2e8f0;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 99;
|
||||
}
|
||||
|
||||
.spacer {
|
||||
flex: 1;
|
||||
.header-left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.breadcrumb {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
color: var(--text-secondary);
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.breadcrumb-icon {
|
||||
color: var(--primary);
|
||||
}
|
||||
|
||||
.breadcrumb-separator {
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.breadcrumb-current {
|
||||
color: var(--text);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.header-right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.notification-btn :deep(.t-button) {
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.notification-btn :deep(.t-button:hover) {
|
||||
color: var(--primary);
|
||||
background: rgba(102, 126, 234, 0.1);
|
||||
}
|
||||
|
||||
.user-info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.avatar {
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
border-radius: 50%;
|
||||
overflow: hidden;
|
||||
background: linear-gradient(135deg, #0d9488, #14b8a6);
|
||||
}
|
||||
|
||||
.avatar img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.avatar-placeholder {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: white;
|
||||
font-weight: 600;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.user-meta {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
.username {
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
.logout-btn {
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.logout-btn:hover {
|
||||
color: var(--danger);
|
||||
background: var(--danger-light);
|
||||
}
|
||||
|
||||
.content {
|
||||
min-height: calc(100vh - 56px);
|
||||
min-height: calc(100vh - 64px);
|
||||
background: var(--app-bg);
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.sidebar {
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
.main-layout {
|
||||
margin-left: 200px;
|
||||
}
|
||||
|
||||
.brand-subtitle,
|
||||
.version {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,24 +1,140 @@
|
||||
<template>
|
||||
<div class="login">
|
||||
<div class="panel login-card">
|
||||
<h1>爱维宠物医院管理平台</h1>
|
||||
<t-form :data="form" @submit="onSubmit">
|
||||
<t-form-item label="账号">
|
||||
<t-input v-model="form.account" placeholder="用户名/手机号/邮箱" />
|
||||
</t-form-item>
|
||||
<t-form-item label="密码">
|
||||
<t-input v-model="form.password" type="password" placeholder="请输入密码" />
|
||||
</t-form-item>
|
||||
<t-form-item>
|
||||
<t-button theme="primary" type="submit" block>登录</t-button>
|
||||
</t-form-item>
|
||||
</t-form>
|
||||
<div class="login-page">
|
||||
<div class="login-bg">
|
||||
<div class="bg-circle circle-1"></div>
|
||||
<div class="bg-circle circle-2"></div>
|
||||
<div class="bg-circle circle-3"></div>
|
||||
<div class="bg-grid"></div>
|
||||
<div class="bg-particles">
|
||||
<span v-for="n in 20" :key="n" class="particle" :style="getParticleStyle(n)"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="login-container">
|
||||
<div class="login-card">
|
||||
<div class="logo-section">
|
||||
<div class="logo">
|
||||
<div class="logo-inner">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||||
<path d="M12 2L2 7l10 5 10-5-10-5z"/>
|
||||
<path d="M2 17l10 5 10-5"/>
|
||||
<path d="M2 12l10 5 10-5"/>
|
||||
</svg>
|
||||
</div>
|
||||
<div class="logo-ring"></div>
|
||||
<div class="logo-ring ring-2"></div>
|
||||
</div>
|
||||
<h1 class="title">爱维宠物医院</h1>
|
||||
<p class="subtitle">智能管理平台</p>
|
||||
</div>
|
||||
|
||||
<t-form :data="form" @submit="onSubmit" class="login-form">
|
||||
<t-form-item>
|
||||
<t-input
|
||||
v-model="form.account"
|
||||
placeholder="用户名 / 手机号 / 邮箱"
|
||||
size="large"
|
||||
class="input-field"
|
||||
>
|
||||
<template #prefix-icon>
|
||||
<t-icon name="user" />
|
||||
</template>
|
||||
</t-input>
|
||||
</t-form-item>
|
||||
|
||||
<t-form-item>
|
||||
<t-input
|
||||
v-model="form.password"
|
||||
type="password"
|
||||
placeholder="请输入密码"
|
||||
size="large"
|
||||
class="input-field"
|
||||
>
|
||||
<template #prefix-icon>
|
||||
<t-icon name="lock-on" />
|
||||
</template>
|
||||
</t-input>
|
||||
</t-form-item>
|
||||
|
||||
<div class="form-options">
|
||||
<t-checkbox v-model="rememberMe" class="remember-checkbox">
|
||||
<span class="checkbox-label">记住我</span>
|
||||
</t-checkbox>
|
||||
<a href="#" class="forgot-link">忘记密码?</a>
|
||||
</div>
|
||||
|
||||
<t-form-item>
|
||||
<t-button
|
||||
theme="primary"
|
||||
type="submit"
|
||||
block
|
||||
size="large"
|
||||
:loading="loading"
|
||||
class="login-btn"
|
||||
>
|
||||
<span class="btn-text">登 录</span>
|
||||
<t-icon name="arrow-right" class="btn-icon" />
|
||||
</t-button>
|
||||
</t-form-item>
|
||||
</t-form>
|
||||
|
||||
<div class="divider">
|
||||
<span class="divider-line"></span>
|
||||
<span class="divider-text">其他登录方式</span>
|
||||
<span class="divider-line"></span>
|
||||
</div>
|
||||
|
||||
<div class="social-login">
|
||||
<t-button theme="default" variant="outline" shape="circle" class="social-btn wechat">
|
||||
<t-icon name="logo-wechat" />
|
||||
</t-button>
|
||||
<t-button theme="default" variant="outline" shape="circle" class="social-btn phone">
|
||||
<t-icon name="mobile" />
|
||||
</t-button>
|
||||
</div>
|
||||
|
||||
<div class="footer">
|
||||
<p>还没有账号? <router-link to="/register" class="register-link">立即注册</router-link></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="login-illustration">
|
||||
<div class="illustration-bg"></div>
|
||||
<div class="illustration-content">
|
||||
<div class="floating-icons">
|
||||
<div class="icon icon-1">🐕</div>
|
||||
<div class="icon icon-2">🐈</div>
|
||||
<div class="icon icon-3">🏥</div>
|
||||
<div class="icon icon-4">💉</div>
|
||||
<div class="icon icon-5">🦴</div>
|
||||
<div class="icon icon-6">🐾</div>
|
||||
</div>
|
||||
<div class="content-wrapper">
|
||||
<div class="badge">✨ 专业 · 贴心 · 高效</div>
|
||||
<h2>专业宠物医疗<br>用心呵护每一刻</h2>
|
||||
<p>为爱宠提供最优质的医疗服务<br>让每一个生命都得到最好的照顾</p>
|
||||
<div class="feature-list">
|
||||
<div class="feature-item">
|
||||
<t-icon name="check-circle" class="feature-icon" />
|
||||
<span>在线预约</span>
|
||||
</div>
|
||||
<div class="feature-item">
|
||||
<t-icon name="check-circle" class="feature-icon" />
|
||||
<span>电子病历</span>
|
||||
</div>
|
||||
<div class="feature-item">
|
||||
<t-icon name="check-circle" class="feature-icon" />
|
||||
<span>智能提醒</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { reactive } from 'vue';
|
||||
import { ref, reactive } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { MessagePlugin } from 'tdesign-vue-next';
|
||||
import { api } from '../api';
|
||||
@@ -26,17 +142,31 @@ import { useAuthStore } from '../store/auth';
|
||||
|
||||
const router = useRouter();
|
||||
const auth = useAuthStore();
|
||||
const loading = ref(false);
|
||||
const rememberMe = ref(false);
|
||||
|
||||
const form = reactive({
|
||||
account: '',
|
||||
password: '',
|
||||
});
|
||||
|
||||
const getParticleStyle = (n: number) => {
|
||||
return {
|
||||
left: `${Math.random() * 100}%`,
|
||||
top: `${Math.random() * 100}%`,
|
||||
animationDelay: `${Math.random() * 5}s`,
|
||||
animationDuration: `${3 + Math.random() * 4}s`,
|
||||
width: `${2 + Math.random() * 4}px`,
|
||||
height: `${2 + Math.random() * 4}px`,
|
||||
};
|
||||
};
|
||||
|
||||
const onSubmit = async () => {
|
||||
if (!form.account || !form.password) {
|
||||
MessagePlugin.warning('请输入账号与密码');
|
||||
return;
|
||||
}
|
||||
loading.value = true;
|
||||
try {
|
||||
const res = await api.login(form);
|
||||
if (res.code === 0) {
|
||||
@@ -45,31 +175,558 @@ const onSubmit = async () => {
|
||||
username: res.data.username,
|
||||
role: res.data.role,
|
||||
});
|
||||
MessagePlugin.success('登录成功');
|
||||
router.push('/dashboard');
|
||||
} else {
|
||||
MessagePlugin.error(res.message || '登录失败');
|
||||
}
|
||||
} catch {
|
||||
MessagePlugin.error('登录失败');
|
||||
MessagePlugin.error('登录失败,请检查网络');
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.login {
|
||||
.login-page {
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: linear-gradient(135deg, #e2e8f0, #f8fafc);
|
||||
background: linear-gradient(135deg, #0d9488 0%, #14b8a6 100%);
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.login-bg {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.bg-circle {
|
||||
position: absolute;
|
||||
border-radius: 50%;
|
||||
background: rgba(255, 255, 255, 0.08);
|
||||
animation: float 20s infinite ease-in-out;
|
||||
filter: blur(40px);
|
||||
}
|
||||
|
||||
.circle-1 {
|
||||
width: 500px;
|
||||
height: 500px;
|
||||
top: -150px;
|
||||
right: -100px;
|
||||
animation-delay: 0s;
|
||||
}
|
||||
|
||||
.circle-2 {
|
||||
width: 400px;
|
||||
height: 400px;
|
||||
bottom: -100px;
|
||||
left: -100px;
|
||||
animation-delay: -7s;
|
||||
}
|
||||
|
||||
.circle-3 {
|
||||
width: 300px;
|
||||
height: 300px;
|
||||
top: 40%;
|
||||
left: 20%;
|
||||
animation-delay: -14s;
|
||||
}
|
||||
|
||||
.bg-grid {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background-image:
|
||||
linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
|
||||
linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
|
||||
background-size: 50px 50px;
|
||||
animation: gridMove 20s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes gridMove {
|
||||
0% { transform: translate(0, 0); }
|
||||
100% { transform: translate(50px, 50px); }
|
||||
}
|
||||
|
||||
.bg-particles {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
}
|
||||
|
||||
.particle {
|
||||
position: absolute;
|
||||
background: rgba(255, 255, 255, 0.5);
|
||||
border-radius: 50%;
|
||||
animation: particleFloat linear infinite;
|
||||
}
|
||||
|
||||
@keyframes particleFloat {
|
||||
0% {
|
||||
transform: translateY(100vh) scale(0);
|
||||
opacity: 0;
|
||||
}
|
||||
10% {
|
||||
opacity: 1;
|
||||
}
|
||||
90% {
|
||||
opacity: 1;
|
||||
}
|
||||
100% {
|
||||
transform: translateY(-100vh) scale(1);
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes float {
|
||||
0%, 100% { transform: translate(0, 0) scale(1); }
|
||||
33% { transform: translate(30px, -30px) scale(1.1); }
|
||||
66% { transform: translate(-20px, 20px) scale(0.9); }
|
||||
}
|
||||
|
||||
.login-container {
|
||||
display: flex;
|
||||
width: 1000px;
|
||||
max-width: 95%;
|
||||
background: rgba(255, 255, 255, 0.98);
|
||||
border-radius: 32px;
|
||||
box-shadow:
|
||||
0 25px 50px -12px rgba(0, 0, 0, 0.25),
|
||||
0 0 0 1px rgba(255, 255, 255, 0.1);
|
||||
backdrop-filter: blur(20px);
|
||||
overflow: hidden;
|
||||
animation: slideUp 0.8s cubic-bezier(0.4, 0, 0.2, 1);
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
@keyframes slideUp {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(40px) scale(0.98);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0) scale(1);
|
||||
}
|
||||
}
|
||||
|
||||
.login-card {
|
||||
width: 360px;
|
||||
flex: 1;
|
||||
padding: 56px 48px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
h1 {
|
||||
.logo-section {
|
||||
text-align: center;
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
|
||||
.logo {
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
margin: 0 auto 20px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.logo-inner {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: linear-gradient(135deg, #0d9488, #14b8a6);
|
||||
border-radius: 20px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: white;
|
||||
box-shadow: 0 15px 35px rgba(102, 126, 234, 0.4);
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
animation: logoPulse 2s ease-in-out infinite;
|
||||
}
|
||||
|
||||
@keyframes logoPulse {
|
||||
0%, 100% { transform: scale(1); }
|
||||
50% { transform: scale(1.05); }
|
||||
}
|
||||
|
||||
.logo svg {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
.logo-ring {
|
||||
position: absolute;
|
||||
inset: -8px;
|
||||
border: 2px solid rgba(102, 126, 234, 0.2);
|
||||
border-radius: 28px;
|
||||
animation: ringPulse 2s ease-out infinite;
|
||||
}
|
||||
|
||||
.logo-ring.ring-2 {
|
||||
animation-delay: 0.5s;
|
||||
}
|
||||
|
||||
@keyframes ringPulse {
|
||||
0% { transform: scale(1); opacity: 1; }
|
||||
100% { transform: scale(1.3); opacity: 0; }
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 32px;
|
||||
font-weight: 800;
|
||||
background: linear-gradient(135deg, #1e293b, #475569);
|
||||
-webkit-background-clip: text;
|
||||
-webkit-text-fill-color: transparent;
|
||||
background-clip: text;
|
||||
margin: 0 0 8px;
|
||||
letter-spacing: -0.5px;
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
font-size: 15px;
|
||||
color: #64748b;
|
||||
margin: 0;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.login-form :deep(.t-input) {
|
||||
border-radius: 14px;
|
||||
height: 52px;
|
||||
border: 2px solid #e2e8f0;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.login-form :deep(.t-input:hover) {
|
||||
border-color: #cbd5e1;
|
||||
}
|
||||
|
||||
.login-form :deep(.t-input:focus) {
|
||||
border-color: #0d9488;
|
||||
box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
|
||||
}
|
||||
|
||||
.login-form :deep(.t-input__inner) {
|
||||
padding-left: 44px !important;
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
.input-field :deep(.t-input__prefix-icon) {
|
||||
color: #94a3b8;
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.form-options {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin: 8px 0 28px;
|
||||
}
|
||||
|
||||
.remember-checkbox :deep(.t-checkbox__label) {
|
||||
font-size: 14px;
|
||||
color: #475569;
|
||||
}
|
||||
|
||||
.checkbox-label {
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.forgot-link {
|
||||
color: #0d9488;
|
||||
text-decoration: none;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
transition: all 0.3s ease;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.forgot-link::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
bottom: -2px;
|
||||
left: 0;
|
||||
width: 0;
|
||||
height: 2px;
|
||||
background: linear-gradient(90deg, #0d9488, #14b8a6);
|
||||
transition: width 0.3s ease;
|
||||
}
|
||||
|
||||
.forgot-link:hover {
|
||||
color: #14b8a6;
|
||||
}
|
||||
|
||||
.forgot-link:hover::after {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.login-btn {
|
||||
height: 52px !important;
|
||||
border-radius: 14px !important;
|
||||
font-size: 16px !important;
|
||||
font-weight: 700 !important;
|
||||
background: linear-gradient(135deg, #0d9488, #14b8a6) !important;
|
||||
border: none !important;
|
||||
box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4) !important;
|
||||
transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.login-btn::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: -100%;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
|
||||
transition: left 0.5s;
|
||||
}
|
||||
|
||||
.login-btn:hover {
|
||||
transform: translateY(-2px) !important;
|
||||
box-shadow: 0 12px 28px rgba(102, 126, 234, 0.5) !important;
|
||||
}
|
||||
|
||||
.login-btn:hover::before {
|
||||
left: 100%;
|
||||
}
|
||||
|
||||
.btn-text {
|
||||
margin-right: 8px;
|
||||
}
|
||||
|
||||
.btn-icon {
|
||||
transition: transform 0.3s ease;
|
||||
}
|
||||
|
||||
.login-btn:hover .btn-icon {
|
||||
transform: translateX(4px);
|
||||
}
|
||||
|
||||
.divider {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
margin: 28px 0;
|
||||
}
|
||||
|
||||
.divider-line {
|
||||
flex: 1;
|
||||
height: 1px;
|
||||
background: linear-gradient(90deg, transparent, #e2e8f0, transparent);
|
||||
}
|
||||
|
||||
.divider-text {
|
||||
font-size: 13px;
|
||||
color: #94a3b8;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.social-login {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
gap: 16px;
|
||||
margin-bottom: 28px;
|
||||
}
|
||||
|
||||
.social-btn {
|
||||
width: 48px !important;
|
||||
height: 48px !important;
|
||||
border-radius: 14px !important;
|
||||
border: 2px solid #e2e8f0 !important;
|
||||
transition: all 0.3s ease !important;
|
||||
font-size: 20px !important;
|
||||
}
|
||||
|
||||
.social-btn:hover {
|
||||
transform: translateY(-3px) !important;
|
||||
border-color: #cbd5e1 !important;
|
||||
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1) !important;
|
||||
}
|
||||
|
||||
.social-btn.wechat:hover {
|
||||
color: #07c160 !important;
|
||||
border-color: #07c160 !important;
|
||||
background: rgba(7, 193, 96, 0.05) !important;
|
||||
}
|
||||
|
||||
.social-btn.phone:hover {
|
||||
color: #0d9488 !important;
|
||||
border-color: #0d9488 !important;
|
||||
background: rgba(102, 126, 234, 0.05) !important;
|
||||
}
|
||||
|
||||
.footer {
|
||||
text-align: center;
|
||||
font-size: 14px;
|
||||
color: #64748b;
|
||||
}
|
||||
|
||||
.register-link {
|
||||
color: #0d9488;
|
||||
text-decoration: none;
|
||||
font-weight: 700;
|
||||
transition: all 0.3s ease;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.register-link::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
bottom: -2px;
|
||||
left: 0;
|
||||
width: 0;
|
||||
height: 2px;
|
||||
background: linear-gradient(90deg, #0d9488, #14b8a6);
|
||||
transition: width 0.3s ease;
|
||||
}
|
||||
|
||||
.register-link:hover {
|
||||
color: #14b8a6;
|
||||
}
|
||||
|
||||
.register-link:hover::after {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.login-illustration {
|
||||
width: 420px;
|
||||
background: linear-gradient(135deg, #0d9488, #14b8a6);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: white;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.illustration-bg {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background:
|
||||
radial-gradient(circle at 30% 20%, rgba(255,255,255,0.1) 0%, transparent 50%),
|
||||
radial-gradient(circle at 70% 80%, rgba(255,255,255,0.1) 0%, transparent 50%);
|
||||
}
|
||||
|
||||
.illustration-content {
|
||||
text-align: center;
|
||||
padding: 48px;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.floating-icons {
|
||||
position: relative;
|
||||
height: 140px;
|
||||
margin-bottom: 32px;
|
||||
}
|
||||
|
||||
.icon {
|
||||
position: absolute;
|
||||
font-size: 36px;
|
||||
animation: iconFloat 3s ease-in-out infinite;
|
||||
filter: drop-shadow(0 4px 8px rgba(0,0,0,0.2));
|
||||
}
|
||||
|
||||
.icon-1 { left: 5%; top: 0; animation-delay: 0s; }
|
||||
.icon-2 { right: 5%; top: 10%; animation-delay: 0.4s; }
|
||||
.icon-3 { left: 50%; top: 30%; transform: translateX(-50%); animation-delay: 0.8s; }
|
||||
.icon-4 { right: 15%; bottom: 10%; animation-delay: 1.2s; }
|
||||
.icon-5 { left: 15%; bottom: 5%; animation-delay: 1.6s; }
|
||||
.icon-6 { right: 30%; top: 5%; animation-delay: 2s; }
|
||||
|
||||
@keyframes iconFloat {
|
||||
0%, 100% { transform: translateY(0) rotate(0deg); }
|
||||
50% { transform: translateY(-20px) rotate(5deg); }
|
||||
}
|
||||
|
||||
.icon-3 {
|
||||
font-size: 48px;
|
||||
}
|
||||
|
||||
.content-wrapper {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.badge {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
padding: 8px 16px;
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
border-radius: 20px;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
margin-bottom: 24px;
|
||||
backdrop-filter: blur(10px);
|
||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
|
||||
.illustration-content h2 {
|
||||
font-size: 28px;
|
||||
font-weight: 700;
|
||||
margin: 0 0 16px;
|
||||
line-height: 1.4;
|
||||
text-shadow: 0 2px 10px rgba(0,0,0,0.1);
|
||||
}
|
||||
|
||||
.illustration-content p {
|
||||
font-size: 15px;
|
||||
opacity: 0.95;
|
||||
margin: 0 0 32px;
|
||||
line-height: 1.8;
|
||||
}
|
||||
|
||||
.feature-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
align-items: flex-start;
|
||||
text-align: left;
|
||||
padding: 0 20px;
|
||||
}
|
||||
|
||||
.feature-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
padding: 8px 16px;
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
border-radius: 10px;
|
||||
backdrop-filter: blur(10px);
|
||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
|
||||
.feature-icon {
|
||||
color: #4ade80;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
@media (max-width: 900px) {
|
||||
.login-illustration {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.login-card {
|
||||
padding: 40px 32px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 480px) {
|
||||
.login-card {
|
||||
padding: 32px 24px;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 26px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
716
frontend/src/pages/Register.vue
Normal file
716
frontend/src/pages/Register.vue
Normal file
@@ -0,0 +1,716 @@
|
||||
<template>
|
||||
<div class="login-page">
|
||||
<div class="login-bg">
|
||||
<div class="bg-circle circle-1"></div>
|
||||
<div class="bg-circle circle-2"></div>
|
||||
<div class="bg-circle circle-3"></div>
|
||||
<div class="bg-grid"></div>
|
||||
<div class="bg-particles">
|
||||
<span v-for="n in 20" :key="n" class="particle" :style="getParticleStyle(n)"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="login-container">
|
||||
<div class="login-card">
|
||||
<div class="logo-section">
|
||||
<div class="logo">
|
||||
<div class="logo-inner">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||||
<path d="M12 2L2 7l10 5 10-5-10-5z"/>
|
||||
<path d="M2 17l10 5 10-5"/>
|
||||
<path d="M2 12l10 5 10-5"/>
|
||||
</svg>
|
||||
</div>
|
||||
<div class="logo-ring"></div>
|
||||
<div class="logo-ring ring-2"></div>
|
||||
</div>
|
||||
<h1 class="title">创建账号</h1>
|
||||
<p class="subtitle">加入爱维宠物医院</p>
|
||||
</div>
|
||||
|
||||
<t-form :data="form" @submit="onSubmit" class="login-form">
|
||||
<t-form-item>
|
||||
<t-input
|
||||
v-model="form.username"
|
||||
placeholder="请输入用户名"
|
||||
size="large"
|
||||
class="input-field"
|
||||
clearable
|
||||
>
|
||||
<template #prefix-icon>
|
||||
<t-icon name="user" />
|
||||
</template>
|
||||
</t-input>
|
||||
</t-form-item>
|
||||
|
||||
<t-form-item>
|
||||
<t-input
|
||||
v-model="form.phone"
|
||||
placeholder="请输入手机号"
|
||||
size="large"
|
||||
class="input-field"
|
||||
clearable
|
||||
>
|
||||
<template #prefix-icon>
|
||||
<t-icon name="mobile" />
|
||||
</template>
|
||||
</t-input>
|
||||
</t-form-item>
|
||||
|
||||
<t-form-item>
|
||||
<t-input
|
||||
v-model="form.email"
|
||||
placeholder="请输入邮箱(选填)"
|
||||
size="large"
|
||||
class="input-field"
|
||||
clearable
|
||||
>
|
||||
<template #prefix-icon>
|
||||
<t-icon name="mail" />
|
||||
</template>
|
||||
</t-input>
|
||||
</t-form-item>
|
||||
|
||||
<t-form-item>
|
||||
<t-input
|
||||
v-model="form.password"
|
||||
type="password"
|
||||
placeholder="请输入密码"
|
||||
size="large"
|
||||
class="input-field"
|
||||
clearable
|
||||
>
|
||||
<template #prefix-icon>
|
||||
<t-icon name="lock-on" />
|
||||
</template>
|
||||
</t-input>
|
||||
</t-form-item>
|
||||
|
||||
<t-form-item>
|
||||
<t-input
|
||||
v-model="form.confirmPassword"
|
||||
type="password"
|
||||
placeholder="请确认密码"
|
||||
size="large"
|
||||
class="input-field"
|
||||
clearable
|
||||
>
|
||||
<template #prefix-icon>
|
||||
<t-icon name="check-circle" />
|
||||
</template>
|
||||
</t-input>
|
||||
</t-form-item>
|
||||
|
||||
<t-form-item>
|
||||
<t-checkbox v-model="agreeTerms" class="remember-checkbox">
|
||||
<span class="checkbox-label">我已阅读并同意 <a href="#" class="terms-link">服务条款</a> 和 <a href="#" class="terms-link">隐私政策</a></span>
|
||||
</t-checkbox>
|
||||
</t-form-item>
|
||||
|
||||
<t-form-item>
|
||||
<t-button
|
||||
theme="primary"
|
||||
type="submit"
|
||||
block
|
||||
size="large"
|
||||
:loading="loading"
|
||||
class="login-btn"
|
||||
>
|
||||
<span class="btn-text">注 册</span>
|
||||
<t-icon name="arrow-right" class="btn-icon" />
|
||||
</t-button>
|
||||
</t-form-item>
|
||||
</t-form>
|
||||
|
||||
<div class="footer">
|
||||
<p>已有账号? <router-link to="/login" class="register-link">立即登录</router-link></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="login-illustration">
|
||||
<div class="illustration-bg"></div>
|
||||
<div class="illustration-content">
|
||||
<div class="floating-icons">
|
||||
<div class="icon icon-1">🐕</div>
|
||||
<div class="icon icon-2">🐈</div>
|
||||
<div class="icon icon-3">🏥</div>
|
||||
<div class="icon icon-4">💉</div>
|
||||
<div class="icon icon-5">🦴</div>
|
||||
<div class="icon icon-6">🐾</div>
|
||||
</div>
|
||||
<div class="content-wrapper">
|
||||
<div class="badge">✨ 专业 · 贴心 · 高效</div>
|
||||
<h2>开启您的<br>宠物医疗之旅</h2>
|
||||
<p>注册即享专业宠物医疗服务<br>让爱宠健康每一刻</p>
|
||||
<div class="feature-list">
|
||||
<div class="feature-item">
|
||||
<t-icon name="check-circle" class="feature-icon" />
|
||||
<span>在线预约</span>
|
||||
</div>
|
||||
<div class="feature-item">
|
||||
<t-icon name="check-circle" class="feature-icon" />
|
||||
<span>电子病历</span>
|
||||
</div>
|
||||
<div class="feature-item">
|
||||
<t-icon name="check-circle" class="feature-icon" />
|
||||
<span>智能提醒</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { MessagePlugin } from 'tdesign-vue-next';
|
||||
import { api } from '../api';
|
||||
|
||||
const router = useRouter();
|
||||
const loading = ref(false);
|
||||
const agreeTerms = ref(false);
|
||||
|
||||
const form = reactive({
|
||||
username: '',
|
||||
phone: '',
|
||||
email: '',
|
||||
password: '',
|
||||
confirmPassword: '',
|
||||
});
|
||||
|
||||
const getParticleStyle = (n: number) => {
|
||||
return {
|
||||
left: `${Math.random() * 100}%`,
|
||||
top: `${Math.random() * 100}%`,
|
||||
animationDelay: `${Math.random() * 5}s`,
|
||||
animationDuration: `${3 + Math.random() * 4}s`,
|
||||
width: `${2 + Math.random() * 4}px`,
|
||||
height: `${2 + Math.random() * 4}px`,
|
||||
};
|
||||
};
|
||||
|
||||
const onSubmit = async () => {
|
||||
// 表单验证
|
||||
if (!form.username.trim()) {
|
||||
MessagePlugin.warning('请输入用户名');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!form.phone.trim() && !form.email.trim()) {
|
||||
MessagePlugin.warning('请输入手机号或邮箱');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!form.password) {
|
||||
MessagePlugin.warning('请输入密码');
|
||||
return;
|
||||
}
|
||||
|
||||
if (form.password.length < 6) {
|
||||
MessagePlugin.warning('密码长度至少6位');
|
||||
return;
|
||||
}
|
||||
|
||||
if (form.password !== form.confirmPassword) {
|
||||
MessagePlugin.warning('两次输入的密码不一致');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!agreeTerms.value) {
|
||||
MessagePlugin.warning('请同意服务条款和隐私政策');
|
||||
return;
|
||||
}
|
||||
|
||||
loading.value = true;
|
||||
try {
|
||||
const payload = {
|
||||
username: form.username.trim(),
|
||||
password: form.password,
|
||||
phone: form.phone.trim() || undefined,
|
||||
email: form.email.trim() || undefined,
|
||||
};
|
||||
|
||||
const res = await api.register(payload);
|
||||
if (res.code === 0) {
|
||||
MessagePlugin.success('注册成功,请登录');
|
||||
router.push('/login');
|
||||
} else {
|
||||
MessagePlugin.error(res.message || '注册失败');
|
||||
}
|
||||
} catch (error: any) {
|
||||
MessagePlugin.error(error?.response?.data?.message || '注册失败,请检查网络');
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.login-page {
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: linear-gradient(135deg, #0d9488 0%, #14b8a6 100%);
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.login-bg {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.bg-circle {
|
||||
position: absolute;
|
||||
border-radius: 50%;
|
||||
background: rgba(255, 255, 255, 0.08);
|
||||
animation: float 20s infinite ease-in-out;
|
||||
filter: blur(40px);
|
||||
}
|
||||
|
||||
.circle-1 {
|
||||
width: 500px;
|
||||
height: 500px;
|
||||
top: -150px;
|
||||
right: -100px;
|
||||
animation-delay: 0s;
|
||||
}
|
||||
|
||||
.circle-2 {
|
||||
width: 400px;
|
||||
height: 400px;
|
||||
bottom: -100px;
|
||||
left: -100px;
|
||||
animation-delay: -7s;
|
||||
}
|
||||
|
||||
.circle-3 {
|
||||
width: 300px;
|
||||
height: 300px;
|
||||
top: 40%;
|
||||
left: 20%;
|
||||
animation-delay: -14s;
|
||||
}
|
||||
|
||||
.bg-grid {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background-image:
|
||||
linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
|
||||
linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
|
||||
background-size: 50px 50px;
|
||||
animation: gridMove 20s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes gridMove {
|
||||
0% { transform: translate(0, 0); }
|
||||
100% { transform: translate(50px, 50px); }
|
||||
}
|
||||
|
||||
.bg-particles {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
}
|
||||
|
||||
.particle {
|
||||
position: absolute;
|
||||
background: rgba(255, 255, 255, 0.5);
|
||||
border-radius: 50%;
|
||||
animation: particleFloat linear infinite;
|
||||
}
|
||||
|
||||
@keyframes particleFloat {
|
||||
0% {
|
||||
transform: translateY(100vh) scale(0);
|
||||
opacity: 0;
|
||||
}
|
||||
10% {
|
||||
opacity: 1;
|
||||
}
|
||||
90% {
|
||||
opacity: 1;
|
||||
}
|
||||
100% {
|
||||
transform: translateY(-100vh) scale(1);
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes float {
|
||||
0%, 100% { transform: translate(0, 0) scale(1); }
|
||||
33% { transform: translate(30px, -30px) scale(1.1); }
|
||||
66% { transform: translate(-20px, 20px) scale(0.9); }
|
||||
}
|
||||
|
||||
.login-container {
|
||||
display: flex;
|
||||
width: 1000px;
|
||||
max-width: 95%;
|
||||
background: rgba(255, 255, 255, 0.98);
|
||||
border-radius: 32px;
|
||||
box-shadow:
|
||||
0 25px 50px -12px rgba(0, 0, 0, 0.25),
|
||||
0 0 0 1px rgba(255, 255, 255, 0.1);
|
||||
backdrop-filter: blur(20px);
|
||||
overflow: hidden;
|
||||
animation: slideUp 0.8s cubic-bezier(0.4, 0, 0.2, 1);
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
@keyframes slideUp {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(40px) scale(0.98);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0) scale(1);
|
||||
}
|
||||
}
|
||||
|
||||
.login-card {
|
||||
flex: 1;
|
||||
padding: 48px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.logo-section {
|
||||
text-align: center;
|
||||
margin-bottom: 32px;
|
||||
}
|
||||
|
||||
.logo {
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
margin: 0 auto 20px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.logo-inner {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: linear-gradient(135deg, #0d9488, #14b8a6);
|
||||
border-radius: 20px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: white;
|
||||
box-shadow: 0 15px 35px rgba(102, 126, 234, 0.4);
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
animation: logoPulse 2s ease-in-out infinite;
|
||||
}
|
||||
|
||||
@keyframes logoPulse {
|
||||
0%, 100% { transform: scale(1); }
|
||||
50% { transform: scale(1.05); }
|
||||
}
|
||||
|
||||
.logo svg {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
.logo-ring {
|
||||
position: absolute;
|
||||
inset: -8px;
|
||||
border: 2px solid rgba(102, 126, 234, 0.2);
|
||||
border-radius: 28px;
|
||||
animation: ringPulse 2s ease-out infinite;
|
||||
}
|
||||
|
||||
.logo-ring.ring-2 {
|
||||
animation-delay: 0.5s;
|
||||
}
|
||||
|
||||
@keyframes ringPulse {
|
||||
0% { transform: scale(1); opacity: 1; }
|
||||
100% { transform: scale(1.3); opacity: 0; }
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 32px;
|
||||
font-weight: 800;
|
||||
background: linear-gradient(135deg, #1e293b, #475569);
|
||||
-webkit-background-clip: text;
|
||||
-webkit-text-fill-color: transparent;
|
||||
background-clip: text;
|
||||
margin: 0 0 8px;
|
||||
letter-spacing: -0.5px;
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
font-size: 15px;
|
||||
color: #64748b;
|
||||
margin: 0;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.login-form :deep(.t-input) {
|
||||
border-radius: 14px;
|
||||
height: 52px;
|
||||
border: 2px solid #e2e8f0;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.login-form :deep(.t-input:hover) {
|
||||
border-color: #cbd5e1;
|
||||
}
|
||||
|
||||
.login-form :deep(.t-input:focus) {
|
||||
border-color: #0d9488;
|
||||
box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
|
||||
}
|
||||
|
||||
.login-form :deep(.t-input__inner) {
|
||||
padding-left: 44px !important;
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
.input-field :deep(.t-input__prefix-icon) {
|
||||
color: #94a3b8;
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.remember-checkbox :deep(.t-checkbox__label) {
|
||||
font-size: 13px;
|
||||
color: #475569;
|
||||
}
|
||||
|
||||
.checkbox-label {
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.terms-link {
|
||||
color: #0d9488;
|
||||
text-decoration: none;
|
||||
font-weight: 600;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.terms-link:hover {
|
||||
color: #14b8a6;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.login-btn {
|
||||
height: 52px !important;
|
||||
border-radius: 14px !important;
|
||||
font-size: 16px !important;
|
||||
font-weight: 700 !important;
|
||||
background: linear-gradient(135deg, #0d9488, #14b8a6) !important;
|
||||
border: none !important;
|
||||
box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4) !important;
|
||||
transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.login-btn::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: -100%;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
|
||||
transition: left 0.5s;
|
||||
}
|
||||
|
||||
.login-btn:hover {
|
||||
transform: translateY(-2px) !important;
|
||||
box-shadow: 0 12px 28px rgba(102, 126, 234, 0.5) !important;
|
||||
}
|
||||
|
||||
.login-btn:hover::before {
|
||||
left: 100%;
|
||||
}
|
||||
|
||||
.btn-text {
|
||||
margin-right: 8px;
|
||||
}
|
||||
|
||||
.btn-icon {
|
||||
transition: transform 0.3s ease;
|
||||
}
|
||||
|
||||
.login-btn:hover .btn-icon {
|
||||
transform: translateX(4px);
|
||||
}
|
||||
|
||||
.footer {
|
||||
text-align: center;
|
||||
font-size: 14px;
|
||||
color: #64748b;
|
||||
margin-top: 24px;
|
||||
}
|
||||
|
||||
.register-link {
|
||||
color: #0d9488;
|
||||
text-decoration: none;
|
||||
font-weight: 700;
|
||||
transition: all 0.3s ease;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.register-link::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
bottom: -2px;
|
||||
left: 0;
|
||||
width: 0;
|
||||
height: 2px;
|
||||
background: linear-gradient(90deg, #0d9488, #14b8a6);
|
||||
transition: width 0.3s ease;
|
||||
}
|
||||
|
||||
.register-link:hover {
|
||||
color: #14b8a6;
|
||||
}
|
||||
|
||||
.register-link:hover::after {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.login-illustration {
|
||||
width: 420px;
|
||||
background: linear-gradient(135deg, #0d9488, #14b8a6);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: white;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.illustration-bg {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background:
|
||||
radial-gradient(circle at 30% 20%, rgba(255,255,255,0.1) 0%, transparent 50%),
|
||||
radial-gradient(circle at 70% 80%, rgba(255,255,255,0.1) 0%, transparent 50%);
|
||||
}
|
||||
|
||||
.illustration-content {
|
||||
text-align: center;
|
||||
padding: 48px;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.floating-icons {
|
||||
position: relative;
|
||||
height: 140px;
|
||||
margin-bottom: 32px;
|
||||
}
|
||||
|
||||
.icon {
|
||||
position: absolute;
|
||||
font-size: 36px;
|
||||
animation: iconFloat 3s ease-in-out infinite;
|
||||
filter: drop-shadow(0 4px 8px rgba(0,0,0,0.2));
|
||||
}
|
||||
|
||||
.icon-1 { left: 5%; top: 0; animation-delay: 0s; }
|
||||
.icon-2 { right: 5%; top: 10%; animation-delay: 0.4s; }
|
||||
.icon-3 { left: 50%; top: 30%; transform: translateX(-50%); animation-delay: 0.8s; }
|
||||
.icon-4 { right: 15%; bottom: 10%; animation-delay: 1.2s; }
|
||||
.icon-5 { left: 15%; bottom: 5%; animation-delay: 1.6s; }
|
||||
.icon-6 { right: 30%; top: 5%; animation-delay: 2s; }
|
||||
|
||||
@keyframes iconFloat {
|
||||
0%, 100% { transform: translateY(0) rotate(0deg); }
|
||||
50% { transform: translateY(-20px) rotate(5deg); }
|
||||
}
|
||||
|
||||
.icon-3 {
|
||||
font-size: 48px;
|
||||
}
|
||||
|
||||
.content-wrapper {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.badge {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
padding: 8px 16px;
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
border-radius: 20px;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
margin-bottom: 24px;
|
||||
backdrop-filter: blur(10px);
|
||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
|
||||
.illustration-content h2 {
|
||||
font-size: 28px;
|
||||
font-weight: 700;
|
||||
margin: 0 0 16px;
|
||||
line-height: 1.4;
|
||||
text-shadow: 0 2px 10px rgba(0,0,0,0.1);
|
||||
}
|
||||
|
||||
.illustration-content p {
|
||||
font-size: 15px;
|
||||
opacity: 0.95;
|
||||
margin: 0 0 32px;
|
||||
line-height: 1.8;
|
||||
}
|
||||
|
||||
.feature-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
align-items: flex-start;
|
||||
text-align: left;
|
||||
padding: 0 20px;
|
||||
}
|
||||
|
||||
.feature-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
padding: 8px 16px;
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
border-radius: 10px;
|
||||
backdrop-filter: blur(10px);
|
||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
|
||||
.feature-icon {
|
||||
color: #4ade80;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
@media (max-width: 900px) {
|
||||
.login-illustration {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.login-card {
|
||||
padding: 40px 32px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 480px) {
|
||||
.login-card {
|
||||
padding: 32px 24px;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 26px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -3,6 +3,7 @@ import { useAuthStore } from '../store/auth';
|
||||
|
||||
const routes: RouteRecordRaw[] = [
|
||||
{ path: '/login', name: 'login', component: () => import('../pages/Login.vue') },
|
||||
{ path: '/register', name: 'register', component: () => import('../pages/Register.vue') },
|
||||
{
|
||||
path: '/',
|
||||
component: () => import('../layouts/MainLayout.vue'),
|
||||
@@ -34,10 +35,10 @@ const router = createRouter({
|
||||
|
||||
router.beforeEach((to) => {
|
||||
const auth = useAuthStore();
|
||||
if (to.path !== '/login' && !auth.token) {
|
||||
if (to.path !== '/login' && to.path !== '/register' && !auth.token) {
|
||||
return '/login';
|
||||
}
|
||||
if (to.path === '/login' && auth.token) {
|
||||
if ((to.path === '/login' || to.path === '/register') && auth.token) {
|
||||
return '/dashboard';
|
||||
}
|
||||
const roles = to.meta?.roles as string[] | undefined;
|
||||
|
||||
@@ -1,131 +1,492 @@
|
||||
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');
|
||||
|
||||
:root {
|
||||
/* 主色调 - 清新青绿色系 */
|
||||
--primary: #0d9488;
|
||||
--primary-light: #14b8a6;
|
||||
--primary-hover: #0f766e;
|
||||
--primary-dark: #115e59;
|
||||
|
||||
/* 功能色 */
|
||||
--success: #10b981;
|
||||
--success-light: #d1fae5;
|
||||
--success-dark: #059669;
|
||||
--warning: #f59e0b;
|
||||
--warning-light: #fef3c7;
|
||||
--warning-dark: #d97706;
|
||||
--danger: #ef4444;
|
||||
--danger-light: #fee2e2;
|
||||
--danger-dark: #dc2626;
|
||||
--info: #3b82f6;
|
||||
--info-light: #dbeafe;
|
||||
--info-dark: #2563eb;
|
||||
|
||||
/* 中性色 */
|
||||
--app-bg: #f8fafc;
|
||||
--panel-bg: #ffffff;
|
||||
--primary: #3b82f6;
|
||||
--primary-hover: #2563eb;
|
||||
--secondary: #64748b;
|
||||
--success: #10b981;
|
||||
--warning: #f59e0b;
|
||||
--danger: #ef4444;
|
||||
--text: #1e293b;
|
||||
--text-secondary: #64748b;
|
||||
--text-muted: #94a3b8;
|
||||
--border: #e2e8f0;
|
||||
--shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
|
||||
--shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
|
||||
--radius: 8px;
|
||||
--transition: all 0.2s ease;
|
||||
--border-light: #f1f5f9;
|
||||
--border-hover: #cbd5e1;
|
||||
|
||||
/* 阴影 */
|
||||
--shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.03);
|
||||
--shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.06), 0 1px 2px -1px rgba(0, 0, 0, 0.06);
|
||||
--shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.08);
|
||||
--shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.08);
|
||||
--shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
|
||||
--shadow-xl: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
|
||||
--shadow-primary: 0 4px 14px rgba(13, 148, 136, 0.35);
|
||||
--shadow-success: 0 4px 14px rgba(16, 185, 129, 0.35);
|
||||
--shadow-warning: 0 4px 14px rgba(245, 158, 11, 0.35);
|
||||
--shadow-danger: 0 4px 14px rgba(239, 68, 68, 0.35);
|
||||
|
||||
/* 圆角 */
|
||||
--radius-xs: 4px;
|
||||
--radius-sm: 8px;
|
||||
--radius: 12px;
|
||||
--radius-md: 16px;
|
||||
--radius-lg: 20px;
|
||||
--radius-xl: 24px;
|
||||
--radius-full: 9999px;
|
||||
|
||||
/* 过渡 */
|
||||
--transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
|
||||
--transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
|
||||
--transition-slow: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
||||
--transition-bounce: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
|
||||
}
|
||||
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
html {
|
||||
scroll-behavior: smooth;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
|
||||
font-family: "Inter", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
|
||||
background: var(--app-bg);
|
||||
color: var(--text);
|
||||
line-height: 1.5;
|
||||
line-height: 1.6;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
/* 页面容器 */
|
||||
.page {
|
||||
padding: 24px;
|
||||
max-width: 1400px;
|
||||
max-width: 1440px;
|
||||
margin: 0 auto;
|
||||
animation: pageEnter 0.5s cubic-bezier(0.4, 0, 0.2, 1);
|
||||
}
|
||||
|
||||
.panel {
|
||||
background: var(--panel-bg);
|
||||
border-radius: var(--radius);
|
||||
padding: 24px;
|
||||
box-shadow: var(--shadow);
|
||||
margin-bottom: 24px;
|
||||
@keyframes pageEnter {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(20px) scale(0.98);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0) scale(1);
|
||||
}
|
||||
}
|
||||
|
||||
/* 通用动画 */
|
||||
@keyframes fadeIn {
|
||||
from { opacity: 0; }
|
||||
to { opacity: 1; }
|
||||
}
|
||||
|
||||
@keyframes fadeInUp {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(20px);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes fadeInDown {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(-20px);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes fadeInLeft {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateX(-20px);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateX(0);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes fadeInRight {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateX(20px);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateX(0);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes scaleIn {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: scale(0.9);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: scale(1);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes slideUp {
|
||||
from { transform: translateY(100%); }
|
||||
to { transform: translateY(0); }
|
||||
}
|
||||
|
||||
@keyframes slideDown {
|
||||
from { transform: translateY(-100%); }
|
||||
to { transform: translateY(0); }
|
||||
}
|
||||
|
||||
@keyframes bounce {
|
||||
0%, 100% { transform: translateY(0); }
|
||||
50% { transform: translateY(-10px); }
|
||||
}
|
||||
|
||||
@keyframes pulse {
|
||||
0%, 100% {
|
||||
opacity: 1;
|
||||
transform: scale(1);
|
||||
}
|
||||
50% {
|
||||
opacity: 0.7;
|
||||
transform: scale(1.05);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
from { transform: rotate(0deg); }
|
||||
to { transform: rotate(360deg); }
|
||||
}
|
||||
|
||||
@keyframes shimmer {
|
||||
0% { background-position: -200% 0; }
|
||||
100% { background-position: 200% 0; }
|
||||
}
|
||||
|
||||
@keyframes float {
|
||||
0%, 100% { transform: translateY(0px); }
|
||||
50% { transform: translateY(-10px); }
|
||||
}
|
||||
|
||||
@keyframes ripple {
|
||||
0% {
|
||||
transform: scale(0);
|
||||
opacity: 1;
|
||||
}
|
||||
100% {
|
||||
transform: scale(4);
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* 动画工具类 */
|
||||
.animate-fade-in { animation: fadeIn 0.3s ease-out; }
|
||||
.animate-fade-in-up { animation: fadeInUp 0.4s ease-out; }
|
||||
.animate-fade-in-down { animation: fadeInDown 0.4s ease-out; }
|
||||
.animate-fade-in-left { animation: fadeInLeft 0.4s ease-out; }
|
||||
.animate-fade-in-right { animation: fadeInRight 0.4s ease-out; }
|
||||
.animate-scale-in { animation: scaleIn 0.3s ease-out; }
|
||||
.animate-bounce { animation: bounce 2s infinite; }
|
||||
.animate-pulse { animation: pulse 2s infinite; }
|
||||
.animate-spin { animation: spin 1s linear infinite; }
|
||||
.animate-float { animation: float 3s ease-in-out infinite; }
|
||||
|
||||
/* 延迟类 */
|
||||
.delay-100 { animation-delay: 0.1s; }
|
||||
.delay-200 { animation-delay: 0.2s; }
|
||||
.delay-300 { animation-delay: 0.3s; }
|
||||
.delay-400 { animation-delay: 0.4s; }
|
||||
.delay-500 { animation-delay: 0.5s; }
|
||||
|
||||
/* 悬停效果 */
|
||||
.hover-lift {
|
||||
transition: var(--transition);
|
||||
}
|
||||
|
||||
.panel:hover {
|
||||
box-shadow: var(--shadow-lg);
|
||||
.hover-lift:hover {
|
||||
transform: translateY(-4px);
|
||||
box-shadow: var(--shadow-md);
|
||||
}
|
||||
|
||||
.page-title {
|
||||
font-size: 24px;
|
||||
font-weight: 600;
|
||||
margin: 0 0 24px;
|
||||
color: var(--text);
|
||||
.hover-scale {
|
||||
transition: var(--transition);
|
||||
}
|
||||
|
||||
.hover-scale:hover {
|
||||
transform: scale(1.02);
|
||||
}
|
||||
|
||||
.hover-glow {
|
||||
transition: var(--transition);
|
||||
}
|
||||
|
||||
.hover-glow:hover {
|
||||
box-shadow: 0 0 20px rgba(13, 148, 136, 0.3);
|
||||
}
|
||||
|
||||
/* 面板样式 */
|
||||
.panel {
|
||||
background: var(--panel-bg);
|
||||
border-radius: var(--radius-lg);
|
||||
padding: 28px;
|
||||
box-shadow: var(--shadow-sm);
|
||||
border: 1px solid var(--border-light);
|
||||
transition: var(--transition-slow);
|
||||
position: relative;
|
||||
padding-bottom: 12px;
|
||||
}
|
||||
|
||||
.page-title::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 50px;
|
||||
height: 3px;
|
||||
background: var(--primary);
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.inline-form {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 16px;
|
||||
align-items: center;
|
||||
margin-bottom: 20px;
|
||||
padding-bottom: 20px;
|
||||
border-bottom: 1px solid var(--border);
|
||||
}
|
||||
|
||||
.table-actions {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.t-table {
|
||||
border-radius: var(--radius);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.t-btn {
|
||||
border-radius: var(--radius) !important;
|
||||
transition: var(--transition) !important;
|
||||
.panel::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 1px;
|
||||
background: linear-gradient(90deg, transparent, rgba(255,255,255,0.8), transparent);
|
||||
}
|
||||
|
||||
.t-btn--variant-outline {
|
||||
border-color: var(--primary) !important;
|
||||
.panel:hover {
|
||||
box-shadow: var(--shadow-md);
|
||||
transform: translateY(-2px);
|
||||
border-color: var(--border-hover);
|
||||
}
|
||||
|
||||
/* 玻璃态面板 */
|
||||
.panel-glass {
|
||||
background: rgba(255, 255, 255, 0.8);
|
||||
backdrop-filter: blur(20px);
|
||||
border: 1px solid rgba(255, 255, 255, 0.3);
|
||||
}
|
||||
|
||||
/* 渐变面板 */
|
||||
.panel-gradient {
|
||||
background: linear-gradient(135deg, var(--panel-bg) 0%, var(--app-bg) 100%);
|
||||
}
|
||||
|
||||
/* 页面标题 */
|
||||
.page-title {
|
||||
font-size: 32px;
|
||||
font-weight: 800;
|
||||
margin: 0 0 12px;
|
||||
color: var(--text);
|
||||
background: linear-gradient(135deg, var(--text) 0%, var(--text-secondary) 100%);
|
||||
-webkit-background-clip: text;
|
||||
-webkit-text-fill-color: transparent;
|
||||
background-clip: text;
|
||||
letter-spacing: -0.5px;
|
||||
}
|
||||
|
||||
.page-subtitle {
|
||||
font-size: 15px;
|
||||
color: var(--text-secondary);
|
||||
margin: 0;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
/* TDesign 组件样式覆盖 */
|
||||
|
||||
/* 按钮样式优化 */
|
||||
.t-button--theme-primary {
|
||||
background: linear-gradient(135deg, var(--primary), var(--primary-light)) !important;
|
||||
border: none !important;
|
||||
box-shadow: var(--shadow-primary);
|
||||
font-weight: 600;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.t-button--theme-primary::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: -100%;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
|
||||
transition: left 0.5s;
|
||||
}
|
||||
|
||||
.t-button--theme-primary:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 8px 25px rgba(13, 148, 136, 0.45);
|
||||
}
|
||||
|
||||
.t-button--theme-primary:hover::before {
|
||||
left: 100%;
|
||||
}
|
||||
|
||||
.t-button--theme-primary:active {
|
||||
transform: translateY(0);
|
||||
}
|
||||
|
||||
.t-button--variant-outline {
|
||||
border: 2px solid var(--primary) !important;
|
||||
color: var(--primary) !important;
|
||||
background: transparent !important;
|
||||
font-weight: 600;
|
||||
transition: var(--transition);
|
||||
}
|
||||
|
||||
.t-btn--variant-outline:hover {
|
||||
background: var(--primary) !important;
|
||||
color: white !important;
|
||||
.t-button--variant-outline:hover {
|
||||
background: rgba(13, 148, 136, 0.08) !important;
|
||||
border-color: var(--primary-dark) !important;
|
||||
color: var(--primary-dark) !important;
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
.t-btn--theme-primary {
|
||||
background: var(--primary) !important;
|
||||
border-color: var(--primary) !important;
|
||||
.t-button--variant-text {
|
||||
font-weight: 500;
|
||||
transition: var(--transition);
|
||||
}
|
||||
|
||||
.t-btn--theme-primary:hover {
|
||||
background: var(--primary-hover) !important;
|
||||
border-color: var(--primary-hover) !important;
|
||||
.t-button--variant-text:hover {
|
||||
background: rgba(13, 148, 136, 0.08) !important;
|
||||
}
|
||||
|
||||
/* 输入框样式 */
|
||||
.t-input {
|
||||
border-radius: var(--radius-sm);
|
||||
transition: var(--transition);
|
||||
border: 2px solid var(--border);
|
||||
}
|
||||
|
||||
.t-input:hover {
|
||||
border-color: var(--border-hover);
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
|
||||
}
|
||||
|
||||
.t-input:focus {
|
||||
border-color: var(--primary);
|
||||
box-shadow: 0 0 0 4px rgba(13, 148, 136, 0.1);
|
||||
}
|
||||
|
||||
.t-input__inner {
|
||||
font-size: 15px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.t-input__prefix-icon {
|
||||
color: var(--text-muted);
|
||||
transition: var(--transition);
|
||||
}
|
||||
|
||||
.t-input:focus-within .t-input__prefix-icon {
|
||||
color: var(--primary);
|
||||
}
|
||||
|
||||
/* 表格样式 */
|
||||
.t-table {
|
||||
border-radius: var(--radius);
|
||||
overflow: hidden;
|
||||
border: 1px solid var(--border-light);
|
||||
}
|
||||
|
||||
.t-table__header {
|
||||
background: linear-gradient(135deg, #f8fafc, #f1f5f9);
|
||||
}
|
||||
|
||||
.t-table__th-cell {
|
||||
font-weight: 700;
|
||||
color: var(--text);
|
||||
padding: 18px 16px;
|
||||
font-size: 13px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.5px;
|
||||
}
|
||||
|
||||
.t-table__row {
|
||||
transition: var(--transition);
|
||||
}
|
||||
|
||||
.t-table__row:hover {
|
||||
background: rgba(13, 148, 136, 0.04);
|
||||
}
|
||||
|
||||
.t-table__td {
|
||||
padding: 16px;
|
||||
font-size: 14px;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.t-table--striped .t-table__row:nth-child(even) {
|
||||
background: rgba(248, 250, 252, 0.5);
|
||||
}
|
||||
|
||||
.t-table--striped .t-table__row:nth-child(even):hover {
|
||||
background: rgba(13, 148, 136, 0.05);
|
||||
}
|
||||
|
||||
/* 标签样式 */
|
||||
.t-tag {
|
||||
border-radius: 20px !important;
|
||||
border-radius: var(--radius-full) !important;
|
||||
padding: 4px 12px !important;
|
||||
font-size: 12px !important;
|
||||
font-weight: 500 !important;
|
||||
border: none !important;
|
||||
}
|
||||
|
||||
/* 卡片样式 */
|
||||
.t-card {
|
||||
border-radius: var(--radius) !important;
|
||||
box-shadow: var(--shadow-sm) !important;
|
||||
border: 1px solid var(--border-light) !important;
|
||||
transition: var(--transition);
|
||||
}
|
||||
|
||||
.t-card:hover {
|
||||
box-shadow: var(--shadow) !important;
|
||||
}
|
||||
|
||||
.t-form__controls {
|
||||
margin-top: 10px !important;
|
||||
/* 表单样式 */
|
||||
.t-form__item {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.t-form__label {
|
||||
font-weight: 500;
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
/* 对话框样式 */
|
||||
.t-dialog {
|
||||
border-radius: var(--radius-lg) !important;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.t-dialog__header {
|
||||
padding: 24px 24px 16px !important;
|
||||
border-bottom: 1px solid var(--border-light);
|
||||
}
|
||||
|
||||
.t-dialog__body {
|
||||
@@ -134,41 +495,119 @@ body {
|
||||
|
||||
.t-dialog__footer {
|
||||
padding: 16px 24px 24px !important;
|
||||
border-top: 1px solid var(--border-light);
|
||||
}
|
||||
|
||||
.form-section-title {
|
||||
font-size: 16px;
|
||||
/* 菜单样式 */
|
||||
.t-menu {
|
||||
border-radius: var(--radius);
|
||||
}
|
||||
|
||||
.t-menu__item {
|
||||
border-radius: var(--radius-sm);
|
||||
margin: 4px 8px;
|
||||
transition: var(--transition);
|
||||
}
|
||||
|
||||
.t-menu__item.t-is-active {
|
||||
background: linear-gradient(135deg, rgba(13, 148, 136, 0.1), rgba(20, 184, 166, 0.1));
|
||||
color: var(--primary);
|
||||
font-weight: 600;
|
||||
color: var(--text);
|
||||
margin: 24px 0 16px;
|
||||
padding-left: 12px;
|
||||
border-left: 4px solid var(--primary);
|
||||
}
|
||||
|
||||
/* 分页样式 */
|
||||
.t-pagination {
|
||||
padding: 16px 0;
|
||||
}
|
||||
|
||||
.t-pagination__number.t-is-current {
|
||||
background: linear-gradient(135deg, var(--primary), var(--primary-light)) !important;
|
||||
border-color: transparent !important;
|
||||
}
|
||||
|
||||
/* 状态徽章 */
|
||||
.status-badge {
|
||||
display: inline-block;
|
||||
padding: 4px 12px;
|
||||
border-radius: 20px;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
padding: 6px 14px;
|
||||
border-radius: var(--radius-full);
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.status-badge::before {
|
||||
content: '';
|
||||
width: 6px;
|
||||
height: 6px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.status-pending {
|
||||
background: #fef3c7;
|
||||
color: #d97706;
|
||||
background: var(--warning-light);
|
||||
color: #b45309;
|
||||
}
|
||||
|
||||
.status-active {
|
||||
background: #d1fae5;
|
||||
color: #059669;
|
||||
.status-pending::before { background: var(--warning); }
|
||||
|
||||
.status-active,
|
||||
.status-processing {
|
||||
background: var(--info-light);
|
||||
color: #1d4ed8;
|
||||
}
|
||||
|
||||
.status-completed {
|
||||
background: #dbeafe;
|
||||
color: #2563eb;
|
||||
.status-active::before,
|
||||
.status-processing::before { background: var(--info); }
|
||||
|
||||
.status-completed,
|
||||
.status-success {
|
||||
background: var(--success-light);
|
||||
color: #047857;
|
||||
}
|
||||
|
||||
.status-cancelled {
|
||||
background: #fee2e2;
|
||||
color: #dc2626;
|
||||
.status-completed::before,
|
||||
.status-success::before { background: var(--success); }
|
||||
|
||||
.status-cancelled,
|
||||
.status-error {
|
||||
background: var(--danger-light);
|
||||
color: #b91c1c;
|
||||
}
|
||||
|
||||
.status-cancelled::before,
|
||||
.status-error::before { background: var(--danger); }
|
||||
|
||||
/* 滚动条样式 */
|
||||
::-webkit-scrollbar {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-track {
|
||||
background: var(--border-light);
|
||||
border-radius: var(--radius-full);
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb {
|
||||
background: var(--text-muted);
|
||||
border-radius: var(--radius-full);
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb:hover {
|
||||
background: var(--text-secondary);
|
||||
}
|
||||
|
||||
/* 响应式调整 */
|
||||
@media (max-width: 768px) {
|
||||
.page {
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.page-title {
|
||||
font-size: 22px;
|
||||
}
|
||||
|
||||
.panel {
|
||||
padding: 16px;
|
||||
}
|
||||
}
|
||||
|
||||
98
frontend/src/styles/theme.css
Normal file
98
frontend/src/styles/theme.css
Normal file
@@ -0,0 +1,98 @@
|
||||
/* Pet Hospital Theme Variables */
|
||||
:root {
|
||||
/* Primary Brand Colors */
|
||||
--brand-primary: #4361ee;
|
||||
--brand-secondary: #3f37c9;
|
||||
--brand-accent: #4cc9f0;
|
||||
|
||||
/* Status Colors */
|
||||
--status-success: #4ade80;
|
||||
--status-warning: #facc15;
|
||||
--status-error: #f87171;
|
||||
--status-info: #60a5fa;
|
||||
|
||||
/* Neutral Palette */
|
||||
--neutral-50: #f8fafc;
|
||||
--neutral-100: #f1f5f9;
|
||||
--neutral-200: #e2e8f0;
|
||||
--neutral-300: #cbd5e1;
|
||||
--neutral-400: #94a3b8;
|
||||
--neutral-500: #64748b;
|
||||
--neutral-600: #475569;
|
||||
--neutral-700: #334155;
|
||||
--neutral-800: #1e293b;
|
||||
--neutral-900: #0f172a;
|
||||
|
||||
/* Backgrounds */
|
||||
--bg-app: var(--neutral-50);
|
||||
--bg-panel: #ffffff;
|
||||
--bg-hover: var(--neutral-100);
|
||||
|
||||
/* Text */
|
||||
--text-primary: var(--neutral-800);
|
||||
--text-secondary: var(--neutral-600);
|
||||
--text-muted: var(--neutral-500);
|
||||
--text-inverse: #ffffff;
|
||||
|
||||
/* Borders */
|
||||
--border-default: var(--neutral-200);
|
||||
--border-subtle: var(--neutral-300);
|
||||
|
||||
/* Shadows */
|
||||
--shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
|
||||
--shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
|
||||
--shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
|
||||
--shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
|
||||
--shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
|
||||
|
||||
/* Radius */
|
||||
--radius-xs: 4px;
|
||||
--radius-sm: 6px;
|
||||
--radius: 8px;
|
||||
--radius-lg: 12px;
|
||||
--radius-xl: 16px;
|
||||
--radius-full: 9999px;
|
||||
|
||||
/* Transitions */
|
||||
--transition-fast: all 0.15s ease;
|
||||
--transition: all 0.2s ease;
|
||||
--transition-slow: all 0.3s ease;
|
||||
|
||||
/* Spacing */
|
||||
--space-xxs: 4px;
|
||||
--space-xs: 8px;
|
||||
--space-sm: 12px;
|
||||
--space: 16px;
|
||||
--space-md: 20px;
|
||||
--space-lg: 24px;
|
||||
--space-xl: 32px;
|
||||
--space-xxl: 40px;
|
||||
|
||||
/* Typography */
|
||||
--font-size-xs: 12px;
|
||||
--font-size-sm: 14px;
|
||||
--font-size: 16px;
|
||||
--font-size-lg: 18px;
|
||||
--font-size-xl: 20px;
|
||||
--font-size-xxl: 24px;
|
||||
--font-size-xxxl: 32px;
|
||||
|
||||
--font-weight-normal: 400;
|
||||
--font-weight-medium: 500;
|
||||
--font-weight-semibold: 600;
|
||||
--font-weight-bold: 700;
|
||||
}
|
||||
|
||||
/* Dark mode support (optional) */
|
||||
@media (prefers-color-scheme: dark) {
|
||||
:root {
|
||||
--bg-app: var(--neutral-900);
|
||||
--bg-panel: var(--neutral-800);
|
||||
--bg-hover: var(--neutral-700);
|
||||
--text-primary: var(--neutral-100);
|
||||
--text-secondary: var(--neutral-300);
|
||||
--text-muted: var(--neutral-400);
|
||||
--border-default: var(--neutral-700);
|
||||
--border-subtle: var(--neutral-600);
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@ export default defineConfig({
|
||||
port: 5173,
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: 'http://localhost:8081',
|
||||
target: 'http://localhost:8080',
|
||||
changeOrigin: true,
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user