功能:更新 YumiNail 用户端流程

This commit is contained in:
xiaowang
2026-05-31 18:36:52 +08:00
parent 22347ff076
commit 73483e7b0c
49 changed files with 6053 additions and 1306 deletions
+3 -2
View File
@@ -78,6 +78,7 @@ const adminThemeRefreshOptions = { mode: 'admin' as const }
const customerThemeRefreshOptions = { mode: 'customer' as const }
const isAdminShell = computed(() => route.path.startsWith('/admin') || route.matched.some(r => r.meta.isAdmin))
const bottomNavRouteNames = new Set(['home', 'products', 'cart', 'profile'])
/** isHiddenNav is a reactive state variable used by the template and event handlers. */
const isHiddenNav = computed(() => {
@@ -85,11 +86,11 @@ const isHiddenNav = computed(() => {
return true
}
if (route.path === '/' || isAdminShell.value) {
if (isAdminShell.value) {
return true
}
return route.matched.some(r => r.meta.hideNav) || route.matched.some(r => r.meta.isAdmin)
return !bottomNavRouteNames.has(String(route.name || ''))
})
/**
+29 -1
View File
@@ -21,11 +21,30 @@ export interface CommentVO {
parentCommentId?: IdType
parentCommentContent?: string
likeCount?: number
ratingScore?: number
imageFileIds?: IdType[]
imageUrls?: string[]
createTime?: string
updateTime?: string
replies?: CommentVO[]
}
export interface CommentCreateRequest {
productId: IdType
shopId?: IdType | null
parentCommentId?: IdType | null
commentContent: string
ratingScore?: number
imageFileIds?: IdType[]
}
export interface CommentImageFileVO {
id: IdType
fileName?: string
fileUrl?: string
createTime?: string
}
/**
* commentApi groups all API calls for this page domain.
* Call guide: pass the typed payload or identifier into the method below, and use the returned Promise in the page script.
@@ -44,9 +63,18 @@ export const commentApi = {
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param data: { productId: IdType; shopId?: IdType | null; parentCommentId?: IdType | null; commentContent: string } caller-supplied value for `data: { productId: IdType; shopId?: IdType | null; parentCommentId?: IdType | null; commentContent: string }`
*/
create: (data: { productId: IdType; shopId?: IdType | null; parentCommentId?: IdType | null; commentContent: string }) => {
create: (data: CommentCreateRequest) => {
return api.post<IdType>('/comment/create', data) as unknown as Promise<IdType>
},
uploadImage: (file: File) => {
const formData = new FormData()
formData.append('file', file)
return api.post<CommentImageFileVO>('/comment/upload-image', formData, {
headers: {
'Content-Type': 'multipart/form-data'
}
}) as unknown as Promise<CommentImageFileVO>
},
/**
* `delete` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
+23
View File
@@ -36,6 +36,26 @@ export interface NailArtistReviewVO {
submittedAt?: string
}
export interface NailArtistListItemVO {
id?: IdType
userId?: IdType
identity?: string
experience?: number
skills?: string
rating?: number | string
status?: number
participateProduction?: number
workStartTime?: string
workEndTime?: string
userType?: number
userTypeName?: string
portfolio?: string
nickname?: string
shopId?: IdType
shopName?: string
signature?: string
}
export interface NailArtistProfileVO {
artistId: IdType
artistName?: string
@@ -65,5 +85,8 @@ export const nailArtistApi = {
},
listReviews: async (artistId: IdType): Promise<NailArtistReviewVO[]> => {
return await api.get<NailArtistReviewVO[]>(`/nail-artist/${artistId}/reviews`) as unknown as NailArtistReviewVO[]
},
listByShopId: async (shopId: IdType): Promise<NailArtistListItemVO[]> => {
return await api.get<NailArtistListItemVO[]>(`/nail-artist/list/shop/${shopId}`) as unknown as NailArtistListItemVO[]
}
}
+1
View File
@@ -24,6 +24,7 @@ export interface ProductVO {
price: number
estimatedTime: number
approximateDuration?: string
serviceDurationMinutes?: number
bookableArtists?: string
availableBookableArtistCount?: number
bookableArtistRestricted?: boolean
+2
View File
@@ -65,6 +65,7 @@ export interface ShopTrustProfileVO {
averageRating?: number
reviewCount?: number
productCount?: number
artistCount?: number
recentReviewCount?: number
}
environmentImages?: string[]
@@ -72,6 +73,7 @@ export interface ShopTrustProfileVO {
id: IdType
title?: string
imageUrl?: string
imageFileIds?: string
price?: number
likeCount?: number
collectCount?: number
@@ -4,7 +4,7 @@
<button class="nav-item" :class="{ active: currentRoute === 'home' }" type="button" @click="handleNavClick('home')">
<a-badge :count="0" :offset="[0, 0]">
<div class="nav-icon">
<HomeOutlined :style="{ fontSize: '22px' }" />
<HomeOutlined :style="{ fontSize: '25px' }" />
</div>
</a-badge>
<span class="nav-label">首页</span>
@@ -13,7 +13,7 @@
<button class="nav-item" :class="{ active: currentRoute === 'products' }" type="button" @click="handleNavClick('products')">
<a-badge :count="0" :offset="[0, 0]">
<div class="nav-icon">
<ShoppingOutlined :style="{ fontSize: '22px' }" />
<ShoppingOutlined :style="{ fontSize: '25px' }" />
</div>
</a-badge>
<span class="nav-label">作品集</span>
@@ -22,7 +22,7 @@
<button class="nav-item" :class="{ active: currentRoute === 'cart' }" type="button" @click="handleNavClick('cart')">
<a-badge :count="cartCount" :offset="[0, 0]">
<div class="nav-icon">
<ShoppingCartOutlined :style="{ fontSize: '22px' }" />
<ShoppingCartOutlined :style="{ fontSize: '25px' }" />
</div>
</a-badge>
<span class="nav-label">购物车</span>
@@ -31,7 +31,7 @@
<button class="nav-item" :class="{ active: currentRoute === 'profile' }" type="button" @click="handleNavClick('profile')">
<a-badge :dot="hasNotification" :offset="[0, 0]">
<div class="nav-icon">
<UserOutlined :style="{ fontSize: '22px' }" />
<UserOutlined :style="{ fontSize: '25px' }" />
</div>
</a-badge>
<span class="nav-label">我的</span>
@@ -189,8 +189,8 @@ const handleNavClick = (tab: string) => {
display: flex;
align-items: center;
justify-content: center;
width: 34px;
height: 30px;
width: 40px;
height: 34px;
margin-bottom: 0;
border-radius: 18px 18px 16px 16px;
transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
@@ -247,7 +247,7 @@ const handleNavClick = (tab: string) => {
}
.nav-icon :deep(.anticon) {
font-size: 20px !important;
font-size: 22px !important;
}
.nav-label {
@@ -169,7 +169,7 @@ const displayContentHtml = computed(() => renderRichContent(displayContent.value
.system-message-card__title {
margin: 0;
color: var(--text-primary);
font-size: 22px;
font-size: 19px;
font-weight: 800;
line-height: 1.35;
overflow-wrap: break-word;
@@ -269,7 +269,7 @@ const displayContentHtml = computed(() => renderRichContent(displayContent.value
}
.system-message-card__title {
font-size: 20px;
font-size: 18px;
}
.system-message-card__footer {
+6
View File
@@ -56,6 +56,12 @@ const router = createRouter({
component: () => import('../views/ShopDetailView.vue'),
meta: { requiresAuth: false, hideNav: true, isAdmin: false }
},
{
path: '/shop/:shopId/artists',
name: 'shop-artists',
component: () => import('../views/ArtistListView.vue'),
meta: { requiresAuth: false, hideNav: true, isAdmin: false }
},
{
path: '/artist/:id',
name: 'artist-profile',
+30 -1
View File
@@ -113,7 +113,7 @@ body {
.yumi-title {
display: block;
color: var(--text-primary);
font-size: 24px;
font-size: 21px;
font-weight: 760;
line-height: 1.18;
}
@@ -154,6 +154,35 @@ body {
transform: scale(0.96);
}
.app-container--phone-shell :where(.nav-button, .icon-btn, .back-btn, .yumi-icon-button) :where(.anticon),
.app-container--phone-shell :where(.header, .shop-topbar, .detail-header, .artist-topbar, .artist-list-topbar, .auth-topbar, .not-found-topbar, .cart-topbar, .vip-header) :where(.ant-btn .anticon, button .anticon),
.app-container--admin :where(.mobile-icon-btn, .mobile-avatar-btn) :where(.anticon) {
font-size: 21px !important;
line-height: 1;
}
.app-container--phone-shell :where(.bottom-nav .nav-icon) {
width: 40px;
height: 34px;
}
.app-container--phone-shell :where(.bottom-nav .nav-icon .anticon) {
font-size: 25px !important;
line-height: 1;
}
.app-container--admin :where(.mobile-tabbar__item .anticon) {
font-size: 21px !important;
line-height: 1;
}
.app-container--phone-shell :where(.nav-button, .icon-btn, .back-btn, .yumi-icon-button, .bottom-nav .nav-icon) :where(.anticon svg),
.app-container--admin :where(.mobile-icon-btn, .mobile-avatar-btn, .mobile-tabbar__item) :where(.anticon svg) {
display: block;
width: 1em;
height: 1em;
}
.yumi-page-titlebar {
display: flex;
align-items: center;
@@ -45,7 +45,7 @@
.admin-page-intro__title {
margin: 0;
font-size: clamp(24px, 5vw, 32px);
font-size: clamp(20px, 4vw, 26px);
line-height: 1.08;
font-weight: 700;
}
@@ -234,7 +234,7 @@
.admin-mobile-stat__value {
margin-top: 10px;
font-size: 28px;
font-size: 24px;
font-weight: 700;
color: var(--admin-mobile-ink);
}
@@ -0,0 +1,16 @@
import { describe, expect, it } from 'vitest'
import { buildRatingStars, normalizeCommentRating } from './comment-review'
describe('comment review helpers', () => {
it('normalizes comment ratings for display and submit', () => {
expect(normalizeCommentRating(undefined)).toBe(5)
expect(normalizeCommentRating(0)).toBe(1)
expect(normalizeCommentRating(6)).toBe(5)
expect(normalizeCommentRating('3')).toBe(3)
})
it('builds filled and empty star states from a rating', () => {
expect(buildRatingStars(3)).toEqual([true, true, true, false, false])
expect(buildRatingStars(5)).toEqual([true, true, true, true, true])
})
})
@@ -0,0 +1,12 @@
export const normalizeCommentRating = (value: unknown, fallback = 5) => {
const numeric = Number(value ?? fallback)
if (!Number.isFinite(numeric)) {
return fallback
}
return Math.min(5, Math.max(1, Math.round(numeric)))
}
export const buildRatingStars = (rating: unknown) => {
const normalized = normalizeCommentRating(rating)
return Array.from({ length: 5 }, (_, index) => index < normalized)
}
@@ -132,7 +132,7 @@ onMounted(loadOrder)
.hero-card, .form-card { border: 1px solid var(--theme-border); border-radius: 20px; background: color-mix(in srgb, var(--theme-card-bg) 88%, transparent); box-shadow: 0 18px 44px rgba(74, 68, 63, 0.08); }
.hero-card { padding: 22px; margin-bottom: 14px; background: var(--theme-gradient-soft); }
.hero-card span { color: var(--theme-primary); font-size: 12px; font-weight: 700; letter-spacing: .05em; }
.hero-card h2 { margin: 10px 0 6px; font-size: 24px; }
.hero-card h2 { margin: 10px 0 6px; font-size: 21px; }
.hero-card p { margin: 0; color: var(--text-secondary); line-height: 1.6; }
.form-card { padding: 16px; }
:deep(.ant-btn-primary) { background: var(--theme-primary); border-color: var(--theme-primary); }
@@ -107,7 +107,7 @@ onMounted(loadRecords)
.hero-card, .record-card { border: 1px solid var(--theme-border); border-radius: 20px; background: color-mix(in srgb, var(--theme-card-bg) 88%, transparent); box-shadow: 0 18px 44px rgba(74, 68, 63, 0.08); }
.hero-card { padding: 22px; margin-bottom: 14px; background: var(--theme-gradient-soft); }
.hero-card span, .record-label { color: var(--theme-primary); font-size: 12px; font-weight: 700; letter-spacing: .05em; }
.hero-card h2 { margin: 10px 0 6px; font-size: 24px; }
.hero-card h2 { margin: 10px 0 6px; font-size: 21px; }
.hero-card p, .record-card p { margin: 0; color: var(--text-secondary); line-height: 1.6; }
.record-card { padding: 16px; margin-top: 14px; }
.record-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
@@ -0,0 +1,340 @@
<script setup lang="ts">
import { computed, ref, shallowRef, watch } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import {
CalendarOutlined,
LeftOutlined,
RightOutlined,
StarFilled,
UserOutlined
} from '@ant-design/icons-vue'
import { message } from 'ant-design-vue'
import { nailArtistApi, type NailArtistListItemVO } from '@/api/nail-artist'
const route = useRoute()
const router = useRouter()
const artists = ref<NailArtistListItemVO[]>([])
const loading = shallowRef(false)
const loadError = shallowRef('')
const shopId = computed(() => String(route.params.shopId || ''))
const pageTitle = computed(() => String(route.query.shopName || '美甲师'))
const formatRating = (value?: number | string) => {
const rating = Number(value || 0)
return rating > 0 ? rating.toFixed(1) : '暂无'
}
const parseSkillTags = (skills?: string) => {
return String(skills || '')
.split(/[,;,;、\s]+/)
.map(tag => tag.trim())
.filter(Boolean)
.slice(0, 4)
}
const formatWorkTime = (artist: NailArtistListItemVO) => {
const start = String(artist.workStartTime || '').slice(0, 5)
const end = String(artist.workEndTime || '').slice(0, 5)
return start && end ? `${start}-${end}` : '到店确认'
}
const displayName = (artist: NailArtistListItemVO) => artist.nickname || artist.identity || '美甲师'
const openArtist = (artist: NailArtistListItemVO) => {
const artistId = artist.userId
if (!artistId) {
message.info('美甲师信息暂未完善')
return
}
router.push(`/artist/${artistId}`)
}
const loadArtists = async () => {
if (!shopId.value) {
loadError.value = '缺少店铺信息'
return
}
loading.value = true
loadError.value = ''
try {
artists.value = await nailArtistApi.listByShopId(shopId.value)
} catch (error) {
loadError.value = error instanceof Error ? error.message : '美甲师列表加载失败'
message.error(loadError.value)
} finally {
loading.value = false
}
}
watch(shopId, loadArtists, { immediate: true })
</script>
<template>
<div class="artist-list-page">
<header class="artist-list-topbar">
<a-button class="nav-button" type="text" aria-label="返回" @click="router.back()">
<LeftOutlined />
</a-button>
<h1>{{ pageTitle }}</h1>
<span class="topbar-count">{{ artists.length }} 位</span>
</header>
<main class="artist-list-body">
<a-spin :spinning="loading">
<a-result v-if="loadError" status="warning" title="暂时无法查看美甲师" :sub-title="loadError">
<template #extra>
<a-button type="primary" @click="loadArtists">重试</a-button>
</template>
</a-result>
<template v-else>
<section class="list-summary">
<span>Artists</span>
<h2>本店美甲师</h2>
<p>选择熟悉的美甲师进入主页,查看作品、评价和近期可预约时间。</p>
</section>
<div v-if="artists.length" class="artist-cards">
<button
v-for="artist in artists"
:key="artist.userId || artist.id"
class="artist-card"
type="button"
@click="openArtist(artist)"
>
<a-avatar :size="56" class="artist-avatar">
<UserOutlined />
</a-avatar>
<div class="artist-copy">
<div class="artist-heading">
<strong>{{ displayName(artist) }}</strong>
<span :class="['status-chip', artist.status === 1 ? 'status-chip--active' : '']">
{{ artist.status === 1 ? '可预约' : '休息中' }}
</span>
</div>
<p>{{ artist.signature || artist.identity || '专注细节与稳定出品' }}</p>
<div class="artist-meta">
<span><StarFilled /> {{ formatRating(artist.rating) }}</span>
<span><CalendarOutlined /> {{ formatWorkTime(artist) }}</span>
</div>
<div v-if="parseSkillTags(artist.skills).length" class="tag-row">
<span v-for="tag in parseSkillTags(artist.skills)" :key="tag">{{ tag }}</span>
</div>
</div>
<RightOutlined class="card-arrow" />
</button>
</div>
<a-empty v-else class="empty-state" description="本店暂未配置可展示的美甲师" />
</template>
</a-spin>
</main>
</div>
</template>
<style scoped>
.artist-list-page {
min-height: 100vh;
background:
radial-gradient(circle at 18% 0%, rgba(232, 180, 184, 0.28), transparent 34%),
var(--theme-page-bg);
color: var(--text-primary);
}
.artist-list-topbar {
position: sticky;
top: 0;
z-index: 20;
display: grid;
grid-template-columns: 44px minmax(0, 1fr) 52px;
align-items: center;
height: 58px;
max-width: 960px;
margin: 0 auto;
padding: 0 14px;
background: color-mix(in srgb, var(--theme-card-bg) 92%, transparent);
border-bottom: 1px solid var(--theme-border);
backdrop-filter: blur(14px);
}
.nav-button {
width: 40px;
height: 40px;
}
.artist-list-topbar h1 {
margin: 0;
overflow: hidden;
font-size: 17px;
font-weight: 700;
text-align: center;
text-overflow: ellipsis;
white-space: nowrap;
}
.topbar-count {
color: var(--text-secondary);
font-size: 13px;
text-align: right;
}
.artist-list-body {
max-width: 960px;
margin: 0 auto;
padding: 18px 14px 36px;
}
.list-summary {
padding: 20px;
background: color-mix(in srgb, var(--theme-card-bg) 88%, transparent);
border: 1px solid color-mix(in srgb, var(--theme-border) 78%, transparent);
border-radius: 16px;
box-shadow: 0 16px 40px rgba(124, 83, 87, 0.08);
backdrop-filter: blur(18px);
}
.list-summary span {
color: var(--theme-primary);
font-size: 12px;
font-weight: 700;
letter-spacing: 0.05em;
text-transform: uppercase;
}
.list-summary h2 {
margin: 8px 0;
font-size: 22px;
line-height: 1.2;
}
.list-summary p {
margin: 0;
color: var(--text-secondary);
line-height: 1.7;
}
.artist-cards {
display: grid;
gap: 12px;
margin-top: 16px;
}
.artist-card {
display: grid;
grid-template-columns: 56px minmax(0, 1fr) 18px;
gap: 14px;
align-items: center;
width: 100%;
padding: 16px;
color: inherit;
text-align: left;
cursor: pointer;
background: color-mix(in srgb, var(--theme-card-bg) 92%, transparent);
border: 1px solid color-mix(in srgb, var(--theme-border) 82%, transparent);
border-radius: 16px;
box-shadow: 0 12px 28px rgba(124, 83, 87, 0.06);
}
.artist-avatar {
color: var(--theme-primary);
background: var(--theme-primary-soft);
border: 2px solid #fff;
}
.artist-copy {
min-width: 0;
}
.artist-heading {
display: flex;
gap: 8px;
align-items: center;
justify-content: space-between;
}
.artist-heading strong {
overflow: hidden;
font-size: 17px;
text-overflow: ellipsis;
white-space: nowrap;
}
.status-chip {
flex: 0 0 auto;
padding: 4px 8px;
color: var(--text-secondary);
font-size: 12px;
background: color-mix(in srgb, var(--theme-card-bg) 70%, var(--theme-primary-soft));
border-radius: 999px;
}
.status-chip--active {
color: var(--theme-primary);
background: var(--theme-primary-soft);
}
.artist-copy p {
display: -webkit-box;
margin: 6px 0 10px;
overflow: hidden;
color: var(--text-secondary);
font-size: 13px;
line-height: 1.5;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
}
.artist-meta,
.tag-row {
display: flex;
flex-wrap: wrap;
gap: 8px;
}
.artist-meta span {
display: inline-flex;
gap: 4px;
align-items: center;
color: var(--text-secondary);
font-size: 12px;
}
.artist-meta svg {
color: var(--theme-primary);
}
.tag-row {
margin-top: 10px;
}
.tag-row span {
padding: 4px 8px;
color: var(--theme-primary);
font-size: 12px;
background: var(--theme-primary-soft);
border-radius: 999px;
}
.card-arrow {
color: var(--text-secondary);
font-size: 12px;
}
.empty-state {
margin-top: 48px;
}
@media (max-width: 640px) {
.artist-list-body {
padding: 14px 12px 30px;
}
.artist-card {
grid-template-columns: 52px minmax(0, 1fr) 16px;
gap: 12px;
padding: 14px;
}
}
</style>
File diff suppressed because it is too large Load Diff
+67 -11
View File
@@ -1,5 +1,13 @@
<template>
<div class="mobile-container">
<header class="auth-topbar">
<button class="auth-back-button" type="button" aria-label="返回" @click="handleBackClick">
<LeftOutlined />
</button>
<strong>指尖设计师</strong>
<span class="auth-topbar-spacer" aria-hidden="true"></span>
</header>
<main class="auth-page">
<section class="brand-stage" aria-label="指尖设计师">
<div class="brand-mark" aria-hidden="true">
@@ -440,7 +448,7 @@
*/
import { computed, onBeforeUnmount, onMounted, reactive, ref, watch } from 'vue'
import { useRouter } from 'vue-router'
import { InfoCircleOutlined, LockOutlined, UserOutlined } from '@ant-design/icons-vue'
import { InfoCircleOutlined, LeftOutlined, LockOutlined, UserOutlined } from '@ant-design/icons-vue'
import { message } from 'ant-design-vue'
import type { Rule } from 'ant-design-vue/es/form'
/**
@@ -467,6 +475,14 @@ import type { IdType } from '@/utils/id'
*/
const router = useRouter()
const handleBackClick = () => {
if (window.history.length > 1) {
router.back()
return
}
router.push('/home')
}
/**
* Purpose: activeTab supports AuthView.vue by holding or executing the active tab page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
@@ -1326,10 +1342,50 @@ onBeforeUnmount(() => {
padding: 24px 20px 28px;
}
.auth-topbar {
position: sticky;
top: 0;
z-index: 20;
display: grid;
grid-template-columns: 40px minmax(0, 1fr) 40px;
align-items: center;
width: min(100%, 430px);
height: 44px;
margin: -10px auto 8px;
}
.auth-back-button {
display: inline-grid;
width: 36px;
height: 36px;
place-items: center;
border: 1px solid color-mix(in srgb, var(--theme-border) 78%, transparent);
border-radius: 999px;
color: var(--theme-primary-action);
background: color-mix(in srgb, var(--theme-card-bg) 86%, transparent);
box-shadow: 0 10px 24px color-mix(in srgb, var(--theme-neutral) 8%, transparent);
cursor: pointer;
}
.auth-topbar strong {
overflow: hidden;
color: var(--text-primary);
font-size: 16px;
font-weight: 800;
text-align: center;
text-overflow: ellipsis;
white-space: nowrap;
}
.auth-topbar-spacer {
width: 36px;
height: 36px;
}
.auth-page {
width: 100%;
max-width: 430px;
min-height: calc(100svh - 52px);
min-height: calc(100svh - 104px);
display: flex;
flex-direction: column;
justify-content: center;
@@ -1369,7 +1425,7 @@ onBeforeUnmount(() => {
background: var(--theme-gradient);
color: var(--theme-card-bg);
font-family: "Playfair Display", serif;
font-size: 30px;
font-size: 24px;
font-weight: 700;
line-height: 1;
letter-spacing: 0;
@@ -1379,7 +1435,7 @@ onBeforeUnmount(() => {
margin: 0;
color: var(--theme-primary-action);
font-family: "Playfair Display", serif;
font-size: 42px;
font-size: 28px;
font-weight: 700;
line-height: 1.05;
letter-spacing: 0;
@@ -1389,7 +1445,7 @@ onBeforeUnmount(() => {
margin: 8px 0 0;
color: var(--text-primary);
font-family: "Playfair Display", serif;
font-size: 28px;
font-size: 22px;
font-weight: 600;
line-height: 1.2;
letter-spacing: 0;
@@ -1436,7 +1492,7 @@ onBeforeUnmount(() => {
margin: 10px 0 0;
color: var(--text-primary);
font-family: "Playfair Display", serif;
font-size: 26px;
font-size: 22px;
font-weight: 600;
line-height: 1.25;
letter-spacing: 0;
@@ -1896,7 +1952,7 @@ onBeforeUnmount(() => {
}
.auth-page {
min-height: calc(100svh - 42px);
min-height: calc(100svh - 92px);
gap: 18px;
}
@@ -1909,15 +1965,15 @@ onBeforeUnmount(() => {
.brand-mark span {
width: 48px;
height: 48px;
font-size: 28px;
font-size: 22px;
}
.brand-name {
font-size: 38px;
font-size: 28px;
}
.brand-title {
font-size: 26px;
font-size: 21px;
}
.brand-copy {
@@ -1930,7 +1986,7 @@ onBeforeUnmount(() => {
}
.auth-card-header h2 {
font-size: 24px;
font-size: 21px;
}
}
</style>
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -82,7 +82,7 @@ onMounted(loadContact)
.hero-card, .section-card, .quick-grid button { border: 1px solid var(--theme-border); border-radius: 24px; background: color-mix(in srgb, var(--theme-card-bg) 88%, transparent); box-shadow: 0 18px 44px color-mix(in srgb, var(--theme-neutral) 8%, transparent); }
.hero-card { padding: 24px; margin-bottom: 14px; background: linear-gradient(135deg, color-mix(in srgb, var(--theme-primary) 24%, var(--theme-card-bg)), color-mix(in srgb, var(--theme-secondary) 18%, var(--theme-card-bg))); }
.hero-card span { color: var(--theme-primary-action); font-family: Georgia, 'Times New Roman', serif; font-size: 12px; font-weight: 800; }
.hero-card h2 { margin: 10px 0 6px; font-size: 25px; font-weight: 850; }
.hero-card h2 { margin: 10px 0 6px; font-size: 21px; font-weight: 850; }
.hero-card p, .section-card p, .quick-grid span { margin: 0; color: var(--text-secondary); line-height: 1.6; }
.section-card { padding: 16px; }
.section-card h3 { margin: 0 0 12px; font-size: 17px; }
+92 -30
View File
@@ -1,19 +1,17 @@
<template>
<div class="mobile-container home-page">
<header class="home-topbar">
<button class="yumi-icon-button" type="button" aria-label="打开菜单" @click="router.push('/profile')">
<MenuOutlined />
</button>
<strong class="home-brand">首页</strong>
<button class="yumi-icon-button" type="button" aria-label="查看购物车" @click="router.push('/cart')">
<ShoppingOutlined />
</button>
<span class="home-topbar-spacer" aria-hidden="true"></span>
<strong class="home-brand">{{ currentShopName }}</strong>
<span class="home-topbar-spacer" aria-hidden="true"></span>
</header>
<section class="hero">
<div class="hero-copy" @click="handleUserClick">
<p class="hero-kicker">{{ greeting }}</p>
<h1>{{ displayName }}</h1>
<h1 class="hero-greeting">
<span>{{ greeting }}</span>
<span class="hero-greeting__name">{{ displayName }}</span>
</h1>
<div class="member-line" aria-label="会员等级">
<span></span>
<p>{{ memberLevelText }}</p>
@@ -230,10 +228,8 @@ import {
AppstoreOutlined,
CalendarOutlined,
CreditCardOutlined,
MenuOutlined,
RightOutlined,
SearchOutlined,
ShoppingOutlined,
TagsOutlined,
} from '@ant-design/icons-vue'
/**
@@ -348,11 +344,45 @@ const page = ref(1)
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const pageSize = 8
const now = ref(new Date())
let greetingTimer: ReturnType<typeof window.setInterval> | undefined
/** isLoggedIn is a reactive state variable used by the template and event handlers. */
const isLoggedIn = computed(() => Boolean(localStorage.getItem('accessToken') || sessionStorage.getItem('accessToken')))
/** currentShopName renders the active shop name in the page navigation bar. */
const currentShopName = computed(() => {
const userShopName = userInfo.value?.shopName || userInfo.value?.shopNames?.find(Boolean)
if (userShopName) {
return userShopName
}
if (typeof window !== 'undefined') {
try {
const raw = localStorage.getItem('userInfo')
const storedUser = raw ? JSON.parse(raw) as { shopName?: string; shopNames?: string[] } : null
const cachedShopName = storedUser?.shopName || storedUser?.shopNames?.find(Boolean)
if (cachedShopName) {
return cachedShopName
}
} catch {
// Ignore malformed cached user data and keep resolving from public shops.
}
}
return publicShops.value.find(shop => shop.shopName)?.shopName || '当前门店'
})
/** greeting is a reactive state variable used by the template and event handlers. */
const greeting = computed(() => '早上好,')
const greeting = computed(() => {
const hour = now.value.getHours()
if (hour >= 5 && hour < 9) return '早上好,'
if (hour >= 9 && hour < 11) return '上午好,'
if (hour >= 11 && hour < 13) return '中午好,'
if (hour >= 13 && hour < 17) return '下午好,'
if (hour >= 17 && hour < 19) return '傍晚好,'
if (hour >= 19 && hour < 23) return '晚上好,'
if (hour >= 23 || hour < 1) return '深夜好,'
return '凌晨好,'
})
/** displayName is a reactive state variable used by the template and event handlers. */
const displayName = computed(() => userInfo.value?.nickname || (isLoggedIn.value ? '用户' : '朋友'))
const memberLevelText = computed(() => `会员等级:${userInfo.value?.level || (isLoggedIn.value ? '普通会员' : '游客')}`)
@@ -587,6 +617,11 @@ const openShopById = (shopId: IdType) => {
}
onMounted(async () => {
now.value = new Date()
greetingTimer = window.setInterval(() => {
now.value = new Date()
}, 60 * 1000)
const homeTasks = [
loadUserInfo(),
loadAnnouncements(),
@@ -601,6 +636,9 @@ onMounted(async () => {
})
onUnmounted(() => {
if (greetingTimer) {
window.clearInterval(greetingTimer)
}
window.removeEventListener('scroll', handleScroll)
})
</script>
@@ -795,7 +833,7 @@ onUnmounted(() => {
.banner-copy h3 {
margin: 10px 0 4px;
font-size: 22px;
font-size: 19px;
color: var(--text-primary);
}
@@ -816,7 +854,7 @@ onUnmounted(() => {
.banner-empty h3 {
margin: 0;
font-size: 26px;
font-size: 21px;
color: var(--text-primary);
}
@@ -872,7 +910,7 @@ onUnmounted(() => {
}
.product-card :deep(.ant-card-body) {
padding: 12px;
padding: 12px 12px 16px;
}
.product-img {
@@ -915,9 +953,10 @@ onUnmounted(() => {
}
.price {
margin: 0;
margin: 0 0 2px;
font-size: 16px;
font-weight: 700;
line-height: 1.25;
color: var(--theme-primary-action);
}
@@ -994,7 +1033,7 @@ onUnmounted(() => {
}
.banner-empty h3 {
font-size: 22px;
font-size: 20px;
line-height: 1.35;
}
@@ -1073,20 +1112,30 @@ onUnmounted(() => {
position: sticky;
top: 0;
z-index: 40;
display: flex;
display: grid;
grid-template-columns: 42px minmax(0, 1fr) 42px;
align-items: center;
justify-content: space-between;
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-topbar-spacer {
width: 42px;
height: 32px;
}
.home-brand {
overflow: hidden;
color: var(--text-primary);
font-size: 16px;
font-weight: 800;
letter-spacing: 0;
line-height: 1.25;
text-align: center;
text-overflow: ellipsis;
white-space: nowrap;
}
.hero {
@@ -1101,21 +1150,29 @@ onUnmounted(() => {
min-width: 0;
}
.hero-kicker {
margin: 0 0 4px;
color: var(--text-secondary);
font-size: 12px;
line-height: 1.2;
}
.hero h1 {
.hero-greeting {
display: flex;
min-width: 0;
align-items: baseline;
margin: 0;
color: var(--text-primary);
font-size: 23px;
font-size: 18px;
font-weight: 800;
line-height: 1.12;
}
.hero-greeting span {
flex: 0 0 auto;
}
.hero-greeting__name {
flex: 1 1 auto;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.member-line {
display: flex;
align-items: center;
@@ -1403,13 +1460,16 @@ onUnmounted(() => {
}
.home-page .product-card {
overflow: hidden;
border-radius: 20px;
background: transparent;
box-shadow: none;
cursor: pointer;
}
.home-page .product-info {
padding: 0 2px 8px;
}
.home-page .product-img {
aspect-ratio: 1 / 1.08;
margin: 0 0 9px;
@@ -1435,6 +1495,8 @@ onUnmounted(() => {
align-items: center;
justify-content: space-between;
gap: 8px;
min-height: 22px;
padding-bottom: 3px;
}
.home-page .price {
@@ -1506,7 +1568,7 @@ onUnmounted(() => {
}
@media (max-width: 360px) {
.hero h1 {
.hero-greeting {
font-size: 20px;
}
+68 -5
View File
@@ -1,5 +1,13 @@
<template>
<div class="not-found-container">
<header class="not-found-topbar">
<button class="not-found-back" type="button" aria-label="返回" @click="handleBackClick">
<LeftOutlined />
</button>
<strong>指尖设计师</strong>
<span class="not-found-topbar-spacer" aria-hidden="true"></span>
</header>
<div class="not-found-content">
<span class="not-found-kicker">指尖设计师</span>
<div class="error-code">404</div>
@@ -20,6 +28,7 @@
*/
import { ref, onMounted, onUnmounted } from 'vue'
import { useRouter } from 'vue-router'
import { LeftOutlined } from '@ant-design/icons-vue'
/**
* Purpose: router supports NotFoundView.vue by holding or executing the router page or API role.
@@ -30,11 +39,25 @@ const router = useRouter()
const countdown = ref(5)
let timer: number | null = null
/** redirectToHome is a local helper used by this page script. */
const redirectToHome = () => {
const clearRedirectTimer = () => {
if (timer) {
clearInterval(timer)
timer = null
}
}
const handleBackClick = () => {
clearRedirectTimer()
if (window.history.length > 1) {
router.back()
return
}
router.push('/home')
}
/** redirectToHome is a local helper used by this page script. */
const redirectToHome = () => {
clearRedirectTimer()
router.push('/home')
}
@@ -52,14 +75,13 @@ onMounted(() => {
})
onUnmounted(() => {
if (timer) {
clearInterval(timer)
}
clearRedirectTimer()
})
</script>
<style scoped>
.not-found-container {
position: relative;
min-height: 100vh;
display: flex;
justify-content: center;
@@ -70,6 +92,47 @@ onUnmounted(() => {
padding: 20px;
}
.not-found-topbar {
position: fixed;
top: 12px;
left: 50%;
z-index: 20;
display: grid;
grid-template-columns: 40px minmax(0, 1fr) 40px;
align-items: center;
width: min(calc(100% - 32px), var(--app-mobile-max-width, 480px));
height: 44px;
transform: translateX(-50%);
}
.not-found-back {
display: inline-grid;
width: 36px;
height: 36px;
place-items: center;
border: 1px solid color-mix(in srgb, var(--theme-border) 78%, transparent);
border-radius: 999px;
color: var(--theme-primary-action);
background: color-mix(in srgb, var(--theme-card-bg) 88%, transparent);
box-shadow: 0 10px 24px color-mix(in srgb, var(--theme-neutral) 8%, transparent);
cursor: pointer;
}
.not-found-topbar strong {
overflow: hidden;
color: var(--text-primary);
font-size: 16px;
font-weight: 800;
text-align: center;
text-overflow: ellipsis;
white-space: nowrap;
}
.not-found-topbar-spacer {
width: 36px;
height: 36px;
}
.not-found-content {
background: color-mix(in srgb, var(--theme-card-bg) 88%, transparent);
border: 1px solid var(--theme-border);
@@ -143,7 +143,7 @@ onMounted(loadMessages)
.page-header h1 {
margin: 0;
font-size: 24px;
font-size: 20px;
}
.page-header p {
@@ -280,7 +280,7 @@ onMounted(loadMessages)
}
.page-header h1 {
font-size: 27px;
font-size: 21px;
font-weight: 860;
}
@@ -212,10 +212,10 @@ onMounted(loadOrder)
.hero-card, .section-card, .timeline-card { border: 1px solid var(--theme-border); border-radius: 20px; background: color-mix(in srgb, var(--theme-card-bg) 88%, transparent); box-shadow: 0 18px 44px rgba(74, 68, 63, 0.08); }
.hero-card { padding: 22px; background: var(--theme-gradient-soft); }
.eyebrow { display: block; color: var(--theme-primary); font-size: 12px; font-weight: 700; letter-spacing: .05em; }
.hero-card h2 { margin: 10px 0 6px; font-size: 24px; }
.hero-card h2 { margin: 10px 0 6px; font-size: 21px; }
.hero-card p { margin: 0; color: var(--text-secondary); }
.hero-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; }
.hero-meta strong { font-size: 22px; }
.hero-meta strong { font-size: 20px; }
.status-pill { padding: 6px 12px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--theme-primary-soft); color: var(--theme-primary); }
.status-pill.cancelled { color: var(--theme-accent); }
.timeline-card { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1px; overflow: hidden; margin-top: 14px; background: var(--theme-border); }
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+150 -75
View File
@@ -1,16 +1,11 @@
<template>
<div class="mobile-container product-list-page">
<header class="gallery-header">
<a-button class="icon-btn" type="text" aria-label="返回首页" @click="handleBackClick">
<MenuOutlined />
</a-button>
<div class="brand-lockup" aria-label="指尖设计师">
<h1>指尖设计师</h1>
<span class="header-spacer" aria-hidden="true"></span>
<div class="brand-lockup" :aria-label="currentShopName">
<h1>{{ currentShopName }}</h1>
</div>
<a-button class="icon-btn icon-btn--bag" type="text" aria-label="前往购物车" @click="router.push('/cart')">
<ShoppingOutlined />
<span class="bag-dot" aria-hidden="true"></span>
</a-button>
<span class="header-spacer" aria-hidden="true"></span>
</header>
<main class="gallery-content">
@@ -105,7 +100,7 @@
@click.stop="handleAddToCart(item)"
>
<CheckOutlined v-if="item.inCart" />
<PlusOutlined v-else />
<ShoppingCartOutlined v-else />
</button>
</div>
@@ -151,6 +146,16 @@
</div>
</section>
</main>
<button
v-show="showBackTop"
class="back-to-top-button"
type="button"
aria-label="返回顶部"
@click="scrollToTop"
>
<UpOutlined />
</button>
</div>
</template>
@@ -159,17 +164,16 @@
* ProductListView page script.
* Call guide: the template binds the reactive state below, and the methods are triggered by button clicks, lifecycle hooks, or router events.
*/
import { onMounted, ref, watch, inject, computed } from 'vue'
import { computed, inject, onMounted, onUnmounted, ref, watch } from 'vue'
import { useRouter, useRoute } from 'vue-router'
import {
CheckOutlined,
ClockCircleOutlined,
HeartOutlined,
MenuOutlined,
PlusOutlined,
SearchOutlined,
ShoppingOutlined,
StarOutlined
ShoppingCartOutlined,
StarOutlined,
UpOutlined
} from '@ant-design/icons-vue'
import { message } from 'ant-design-vue'
/**
@@ -219,6 +223,8 @@ const allTags = computed(() => filterGroups.value.flatMap(group => group.tags ||
const selectedCategory = ref('全部')
/** selectedTagId tracks the grouped filter id sent to the backend. */
const selectedTagId = ref('')
const selectedShopId = ref('')
const bookableOnly = ref(false)
/**
* Purpose: products supports ProductListView.vue by holding or executing the products page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
@@ -226,6 +232,8 @@ const selectedTagId = ref('')
const products = ref<ProductListItem[]>([])
/** loading is a reactive state variable used by the template and event handlers. */
const loading = ref(false)
/** showBackTop toggles the floating shortcut after the gallery scrolls down. */
const showBackTop = ref(false)
/** showSearch is a reactive state variable used by the template and event handlers. */
const showSearch = ref(false)
/** searchKeyword is a reactive state variable used by the template and event handlers. */
@@ -245,17 +253,57 @@ let useGlobalLoadingForNextRouteSync = false
/** isLoggedIn is a reactive state variable used by the template and event handlers. */
const isLoggedIn = computed(() => Boolean(localStorage.getItem('accessToken') || sessionStorage.getItem('accessToken')))
/** currentShopName renders the active shop name in the page navigation bar. */
const currentShopName = computed(() => {
const routeShopName = typeof route.query.shopName === 'string' ? route.query.shopName.trim() : ''
if (routeShopName) {
return routeShopName
}
if (typeof window !== 'undefined') {
try {
const raw = localStorage.getItem('userInfo')
const storedUser = raw ? JSON.parse(raw) as { shopName?: string; shopNames?: string[] } : null
return storedUser?.shopName || storedUser?.shopNames?.find(Boolean) || '当前门店'
} catch {
return '当前门店'
}
}
return '当前门店'
})
/** activeBannerText is a reactive state variable used by the template and event handlers. */
const activeBannerText = computed(() => {
if (searchKeyword.value.trim()) {
return `当前显示“${searchKeyword.value.trim()}”的匹配结果`
}
if (selectedShopId.value && bookableOnly.value) {
return `当前显示“${currentShopName.value}”的可预约作品`
}
if (selectedShopId.value) {
return `当前显示“${currentShopName.value}”的作品`
}
if (selectedCategory.value !== '全部') {
return `当前按场景“${selectedCategory.value}”筛选`
}
return ''
})
const getScopedRouteQuery = (includeBookable = true) => {
const query: Record<string, string> = {}
const routeShopName = typeof route.query.shopName === 'string' ? route.query.shopName.trim() : ''
if (selectedShopId.value) {
query.shopId = selectedShopId.value
}
if (routeShopName) {
query.shopName = routeShopName
}
if (includeBookable && bookableOnly.value) {
query.bookable = '1'
}
return query
}
/**
* Purpose: DEFAULT_PRODUCT_IMAGE supports ProductListView.vue by holding or executing the default product image page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
@@ -341,7 +389,15 @@ const fetchProducts = async () => {
response = pageResult.list || []
}
products.value = markProductsInCart(Array.isArray(response) ? response : [])
let filteredProducts = Array.isArray(response) ? response : []
if (selectedShopId.value) {
filteredProducts = filteredProducts.filter(item => String(item.shopId || '') === selectedShopId.value)
}
if (bookableOnly.value) {
filteredProducts = filteredProducts.filter(item => item.availableBookableArtistCount === undefined || Number(item.availableBookableArtistCount) > 0)
}
products.value = markProductsInCart(filteredProducts)
await loadImageUrls(products.value)
} catch (error: any) {
console.error('获取作品列表失败:', error)
@@ -358,12 +414,16 @@ const syncRouteFilters = async () => {
const keyword = typeof route.query.keyword === 'string' ? route.query.keyword.trim() : ''
const tag = typeof route.query.tag === 'string' ? route.query.tag.trim() : ''
const tagId = typeof route.query.tagId === 'string' ? route.query.tagId.trim() : ''
const shopId = typeof route.query.shopId === 'string' ? route.query.shopId.trim() : ''
const bookable = route.query.bookable === '1'
const matchedTag = tagId
? allTags.value.find(item => String(item.id) === tagId)
: allTags.value.find(item => item.tagName === tag || item.displayName === tag)
searchKeyword.value = keyword
showSearch.value = Boolean(keyword)
selectedShopId.value = shopId
bookableOnly.value = bookable
selectedTagId.value = matchedTag ? String(matchedTag.id) : ''
selectedCategory.value = matchedTag ? (matchedTag.displayName || matchedTag.tagName) : '全部'
if (useGlobalLoadingForNextRouteSync) {
@@ -374,11 +434,6 @@ const syncRouteFilters = async () => {
await fetchProducts()
}
/** handleBackClick is a local helper used by this page script. */
const handleBackClick = () => {
router.push('/home')
}
/** handleCategoryClick is a local helper used by this page script. */
const handleCategoryClick = (category: string) => {
selectedCategory.value = category
@@ -386,7 +441,7 @@ const handleCategoryClick = (category: string) => {
searchKeyword.value = ''
showSearch.value = false
useGlobalLoadingForNextRouteSync = true
router.replace({ path: '/products', query: {} })
router.replace({ path: '/products', query: getScopedRouteQuery() })
}
/** handleTagClick is a local helper used by grouped scene-filter chips. */
@@ -398,7 +453,7 @@ const handleTagClick = (tag: TagVO) => {
useGlobalLoadingForNextRouteSync = true
router.replace({
path: '/products',
query: { tag: tag.displayName || tag.tagName, tagId: String(tag.id) }
query: { ...getScopedRouteQuery(), tag: tag.displayName || tag.tagName, tagId: String(tag.id) }
})
}
@@ -434,7 +489,7 @@ const handleSearch = () => {
useGlobalLoadingForNextRouteSync = true
router.replace({
path: '/products',
query: keyword ? { keyword } : {}
query: keyword ? { ...getScopedRouteQuery(), keyword } : getScopedRouteQuery()
})
}
@@ -444,8 +499,19 @@ const resetFilters = () => {
selectedTagId.value = ''
searchKeyword.value = ''
showSearch.value = false
bookableOnly.value = false
useGlobalLoadingForNextRouteSync = true
router.replace('/products')
router.replace({ path: '/products', query: getScopedRouteQuery(false) })
}
/** handleWindowScroll keeps the return-to-top shortcut in sync with page position. */
const handleWindowScroll = () => {
showBackTop.value = (document.documentElement.scrollTop || document.body.scrollTop) > 360
}
/** scrollToTop returns the product gallery to the top of the page. */
const scrollToTop = () => {
window.scrollTo({ top: 0, behavior: 'smooth' })
}
watch(
@@ -459,6 +525,12 @@ watch(
onMounted(async () => {
await fetchTags()
await syncRouteFilters()
handleWindowScroll()
window.addEventListener('scroll', handleWindowScroll, { passive: true })
})
onUnmounted(() => {
window.removeEventListener('scroll', handleWindowScroll)
})
</script>
@@ -484,19 +556,25 @@ onMounted(async () => {
.gallery-header {
position: fixed;
top: 0;
left: 0;
right: 0;
left: 50%;
z-index: 100;
display: flex;
align-items: center;
justify-content: space-between;
width: 100%;
width: min(100%, var(--app-mobile-max-width, 480px));
height: var(--gallery-header-height);
padding: 0 var(--gallery-gutter);
border-bottom: 1px solid var(--gallery-border);
background: color-mix(in srgb, var(--theme-tertiary) 86%, transparent);
box-shadow: 0 12px 36px color-mix(in srgb, var(--theme-neutral) 8%, transparent);
backdrop-filter: blur(20px);
transform: translateX(-50%);
}
.header-spacer {
flex: 0 0 36px;
width: 36px;
height: 36px;
}
.brand-lockup {
@@ -508,45 +586,14 @@ onMounted(async () => {
.brand-lockup h1 {
margin: 0;
overflow: hidden;
color: var(--text-primary);
font-size: 16px;
font-weight: 800;
line-height: 1;
letter-spacing: 0;
}
.icon-btn {
position: relative;
display: inline-flex;
align-items: center;
justify-content: center;
width: 36px;
height: 36px;
border-radius: 999px;
color: var(--theme-primary-action);
background: color-mix(in srgb, var(--theme-card-bg) 72%, transparent);
box-shadow: 0 10px 24px color-mix(in srgb, var(--theme-primary) 12%, transparent);
}
.icon-btn:hover,
.icon-btn:focus {
color: var(--theme-accent);
background: var(--theme-primary-soft);
}
.icon-btn :deep(.anticon) {
font-size: 18px;
}
.bag-dot {
position: absolute;
top: 10px;
right: 9px;
width: 7px;
height: 7px;
border: 1px solid var(--theme-card-bg);
border-radius: 999px;
background: var(--theme-secondary);
text-overflow: ellipsis;
white-space: nowrap;
}
.gallery-content {
@@ -555,17 +602,17 @@ onMounted(async () => {
.search-panel {
display: grid;
gap: 16px;
margin-bottom: 16px;
gap: 10px;
margin-bottom: 12px;
}
.search-field {
display: grid;
grid-template-columns: 22px minmax(0, 1fr) auto;
align-items: center;
gap: 10px;
min-height: 56px;
padding: 8px 8px 8px 17px;
gap: 8px;
min-height: 46px;
padding: 6px 7px 6px 15px;
border: 1px solid var(--gallery-border);
border-radius: 999px;
background: var(--gallery-surface-strong);
@@ -582,7 +629,7 @@ onMounted(async () => {
.search-field__icon {
color: var(--theme-primary-action);
font-size: 19px;
font-size: 18px;
}
.search-field__input {
@@ -600,9 +647,9 @@ onMounted(async () => {
}
.search-field__action {
min-width: 58px;
height: 38px;
padding: 0 14px;
min-width: 52px;
height: 32px;
padding: 0 12px;
border: 1px solid color-mix(in srgb, var(--theme-primary) 54%, var(--theme-card-bg));
border-radius: 999px;
color: var(--theme-primary-action);
@@ -625,10 +672,10 @@ onMounted(async () => {
.category-rail {
display: flex;
gap: 10px;
gap: 8px;
overflow-x: auto;
overflow-y: hidden;
padding: 1px 0 7px;
padding: 0 0 5px;
scroll-snap-type: x proximity;
scrollbar-width: none;
}
@@ -639,8 +686,8 @@ onMounted(async () => {
.category-item {
flex: 0 0 auto;
min-height: 36px;
padding: 0 18px;
min-height: 30px;
padding: 0 14px;
border: 1px solid var(--gallery-border);
border-radius: 999px;
color: var(--text-secondary);
@@ -922,6 +969,34 @@ onMounted(async () => {
box-shadow: var(--theme-button-shadow);
}
.back-to-top-button {
position: fixed;
right: max(18px, calc((100vw - var(--app-mobile-max-width, 480px)) / 2 + 18px));
bottom: calc(92px + env(safe-area-inset-bottom, 0px));
z-index: 120;
display: inline-grid;
width: 42px;
height: 42px;
place-items: center;
border: 1px solid color-mix(in srgb, var(--theme-primary) 36%, var(--theme-border));
border-radius: 999px;
color: var(--theme-card-bg);
background: var(--theme-primary-action);
box-shadow: 0 14px 34px color-mix(in srgb, var(--theme-primary) 26%, transparent);
cursor: pointer;
transition: transform 0.18s ease, opacity 0.18s ease;
}
.back-to-top-button:hover,
.back-to-top-button:focus {
transform: translateY(-2px);
outline: 0;
}
.back-to-top-button:active {
transform: scale(0.94);
}
@media (max-width: 360px) {
.product-list-page {
--gallery-gutter: 14px;
+37 -10
View File
@@ -287,12 +287,9 @@ import { notifyShopThemeChanged } from '@/utils/shop-theme'
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const router = useRouter()
const USER_INFO_CACHE_KEY = 'userInfo'
/**
* Purpose: userInfo supports ProfileView.vue by holding or executing the user info page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const userInfo = ref<UserVO>({
const createEmptyUserInfo = (): UserVO => ({
id: 0,
nickname: '',
account: '',
@@ -303,6 +300,34 @@ const userInfo = ref<UserVO>({
updateTime: ''
})
const readCachedUserInfo = (): UserVO => {
if (typeof window === 'undefined') {
return createEmptyUserInfo()
}
try {
const raw = localStorage.getItem(USER_INFO_CACHE_KEY)
const cached = raw ? JSON.parse(raw) as Partial<UserVO> : null
return cached && typeof cached === 'object'
? { ...createEmptyUserInfo(), ...cached }
: createEmptyUserInfo()
} catch {
return createEmptyUserInfo()
}
}
const persistCachedUserInfo = (info: UserVO) => {
if (typeof window === 'undefined') {
return
}
localStorage.setItem(USER_INFO_CACHE_KEY, JSON.stringify(info))
}
/**
* Purpose: userInfo supports ProfileView.vue by holding or executing the user info page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const userInfo = ref<UserVO>(readCachedUserInfo())
/** editModalVisible is a reactive state variable used by the template and event handlers. */
const editModalVisible = ref(false)
/** saving is a reactive state variable used by the template and event handlers. */
@@ -416,7 +441,7 @@ const shopOptions = computed(() => {
})
/** currentShopName is a reactive state variable used by the template and event handlers. */
const currentShopName = computed(() => userInfo.value.shopName || '当前门店')
const currentShopName = computed(() => userInfo.value.shopName || userInfo.value.shopNames?.find(Boolean) || '当前门店')
/** shopSwitchTip is a reactive state variable used by the template and event handlers. */
const shopSwitchTip = computed(() => {
if (shopOptions.value.length > 1) {
@@ -516,7 +541,7 @@ const isServiceUser = computed(() => {
const persistUserSession = (payload: any) => {
localStorage.setItem('accessToken', payload.accessToken)
localStorage.setItem('refreshToken', payload.refreshToken)
localStorage.setItem('userInfo', JSON.stringify(payload.userInfo))
localStorage.setItem(USER_INFO_CACHE_KEY, JSON.stringify(payload.userInfo))
sessionStorage.setItem('accessToken', payload.accessToken)
notifyShopThemeChanged()
if (payload.needSetPassword) {
@@ -532,6 +557,7 @@ const fetchUserInfo = async () => {
artistCalendarAccessible.value = false
const response = await userApi.getUserInfo()
userInfo.value = response
persistCachedUserInfo(response)
needSetPassword.value = localStorage.getItem('needSetPassword') === 'true'
selectedShopId.value = response.shopId ? String(response.shopId) : undefined
artistCalendarAccessible.value = response.type === 3
@@ -666,6 +692,7 @@ const handleDeleteAvatar = () => {
try {
await runWithGlobalLoading(() => userApi.updateUserInfo({ avatar: '' }))
userInfo.value.avatar = ''
persistCachedUserInfo(userInfo.value)
message.success('头像删除成功')
} catch (error) {
console.error('删除头像失败:', error)
@@ -829,7 +856,7 @@ const handleLogout = () => {
} finally {
localStorage.removeItem('accessToken')
localStorage.removeItem('refreshToken')
localStorage.removeItem('userInfo')
localStorage.removeItem(USER_INFO_CACHE_KEY)
localStorage.removeItem('needSetPassword')
sessionStorage.removeItem('accessToken')
notifyShopThemeChanged()
@@ -913,7 +940,7 @@ onMounted(async () => {
.profile-topbar h1 {
margin: 2px 0 0;
color: var(--text-primary);
font-size: 24px;
font-size: 18px;
font-weight: 780;
line-height: 1.18;
}
@@ -998,7 +1025,7 @@ onMounted(async () => {
margin: 4px 0 4px;
overflow: hidden;
color: var(--text-primary);
font-size: 22px;
font-size: 20px;
font-weight: 800;
line-height: 1.18;
text-overflow: ellipsis;
@@ -129,7 +129,7 @@ onMounted(loadProgress)
.hero-card, .section-card, .progress-list { border: 1px solid var(--theme-border); border-radius: 20px; background: color-mix(in srgb, var(--theme-card-bg) 88%, transparent); box-shadow: 0 18px 44px rgba(74, 68, 63, 0.08); }
.hero-card { padding: 22px; margin-bottom: 14px; background: var(--theme-gradient-soft); }
.hero-card span { color: var(--theme-primary); font-size: 12px; font-weight: 700; letter-spacing: .05em; }
.hero-card h2 { margin: 10px 0 6px; font-size: 24px; }
.hero-card h2 { margin: 10px 0 6px; font-size: 21px; }
.hero-card p { margin: 0; color: var(--text-secondary); line-height: 1.6; }
.progress-list { display: grid; gap: 0; overflow: hidden; }
.progress-list article { display: flex; gap: 12px; padding: 16px; border-top: 1px solid var(--theme-border); }
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -797,6 +797,12 @@ onMounted(async () => {
color: var(--theme-card-bg);
}
.mobile-icon-btn :deep(.anticon),
.mobile-avatar-btn :deep(.anticon) {
font-size: 21px;
line-height: 1;
}
.mobile-topbar__actions {
display: inline-flex;
align-items: center;
@@ -1016,7 +1022,8 @@ onMounted(async () => {
}
.mobile-tabbar__item :deep(.anticon) {
font-size: 16px;
font-size: 21px;
line-height: 1;
}
.drawer-account {
@@ -398,7 +398,7 @@ const goToFrontend = () => {
}
.login-header h1 {
font-size: clamp(28px, 4vw, 38px);
font-size: clamp(23px, 3.2vw, 28px);
font-weight: 700;
margin: 0 0 8px 0;
}