Browse Source

AI问诊-个人中心

master
ZhaoYang 2 months ago
parent
commit
3d3c347b29
  1. BIN
      pages/images/bj.png
  2. BIN
      pages/images/fkjy.png
  3. BIN
      pages/images/gywm.png
  4. BIN
      pages/images/smrz.png
  5. BIN
      pages/images/sz.png
  6. BIN
      pages/images/wdxx.png
  7. BIN
      pages/images/wz.png
  8. 10
      pages/login/login.js
  9. 67
      pages/map/map.js
  10. 3
      pages/map/map.wxml
  11. 3
      pages/map/map.wxss
  12. 495
      pages/personal/personal.js
  13. 239
      pages/personal/personal.wxml
  14. 1035
      pages/personal/personal.wxss
  15. 186
      pagesA/pages/wzai/wzai.js
  16. 3
      pagesA/pages/wzai/wzai.json
  17. 24
      pagesA/pages/wzai/wzai.wxml
  18. 56
      pagesA/pages/wzai/wzai.wxss
  19. 13
      utils/api.js

BIN
pages/images/bj.png

After

Width: 200  |  Height: 200  |  Size: 3.3 KiB

BIN
pages/images/fkjy.png

After

Width: 200  |  Height: 200  |  Size: 4.5 KiB

BIN
pages/images/gywm.png

After

Width: 200  |  Height: 200  |  Size: 3.8 KiB

BIN
pages/images/smrz.png

After

Width: 200  |  Height: 200  |  Size: 4.3 KiB

BIN
pages/images/sz.png

After

Width: 200  |  Height: 200  |  Size: 6.5 KiB

BIN
pages/images/wdxx.png

After

Width: 200  |  Height: 200  |  Size: 6.5 KiB

BIN
pages/images/wz.png

After

Width: 200  |  Height: 200  |  Size: 4.2 KiB

10
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
})
}
}
})

67
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' } } });
}
})
},

3
pages/map/map.wxml

@ -41,7 +41,8 @@
<view class="detail-info">
<view class="info-item">
<text class="info-label">类型:</text>
<text class="info-value">{{currentMarker.merchantType}}</text>
<text class="info-value" wx:if="{{currentMarker.merchantType}}">{{currentMarker.merchantType}}</text>
<text class="info-value" wx:else>{{currentMarker.guideType}}</text>
</view>
<view class="info-item">
<text class="info-label">地区:</text>

3
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;

495
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'
};
}
})
});

239
pages/personal/personal.wxml

@ -1,147 +1,142 @@
<view class="personal-center">
<!-- 顶部背景 -->
<view class="header-bg"></view>
<!-- 用户信息卡片 -->
<view class="user-card" bindtap="onTapUserInfo">
<view class="user-info">
<view class="avatar-section">
<image class="avatar" src="{{userInfo.avatar || '/assets/images/avatar-default.png'}}" mode="aspectFill"></image>
<view class="avatar-badge" wx:if="{{userInfo.isVerified}}">
<text class="iconfont icon-check-circle"></text>
</view>
</view>
<view class="user-details">
<view class="user-name">
<text class="name">{{userInfo.nickname || '点击登录'}}</text>
<text class="iconfont icon-edit" wx:if="{{userInfo.nickname}}"></text>
</view>
<view class="user-phone">
<text class="iconfont icon-phone"></text>
<text>{{userInfo.phone || '未绑定手机号'}}</text>
<!-- 用户信息区域 -->
<view class="user-section fade-in">
<view class="user-card">
<!-- 头像 -->
<button class="avatar-btn" open-type="chooseAvatar" bindchooseavatar="onChooseAvatar">
<image class="avatar" src="{{avatarUrl || '/pages/images/tx.png'}}" mode="aspectFill"></image>
</button>
<!-- 用户信息 -->
<view class="user-info">
<view class="nickname-section" bindtap="editNickname">
<text class="nickname">{{userInfo.nickName || '微信用户'}}</text>
<image src="/pages/images/bj.png"></image>
</view>
<view class="user-tags">
<view class="tag" wx:if="{{userInfo.isDoctor}}">
<text class="iconfont icon-stethoscope"></text>
<text>医生认证</text>
</view>
<view class="tag" wx:if="{{userInfo.isVerified}}">
<text class="iconfont icon-shield-check"></text>
<text>已实名</text>
<view class="user-meta">
<view class="auth-tag {{userInfo.isVerified ? 'verified' : ''}}" bindtap="goToAuth">
<text>{{userInfo.isVerified ? '已认证' : '未认证'}}</text>
</view>
</view>
</view>
</view>
<view class="card-arrow">
<text class="iconfont icon-chevron-right"></text>
</view>
</view>
<!-- 统计数据 -->
<view class="stats-grid">
<view
wx:for="{{stats}}"
wx:key="id"
class="stat-item"
bindtap="onTapStat"
data-id="{{item.id}}"
>
<view class="stat-icon" style="color: {{item.color}};">
<text class="iconfont icon-{{item.icon}}"></text>
<!-- 消息通知 -->
<view class="section-card fade-in-delay-1">
<view class="section-header">
<text class="section-title">消息通知</text>
</view>
<view class="message-row">
<view class="message-item" bindtap="goToConsultation">
<view class="message-icon-wrapper">
<image class="message-icon" src="/pages/images/wz.png" mode=""></image>
</view>
<text class="message-label">问诊消息</text>
</view>
<view class="divider"></view>
<view class="message-item" bindtap="goToQA">
<view class="message-icon-wrapper">
<image class="message-icon" src="/pages/images/wdxx.png" mode=""></image>
</view>
<text class="message-label">问答消息</text>
</view>
<view class="stat-value">{{item.value}}</view>
<view class="stat-name">{{item.name}}</view>
</view>
</view>
<!-- 快捷操作 -->
<view class="quick-actions">
<view class="section-title">
<text class="iconfont icon-zap"></text>
<text>快捷操作</text>
</view>
<view class="actions-grid">
<view
wx:for="{{quickActions}}"
wx:key="id"
class="action-item"
bindtap="onTapQuickAction"
data-id="{{item.id}}"
>
<view class="action-icon" style="background: {{item.color}};">
<text class="iconfont icon-{{item.icon}}"></text>
<!-- 功能列表 -->
<view class="section-card fade-in-delay-2">
<view class="function-list">
<!-- 实名认证 -->
<view class="function-item" bindtap="goToAuth">
<view class="item-left">
<image class="item-icon" src="/pages/images/smrz.png"></image>
<text class="item-title">实名认证</text>
</view>
<view class="item-status {{userInfo.isVerified ? 'verified' : ''}}">
{{userInfo.isVerified ? '已认证' : '去认证'}}
</view>
</view>
<!-- 反馈建议 -->
<view class="function-item" bindtap="showFeedback">
<view class="item-left">
<image class="item-icon" src="/pages/images/fkjy.png"></image>
<text class="item-title">反馈建议</text>
</view>
</view>
<!-- 关于我们 -->
<view class="function-item" bindtap="goToAbout">
<view class="item-left">
<image class="item-icon" src="/pages/images/gywm.png"></image>
<text class="item-title">关于我们</text>
</view>
</view>
<!-- 设置 -->
<view class="function-item" bindtap="goToSettings">
<view class="item-left">
<image class="item-icon" src="/pages/images/sz.png"></image>
<text class="item-title">设置</text>
</view>
<view class="action-name">{{item.name}}</view>
</view>
</view>
</view>
<!-- 功能模块 -->
<view class="modules">
<block wx:for="{{modules}}" wx:key="id">
<view class="module-section">
<view class="section-title">
<text class="iconfont icon-{{item.icon}}"></text>
<text>{{item.name}}</text>
<!-- 反馈建议弹窗 -->
<view class="feedback-modal {{showFeedbackModal ? 'show' : ''}}">
<view class="modal-mask" bindtap="hideFeedback"></view>
<view class="modal-content">
<view class="modal-header">
<text class="modal-title">反馈建议</text>
<view class="modal-close" bindtap="hideFeedback">
<image src="/icons/close.png"></image>
</view>
<view class="module-items">
<view
wx:for="{{item.items}}"
wx:key="id"
class="module-item"
bindtap="onTapMenuItem"
data-moduleid="{{moduleId}}"
data-itemid="{{item.id}}"
>
<view class="item-left">
<view class="item-icon">
<text class="iconfont icon-{{item.icon}}"></text>
</view>
<view class="item-info">
<view class="item-name">{{item.name}}</view>
<view class="item-desc">{{item.desc}}</view>
<view
class="item-status {{item.statusColor || ''}}"
wx:if="{{item.status}}"
>
{{item.status}}
</view>
</view>
</view>
<view class="item-right">
<view class="badge" wx:if="{{item.badge > 0}}">
{{item.badge > 99 ? '99+' : item.badge}}
</view>
<text class="iconfont icon-chevron-right" wx:if="{{item.arrow}}"></text>
</view>
</view>
</view>
<view class="modal-body">
<textarea class="feedback-input" placeholder="请输入您的反馈或建议..." placeholder-class="placeholder" value="{{feedbackContent}}" bindinput="onFeedbackInput" maxlength="200" auto-height></textarea>
<view class="char-count">
<text class="current">{{feedbackContent.length}}</text>
<text class="total">/200</text>
</view>
</view>
</block>
</view>
<!-- 底部操作 -->
<view class="bottom-actions">
<view class="system-info">
<text>版本 {{systemInfo.version}}</text>
<text>最后登录 {{systemInfo.lastLogin}}</text>
<view class="modal-footer">
<button class="submit-btn {{canSubmit ? 'active' : ''}}" bindtap="submitFeedback" disabled="{{!canSubmit}}">
{{isSubmitting ? '提交中...' : '提交'}}
</button>
</view>
</view>
<view class="action-buttons">
<button class="btn btn-setting" bindtap="onTapSettings">
<text class="iconfont icon-settings"></text>
<text>设置</text>
</button>
<button class="btn btn-logout" bindtap="onLogout">
<text class="iconfont icon-log-out"></text>
<text>退出登录</text>
</button>
</view>
<!-- 修改昵称弹窗 -->
<view class="nickname-modal {{showNicknameModal ? 'show' : ''}}">
<view class="modal-mask" bindtap="hideNicknameModal"></view>
<view class="modal-content">
<view class="modal-header">
<text class="modal-title">修改昵称</text>
</view>
<view class="modal-body">
<input class="nickname-input" type="text" placeholder="请输入昵称" value="{{newNickname}}" bindinput="onNicknameInput" maxlength="10" />
<text class="input-tip">最多10个字符</text>
</view>
<view class="modal-footer">
<button class="cancel-btn" bindtap="hideNicknameModal">取消</button>
<button class="confirm-btn" bindtap="saveNickname">确定</button>
</view>
</view>
</view>
<!-- 提示信息 -->
<view class="toast {{showToast ? 'show' : ''}}">
<text>{{toastText}}</text>
</view>
</view>

1035
pages/personal/personal.wxss
File diff suppressed because it is too large
View File

186
pagesA/pages/wzai/wzai.js

@ -1,39 +1,18 @@
import http from '../../../utils/api'
Page({
data: {
// 当前时间
currentTime: '',
// 聊天消息
messages: [],
// 输入框相关
inputValue: '',
autoFocus: false,
// 症状选择
quickSymptoms: [
'发热', '咳嗽', '腹泻', '食欲不振',
'精神萎靡', '呼吸困难', '体重下降', '皮肤问题'
],
quickSymptoms: [],
wzsearch:{},
selectedSymptoms: [],
showSymptomSelector: false,
// 症状数据
symptoms: [
{ id: 1, name: '发热', category: '全身症状' },
{ id: 2, name: '咳嗽', category: '呼吸系统' },
{ id: 3, name: '腹泻', category: '消化系统' },
{ id: 4, name: '呕吐', category: '消化系统' },
{ id: 5, name: '食欲不振', category: '消化系统' },
{ id: 6, name: '呼吸困难', category: '呼吸系统' },
{ id: 7, name: '精神萎靡', category: '神经系统' },
{ id: 8, name: '体重下降', category: '全身症状' },
{ id: 9, name: '皮肤问题', category: '皮肤系统' },
{ id: 10, name: '跛行', category: '运动系统' },
{ id: 11, name: '眼部分泌物', category: '五官' },
{ id: 12, name: '流鼻涕', category: '呼吸系统' }
],
// 状态控制
isAIThinking: false,
isLoading: false,
@ -43,35 +22,55 @@ Page({
onLoad() {
this.initData();
this.getInquiry()
},
// AI问诊快捷字列表
getInquiry() {
http.inquiry({
data: {},
success: res => {
console.log(1111, res);
this.setData({
quickSymptoms: res.rows
})
}
})
},
onShow() {
this.updateCurrentTime();
this.setData({ autoFocus: true });
this.setData({
autoFocus: true
});
},
// 初始化数据
initData() {
// 设置当前时间
this.updateCurrentTime();
// 定时更新当前时间
setInterval(() => {
this.updateCurrentTime();
}, 60000);
},
// 更新当前时间
updateCurrentTime() {
const now = new Date();
const timeString = `${now.getHours().toString().padStart(2, '0')}:${now.getMinutes().toString().padStart(2, '0')}`;
this.setData({ currentTime: timeString });
this.setData({
currentTime: timeString
});
},
// 输入框变化
onInput(e) {
this.setData({ inputValue: e.detail.value });
this.setData({
inputValue: e.detail.value
});
},
// 发送消息
@ -93,6 +92,8 @@ Page({
autoFocus: true
});
console.log(666, this.data.messages)
// 模拟AI思考
this.simulateAIResponse(message);
},
@ -105,121 +106,60 @@ Page({
// 模拟AI响应
simulateAIResponse(userMessage) {
this.setData({ isAIThinking: true });
this.setData({
isAIThinking: true
});
console.log(888, userMessage);
// 模拟AI思考时间
setTimeout(() => {
const aiMessage = this.generateAIResponse(userMessage);
console.log(333,aiMessage);
console.log(333, aiMessage);
this.setData({
messages: [...this.data.messages, aiMessage],
isAIThinking: false
});
console.log(789, this.data.messages);
}, 1500 + Math.random() * 1000);
},
// 生成AI响应
generateAIResponse(userMessage) {
console.log(444,userMessage);
const responses = {
'发热': {
content: '根据您的描述,牲畜出现发热症状。',
diagnosis: {
disease: '可能为感染性疾病或中暑',
severity: 'moderate',
severityText: '中度',
suggestion: '建议:1. 隔离观察 2. 监测体温 3. 提供充足饮水 4. 如持续发热,及时联系兽医'
}
console.log(444, userMessage);
http.search({
data: {
keyword: userMessage
},
'咳嗽': {
content: '咳嗽症状提示可能存在呼吸系统问题。',
diagnosis: {
disease: '可能为呼吸道感染或肺炎',
severity: 'low',
severityText: '轻度',
suggestion: '建议:1. 保持圈舍通风 2. 避免粉尘 3. 观察呼吸频率 4. 如有加重及时就医'
}
},
'腹泻': {
content: '腹泻症状需要关注,可能由多种原因引起。',
diagnosis: {
disease: '可能为消化不良或肠胃感染',
severity: 'moderate',
severityText: '中度',
suggestion: '建议:1. 调整饲料 2. 补充电解质 3. 观察粪便性状 4. 如持续腹泻需兽医检查'
}
success: res => {
console.log('查询结果', res)
const wzsearch = res.rows[0]
return {
id: Date.now() + 1,
type: 'assistant',
content: wzsearch.title,
diagnosis: wzsearch,
time: this.getCurrentTime()
};
}
};
})
// 匹配症状关键词
let response = responses['发热']; // 默认响应
for (const [symptom, data] of Object.entries(responses)) {
if (userMessage.includes(symptom)) {
response = data;
break;
}
}
return {
id: Date.now() + 1,
type: 'assistant',
content: response.content,
diagnosis: response.diagnosis,
time: this.getCurrentTime()
};
},
// 选择快捷症状
selectQuickSymptom(e) {
console.log(1111,e);
const symptom = e.currentTarget.dataset.symptom;
this.setData({ inputValue: symptom });
const symptom = e.currentTarget.dataset.symptom.keywords;
this.setData({
inputValue: symptom
});
this.sendMessage();
},
// 切换症状选择器
toggleSymptomSelector() {
this.setData({ showSymptomSelector: !this.data.showSymptomSelector });
},
// 关闭症状选择器
closeSymptomSelector() {
this.setData({ showSymptomSelector: false });
},
// 症状选择
onSymptomSelect(e) {
const { symptom } = e.detail;
const selectedSymptoms = [...this.data.selectedSymptoms];
const index = selectedSymptoms.findIndex(s => s.id === symptom.id);
if (index > -1) {
selectedSymptoms.splice(index, 1);
} else {
selectedSymptoms.push(symptom);
}
this.setData({ selectedSymptoms });
},
// 确认症状选择
confirmSymptoms() {
if (this.data.selectedSymptoms.length === 0) {
wx.showToast({
title: '请选择至少一个症状',
icon: 'none'
});
return;
}
const symptomNames = this.data.selectedSymptoms.map(s => s.name).join('、');
this.setData({
inputValue: `我的牲畜出现以下症状:${symptomNames}`,
showSymptomSelector: false
});
},
// 返回
@ -229,12 +169,16 @@ Page({
// 显示更多菜单
showMoreMenu() {
this.setData({ showMoreMenu: true });
this.setData({
showMoreMenu: true
});
},
// 关闭更多菜单
closeMoreMenu() {
this.setData({ showMoreMenu: false });
this.setData({
showMoreMenu: false
});
},
// 阻止事件冒泡
@ -291,7 +235,7 @@ Page({
showInstructions() {
wx.showModal({
title: '使用说明',
content: '1. 描述您或牲畜的症状\n2. AI助手会分析并提供建议\n3. 可使用快捷症状选择\n4. 诊断结果仅供参考,请及时咨询专业兽医',
content: '1. 描述您或牲畜的症状2. AI助手会分析并提供建议3. 可使用快捷症状选择4. 诊断结果仅供参考,请及时咨询专业兽医',
showCancel: false
});
this.closeMoreMenu();

3
pagesA/pages/wzai/wzai.json

@ -1,5 +1,4 @@
{
"navigationBarTitleText":"AI问诊",
"navigationStyle": "custom",
"navigationBarTitleText":"AI智能问诊",
"usingComponents": {}
}

24
pagesA/pages/wzai/wzai.wxml

@ -1,22 +1,10 @@
<view class="diagnosis-container">
<!-- 自定义导航栏 -->
<view class="custom-navbar">
<view class="nav-left">
<view class="back-btn" bindtap="goBack">
<text class="back-icon">←</text>
</view>
</view>
<view class="nav-center">
<text class="nav-title">AI智能问诊</text>
<text class="nav-subtitle">与牧健康助手</text>
</view>
<view class="nav-right">
<view class="more-btn" bindtap="showMoreMenu">···</view>
</view>
</view>
<!-- 医生信息卡片 -->
<view class="doctor-card">
<view class="nav-right">
<view class="more-btn" bindtap="showMoreMenu">···</view>
</view>
<view class="doctor-avatar">
<image class="avatar-img" src="/pages/images/aiwz.png" mode="aspectFit"></image>
</view>
@ -74,7 +62,7 @@
</view>
<view class="message-content">
<view class="message-bubble assistant-bubble">
<text class="message-text">{{item.content}}</text>
<text class="message-text">根据您的描述,{{item.content}}</text>
<!-- 诊断结果卡片 -->
<view wx:if="{{item.diagnosis}}" class="diagnosis-card">
<view class="diagnosis-header">
@ -124,7 +112,7 @@
<text class="section-title">快速选择症状</text>
<scroll-view class="symptom-tags" scroll-x>
<view class="symptom-tag" wx:for="{{quickSymptoms}}" wx:key="id" bindtap="selectQuickSymptom" data-symptom="{{item}}">
<text class="tag-text">{{item}}</text>
<text class="tag-text">{{item.keywords}}</text>
</view>
</scroll-view>
</view>
@ -142,7 +130,6 @@
confirm-type="send"
focus="{{autoFocus}}"
/>
</view>
<button class="send-btn" bindtap="sendMessage" hover-class="send-btn-hover">
<text class="send-icon">↑</text>
@ -153,7 +140,6 @@
<symptom-selector
id="symptomSelector"
show="{{showSymptomSelector}}"
symptoms="{{symptoms}}"
selectedSymptoms="{{selectedSymptoms}}"
bind:select="onSymptomSelect"
bind:confirm="confirmSymptoms"

56
pagesA/pages/wzai/wzai.wxss

@ -7,62 +7,18 @@
background: linear-gradient(180deg, #f8fafc 0%, #f0f9ff 100%);
}
/* 自定义导航栏 */
.custom-navbar {
height: 120rpx;
padding-top: 40rpx;
background: linear-gradient(135deg, #86D8D0 0%, #6BC4BC 100%);
display: flex;
align-items: center;
justify-content: space-between;
padding: 40rpx 32rpx 20rpx;
box-shadow: 0 2rpx 12rpx rgba(134, 216, 208, 0.2);
}
.nav-left, .nav-right {
width: 80rpx;
}
.nav-center {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
}
.nav-title {
font-size: 36rpx;
font-weight: 600;
color: white;
margin-bottom: 4rpx;
}
.nav-subtitle {
font-size: 22rpx;
color: rgba(255, 255, 255, 0.8);
}
.back-btn {
width: 64rpx;
height: 64rpx;
border-radius: 50%;
background: rgba(255, 255, 255, 0.2);
display: flex;
align-items: center;
justify-content: center;
}
.back-icon {
color: white;
font-size: 36rpx;
font-weight: 300;
/* 顶部功能选择 */
.nav-right {
position: absolute;
right: 30rpx;
top: 30rpx;
}
.more-btn {
width: 64rpx;
height: 64rpx;
border-radius: 50%;
background: rgba(255, 255, 255, 0.2);
background:#86D8D0;
display: flex;
align-items: center;
justify-content: center;

13
utils/api.js

@ -11,7 +11,6 @@ function getPhoneNumber(params) {
http('/auth/wechat/bind', 'post', params)
}
// 轮播
function carousel(params) {
http('/muhu/ads/list', 'get', params)
@ -32,8 +31,18 @@ function guidance(params) {
http('/muhu/guide/list', 'get', params)
}
// AI问诊快捷词列表
function inquiry(params) {
http('/system/base/list', 'get', params)
}
// AI问诊模糊搜索
function search(params) {
http('/system/base/search', 'get', params)
}
export default { // 暴露接口
login,carousel,disaster,pharmacy,guidance,getPhoneNumber
login,carousel,disaster,pharmacy,guidance,getPhoneNumber,inquiry,
search
}
Loading…
Cancel
Save