diff --git a/app.json b/app.json index 6ddf3b1..50d188f 100644 --- a/app.json +++ b/app.json @@ -11,7 +11,10 @@ { "root": "pagesA", "pages": [ - "pages/wzai/wzai" + "pages/wzai/wzai", + "pages/askingSy/askingSy", + "pages/askingSyAdd/askingSyAdd", + "pages/askingSyDetails/askingSyDetails" ] }, { diff --git a/pages/home/home.js b/pages/home/home.js index 5dab60b..4109991 100644 --- a/pages/home/home.js +++ b/pages/home/home.js @@ -14,6 +14,7 @@ Page({ + // 轮播 getCarousel() { http.carousel({ @@ -47,6 +48,13 @@ Page({ }) }, + // 问兽医 + bindWsy(){ + wx.navigateTo({ + url: '/pagesA/pages/askingSy/askingSy', + }) + }, + //获取当前位置信息 getLocation() { diff --git a/pages/home/home.wxml b/pages/home/home.wxml index ece817b..3e3905c 100644 --- a/pages/home/home.wxml +++ b/pages/home/home.wxml @@ -41,7 +41,7 @@ - + 问兽医 智能匹配医生 平均5分钟恢复 diff --git a/pages/login/login.js b/pages/login/login.js index df767ef..abb3935 100644 --- a/pages/login/login.js +++ b/pages/login/login.js @@ -39,8 +39,8 @@ Page({ }); } - if (res.token) { - wx.setStorageSync('token', res.token) + if (res.data.token) { + wx.setStorageSync('token', res.data.token) wx.switchTab({ url: '/pages/home/home' }); diff --git a/pagesA/images/ch.png b/pagesA/images/ch.png new file mode 100644 index 0000000..a1b862e Binary files /dev/null and b/pagesA/images/ch.png differ diff --git a/pagesA/images/jh.png b/pagesA/images/jh.png new file mode 100644 index 0000000..ce4d71f Binary files /dev/null and b/pagesA/images/jh.png differ diff --git a/pagesA/pages/askingSy/askingSy.js b/pagesA/pages/askingSy/askingSy.js new file mode 100644 index 0000000..32e9cdc --- /dev/null +++ b/pagesA/pages/askingSy/askingSy.js @@ -0,0 +1,104 @@ +Page({ + data: { + diagnosisList: [ + { + id: 1, + status: 'replied', + createdAt:'2025-02-12', + userInfo: { + avatar: '/pages/images/tx.png', + nickName: '张小明' + }, + petInfo: { + type: '狗', + age: 3, + gender: '公' + }, + description: '最近三天食欲不振,精神萎靡,偶尔呕吐黄色泡沫,大便偏软带血丝,体温正常但鼻头干燥。', + images: ['/images/pet1.jpg', '/images/pet2.jpg'], + replies: [{}, {}, {}] + }, + { + id: 2, + status: 'pending', + createdAt: '2025-02-12', + userInfo: { + avatar: '/pages/images/tx.png', + nickName: '李小花' + }, + petInfo: { + type: '猫', + age: 2, + gender: '母' + }, + description: '今天发现眼睛有黄色分泌物,频繁抓挠眼睛周围,食欲正常但饮水量减少。', + images: ['/images/cat1.jpg'], + replies: [] + }, + { + id: 3, + status: 'replied', + createdAt: '2025-02-12', + userInfo: { + avatar: '/pages/images/tx.png', + nickName: '王先生' + }, + petInfo: { + type: '狗', + age: 5, + gender: '公' + }, + description: '狗狗最近走路跛脚,右前腿不敢着地,触摸时会叫。之前从沙发上跳下来可能受伤了。', + images: [], + replies: [{}, {}] + } + ] + }, + + onLoad: function() { + // 页面加载 + }, + + // 格式化日期显示 + formatDate: function(dateString) { + const date = new Date(dateString); + const now = new Date(); + const diff = now - date; + const diffDays = Math.floor(diff / (1000 * 60 * 60 * 24)); + const diffHours = Math.floor(diff / (1000 * 60 * 60)); + const diffMinutes = Math.floor(diff / (1000 * 60)); + + if (diffMinutes < 60) { + return `${diffMinutes}分钟前`; + } else if (diffHours < 24) { + return `${diffHours}小时前`; + } else if (diffDays === 1) { + return '昨天'; + } else if (diffDays === 2) { + return '前天'; + } else if (diffDays < 7) { + return `${diffDays}天前`; + } else { + const month = date.getMonth() + 1; + const day = date.getDate(); + return `${month}月${day}日`; + } + }, + + // 显示创建问诊单 + showCreateModal: function() { + wx.navigateTo({ + url: '/pagesA/pages/askingSyAdd/askingSyAdd', + }); + }, + + // 查看详情 + viewDetail: function(e) { + const index = e.currentTarget.dataset.index; + const item = this.data.diagnosisList[index]; + wx.navigateTo({ + url: `/pagesA/pages/askingSyDetails/askingSyDetails`, + }); + }, + +}); \ No newline at end of file diff --git a/pagesA/pages/askingSy/askingSy.json b/pagesA/pages/askingSy/askingSy.json new file mode 100644 index 0000000..6996a56 --- /dev/null +++ b/pagesA/pages/askingSy/askingSy.json @@ -0,0 +1,4 @@ +{ + "navigationBarTitleText":"问兽医", + "usingComponents": {} +} \ No newline at end of file diff --git a/pagesA/pages/askingSy/askingSy.wxml b/pagesA/pages/askingSy/askingSy.wxml new file mode 100644 index 0000000..91c517e --- /dev/null +++ b/pagesA/pages/askingSy/askingSy.wxml @@ -0,0 +1,87 @@ + + + + + + 问诊 + 专业兽医在线解答 + + + + + + + + + + + + + + 暂无问诊记录 + 开始您的第一次问诊吧 + + + + + + 问诊记录 + {{diagnosisList.length}}条 + + + + + + + + {{item.status === 'replied' ? '已回复' : '待回复'}} + + + + + + + 症状描述 + + + {{item.description}} + + + + + + + + {{item.createdAt}} + + + + + + {{item.replies.length}}条回复 + + + + + + + + + 已显示全部记录 + + + + + + + + 问诊单 + + + \ No newline at end of file diff --git a/pagesA/pages/askingSy/askingSy.wxss b/pagesA/pages/askingSy/askingSy.wxss new file mode 100644 index 0000000..259812d --- /dev/null +++ b/pagesA/pages/askingSy/askingSy.wxss @@ -0,0 +1,415 @@ +/* 全局样式 */ + .wzbox{ + min-height: 100vh; + position: relative; + background: linear-gradient(180deg, #F8FBFF 0%, #F0F7FF 100%); + } + + /* 头部样式优化 */ + .header { + padding: 20rpx 40rpx 20rpx; + background: linear-gradient(135deg, #6D9EFF 0%, #4A7CFF 100%); + border-radius: 0 0 36rpx 36rpx; + box-shadow: 0 4rpx 20rpx rgba(74, 144, 226, 0.15); + position: relative; + overflow: hidden; + } + + .header-content { + position: relative; + z-index: 2; + } + + .title-section { + display: flex; + flex-direction: column; + gap: 8rpx; + } + + .title { + font-size: 44rpx; + font-weight: 700; + color: #FFFFFF; + letter-spacing: 0.5rpx; + text-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1); + } + + .subtitle { + font-size: 28rpx; + color: rgba(255, 255, 255, 0.9); + font-weight: 400; + } + + /* 头部装饰元素 */ + .header-decoration { + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + overflow: hidden; + z-index: 1; + } + + .decoration-circle { + position: absolute; + border-radius: 50%; + background: rgba(255, 255, 255, 0.08); + } + + .circle-1 { + width: 200rpx; + height: 200rpx; + top: -80rpx; + right: -40rpx; + } + + .circle-2 { + width: 120rpx; + height: 120rpx; + bottom: -40rpx; + left: -20rpx; + } + + /* 问诊记录列表 */ + .record-list { + height: calc(100vh - 200rpx); + padding: 0 32rpx 20rpx; + box-sizing: border-box; + } + + .records-container { + padding-top: 24rpx; + } + + /* 列表头部 */ + .section-header { + display: flex; + justify-content: space-between; + align-items: center; + margin-bottom: 24rpx; + padding: 0 4rpx; + } + + .section-title { + font-size: 32rpx; + font-weight: 700; + color: #1A1A1A; + position: relative; + padding-left: 16rpx; + } + + .section-title::before { + content: ''; + position: absolute; + left: 0; + top: 50%; + transform: translateY(-50%); + width: 3rpx; + height: 20rpx; + background: linear-gradient(180deg, #6D9EFF 0%, #4A7CFF 100%); + border-radius: 2rpx; + } + + .section-count { + font-size: 26rpx; + color: #666; + background: #F0F7FF; + padding: 6rpx 16rpx; + border-radius: 16rpx; + font-weight: 500; + } + + /* 问诊记录卡片 */ + .record-card { + background: #FFFFFF; + border-radius: 24rpx; + margin-bottom: 24rpx; + box-shadow: 0 6rpx 24rpx rgba(74, 144, 226, 0.08); + position: relative; + overflow: hidden; + transition: all 0.3s cubic-bezier(0.2, 0, 0.2, 1); + border: 1rpx solid #F0F7FF; + } + + .record-card:active { + transform: translateY(-2rpx); + box-shadow: 0 10rpx 30rpx rgba(74, 144, 226, 0.15); + } + + /* 卡片头部 */ + .card-header { + display: flex; + justify-content: space-between; + align-items: flex-start; + padding: 28rpx 28rpx 24rpx; + border-bottom: 1rpx solid #F5F9FF; + } + + .user-info { + display: flex; + align-items: flex-start; + gap: 16rpx; + flex: 1; + } + + .user-avatar { + width: 60rpx; + height: 60rpx; + border-radius: 50%; + border: 2rpx solid rgba(255, 255, 255, 0.8); + box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.08); + } + + .user-details { + display: flex; + flex-direction: column; + gap: 6rpx; + } + + .user-name { + font-size: 28rpx; + color: #1A1A1A; + font-weight: 600; + line-height: 1.2; + } + + .pet-info { + font-size: 24rpx; + color: #666; + font-weight: 400; + line-height: 1.2; + } + + /* 状态标签 - 移至右上角 */ + .status-tag { + padding: 8rpx 20rpx; + border-radius: 20rpx; + font-size: 22rpx; + font-weight: 600; + min-width: 80rpx; + text-align: center; + flex-shrink: 0; + margin-left: 16rpx; + } + + .status-replied { + background: linear-gradient(135deg, rgba(76, 217, 100, 0.12) 0%, rgba(46, 204, 113, 0.12) 100%); + color: #2ECC71; + border: 1rpx solid rgba(46, 204, 113, 0.2); + } + + .status-pending { + background: linear-gradient(135deg, rgba(255, 149, 0, 0.12) 0%, rgba(255, 127, 0, 0.12) 100%); + color: #FF9500; + border: 1rpx solid rgba(255, 149, 0, 0.2); + } + + /* 症状描述 */ + .symptom-section { + padding: 24rpx 28rpx; + border-bottom: 1rpx solid #F5F9FF; + } + + .section-title-row { + display: flex; + align-items: center; + gap: 12rpx; + margin-bottom: 16rpx; + } + + + + .section-title-text { + font-size: 28rpx; + font-weight: 600; + color: #1A1A1A; + } + + .symptom-content { + display: flex; + align-items: flex-start; + gap: 20rpx; + } + + .symptom-text { + flex: 1; + font-size: 28rpx; + color: #333; + line-height: 1.6; + font-weight: 400; + } + + + + + /* 卡片底部 */ + .card-footer { + display: flex; + justify-content: space-between; + align-items: center; + padding: 20rpx 28rpx; + } + + .time-info { + display: flex; + align-items: center; + gap: 8rpx; + } + + + + .time-text { + font-size: 24rpx; + color: #999; + font-weight: 400; + } + + .reply-info { + display: flex; + align-items: center; + gap: 8rpx; + padding: 8rpx 16rpx; + background: #F0F7FF; + border-radius: 16rpx; + border: 1rpx solid #E5EFFF; + } + + .reply-count { + font-size: 24rpx; + font-weight: 500; + color: #4A7CFF; + } + + /* 空状态优化 */ + .empty-state { + display: flex; + flex-direction: column; + align-items: center; + padding-top: 120rpx; + text-align: center; + } + + .empty-icon { + width: 240rpx; + height: 180rpx; + margin-bottom: 32rpx; + opacity: 0.5; + } + + .empty-text { + font-size: 32rpx; + color: #666; + margin-bottom: 12rpx; + font-weight: 600; + } + + .empty-tip { + font-size: 26rpx; + color: #999; + margin-bottom: 40rpx; + line-height: 1.4; + } + + + /* 列表底部 */ + .list-footer { + text-align: center; + padding: 40rpx 0; + color: #999; + font-size: 24rpx; + } + + .footer-text { + opacity: 0.6; + letter-spacing: 1rpx; + } + + /* 新建问诊按钮优化 */ + .create-btn-container { + position: fixed; + bottom: 40rpx; + right: 32rpx; + z-index: 100; + } + + .create-btn { + width: 140rpx; + height: 140rpx; + background: linear-gradient(135deg, #6D9EFF 0%, #4A7CFF 100%); + border-radius: 50%; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + box-shadow: 0 8rpx 32rpx rgba(74, 144, 226, 0.3); + transition: all 0.3s cubic-bezier(0.2, 0, 0.2, 1); + position: relative; + overflow: hidden; + } + + .create-btn::after { + content: ''; + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + background: rgba(255, 255, 255, 0.1); + opacity: 0; + transition: opacity 0.2s ease; + } + + .create-btn:active { + transform: scale(0.95); + box-shadow: 0 4rpx 20rpx rgba(74, 144, 226, 0.4); + } + + .create-btn:active::after { + opacity: 1; + } + + .btn-icon { + width: 40rpx; + height: 40rpx; + margin-bottom: 10rpx; + } + + .btn-text { + font-size: 26rpx; + color: white; + font-weight: 600; + letter-spacing: 0.5rpx; + } + + /* 卡片入场动画 */ + @keyframes cardSlideIn { + from { + opacity: 0; + transform: translateY(30rpx); + } + to { + opacity: 1; + transform: translateY(0); + } + } + + .record-card { + animation: cardSlideIn 0.4s ease-out forwards; + opacity: 0; + } + + .record-card:nth-child(1) { animation-delay: 0.1s; } + .record-card:nth-child(2) { animation-delay: 0.15s; } + .record-card:nth-child(3) { animation-delay: 0.2s; } + .record-card:nth-child(4) { animation-delay: 0.25s; } + .record-card:nth-child(5) { animation-delay: 0.3s; } + + /* 响应式适配 */ + @media screen and (min-width: 768px) { + .record-card { + max-width: 600rpx; + margin-left: auto; + margin-right: auto; + } + } \ No newline at end of file diff --git a/pagesA/pages/askingSyAdd/askingSyAdd.js b/pagesA/pages/askingSyAdd/askingSyAdd.js new file mode 100644 index 0000000..f92969f --- /dev/null +++ b/pagesA/pages/askingSyAdd/askingSyAdd.js @@ -0,0 +1,148 @@ +Page({ + /** + * 页面的初始数据 + */ + data: { + formData: { + petType: '', + petAge: '', + petGender: '', + symptoms: '', + images: [] + }, + symptomsLength: 0, + isSubmitting: false, + isFormValid: false + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + // 初始化表单验证 + this.checkFormValidity(); + }, + + + // 宠物类型输入 + onPetTypeInput(e) { + const value = e.detail.value; + this.setData({ + 'formData.petType': value + }, () => { + this.checkFormValidity(); + }); + }, + + // 宠物年龄输入 + onPetAgeInput(e) { + const value = e.detail.value; + this.setData({ + 'formData.petAge': value + }, () => { + this.checkFormValidity(); + }); + }, + + // 选择性别 + selectGender(e) { + const value = e.currentTarget.dataset.value; + this.setData({ + 'formData.petGender': value + }, () => { + this.checkFormValidity(); + }); + }, + + // 症状描述输入 + onSymptomsInput(e) { + const value = e.detail.value; + this.setData({ + 'formData.symptoms': value, + symptomsLength: value.length + }, () => { + this.checkFormValidity(); + }); + }, + + // 选择图片 + chooseImage() { + if (this.data.formData.images.length >= 3) { + wx.showToast({ + title: '最多上传3张图片', + icon: 'none' + }); + return; + } + + wx.chooseImage({ + count: 3 - this.data.formData.images.length, + sizeType: ['compressed'], + sourceType: ['album', 'camera'], + success: (res) => { + const tempFilePaths = res.tempFilePaths; + const images = [...this.data.formData.images, ...tempFilePaths]; + this.setData({ + 'formData.images': images + }); + } + }); + }, + + // 移除图片 + removeImage(e) { + const index = e.currentTarget.dataset.index; + const images = [...this.data.formData.images]; + images.splice(index, 1); + this.setData({ + 'formData.images': images + }); + }, + + // 预览图片 + previewImage(e) { + const current = e.currentTarget.dataset.url; + const urls = e.currentTarget.dataset.urls; + + wx.previewImage({ + current, + urls + }); + }, + + // 检查表单有效性 + checkFormValidity() { + const { petType, petAge, petGender, symptoms } = this.data.formData; + const isValid = petType.trim() && petAge && petGender && symptoms.trim(); + this.setData({ + isFormValid: !!isValid + }); + }, + + // 表单提交 + submitForm(e) { + if (this.data.isSubmitting || !this.data.isFormValid) { + return; + } + + this.setData({ + isSubmitting: true + }); + + // 模拟提交 + setTimeout(() => { + wx.showToast({ + title: '提交成功', + icon: 'success', + duration: 1500, + success: () => { + setTimeout(() => { + wx.navigateTo({ + url: '/pagesA/pages/askingSy/askingSy', + }) + }, 1500); + } + }); + }, 1500); + } +}); \ No newline at end of file diff --git a/pagesA/pages/askingSyAdd/askingSyAdd.json b/pagesA/pages/askingSyAdd/askingSyAdd.json new file mode 100644 index 0000000..1ee3a2c --- /dev/null +++ b/pagesA/pages/askingSyAdd/askingSyAdd.json @@ -0,0 +1,4 @@ +{ + "navigationBarTitleText":"问诊单", + "usingComponents": {} +} \ No newline at end of file diff --git a/pagesA/pages/askingSyAdd/askingSyAdd.wxml b/pagesA/pages/askingSyAdd/askingSyAdd.wxml new file mode 100644 index 0000000..33df172 --- /dev/null +++ b/pagesA/pages/askingSyAdd/askingSyAdd.wxml @@ -0,0 +1,163 @@ + + + + +
+ + + + + + 牲畜类型 + + 必填 + + + + + + + + + 宠物信息 + + 必填 + + + + + + + 年龄 + + + + + + + + + + + 性别 + + + + + + + + + + + + + + + + + + 症状描述 + + 必填 + + +