anon-ui/src/components/home/HomeHeroCard.vue
2026-05-03 19:36:05 +08:00

241 lines
4.5 KiB
Vue

<template>
<view class="hero">
<view class="hero-copy">
<text class="hero-eyebrow">{{ eyebrow }}</text>
<text class="hero-title">{{ title }}</text>
<text class="hero-subtitle">{{ subtitle }}</text>
<view class="hero-tags">
<text class="hero-tag" v-for="item in highlights" :key="item">{{ item }}</text>
</view>
</view>
<view class="hero-visual">
<image class="hero-image" :src="image" mode="aspectFit"></image>
</view>
<view class="hero-actions">
<button class="primary-button" @tap="$emit('action')">{{ actionText }}</button>
<button class="secondary-button" @tap="$emit('secondary')">{{ secondaryText }}</button>
</view>
<view class="sparkle sparkle-one"></view>
<view class="sparkle sparkle-two"></view>
<view class="sparkle sparkle-three"></view>
</view>
</template>
<script setup lang="ts">
defineEmits(["action", "secondary"]);
defineProps({
eyebrow: {
type: String,
required: true,
},
title: {
type: String,
required: true,
},
subtitle: {
type: String,
required: true,
},
highlights: {
type: Array as () => string[],
required: true,
},
image: {
type: String,
required: true,
},
actionText: {
type: String,
required: true,
},
secondaryText: {
type: String,
required: true,
},
});
</script>
<style scoped>
.hero {
position: relative;
overflow: hidden;
border-radius: 34rpx;
padding: 38rpx 32rpx 30rpx;
background:
linear-gradient(140deg, rgba(255, 247, 252, 0.96) 0%, rgba(255, 255, 255, 0.9) 38%, rgba(232, 247, 255, 0.92) 100%),
linear-gradient(45deg, rgba(255, 180, 206, 0.36), rgba(153, 217, 255, 0.2));
border: 1rpx solid rgba(255, 255, 255, 0.82);
box-shadow: 0 22rpx 52rpx rgba(89, 101, 132, 0.12);
}
.hero::before {
content: "";
position: absolute;
left: 28rpx;
right: 28rpx;
top: 24rpx;
height: 1rpx;
background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.96), transparent);
}
.hero::after {
content: "";
position: absolute;
right: -80rpx;
bottom: -120rpx;
width: 360rpx;
height: 320rpx;
background: linear-gradient(150deg, rgba(255, 216, 228, 0.46), rgba(198, 235, 255, 0.28));
transform: rotate(-16deg);
border-radius: 42% 58% 48% 52%;
}
.hero-copy {
position: relative;
z-index: 2;
width: 64%;
}
.hero-eyebrow {
display: block;
color: #d94f75;
font-size: 24rpx;
font-weight: 600;
line-height: 1.3;
}
.hero-title {
display: block;
margin-top: 12rpx;
color: #20273a;
font-size: 46rpx;
font-weight: 700;
line-height: 1.18;
}
.hero-subtitle {
display: block;
margin-top: 18rpx;
color: #626b7b;
font-size: 27rpx;
line-height: 1.55;
}
.hero-tags {
display: flex;
flex-wrap: wrap;
margin-top: 22rpx;
}
.hero-tag {
margin-right: 12rpx;
margin-bottom: 12rpx;
padding: 9rpx 16rpx;
border-radius: 999rpx;
background: rgba(255, 255, 255, 0.72);
color: #6c7280;
font-size: 22rpx;
line-height: 1.2;
border: 1rpx solid rgba(255, 255, 255, 0.92);
box-shadow: 0 8rpx 20rpx rgba(124, 143, 171, 0.08);
}
.hero-visual {
position: absolute;
right: 10rpx;
top: 34rpx;
width: 238rpx;
height: 226rpx;
z-index: 1;
}
.hero-image {
width: 100%;
height: 100%;
filter: drop-shadow(0 16rpx 26rpx rgba(230, 95, 131, 0.12));
}
.hero-actions {
position: relative;
z-index: 2;
display: flex;
align-items: center;
margin-top: 36rpx;
}
.primary-button,
.secondary-button {
height: 80rpx;
line-height: 80rpx;
border-radius: 999rpx;
font-size: 28rpx;
margin: 0;
}
.primary-button::after,
.secondary-button::after {
content: none;
}
.primary-button {
flex: 1;
color: #fff;
background: linear-gradient(135deg, #ff6f96 0%, #ff9a7a 100%);
box-shadow: 0 14rpx 28rpx rgba(255, 111, 150, 0.28);
}
.secondary-button {
width: 190rpx;
margin-left: 18rpx;
color: #d94f75;
background: rgba(255, 255, 255, 0.76);
border: 1rpx solid rgba(255, 255, 255, 0.94);
box-shadow: 0 10rpx 24rpx rgba(124, 143, 171, 0.08);
}
.sparkle {
position: absolute;
z-index: 1;
width: 10rpx;
height: 10rpx;
background: #fff;
transform: rotate(45deg);
box-shadow: 0 0 18rpx rgba(255, 255, 255, 0.9);
}
.sparkle-one {
top: 34rpx;
left: 58%;
}
.sparkle-two {
top: 164rpx;
right: 42rpx;
width: 8rpx;
height: 8rpx;
}
.sparkle-three {
bottom: 108rpx;
left: 40rpx;
width: 7rpx;
height: 7rpx;
}
@media screen and (max-width: 360px) {
.hero-copy {
width: 68%;
}
.hero-visual {
width: 190rpx;
height: 190rpx;
}
}
</style>