将现有的管理后台UI从传统Ant Design白色主题升级为具有强烈科技感的现代化深色主题,采用"量子科技"设计理念。
/* 主色调 */
--primary-bg: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
--surface-bg: rgba(30, 27, 75, 0.8);
--card-bg: rgba(15, 23, 42, 0.6);
/* 强调色 */
--neon-purple: #8b5cf6;
--electric-cyan: #06b6d4;
--aurora-green: #10b981;
--warning-orange: #f59e0b;
--error-red: #ef4444;
/* 中性色 */
--text-primary: #f1f5f9;
--text-secondary: #cbd5e1;
--text-muted: #64748b;
--border-subtle: rgba(148, 163, 184, 0.1);
在Tailwind配置中添加科技感主题:
// tailwind.config.js
module.exports = {
theme: {
extend: {
colors: {
'tech-primary': '#0f172a',
'tech-surface': 'rgba(30, 27, 75, 0.8)',
'tech-accent': '#8b5cf6',
'tech-cyan': '#06b6d4',
'tech-green': '#10b981',
},
backgroundImage: {
'tech-gradient': 'linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%)',
'card-gradient': 'linear-gradient(145deg, rgba(15, 23, 42, 0.6), rgba(30, 27, 75, 0.4))',
},
animation: {
'pulse-glow': 'pulse-glow 2s ease-in-out infinite alternate',
'float': 'float 6s ease-in-out infinite',
}
}
}
}
创建科技感背景组件:
// src/client/admin/components/TechBackground.tsx
import React from 'react';
export const TechBackground: React.FC = () => {
return (
<div className="fixed inset-0 -z-10 overflow-hidden">
<div className="absolute inset-0 bg-gradient-to-br from-slate-900 via-purple-900 to-slate-900" />
<div className="absolute inset-0 bg-[url('data:image/svg+xml,%3Csvg width="60" height="60" viewBox="0 0 60 60" xmlns="http://www.w3.org/2000/svg"%3E%3Cg fill="none" fill-rule="evenodd"%3E%3Cg fill="%239C92AC" fill-opacity="0.1"%3E%3Cpath d="M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z"/%3E%3C/g%3E%3C/g%3E%3C/svg%3E')] opacity-20" />
<div className="absolute inset-0 bg-gradient-to-t from-slate-900/50 to-transparent" />
</div>
);
};
创建科技感Card组件:
// src/client/admin/components/TechCard.tsx
import React from 'react';
import { Card } from 'antd';
interface TechCardProps {
title: string;
value: string | number;
icon: React.ReactNode;
trend?: string;
color?: string;
}
export const TechCard: React.FC<TechCardProps> = ({ title, value, icon, trend, color = '#8b5cf6' }) => {
return (
<div className="relative group">
<div className="absolute inset-0 bg-gradient-to-r from-purple-600 to-cyan-600 rounded-xl blur-lg opacity-30 group-hover:opacity-50 transition-opacity" />
<Card className="relative bg-slate-800/80 backdrop-blur-sm border border-slate-700/50 rounded-xl hover:border-purple-500/50 transition-all duration-300">
<div className="flex items-center justify-between mb-4">
<div className="p-3 rounded-lg bg-slate-700/50">
{React.cloneElement(icon as React.ReactElement, { className: 'text-2xl', style: { color } })}
</div>
{trend && (
<span className="text-sm text-green-400">{trend}</span>
)}
</div>
<div className="text-3xl font-bold text-white mb-1">{value}</div>
<div className="text-sm text-slate-400">{title}</div>
</Card>
</div>
);
};
// src/client/admin/pages/TechDashboard.tsx
import React from 'react';
import { Row, Col } from 'antd';
import { UserOutlined, BellOutlined, EyeOutlined, TrendingUpOutlined } from '@ant-design/icons';
import { TechCard } from '../components/TechCard';
import { TechBackground } from '../components/TechBackground';
export const TechDashboard: React.FC = () => {
return (
<div className="min-h-screen relative">
<TechBackground />
<div className="relative z-10 px-6 py-8">
<div className="mb-8">
<h1 className="text-4xl font-bold text-white mb-2">量子控制台</h1>
<p className="text-slate-400">实时监控您的系统状态</p>
</div>
<Row gutter={[24, 24]}>
<Col xs={24} sm={12} lg={6}>
<TechCard
title="活跃用户"
value="112,893"
icon={<UserOutlined />}
trend="+12.5%"
color="#10b981"
/>
</Col>
<Col xs={24} sm={12} lg={6}>
<TechCard
title="系统消息"
value="93"
icon={<BellOutlined />}
trend="5 未读"
color="#f59e0b"
/>
</Col>
<Col xs={24} sm={12} lg={6}>
<TechCard
title="在线用户"
value="1,128"
icon={<EyeOutlined />}
trend="32.1%"
color="#06b6d4"
/>
</Col>
<Col xs={24} sm={12} lg={6}>
<TechCard
title="增长率"
value="+23.5%"
icon={<TrendingUpOutlined />}
trend="较上周"
color="#8b5cf6"
/>
</Col>
</Row>
{/* 数据图表区域 */}
<div className="mt-8 grid grid-cols-1 lg:grid-cols-2 gap-6">
<div className="bg-slate-800/80 backdrop-blur-sm border border-slate-700/50 rounded-xl p-6">
<h3 className="text-xl font-semibold text-white mb-4">用户活跃度</h3>
{/* 图表组件 */}
</div>
<div className="bg-slate-800/80 backdrop-blur-sm border border-slate-700/50 rounded-xl p-6">
<h3 className="text-xl font-semibold text-white mb-4">系统性能</h3>
{/* 图表组件 */}
</div>
</div>
</div>
</div>
);
};
// 主要变化包括深色主题、毛玻璃效果、发光边框
const TechLayout: React.FC = () => {
return (
<Layout className="min-h-screen bg-slate-900">
<Sider
className="bg-slate-800/90 backdrop-blur-sm border-r border-slate-700/50"
style={{
boxShadow: '0 0 20px rgba(139, 92, 246, 0.1)',
background: 'linear-gradient(180deg, rgba(15, 23, 42, 0.9), rgba(30, 27, 75, 0.8))'
}}
>
{/* 侧边栏内容 */}
</Sider>
<Layout className="bg-transparent">
<Header className="bg-slate-800/90 backdrop-blur-sm border-b border-slate-700/50">
{/* 顶部导航 */}
</Header>
<Content className="p-6">
<Outlet />
</Content>
</Layout>
</Layout>
);
};