You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
330 lines
7.5 KiB
330 lines
7.5 KiB
Page({
|
|
data: {
|
|
userInfo: {
|
|
avatar: '/assets/images/avatar.png',
|
|
nickname: '用户昵称',
|
|
phone: '138****8888',
|
|
isVerified: false,
|
|
isDoctor: false
|
|
},
|
|
|
|
// 功能模块
|
|
modules: [
|
|
{
|
|
id: 'info',
|
|
icon: 'user-circle',
|
|
name: '个人管理',
|
|
items: [
|
|
{
|
|
id: 'profile',
|
|
name: '信息管理',
|
|
desc: '查看和编辑个人信息',
|
|
icon: 'profile',
|
|
badge: 0,
|
|
arrow: true
|
|
},
|
|
{
|
|
id: 'realname',
|
|
name: '实名认证',
|
|
desc: '通过输入身份信息',
|
|
icon: 'shield-check',
|
|
badge: 0,
|
|
arrow: true,
|
|
status: '未认证', // 认证状态
|
|
statusColor: 'text-orange'
|
|
}
|
|
]
|
|
},
|
|
{
|
|
id: 'security',
|
|
icon: 'lock',
|
|
name: '账户安全',
|
|
items: [
|
|
{
|
|
id: 'security_settings',
|
|
name: '账户安全',
|
|
desc: '设置账户密码和安全问题',
|
|
icon: 'settings',
|
|
badge: 0,
|
|
arrow: true
|
|
},
|
|
{
|
|
id: 'feedback',
|
|
name: '反馈建议',
|
|
desc: '向平台提交反馈和建议',
|
|
icon: 'message',
|
|
badge: 3, // 未读回复数
|
|
arrow: true
|
|
}
|
|
]
|
|
},
|
|
{
|
|
id: 'notification',
|
|
icon: 'bell',
|
|
name: '消息通知',
|
|
items: [
|
|
{
|
|
id: 'notifications',
|
|
name: '消息通知',
|
|
desc: '问诊、问答、订单等消息',
|
|
icon: 'notification',
|
|
badge: 5, // 未读消息数
|
|
arrow: true
|
|
},
|
|
{
|
|
id: 'privacy',
|
|
name: '隐私设置',
|
|
desc: '管理个人信息可见性',
|
|
icon: 'eye-off',
|
|
badge: 0,
|
|
arrow: true
|
|
}
|
|
]
|
|
},
|
|
{
|
|
id: 'support',
|
|
icon: 'help-circle',
|
|
name: '帮助与支持',
|
|
items: [
|
|
{
|
|
id: 'about',
|
|
name: '关于我们',
|
|
desc: '了解平台信息',
|
|
icon: 'info',
|
|
badge: 0,
|
|
arrow: true
|
|
},
|
|
{
|
|
id: 'service',
|
|
name: '客服中心',
|
|
desc: '7x24小时在线服务',
|
|
icon: 'headphones',
|
|
badge: 0,
|
|
arrow: true
|
|
},
|
|
{
|
|
id: 'agreement',
|
|
name: '用户协议',
|
|
desc: '查看平台使用条款',
|
|
icon: 'file-text',
|
|
badge: 0,
|
|
arrow: true
|
|
}
|
|
]
|
|
}
|
|
],
|
|
|
|
// 统计数据
|
|
stats: [
|
|
{
|
|
id: 'consultation',
|
|
name: '我的问诊',
|
|
value: '12',
|
|
icon: 'stethoscope',
|
|
color: '#07c160'
|
|
},
|
|
{
|
|
id: 'orders',
|
|
name: '我的订单',
|
|
value: '8',
|
|
icon: 'shopping-bag',
|
|
color: '#ff6b6b'
|
|
},
|
|
{
|
|
id: 'favorites',
|
|
name: '我的收藏',
|
|
value: '23',
|
|
icon: 'heart',
|
|
color: '#ff9f43'
|
|
},
|
|
{
|
|
id: 'coupons',
|
|
name: '我的优惠券',
|
|
value: '3',
|
|
icon: 'tag',
|
|
color: '#2e86de'
|
|
}
|
|
],
|
|
|
|
// 快捷操作
|
|
quickActions: [
|
|
{
|
|
id: 'health_record',
|
|
name: '健康档案',
|
|
icon: 'file-medical',
|
|
color: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)'
|
|
},
|
|
{
|
|
id: 'appointment',
|
|
name: '预约挂号',
|
|
icon: 'calendar',
|
|
color: 'linear-gradient(135deg, #f093fb 0%, #f5576c 100%)'
|
|
},
|
|
{
|
|
id: 'medicine',
|
|
name: '我的药箱',
|
|
icon: 'pill',
|
|
color: 'linear-gradient(135deg, #4facfe 0%, #00f2fe 100%)'
|
|
},
|
|
{
|
|
id: 'report',
|
|
name: '检查报告',
|
|
icon: 'clipboard',
|
|
color: 'linear-gradient(135deg, #43e97b 0%, #38f9d7 100%)'
|
|
}
|
|
],
|
|
|
|
// 系统信息
|
|
systemInfo: {
|
|
version: '2.1.0',
|
|
lastLogin: '2024-01-15 14:30'
|
|
}
|
|
},
|
|
|
|
onLoad() {
|
|
this.loadUserInfo()
|
|
this.checkNotifications()
|
|
},
|
|
|
|
onShow() {
|
|
// 每次显示页面时刷新数据
|
|
this.refreshData()
|
|
},
|
|
|
|
// 加载用户信息
|
|
loadUserInfo() {
|
|
// 模拟API调用
|
|
setTimeout(() => {
|
|
this.setData({
|
|
'userInfo.nickname': '张小凡',
|
|
'userInfo.phone': '138****5678',
|
|
'userInfo.isVerified': true,
|
|
'userInfo.isDoctor': false
|
|
})
|
|
}, 500)
|
|
},
|
|
|
|
// 检查通知
|
|
checkNotifications() {
|
|
// 模拟检查未读消息
|
|
const updatedModules = this.data.modules.map(module => {
|
|
return {
|
|
...module,
|
|
items: module.items.map(item => {
|
|
if (item.id === 'notifications') {
|
|
return { ...item, badge: Math.floor(Math.random() * 10) }
|
|
}
|
|
return item
|
|
})
|
|
}
|
|
})
|
|
|
|
this.setData({ modules: updatedModules })
|
|
},
|
|
|
|
// 刷新数据
|
|
refreshData() {
|
|
// 刷新统计数据
|
|
const updatedStats = this.data.stats.map(stat => ({
|
|
...stat,
|
|
value: String(Math.floor(Math.random() * 20) + 5)
|
|
}))
|
|
|
|
this.setData({ stats: updatedStats })
|
|
},
|
|
|
|
// 点击用户头像区域
|
|
onTapUserInfo() {
|
|
wx.navigateTo({
|
|
url: '/pages/profile/edit-profile'
|
|
})
|
|
},
|
|
|
|
// 点击统计项
|
|
onTapStat(e) {
|
|
const { id } = e.currentTarget.dataset
|
|
const urls = {
|
|
consultation: '/pages/consultation/my-consultation',
|
|
orders: '/pages/order/my-orders',
|
|
favorites: '/pages/favorites/favorites',
|
|
coupons: '/pages/coupon/my-coupons'
|
|
}
|
|
|
|
if (urls[id]) {
|
|
wx.navigateTo({ url: urls[id] })
|
|
}
|
|
},
|
|
|
|
// 点击快捷操作
|
|
onTapQuickAction(e) {
|
|
const { id } = e.currentTarget.dataset
|
|
const urls = {
|
|
health_record: '/pages/health/record',
|
|
appointment: '/pages/appointment/list',
|
|
medicine: '/pages/medicine/medicine-box',
|
|
report: '/pages/report/list'
|
|
}
|
|
|
|
if (urls[id]) {
|
|
wx.navigateTo({ url: urls[id] })
|
|
}
|
|
},
|
|
|
|
// 点击功能项
|
|
onTapMenuItem(e) {
|
|
const { moduleid, itemid } = e.currentTarget.dataset
|
|
console.log('点击:', moduleid, itemid)
|
|
|
|
// 根据不同的itemid跳转到不同页面
|
|
const pageMap = {
|
|
profile: '/pages/profile/edit-profile',
|
|
realname: '/pages/auth/realname-auth',
|
|
security_settings: '/pages/security/settings',
|
|
feedback: '/pages/feedback/feedback',
|
|
notifications: '/pages/notification/notification-center',
|
|
privacy: '/pages/privacy/settings',
|
|
about: '/pages/about/about',
|
|
service: '/pages/service/customer-service',
|
|
agreement: '/pages/agreement/user-agreement'
|
|
}
|
|
|
|
if (pageMap[itemid]) {
|
|
wx.navigateTo({ url: pageMap[itemid] })
|
|
}
|
|
},
|
|
|
|
// 设置
|
|
onTapSettings() {
|
|
wx.navigateTo({
|
|
url: '/pages/settings/settings'
|
|
})
|
|
},
|
|
|
|
// 退出登录
|
|
onLogout() {
|
|
wx.showModal({
|
|
title: '提示',
|
|
content: '确定要退出登录吗?',
|
|
success: (res) => {
|
|
if (res.confirm) {
|
|
// 清除登录状态
|
|
wx.removeStorageSync('token')
|
|
wx.removeStorageSync('userInfo')
|
|
|
|
// 跳转到登录页
|
|
wx.reLaunch({
|
|
url: '/pages/login/login'
|
|
})
|
|
}
|
|
}
|
|
})
|
|
},
|
|
|
|
// 分享
|
|
onShareAppMessage() {
|
|
return {
|
|
title: '健康管理,从这里开始',
|
|
path: '/pages/index/index'
|
|
}
|
|
}
|
|
})
|