Files
uni-fans-score/components/home/HomeMainH5.vue
T
2026-04-29 11:10:29 +08:00

295 lines
6.2 KiB
Vue

<template>
<view class="h5-home-wrap">
<view class="main-content" :style="mainContentStyle">
<view class="h5-banner-section" v-if="bannerImages && bannerImages.length > 0">
<swiper class="h5-banner-swiper" :indicator-dots="bannerImages.length > 1" :autoplay="true" :interval="4000"
:duration="500" circular>
<swiper-item v-for="(img, idx) in bannerImages" :key="idx">
<view class="h5-banner-item" @click="$emit('bannerClick', idx)">
<image :src="img" mode="aspectFill" class="h5-banner-image"></image>
</view>
</swiper-item>
</swiper>
</view>
<view class="h5-banner-empty" v-else>
<text>{{ loadingText }}</text>
</view>
<view class="h5-cta-card">
<view class="h5-cta-header">
<text class="h5-cta-title">{{ scanText }}</text>
<text class="h5-cta-desc">{{ t('home.h5ScanDesc') }}</text>
</view>
<view class="h5-cta-btn" @click="$emit('scan')">
<image class="h5-cta-icon" src="/static/scan-icon.png" mode="aspectFit" />
<text class="h5-cta-btn-text">{{ scanText }}</text>
</view>
</view>
<view class="h5-section">
<view class="h5-section-title">{{ t('home.h5HowItWorks') }}</view>
<view class="h5-steps">
<view class="h5-step-item">
<text class="h5-step-index">1</text>
<text class="h5-step-text">{{ t('home.h5StepScan') }}</text>
</view>
<view class="h5-step-item">
<text class="h5-step-index">2</text>
<text class="h5-step-text">{{ t('home.h5StepUnlock') }}</text>
</view>
<view class="h5-step-item">
<text class="h5-step-index">3</text>
<text class="h5-step-text">{{ t('home.h5StepReturn') }}</text>
</view>
</view>
</view>
<view class="h5-section">
<view class="h5-section-title">{{ t('home.h5ServiceTitle') }}</view>
<view class="h5-tags">
<text class="h5-tag">{{ t('home.h5ServiceSupport') }}</text>
<text class="h5-tag">{{ t('home.h5ServiceSafePayment') }}</text>
<text class="h5-tag">{{ t('home.h5ServiceEasyReturn') }}</text>
</view>
</view>
</view>
<view class="h5-bottom-actions">
<view class="action-btn secondary" @click="$emit('buy')">
<image class="action-icon" src="/static/shop_icon.png" mode="aspectFit" />
<text class="action-label">{{ buyDeviceText }}</text>
</view>
<view class="action-btn primary" @click="$emit('scan')">
<image class="action-icon" src="/static/scan-icon.png" mode="aspectFit" />
<text class="action-label primary-label">{{ scanText }}</text>
</view>
<view class="action-btn secondary" @click="$emit('my')">
<image class="action-icon" src="/static/user.png" mode="aspectFit" />
<text class="action-label">{{ personalCenterText }}</text>
</view>
</view>
</view>
</template>
<script setup>
import { useI18n } from '../../utils/i18n.js'
const { t } = useI18n()
defineEmits(['bannerClick', 'scan', 'buy', 'my'])
defineProps({
mainContentStyle: { type: Object, default: () => ({}) },
bannerImages: { type: Array, default: () => [] },
loadingText: { type: String, default: '' },
buyDeviceText: { type: String, default: '' },
scanText: { type: String, default: '' },
personalCenterText: { type: String, default: '' }
})
</script>
<style lang="scss" scoped>
.h5-home-wrap {
min-height: 100%;
}
.main-content {
padding-bottom: 220rpx;
}
.h5-banner-section {
padding: 24rpx 20rpx 0;
box-sizing: border-box;
}
.h5-banner-swiper {
width: 100%;
height: 320rpx;
border-radius: 20rpx;
overflow: hidden;
background: #f5f5f5;
}
.h5-banner-item,
.h5-banner-image {
width: 100%;
height: 100%;
}
.h5-banner-empty {
padding: 80rpx 20rpx 0;
text-align: center;
color: #999;
font-size: 26rpx;
}
.h5-cta-card {
margin: 20rpx;
padding: 24rpx;
border-radius: 20rpx;
background: #ffffff;
display: flex;
align-items: center;
justify-content: space-between;
gap: 20rpx;
box-shadow: 0 6rpx 18rpx rgba(0, 0, 0, 0.05);
}
.h5-cta-header {
flex: 1;
}
.h5-cta-title {
font-size: 32rpx;
font-weight: 600;
color: #1f7d43;
display: block;
}
.h5-cta-desc {
font-size: 24rpx;
color: #4f7b61;
margin-top: 8rpx;
display: block;
}
.h5-cta-btn {
height: 76rpx;
padding: 0 24rpx;
background: #3EAB64;
border-radius: 38rpx;
display: flex;
align-items: center;
justify-content: center;
gap: 8rpx;
}
.h5-cta-icon {
width: 30rpx;
height: 30rpx;
filter: brightness(0) invert(1);
}
.h5-cta-btn-text {
color: #fff;
font-size: 24rpx;
font-weight: 600;
}
.h5-section {
margin: 0 20rpx 20rpx;
background: #fff;
border-radius: 20rpx;
padding: 20rpx;
box-shadow: 0 6rpx 18rpx rgba(0, 0, 0, 0.04);
}
.h5-section-title {
font-size: 28rpx;
font-weight: 600;
color: #2d2d2d;
margin-bottom: 16rpx;
}
.h5-steps {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 12rpx;
}
.h5-step-item {
background: #f4f8f6;
border-radius: 14rpx;
padding: 16rpx 10rpx;
display: flex;
flex-direction: column;
align-items: center;
gap: 8rpx;
}
.h5-step-index {
width: 34rpx;
height: 34rpx;
background: #3EAB64;
color: #fff;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-size: 20rpx;
}
.h5-step-text {
font-size: 22rpx;
color: #315c46;
}
.h5-tags {
display: flex;
flex-wrap: wrap;
gap: 12rpx;
}
.h5-tag {
padding: 10rpx 16rpx;
background: #eef8f1;
color: #2e7d4f;
border-radius: 999rpx;
font-size: 22rpx;
}
.h5-bottom-actions {
position: fixed;
left: 20rpx;
right: 20rpx;
bottom: 30rpx;
z-index: 1200;
padding: 14rpx;
background: rgba(255, 255, 255, 0.96);
border-radius: 56rpx;
box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.08);
display: flex;
align-items: center;
gap: 12rpx;
}
.action-btn {
height: 86rpx;
border-radius: 43rpx;
padding: 0 20rpx;
display: flex;
align-items: center;
justify-content: center;
gap: 8rpx;
}
.action-btn.primary {
flex: 1;
background: #3EAB64;
max-width: 360rpx;
}
.action-btn.secondary {
width: 150rpx;
background: #f4f6f8;
}
.action-icon {
width: 32rpx;
height: 32rpx;
}
.action-btn.primary .action-icon {
filter: brightness(0) invert(1);
}
.action-label {
font-size: 24rpx;
color: #333;
}
.primary-label {
color: #fff;
font-weight: 600;
}
</style>