2026-02-13 17:34:32 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<div class="mobile-container">
|
|
|
|
|
|
<header class="header">
|
|
|
|
|
|
<div class="user-info" @click="handleUserClick">
|
2026-03-26 10:28:28 +08:00
|
|
|
|
<a-avatar
|
|
|
|
|
|
:size="44"
|
|
|
|
|
|
:src="userInfo?.avatar || DEFAULT_AVATAR"
|
|
|
|
|
|
/>
|
2026-02-13 17:34:32 +08:00
|
|
|
|
<div class="welcome">
|
2026-03-26 10:28:28 +08:00
|
|
|
|
<p class="greeting">{{ greeting }}</p>
|
|
|
|
|
|
<p class="username">{{ displayName }}</p>
|
2026-02-13 17:34:32 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2026-03-26 10:28:28 +08:00
|
|
|
|
<a-button class="header-action" type="primary" ghost @click="handleUserClick">
|
|
|
|
|
|
{{ isLoggedIn ? '个人中心' : '去登录' }}
|
|
|
|
|
|
</a-button>
|
2026-02-13 17:34:32 +08:00
|
|
|
|
</header>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="search-section">
|
2026-03-26 10:28:28 +08:00
|
|
|
|
<a-input-search
|
2026-02-13 17:34:32 +08:00
|
|
|
|
v-model:value="searchQuery"
|
|
|
|
|
|
size="large"
|
2026-03-26 10:28:28 +08:00
|
|
|
|
placeholder="搜索作品、风格或门店"
|
|
|
|
|
|
enter-button="搜索"
|
|
|
|
|
|
@search="handleSearch"
|
|
|
|
|
|
/>
|
2026-02-13 17:34:32 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
|
2026-03-26 10:28:28 +08:00
|
|
|
|
<a-alert
|
|
|
|
|
|
v-if="!isLoggedIn"
|
|
|
|
|
|
class="guest-alert"
|
|
|
|
|
|
type="info"
|
|
|
|
|
|
show-icon
|
|
|
|
|
|
message="当前为游客模式"
|
|
|
|
|
|
description="先逛作品和门店,收藏、加购、下单时再登录即可。"
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
2026-03-26 10:53:19 +08:00
|
|
|
|
<section class="section">
|
|
|
|
|
|
<div class="banner-container">
|
|
|
|
|
|
<div class="banner-carousel">
|
|
|
|
|
|
<a-carousel v-if="bannerImages.length" autoplay :autoplay-speed="3200" effect="fade">
|
|
|
|
|
|
<div
|
|
|
|
|
|
v-for="banner in bannerImages"
|
|
|
|
|
|
:key="banner.id"
|
|
|
|
|
|
class="banner-slide"
|
|
|
|
|
|
@click="openShopById(banner.shopId)"
|
|
|
|
|
|
>
|
|
|
|
|
|
<img :src="banner.url" :alt="banner.shopName" class="banner-img" />
|
|
|
|
|
|
<div class="banner-copy">
|
|
|
|
|
|
<a-tag color="blue">门店推荐</a-tag>
|
|
|
|
|
|
<h3>{{ banner.shopName }}</h3>
|
|
|
|
|
|
<p>{{ banner.businessHours || '欢迎到店体验' }}</p>
|
|
|
|
|
|
</div>
|
2026-03-26 10:28:28 +08:00
|
|
|
|
</div>
|
2026-03-26 10:53:19 +08:00
|
|
|
|
</a-carousel>
|
|
|
|
|
|
<div v-else class="banner-empty">
|
|
|
|
|
|
<h3>发现适合你的美甲风格</h3>
|
|
|
|
|
|
<p>先看看门店 Banner 和精选作品,再决定今天预约谁。</p>
|
|
|
|
|
|
<a-button type="primary" @click="router.push('/products')">浏览作品</a-button>
|
2026-03-05 15:15:59 +08:00
|
|
|
|
</div>
|
2026-03-04 10:14:45 +08:00
|
|
|
|
</div>
|
2026-02-13 17:34:32 +08:00
|
|
|
|
</div>
|
2026-03-26 10:28:28 +08:00
|
|
|
|
</section>
|
|
|
|
|
|
|
2026-02-13 17:34:32 +08:00
|
|
|
|
<section class="section">
|
|
|
|
|
|
<div class="section-header">
|
2026-03-05 16:08:27 +08:00
|
|
|
|
<h3>精选作品</h3>
|
2026-03-26 10:28:28 +08:00
|
|
|
|
<a class="see-all" @click="handleSeeAll('featured')">查看全部</a>
|
2026-02-13 17:34:32 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<div class="horizontal-scroll">
|
|
|
|
|
|
<a-card
|
|
|
|
|
|
v-for="item in featuredItems"
|
|
|
|
|
|
:key="item.id"
|
|
|
|
|
|
class="product-card"
|
|
|
|
|
|
:body-style="{ padding: '12px' }"
|
|
|
|
|
|
hoverable
|
|
|
|
|
|
@click="handleProductClick(item)"
|
|
|
|
|
|
>
|
|
|
|
|
|
<div class="product-img" :style="{ backgroundColor: item.bgColor }">
|
2026-03-26 10:28:28 +08:00
|
|
|
|
<img v-if="item.coverUrl" :src="item.coverUrl" :alt="item.name" class="product-cover" />
|
|
|
|
|
|
<span v-else>{{ item.name[0] }}</span>
|
2026-02-13 17:34:32 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<div class="product-info">
|
|
|
|
|
|
<p class="name">{{ item.name }}</p>
|
2026-03-26 10:28:28 +08:00
|
|
|
|
<p class="meta">{{ item.meta }}</p>
|
|
|
|
|
|
<p class="price">¥{{ item.price }}</p>
|
2026-02-13 17:34:32 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</a-card>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
|
|
<section class="section popular-section">
|
|
|
|
|
|
<div class="section-header">
|
2026-03-05 16:08:27 +08:00
|
|
|
|
<h3>热门作品</h3>
|
2026-03-26 10:28:28 +08:00
|
|
|
|
<a class="see-all" @click="handleSeeAll('popular')">查看全部</a>
|
2026-02-13 17:34:32 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<div class="product-grid">
|
|
|
|
|
|
<a-card
|
|
|
|
|
|
v-for="item in popularItems"
|
|
|
|
|
|
:key="item.id"
|
|
|
|
|
|
class="product-card grid-item"
|
|
|
|
|
|
:body-style="{ padding: '12px' }"
|
|
|
|
|
|
hoverable
|
|
|
|
|
|
@click="handleProductClick(item)"
|
|
|
|
|
|
>
|
|
|
|
|
|
<div class="product-img" :style="{ backgroundColor: item.bgColor }">
|
2026-03-26 10:28:28 +08:00
|
|
|
|
<img v-if="item.coverUrl" :src="item.coverUrl" :alt="item.name" class="product-cover" />
|
|
|
|
|
|
<span v-else>{{ item.name[0] }}</span>
|
2026-02-13 17:34:32 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<div class="product-info">
|
|
|
|
|
|
<p class="name">{{ item.name }}</p>
|
2026-03-26 10:28:28 +08:00
|
|
|
|
<p class="meta">{{ item.meta }}</p>
|
|
|
|
|
|
<p class="price">¥{{ item.price }}</p>
|
2026-02-13 17:34:32 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</a-card>
|
|
|
|
|
|
</div>
|
2026-03-26 10:28:28 +08:00
|
|
|
|
|
2026-02-28 14:32:28 +08:00
|
|
|
|
<div v-if="loading" class="loading-more">
|
|
|
|
|
|
<a-spin size="small" />
|
2026-03-26 10:28:28 +08:00
|
|
|
|
<span>加载中...</span>
|
2026-02-28 14:32:28 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<div v-else-if="!hasMore && popularItems.length > 0" class="no-more">
|
2026-03-26 10:28:28 +08:00
|
|
|
|
没有更多热门推荐了
|
2026-02-28 14:32:28 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<div v-else-if="popularItems.length === 0 && !loading" class="no-products">
|
2026-03-05 16:08:27 +08:00
|
|
|
|
暂无热门作品
|
2026-02-28 14:32:28 +08:00
|
|
|
|
</div>
|
2026-02-13 17:34:32 +08:00
|
|
|
|
</section>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
2026-03-26 10:28:28 +08:00
|
|
|
|
import { computed, onMounted, onUnmounted, ref } from 'vue'
|
2026-02-13 17:34:32 +08:00
|
|
|
|
import { useRouter } from 'vue-router'
|
2026-03-26 10:28:28 +08:00
|
|
|
|
import { message } from 'ant-design-vue'
|
2026-02-28 14:32:28 +08:00
|
|
|
|
import { userApi, type UserVO } from '../api/user'
|
2026-03-26 10:28:28 +08:00
|
|
|
|
import { productApi, type ProductVO } from '../api/product'
|
2026-03-04 10:14:45 +08:00
|
|
|
|
import { shopApi, type ShopVO } from '../api/shop'
|
|
|
|
|
|
import { fileApi } from '../api/file'
|
2026-03-26 10:28:28 +08:00
|
|
|
|
import { DEFAULT_AVATAR, DEFAULT_PRODUCT_IMAGE } from '@/constants'
|
2026-03-27 14:55:41 +08:00
|
|
|
|
import type { IdType } from '@/utils/id'
|
2026-03-26 10:28:28 +08:00
|
|
|
|
|
|
|
|
|
|
interface BannerImage {
|
2026-03-26 10:53:19 +08:00
|
|
|
|
id: string
|
2026-03-27 14:55:41 +08:00
|
|
|
|
shopId: IdType
|
2026-03-26 10:28:28 +08:00
|
|
|
|
shopName: string
|
|
|
|
|
|
businessHours?: string
|
|
|
|
|
|
url: string
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
interface ProductCardItem {
|
2026-03-27 14:55:41 +08:00
|
|
|
|
id: IdType
|
2026-03-26 10:28:28 +08:00
|
|
|
|
name: string
|
|
|
|
|
|
price: string
|
|
|
|
|
|
meta: string
|
|
|
|
|
|
coverUrl: string
|
|
|
|
|
|
bgColor: string
|
|
|
|
|
|
}
|
2026-02-13 17:34:32 +08:00
|
|
|
|
|
|
|
|
|
|
const router = useRouter()
|
|
|
|
|
|
|
2026-03-26 10:28:28 +08:00
|
|
|
|
const userInfo = ref<UserVO | null>(null)
|
|
|
|
|
|
const publicShops = ref<ShopVO[]>([])
|
|
|
|
|
|
const bannerImages = ref<BannerImage[]>([])
|
|
|
|
|
|
const featuredItems = ref<ProductCardItem[]>([])
|
|
|
|
|
|
const popularSource = ref<ProductCardItem[]>([])
|
|
|
|
|
|
const popularItems = ref<ProductCardItem[]>([])
|
|
|
|
|
|
const productImageCache = ref<Record<string, string>>({})
|
2026-02-13 17:34:32 +08:00
|
|
|
|
const searchQuery = ref('')
|
2026-02-28 14:32:28 +08:00
|
|
|
|
const loading = ref(false)
|
|
|
|
|
|
const hasMore = ref(true)
|
|
|
|
|
|
const page = ref(1)
|
2026-03-26 10:28:28 +08:00
|
|
|
|
const pageSize = 8
|
|
|
|
|
|
|
|
|
|
|
|
const isLoggedIn = computed(() => Boolean(localStorage.getItem('accessToken') || sessionStorage.getItem('accessToken')))
|
|
|
|
|
|
const greeting = computed(() => (isLoggedIn.value ? '欢迎回来' : '游客模式'))
|
|
|
|
|
|
const displayName = computed(() => userInfo.value?.nickname || (isLoggedIn.value ? '用户' : '先看看门店和作品'))
|
|
|
|
|
|
|
|
|
|
|
|
const getRandomColor = (): string => {
|
|
|
|
|
|
const colors = ['#ffe4d6', '#d6eaff', '#e2ffd6', '#fff2d6', '#d6ffe4', '#e4d6ff']
|
|
|
|
|
|
return colors[Math.floor(Math.random() * colors.length)] ?? '#ffe4d6'
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const getProductCoverUrl = async (product: ProductVO): Promise<string> => {
|
|
|
|
|
|
const firstImageId = product.imageFileIds?.split(',').map(id => id.trim()).find(Boolean)
|
|
|
|
|
|
if (!firstImageId) {
|
|
|
|
|
|
return DEFAULT_PRODUCT_IMAGE
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!productImageCache.value[firstImageId]) {
|
|
|
|
|
|
try {
|
2026-03-27 14:55:41 +08:00
|
|
|
|
productImageCache.value[firstImageId] = await fileApi.getSignedUrl(firstImageId) as unknown as string
|
2026-03-26 10:28:28 +08:00
|
|
|
|
} catch (error) {
|
|
|
|
|
|
console.error('获取首页作品封面失败:', error)
|
|
|
|
|
|
productImageCache.value[firstImageId] = DEFAULT_PRODUCT_IMAGE
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return productImageCache.value[firstImageId] || DEFAULT_PRODUCT_IMAGE
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const formatProductCards = async (products: ProductVO[]): Promise<ProductCardItem[]> =>
|
|
|
|
|
|
Promise.all(products.map(async item => ({
|
|
|
|
|
|
id: item.id,
|
|
|
|
|
|
name: item.title || item.name || '未命名作品',
|
|
|
|
|
|
price: Number(item.price || 0).toFixed(2),
|
|
|
|
|
|
meta: item.approximateDuration || item.shopName || '支持预约',
|
|
|
|
|
|
coverUrl: await getProductCoverUrl(item),
|
|
|
|
|
|
bgColor: getRandomColor()
|
|
|
|
|
|
})))
|
|
|
|
|
|
|
|
|
|
|
|
const appendPopularItems = (loadMore = false) => {
|
|
|
|
|
|
const nextItems = popularSource.value.slice(0, page.value * pageSize)
|
|
|
|
|
|
popularItems.value = nextItems
|
|
|
|
|
|
hasMore.value = nextItems.length < popularSource.value.length
|
|
|
|
|
|
if (!loadMore && nextItems.length === 0) {
|
|
|
|
|
|
hasMore.value = false
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2026-02-28 14:32:28 +08:00
|
|
|
|
|
|
|
|
|
|
const loadUserInfo = async () => {
|
2026-03-26 10:28:28 +08:00
|
|
|
|
if (!isLoggedIn.value) {
|
|
|
|
|
|
userInfo.value = null
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
2026-02-28 14:32:28 +08:00
|
|
|
|
try {
|
2026-03-26 10:28:28 +08:00
|
|
|
|
const response = await userApi.getUserInfo()
|
|
|
|
|
|
userInfo.value = response || null
|
2026-02-28 14:32:28 +08:00
|
|
|
|
} catch (error) {
|
|
|
|
|
|
console.error('获取用户信息失败:', error)
|
2026-03-26 10:28:28 +08:00
|
|
|
|
userInfo.value = null
|
2026-02-28 14:32:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-03-26 10:28:28 +08:00
|
|
|
|
const loadPublicShops = async () => {
|
2026-03-04 10:14:45 +08:00
|
|
|
|
try {
|
2026-03-26 10:28:28 +08:00
|
|
|
|
const shops = await shopApi.getPublicShops()
|
|
|
|
|
|
publicShops.value = Array.isArray(shops) ? shops : []
|
|
|
|
|
|
await loadBannerImages()
|
|
|
|
|
|
} catch (error) {
|
|
|
|
|
|
console.error('获取门店列表失败:', error)
|
|
|
|
|
|
publicShops.value = []
|
|
|
|
|
|
bannerImages.value = []
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const loadBannerImages = async () => {
|
|
|
|
|
|
const banners: BannerImage[] = []
|
|
|
|
|
|
for (const shop of publicShops.value) {
|
2026-03-26 10:53:19 +08:00
|
|
|
|
const coverIds = (shop.coverImageFileId || shop.imageFileIds || '')
|
|
|
|
|
|
.split(',')
|
|
|
|
|
|
.map(id => id.trim())
|
|
|
|
|
|
.filter(Boolean)
|
2026-03-26 10:28:28 +08:00
|
|
|
|
for (const id of coverIds) {
|
|
|
|
|
|
try {
|
2026-03-27 14:55:41 +08:00
|
|
|
|
const url = await fileApi.getSignedUrl(id) as unknown as string
|
2026-03-26 10:28:28 +08:00
|
|
|
|
if (url) {
|
|
|
|
|
|
banners.push({
|
2026-03-26 10:53:19 +08:00
|
|
|
|
id: `${shop.id}-${id}`,
|
2026-03-27 14:55:41 +08:00
|
|
|
|
shopId: shop.id,
|
2026-03-26 10:28:28 +08:00
|
|
|
|
shopName: shop.shopName,
|
|
|
|
|
|
businessHours: shop.businessHours,
|
|
|
|
|
|
url
|
|
|
|
|
|
})
|
2026-03-04 10:14:45 +08:00
|
|
|
|
}
|
2026-03-26 10:28:28 +08:00
|
|
|
|
} catch (error) {
|
|
|
|
|
|
console.error('获取门店轮播图失败:', error)
|
2026-03-04 10:14:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2026-03-26 10:28:28 +08:00
|
|
|
|
bannerImages.value = banners.slice(0, 8)
|
2026-03-04 10:14:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-28 14:32:28 +08:00
|
|
|
|
const loadFeaturedProducts = async () => {
|
|
|
|
|
|
try {
|
2026-03-26 10:28:28 +08:00
|
|
|
|
let products = await productApi.getProductsByTag('精选')
|
|
|
|
|
|
if (!Array.isArray(products) || products.length === 0) {
|
|
|
|
|
|
products = await productApi.getAllProducts()
|
|
|
|
|
|
}
|
|
|
|
|
|
featuredItems.value = await formatProductCards((products || []).slice(0, 6))
|
2026-02-28 14:32:28 +08:00
|
|
|
|
} catch (error) {
|
2026-03-05 16:08:27 +08:00
|
|
|
|
console.error('获取精选作品失败:', error)
|
2026-03-26 10:28:28 +08:00
|
|
|
|
featuredItems.value = []
|
2026-02-28 14:32:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-03-26 10:28:28 +08:00
|
|
|
|
const loadPopularProducts = async () => {
|
2026-02-28 14:32:28 +08:00
|
|
|
|
loading.value = true
|
|
|
|
|
|
try {
|
2026-03-26 10:28:28 +08:00
|
|
|
|
let products = await productApi.getProductsByTag('热门')
|
|
|
|
|
|
if (!Array.isArray(products) || products.length === 0) {
|
|
|
|
|
|
products = await productApi.getAllProducts()
|
2026-02-28 14:32:28 +08:00
|
|
|
|
}
|
2026-03-26 10:28:28 +08:00
|
|
|
|
popularSource.value = await formatProductCards(products || [])
|
|
|
|
|
|
page.value = 1
|
|
|
|
|
|
appendPopularItems()
|
2026-02-28 14:32:28 +08:00
|
|
|
|
} catch (error) {
|
2026-03-05 16:08:27 +08:00
|
|
|
|
console.error('获取热门作品失败:', error)
|
2026-03-26 10:28:28 +08:00
|
|
|
|
popularSource.value = []
|
|
|
|
|
|
popularItems.value = []
|
|
|
|
|
|
hasMore.value = false
|
2026-02-28 14:32:28 +08:00
|
|
|
|
} finally {
|
|
|
|
|
|
loading.value = false
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const handleScroll = () => {
|
2026-03-26 10:28:28 +08:00
|
|
|
|
if (loading.value || !hasMore.value) {
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
2026-02-28 14:32:28 +08:00
|
|
|
|
const scrollTop = document.documentElement.scrollTop || document.body.scrollTop
|
|
|
|
|
|
const scrollHeight = document.documentElement.scrollHeight || document.body.scrollHeight
|
|
|
|
|
|
const clientHeight = document.documentElement.clientHeight
|
2026-03-26 10:28:28 +08:00
|
|
|
|
if (scrollTop + clientHeight >= scrollHeight - 120) {
|
|
|
|
|
|
page.value += 1
|
|
|
|
|
|
appendPopularItems(true)
|
2026-02-28 14:32:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-03-26 10:28:28 +08:00
|
|
|
|
const handleUserClick = () => {
|
|
|
|
|
|
if (isLoggedIn.value) {
|
|
|
|
|
|
router.push('/profile')
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
message.info('登录后可查看个人中心、收藏和订单')
|
|
|
|
|
|
router.push('/')
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const handleSearch = () => {
|
|
|
|
|
|
const keyword = searchQuery.value.trim()
|
|
|
|
|
|
router.push(keyword ? { path: '/products', query: { keyword } } : '/products')
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const handleSeeAll = (type: 'featured' | 'popular') => {
|
|
|
|
|
|
router.push({
|
|
|
|
|
|
path: '/products',
|
|
|
|
|
|
query: type === 'featured' ? { tag: '精选' } : { tag: '热门' }
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const handleProductClick = (item: ProductCardItem) => {
|
|
|
|
|
|
router.push(`/product/${item.id}`)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-03-27 14:55:41 +08:00
|
|
|
|
const openShopById = (shopId: IdType) => {
|
2026-03-26 10:28:28 +08:00
|
|
|
|
router.push(`/shop/${shopId}`)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
onMounted(async () => {
|
|
|
|
|
|
await Promise.all([
|
|
|
|
|
|
loadUserInfo(),
|
|
|
|
|
|
loadPublicShops(),
|
|
|
|
|
|
loadFeaturedProducts(),
|
|
|
|
|
|
loadPopularProducts()
|
|
|
|
|
|
])
|
2026-02-28 14:32:28 +08:00
|
|
|
|
window.addEventListener('scroll', handleScroll)
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
onUnmounted(() => {
|
|
|
|
|
|
window.removeEventListener('scroll', handleScroll)
|
|
|
|
|
|
})
|
2026-02-13 17:34:32 +08:00
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
|
.header {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
|
align-items: center;
|
2026-03-26 10:28:28 +08:00
|
|
|
|
padding: 16px 20px 8px;
|
2026-02-13 17:34:32 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.user-info {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
gap: 12px;
|
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.greeting {
|
|
|
|
|
|
font-size: 12px;
|
2026-03-26 10:28:28 +08:00
|
|
|
|
color: #8b8b9a;
|
|
|
|
|
|
margin: 0 0 2px;
|
2026-02-13 17:34:32 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.username {
|
|
|
|
|
|
font-size: 16px;
|
2026-03-26 10:28:28 +08:00
|
|
|
|
font-weight: 700;
|
2026-02-13 17:34:32 +08:00
|
|
|
|
margin: 0;
|
2026-03-26 10:28:28 +08:00
|
|
|
|
color: #1f1f1f;
|
2026-02-13 17:34:32 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-03-26 10:28:28 +08:00
|
|
|
|
.header-action {
|
|
|
|
|
|
border-radius: 999px;
|
2026-02-13 17:34:32 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.search-section {
|
2026-03-26 10:28:28 +08:00
|
|
|
|
padding: 8px 20px 0;
|
2026-02-13 17:34:32 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-03-26 10:28:28 +08:00
|
|
|
|
.guest-alert {
|
|
|
|
|
|
margin: 16px 20px 0;
|
|
|
|
|
|
border-radius: 16px;
|
2026-02-13 17:34:32 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-03-05 15:15:59 +08:00
|
|
|
|
.banner-container {
|
|
|
|
|
|
padding: 0 20px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-03-04 10:14:45 +08:00
|
|
|
|
.banner-carousel {
|
2026-03-05 15:15:59 +08:00
|
|
|
|
width: 100%;
|
2026-03-26 10:28:28 +08:00
|
|
|
|
border-radius: 18px;
|
2026-03-04 10:14:45 +08:00
|
|
|
|
overflow: hidden;
|
2026-03-26 10:28:28 +08:00
|
|
|
|
min-height: 220px;
|
|
|
|
|
|
box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
|
|
|
|
|
|
background: linear-gradient(135deg, #f4f7ff 0%, #eef4ff 100%);
|
2026-03-04 10:14:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.banner-slide {
|
2026-03-26 10:28:28 +08:00
|
|
|
|
position: relative;
|
2026-03-04 10:14:45 +08:00
|
|
|
|
width: 100%;
|
2026-03-26 10:28:28 +08:00
|
|
|
|
aspect-ratio: 16 / 9;
|
2026-03-04 10:14:45 +08:00
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.banner-img {
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
height: 100%;
|
|
|
|
|
|
object-fit: cover;
|
2026-03-26 10:28:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.banner-copy {
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
left: 24px;
|
|
|
|
|
|
bottom: 24px;
|
|
|
|
|
|
padding: 16px 18px;
|
2026-03-04 10:14:45 +08:00
|
|
|
|
border-radius: 16px;
|
2026-03-26 10:28:28 +08:00
|
|
|
|
background: rgba(255, 255, 255, 0.92);
|
|
|
|
|
|
backdrop-filter: blur(6px);
|
|
|
|
|
|
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
|
2026-03-04 10:14:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-03-26 10:28:28 +08:00
|
|
|
|
.banner-copy h3 {
|
|
|
|
|
|
margin: 10px 0 4px;
|
|
|
|
|
|
font-size: 22px;
|
|
|
|
|
|
color: #1f1f1f;
|
2026-03-04 10:14:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-03-26 10:28:28 +08:00
|
|
|
|
.banner-copy p {
|
|
|
|
|
|
margin: 0;
|
|
|
|
|
|
color: #666;
|
2026-03-04 10:14:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-03-26 10:28:28 +08:00
|
|
|
|
.banner-empty {
|
|
|
|
|
|
min-height: 220px;
|
2026-02-13 17:34:32 +08:00
|
|
|
|
display: flex;
|
2026-03-26 10:28:28 +08:00
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
align-items: flex-start;
|
2026-02-13 17:34:32 +08:00
|
|
|
|
justify-content: center;
|
2026-03-26 10:28:28 +08:00
|
|
|
|
gap: 12px;
|
|
|
|
|
|
padding: 28px;
|
2026-02-13 17:34:32 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-03-26 10:28:28 +08:00
|
|
|
|
.banner-empty h3 {
|
|
|
|
|
|
margin: 0;
|
|
|
|
|
|
font-size: 26px;
|
|
|
|
|
|
color: #1f1f1f;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.banner-empty p {
|
|
|
|
|
|
margin: 0;
|
|
|
|
|
|
max-width: 360px;
|
|
|
|
|
|
color: #666;
|
|
|
|
|
|
line-height: 1.7;
|
2026-02-13 17:34:32 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.section {
|
2026-03-26 10:28:28 +08:00
|
|
|
|
padding: 24px 0 0;
|
2026-02-13 17:34:32 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.section-header {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
|
align-items: center;
|
2026-03-26 10:28:28 +08:00
|
|
|
|
padding: 0 20px 14px;
|
2026-02-13 17:34:32 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.section-header h3 {
|
|
|
|
|
|
margin: 0;
|
2026-03-26 10:28:28 +08:00
|
|
|
|
font-size: 18px;
|
|
|
|
|
|
font-weight: 700;
|
2026-02-13 17:34:32 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.see-all {
|
2026-03-26 10:28:28 +08:00
|
|
|
|
color: #1677ff;
|
2026-02-13 17:34:32 +08:00
|
|
|
|
font-size: 13px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.horizontal-scroll {
|
|
|
|
|
|
display: flex;
|
2026-03-26 10:28:28 +08:00
|
|
|
|
gap: 14px;
|
2026-02-13 17:34:32 +08:00
|
|
|
|
overflow-x: auto;
|
|
|
|
|
|
padding: 0 20px;
|
|
|
|
|
|
scrollbar-width: none;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-03-26 10:28:28 +08:00
|
|
|
|
.horizontal-scroll::-webkit-scrollbar {
|
|
|
|
|
|
display: none;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-13 17:34:32 +08:00
|
|
|
|
.product-card {
|
2026-03-26 10:28:28 +08:00
|
|
|
|
width: 152px;
|
2026-02-13 17:34:32 +08:00
|
|
|
|
flex-shrink: 0;
|
2026-03-26 10:28:28 +08:00
|
|
|
|
border-radius: 18px;
|
2026-02-13 17:34:32 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.product-card :deep(.ant-card-body) {
|
|
|
|
|
|
padding: 12px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.product-img {
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
aspect-ratio: 1;
|
2026-03-26 10:28:28 +08:00
|
|
|
|
border-radius: 14px;
|
|
|
|
|
|
overflow: hidden;
|
2026-02-13 17:34:32 +08:00
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
2026-03-26 10:28:28 +08:00
|
|
|
|
justify-content: center;
|
|
|
|
|
|
margin-bottom: 10px;
|
2026-02-13 17:34:32 +08:00
|
|
|
|
font-size: 40px;
|
2026-03-26 10:28:28 +08:00
|
|
|
|
font-weight: 700;
|
|
|
|
|
|
color: rgba(0, 0, 0, 0.15);
|
2026-02-13 17:34:32 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-03-26 10:28:28 +08:00
|
|
|
|
.product-cover {
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
height: 100%;
|
|
|
|
|
|
object-fit: cover;
|
2026-02-13 17:34:32 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-03-26 10:28:28 +08:00
|
|
|
|
.name {
|
|
|
|
|
|
margin: 0 0 4px;
|
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
|
color: #1f1f1f;
|
2026-02-13 17:34:32 +08:00
|
|
|
|
white-space: nowrap;
|
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-03-26 10:28:28 +08:00
|
|
|
|
.meta {
|
|
|
|
|
|
margin: 0 0 6px;
|
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
|
color: #8b8b9a;
|
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.price {
|
2026-02-13 17:34:32 +08:00
|
|
|
|
margin: 0;
|
|
|
|
|
|
font-size: 16px;
|
2026-03-26 10:28:28 +08:00
|
|
|
|
font-weight: 700;
|
|
|
|
|
|
color: #ff4d4f;
|
2026-02-13 17:34:32 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.product-grid {
|
|
|
|
|
|
display: grid;
|
2026-03-26 10:28:28 +08:00
|
|
|
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
|
|
|
|
gap: 14px;
|
2026-02-13 17:34:32 +08:00
|
|
|
|
padding: 0 20px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.grid-item {
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-03-26 10:28:28 +08:00
|
|
|
|
.loading-more,
|
|
|
|
|
|
.no-more,
|
|
|
|
|
|
.no-products {
|
2026-02-28 14:32:28 +08:00
|
|
|
|
display: flex;
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
align-items: center;
|
2026-03-26 10:28:28 +08:00
|
|
|
|
gap: 8px;
|
|
|
|
|
|
padding: 24px 0 36px;
|
|
|
|
|
|
color: #8b8b9a;
|
2026-02-28 14:32:28 +08:00
|
|
|
|
}
|
2026-03-24 09:59:52 +08:00
|
|
|
|
|
|
|
|
|
|
@media (min-width: 992px) {
|
|
|
|
|
|
.header,
|
|
|
|
|
|
.search-section,
|
2026-03-26 10:28:28 +08:00
|
|
|
|
.section,
|
|
|
|
|
|
.guest-alert {
|
2026-03-24 09:59:52 +08:00
|
|
|
|
max-width: var(--frontend-content-max-width);
|
|
|
|
|
|
margin-left: auto;
|
|
|
|
|
|
margin-right: auto;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.banner-container {
|
|
|
|
|
|
padding: 0 24px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.banner-carousel {
|
2026-03-26 10:28:28 +08:00
|
|
|
|
max-width: var(--frontend-content-max-width);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-03-24 09:59:52 +08:00
|
|
|
|
.horizontal-scroll {
|
|
|
|
|
|
overflow: visible;
|
|
|
|
|
|
flex-wrap: wrap;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.product-card {
|
|
|
|
|
|
flex: 1 1 calc(25% - 12px);
|
|
|
|
|
|
width: calc(25% - 12px);
|
|
|
|
|
|
min-width: 180px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.product-grid {
|
|
|
|
|
|
grid-template-columns: repeat(4, minmax(0, 1fr));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2026-02-24 10:57:00 +08:00
|
|
|
|
</style>
|