import React, { useState, useEffect } from 'react'; import { motion } from 'framer-motion'; import { Button, Typography, Spin, Row, Col, Empty, Tag } from 'antd'; import { ReadOutlined, ClockCircleOutlined, UserOutlined, BookOutlined } from '@ant-design/icons'; import { getVBCourses } from '../api'; const { Title, Paragraph } = Typography; const VBCourses = () => { const [courses, setCourses] = useState([]); const [loading, setLoading] = useState(true); useEffect(() => { const fetchCourses = async () => { try { const res = await getVBCourses(); setCourses(res.data); } catch (error) { console.error("Failed to fetch VB Courses:", error); } finally { setLoading(false); } } fetchCourses(); }, []); if (loading) return
; return (
VB <span style={{ color: '#00f0ff' }}>CODING COURSES</span> 探索 Vibe Coding 软件与硬件课程,开启您的编程之旅。
{courses.length === 0 ? (
暂无课程内容} />
) : ( {courses.map((item, index) => (
{item.display_cover_image ? ( {item.title} ) : ( )}
{item.tag && ( {item.tag} )} {item.course_type_display || (item.course_type === 'hardware' ? '硬件课程' : '软件课程')}

{item.title}

{item.instructor} {item.duration} {item.lesson_count} 课时

{item.description}

))}
)} {/* 装饰性背景 */}
); }; export default VBCourses;