增加uniapp

This commit is contained in:
2026-07-15 09:08:52 +08:00
parent 4aa9204df7
commit a5d129cfa0
24 changed files with 2136 additions and 1 deletions
+382
View File
@@ -0,0 +1,382 @@
<template>
<view class="dashboard-container">
<!-- 顶部欢迎区域 -->
<view class="header">
<view class="user-info">
<view class="avatar">
<text class="avatar-text"></text>
</view>
<view class="info">
<text class="greeting">{{ greeting }}{{ userName }}</text>
<text class="date">{{ currentDate }}</text>
</view>
</view>
<view class="notice-icon" @click="goToNotice">
<text class="iconfont">🔔</text>
<view class="badge" v-if="unreadCount > 0">
<text>{{ unreadCount > 99 ? '99+' : unreadCount }}</text>
</view>
</view>
</view>
<!-- 数据概览卡片 -->
<view class="section">
<view class="section-title">
<text>数据概览</text>
</view>
<view class="stats-grid">
<view class="stat-card" v-for="(item, index) in statsData" :key="index">
<text class="stat-value" :style="{ color: item.color }">{{ item.value }}</text>
<text class="stat-label">{{ item.label }}</text>
<view class="trend" :class="item.trend > 0 ? 'up' : 'down'">
<text>{{ item.trend > 0 ? '↑' : '↓' }} {{ Math.abs(item.trend) }}%</text>
</view>
</view>
</view>
</view>
<!-- 快捷操作 -->
<view class="section">
<view class="section-title">
<text>快捷操作</text>
</view>
<view class="quick-actions">
<view class="action-item" v-for="(action, index) in quickActions" :key="index" @click="handleAction(action)">
<view class="action-icon" :style="{ backgroundColor: action.bgColor }">
<text>{{ action.icon }}</text>
</view>
<text class="action-name">{{ action.name }}</text>
</view>
</view>
</view>
<!-- 最近动态 -->
<view class="section">
<view class="section-title-row">
<text class="section-title">最近动态</text>
<text class="more" @click="viewMore">查看更多 ></text>
</view>
<view class="activity-list">
<view class="activity-item" v-for="(item, index) in recentActivities" :key="index">
<view class="activity-dot" :style="{ backgroundColor: item.color }"></view>
<view class="activity-content">
<text class="activity-title">{{ item.title }}</text>
<text class="activity-time">{{ item.time }}</text>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
userName: '用户',
unreadCount: 3,
statsData: [
{ label: '今日访问', value: '1,234', color: '#1989fa', trend: 12.5 },
{ label: '总用户数', value: '5,678', color: '#07c160', trend: 8.3 },
{ label: '订单数量', value: '892', color: '#fa9d3b', trend: -2.1 },
{ label: '收入金额', value: '¥12.5w', color: '#ff6b6b', trend: 15.7 }
],
quickActions: [
{ name: '数据报表', icon: '📊', bgColor: '#e8f4fd', path: '' },
{ name: '内容管理', icon: '📝', bgColor: '#e8faef', path: '' },
{ name: '用户管理', icon: '👥', bgColor: '#fef3e8', path: '' },
{ name: '系统设置', icon: '⚙️', bgColor: '#fce8ec', path: '' }
],
recentActivities: [
{ title: '新用户 张三 完成注册', time: '10分钟前', color: '#1989fa' },
{ title: '订单 #20240115001 已完成', time: '30分钟前', color: '#07c160' },
{ title: '系统已完成自动备份', time: '1小时前', color: '#fa9d3b' },
{ title: '内容《新手指南》已发布', time: '2小时前', color: '#ff6b6b' }
]
}
},
computed: {
greeting() {
const hour = new Date().getHours()
if (hour < 6) return '凌晨好'
if (hour < 9) return '早上好'
if (hour < 12) return '上午好'
if (hour < 14) return '中午好'
if (hour < 17) return '下午好'
if (hour < 19) return '傍晚好'
return '晚上好'
},
currentDate() {
const now = new Date()
const weekDays = ['周日', '周一', '周二', '周三', '周四', '周五', '周六']
const month = now.getMonth() + 1
const day = now.getDate()
const weekDay = weekDays[now.getDay()]
return `${month}${day}${weekDay}`
}
},
onShow() {
this.checkLoginStatus()
},
methods: {
checkLoginStatus() {
const isLoggedIn = uni.getStorageSync('isLoggedIn')
if (!isLoggedIn) {
uni.reLaunch({
url: '/pages/login/login'
})
} else {
const userInfo = uni.getStorageSync('userInfo')
if (userInfo && userInfo.phone) {
this.userName = userInfo.phone.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2')
}
}
},
goToNotice() {
uni.showToast({ title: '消息中心开发中', icon: 'none' })
},
handleAction(action) {
uni.showToast({ title: action.name + ' 功能开发中', icon: 'none' })
},
viewMore() {
uni.showToast({ title: '查看更多动态', icon: 'none' })
}
}
}
</script>
<style scoped>
.dashboard-container {
min-height: 100vh;
background-color: #f5f5f5;
padding-bottom: 32rpx;
}
.header {
background: linear-gradient(135deg, #1989fa 0%, #0d7ed9 100%);
padding: 32rpx 32rpx 48rpx;
display: flex;
justify-content: space-between;
align-items: center;
}
.user-info {
display: flex;
align-items: center;
}
.avatar {
width: 96rpx;
height: 96rpx;
border-radius: 50%;
background-color: rgba(255, 255, 255, 0.25);
display: flex;
align-items: center;
justify-content: center;
margin-right: 24rpx;
}
.avatar-text {
font-size: 36rpx;
color: #fff;
font-weight: bold;
}
.info {
display: flex;
flex-direction: column;
}
.greeting {
font-size: 34rpx;
color: #fff;
font-weight: 500;
margin-bottom: 6rpx;
}
.date {
font-size: 24rpx;
color: rgba(255, 255, 255, 0.8);
}
.notice-icon {
position: relative;
width: 64rpx;
height: 64rpx;
display: flex;
align-items: center;
justify-content: center;
}
.iconfont {
font-size: 40rpx;
}
.badge {
position: absolute;
top: 0;
right: 0;
min-width: 32rpx;
height: 32rpx;
background-color: #ff4d4f;
border-radius: 16rpx;
display: flex;
align-items: center;
justify-content: center;
padding: 0 8rpx;
}
.badge text {
font-size: 20rpx;
color: #fff;
}
.section {
margin: 24rpx 24rpx 0;
background-color: #fff;
border-radius: 20rpx;
padding: 32rpx;
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.04);
}
.section-title {
font-size: 32rpx;
font-weight: 600;
color: #333;
margin-bottom: 28rpx;
}
.section-title-row {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 28rpx;
}
.section-title-row .section-title {
margin-bottom: 0;
}
.more {
font-size: 26rpx;
color: #999;
}
.stats-grid {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 24rpx;
}
.stat-card {
background-color: #fafafa;
border-radius: 16rpx;
padding: 28rpx 24rpx;
}
.stat-value {
font-size: 44rpx;
font-weight: bold;
display: block;
margin-bottom: 8rpx;
}
.stat-label {
font-size: 26rpx;
color: #666;
display: block;
margin-bottom: 12rpx;
}
.trend {
display: inline-block;
font-size: 22rpx;
padding: 4rpx 12rpx;
border-radius: 6rpx;
}
.trend.up {
color: #07c160;
background-color: rgba(7, 193, 96, 0.1);
}
.trend.down {
color: #ff4d4f;
background-color: rgba(255, 77, 79, 0.1);
}
.quick-actions {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 24rpx;
}
.action-item {
display: flex;
flex-direction: column;
align-items: center;
}
.action-icon {
width: 100rpx;
height: 100rpx;
border-radius: 24rpx;
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 12rpx;
}
.action-icon text {
font-size: 44rpx;
}
.action-name {
font-size: 24rpx;
color: #666;
}
.activity-list {
display: flex;
flex-direction: column;
}
.activity-item {
display: flex;
align-items: flex-start;
padding: 20rpx 0;
border-bottom: 1rpx solid #f5f5f5;
}
.activity-item:last-child {
border-bottom: none;
}
.activity-dot {
width: 16rpx;
height: 16rpx;
border-radius: 50%;
margin-top: 12rpx;
margin-right: 20rpx;
flex-shrink: 0;
}
.activity-content {
flex: 1;
display: flex;
justify-content: space-between;
align-items: center;
}
.activity-title {
font-size: 28rpx;
color: #333;
}
.activity-time {
font-size: 24rpx;
color: #999;
flex-shrink: 0;
margin-left: 24rpx;
}
</style>
+290
View File
@@ -0,0 +1,290 @@
<template>
<view class="functions-container">
<!-- 搜索栏 -->
<view class="search-bar">
<view class="search-input">
<text class="search-icon">🔍</text>
<input
type="text"
v-model="searchKeyword"
placeholder="搜索功能..."
@confirm="handleSearch"
class="input"
/>
</view>
</view>
<!-- 常用功能 -->
<view class="section">
<view class="section-title">
<text>常用功能</text>
</view>
<view class="function-grid">
<view
class="function-item"
v-for="(func, index) in commonFunctions"
:key="index"
@click="handleFunction(func)"
>
<view class="func-icon" :style="{ backgroundColor: func.bgColor }">
<text>{{ func.icon }}</text>
</view>
<text class="func-name">{{ func.name }}</text>
</view>
</view>
</view>
<!-- 管理工具 -->
<view class="section">
<view class="section-title">
<text>管理工具</text>
</view>
<view class="function-list">
<view
class="list-item"
v-for="(item, index) in manageTools"
:key="index"
@click="handleFunction(item)"
>
<view class="list-icon" :style="{ backgroundColor: item.bgColor }">
<text>{{ item.icon }}</text>
</view>
<view class="list-info">
<text class="list-name">{{ item.name }}</text>
<text class="list-desc">{{ item.desc }}</text>
</view>
<text class="arrow">></text>
</view>
</view>
</view>
<!-- 数据服务 -->
<view class="section">
<view class="section-title">
<text>数据服务</text>
</view>
<view class="function-list">
<view
class="list-item"
v-for="(item, index) in dataServices"
:key="index"
@click="handleFunction(item)"
>
<view class="list-icon" :style="{ backgroundColor: item.bgColor }">
<text>{{ item.icon }}</text>
</view>
<view class="list-info">
<text class="list-name">{{ item.name }}</text>
<text class="list-desc">{{ item.desc }}</text>
</view>
<text class="arrow">></text>
</view>
</view>
</view>
<!-- 系统工具 -->
<view class="section">
<view class="section-title">
<text>系统工具</text>
</view>
<view class="function-list">
<view
class="list-item"
v-for="(item, index) in systemTools"
:key="index"
@click="handleFunction(item)"
>
<view class="list-icon" :style="{ backgroundColor: item.bgColor }">
<text>{{ item.icon }}</text>
</view>
<view class="list-info">
<text class="list-name">{{ item.name }}</text>
<text class="list-desc">{{ item.desc }}</text>
</view>
<text class="arrow">></text>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
searchKeyword: '',
commonFunctions: [
{ name: '文章管理', icon: '📄', bgColor: '#e8f4fd', path: '', type: 'common' },
{ name: '图片管理', icon: '🖼️', bgColor: '#fef3e8', path: '', type: 'common' },
{ name: '文件管理', icon: '📁', bgColor: '#e8faef', path: '', type: 'common' },
{ name: '评论审核', icon: '💬', bgColor: '#fce8ec', path: '', type: 'common' },
{ name: '用户反馈', icon: '📮', bgColor: '#f3e8fd', path: '', type: 'common' },
{ name: '数据统计', icon: '📊', bgColor: '#e8f0fe', path: '', type: 'common' },
{ name: '公告通知', icon: '📢', bgColor: '#fff4e8', path: '', type: 'common' },
{ name: '日志查看', icon: '📋', bgColor: '#e8fcf4', path: '', type: 'common' }
],
manageTools: [
{ name: '内容发布', desc: '发布文章、图片等内容', icon: '✏️', bgColor: '#e8f4fd', path: '' },
{ name: '分类管理', desc: '管理内容分类标签', icon: '🏷️', bgColor: '#fef3e8', path: '' },
{ name: '权限设置', desc: '配置用户角色权限', icon: '🔐', bgColor: '#e8faef', path: '' },
{ name: '站点配置', desc: '网站基本设置项', icon: '⚙️', bgColor: '#fce8ec', path: '' }
],
dataServices: [
{ name: '数据备份', desc: '一键备份所有数据', icon: '💾', bgColor: '#e8f4fd', path: '' },
{ name: '数据恢复', desc: '从备份中恢复数据', icon: '♻️', bgColor: '#fef3e8', path: '' },
{ name: '数据导出', desc: '导出为Excel/CSV', icon: '📤', bgColor: '#e8faef', path: '' },
{ name: '数据清理', desc: '清理冗余临时数据', icon: '🧹', bgColor: '#fce8ec', path: '' }
],
systemTools: [
{ name: '缓存管理', desc: '清除系统缓存加速访问', icon: '🚀', bgColor: '#e8f4fd', path: '' },
{ name: '安全检测', desc: '扫描系统安全隐患', icon: '🛡️', bgColor: '#e8faef', path: '' },
{ name: '版本更新', desc: '检查并更新系统版本', icon: '🔄', bgColor: '#fef3e8', path: '' },
{ name: '关于系统', desc: '系统信息与帮助文档', icon: '️', bgColor: '#f3e8fd', path: '' }
]
}
},
methods: {
handleSearch() {
if (this.searchKeyword.trim()) {
uni.showToast({ title: '搜索:' + this.searchKeyword, icon: 'none' })
}
},
handleFunction(func) {
uni.showToast({ title: func.name + ' 功能开发中', icon: 'none' })
}
}
}
</script>
<style scoped>
.functions-container {
min-height: 100vh;
background-color: #f5f5f5;
padding-bottom: 32rpx;
}
.search-bar {
padding: 24rpx 24rpx 0;
}
.search-input {
display: flex;
align-items: center;
background-color: #fff;
border-radius: 48rpx;
padding: 16rpx 32rpx;
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.04);
}
.search-icon {
font-size: 32rpx;
margin-right: 16rpx;
}
.input {
flex: 1;
font-size: 28rpx;
color: #333;
}
.section {
margin: 24rpx 24rpx 0;
background-color: #fff;
border-radius: 20rpx;
padding: 32rpx;
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.04);
}
.section-title {
font-size: 32rpx;
font-weight: 600;
color: #333;
margin-bottom: 28rpx;
}
.function-grid {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 24rpx;
}
.function-item {
display: flex;
flex-direction: column;
align-items: center;
}
.func-icon {
width: 96rpx;
height: 96rpx;
border-radius: 24rpx;
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 12rpx;
}
.func-icon text {
font-size: 42rpx;
}
.func-name {
font-size: 24rpx;
color: #666;
text-align: center;
}
.function-list {
display: flex;
flex-direction: column;
}
.list-item {
display: flex;
align-items: center;
padding: 24rpx 0;
border-bottom: 1rpx solid #f5f5f5;
}
.list-item:last-child {
border-bottom: none;
}
.list-icon {
width: 80rpx;
height: 80rpx;
border-radius: 18rpx;
display: flex;
align-items: center;
justify-content: center;
margin-right: 24rpx;
flex-shrink: 0;
}
.list-icon text {
font-size: 36rpx;
}
.list-info {
flex: 1;
display: flex;
flex-direction: column;
}
.list-name {
font-size: 30rpx;
color: #333;
margin-bottom: 6rpx;
}
.list-desc {
font-size: 24rpx;
color: #999;
}
.arrow {
font-size: 28rpx;
color: #ccc;
margin-left: 16rpx;
}
</style>
+403
View File
@@ -0,0 +1,403 @@
<template>
<view class="login-container">
<view class="login-header">
<text class="welcome-text">欢迎登录</text>
<text class="sub-text">云泽网站综合管理平台</text>
</view>
<view class="login-form">
<!-- 登录方式切换 -->
<view class="tab-switch">
<view
class="tab-item"
:class="{ active: loginType === 'phone' }"
@click="switchLoginType('phone')"
>
<text>验证码登录</text>
</view>
<view
class="tab-item"
:class="{ active: loginType === 'account' }"
@click="switchLoginType('account')"
>
<text>密码登录</text>
</view>
</view>
<!-- 手机号输入 -->
<view class="input-group">
<view class="input-item">
<text class="icon">+86</text>
<input
type="number"
v-model="phoneNumber"
placeholder="请输入手机号"
maxlength="11"
class="input-field"
/>
</view>
</view>
<!-- 验证码/密码输入 -->
<view class="input-group" v-if="loginType === 'phone'">
<view class="input-item">
<input
type="number"
v-model="verifyCode"
placeholder="请输入验证码"
maxlength="6"
class="input-field code-input"
/>
<view
class="code-btn"
:class="{ disabled: countdown > 0 }"
@click="sendCode"
>
<text>{{ countdown > 0 ? countdown + 's后重发' : '获取验证码' }}</text>
</view>
</view>
</view>
<view class="input-group" v-else>
<view class="input-item">
<input
type="text"
v-model="password"
placeholder="请输入密码"
:password="!showPassword"
class="input-field"
/>
<text class="eye-icon" @click="togglePassword">{{ showPassword ? '隐藏' : '显示' }}</text>
</view>
</view>
<!-- 登录按钮 -->
<button class="login-btn" @click="handleLogin" :disabled="isLoading">
<text>{{ isLoading ? '登录中...' : '登 录' }}</text>
</button>
<!-- 其他选项 -->
<view class="options">
<text class="link" @click="goToRegister">新用户注册</text>
<text class="link" @click="forgetPassword">忘记密码</text>
</view>
</view>
<!-- 协议 -->
<view class="agreement">
<checkbox :checked="agreed" @click="toggleAgree" color="#1989fa" />
<text class="agree-text">
我已阅读并同意
<text class="link">用户协议</text>
<text class="link">隐私政策</text>
</text>
</view>
</view>
</template>
<script>
export default {
data() {
return {
loginType: 'phone', // phone | account
phoneNumber: '',
verifyCode: '',
password: '',
showPassword: false,
countdown: 0,
isLoading: false,
agreed: false,
timer: null
}
},
onUnload() {
if (this.timer) {
clearInterval(this.timer)
}
},
methods: {
switchLoginType(type) {
this.loginType = type
},
togglePassword() {
this.showPassword = !this.showPassword
},
sendCode() {
if (this.countdown > 0) return
if (!this.phoneNumber || this.phoneNumber.length !== 11) {
uni.showToast({ title: '请输入正确的手机号', icon: 'none' })
return
}
// TODO: 调用发送验证码接口
uni.showToast({ title: '验证码已发送', icon: 'success' })
this.countdown = 60
this.timer = setInterval(() => {
this.countdown--
if (this.countdown <= 0) {
clearInterval(this.timer)
this.timer = null
}
}, 1000)
},
handleLogin() {
if (!this.agreed) {
uni.showToast({ title: '请先同意用户协议', icon: 'none' })
return
}
if (!this.phoneNumber || this.phoneNumber.length !== 11) {
uni.showToast({ title: '请输入正确的手机号', icon: 'none' })
return
}
if (this.loginType === 'phone') {
if (!this.verifyCode) {
uni.showToast({ title: '请输入验证码', icon: 'none' })
return
}
} else {
if (!this.password) {
uni.showToast({ title: '请输入密码', icon: 'none' })
return
}
}
this.isLoading = true
// TODO: 调用登录接口
setTimeout(() => {
this.isLoading = false
uni.showToast({ title: '登录成功', icon: 'success' })
// 存储登录状态
uni.setStorageSync('isLoggedIn', true)
uni.setStorageSync('userInfo', {
phone: this.phoneNumber,
loginTime: new Date().getTime()
})
// 跳转到仪表盘
setTimeout(() => {
uni.switchTab({
url: '/pages/dashboard/dashboard'
})
}, 1500)
}, 1500)
},
toggleAgree() {
this.agreed = !this.agreed
},
goToRegister() {
uni.showToast({ title: '注册功能开发中', icon: 'none' })
},
forgetPassword() {
uni.showToast({ title: '密码找回功能开发中', icon: 'none' })
}
}
}
</script>
<style scoped>
.login-container {
min-height: 100vh;
background: linear-gradient(180deg, #1989fa 0%, #e8f4fd 40%, #f5f5f5 40%);
padding: 0 48rpx;
box-sizing: border-box;
}
.login-header {
padding-top: 120rpx;
text-align: center;
margin-bottom: 60rpx;
}
.logo {
width: 140rpx;
height: 140rpx;
border-radius: 28rpx;
background-color: #fff;
display: flex;
align-items: center;
justify-content: center;
margin: 0 auto 32rpx;
box-shadow: 0 8rpx 24rpx rgba(25, 137, 250, 0.2);
}
.logo-text {
font-size: 56rpx;
font-weight: bold;
color: #1989fa;
}
.welcome-text {
display: block;
font-size: 44rpx;
font-weight: bold;
color: #fff;
margin-bottom: 12rpx;
}
.sub-text {
display: block;
font-size: 28rpx;
color: rgba(255, 255, 255, 0.85);
}
.login-form {
background-color: #fff;
border-radius: 24rpx;
padding: 48rpx 40rpx;
box-shadow: 0 8rpx 32rpx rgba(0, 0, 0, 0.06);
}
.tab-switch {
display: flex;
border-bottom: 1rpx solid #eee;
margin-bottom: 40rpx;
}
.tab-item {
flex: 1;
text-align: center;
padding: 20rpx 0;
position: relative;
}
.tab-item text {
font-size: 30rpx;
color: #999;
}
.tab-item.active text {
color: #1989fa;
font-weight: 500;
}
.tab-item.active::after {
content: '';
position: absolute;
bottom: -1rpx;
left: 50%;
transform: translateX(-50%);
width: 80rpx;
height: 4rpx;
background-color: #1989fa;
border-radius: 2rpx;
}
.input-group {
margin-bottom: 28rpx;
}
.input-item {
display: flex;
align-items: center;
border: 2rpx solid #e5e5e5;
border-radius: 12rpx;
padding: 0 24rpx;
height: 96rpx;
background-color: #fafafa;
}
.input-item:focus-within {
border-color: #1989fa;
background-color: #fff;
}
.icon {
font-size: 28rpx;
color: #333;
margin-right: 16rpx;
font-weight: 500;
}
.input-field {
flex: 1;
height: 100%;
font-size: 30rpx;
color: #333;
}
.code-input {
padding-right: 16rpx;
}
.code-btn {
padding: 16rpx 24rpx;
background-color: #1989fa;
border-radius: 8rpx;
margin-left: 16rpx;
flex-shrink: 0;
}
.code-btn text {
font-size: 24rpx;
color: #fff;
white-space: nowrap;
}
.code-btn.disabled {
background-color: #ccc;
}
.eye-icon {
font-size: 26rpx;
color: #1989fa;
padding: 12rpx;
}
.login-btn {
width: 100%;
height: 92rpx;
background: linear-gradient(135deg, #1989fa 0%, #0d7ed9 100%);
border-radius: 46rpx;
display: flex;
align-items: center;
justify-content: center;
margin-top: 40rpx;
border: none;
}
.login-btn text {
font-size: 32rpx;
color: #fff;
font-weight: 500;
letter-spacing: 4rpx;
}
.login-btn[disabled] {
opacity: 0.6;
}
.options {
display: flex;
justify-content: space-between;
margin-top: 32rpx;
padding: 0 8rpx;
}
.options .link {
font-size: 26rpx;
color: #1989fa;
}
.agreement {
display: flex;
align-items: flex-start;
margin-top: 48rpx;
padding: 0 8rpx;
}
.agree-text {
font-size: 24rpx;
color: #999;
margin-left: 12rpx;
line-height: 1.6;
}
.agree-text .link {
color: #1989fa;
}
</style>
+474
View File
@@ -0,0 +1,474 @@
<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>