475 lines
9.6 KiB
Vue
475 lines
9.6 KiB
Vue
<template>
|
||
<view class="mine-container">
|
||
<!-- 用户信息卡片 -->
|
||
<view class="user-card">
|
||
<view class="user-profile">
|
||
<view class="avatar">
|
||
<text class="avatar-text">云</text>
|
||
</view>
|
||
<view class="user-detail">
|
||
<view class="name-row">
|
||
<text class="nickname">{{ userInfo.nickname || '未设置昵称' }}</text>
|
||
<view class="vip-badge" v-if="userInfo.isVip">
|
||
<text>VIP</text>
|
||
</view>
|
||
</view>
|
||
<text class="phone">{{ maskedPhone }}</text>
|
||
</view>
|
||
<view class="edit-btn" @click="editProfile">
|
||
<text>编辑</text>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 统计信息 -->
|
||
<view class="stats-row">
|
||
<view class="stat-item" @click="goToPage('articles')">
|
||
<text class="stat-num">{{ userStats.articles }}</text>
|
||
<text class="stat-label">文章</text>
|
||
</view>
|
||
<view class="stat-divider"></view>
|
||
<view class="stat-item" @click="goToPage('followers')">
|
||
<text class="stat-num">{{ userStats.followers }}</text>
|
||
<text class="stat-label">粉丝</text>
|
||
</view>
|
||
<view class="stat-divider"></view>
|
||
<view class="stat-item" @click="goToPage('following')">
|
||
<text class="stat-num">{{ userStats.following }}</text>
|
||
<text class="stat-label">关注</text>
|
||
</view>
|
||
<view class="stat-divider"></view>
|
||
<view class="stat-item" @click="goToPage('likes')">
|
||
<text class="stat-num">{{ userStats.likes }}</text>
|
||
<text class="stat-label">获赞</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 订单/资产入口 -->
|
||
<view class="section order-section">
|
||
<view class="order-header">
|
||
<text class="section-title">我的订单</text>
|
||
<text class="more" @click="viewAllOrders">全部订单 ></text>
|
||
</view>
|
||
<view class="order-grid">
|
||
<view class="order-item" v-for="(item, index) in orderTypes" :key="index" @click="goToOrder(item.type)">
|
||
<view class="order-icon-wrap">
|
||
<text class="order-icon">{{ item.icon }}</text>
|
||
<view class="order-badge" v-if="item.count > 0">
|
||
<text>{{ item.count }}</text>
|
||
</view>
|
||
</view>
|
||
<text class="order-name">{{ item.name }}</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 功能列表 -->
|
||
<view class="section menu-section">
|
||
<view class="menu-list">
|
||
<view
|
||
class="menu-item"
|
||
v-for="(menu, index) in menuList"
|
||
:key="index"
|
||
@click="handleMenu(menu)"
|
||
>
|
||
<view class="menu-icon" :style="{ backgroundColor: menu.bgColor }">
|
||
<text>{{ menu.icon }}</text>
|
||
</view>
|
||
<text class="menu-name">{{ menu.name }}</text>
|
||
<view class="menu-right">
|
||
<text class="menu-desc" v-if="menu.desc">{{ menu.desc }}</text>
|
||
<text class="arrow">></text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 退出登录按钮 -->
|
||
<view class="logout-wrapper">
|
||
<button class="logout-btn" @click="handleLogout">
|
||
<text>退出登录</text>
|
||
</button>
|
||
</view>
|
||
|
||
<!-- 版本信息 -->
|
||
<view class="version-info">
|
||
<text>云泽网站综合管理平台 v1.0.0</text>
|
||
</view>
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
export default {
|
||
data() {
|
||
return {
|
||
userInfo: {
|
||
nickname: '',
|
||
phone: '',
|
||
avatar: '',
|
||
isVip: false
|
||
},
|
||
userStats: {
|
||
articles: 12,
|
||
followers: 256,
|
||
following: 89,
|
||
likes: 1024
|
||
},
|
||
orderTypes: [
|
||
{ name: '待付款', icon: '💰', type: 'pending', count: 0 },
|
||
{ name: '进行中', icon: '⏳', type: 'processing', count: 2 },
|
||
{ name: '已完成', icon: '✅', type: 'completed', count: 8 },
|
||
{ name: '已取消', icon: '❌', type: 'cancelled', count: 1 }
|
||
],
|
||
menuList: [
|
||
{ name: '我的收藏', icon: '⭐', bgColor: '#fff4e8', desc: '', action: 'favorites' },
|
||
{ name: '浏览历史', icon: '🕐', bgColor: '#e8f4fd', desc: '', action: 'history' },
|
||
{ name: '地址管理', icon: '📍', bgColor: '#e8faef', desc: '', action: 'address' },
|
||
{ name: '账号安全', icon: '🔒', bgColor: '#fce8ec', desc: '', action: 'security' },
|
||
{ name: '消息通知', icon: '🔔', bgColor: '#f3e8fd', desc: '3条未读', action: 'notice' },
|
||
{ name: '帮助中心', icon: '❓', bgColor: '#e8f0fe', desc: '', action: 'help' },
|
||
{ name: '关于我们', icon: 'ℹ️', bgColor: '#e8fcf4', desc: '', action: 'about' },
|
||
{ name: '意见反馈', icon: '💬', bgColor: '#fef3e8', desc: '', action: 'feedback' }
|
||
]
|
||
}
|
||
},
|
||
computed: {
|
||
maskedPhone() {
|
||
if (this.userInfo.phone) {
|
||
return this.userInfo.phone.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2')
|
||
}
|
||
return '未绑定手机号'
|
||
}
|
||
},
|
||
onShow() {
|
||
this.loadUserInfo()
|
||
},
|
||
methods: {
|
||
loadUserInfo() {
|
||
const isLoggedIn = uni.getStorageSync('isLoggedIn')
|
||
const userInfo = uni.getStorageSync('userInfo')
|
||
|
||
if (isLoggedIn && userInfo) {
|
||
this.userInfo.phone = userInfo.phone || ''
|
||
this.userInfo.nickname = userInfo.nickname || ''
|
||
}
|
||
},
|
||
editProfile() {
|
||
uni.showToast({ title: '个人信息编辑开发中', icon: 'none' })
|
||
},
|
||
goToPage(type) {
|
||
const pageMap = {
|
||
articles: '我的文章',
|
||
followers: '粉丝列表',
|
||
following: '关注列表',
|
||
likes: '获赞记录'
|
||
}
|
||
uni.showToast({ title: pageMap[type] + ' 开发中', icon: 'none' })
|
||
},
|
||
viewAllOrders() {
|
||
uni.showToast({ title: '全部订单开发中', icon: 'none' })
|
||
},
|
||
goToOrder(type) {
|
||
uni.showToast({ title: '订单详情开发中', icon: 'none' })
|
||
},
|
||
handleMenu(menu) {
|
||
uni.showToast({ title: menu.name + ' 功能开发中', icon: 'none' })
|
||
},
|
||
handleLogout() {
|
||
uni.showModal({
|
||
title: '提示',
|
||
content: '确定要退出登录吗?',
|
||
success: (res) => {
|
||
if (res.confirm) {
|
||
// 清除登录状态
|
||
uni.removeStorageSync('isLoggedIn')
|
||
uni.removeStorageSync('userInfo')
|
||
|
||
uni.showToast({ title: '已退出登录', icon: 'success' })
|
||
|
||
setTimeout(() => {
|
||
uni.reLaunch({
|
||
url: '/pages/login/login'
|
||
})
|
||
}, 1500)
|
||
}
|
||
}
|
||
})
|
||
}
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style scoped>
|
||
.mine-container {
|
||
min-height: 100vh;
|
||
background-color: #f5f5f5;
|
||
padding-bottom: 32rpx;
|
||
}
|
||
|
||
.user-card {
|
||
background: linear-gradient(135deg, #1989fa 0%, #0d7ed9 100%);
|
||
margin: 24rpx;
|
||
border-radius: 24rpx;
|
||
padding: 40rpx 32rpx 32rpx;
|
||
box-shadow: 0 8rpx 32rpx rgba(25, 137, 250, 0.25);
|
||
}
|
||
|
||
.user-profile {
|
||
display: flex;
|
||
align-items: center;
|
||
margin-bottom: 36rpx;
|
||
}
|
||
|
||
.avatar {
|
||
width: 120rpx;
|
||
height: 120rpx;
|
||
border-radius: 50%;
|
||
background-color: rgba(255, 255, 255, 0.25);
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
margin-right: 28rpx;
|
||
flex-shrink: 0;
|
||
}
|
||
|
||
.avatar-text {
|
||
font-size: 48rpx;
|
||
color: #fff;
|
||
font-weight: bold;
|
||
}
|
||
|
||
.user-detail {
|
||
flex: 1;
|
||
}
|
||
|
||
.name-row {
|
||
display: flex;
|
||
align-items: center;
|
||
margin-bottom: 10rpx;
|
||
}
|
||
|
||
.nickname {
|
||
font-size: 38rpx;
|
||
color: #fff;
|
||
font-weight: 600;
|
||
margin-right: 16rpx;
|
||
}
|
||
|
||
.vip-badge {
|
||
background: linear-gradient(135deg, #ffd700 0%, #ffaa00 100%);
|
||
padding: 4rpx 16rpx;
|
||
border-radius: 8rpx;
|
||
}
|
||
|
||
.vip-badge text {
|
||
font-size: 20rpx;
|
||
color: #fff;
|
||
font-weight: bold;
|
||
}
|
||
|
||
.phone {
|
||
font-size: 26rpx;
|
||
color: rgba(255, 255, 255, 0.85);
|
||
}
|
||
|
||
.edit-btn {
|
||
padding: 12rpx 28rpx;
|
||
border: 2rpx solid rgba(255, 255, 255, 0.6);
|
||
border-radius: 28rpx;
|
||
margin-left: 20rpx;
|
||
}
|
||
|
||
.edit-btn text {
|
||
font-size: 26rpx;
|
||
color: #fff;
|
||
}
|
||
|
||
.stats-row {
|
||
display: flex;
|
||
align-items: center;
|
||
background-color: rgba(255, 255, 255, 0.15);
|
||
border-radius: 16rpx;
|
||
padding: 24rpx 0;
|
||
}
|
||
|
||
.stat-item {
|
||
flex: 1;
|
||
display: flex;
|
||
flex-direction: column;
|
||
align-items: center;
|
||
}
|
||
|
||
.stat-num {
|
||
font-size: 36rpx;
|
||
color: #fff;
|
||
font-weight: bold;
|
||
margin-bottom: 6rpx;
|
||
}
|
||
|
||
.stat-label {
|
||
font-size: 24rpx;
|
||
color: rgba(255, 255, 255, 0.8);
|
||
}
|
||
|
||
.stat-divider {
|
||
width: 1rpx;
|
||
height: 48rpx;
|
||
background-color: rgba(255, 255, 255, 0.25);
|
||
}
|
||
|
||
.section {
|
||
margin: 24rpx 24rpx 0;
|
||
background-color: #fff;
|
||
border-radius: 20rpx;
|
||
padding: 32rpx;
|
||
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.04);
|
||
}
|
||
|
||
.order-section .section-title {
|
||
font-size: 30rpx;
|
||
font-weight: 600;
|
||
color: #333;
|
||
}
|
||
|
||
.order-header {
|
||
display: flex;
|
||
justify-content: space-between;
|
||
align-items: center;
|
||
margin-bottom: 28rpx;
|
||
}
|
||
|
||
.more {
|
||
font-size: 26rpx;
|
||
color: #999;
|
||
}
|
||
|
||
.order-grid {
|
||
display: grid;
|
||
grid-template-columns: repeat(4, 1fr);
|
||
gap: 16rpx;
|
||
}
|
||
|
||
.order-item {
|
||
display: flex;
|
||
flex-direction: column;
|
||
align-items: center;
|
||
}
|
||
|
||
.order-icon-wrap {
|
||
position: relative;
|
||
margin-bottom: 12rpx;
|
||
}
|
||
|
||
.order-icon {
|
||
font-size: 44rpx;
|
||
}
|
||
|
||
.order-badge {
|
||
position: absolute;
|
||
top: -8rpx;
|
||
right: -16rpx;
|
||
min-width: 32rpx;
|
||
height: 32rpx;
|
||
background-color: #ff4d4f;
|
||
border-radius: 16rpx;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
padding: 0 8rpx;
|
||
}
|
||
|
||
.order-badge text {
|
||
font-size: 20rpx;
|
||
color: #fff;
|
||
}
|
||
|
||
.order-name {
|
||
font-size: 24rpx;
|
||
color: #666;
|
||
}
|
||
|
||
.menu-list {
|
||
display: flex;
|
||
flex-direction: column;
|
||
}
|
||
|
||
.menu-item {
|
||
display: flex;
|
||
align-items: center;
|
||
padding: 28rpx 0;
|
||
border-bottom: 1rpx solid #f5f5f5;
|
||
}
|
||
|
||
.menu-item:last-child {
|
||
border-bottom: none;
|
||
}
|
||
|
||
.menu-icon {
|
||
width: 72rpx;
|
||
height: 72rpx;
|
||
border-radius: 16rpx;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
margin-right: 24rpx;
|
||
flex-shrink: 0;
|
||
}
|
||
|
||
.menu-icon text {
|
||
font-size: 34rpx;
|
||
}
|
||
|
||
.menu-name {
|
||
flex: 1;
|
||
font-size: 30rpx;
|
||
color: #333;
|
||
}
|
||
|
||
.menu-right {
|
||
display: flex;
|
||
align-items: center;
|
||
}
|
||
|
||
.menu-desc {
|
||
font-size: 24rpx;
|
||
color: #999;
|
||
margin-right: 12rpx;
|
||
}
|
||
|
||
.arrow {
|
||
font-size: 28rpx;
|
||
color: #ccc;
|
||
}
|
||
|
||
.logout-wrapper {
|
||
padding: 48rpx 48rpx 0;
|
||
}
|
||
|
||
.logout-btn {
|
||
width: 100%;
|
||
height: 88rpx;
|
||
background-color: #fff;
|
||
border: 2rpx solid #ff4d4f;
|
||
border-radius: 44rpx;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
}
|
||
|
||
.logout-btn text {
|
||
font-size: 30rpx;
|
||
color: #ff4d4f;
|
||
font-weight: 500;
|
||
}
|
||
|
||
.version-info {
|
||
text-align: center;
|
||
padding-top: 40rpx;
|
||
}
|
||
|
||
.version-info text {
|
||
font-size: 24rpx;
|
||
color: #ccc;
|
||
}
|
||
</style>
|