ym923 | 4558e9f | 2025-06-09 20:16:16 +0800 | [diff] [blame] | 1 | // src/pages/Home.jsx |
| 2 | import React, { useState, useEffect } from 'react'; |
| 3 | import { getActivityPreviews, getFullActivities } from '../api/activity'; |
| 4 | import Post from '../components/Post'; |
| 5 | import Navbar from '../components/Navbar'; // ✅ 导入导航栏组件 |
| 6 | import { AppstoreOutlined } from '@ant-design/icons'; |
| 7 | import { Row, Col, Card, Space } from 'antd'; |
| 8 | import './Home.css'; |
| 9 | |
| 10 | const Community = () => { |
| 11 | const [activityPreviews, setActivityPreviews] = useState([]); |
| 12 | const [fullActivities, setFullActivities] = useState([]); |
| 13 | const [selectedActivityId, setSelectedActivityId] = useState(null); |
| 14 | |
| 15 | useEffect(() => { |
| 16 | getActivityPreviews().then(res => setActivityPreviews(res.data)); |
| 17 | getFullActivities().then(res => setFullActivities(res.data)); |
| 18 | }, []); |
| 19 | |
| 20 | return ( |
| 21 | <div style={{ minHeight: '100vh', backgroundColor: '#f0f2f5' }}> |
| 22 | {/* 导航栏 */} |
| 23 | <Navbar /> |
| 24 | |
| 25 | {/* 内容区域 */} |
| 26 | <div style={{ padding: 24 }}> |
| 27 | {/* 帖子区域 */} |
| 28 | <Row justify="center"> |
| 29 | <Col |
| 30 | xs={24} |
| 31 | sm={24} |
| 32 | md={24} |
| 33 | lg={22} |
| 34 | xl={20} |
| 35 | xxl={18} |
| 36 | style={{ maxWidth: 1400, width: '100%' }} |
| 37 | > |
| 38 | <Card |
| 39 | title={<Space><AppstoreOutlined />最新帖子</Space>} |
| 40 | bordered={false} |
| 41 | bodyStyle={{ padding: 24 }} |
| 42 | style={{ boxShadow: '0 2px 8px rgba(0,0,0,0.15)', borderRadius: 8 }} |
| 43 | > |
| 44 | <Post /> |
| 45 | </Card> |
| 46 | </Col> |
| 47 | </Row> |
| 48 | </div> |
| 49 | </div> |
| 50 | ); |
| 51 | }; |
| 52 | |
| 53 | export default Community; |