功能:更新消息中心和 YumiNail 模块
This commit is contained in:
@@ -0,0 +1,914 @@
|
||||
<template>
|
||||
<div class="mobile-container">
|
||||
<div class="header-bg"></div>
|
||||
|
||||
<header class="header">
|
||||
<h1>个人中心</h1>
|
||||
<a-button class="settings-btn" type="text" @click="handleSettingsClick">
|
||||
<SettingOutlined :style="{ fontSize: '20px' }" />
|
||||
</a-button>
|
||||
</header>
|
||||
|
||||
<div class="profile-info">
|
||||
<a-card :bordered="false" class="profile-card">
|
||||
<div class="avatar-section">
|
||||
<a-badge :dot="hasNotification" :offset="[-5, 5]">
|
||||
<a-avatar :size="90" :src="userInfo.avatar || DEFAULT_AVATAR" class="user-avatar" />
|
||||
</a-badge>
|
||||
<div class="user-details">
|
||||
<h2 class="username">{{ userInfo.nickname || '用户' }}</h2>
|
||||
<p class="account">{{ userInfo.account }}</p>
|
||||
<p class="signature" v-if="userInfo.signature">{{ userInfo.signature }}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="shop-card" @click="handleShopCardClick">
|
||||
<div class="shop-icon-wrapper">
|
||||
<ShopOutlined class="shop-icon" />
|
||||
</div>
|
||||
<div class="shop-content">
|
||||
<p class="shop-label">当前登录门店</p>
|
||||
<h3 class="shop-name">{{ currentShopName }}</h3>
|
||||
<p class="shop-tip">{{ shopSwitchTip }}</p>
|
||||
</div>
|
||||
<div class="shop-arrow">
|
||||
<RightOutlined />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="needSetPassword" class="password-tip">
|
||||
<a-alert
|
||||
type="warning"
|
||||
message="建议尽快设置密码"
|
||||
description="当前账号还未设置登录密码。"
|
||||
show-icon
|
||||
>
|
||||
<template #action>
|
||||
<a-button size="small" type="primary" @click="handleSetPassword">去设置</a-button>
|
||||
</template>
|
||||
</a-alert>
|
||||
</div>
|
||||
|
||||
<a-button type="primary" block @click="handleEditProfile" class="edit-btn">
|
||||
编辑资料
|
||||
</a-button>
|
||||
</a-card>
|
||||
</div>
|
||||
|
||||
<div class="stats-section">
|
||||
<a-card :bordered="false" class="stats-card">
|
||||
<a-row :gutter="16">
|
||||
<a-col :span="8">
|
||||
<div class="stat-item" @click="router.push('/orders')">
|
||||
<div class="stat-icon orders">
|
||||
<ShoppingOutlined />
|
||||
</div>
|
||||
<a-statistic title="订单" :value="orderCount" />
|
||||
</div>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<div class="stat-item" @click="router.push('/wishlist')">
|
||||
<div class="stat-icon wishlist">
|
||||
<HeartOutlined />
|
||||
</div>
|
||||
<a-statistic title="收藏" :value="wishlistCount" />
|
||||
</div>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<div class="stat-item" @click="router.push('/coupons')">
|
||||
<div class="stat-icon coupons">
|
||||
<CreditCardOutlined />
|
||||
</div>
|
||||
<a-statistic title="优惠券" :value="couponCount" />
|
||||
</div>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-card>
|
||||
</div>
|
||||
|
||||
<div class="menu-section">
|
||||
<a-card :bordered="false" class="menu-card">
|
||||
<a-list :data-source="coreMenuItems" :split="false">
|
||||
<template #renderItem="{ item }">
|
||||
<a-list-item class="menu-item" @click="handleMenuClick(item.key)">
|
||||
<template #actions>
|
||||
<RightOutlined />
|
||||
</template>
|
||||
<a-list-item-meta>
|
||||
<template #avatar>
|
||||
<div class="menu-icon" :style="{ backgroundColor: item.bgColor }">
|
||||
<component :is="item.icon" />
|
||||
</div>
|
||||
</template>
|
||||
<template #title>
|
||||
<span>{{ item.title }}</span>
|
||||
</template>
|
||||
<template #description v-if="item.desc">
|
||||
<span>{{ item.desc }}</span>
|
||||
</template>
|
||||
</a-list-item-meta>
|
||||
</a-list-item>
|
||||
</template>
|
||||
</a-list>
|
||||
</a-card>
|
||||
</div>
|
||||
|
||||
<div class="logout-section">
|
||||
<a-button danger block @click="handleLogout">
|
||||
退出登录
|
||||
</a-button>
|
||||
</div>
|
||||
|
||||
<a-modal
|
||||
v-model:open="editModalVisible"
|
||||
title="编辑资料"
|
||||
@ok="handleSaveProfile"
|
||||
@cancel="handleCancelEdit"
|
||||
:confirmLoading="saving"
|
||||
:ok-button-props="{ disabled: avatarUploadPending }"
|
||||
>
|
||||
<DraftActions
|
||||
:saved-at="draftSavedAt"
|
||||
:disabled="avatarUploadPending"
|
||||
@save="handleSaveDraft"
|
||||
@clear="handleClearDraft"
|
||||
/>
|
||||
<a-form layout="vertical">
|
||||
<a-form-item label="头像">
|
||||
<div class="avatar-upload-section">
|
||||
<a-upload
|
||||
name="file"
|
||||
:show-upload-list="false"
|
||||
:before-upload="beforeUploadAvatar"
|
||||
:custom-request="handleAvatarUpload"
|
||||
accept="image/*"
|
||||
>
|
||||
<a-avatar :size="80" :src="editForm.avatar || DEFAULT_AVATAR" />
|
||||
<div class="upload-hint">点击更换头像</div>
|
||||
</a-upload>
|
||||
<a-progress
|
||||
v-if="avatarUploadPending"
|
||||
:percent="Math.round(avatarUploadProgress)"
|
||||
size="small"
|
||||
status="active"
|
||||
class="avatar-upload-progress"
|
||||
/>
|
||||
<div v-if="avatarUploadPending" class="avatar-upload-status">头像上传中,上传完成前不可保存。</div>
|
||||
<a-button v-if="editForm.avatar" type="text" danger size="small" @click="handleDeleteAvatar">
|
||||
删除头像
|
||||
</a-button>
|
||||
</div>
|
||||
</a-form-item>
|
||||
<a-form-item label="昵称">
|
||||
<a-input v-model:value="editForm.nickname" placeholder="请输入昵称" />
|
||||
</a-form-item>
|
||||
<a-form-item label="个性签名">
|
||||
<a-textarea v-model:value="editForm.signature" placeholder="请输入个性签名" :rows="3" />
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</a-modal>
|
||||
|
||||
<a-modal
|
||||
v-model:open="shopSwitchVisible"
|
||||
title="切换登录门店"
|
||||
:confirm-loading="shopSwitchLoading"
|
||||
@ok="handleConfirmSwitchShop"
|
||||
>
|
||||
<a-radio-group v-model:value="selectedShopId" class="shop-option-group">
|
||||
<a-radio
|
||||
v-for="shop in shopOptions"
|
||||
:key="String(shop.id)"
|
||||
:value="String(shop.id)"
|
||||
class="shop-option"
|
||||
>
|
||||
<div class="shop-option-name">{{ shop.shopName }}</div>
|
||||
</a-radio>
|
||||
</a-radio-group>
|
||||
<a-empty v-if="!shopOptions.length" description="当前账号没有可切换的门店" />
|
||||
</a-modal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, reactive, ref } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import {
|
||||
BellOutlined,
|
||||
CreditCardOutlined,
|
||||
HeartOutlined,
|
||||
QuestionCircleOutlined,
|
||||
RightOutlined,
|
||||
SettingOutlined,
|
||||
ShopOutlined,
|
||||
ShoppingOutlined
|
||||
} from '@ant-design/icons-vue'
|
||||
import { message, Modal } from 'ant-design-vue'
|
||||
import type { UploadProps } from 'ant-design-vue'
|
||||
import DraftActions from '@/components/DraftActions.vue'
|
||||
import { authApi } from '@/api/auth'
|
||||
import { couponApi } from '@/api/coupon'
|
||||
import { fileApi } from '@/api/file'
|
||||
import { orderApi } from '@/api/order'
|
||||
import { userApi, type UserVO } from '@/api/user'
|
||||
import { createChunkUploadTask, type ChunkUploadTask } from '@/utils/chunk-upload'
|
||||
import { buildDraftStorageKey, clearDraftRecord, loadDraftRecord, saveDraftRecord } from '@/utils/form-draft'
|
||||
import { wishlistApi } from '@/api/wishlist'
|
||||
import { DEFAULT_AVATAR } from '@/constants'
|
||||
import { runWithGlobalLoading } from '@/utils/action-loading'
|
||||
|
||||
const router = useRouter()
|
||||
|
||||
const userInfo = ref<UserVO>({
|
||||
id: 0,
|
||||
nickname: '',
|
||||
account: '',
|
||||
avatar: '',
|
||||
type: 0,
|
||||
status: 0,
|
||||
createTime: '',
|
||||
updateTime: ''
|
||||
})
|
||||
|
||||
const editModalVisible = ref(false)
|
||||
const saving = ref(false)
|
||||
const needSetPassword = ref(false)
|
||||
const hasNotification = ref(false)
|
||||
const orderCount = ref(0)
|
||||
const couponCount = ref(0)
|
||||
const wishlistCount = ref(0)
|
||||
const shopSwitchVisible = ref(false)
|
||||
const shopSwitchLoading = ref(false)
|
||||
const selectedShopId = ref<string>()
|
||||
const avatarUploadProgress = ref(0)
|
||||
const avatarUploadPending = ref(false)
|
||||
let avatarUploadTask: ChunkUploadTask<string> | null = null
|
||||
const draftSavedAt = ref<number | null>(null)
|
||||
|
||||
const editForm = reactive({
|
||||
nickname: '',
|
||||
avatar: '',
|
||||
signature: ''
|
||||
})
|
||||
|
||||
const getDraftKey = () => buildDraftStorageKey('profile-edit')
|
||||
|
||||
const buildDraftPayload = () => ({
|
||||
nickname: editForm.nickname,
|
||||
avatar: editForm.avatar,
|
||||
signature: editForm.signature
|
||||
})
|
||||
|
||||
const restoreDraft = () => {
|
||||
const draft = loadDraftRecord<ReturnType<typeof buildDraftPayload>>(getDraftKey())
|
||||
if (!draft) {
|
||||
draftSavedAt.value = null
|
||||
return
|
||||
}
|
||||
Object.assign(editForm, draft.payload)
|
||||
draftSavedAt.value = draft.savedAt
|
||||
message.success('已恢复暂存内容')
|
||||
}
|
||||
|
||||
const handleSaveDraft = () => {
|
||||
if (avatarUploadPending.value) {
|
||||
message.warning('头像上传完成后才能暂存')
|
||||
return
|
||||
}
|
||||
const draft = saveDraftRecord(getDraftKey(), buildDraftPayload())
|
||||
draftSavedAt.value = draft.savedAt
|
||||
message.success('已暂存到本地')
|
||||
}
|
||||
|
||||
const handleClearDraft = (showMessage = true) => {
|
||||
clearDraftRecord(getDraftKey())
|
||||
draftSavedAt.value = null
|
||||
if (showMessage) {
|
||||
message.success('已清除暂存')
|
||||
}
|
||||
}
|
||||
|
||||
const shopOptions = computed(() => {
|
||||
const ids = userInfo.value.shopIds || []
|
||||
const names = userInfo.value.shopNames || []
|
||||
return ids.map((id, index) => ({
|
||||
id,
|
||||
shopName: names[index] || `门店 ${id}`
|
||||
}))
|
||||
})
|
||||
|
||||
const currentShopName = computed(() => userInfo.value.shopName || '当前暂无可用门店')
|
||||
const shopSwitchTip = computed(() => {
|
||||
if (shopOptions.value.length > 1) {
|
||||
return `可切换 ${shopOptions.value.length} 家门店`
|
||||
}
|
||||
if (shopOptions.value.length === 1) {
|
||||
return '点击查看当前门店详情'
|
||||
}
|
||||
return '当前暂无可用门店'
|
||||
})
|
||||
|
||||
const menuItems = [
|
||||
{
|
||||
key: 'orders',
|
||||
title: '我的订单',
|
||||
desc: '查看预约状态、取消订单',
|
||||
icon: ShoppingOutlined,
|
||||
bgColor: '#e6f7ff'
|
||||
},
|
||||
{
|
||||
key: 'wishlist',
|
||||
title: '我的收藏',
|
||||
desc: '快速回到喜欢的作品',
|
||||
icon: HeartOutlined,
|
||||
bgColor: '#fff1f0'
|
||||
},
|
||||
{
|
||||
key: 'coupons',
|
||||
title: '我的优惠券',
|
||||
desc: '查看可用优惠和 VIP 折扣',
|
||||
icon: CreditCardOutlined,
|
||||
bgColor: '#fff7e6'
|
||||
},
|
||||
{
|
||||
key: 'notifications',
|
||||
title: '消息通知',
|
||||
desc: '消息中心功能开发中',
|
||||
icon: BellOutlined,
|
||||
bgColor: '#f9f0ff'
|
||||
},
|
||||
{
|
||||
key: 'help',
|
||||
title: '帮助与支持',
|
||||
desc: '常见问题功能开发中',
|
||||
icon: QuestionCircleOutlined,
|
||||
bgColor: '#eef9ff'
|
||||
}
|
||||
]
|
||||
|
||||
void menuItems
|
||||
|
||||
const coreMenuItems = [
|
||||
{
|
||||
key: 'orders',
|
||||
title: '我的订单',
|
||||
desc: '查看预约状态、取消订单',
|
||||
icon: ShoppingOutlined,
|
||||
bgColor: '#e6f7ff'
|
||||
},
|
||||
{
|
||||
key: 'wishlist',
|
||||
title: '我的收藏',
|
||||
desc: '快速回到喜欢的作品',
|
||||
icon: HeartOutlined,
|
||||
bgColor: '#fff1f0'
|
||||
},
|
||||
{
|
||||
key: 'coupons',
|
||||
title: '我的优惠券',
|
||||
desc: '查看可用优惠和 VIP 折扣',
|
||||
icon: CreditCardOutlined,
|
||||
bgColor: '#fff7e6'
|
||||
},
|
||||
{
|
||||
key: 'settings',
|
||||
title: '设置中心',
|
||||
desc: '统一管理账号安全和更多入口',
|
||||
icon: SettingOutlined,
|
||||
bgColor: '#f9f0ff'
|
||||
}
|
||||
]
|
||||
|
||||
const persistUserSession = (payload: any) => {
|
||||
localStorage.setItem('accessToken', payload.accessToken)
|
||||
localStorage.setItem('refreshToken', payload.refreshToken)
|
||||
localStorage.setItem('userInfo', JSON.stringify(payload.userInfo))
|
||||
sessionStorage.setItem('accessToken', payload.accessToken)
|
||||
if (payload.needSetPassword) {
|
||||
localStorage.setItem('needSetPassword', 'true')
|
||||
} else {
|
||||
localStorage.removeItem('needSetPassword')
|
||||
}
|
||||
}
|
||||
|
||||
const fetchUserInfo = async () => {
|
||||
try {
|
||||
const response = await userApi.getUserInfo()
|
||||
userInfo.value = response
|
||||
needSetPassword.value = localStorage.getItem('needSetPassword') === 'true'
|
||||
selectedShopId.value = response.shopId ? String(response.shopId) : undefined
|
||||
} catch (error) {
|
||||
console.error('获取用户信息失败:', error)
|
||||
message.error('获取用户信息失败')
|
||||
}
|
||||
}
|
||||
|
||||
const loadCounts = async () => {
|
||||
try {
|
||||
const [orders, coupons, wishlist] = await Promise.all([
|
||||
orderApi.getOrderList(),
|
||||
couponApi.listUserCoupons(),
|
||||
wishlistApi.getWishlist()
|
||||
])
|
||||
orderCount.value = Array.isArray(orders) ? orders.length : 0
|
||||
couponCount.value = Array.isArray(coupons) ? coupons.length : 0
|
||||
wishlistCount.value = Array.isArray(wishlist) ? wishlist.length : 0
|
||||
} catch (error) {
|
||||
console.error('加载个人中心统计失败:', error)
|
||||
}
|
||||
}
|
||||
|
||||
const handleEditProfile = () => {
|
||||
avatarUploadTask?.cancel()
|
||||
avatarUploadTask = null
|
||||
avatarUploadPending.value = false
|
||||
avatarUploadProgress.value = 0
|
||||
editForm.nickname = userInfo.value.nickname || ''
|
||||
editForm.avatar = userInfo.value.avatar || ''
|
||||
editForm.signature = userInfo.value.signature || ''
|
||||
restoreDraft()
|
||||
editModalVisible.value = true
|
||||
}
|
||||
|
||||
const beforeUploadAvatar: UploadProps['beforeUpload'] = file => {
|
||||
const isImage = file.type.startsWith('image/')
|
||||
const isLt20M = file.size / 1024 / 1024 < 20
|
||||
|
||||
if (!isImage) {
|
||||
message.error('只能上传图片文件')
|
||||
}
|
||||
if (!isLt20M) {
|
||||
message.error('图片大小不能超过 20MB')
|
||||
}
|
||||
return isImage && isLt20M
|
||||
}
|
||||
|
||||
const handleAvatarUpload = async (options: any) => {
|
||||
const { file, onProgress, onSuccess, onError } = options
|
||||
|
||||
avatarUploadTask?.cancel()
|
||||
avatarUploadProgress.value = 0
|
||||
avatarUploadPending.value = true
|
||||
|
||||
const task = createChunkUploadTask({
|
||||
file: file as File,
|
||||
scene: 'profile-avatar',
|
||||
api: {
|
||||
initUpload: fileApi.initAvatarChunkUpload,
|
||||
uploadChunk: fileApi.uploadAvatarChunk,
|
||||
completeUpload: fileApi.completeAvatarChunkUpload,
|
||||
cancelUpload: fileApi.cancelAvatarChunkUpload
|
||||
},
|
||||
onProgress: (percent) => {
|
||||
avatarUploadProgress.value = percent
|
||||
onProgress?.({ percent })
|
||||
}
|
||||
})
|
||||
|
||||
avatarUploadTask = task
|
||||
|
||||
try {
|
||||
const { response } = await task.promise
|
||||
editForm.avatar = response as unknown as string
|
||||
avatarUploadProgress.value = 100
|
||||
onSuccess?.({ url: response })
|
||||
message.success('头像上传成功')
|
||||
} catch (error) {
|
||||
const errorMessage = (error as Error)?.message || '头像上传失败'
|
||||
if (errorMessage !== '上传已取消' && errorMessage !== 'canceled') {
|
||||
console.error('头像上传失败:', error)
|
||||
message.error(errorMessage)
|
||||
onError?.(error)
|
||||
}
|
||||
} finally {
|
||||
if (avatarUploadTask === task) {
|
||||
avatarUploadTask = null
|
||||
avatarUploadPending.value = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const handleDeleteAvatar = () => {
|
||||
Modal.confirm({
|
||||
title: '确认删除头像',
|
||||
content: '删除后会恢复为默认头像。',
|
||||
okText: '确认',
|
||||
cancelText: '取消',
|
||||
onOk: async () => {
|
||||
editForm.avatar = ''
|
||||
try {
|
||||
await runWithGlobalLoading(() => userApi.updateUserInfo({ avatar: '' }))
|
||||
userInfo.value.avatar = ''
|
||||
message.success('头像删除成功')
|
||||
} catch (error) {
|
||||
console.error('删除头像失败:', error)
|
||||
message.error('删除头像失败')
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const handleSaveProfile = async () => {
|
||||
if (!editForm.nickname.trim()) {
|
||||
message.error('请输入昵称')
|
||||
return
|
||||
}
|
||||
|
||||
if (avatarUploadPending.value) {
|
||||
message.warning('头像上传完成前不可保存')
|
||||
return
|
||||
}
|
||||
|
||||
saving.value = true
|
||||
try {
|
||||
await runWithGlobalLoading(async () => {
|
||||
await userApi.updateUserInfo({
|
||||
nickname: editForm.nickname,
|
||||
avatar: editForm.avatar,
|
||||
signature: editForm.signature
|
||||
})
|
||||
await fetchUserInfo()
|
||||
})
|
||||
message.success('资料更新成功')
|
||||
handleClearDraft(false)
|
||||
editModalVisible.value = false
|
||||
} catch (error) {
|
||||
console.error('保存资料失败:', error)
|
||||
message.error('保存资料失败')
|
||||
} finally {
|
||||
saving.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const handleCancelEdit = () => {
|
||||
avatarUploadTask?.cancel()
|
||||
avatarUploadTask = null
|
||||
avatarUploadPending.value = false
|
||||
avatarUploadProgress.value = 0
|
||||
editModalVisible.value = false
|
||||
}
|
||||
|
||||
const handleShopCardClick = () => {
|
||||
if (shopOptions.value.length > 1) {
|
||||
shopSwitchVisible.value = true
|
||||
return
|
||||
}
|
||||
if (userInfo.value.shopId) {
|
||||
router.push(`/shop/${userInfo.value.shopId}`)
|
||||
return
|
||||
}
|
||||
message.info('当前暂无可用门店')
|
||||
}
|
||||
|
||||
const handleConfirmSwitchShop = async () => {
|
||||
if (!selectedShopId.value) {
|
||||
message.warning('请选择要切换的门店')
|
||||
return
|
||||
}
|
||||
if (String(userInfo.value.shopId || '') === selectedShopId.value) {
|
||||
shopSwitchVisible.value = false
|
||||
return
|
||||
}
|
||||
|
||||
shopSwitchLoading.value = true
|
||||
try {
|
||||
await runWithGlobalLoading(async () => {
|
||||
const response = await authApi.switchShop({ shopId: selectedShopId.value })
|
||||
persistUserSession(response as any)
|
||||
await Promise.all([fetchUserInfo(), loadCounts()])
|
||||
})
|
||||
message.success('门店已切换')
|
||||
shopSwitchVisible.value = false
|
||||
} catch (error: any) {
|
||||
console.error('切换门店失败:', error)
|
||||
message.error(error?.message || '切换门店失败')
|
||||
} finally {
|
||||
shopSwitchLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const handleMenuClick = (key: string) => {
|
||||
if (key === 'orders') {
|
||||
router.push('/orders')
|
||||
} else if (key === 'wishlist') {
|
||||
router.push('/wishlist')
|
||||
} else if (key === 'coupons') {
|
||||
router.push('/coupons')
|
||||
} else if (key === 'settings') {
|
||||
router.push('/settings')
|
||||
} else if (key === 'notifications') {
|
||||
message.info('消息通知功能开发中')
|
||||
} else if (key === 'help') {
|
||||
message.info('帮助中心功能开发中')
|
||||
}
|
||||
}
|
||||
|
||||
const handleLogout = () => {
|
||||
Modal.confirm({
|
||||
title: '确认退出登录',
|
||||
content: '退出后需要重新登录才能继续下单和查看订单。',
|
||||
okText: '确认',
|
||||
cancelText: '取消',
|
||||
onOk: async () => {
|
||||
await runWithGlobalLoading(async () => {
|
||||
try {
|
||||
await authApi.logout()
|
||||
} catch (error) {
|
||||
console.error('退出登录接口调用失败:', error)
|
||||
} finally {
|
||||
localStorage.removeItem('accessToken')
|
||||
localStorage.removeItem('refreshToken')
|
||||
localStorage.removeItem('userInfo')
|
||||
localStorage.removeItem('needSetPassword')
|
||||
sessionStorage.removeItem('accessToken')
|
||||
message.success('已退出登录')
|
||||
router.push('/')
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const handleSettingsClick = () => {
|
||||
router.push('/settings')
|
||||
}
|
||||
|
||||
const handleSetPassword = () => {
|
||||
router.push('/settings/password')
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
await Promise.all([fetchUserInfo(), loadCounts()])
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.mobile-container {
|
||||
padding-top: 60px;
|
||||
min-height: 100vh;
|
||||
background: #f5f5f5;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.header-bg {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 200px;
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 45%, #f093fb 100%);
|
||||
z-index: 0;
|
||||
}
|
||||
|
||||
.header {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 100;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 10px 15px;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.header h1 {
|
||||
margin: 0;
|
||||
font-size: 18px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.settings-btn {
|
||||
color: white;
|
||||
}
|
||||
|
||||
.profile-info,
|
||||
.stats-section,
|
||||
.menu-section,
|
||||
.logout-section {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
padding: 0 15px 15px;
|
||||
}
|
||||
|
||||
.profile-info {
|
||||
padding-top: 15px;
|
||||
}
|
||||
|
||||
.profile-card,
|
||||
.stats-card,
|
||||
.menu-card {
|
||||
border-radius: 22px;
|
||||
box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
|
||||
}
|
||||
|
||||
.profile-card :deep(.ant-card-body) {
|
||||
padding: 28px 24px 24px;
|
||||
}
|
||||
|
||||
.avatar-section {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 18px;
|
||||
}
|
||||
|
||||
.user-avatar {
|
||||
border: 4px solid white;
|
||||
}
|
||||
|
||||
.username {
|
||||
margin: 0 0 6px;
|
||||
font-size: 24px;
|
||||
font-weight: 700;
|
||||
color: #1a1a2e;
|
||||
}
|
||||
|
||||
.account,
|
||||
.signature {
|
||||
margin: 0;
|
||||
color: #7c7c8a;
|
||||
line-height: 1.7;
|
||||
}
|
||||
|
||||
.shop-card {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 14px;
|
||||
margin-top: 24px;
|
||||
padding: 18px;
|
||||
border-radius: 18px;
|
||||
background: linear-gradient(135deg, #f5f7ff 0%, #e8ecff 100%);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.shop-icon-wrapper {
|
||||
width: 52px;
|
||||
height: 52px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: 14px;
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
}
|
||||
|
||||
.shop-icon {
|
||||
font-size: 24px;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.shop-content {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.shop-label {
|
||||
margin: 0 0 4px;
|
||||
font-size: 12px;
|
||||
color: #8b8b9a;
|
||||
}
|
||||
|
||||
.shop-name {
|
||||
margin: 0;
|
||||
font-size: 18px;
|
||||
font-weight: 700;
|
||||
color: #1a1a2e;
|
||||
}
|
||||
|
||||
.shop-tip {
|
||||
margin: 6px 0 0;
|
||||
color: #6b6b7a;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.shop-arrow {
|
||||
color: #c4c4d0;
|
||||
}
|
||||
|
||||
.password-tip {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.edit-btn {
|
||||
margin-top: 20px;
|
||||
height: 48px;
|
||||
border-radius: 14px;
|
||||
font-size: 15px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.stats-card :deep(.ant-card-body) {
|
||||
padding: 20px 16px;
|
||||
}
|
||||
|
||||
.stat-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.stat-icon {
|
||||
width: 52px;
|
||||
height: 52px;
|
||||
border-radius: 16px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 24px;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.stat-icon.orders {
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
}
|
||||
|
||||
.stat-icon.wishlist {
|
||||
background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
|
||||
}
|
||||
|
||||
.stat-icon.coupons {
|
||||
background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
|
||||
}
|
||||
|
||||
.menu-card :deep(.ant-card-body) {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.menu-item {
|
||||
padding: 18px 16px;
|
||||
cursor: pointer;
|
||||
border-bottom: 1px solid #f5f5f7;
|
||||
}
|
||||
|
||||
.menu-item:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.menu-icon {
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
border-radius: 12px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 20px;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.logout-section :deep(.ant-btn-dangerous) {
|
||||
height: 50px;
|
||||
border-radius: 25px;
|
||||
font-weight: 700;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.avatar-upload-section {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.upload-hint {
|
||||
font-size: 12px;
|
||||
color: #667eea;
|
||||
}
|
||||
|
||||
.avatar-upload-progress {
|
||||
width: 220px;
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
.avatar-upload-status {
|
||||
font-size: 12px;
|
||||
color: #fa8c16;
|
||||
}
|
||||
|
||||
.shop-option-group {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.shop-option {
|
||||
margin: 0;
|
||||
padding: 12px 14px;
|
||||
border: 1px solid #e8ecff;
|
||||
border-radius: 14px;
|
||||
}
|
||||
|
||||
.shop-option-name {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
@media (min-width: 992px) {
|
||||
.profile-info,
|
||||
.stats-section,
|
||||
.menu-section,
|
||||
.logout-section {
|
||||
max-width: var(--frontend-content-max-width);
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user