diff --git a/pages/images/bj.png b/pages/images/bj.png new file mode 100644 index 0000000..1dfe6dd Binary files /dev/null and b/pages/images/bj.png differ diff --git a/pages/images/fkjy.png b/pages/images/fkjy.png new file mode 100644 index 0000000..f2743b0 Binary files /dev/null and b/pages/images/fkjy.png differ diff --git a/pages/images/gywm.png b/pages/images/gywm.png new file mode 100644 index 0000000..7a2cbfd Binary files /dev/null and b/pages/images/gywm.png differ diff --git a/pages/images/smrz.png b/pages/images/smrz.png new file mode 100644 index 0000000..eec18d1 Binary files /dev/null and b/pages/images/smrz.png differ diff --git a/pages/images/sz.png b/pages/images/sz.png new file mode 100644 index 0000000..3e72d5d Binary files /dev/null and b/pages/images/sz.png differ diff --git a/pages/images/wdxx.png b/pages/images/wdxx.png new file mode 100644 index 0000000..de2fbb7 Binary files /dev/null and b/pages/images/wdxx.png differ diff --git a/pages/images/wz.png b/pages/images/wz.png new file mode 100644 index 0000000..ec4dcc3 Binary files /dev/null and b/pages/images/wz.png differ diff --git a/pages/login/login.js b/pages/login/login.js index 334b10d..df767ef 100644 --- a/pages/login/login.js +++ b/pages/login/login.js @@ -27,6 +27,7 @@ Page({ clientType: 'herdsman-app' }, success: function (res) { + console.log(111111,res); if (res.data) { that.setData({ phoneData: res.data @@ -97,6 +98,15 @@ Page({ icon: 'success', duration: 2000 }); + }else{ + wx.showToast({ + title: res.msg, + icon: 'none', + duration: 2000 + }); + this.setData({ + isLoading:false + }) } } }) diff --git a/pages/map/map.js b/pages/map/map.js index 762ff16..a550905 100644 --- a/pages/map/map.js +++ b/pages/map/map.js @@ -9,7 +9,7 @@ Page({ longitude: null, latitude: null, markers: [], - activeTab: 'clinic', + activeTab: null, baseUr: baseUr, showDetail: false, currentMarker: null @@ -19,6 +19,7 @@ Page({ // 切换标签页 switchTab(e) { const tab = e.currentTarget.dataset.tab; + console.log(3333, e); this.setData({ activeTab: tab, showDetail: false // 切换标签时关闭详情 @@ -31,7 +32,6 @@ Page({ http.pharmacy({ data: {}, success: res => { - console.log(111, res); this.setData({ markers: res.rows.map((point, index) => ({ id: point.id, @@ -44,11 +44,11 @@ Page({ // 添加气泡标签显示名称 callout: { content: point.title, - color: '#333', + color: '#fff', fontSize: 12, - borderRadius: 4, - bgColor: '#ffffff', - padding: 4, + borderRadius: 6, + bgColor: '#2B5CA9', + padding: 5, display: 'ALWAYS' }, // 保存详细信息 @@ -57,7 +57,7 @@ Page({ address: point.address })) }) - + // 调整地图视野以显示所有标记 if (res.rows.length > 0) { this.adjustMapView(res.rows); @@ -71,26 +71,53 @@ Page({ data: {}, success: res => { console.log(222, res); - // 清除地图标记 this.setData({ - markers: [] - }); + markers: res.rows.map((point, index) => ({ + id: point.id, + title: point.title, + latitude: point.latitude, + longitude: point.longitude, + iconPath: point.iconPath ? baseUr + point.iconPath : '/pages/images/dw.png', + width: 35, + height: 35, + // 添加气泡标签显示名称 + callout: { + content: point.title, + color: '#fff', + fontSize: 12, + borderRadius: 6, + bgColor: '#2B5CA9', + padding: 4, + display: 'ALWAYS' + }, + // 保存详细信息 + merchantType: point.guideType, + region: point.region, + address: point.address + })) + }) + // 调整地图视野以显示所有标记 + if (res.rows.length > 0) { + this.adjustMapView(res.rows); + } } }) + + } }, // 调整地图视野以显示所有标记点 adjustMapView(points) { const mapContext = wx.createMapContext('myMap', this); - + if (points && points.length > 0) { // 将点转换为地图需要的格式 const mapPoints = points.map(point => ({ latitude: point.latitude, longitude: point.longitude })); - + // 如果有当前位置,也包含在内 if (this.data.latitude && this.data.longitude) { mapPoints.push({ @@ -98,7 +125,7 @@ Page({ longitude: this.data.longitude }); } - + // 调整地图视野 mapContext.includePoints({ points: mapPoints, @@ -111,7 +138,7 @@ Page({ onMarkerTap(e) { const markerId = e.markerId; const marker = this.data.markers.find(m => m.id === markerId); - + if (marker) { this.setData({ showDetail: true, @@ -138,8 +165,13 @@ Page({ // 导航到标记点 navigateToMarker() { if (this.data.currentMarker) { - const { latitude, longitude, title, address } = this.data.currentMarker; - + const { + latitude, + longitude, + title, + address + } = this.data.currentMarker; + wx.openLocation({ latitude: latitude, longitude: longitude, @@ -164,9 +196,6 @@ Page({ latitude: latitude, longitude: longitude }); - - // 加载初始数据 - that.switchTab({ currentTarget: { dataset: { tab: 'clinic' } } }); } }) }, diff --git a/pages/map/map.wxml b/pages/map/map.wxml index 1938400..4f8a66d 100644 --- a/pages/map/map.wxml +++ b/pages/map/map.wxml @@ -41,7 +41,8 @@ 类型: - {{currentMarker.merchantType}} + {{currentMarker.merchantType}} + {{currentMarker.guideType}} 地区: diff --git a/pages/map/map.wxss b/pages/map/map.wxss index faef587..a8b10a8 100644 --- a/pages/map/map.wxss +++ b/pages/map/map.wxss @@ -2,6 +2,7 @@ .page-container { width: 100%; min-height: 100vh; + padding: 10rpx 0; background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%); } @@ -227,7 +228,7 @@ color: white; border: none; border-radius: 8rpx; - padding: 16rpx 40rpx; + padding: 0rpx 40rpx; font-size: 28rpx; font-weight: 500; transition: transform 0.2s; diff --git a/pages/personal/personal.js b/pages/personal/personal.js index d066da2..45ecd65 100644 --- a/pages/personal/personal.js +++ b/pages/personal/personal.js @@ -1,330 +1,265 @@ Page({ data: { + // 用户信息 + avatarUrl: '', userInfo: { - avatar: '/assets/images/avatar.png', - nickname: '用户昵称', - phone: '138****8888', - isVerified: false, - isDoctor: false - }, + nickName: '', + userId: '', + isVerified: 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 - } - ] - } - ], + // 弹窗状态 + showFeedbackModal: false, + showNicknameModal: false, + showToast: false, - // 统计数据 - 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' - } - ], + // 反馈相关 + feedbackContent: '', + canSubmit: false, + isSubmitting: false, - // 快捷操作 - 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' - } + // 编辑相关 + newNickname: '', + // 提示信息 + toastText: '' }, onLoad() { - this.loadUserInfo() - this.checkNotifications() + this.loadUserInfo(); }, onShow() { - // 每次显示页面时刷新数据 - this.refreshData() + }, // 加载用户信息 loadUserInfo() { - // 模拟API调用 - setTimeout(() => { + // 从缓存获取用户信息 + const userInfo = wx.getStorageSync('userInfo'); + const avatarUrl = wx.getStorageSync('avatarUrl'); + + if (userInfo) { this.setData({ - 'userInfo.nickname': '张小凡', - 'userInfo.phone': '138****5678', - 'userInfo.isVerified': true, - 'userInfo.isDoctor': false - }) - }, 500) + userInfo, + avatarUrl + }); + } else { + // 首次使用,生成默认用户信息 + const defaultUserInfo = { + nickName: '微信用户', + isVerified: false + }; + + wx.setStorageSync('userInfo', defaultUserInfo); + this.setData({ userInfo: defaultUserInfo }); + } }, - // 检查通知 - 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 - }) - } - }) + + // 选择头像 + onChooseAvatar(e) { + const { avatarUrl } = e.detail; - this.setData({ modules: updatedModules }) + // 显示加载 + wx.showLoading({ + title: '更新中...', + mask: true + }); + + // 模拟上传过程 + setTimeout(() => { + this.setData({ avatarUrl }); + + // 保存到缓存 + wx.setStorageSync('avatarUrl', avatarUrl); + + wx.hideLoading(); + this.showToast('头像更新成功'); + }, 800); }, - // 刷新数据 - refreshData() { - // 刷新统计数据 - const updatedStats = this.data.stats.map(stat => ({ - ...stat, - value: String(Math.floor(Math.random() * 20) + 5) - })) - - this.setData({ stats: updatedStats }) + + + // 编辑昵称 + editNickname() { + this.setData({ + showNicknameModal: true, + newNickname: this.data.userInfo.nickName + }); }, - // 点击用户头像区域 - onTapUserInfo() { - wx.navigateTo({ - url: '/pages/profile/edit-profile' - }) + hideNicknameModal() { + this.setData({ showNicknameModal: false }); }, - // 点击统计项 - 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' + onNicknameInput(e) { + this.setData({ newNickname: e.detail.value }); + }, + + saveNickname() { + const newNickname = this.data.newNickname.trim(); + + if (!newNickname) { + this.showToast('昵称不能为空'); + return; } - if (urls[id]) { - wx.navigateTo({ url: urls[id] }) + if (newNickname.length > 20) { + this.showToast('昵称不能超过20个字符'); + return; } + + // 更新用户信息 + const updatedUserInfo = { + ...this.data.userInfo, + nickName: newNickname + }; + + this.setData({ + userInfo: updatedUserInfo, + showNicknameModal: false + }); + + // 保存到缓存 + wx.setStorageSync('userInfo', updatedUserInfo); + + this.showToast('昵称修改成功'); + }, + + // 查看问诊消息 + goToConsultation() { + wx.navigateTo({ + url: '' + }); + }, + + // 查看问答消息 + goToQA() { + wx.navigateTo({ + url: '' + }); }, - // 点击快捷操作 - 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' + // 实名认证 + goToAuth() { + if (this.data.userInfo.isVerified) { + this.showToast('您已完成实名认证'); + return; } - if (urls[id]) { - wx.navigateTo({ url: urls[id] }) - } + wx.navigateTo({ + url: '/pages/auth/realname' + }); + }, + + // 显示反馈弹窗 + showFeedback() { + this.setData({ + showFeedbackModal: true, + feedbackContent: '', + canSubmit: false, + isSubmitting: false + }); + }, + + hideFeedback() { + this.setData({ showFeedbackModal: false }); }, - // 点击功能项 - onTapMenuItem(e) { - const { moduleid, itemid } = e.currentTarget.dataset - console.log('点击:', moduleid, itemid) + // 反馈内容输入 + onFeedbackInput(e) { + const content = e.detail.value; + const canSubmit = content.trim().length > 0; - // 根据不同的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' - } + this.setData({ + feedbackContent: content, + canSubmit + }); + }, + + // 提交反馈 + submitFeedback() { + if (!this.data.canSubmit || this.data.isSubmitting) return; - if (pageMap[itemid]) { - wx.navigateTo({ url: pageMap[itemid] }) + const content = this.data.feedbackContent.trim(); + if (content.length < 5) { + this.showToast('请填写详细的反馈内容'); + return; } + + this.setData({ isSubmitting: true }); + + // 模拟提交到服务器 + setTimeout(() => { + console.log('提交反馈:', content); + + this.setData({ + isSubmitting: false, + showFeedbackModal: false + }); + + this.showToast('感谢您的反馈!'); + + // 这里应该是实际的API调用 + // wx.request({ + // url: 'https://your-api.com/feedback', + // method: 'POST', + // data: { content }, + // success: (res) => { + // this.showToast('提交成功'); + // }, + // complete: () => { + // this.setData({ + // isSubmitting: false, + // showFeedbackModal: false + // }); + // } + // }); + }, 1500); + }, + + // 关于我们 + goToAbout() { + wx.navigateTo({ + url: '/pages/about/index' + }); }, // 设置 - onTapSettings() { + goToSettings() { wx.navigateTo({ - url: '/pages/settings/settings' - }) + url: '/pages/settings/index' + }); + }, + + // 显示提示 + showToast(text) { + this.setData({ + toastText: text, + showToast: true + }); + + setTimeout(() => { + this.setData({ showToast: false }); + }, 2000); }, - // 退出登录 - onLogout() { - wx.showModal({ - title: '提示', - content: '确定要退出登录吗?', - success: (res) => { - if (res.confirm) { - // 清除登录状态 - wx.removeStorageSync('token') - wx.removeStorageSync('userInfo') - - // 跳转到登录页 - wx.reLaunch({ - url: '/pages/login/login' - }) - } - } - }) + // 下拉刷新 + onPullDownRefresh() { + this.loadUserInfo(); + this.checkUnreadMessages(); + + setTimeout(() => { + wx.stopPullDownRefresh(); + this.showToast('刷新成功'); + }, 1000); }, // 分享 onShareAppMessage() { return { - title: '健康管理,从这里开始', - path: '/pages/index/index' - } + title: '健康守护 - 您的个人健康中心', + path: '/pages/personal-center/index' + }; } -}) \ No newline at end of file +}); \ No newline at end of file diff --git a/pages/personal/personal.wxml b/pages/personal/personal.wxml index 09c0344..144aed9 100644 --- a/pages/personal/personal.wxml +++ b/pages/personal/personal.wxml @@ -1,147 +1,142 @@ - - - - - -