import React, { useEffect, useState } from 'react'; import { Card, Row, Col, Tag, Button, Spin, Typography } from 'antd'; import { RocketOutlined, RightOutlined } from '@ant-design/icons'; import { useNavigate } from 'react-router-dom'; import { motion } from 'framer-motion'; import { getConfigs } from '../api'; import ActivityList from '../components/activity/ActivityList'; import './Home.css'; const { Title, Paragraph } = Typography; const Home = () => { const [products, setProducts] = useState([]); const [loading, setLoading] = useState(true); const [typedText, setTypedText] = useState(''); const [isTypingComplete, setIsTypingComplete] = useState(false); const fullText = "未来已来 AI 核心驱动"; const navigate = useNavigate(); useEffect(() => { fetchProducts(); let i = 0; const typingInterval = setInterval(() => { i++; setTypedText(fullText.slice(0, i)); if (i >= fullText.length) { clearInterval(typingInterval); setIsTypingComplete(true); } }, 150); return () => clearInterval(typingInterval); }, []); const fetchProducts = async () => { try { const response = await getConfigs(); setProducts(response.data); } catch (error) { console.error('Failed to fetch products:', error); } finally { setLoading(false); } }; const cardVariants = { hidden: { opacity: 0, y: 50 }, visible: (i) => ({ opacity: 1, y: 0, transition: { delay: i * 0.1, duration: 0.5, type: "spring", stiffness: 100 } }), hover: { scale: 1.05, rotateX: 5, rotateY: 5, transition: { duration: 0.3 } } }; if (loading) { return (