2026-02-13 17:34:32 +08:00
|
|
|
<template>
|
|
|
|
|
<div class="mobile-container">
|
|
|
|
|
|
|
|
|
|
<!-- 头部区域 -->
|
|
|
|
|
<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="80" src="https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png" />
|
|
|
|
|
</a-badge>
|
|
|
|
|
<div class="user-details">
|
|
|
|
|
<h2 class="username">昵称</h2>
|
|
|
|
|
<p class="email">user@example.com</p>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<a-button type="primary" block @click="handleEditProfile">
|
|
|
|
|
编辑资料
|
|
|
|
|
</a-button>
|
|
|
|
|
</a-card>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- 统计数据 -->
|
|
|
|
|
<div class="stats-section">
|
|
|
|
|
<a-row :gutter="16">
|
|
|
|
|
<a-col :span="8">
|
|
|
|
|
<a-statistic title="订单" :value="12" />
|
|
|
|
|
</a-col>
|
|
|
|
|
<a-col :span="8">
|
|
|
|
|
<a-statistic title="收藏" :value="5" />
|
|
|
|
|
</a-col>
|
|
|
|
|
<a-col :span="8">
|
|
|
|
|
<a-statistic title="优惠券" :value="3" />
|
|
|
|
|
</a-col>
|
|
|
|
|
</a-row>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- 菜单列表 -->
|
|
|
|
|
<div class="menu-section">
|
|
|
|
|
<a-card :bordered="false" class="menu-card">
|
|
|
|
|
<a-list :data-source="menuItems" :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>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
2026-02-24 09:59:22 +08:00
|
|
|
import { ref } from 'vue'
|
2026-02-13 17:34:32 +08:00
|
|
|
import { useRouter } from 'vue-router'
|
|
|
|
|
import {
|
|
|
|
|
SettingOutlined,
|
|
|
|
|
RightOutlined,
|
|
|
|
|
ShoppingOutlined,
|
|
|
|
|
HeartOutlined,
|
|
|
|
|
EnvironmentOutlined,
|
|
|
|
|
CreditCardOutlined,
|
|
|
|
|
BellOutlined,
|
|
|
|
|
QuestionCircleOutlined
|
|
|
|
|
} from '@ant-design/icons-vue'
|
|
|
|
|
import { message } from 'ant-design-vue'
|
|
|
|
|
|
|
|
|
|
const router = useRouter()
|
|
|
|
|
|
|
|
|
|
// 是否有未读通知
|
|
|
|
|
const hasNotification = ref(true)
|
|
|
|
|
|
|
|
|
|
// 菜单项数据
|
|
|
|
|
const menuItems = ref([
|
|
|
|
|
{
|
|
|
|
|
key: 'orders',
|
|
|
|
|
title: '我的订单',
|
|
|
|
|
icon: ShoppingOutlined,
|
|
|
|
|
bgColor: '#e6f7ff'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key: 'wishlist',
|
|
|
|
|
title: '我的收藏',
|
|
|
|
|
icon: HeartOutlined,
|
|
|
|
|
bgColor: '#fff1f0'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key: 'address',
|
|
|
|
|
title: '收货地址',
|
|
|
|
|
icon: EnvironmentOutlined,
|
|
|
|
|
bgColor: '#f6ffed'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key: 'payment',
|
|
|
|
|
title: '支付方式',
|
|
|
|
|
icon: CreditCardOutlined,
|
|
|
|
|
bgColor: '#fff7e6'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key: 'notifications',
|
|
|
|
|
title: '消息通知',
|
|
|
|
|
desc: '3条未读',
|
|
|
|
|
icon: BellOutlined,
|
|
|
|
|
bgColor: '#f9f0ff'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key: 'help',
|
|
|
|
|
title: '帮助与支持',
|
|
|
|
|
icon: QuestionCircleOutlined,
|
|
|
|
|
bgColor: '#e6f7ff'
|
|
|
|
|
}
|
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
// 处理编辑资料点击
|
|
|
|
|
const handleEditProfile = () => {
|
|
|
|
|
console.log('编辑个人资料被点击')
|
|
|
|
|
message.info('编辑功能开发中...')
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 处理菜单项点击
|
|
|
|
|
const handleMenuClick = (key: string) => {
|
|
|
|
|
console.log('菜单项被点击:', key)
|
|
|
|
|
if (key === 'wishlist') {
|
|
|
|
|
router.push('/wishlist')
|
|
|
|
|
} else if (key === 'orders') {
|
|
|
|
|
message.info('订单功能开发中...')
|
|
|
|
|
} else if (key === 'address') {
|
|
|
|
|
message.info('地址管理功能开发中...')
|
|
|
|
|
} else if (key === 'payment') {
|
|
|
|
|
message.info('支付方式功能开发中...')
|
|
|
|
|
} else if (key === 'notifications') {
|
|
|
|
|
message.info('消息通知功能开发中...')
|
|
|
|
|
} else if (key === 'help') {
|
|
|
|
|
message.info('帮助中心功能开发中...')
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 处理退出登录
|
|
|
|
|
const handleLogout = () => {
|
|
|
|
|
console.log('退出登录被点击')
|
|
|
|
|
message.success('已退出登录')
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 处理设置图标点击
|
|
|
|
|
const handleSettingsClick = () => {
|
|
|
|
|
console.log('设置图标被点击')
|
|
|
|
|
router.push('/settings')
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
.mobile-container {
|
|
|
|
|
padding-top: 60px;
|
|
|
|
|
min-height: 100vh;
|
|
|
|
|
background: #f5f5f5;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.header {
|
|
|
|
|
position: fixed;
|
|
|
|
|
top: 0;
|
|
|
|
|
left: 0;
|
|
|
|
|
right: 0;
|
|
|
|
|
z-index: 100;
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
align-items: center;
|
|
|
|
|
padding: 10px 15px;
|
|
|
|
|
border-bottom: 1px solid #f0f0f0;
|
|
|
|
|
background: white;
|
|
|
|
|
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.header h1 {
|
|
|
|
|
font-size: 18px;
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
margin: 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.settings-btn {
|
|
|
|
|
width: 40px;
|
|
|
|
|
height: 40px;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.profile-info {
|
|
|
|
|
padding: 15px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.profile-card {
|
|
|
|
|
border-radius: 16px;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.profile-card :deep(.ant-card-body) {
|
|
|
|
|
padding: 24px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.avatar-section {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
gap: 16px;
|
|
|
|
|
margin-bottom: 20px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.user-details {
|
|
|
|
|
flex: 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.username {
|
|
|
|
|
font-size: 20px;
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
margin: 0 0 4px 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.email {
|
|
|
|
|
color: #999;
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
margin: 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.stats-section {
|
|
|
|
|
padding: 0 15px 15px;
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.stats-section :deep(.ant-row) {
|
|
|
|
|
width: 100%;
|
|
|
|
|
max-width: 400px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.stats-section :deep(.ant-statistic-title) {
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
color: #999;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.stats-section :deep(.ant-statistic-content) {
|
|
|
|
|
font-size: 20px;
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
color: #1890ff;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.menu-section {
|
|
|
|
|
padding: 0 15px 15px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.menu-card {
|
|
|
|
|
border-radius: 16px;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.menu-card :deep(.ant-card-body) {
|
|
|
|
|
padding: 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.menu-item {
|
|
|
|
|
padding: 16px;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
transition: background 0.3s;
|
|
|
|
|
border-bottom: 1px solid #f0f0f0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.menu-item:hover {
|
|
|
|
|
background: #fafafa;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.menu-item:last-child {
|
|
|
|
|
border-bottom: none;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.menu-item :deep(.ant-list-item-action) {
|
|
|
|
|
margin-left: 8px;
|
|
|
|
|
color: #ccc;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.menu-icon {
|
|
|
|
|
width: 40px;
|
|
|
|
|
height: 40px;
|
|
|
|
|
border-radius: 10px;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
font-size: 18px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.menu-item :deep(.ant-list-item-meta-title) {
|
|
|
|
|
font-size: 15px;
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
color: #333;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.menu-item :deep(.ant-list-item-meta-description) {
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
color: #999;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.logout-section {
|
|
|
|
|
padding: 0 15px 20px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.logout-section :deep(.ant-btn-dangerous) {
|
|
|
|
|
height: 48px;
|
|
|
|
|
border-radius: 24px;
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
font-size: 16px;
|
|
|
|
|
}
|
|
|
|
|
</style>
|