完善统计功能并优化前端界面

后端:
- 扩展 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:
wangziqi
2026-02-11 16:11:31 +08:00
parent f9bfb8556b
commit 77eb648b38
16 changed files with 4487 additions and 176 deletions

59
frontend/COLOR_UPDATE.md Normal file
View 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` (更稳重专业)

View File

@@ -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'),
};

View File

@@ -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

View File

@@ -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>

View 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>

View File

@@ -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;

View File

@@ -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;
}
}

View 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);
}
}

View File

@@ -7,7 +7,7 @@ export default defineConfig({
port: 5173,
proxy: {
'/api': {
target: 'http://localhost:8081',
target: 'http://localhost:8080',
changeOrigin: true,
},
},