hulai-website/components/home/HeroBanner.vue
Mimingguang ee078b61bc feat: 后台管理系统完整重构 + 前后台数据联通
- 后台全面引入 Naive UI 组件库,统一 UI 规范
- 前台 usePublicApi 切换到 API 调用(GET /api/content/[key])
- 前后台数据源统一(site_content 表)
- 产品线统一管理(tour/camp/course 三套编辑器)
- 产品数据归一化(itinerary/faq/pricing 格式统一)
- 表单提交 API 改写入 submissions 表
- 新增 submissions 标记已读 API
- site-content PUT 支持 upsert
- 修复前台 bug(stories 路由冲突、占位符警告、selector breadcrumb)
- 消除 PageHero 类型警告(useSEO reactive 修复)
- 25 个前台页面全部 HTTP 200,展示效果不变

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 17:48:02 +08:00

207 行
4.4 KiB
Vue

<template>
<section v-if="brand && images" class="hero">
<div class="hero-bg">
<img
:src="images.hero.background"
alt="呼伦贝尔草原风光 莫日格勒河蜿蜒穿过辽阔草原"
class="hero-bg-img"
width="1600"
height="900"
fetchpriority="high"
/>
<div class="hero-overlay" />
</div>
<div class="container hero-inner">
<h1 class="hero-title">{{ seo.h1 }}</h1>
<p class="hero-emotional">{{ brand.slogan.emotional }}</p>
<p class="hero-functional">{{ brand.slogan.functional }}</p>
<div class="hero-actions">
<NuxtLink to="/products" class="hero-btn hero-btn--primary">
<span>查看产品</span>
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true">
<path d="M6 3l5 5-5 5" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
</NuxtLink>
<NuxtLink to="/faq" class="hero-btn hero-btn--outline">常见问答</NuxtLink>
</div>
</div>
<!-- 底部弧形裁切 -->
<div class="hero-curve">
<svg viewBox="0 0 1440 64" fill="none" preserveAspectRatio="none" aria-hidden="true">
<path d="M0 64h1440V32C1200 0 240 0 0 32v32z" fill="currentColor" />
</svg>
</div>
</section>
</template>
<script setup>
defineProps({
seo: { type: Object, required: true },
})
const { data: brand } = await usePublicApi('brand')
const { data: images } = await usePublicApi('images')
// 仅在首页 preload Hero 图片,避免全站加载
useHead({
link: [
{ rel: 'preload', href: images.value?.hero?.background, as: 'image' },
],
})
</script>
<style lang="less" scoped>
.hero {
position: relative;
overflow: hidden;
min-height: 480px;
display: flex;
align-items: center;
justify-content: center;
.respond-md({
min-height: 580px;
});
.respond-lg({
min-height: 640px;
});
}
.hero-bg {
position: absolute;
inset: 0;
z-index: 0;
}
.hero-bg-img {
width: 100%;
height: 100%;
object-fit: cover;
object-position: center 40%;
display: block;
}
// 更丰富的渐变遮罩
.hero-overlay {
position: absolute;
inset: 0;
background:
linear-gradient(180deg, rgba(26, 26, 46, 0.35) 0%, rgba(26, 26, 46, 0.15) 40%, rgba(26, 26, 46, 0.5) 100%),
linear-gradient(135deg, rgba(45, 106, 79, 0.3) 0%, transparent 60%);
}
.hero-inner {
position: relative;
z-index: 1;
padding-top: @space-4xl;
padding-bottom: 100px;
text-align: center;
max-width: 720px;
margin: 0 auto;
.respond-md({
padding-top: @space-4xl;
padding-bottom: 120px;
});
}
.hero-title {
color: #FFFFFF;
margin-bottom: @space-lg;
text-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
letter-spacing: 1px;
}
.hero-emotional {
font-size: @font-size-xl;
color: rgba(255, 255, 255, 0.95);
font-weight: @font-weight-medium;
margin-bottom: @space-sm;
text-shadow: 0 1px 6px rgba(0, 0, 0, 0.2);
.respond-md({
font-size: @font-size-2xl;
});
}
.hero-functional {
font-size: @font-size-md;
color: rgba(255, 255, 255, 0.75);
margin-bottom: @space-xl;
.respond-md({
font-size: @font-size-lg;
});
}
.hero-actions {
display: flex;
gap: @space-md;
flex-wrap: wrap;
justify-content: center;
}
.hero-btn {
display: inline-flex;
align-items: center;
gap: @space-sm;
padding: 14px 32px;
border-radius: @border-radius-full;
font-size: @font-size-base;
font-weight: @font-weight-medium;
text-decoration: none;
transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
.respond-md({
padding: 16px 40px;
font-size: @font-size-md;
});
&--primary {
background: #fff;
color: @color-primary;
border: 2px solid #fff;
&:hover {
background: rgba(255, 255, 255, 0.92);
transform: translateY(-2px);
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
color: @color-primary;
}
}
&--outline {
border: 2px solid rgba(255, 255, 255, 0.5);
color: #fff;
&:hover {
background: rgba(255, 255, 255, 0.15);
border-color: rgba(255, 255, 255, 0.8);
color: #fff;
transform: translateY(-2px);
}
}
}
// 底部弧形
.hero-curve {
position: absolute;
bottom: -1px;
left: 0;
right: 0;
z-index: 2;
line-height: 0;
color: @color-bg-gray;
svg {
width: 100%;
height: 40px;
.respond-md({
height: 64px;
});
}
}
</style>