fix: 调整首页组件样式

- 统一相关组件样式,为后续功能开发做准备
This commit is contained in:
2025-09-08 15:46:47 +08:00
parent 031bf4a55e
commit e6165b68b4

View File

@ -6,32 +6,32 @@
<div class="carousel-item"> <div class="carousel-item">
<el-image class="carousel-image" :src="useStrapiMedia(item.url || '')" <el-image class="carousel-image" :src="useStrapiMedia(item.url || '')"
:alt="item.alternativeText || `Carousel Image ${index + 1}`" fit="contain" lazy /> :alt="item.alternativeText || `Carousel Image ${index + 1}`" fit="contain" lazy />
<p v-if="item.caption" class="caption">{{ item.caption }}</p> <p v-if="item.caption" class="carousel-image-caption">{{ item.caption }}</p>
</div> </div>
</el-carousel-item> </el-carousel-item>
</el-carousel> </el-carousel>
<section> <section>
<h2 style="font-size: 1.5rem; font-weight: bold; margin-bottom: 1rem;">推荐产品</h2> <h2>推荐产品</h2>
<p>探索我们的精选产品满足您的各种需求无论是创新技术还是经典设计我们都为您提供优质选择</p> <p>探索我们的精选产品满足您的各种需求无论是创新技术还是经典设计我们都为您提供优质选择</p>
<el-carousel class="production-carousel" height="auto" arrow="never" indicator-position="outside" <el-carousel class="recommend-carousel" height="auto" arrow="never" indicator-position="outside"
:autoplay="false"> :autoplay="false">
<el-carousel-item v-for="n in Math.floor(recommend_productions.length / 3) + 1" :key="n" <el-carousel-item v-for="n in Math.floor(recommend_productions.length / 3) + 1" :key="n"
class="production-list"> class="recommend-list">
<div class="block-group"> <div class="recommend-card-group">
<el-card v-for="(item, index) in recommend_productions.slice((n - 1) * 3, n * 3)" :key="index" <el-card v-for="(item, index) in recommend_productions.slice((n - 1) * 3, n * 3)" :key="index"
class="block production-card" @click="handleProductionCardClick(item.documentId || '')"> class="recommend-card" @click="handleProductionCardClick(item.documentId || '')">
<template #header> <template #header>
<el-image :src="useStrapiMedia(item.cover?.url || '')" <el-image :src="useStrapiMedia(item.cover?.url || '')"
:alt="item.cover?.alternativeText || item.title" fit="cover" :alt="item.cover?.alternativeText || item.title" fit="cover"
style="width: 100%; height: 200px; border-radius: 8px;" lazy /> style="width: 100%; height: 200px; border-radius: 8px;" lazy />
</template> </template>
<div class="card-body"> <div class="recommend-card-body">
<!-- Name --> <!-- Title -->
<div class="text-center"> <div class="text-center">
<span class="production-name">{{ item.title }}</span> <span class="recommend-card-title">{{ item.title }}</span>
</div> </div>
<!-- Description --> <!-- Description -->
<div class="card-description text-left opacity-25">{{ item.summary }}</div> <div class="recommend-card-description text-left opacity-25">{{ item.summary }}</div>
</div> </div>
</el-card> </el-card>
</div> </div>
@ -96,7 +96,14 @@ const handleProductionCardClick = (documentId: string) => {
<style scoped lang="scss"> <style scoped lang="scss">
section { section {
padding: 0 2rem; padding: 2rem;
}
section h2 {
color: var(--el-text-color-primary);
font-size: 1.5rem;
font-weight: bold;
margin-bottom: 0.5rem;
} }
section p { section p {
@ -131,7 +138,7 @@ section p {
height: 100%; height: 100%;
} }
.caption { .carousel-image-caption {
position: absolute; position: absolute;
bottom: 10px; bottom: 10px;
left: 50%; left: 50%;
@ -143,7 +150,7 @@ section p {
font-size: 14px; font-size: 14px;
} }
.production-carousel :deep(.el-carousel__button) { .recommend-carousel :deep(.el-carousel__button) {
/* 指示器按钮样式 */ /* 指示器按钮样式 */
width: 8px; width: 8px;
height: 8px; height: 8px;
@ -152,13 +159,13 @@ section p {
transition: all 0.3s ease; transition: all 0.3s ease;
} }
.production-list { .recommend-list {
display: flex; display: flex;
padding: 1rem; padding: 1rem;
height: 400px; height: 400px;
} }
.block-group { .recommend-card-group {
display: flex; display: flex;
gap: 1rem; gap: 1rem;
width: 100%; width: 100%;
@ -168,34 +175,36 @@ section p {
} }
.production-card { .recommend-card {
transition: all 0.3s ease; transition: all 0.3s ease;
text-align: center; text-align: center;
} }
.production-card:hover { .recommend-card:hover {
transform: translateY(-4px); transform: translateY(-4px);
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15); box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
} }
.production-name {
font-size: 1rem;
font-weight: 600;
}
.card-description { .recommend-card-body {
font-size: 0.8rem;
margin-top: 5px;
}
.production-card .el-image {
height: 150px;
border-radius: 4px;
}
.card-body {
margin: 10px auto; margin: 10px auto;
padding: 0px auto; padding: 0px auto;
height: 100px; height: 100px;
} }
.recommend-card-title {
font-size: 1rem;
font-weight: 600;
}
.recommend-card-description {
font-size: 0.8rem;
margin-top: 5px;
}
.recommend-card .el-image {
height: 150px;
border-radius: 4px;
}
</style> </style>