feat(home): 添加首页轮播图功能并优化页面样式
- 集成 a-carousel 组件实现首页英雄区域轮播图效果 - 添加 ClientOnly 包装确保轮播图在客户端渲染 - 配置自动播放和淡入淡出动画效果 - 设置背景图片数组包含两个轮播图片地址 - 调整 CSS 样式实现轮播图绝对定位和层级管理 - 修改页脚背景色从黑色调整为灰色 - 恢复显示网站名称文字并设置绿色字体颜色 - 优化轮播图容器和幻灯片的高度适配样式
This commit is contained in:
@@ -75,7 +75,7 @@ const year = new Date().getFullYear()
|
|||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.footer {
|
.footer {
|
||||||
background: #000;
|
background: #4b5563;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -35,9 +35,9 @@
|
|||||||
<div class="mx-auto flex max-w-screen-xl items-center justify-between gap-3 px-4">
|
<div class="mx-auto flex max-w-screen-xl items-center justify-between gap-3 px-4">
|
||||||
<NuxtLink to="/" class="navbar-brand">
|
<NuxtLink to="/" class="navbar-brand">
|
||||||
<img class="navbar-logo" :src="logoUrl" :alt="siteName" />
|
<img class="navbar-logo" :src="logoUrl" :alt="siteName" />
|
||||||
<!-- <span class="navbar-brand-name">-->
|
<span class="navbar-brand-name">
|
||||||
<!-- {{ siteName }}-->
|
{{ siteName }}
|
||||||
<!-- </span>-->
|
</span>
|
||||||
</NuxtLink>
|
</NuxtLink>
|
||||||
<nav class="nav hidden md:flex">
|
<nav class="nav hidden md:flex">
|
||||||
<template v-for="item in navItems" :key="item.key">
|
<template v-for="item in navItems" :key="item.key">
|
||||||
@@ -377,6 +377,7 @@ const todayText = computed(() => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.navbar-brand-name {
|
.navbar-brand-name {
|
||||||
|
color: #e7ffe5;
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
letter-spacing: 0.02em;
|
letter-spacing: 0.02em;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
|||||||
@@ -4,6 +4,23 @@
|
|||||||
<div class="grid grid-cols-12 gap-6">
|
<div class="grid grid-cols-12 gap-6">
|
||||||
<div class="col-span-12">
|
<div class="col-span-12">
|
||||||
<div class="panel hero">
|
<div class="panel hero">
|
||||||
|
<div class="hero-bg" aria-hidden="true">
|
||||||
|
<ClientOnly>
|
||||||
|
<a-carousel class="hero-carousel" autoplay effect="fade" :autoplaySpeed="4500" :dots="false">
|
||||||
|
<div
|
||||||
|
v-for="src in heroSlides"
|
||||||
|
:key="src"
|
||||||
|
class="hero-slide"
|
||||||
|
:style="{ backgroundImage: `url(${src})` }"
|
||||||
|
></div>
|
||||||
|
</a-carousel>
|
||||||
|
<template #fallback>
|
||||||
|
<div class="hero-carousel">
|
||||||
|
<div class="hero-slide" :style="{ backgroundImage: `url(${heroSlides[0]})` }"></div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</ClientOnly>
|
||||||
|
</div>
|
||||||
<div class="hero-inner">
|
<div class="hero-inner">
|
||||||
<!-- <div class="hero-badge">OFFICIAL</div>-->
|
<!-- <div class="hero-badge">OFFICIAL</div>-->
|
||||||
<!-- <div class="hero-title">{{ COMPANY.projectName }}</div>-->
|
<!-- <div class="hero-title">{{ COMPANY.projectName }}</div>-->
|
||||||
@@ -140,6 +157,11 @@ usePageSeo({
|
|||||||
path: '/'
|
path: '/'
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const heroSlides = [
|
||||||
|
'https://file-cloud.yst.com.cn/photo/website/2024/11/28/5a5cc07336224e54a84561c80899bcac.jpg',
|
||||||
|
'https://oss.wsdns.cn/20260115/75690dea8f064ceda03246b198a7d710.jpg'
|
||||||
|
]
|
||||||
|
|
||||||
function splitScope(text: string) {
|
function splitScope(text: string) {
|
||||||
return text
|
return text
|
||||||
.split(/[;;]+/g)
|
.split(/[;;]+/g)
|
||||||
@@ -253,14 +275,37 @@ function scrollToCompany() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.hero {
|
.hero {
|
||||||
|
position: relative;
|
||||||
min-height: 360px;
|
min-height: 360px;
|
||||||
background: url('https://oss.wsdns.cn/20260115/75690dea8f064ceda03246b198a7d710.jpg');
|
}
|
||||||
|
|
||||||
|
.hero-bg {
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
z-index: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-carousel {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-slide {
|
||||||
|
height: 100%;
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
background-position: center;
|
background-position: center;
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.hero-carousel :deep(.slick-list),
|
||||||
|
.hero-carousel :deep(.slick-track),
|
||||||
|
.hero-carousel :deep(.slick-slide),
|
||||||
|
.hero-carousel :deep(.slick-slide > div) {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
.hero-inner {
|
.hero-inner {
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
padding: 28px;
|
padding: 28px;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
Reference in New Issue
Block a user