杂务:整理文档并收口 YumiNail 修复

This commit is contained in:
xiaowang
2026-05-21 18:43:59 +08:00
parent 3797938616
commit 9227ec6175
362 changed files with 8358 additions and 19928 deletions
+57 -21
View File
@@ -96,7 +96,7 @@
</template>
<a-list-item-meta>
<template #avatar>
<div class="menu-icon" :style="{ backgroundColor: item.bgColor }">
<div class="menu-icon" :style="{ backgroundColor: item.bgColor, color: item.iconColor }">
<component :is="item.icon" />
</div>
</template>
@@ -219,6 +219,7 @@ import { buildDraftStorageKey, clearDraftRecord, loadDraftRecord, saveDraftRecor
import { wishlistApi } from '@/api/wishlist'
import { DEFAULT_AVATAR } from '@/constants'
import { runWithGlobalLoading } from '@/utils/action-loading'
import { notifyShopThemeChanged } from '@/utils/shop-theme'
const router = useRouter()
@@ -249,6 +250,8 @@ const orderCount = ref(0)
const couponCount = ref(0)
/** wishlistCount is a reactive state variable used by the template and event handlers. */
const wishlistCount = ref(0)
/** artistCalendarAccessible controls whether the appointment calendar entry is shown. */
const artistCalendarAccessible = ref(false)
/** shopSwitchVisible is a reactive state variable used by the template and event handlers. */
const shopSwitchVisible = ref(false)
/** shopSwitchLoading is a reactive state variable used by the template and event handlers. */
@@ -338,14 +341,16 @@ const coreMenuItems = [
title: '我的订单',
desc: '查看预约状态、取消订单',
icon: ShoppingOutlined,
bgColor: '#e6f7ff'
bgColor: 'var(--theme-primary-soft)',
iconColor: 'var(--theme-primary)'
},
{
key: 'artist-calendar',
title: '预约日历',
desc: '查看未来 7 天属于自己的预约',
icon: CalendarOutlined,
bgColor: '#fff7ed',
bgColor: 'var(--theme-primary-soft)',
iconColor: 'var(--theme-accent)',
serviceOnly: true
},
{
@@ -353,42 +358,51 @@ const coreMenuItems = [
title: '我的收藏',
desc: '快速回到喜欢的作品',
icon: HeartOutlined,
bgColor: '#fff1f0'
bgColor: 'var(--theme-primary-soft)',
iconColor: 'var(--theme-primary)'
},
{
key: 'coupons',
title: '我的优惠券',
desc: '查看可用优惠和 VIP 折扣',
icon: CreditCardOutlined,
bgColor: '#fff7e6'
bgColor: 'var(--theme-primary-soft)',
iconColor: 'var(--theme-accent)'
},
{
key: 'vip',
title: 'VIP 中心',
desc: '查看会员等级、余额和变动记录',
icon: CreditCardOutlined,
bgColor: '#f6f1e8'
bgColor: 'var(--theme-primary-soft)',
iconColor: 'var(--theme-accent)'
},
{
key: 'notifications',
title: '消息通知',
desc: '查看店铺通知和系统消息',
icon: BellOutlined,
bgColor: '#eaf6ff'
bgColor: 'var(--theme-primary-soft)',
iconColor: 'var(--theme-primary)'
},
{
key: 'settings',
title: '设置中心',
desc: '统一管理账号安全和更多入口',
icon: SettingOutlined,
bgColor: '#f9f0ff'
bgColor: 'var(--theme-primary-soft)',
iconColor: 'var(--theme-accent)'
}
]
/** profileMenuItems is a reactive state variable used by the template and event handlers. */
const profileMenuItems = computed(() => {
const canViewArtistCalendar = computed(() => {
const userType = userInfo.value.type
return coreMenuItems.filter((item: any) => !item.serviceOnly || userType === 2 || userType === 3)
return userType === 3 || (userType === 2 && artistCalendarAccessible.value)
})
const profileMenuItems = computed(() => {
return coreMenuItems.filter((item: any) => !item.serviceOnly || canViewArtistCalendar.value)
})
/** isServiceUser is a reactive state variable used by the template and event handlers. */
@@ -403,6 +417,7 @@ const persistUserSession = (payload: any) => {
localStorage.setItem('refreshToken', payload.refreshToken)
localStorage.setItem('userInfo', JSON.stringify(payload.userInfo))
sessionStorage.setItem('accessToken', payload.accessToken)
notifyShopThemeChanged()
if (payload.needSetPassword) {
localStorage.setItem('needSetPassword', 'true')
} else {
@@ -413,10 +428,16 @@ const persistUserSession = (payload: any) => {
/** fetchUserInfo is an async page action. Trigger it from the template or lifecycle hook, then await the result. */
const fetchUserInfo = async () => {
try {
artistCalendarAccessible.value = false
const response = await userApi.getUserInfo()
userInfo.value = response
needSetPassword.value = localStorage.getItem('needSetPassword') === 'true'
selectedShopId.value = response.shopId ? String(response.shopId) : undefined
artistCalendarAccessible.value = response.type === 3
if (response.type === 2) {
const artistInfo = await userApi.getNailArtistInfo(response.id).catch(() => null)
artistCalendarAccessible.value = Number(artistInfo?.participateProduction) === 1
}
} catch (error) {
console.error('获取用户信息失败:', error)
message.error('获取用户信息失败')
@@ -629,6 +650,9 @@ const handleMenuClick = (key: string) => {
if (key === 'orders') {
openOrders()
} else if (key === 'artist-calendar') {
if (!canViewArtistCalendar.value) {
return
}
router.push('/artist-calendar')
} else if (key === 'wishlist') {
router.push('/wishlist')
@@ -662,6 +686,7 @@ const handleLogout = () => {
localStorage.removeItem('userInfo')
localStorage.removeItem('needSetPassword')
sessionStorage.removeItem('accessToken')
notifyShopThemeChanged()
message.success('已退出登录')
router.push('/')
}
@@ -690,7 +715,12 @@ onMounted(async () => {
.mobile-container {
padding-top: 60px;
min-height: 100vh;
background: #f5f5f5;
background:
linear-gradient(rgba(255, 255, 255, 0.68), rgba(255, 255, 255, 0.92)),
var(--theme-background-image),
var(--theme-page-bg);
background-size: cover, cover, auto;
background-position: center top;
position: relative;
}
@@ -700,7 +730,7 @@ onMounted(async () => {
left: 0;
right: 0;
height: 200px;
background: linear-gradient(135deg, #667eea 0%, #764ba2 45%, #f093fb 100%);
background: var(--theme-gradient);
z-index: 0;
}
@@ -782,7 +812,7 @@ onMounted(async () => {
margin-top: 24px;
padding: 18px;
border-radius: 18px;
background: linear-gradient(135deg, #f5f7ff 0%, #e8ecff 100%);
background: var(--theme-gradient-soft);
cursor: pointer;
}
@@ -793,7 +823,7 @@ onMounted(async () => {
align-items: center;
justify-content: center;
border-radius: 14px;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
background: var(--theme-gradient);
}
.shop-icon {
@@ -825,7 +855,8 @@ onMounted(async () => {
}
.shop-arrow {
color: #c4c4d0;
color: #76768a;
font-size: 16px;
}
.password-tip {
@@ -864,15 +895,15 @@ onMounted(async () => {
}
.stat-icon.orders {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
background: var(--theme-gradient);
}
.stat-icon.wishlist {
background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
background: linear-gradient(135deg, var(--theme-accent) 0%, var(--theme-primary) 100%);
}
.stat-icon.coupons {
background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
background: linear-gradient(135deg, var(--theme-secondary) 0%, var(--theme-primary) 100%);
}
.menu-card :deep(.ant-card-body) {
@@ -897,7 +928,12 @@ onMounted(async () => {
align-items: center;
justify-content: center;
font-size: 20px;
color: white;
font-weight: 700;
}
.menu-item :deep(.ant-list-item-action .anticon) {
color: #76768a;
font-size: 14px;
}
.logout-section :deep(.ant-btn-dangerous) {
@@ -916,7 +952,7 @@ onMounted(async () => {
.upload-hint {
font-size: 12px;
color: #667eea;
color: var(--theme-primary);
}
.avatar-upload-progress {
@@ -926,7 +962,7 @@ onMounted(async () => {
.avatar-upload-status {
font-size: 12px;
color: #fa8c16;
color: var(--theme-accent);
}
.shop-option-group {