Files
SaaS2/src/pages/index.tsx.bak
2025-06-05 23:05:33 +08:00

561 lines
19 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* 毛玻璃风格私域管理系统首页
* @author 阿瑞
* @description 展示现代简约毛玻璃质感UI效果和系统概览的首页
* @version 3.0.0
* @created 2024-12-19
* @updated 重新设计的现代化UI布局
*/
import React from 'react';
import {
Layout,
Typography,
Button,
Card,
Space,
Row,
Col,
Avatar,
Statistic,
Badge,
Tag,
Divider,
FloatButton,
App,
} from 'antd';
import {
RocketOutlined,
ApiOutlined,
BulbOutlined,
TeamOutlined,
ThunderboltOutlined,
QuestionCircleOutlined,
SecurityScanOutlined,
ArrowRightOutlined,
PlayCircleOutlined,
CheckCircleOutlined,
GlobalOutlined,
SafetyOutlined,
LineChartOutlined,
} from '@ant-design/icons';
import { useTheme } from '../hooks/useTheme'; // 关键代码行注释使用独立的useTheme Hook
import { MdDarkMode, MdLightMode } from "react-icons/md";
const { Header, Content, Footer } = Layout;
const { Title, Paragraph, Text } = Typography;
// 模块级注释:特性数据接口
interface FeatureType {
title: string;
description: string;
icon: React.ReactNode;
color: string;
}
// 模块级注释:核心特性数据
const coreFeatures = [
{
title: '智能多租户架构',
description: '企业级数据隔离,确保每个团队的数据安全独立,支持灵活的权限管理和资源分配',
icon: <SecurityScanOutlined />,
},
{
title: '实时数据洞察',
description: '强大的数据分析引擎,提供实时业务指标监控,智能预警和趋势分析',
icon: <LineChartOutlined />,
},
{
title: '无缝团队协作',
description: '集成化协作平台,支持实时消息、任务管理、文档共享和视频会议',
icon: <TeamOutlined />,
},
{
title: '企业级安全',
description: 'SOC2认证的安全架构端到端加密支持SSO和多因素认证',
icon: <SafetyOutlined />,
}
];
// 模块级注释:统计数据
const statsData = [
{
title: '全球企业用户',
value: 50000,
suffix: '+',
prefix: '',
icon: <GlobalOutlined />,
color: '#667eea',
growth: '+127%',
},
{
title: '月活跃团队',
value: 12543,
suffix: '',
prefix: '',
icon: <TeamOutlined />,
color: '#f093fb',
growth: '+23.6%',
},
{
title: 'API调用次数',
value: 98.7,
suffix: 'M',
prefix: '',
icon: <ApiOutlined />,
color: '#4facfe',
growth: '+45.2%',
},
{
title: '系统可用性',
value: 99.9,
suffix: '%',
prefix: '',
icon: <CheckCircleOutlined />,
color: '#06d7b2',
growth: '99.9%',
}
];
// 模块级注释:技术栈特性数据
const techFeatures: FeatureType[] = [
{
title: 'React 19',
description: '使用最新的 React 19 特性构建现代化应用',
icon: <RocketOutlined />,
color: '#2d7ff9',
},
{
title: 'Next.js 15',
description: '基于 Next.js 15 的强大全栈框架',
icon: <ApiOutlined />,
color: '#06d7b2',
},
{
title: 'Ant Design 5',
description: '使用 Ant Design 5.x 构建优雅的用户界面',
icon: <BulbOutlined />,
color: '#ff9640',
},
{
title: 'TypeScript',
description: '完整的 TypeScript 支持,提供类型安全',
icon: <ThunderboltOutlined />,
color: '#8e6bff',
},
];
export default function HomePage(): React.ReactElement {
// 关键代码行注释:状态管理 - 使用_app.tsx的useTheme Hook确保mounted状态
const { isDark, toggleTheme, mounted } = useTheme(); // 关键代码行注释:解构获取所需的状态
const { message, notification, modal } = App.useApp();
// 关键代码行注释:如果还未挂载,显示加载状态避免闪烁
if (!mounted) {
return <div style={{ height: '100vh', background: '#f6f9fc' }} />;
}
// 模块级注释:事件处理函数
const handleStartClick = (): void => {
message.success('欢迎使用现代化私域管理系统!');
};
const handleLearnMoreClick = (): void => {
notification.info({
message: '了解更多',
description: '感谢您对我们平台的关注。更多功能正在开发中,敬请期待!',
placement: 'topRight',
});
};
const handleHelpClick = (): void => {
modal.info({
title: '帮助中心',
content: (
<div>
<p>使</p>
<p></p>
<p>support@example.com</p>
</div>
),
});
};
return (
<Layout className="modern-layout">
{/* 模块级注释:现代化顶部导航栏 */}
<Header className="modern-header">
<div className="header-container">
{/* 左侧品牌区域 */}
<div className="brand-section">
<div className="brand-logo">
<div className="logo-icon"></div>
<div className="logo-text">
<Title level={4} className="brand-title">SaaS管理平台</Title>
<Text className="brand-subtitle">Enterprise Edition</Text>
</div>
</div>
</div>
{/* 中间导航菜单 */}
<nav className="nav-menu">
<a href="#features" className="nav-item"></a>
<a href="#pricing" className="nav-item"></a>
<a href="#docs" className="nav-item"></a>
<a href="#components" className="nav-item"></a>
<a href="#about" className="nav-item"></a>
</nav>
{/* 右侧操作区域 */}
<div className="header-actions">
{/* 切换主题 使用react-icons*/}
<Button
type="text"
shape="round"
onClick={toggleTheme}
icon={isDark ? <MdLightMode /> : <MdDarkMode />}
className="theme-switch"
/>
<Button type="text" className="login-btn">
</Button>
<Button type="primary" className="signup-btn">
</Button>
</div>
</div>
</Header>
{/* 模块级注释:现代化主要内容区域 */}
<Content className="modern-content">
{/* 模块级注释:重新设计的英雄区域 */}
<section className="hero-section-modern">
<div className="hero-background">
<div className="hero-decoration hero-decoration-1"></div>
<div className="hero-decoration hero-decoration-2"></div>
<div className="hero-decoration hero-decoration-3"></div>
</div>
<div className="hero-container">
<div className="hero-content-modern">
<div className="hero-badge">
<Badge count="NEW" className="version-badge" />
<Text className="version-text">Version 3.0 </Text>
</div>
<Title level={1} className="hero-title-modern">
<span className="title-line"></span>
<span className="title-line title-gradient"></span>
</Title>
<Paragraph className="hero-description-modern">
SaaS管理平台
<br />
</Paragraph>
<div className="hero-buttons-modern">
<Button
type="primary"
size="large"
onClick={handleStartClick}
className="primary-cta-btn"
icon={<RocketOutlined />}
>
</Button>
<Button
size="large"
onClick={handleLearnMoreClick}
className="secondary-cta-btn"
icon={<PlayCircleOutlined />}
>
</Button>
</div>
<div className="hero-stats">
<div className="stat-item">
<Text className="stat-number">50K+</Text>
<Text className="stat-label"></Text>
</div>
<div className="stat-divider"></div>
<div className="stat-item">
<Text className="stat-number">99.9%</Text>
<Text className="stat-label"></Text>
</div>
<div className="stat-divider"></div>
<div className="stat-item">
<Text className="stat-number">24/7</Text>
<Text className="stat-label"></Text>
</div>
</div>
</div>
<div className="hero-visual">
<div className="dashboard-mockup">
<div className="mockup-header">
<div className="mockup-controls">
<span className="control-dot red"></span>
<span className="control-dot yellow"></span>
<span className="control-dot green"></span>
</div>
<Text className="mockup-title">SaaS Dashboard</Text>
</div>
<div className="mockup-content">
<div className="mockup-sidebar">
<div className="sidebar-item active"></div>
<div className="sidebar-item"></div>
<div className="sidebar-item"></div>
<div className="sidebar-item"></div>
</div>
<div className="mockup-main">
<div className="chart-container">
<div className="chart-bars">
<div className="chart-bar" style={{ height: '60%' }}></div>
<div className="chart-bar" style={{ height: '80%' }}></div>
<div className="chart-bar" style={{ height: '45%' }}></div>
<div className="chart-bar" style={{ height: '70%' }}></div>
<div className="chart-bar" style={{ height: '90%' }}></div>
</div>
</div>
<div className="metrics-grid">
<div className="metric-card"></div>
<div className="metric-card"></div>
<div className="metric-card"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
{/* 模块级注释:核心功能展示区域 */}
<section className="features-section-modern">
<div className="section-container">
<div className="section-header">
<Title level={2} className="section-title">
</Title>
<Paragraph className="section-description">
</Paragraph>
</div>
<Row gutter={[32, 32]} className="features-grid">
{coreFeatures.map((feature, index) => (
<Col xs={24} md={12} lg={6} key={index}>
<Card className="feature-card-modern" hoverable>
<div className="feature-content">
<div className={`feature-icon-modern gradient-${index + 1}`}>
{feature.icon}
</div>
<Title level={4} className="feature-title-modern">
{feature.title}
</Title>
<Paragraph className="feature-description-modern">
{feature.description}
</Paragraph>
<div className="feature-action">
<Button type="link" icon={<ArrowRightOutlined />}>
</Button>
</div>
</div>
</Card>
</Col>
))}
</Row>
</div>
</section>
{/* 模块级注释:数据统计展示区域 */}
<section className="stats-section-modern">
<div className="section-container">
<div className="stats-header">
<Title level={2} className="stats-title">
</Title>
<Paragraph className="stats-description">
</Paragraph>
</div>
<Row gutter={[24, 24]} className="stats-grid">
{statsData.map((stat, index) => (
<Col xs={24} sm={12} lg={6} key={index}>
<Card className="stat-card-modern">
<div className="stat-content">
<div className="stat-icon" style={{ color: stat.color }}>
{stat.icon}
</div>
<div className="stat-info">
<Statistic
value={stat.value}
suffix={stat.suffix}
prefix={stat.prefix}
className="stat-number"
/>
<Text className="stat-title">{stat.title}</Text>
<Text className="stat-growth">{stat.growth}</Text>
</div>
</div>
</Card>
</Col>
))}
</Row>
</div>
</section>
{/* 模块级注释:技术栈展示区域 */}
<section className="tech-section-modern">
<div className="section-container">
<div className="tech-header">
<Title level={2} className="tech-title">
</Title>
<Paragraph className="tech-description">
</Paragraph>
</div>
<Row gutter={[24, 24]} className="tech-grid">
{techFeatures.map((tech, index) => (
<Col xs={24} sm={12} md={6} key={index}>
<Card className="tech-card-modern" hoverable>
<div className="tech-content">
<Avatar
size={64}
style={{ backgroundColor: tech.color }}
icon={tech.icon}
className="tech-avatar"
/>
<Title level={4} className="tech-name">
{tech.title}
</Title>
<Paragraph className="tech-desc">
{tech.description}
</Paragraph>
</div>
</Card>
</Col>
))}
</Row>
<div className="tech-tags">
<Title level={5}></Title>
<Space wrap size="middle" className="tags-container">
<Tag color="blue">React 19</Tag>
<Tag color="green">Next.js 15</Tag>
<Tag color="orange">Ant Design 5</Tag>
<Tag color="purple">TypeScript</Tag>
<Tag color="cyan">Tailwind CSS</Tag>
<Tag color="red">MongoDB</Tag>
<Tag color="geekblue">Mongoose 8.x</Tag>
<Tag color="volcano">pnpm</Tag>
</Space>
</div>
</div>
</section>
{/* 模块级注释CTA区域 */}
<section className="cta-section-modern">
<div className="section-container">
<Card className="cta-card">
<div className="cta-content">
<Title level={2} className="cta-title">
</Title>
<Paragraph className="cta-description">
30SaaS管理平台的强大功能
</Paragraph>
<Space size="large" className="cta-buttons">
<Button
type="primary"
size="large"
icon={<RocketOutlined />}
className="cta-primary-btn"
>
</Button>
<Button
size="large"
icon={<QuestionCircleOutlined />}
className="cta-secondary-btn"
>
</Button>
</Space>
</div>
</Card>
</div>
</section>
</Content>
{/* 模块级注释:现代化页脚 */}
<Footer className="modern-footer">
<div className="footer-container">
<div className="footer-content">
<div className="footer-brand">
<div className="footer-logo">
<div className="logo-icon"></div>
<Title level={4} className="footer-brand-title">SaaS管理平台</Title>
</div>
<Paragraph className="footer-brand-desc">
</Paragraph>
</div>
<div className="footer-links">
<div className="link-group">
<Title level={5}></Title>
<a href="#features"></a>
<a href="#pricing"></a>
<a href="#security"></a>
</div>
<div className="link-group">
<Title level={5}></Title>
<a href="#docs">API文档</a>
<a href="#sdk">SDK下载</a>
<a href="#github">GitHub</a>
</div>
<div className="link-group">
<Title level={5}></Title>
<a href="#help"></a>
<a href="#contact"></a>
<a href="#status"></a>
</div>
</div>
</div>
<Divider />
<div className="footer-bottom">
<Text className="copyright">
© 2024 SaaS管理平台. All rights reserved.
</Text>
<Space split={<Divider type="vertical" />}>
<a href="#privacy"></a>
<a href="#terms"></a>
<a href="#cookies">Cookie政策</a>
</Space>
</div>
</div>
</Footer>
{/* 模块级注释:浮动操作按钮 */}
<FloatButton.Group>
<FloatButton
icon={<QuestionCircleOutlined />}
tooltip="帮助中心"
onClick={handleHelpClick}
/>
<FloatButton.BackTop tooltip="回到顶部" />
</FloatButton.Group>
</Layout>
);
}