修改轮播图问题

This commit is contained in:
Li1304553726 2025-11-20 17:51:52 +08:00
parent 68f962b66c
commit 1c5428434d
4 changed files with 21 additions and 19 deletions

View File

@ -69,7 +69,7 @@ export function FireNewsList() {
</div>
{/* 文章列表 */}
<div className="space-y-1 h-200 overflow-hidden hover:overflow-auto scroll-container">
<div className="space-y-5 h-200 overflow-hidden hover:overflow-auto scroll-container">
{articles.map((article, index) => (
<div key={index} className="flex items-center space-x-3 pb-1">
{/* 左侧竖线和日期 */}

View File

@ -16,8 +16,8 @@ export function ImportantNews() {
"/images/carousel-9.jpg",
];
// 转换为 slides 格式
const slides = carouselImages.map((imageUrl, index) => ({
// 转换为 slides 格式
const slides = carouselImages.map((imageUrl, index) => ({
key: `carousel-${index + 1}`,
content: (
<div
@ -31,19 +31,21 @@ export function ImportantNews() {
}));
return(
<div className="relative w-5/6 h-220 mx-auto overflow-hidden ">
{/* 轮播背景图 - 确保有明确尺寸 */}
<div className="absolute top-0 left-0 w-full h-full">
<CarouselDemo
paginationPosition="left"
paginationStyle="dot"
/>
</div>
<div className="relative w-5/6 mx-auto overflow-hidden">
{/* 轮播背景图 - 使用 aspect-ratio 或固定高度 */}
<div className="w-full relative" style={{ aspectRatio: '16/9' }}> {/* 或者设置固定高度 */}
<div className="absolute top-0 left-0 w-full h-full">
<CarouselDemo
paginationPosition="left"
paginationStyle="dot"
/>
</div>
{/* 固定的烽火要闻 */}
<div className="absolute top-0 right-0 w-1/3 h-220 p-1">
<FireNewsList />
{/* 固定的烽火要闻 */}
<div className="absolute top-0 right-0 w-1/3 h-full p-1">
<FireNewsList />
</div>
</div>
</div>
</div>
)
}

View File

@ -65,11 +65,11 @@ const LearnPage = () => {
{/* 顶部Logo区使用背景图片方式展示logo宽70高20 */}
<div className="w-70 h-20 bg-cover bg-no-repeat mb-5" style={{ backgroundImage: "url('images/learn.png')" }}></div>
<div className="flex flex-col lg:flex-row h-[740px]">
<div className="flex flex-col lg:flex-row">
{/* 左侧图片区占据屏幕3/5的宽度 */}
<div className="lg:w-3/5 overflow-hidden">
{/* 使用grid布局来安排图片的位置 */}
<div className="grid grid-cols-3 grid-rows-2 h-full w-full">
<div className="grid grid-cols-3 grid-rows-2 w-full">
{/* 上左第一张图 */}
<div className="row-span-1 col-span-1 shadow-sm overflow-hidden">
<img src="/images/carousel-1.jpg" alt="Image 1" className="w-full h-full object-cover" />

View File

@ -59,7 +59,7 @@ export function TopNav({
return (
// 将组件宽度调整为1514px并保持居中
<div className="h-full w-full mx-auto flex items-center px-8 bg-white border-t-16 border-b-16 border-[#1f79bf]">
<div className="h-full w-full mx-auto flex items-center px-8 bg-white border-t-16 border-b-16 border-[#176cad]">
{/* 搜索框与导航菜单组合 */}
<div className="flex items-center justify-start gap-35 ml-45 ">
{/* 导航菜单 */}