修复:对齐用户端店铺页面

This commit is contained in:
xiaowang
2026-05-30 18:31:35 +08:00
parent 31cd06b5c9
commit 22347ff076
10 changed files with 165 additions and 108 deletions
+75 -36
View File
@@ -4,7 +4,7 @@
<button class="yumi-icon-button" type="button" aria-label="打开菜单" @click="router.push('/profile')">
<MenuOutlined />
</button>
<strong class="home-brand">YumiNail</strong>
<strong class="home-brand">首页</strong>
<button class="yumi-icon-button" type="button" aria-label="查看购物车" @click="router.push('/cart')">
<ShoppingOutlined />
</button>
@@ -13,8 +13,11 @@
<section class="hero">
<div class="hero-copy" @click="handleUserClick">
<p class="hero-kicker">{{ greeting }}</p>
<h1>早上好,{{ displayName }}</h1>
<p>{{ isLoggedIn ? '为你挑选今天适合预约的美甲灵感。' : '先看看门店和作品,喜欢了再登录也可以。' }}</p>
<h1>{{ displayName }}</h1>
<div class="member-line" aria-label="会员等级">
<span></span>
<p>{{ memberLevelText }}</p>
</div>
</div>
<button class="avatar-button" type="button" @click="handleUserClick">
<a-avatar :size="42" :src="userInfo?.avatar || DEFAULT_AVATAR" />
@@ -23,7 +26,7 @@
<form class="search-card" @submit.prevent="handleSearch">
<SearchOutlined class="search-card__icon" />
<input v-model="searchQuery" type="search" placeholder="搜索美甲风格或美甲师..." />
<input v-model="searchQuery" type="search" placeholder="搜索服务或美甲款式..." />
<button type="submit">搜索</button>
</form>
@@ -75,19 +78,19 @@
/>
<div class="feature-banner__shade"></div>
<div class="feature-banner__copy">
<span>新品上线</span>
<span>新品上市</span>
<h2>{{ item.name }}</h2>
<p>{{ item.shopName || item.meta }} · ¥{{ item.price }}</p>
</div>
</button>
</div>
</a-carousel>
<button v-else-if="featuredItems.length || popularItems.length" class="new-arrival-card" type="button" @click="router.push('/products')">
<img :src="DEFAULT_PRODUCT_IMAGE" alt="春日柔彩系列" class="feature-banner__image" />
<button v-else class="new-arrival-card" type="button" @click="router.push('/products')">
<img :src="DEFAULT_PRODUCT_IMAGE" alt="春日繁花系列" class="feature-banner__image" loading="eager" decoding="async" />
<div class="feature-banner__shade"></div>
<div class="feature-banner__copy">
<span>新品上线</span>
<h2>春日柔彩系列</h2>
<span>新品上市</span>
<h2>春日繁花系列</h2>
<p>轻盈裸粉、微闪珠光与日常通勤都刚好。</p>
</div>
</button>
@@ -96,19 +99,19 @@
<nav class="quick-actions" aria-label="快捷入口">
<button type="button" @click="router.push('/products')">
<span><CalendarOutlined /></span>
<b>约时间</b>
<b>在线预约</b>
</button>
<button type="button" @click="router.push('/products')">
<span><ShopOutlined /></span>
<b>找门店</b>
<span><AppstoreOutlined /></span>
<b>作品集</b>
</button>
<button type="button" @click="router.push('/cart')">
<span><ShoppingOutlined /></span>
<b>购物车</b>
<button type="button" @click="router.push('/vip-center')">
<span><CreditCardOutlined /></span>
<b>会员中心</b>
</button>
<button type="button" @click="router.push('/wishlist')">
<span><HeartOutlined /></span>
<b>我的收藏</b>
<button type="button" @click="router.push('/coupons')">
<span><TagsOutlined /></span>
<b>优惠活动</b>
</button>
</nav>
@@ -196,7 +199,7 @@
<h3>门店环境</h3>
</div>
<button class="see-all" type="button" @click="router.push('/products')">
去预约 <RightOutlined />
参观门店 <RightOutlined />
</button>
</div>
<div class="shop-strip">
@@ -224,13 +227,14 @@ import { computed, onMounted, onUnmounted, ref } from 'vue'
import { useRouter } from 'vue-router'
import { message } from 'ant-design-vue'
import {
AppstoreOutlined,
CalendarOutlined,
HeartOutlined,
CreditCardOutlined,
MenuOutlined,
RightOutlined,
SearchOutlined,
ShopOutlined,
ShoppingOutlined,
TagsOutlined,
} from '@ant-design/icons-vue'
/**
* Purpose: AnnouncementVO supports HomeView.vue by holding or executing the announcement vo page or API role.
@@ -348,9 +352,10 @@ const pageSize = 8
/** isLoggedIn is a reactive state variable used by the template and event handlers. */
const isLoggedIn = computed(() => Boolean(localStorage.getItem('accessToken') || sessionStorage.getItem('accessToken')))
/** greeting is a reactive state variable used by the template and event handlers. */
const greeting = computed(() => (isLoggedIn.value ? '欢迎回来' : '游客模式'))
const greeting = computed(() => '早上好,')
/** displayName is a reactive state variable used by the template and event handlers. */
const displayName = computed(() => userInfo.value?.nickname || (isLoggedIn.value ? '用户' : '先看看门店和作品'))
const displayName = computed(() => userInfo.value?.nickname || (isLoggedIn.value ? '用户' : '朋友'))
const memberLevelText = computed(() => `会员等级:${userInfo.value?.level || (isLoggedIn.value ? '普通会员' : '游客')}`)
/** announcementLoop is a reactive state variable used by the template and event handlers. */
const announcementLoop = computed(() => [...announcements.value, ...announcements.value].map((item, index) => ({ ...item, loopKey: index })))
const selectedAnnouncementContentHtml = computed(() => renderRichContent(selectedAnnouncement.value?.content || '暂无公告内容'))
@@ -587,13 +592,10 @@ onMounted(async () => {
loadAnnouncements(),
loadNewArrivalProducts(),
loadFeaturedProducts(),
loadPopularProducts()
loadPopularProducts(),
loadPublicShops()
]
if (!isLoggedIn.value) {
homeTasks.push(loadPublicShops())
}
await Promise.all(homeTasks)
window.addEventListener('scroll', handleScroll)
})
@@ -1068,17 +1070,23 @@ onUnmounted(() => {
}
.home-topbar {
position: sticky;
top: 0;
z-index: 40;
display: flex;
align-items: center;
justify-content: space-between;
padding: 12px 18px 6px;
padding: 12px 18px 9px;
border-bottom: 1px solid color-mix(in srgb, var(--theme-border) 78%, transparent);
background: color-mix(in srgb, var(--theme-card-bg) 88%, transparent);
backdrop-filter: blur(18px);
}
.home-brand {
color: var(--text-primary);
font-family: Georgia, 'Times New Roman', serif;
font-size: 15px;
font-weight: 700;
font-size: 16px;
font-weight: 800;
letter-spacing: 0;
}
.hero {
@@ -1108,8 +1116,23 @@ onUnmounted(() => {
line-height: 1.12;
}
.hero p:last-child {
.member-line {
display: flex;
align-items: center;
gap: 8px;
margin: 7px 0 0;
}
.member-line span {
display: inline-block;
width: 7px;
height: 7px;
border-radius: 999px;
background: var(--theme-secondary);
}
.member-line p {
margin: 0;
color: var(--text-secondary);
font-size: 12px;
line-height: 1.5;
@@ -1181,6 +1204,7 @@ onUnmounted(() => {
.feature-banner {
position: relative;
aspect-ratio: 4 / 3;
min-height: 132px;
margin: 16px 18px 0;
overflow: hidden;
@@ -1193,17 +1217,25 @@ onUnmounted(() => {
.new-arrival-carousel,
.new-arrival-card,
.new-arrival-slide,
.new-arrival-carousel :deep(.slick-slider),
.new-arrival-carousel :deep(.slick-list),
.new-arrival-carousel :deep(.slick-track),
.new-arrival-carousel :deep(.slick-slide),
.new-arrival-carousel :deep(.slick-slide > div) {
min-height: 132px;
height: 100% !important;
min-height: 100%;
}
.new-arrival-carousel,
.new-arrival-card {
position: absolute;
inset: 0;
}
.new-arrival-card {
position: relative;
display: block;
width: 100%;
height: 100%;
overflow: hidden;
border: 0;
background: transparent;
@@ -1212,6 +1244,11 @@ onUnmounted(() => {
text-align: left;
}
.new-arrival-slide {
position: relative;
width: 100%;
}
.new-arrival-carousel :deep(.slick-dots) {
right: 16px;
bottom: 14px;
@@ -1239,6 +1276,7 @@ onUnmounted(() => {
width: 100%;
height: 100%;
object-fit: cover;
object-position: center;
}
.feature-banner__shade {
@@ -1253,7 +1291,8 @@ onUnmounted(() => {
position: relative;
z-index: 1;
display: flex;
min-height: 132px;
height: 100%;
min-height: 0;
max-width: 72%;
flex-direction: column;
justify-content: flex-end;