feat 首页

This commit is contained in:
Ironsp
2026-10-08 17:26:33 +08:00
parent a3b04485dd
commit aa440d6bb5
21 changed files with 138 additions and 926 deletions

View File

@@ -12,6 +12,10 @@ const router = useRouter()
const activeIndex = ref(0)
let timer: ReturnType<typeof setInterval> | null = null
// 后端未下发banner 时退回内置插图。插图在设计稿中并非铺满背景,
// 而是定位在右侧 (928,104) 尺寸 723x598,需按原比例显示。
const hasBanners = computed(() => props.banners.length > 0)
const slides = computed(() => {
if (props.banners.length > 0) {
return props.banners.map((item) => item.imageUrl)
@@ -64,7 +68,12 @@ onBeforeUnmount(stopAutoplay)
class="home-banner__slide"
:class="{ 'home-banner__slide--active': index === activeIndex }"
>
<img class="home-banner__image" :src="src" alt="">
<img
class="home-banner__image"
:class="{ 'home-banner__image--inline': !hasBanners }"
:src="src"
alt=""
>
</div>
</div>
@@ -128,6 +137,19 @@ onBeforeUnmount(stopAutoplay)
width: 100%;
height: 100%;
object-fit: cover;
// 内置插图:按设计稿定位与尺寸原样显示,不铺满
&--inline {
position: absolute;
top: 31px;
right: 269px;
left: auto;
bottom: auto;
width: 723px;
height: 598px;
margin-left: auto;
object-fit: contain;
}
}
&__inner {
@@ -216,25 +238,25 @@ onBeforeUnmount(stopAutoplay)
&__dots {
position: absolute;
right: 80px;
bottom: 40px;
left: 929px;
top: 594px;
z-index: 1;
.flex(row, flex-end, center);
gap: 8px;
.flex(row, flex-start, center);
gap: 13px;
}
&__dot {
width: 8px;
height: 8px;
width: 5px;
height: 5px;
padding: 0;
border: none;
border-radius: 50%;
background: fade(@home-banner-dot, 40%);
background: @home-banner-dot;
cursor: pointer;
&--active {
width: 24px;
border-radius: 4px;
width: 44px;
border-radius: 3px;
background: @home-banner-dot;
}
}