import React, { useEffect, useRef, useState } from 'react'; import Autoplay from 'embla-carousel-autoplay'; import { Carousel, CarouselApi, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, } from '@repo/ui/components/carousel'; import CarouselComponent from './CarouselComponent'; const LbbzPage: React.FC = () => { // const plugin = useRef(Autoplay({ delay: 1000, stopOnInteraction: true })); // const [currentIndex, setCurrentIndex] = useState(0); // const [carouselAPI, setCarouselAPI] = useState(null); // 模拟舆情数据 const mockYuqingData = [ { id: 1, title: '开源舆情2025第2期', date: '20250113' }, { id: 2, title: '开源舆情2025第1期', date: '20250107' }, { id: 3, title: '开源舆情2024第52期', date: '20241220' }, { id: 4, title: '开源舆情2024第51期', date: '20241211' }, { id: 5, title: '开源舆情2024第50期', date: '20241127' }, { id: 6, title: '开源舆情2024第49期', date: '20241116' }, { id: 7, title: '开源舆情2024第48期', date: '20241020' }, { id: 8, title: '开源舆情2024第47期', date: '20241016' }, { id: 9, title: '开源舆情2025第2期', date: '20250113' }, { id: 10, title: '开源舆情2025第1期', date: '20250107' }, { id: 11, title: '开源舆情2024第52期', date: '20241220' }, { id: 12, title: '开源舆情2024第51期', date: '20241211' }, { id: 13, title: '开源舆情2024第50期', date: '20241127' }, { id: 14, title: '开源舆情2024第49期', date: '20241116' }, { id: 15, title: '开源舆情2024第48期', date: '20241020' }, { id: 16, title: '开源舆情2024第47期', date: '20241016' }, ]; const carouselData1= [ { id: 1, image: '/header.png', title: '军事风云第一期', }, { id: 2, image: '/book1.png', title: '军事风云第二期 ', }, { id: 3, image: '/book2.png', title: '军事风云第三期', }, { id: 4, image: '/x1.png', title: '军事风云第三期', }, { id: 5, image: '/x2.png', title: '军事风云第三期', }, ]; // // 监听幻灯片变化 // useEffect(() => { // if (!carouselAPI) return; // const updateCurrentIndex = () => { // setCurrentIndex(carouselAPI.selectedScrollSnap()); // }; // carouselAPI.on('select', updateCurrentIndex); // return () => { // carouselAPI.off('select', updateCurrentIndex); // }; // }, [carouselAPI]); // 滚动到指定索引 // const scrollToIndex = (index: number) => { // if (carouselAPI) { // carouselAPI.scrollTo(index); // setCurrentIndex(index); // 更新当前索引 // } // }; // 将数据分成两列 const leftColumnData = mockYuqingData.slice(0, 8); const rightColumnData = mockYuqingData.slice(8, 16); return ( <>
{/* 上部容器 */}

练兵备战

{/* 下部容器 */}
{/* 上半部分 - 三个并排的容器 */}
军事风云
演训聚焦
1
开源舆情
{/* 下方新增的容器 */}
{/* 左侧 */}
{/* 环球IOS标题 */}
环球70S
{/* 中间 - */}
2024年40期

巴格多格拉空军基地

{/* 宣布亚空军基地 */}
2024年39期

宣布亚空军基地

{/* 右侧 - 形势战备 */}
{/* 形势战备标题 */}
形势战备
{/* 右侧卡片区域 */}
{/* 形势战备教育2024年第13期 */}
2024年第13期

形势战备教育2024年第13期

{/* 形势战备教育2024年第12期 */}
2024年第12期

形势战备教育2024年第12期

{/* 舆情区域 - 两列布局 */}
{/* 左列 */}
{leftColumnData.map((item) => (
{/* 左侧钻石图标和标题 */}

{item.title}

{/* 右侧日期 */} {item.date}
))}
{/* 右列 */}
{rightColumnData.map((item) => (
{/* 左侧钻石图标和标题 */}

{item.title}

{/* 右侧日期 */} {item.date}
))}
); }; export default LbbzPage;