diff --git a/app.json b/app.json index 1eacbdb..3e73cbe 100644 --- a/app.json +++ b/app.json @@ -20,7 +20,9 @@ "pages/medicineDetails/medicineDetails", "pages/attestation/attestation", "pages/noticeList/noticeList", - "pages/noticeListDetails/noticeListDetails" + "pages/noticeListDetails/noticeListDetails", + "pages/todayInquiry/todayInquiry", + "pages/carouselDetail/carouselDetail" ] }, { diff --git a/pages/home/home.js b/pages/home/home.js index 0dad56b..2e5bcaa 100644 --- a/pages/home/home.js +++ b/pages/home/home.js @@ -271,12 +271,10 @@ Page({ // 轮播图点击 onSwiperTap(e) { console.log(1111, e); - var item = e.currentTarget.dataset.value - wx.showToast({ - title: `进入${item.adsType}`, - icon: 'none', - duration: 1000 - }); + var id = e.currentTarget.dataset.value.carouselId + wx.navigateTo({ + url: `/pagesA/pages/carouselDetail/carouselDetail?id=${id}`, + }) }, // 通知点击 diff --git a/pages/personal/personal.js b/pages/personal/personal.js index f381645..396bf70 100644 --- a/pages/personal/personal.js +++ b/pages/personal/personal.js @@ -4,11 +4,13 @@ const baseUrl = require('../../utils/baseUrl') Page({ data: { // 用户信息 - avatarUrl: '', + avatarUrl: '', // 原始头像路径(相对路径) + avatarFullUrl: '', // 完整的头像URL(用于显示) userInfo: { user: {} }, baseUrl: baseUrl, + displayNickName: '', // 显示用的昵称 // 弹窗状态 showFeedbackModal: false, @@ -35,15 +37,56 @@ Page({ // 上传状态 isUploadingAvatar: false, - isUpdatingNickname: false + isUpdatingNickname: false, + + // 消息数字 + totalToday: 0 }, onLoad() { - this.getUserInfo() + this.gettoday() + // 初始化时从缓存加载用户信息 + this.loadUserInfoFromCache() }, onShow() { + console.log('个人中心页面显示,重新获取用户信息') + // 每次显示页面都从服务器获取最新数据 this.getUserInfo() + // 刷新消息数 + this.gettoday() + }, + + // 从缓存加载用户信息(用于快速显示) + loadUserInfoFromCache() { + const cachedUserInfo = wx.getStorageSync('userInfo') + if (cachedUserInfo) { + const avatarFullUrl = this.buildAvatarUrl(cachedUserInfo.user?.avatar) + this.setData({ + userInfo: cachedUserInfo, + avatarUrl: cachedUserInfo.user?.avatar || '', + avatarFullUrl: avatarFullUrl, + displayNickName: cachedUserInfo.user?.nickName || '微信用户' + }) + } + }, + + // 构建完整的头像URL + buildAvatarUrl(avatarPath) { + if (!avatarPath) { + return '/pages/images/tx.png' + } + // 如果已经是完整URL,直接返回 + if (avatarPath.startsWith('http')) { + return avatarPath + } + // 如果是相对路径,拼接baseUrl + // 确保路径格式正确 + let cleanPath = avatarPath + if (cleanPath.startsWith('/')) { + cleanPath = cleanPath.substring(1) + } + return baseUrl + '/' + cleanPath }, // 获取用户信息 @@ -51,58 +94,52 @@ Page({ http.UserInfo({ data: {}, success: (res) => { + console.log('获取用户信息成功', res) if (res.data && res.data.user) { - wx.setStorageSync('userInfo', res.data) + // 构建完整的头像URL + const avatarFullUrl = this.buildAvatarUrl(res.data.user?.avatar) + + // 更新数据 this.setData({ userInfo: res.data, - avatarUrl: res.data.user?.avatar ? baseUrl + res.data.user.avatar : '' + avatarUrl: res.data.user?.avatar || '', + avatarFullUrl: avatarFullUrl, + displayNickName: res.data.user?.nickName || '微信用户' }) + + // 更新缓存 + wx.setStorageSync('userInfo', res.data) } }, fail: (err) => { console.error('获取用户信息失败:', err) // 使用缓存的用户信息 - const cachedUserInfo = wx.getStorageSync('userInfo') - if (cachedUserInfo) { - this.setData({ - userInfo: cachedUserInfo, - avatarUrl: cachedUserInfo.user?.avatar ? baseUrl + cachedUserInfo.user.avatar : '' - }) - } + this.loadUserInfoFromCache() } }) }, - // 更新用户信息到服务器 - updateUserInfo() { - const formData = this.data.formData - // 过滤掉空值 - const dataToUpdate = {} - if (formData.avatar) dataToUpdate.avatar = formData.avatar - if (formData.nickName) dataToUpdate.nickName = formData.nickName - - if (Object.keys(dataToUpdate).length === 0) return - - http.revise({ - data: dataToUpdate, - success: (res) => { - // 清空表单数据 - this.setData({ - 'formData.avatar': null, - 'formData.nickName': null - }) - // 立即刷新用户信息 - this.getUserInfo() + // 问诊消息 - 获取今日消息数 + gettoday() { + http.today({ + data: {}, + success: res => { + if (res.rows && res.rows[0]) { + const num = res.rows[0].totalTodayReplyCount || 0 + this.setData({ + totalToday: num + }) + } }, - fail: (err) => { - console.error('更新失败:', err) - this.showToast('更新失败,请重试') + fail: err => { + console.error('获取消息数失败', err) } }) }, // 选择头像 onChooseAvatar(e) { + // 防止重复上传 if (this.data.isUploadingAvatar) { this.showToast('正在上传中...') return @@ -130,27 +167,62 @@ Page({ filePath: avatarUrl, name: 'file', success: (uploadRes) => { - wx.hideLoading() - try { const result = JSON.parse(uploadRes.data) + console.log('上传结果', result) + if (result && result.fileName) { - // 立即更新本地显示 + // 获取上传后的文件路径 + const uploadedFilePath = result.fileName + // 构建完整的头像URL + const fullAvatarUrl = this.buildAvatarUrl(uploadedFilePath) + + console.log('上传成功,新头像路径:', uploadedFilePath) + console.log('完整头像URL:', fullAvatarUrl) + + // 1. 立即更新本地显示 this.setData({ - avatarUrl: avatarUrl, - 'formData.avatar': result.fileName, - 'userInfo.user.avatar': result.fileName + avatarUrl: uploadedFilePath, + avatarFullUrl: fullAvatarUrl, + 'userInfo.user.avatar': uploadedFilePath }) - // 更新到服务器 - this.updateUserInfo() + // 2. 更新缓存中的用户信息 + const cachedUserInfo = wx.getStorageSync('userInfo') || {} + if (!cachedUserInfo.user) { + cachedUserInfo.user = {} + } + cachedUserInfo.user.avatar = uploadedFilePath + wx.setStorageSync('userInfo', cachedUserInfo) + + + console.log(3435353,uploadedFilePath); + // 3. 单独调用更新头像的API + http.revise({ + data: { avatar: uploadedFilePath }, + success: (res) => { + console.log('头像更新成功') + wx.hideLoading() + this.showToast('头像更新成功') + + // 4. 重新获取用户信息以确保数据同步 + setTimeout(() => { + this.getUserInfo() + }, 500) + }, + fail: (err) => { + console.error('头像更新失败:', err) + wx.hideLoading() + this.showToast('头像保存失败,请重试') + } + }) - this.showToast('头像更新成功') } else { - throw new Error('上传失败') + throw new Error('上传失败:返回数据格式错误') } } catch (error) { console.error('解析上传结果失败:', error) + wx.hideLoading() this.showToast('上传失败,请重试') } }, @@ -169,7 +241,7 @@ Page({ editNickname() { this.setData({ showNicknameModal: true, - newNickname: this.data.userInfo.user?.nickName || '' + newNickname: this.data.userInfo.user?.nickName || this.data.displayNickName || '' }) }, @@ -195,7 +267,8 @@ Page({ } // 如果昵称没有变化,直接关闭弹窗 - if (newNickname === this.data.userInfo.user?.nickName) { + const currentNickName = this.data.userInfo.user?.nickName || this.data.displayNickName + if (newNickname === currentNickName) { this.hideNicknameModal() return } @@ -205,37 +278,60 @@ Page({ // 立即更新本地显示 this.setData({ 'userInfo.user.nickName': newNickname, + displayNickName: newNickname, 'formData.nickName': newNickname }) - // 更新到服务器 - this.updateUserInfo() + // 更新缓存 + const cachedUserInfo = wx.getStorageSync('userInfo') || {} + if (!cachedUserInfo.user) { + cachedUserInfo.user = {} + } + cachedUserInfo.user.nickName = newNickname + wx.setStorageSync('userInfo', cachedUserInfo) - this.setData({ - showNicknameModal: false, - isUpdatingNickname: false + // 更新到服务器 + http.revise({ + data: { nickName: newNickname }, + success: (res) => { + console.log('昵称更新成功') + this.setData({ + showNicknameModal: false, + isUpdatingNickname: false, + 'formData.nickName': null + }) + this.showToast('昵称修改成功') + + // 重新获取用户信息以确保数据同步 + setTimeout(() => { + this.getUserInfo() + }, 500) + }, + fail: (err) => { + console.error('昵称更新失败:', err) + this.setData({ isUpdatingNickname: false }) + this.showToast('修改失败,请重试') + } }) - - this.showToast('昵称修改成功') }, // 查看问诊消息 goToConsultation() { wx.navigateTo({ - url: '' + url: '/pagesA/pages/todayInquiry/todayInquiry' }) }, // 查看问答消息 goToQA() { wx.navigateTo({ - url: '' + url: '' // 请填写实际的问答消息页面路径 }) }, // 实名认证 goToAuth() { - if (this.data.userInfo.authStatus) { + if (this.data.userInfo.authStatus == '已认证') { this.showToast('您已完成实名认证') } else { wx.navigateTo({ @@ -250,12 +346,16 @@ Page({ showFeedbackModal: true, feedbackContent: '', canSubmit: false, - isSubmitting: false + isSubmitting: false, + textareaFocus: true }) }, hideFeedback() { - this.setData({ showFeedbackModal: false }) + this.setData({ + showFeedbackModal: false, + textareaFocus: false + }) }, // 反馈内容输入 @@ -272,7 +372,6 @@ Page({ // 提交反馈 submitFeedback() { if (!this.data.canSubmit || this.data.isSubmitting) return - const content = this.data.feedbackContent.trim() if (content.length < 5) { this.showToast('请填写详细的反馈内容') @@ -281,28 +380,28 @@ Page({ this.setData({ isSubmitting: true }) - // 提交 - setTimeout(() => { - console.log('提交反馈:', content) - http.feedback({ - data:{ - content:content - }, - success:res=>{ - if(res.code==200){ - this.showToast('感谢您的反馈!') - }else{ - this.showToast('反馈失败!') - } - this.setData({ - isSubmitting: false, - showFeedbackModal: false - }) + http.feedback({ + data: { + content: content + }, + success: res => { + if (res.code == 200) { + this.showToast('感谢您的反馈!') + } else { + this.showToast('反馈失败!') } - }) - - - }, 1500) + this.setData({ + isSubmitting: false, + showFeedbackModal: false, + textareaFocus: false + }) + }, + fail: (err) => { + console.error('反馈失败:', err) + this.showToast('反馈失败,请重试') + this.setData({ isSubmitting: false }) + } + }) }, // 退出登录相关 @@ -317,7 +416,7 @@ Page({ doLogout() { // 清除本地存储 wx.clearStorageSync() - + // 跳转到登录页 wx.reLaunch({ url: '/pages/login/login' @@ -340,6 +439,7 @@ Page({ // 下拉刷新 onPullDownRefresh() { this.getUserInfo() + this.gettoday() // 刷新消息数 setTimeout(() => { wx.stopPullDownRefresh() @@ -347,11 +447,4 @@ Page({ }, 1000) }, - // 分享 - onShareAppMessage() { - return { - title: '健康守护 - 您的个人健康中心', - path: '/pages/personal-center/index' - } - } }) \ No newline at end of file diff --git a/pages/personal/personal.wxml b/pages/personal/personal.wxml index 3f0c3c5..29ab65b 100644 --- a/pages/personal/personal.wxml +++ b/pages/personal/personal.wxml @@ -1,23 +1,23 @@ - - + + - - @@ -34,12 +34,15 @@ + + + + {{totalToday}} + 问诊消息 - - @@ -59,7 +62,7 @@ 实名认证 - {{userInfo.authStatus ? '已认证' : '去认证'}} + {{userInfo.authStatus}} diff --git a/pages/personal/personal.wxss b/pages/personal/personal.wxss index 07fadee..918c93f 100644 --- a/pages/personal/personal.wxss +++ b/pages/personal/personal.wxss @@ -255,6 +255,55 @@ height: 60rpx; } +/* 数字气泡 - 定位在顶部 */ +.badge { + position: absolute; + top: -10rpx; + right: -10rpx; + display: flex; + align-items: center; + justify-content: center; + z-index: 2; +} + +.badge-num { + background: linear-gradient(135deg, #ff6b6b, #ee5253); + border-radius: 36rpx; + color: white; + font-size: 22rpx; + font-weight: 600; + display: flex; + align-items: center; + justify-content: center; + padding: 0 10rpx; + box-shadow: 0 4rpx 8rpx rgba(238, 82, 83, 0.3); +} + +/* 动画效果:跳动+呼吸 */ +.animation-badge { + animation: badgeBounce 2.5s ease-in-out infinite; +} + +@keyframes badgeBounce { + 0%, 100% { + transform: scale(1); + } + 30% { + transform: scale(1.2); + } + 50% { + transform: scale(1.1); + } + 70% { + transform: scale(1.15); + } +} + +/* 可选的小红点效果(如果有需要可以保留,当前用的是数字) */ +.badge-dot { + display: none; /* 隐藏,用数字替代 */ +} + .message-label { font-size: 26rpx; color: #475569; diff --git a/pagesA/pages/askingSyDetails/askingSyDetails.js b/pagesA/pages/askingSyDetails/askingSyDetails.js index eb69d8b..9f710c2 100644 --- a/pagesA/pages/askingSyDetails/askingSyDetails.js +++ b/pagesA/pages/askingSyDetails/askingSyDetails.js @@ -1,13 +1,14 @@ import http from '../../../utils/api' const baseUrl = require('../../../utils/baseUrl') + Page({ /** * 页面的初始数据 */ data: { - diagnosisData:{}, - replies:[], - baseUrl:baseUrl, + diagnosisData: {}, + replies: [], + baseUrl: baseUrl, refreshing: false }, @@ -17,45 +18,95 @@ Page({ onLoad(options) { if (options.data) { // 根据id加载兽医回复数据 - const data = JSON.parse(decodeURIComponent(options.data)); - - if(data.images){ - const images = data.images.split(',') - this.setData({ - images:images - }) + const data = JSON.parse(decodeURIComponent(options.data)); + + // 处理用户图片 - 确保是数组格式 + if (data.images) { + if (typeof data.images === 'string') { + data.images = data.images.split(',') + } + console.log('用户图片:', data.images); + } else { + data.images = []; } + this.setData({ - diagnosisData:data, + diagnosisData: data, }) this.loadDiagnosisData(data.formId); } }, - // 加载问诊数据 + /** + * 加载问诊数据(兽医回复) + * @param {string} id - 问诊ID + */ loadDiagnosisData(id) { console.log('加载问诊数据:', id); - http.wzdxq({ - data:{ - consultationId:id - }, - success:res=>{ - console.log(111111111,res); - this.setData({ - replies:res.rows - }) - } - }) + http.wzdxq({ + data: { + consultationId: id + }, + success: res => { + // 处理兽医回复的图片 + let replies = []; + + if (res && res.rows) { + replies = res.rows || []; + + // 遍历每个回复,处理图片字段 + for (let i = 0; i < replies.length; i++) { + const item = replies[i]; + + // 处理图片 - 确保是数组格式 + if (item.images) { + if (typeof item.images === 'string') { + // 如果是空字符串,设为空数组 + if (item.images.trim() === '') { + item.images = []; + } else { + // 按逗号分割字符串 + item.images = item.images.split(','); + } + } else if (Array.isArray(item.images)) { + // 已经是数组,但需要过滤空值 + item.images = item.images.filter(img => img && img.trim() !== ''); + } else { + item.images = []; + } + } else { + item.images = []; + } + + console.log(`兽医回复[${i}]图片:`, item.images); + } + } + + console.log('兽医回复数据:', replies); + this.setData({ + replies: replies + }) + }, + fail: err => { + console.error('加载回复失败:', err); + wx.showToast({ + title: '加载失败', + icon: 'none' + }); + } + }) }, - - - // 返回上一页 + /** + * 返回上一页 + */ goBack() { wx.navigateBack(); }, - // 分享 + /** + * 分享 + */ onShare() { wx.showActionSheet({ itemList: ['分享给好友', '保存到相册'], @@ -70,13 +121,18 @@ Page({ }); }, - // 下拉刷新 + /** + * 下拉刷新 + */ onRefresh() { this.setData({ refreshing: true }); - this.loadDiagnosisData(this.data.diagnosisData.formId) + if (this.data.diagnosisData && this.data.diagnosisData.formId) { + this.loadDiagnosisData(this.data.diagnosisData.formId) + } + setTimeout(() => { this.setData({ refreshing: false @@ -88,17 +144,131 @@ Page({ }, 1000); }, - // 预览图片 + /** + * 预览用户图片 + */ previewImage(e) { - const current = e.currentTarget.dataset.url; - const urls = e.currentTarget.dataset.urls; - const urlsArray = urls.map(item=>{ - return baseUrl+item - }) - console.log(666,urlsArray); + const dataset = e.currentTarget.dataset; + const current = dataset.url; + const urls = dataset.urls || []; + + // 构建完整URL数组 + const urlsArray = urls.map(item => { + // 如果已经是完整URL,直接返回 + if (typeof item === 'string' && (item.startsWith('http://') || item.startsWith('https://'))) { + return item; + } + // 否则拼接baseUrl + return baseUrl + item; + }); + + console.log('预览用户图片:', urlsArray); wx.previewImage({ - current:current, - urls:urlsArray + current: current, + urls: urlsArray }); }, + + /** + * 预览兽医回复图片 - 修复版 + */ + previewReplyImage(e) { + const dataset = e.currentTarget.dataset; + + // 获取数据 - 使用三种可能的来源 + const currentFileName = dataset.url; // 当前点击的图片文件名 + const currentFullUrl = dataset.fullurl; // 当前点击的图片完整URL + const urlsArray = dataset.urls || []; // 该回复的所有图片文件名数组 + const currentIndex = dataset.currentIndex || 0; // 当前点击图片的索引 + const replyIndex = dataset.replyIndex; // 回复在列表中的索引 + + console.log('预览兽医图片 - 数据集:', dataset); + + // 方法1: 从replies数据中获取当前回复的图片列表 + let targetUrls = []; + let targetCurrentUrl = ''; + + if (replyIndex !== undefined && this.data.replies[replyIndex]) { + // 从replies数据中获取完整的图片列表 + const reply = this.data.replies[replyIndex]; + if (reply.images && reply.images.length > 0) { + targetUrls = reply.images; + + // 构建完整URL数组 + const fullUrls = targetUrls.map(img => { + if (typeof img === 'string' && (img.startsWith('http://') || img.startsWith('https://'))) { + return img; + } + return baseUrl + img; + }); + + // 确定当前图片的完整URL + if (currentIndex < fullUrls.length) { + targetCurrentUrl = fullUrls[currentIndex]; + } else if (currentFullUrl) { + targetCurrentUrl = currentFullUrl; + } else if (currentFileName) { + targetCurrentUrl = baseUrl + currentFileName; + } + + console.log('预览兽医回复图片(从replies数据):', fullUrls, '当前:', targetCurrentUrl); + + wx.previewImage({ + current: targetCurrentUrl, + urls: fullUrls + }); + return; + } + } + + // 方法2: 使用dataset中的数据 + if (urlsArray && urlsArray.length > 0) { + // 构建完整URL数组 + const fullUrls = urlsArray.map(item => { + if (typeof item === 'string' && (item.startsWith('http://') || item.startsWith('https://'))) { + return item; + } + return baseUrl + item; + }); + + // 确定当前图片的完整URL + let currentUrl = ''; + if (currentFullUrl) { + currentUrl = currentFullUrl; + } else if (currentIndex < fullUrls.length) { + currentUrl = fullUrls[currentIndex]; + } else if (currentFileName) { + currentUrl = baseUrl + currentFileName; + } + + console.log('预览兽医回复图片(从dataset):', fullUrls, '当前:', currentUrl); + + wx.previewImage({ + current: currentUrl, + urls: fullUrls + }); + return; + } + + // 方法3: 只预览单张图片 + if (currentFullUrl) { + console.log('预览单张兽医图片:', [currentFullUrl]); + wx.previewImage({ + current: currentFullUrl, + urls: [currentFullUrl] + }); + } else if (currentFileName) { + const fullUrl = baseUrl + currentFileName; + console.log('预览单张兽医图片(拼接后):', [fullUrl]); + wx.previewImage({ + current: fullUrl, + urls: [fullUrl] + }); + } else { + wx.showToast({ + title: '图片预览失败', + icon: 'none' + }); + } + } }); \ No newline at end of file diff --git a/pagesA/pages/askingSyDetails/askingSyDetails.wxml b/pagesA/pages/askingSyDetails/askingSyDetails.wxml index 6c9ac31..3afb31a 100644 --- a/pagesA/pages/askingSyDetails/askingSyDetails.wxml +++ b/pagesA/pages/askingSyDetails/askingSyDetails.wxml @@ -1,151 +1,177 @@ - - - - - - - \ No newline at end of file diff --git a/pagesA/pages/askingSyDetails/askingSyDetails.wxss b/pagesA/pages/askingSyDetails/askingSyDetails.wxss index 8334d7a..a9e0110 100644 --- a/pagesA/pages/askingSyDetails/askingSyDetails.wxss +++ b/pagesA/pages/askingSyDetails/askingSyDetails.wxss @@ -252,7 +252,7 @@ font-weight: 500; } -/* 症状描述区域 - 调整到最左边 */ +/* 症状描述区域 */ .symptom-section { padding: 32rpx; position: relative; @@ -544,7 +544,6 @@ } - /* 无回复状态 */ .no-replies { background: #FFFFFF; @@ -557,13 +556,6 @@ overflow: hidden; } -.no-replies-icon { - width: 200rpx; - height: 150rpx; - margin-bottom: 32rpx; - opacity: 0.6; - filter: hue-rotate(200deg); -} .no-replies-title { font-size: 32rpx; @@ -604,4 +596,75 @@ /* 页面底部安全区域 */ .page-bottom { height: 60rpx; +} + +/* 新增兽医回复图片预览 */ +.reply-images-section { + margin-top: 24rpx; + padding: 0 8rpx; +} + +.reply-images-grid { + display: grid; + gap: 12rpx; + width: 100%; +} + +/* 根据图片数量自适应网格 */ +.reply-images-grid.grid-1 { + grid-template-columns: repeat(1, minmax(200rpx, 320rpx)); + justify-content: start; +} + +.reply-images-grid.grid-2 { + grid-template-columns: repeat(2, 1fr); +} + +.reply-images-grid.grid-3, +.reply-images-grid.grid-4, +.reply-images-grid:not(.grid-1):not(.grid-2) { + /* 超过2张时显示为2列网格*/ + grid-template-columns: repeat(2, 1fr); +} + +.reply-image-wrapper { + position: relative; + border-radius: 16rpx; + overflow: hidden; + background-color: #f5f5f5; + aspect-ratio: 1 / 1; /* 保持正方形 */ + box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.1); + transition: transform 0.2s ease; +} + +.reply-image-wrapper:active { + transform: scale(0.98); +} + +.reply-image { + width: 100%; + height: 100%; + border-radius: 16rpx; + object-fit: cover; +} + +/* 图片数量遮罩(超过4张时显示) */ +.image-more-mask { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + background-color: rgba(0, 0, 0, 0.5); + display: flex; + align-items: center; + justify-content: center; + border-radius: 16rpx; +} + +.more-count { + color: #fff; + font-size: 36rpx; + font-weight: 700; + text-shadow: 0 2rpx 4rpx rgba(0,0,0,0.3); } \ No newline at end of file diff --git a/pagesA/pages/attestation/attestation.wxss b/pagesA/pages/attestation/attestation.wxss index b8a23e7..ddfcfac 100644 --- a/pagesA/pages/attestation/attestation.wxss +++ b/pagesA/pages/attestation/attestation.wxss @@ -1371,7 +1371,6 @@ page { visibility: hidden; transition: all 0.3s ease; z-index: 9999; - padding: 40rpx; } .modal-overlay.show { @@ -1380,7 +1379,6 @@ page { } .modal-container { - width: 600rpx; max-width: 90vw; background: #fff; border-radius: 20rpx; diff --git a/pagesA/pages/carouselDetail/carouselDetail.js b/pagesA/pages/carouselDetail/carouselDetail.js new file mode 100644 index 0000000..1de867c --- /dev/null +++ b/pagesA/pages/carouselDetail/carouselDetail.js @@ -0,0 +1,161 @@ +import http from '../../../utils/api'; +const baseUrl = require('../../../utils/baseUrl'); + +Page({ + /** + * 页面的初始数据 + */ + data: { + baseUrl: baseUrl, + detailInfo: {}, + id: null, + cardAnimation: {} // 卡片动画数据 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + if (options.id) { + this.setData({ id: options.id }); + this.getCarouselDetail(options.id); + this.initAnimation(); + } else { + wx.showToast({ + title: '参数错误', + icon: 'none' + }); + } + }, + + /** + * 初始化卡片动画 + */ + initAnimation() { + const animation = wx.createAnimation({ + duration: 600, + timingFunction: 'ease-out', + delay: 100 + }); + + animation.translateY(0).opacity(1).step(); + + this.setData({ + cardAnimation: animation.export() + }); + }, + + /** + * 获取轮播详情 + */ + getCarouselDetail(id) { + wx.showLoading({ title: '加载中...', mask: true }); + + http.carouselDetail({ + data: { id: id }, + success: (res) => { + wx.hideLoading(); + console.log('轮播详情:', res); + + if (res && res.code === 200 && res.data) { + this.setData({ + detailInfo: res.data + }); + + // 设置导航栏颜色为主题色 + wx.setNavigationBarColor({ + frontColor: '#ffffff', + backgroundColor: res.data.textColor?.replace('#', '') || '2E7D32' + }); + + wx.setNavigationBarTitle({ + title: res.data.title || '轮播详情' + }); + } else { + wx.showToast({ + title: res?.msg || '数据加载失败', + icon: 'none' + }); + } + }, + fail: (err) => { + wx.hideLoading(); + console.error('请求失败:', err); + wx.showToast({ + title: '网络错误', + icon: 'none' + }); + } + }); + }, + + /** + * 颜色调整函数(用于渐变效果) + */ + adjustColor(hex, percent) { + if (!hex) return '#4CAF50'; + // 简单实现:如果传入颜色,返回稍浅的版本 + // 这里为了简化,直接返回原色稍微变浅,实际项目中可使用颜色处理库 + return hex; + }, + + /** + * 图片加载错误处理 + */ + imageLoadError(e) { + console.warn('图片加载失败', e); + + }, + + + /** + * 返回上一页 + */ + goBack() { + wx.navigateBack({ + delta: 1 + }); + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() {}, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() {}, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() {}, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() {}, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() {}, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() {}, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + const { title, imageUrl } = this.data.detailInfo; + return { + title: title || '轮播详情', + imageUrl: this.data.baseUrl + (imageUrl || ''), + path: `/pages/carousel/detail/detail?id=${this.data.id}` + }; + } +}); \ No newline at end of file diff --git a/pagesA/pages/carouselDetail/carouselDetail.json b/pagesA/pages/carouselDetail/carouselDetail.json new file mode 100644 index 0000000..faa193e --- /dev/null +++ b/pagesA/pages/carouselDetail/carouselDetail.json @@ -0,0 +1,4 @@ +{ + "navigationBarTitleText":"轮播详情", + "usingComponents": {} +} \ No newline at end of file diff --git a/pagesA/pages/carouselDetail/carouselDetail.wxml b/pagesA/pages/carouselDetail/carouselDetail.wxml new file mode 100644 index 0000000..5eae72b --- /dev/null +++ b/pagesA/pages/carouselDetail/carouselDetail.wxml @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + {{detailInfo.adsType}} + + + + + + + + + {{detailInfo.title || '无标题'}} + {{detailInfo.subtitle || '暂无副标题'}} + + + + + + + + + + + + + + 📐 + + 图片尺寸 + {{detailInfo.imageSize}} + + + + + + 👁️ + + 展示次数 + {{detailInfo.displayCount}} + + + + + + 🖱️ + + 点击次数 + {{detailInfo.clickCount}} + + + + + + 📅 + + 创建时间 + {{detailInfo.createdAt}} + + + + + + 🔄 + + 更新时间 + {{detailInfo.updatedAt}} + + + + + + + + 状态 + + + {{detailInfo.isActive === 1 ? '有效' : '无效'}} + + + + + + + + 📝 + {{detailInfo.remark}} + + + + + + 长期有效 + + + \ No newline at end of file diff --git a/pagesA/pages/carouselDetail/carouselDetail.wxss b/pagesA/pages/carouselDetail/carouselDetail.wxss new file mode 100644 index 0000000..a2bb5b5 --- /dev/null +++ b/pagesA/pages/carouselDetail/carouselDetail.wxss @@ -0,0 +1,284 @@ +.carousel-detail-container { + min-height: 100vh; + background-color: var(--bg-color, #F8F9FA); + position: relative; + padding-bottom: 40rpx; + } + + /* 沉浸式头部 */ + .hero-section { + position: relative; + width: 100%; + height: 600rpx; + overflow: hidden; + } + + .hero-image { + width: 100%; + height: 100%; + filter: brightness(0.9); + transition: transform 0.3s ease; + } + + .hero-image:active { + transform: scale(1.02); + } + + .hero-overlay { + position: absolute; + bottom: 0; + left: 0; + right: 0; + height: 200rpx; + pointer-events: none; + } + + /* 毛玻璃返回按钮 */ + .nav-back { + position: absolute; + top: 60rpx; + left: 30rpx; + width: 72rpx; + height: 72rpx; + border-radius: 36rpx; + display: flex; + align-items: center; + justify-content: center; + font-size: 40rpx; + color: #333; + z-index: 10; + } + + .glass { + background: rgba(255, 255, 255, 0.25); + backdrop-filter: blur(10px); + -webkit-backdrop-filter: blur(10px); + border: 1rpx solid rgba(255, 255, 255, 0.3); + box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.1); + } + + .page-title { + position: absolute; + top: 60rpx; + right: 30rpx; + padding: 16rpx 32rpx; + border-radius: 40rpx; + font-size: 26rpx; + color: #333; + font-weight: 500; + z-index: 10; + letter-spacing: 1rpx; + } + + /* 主要内容卡片 */ + .content-card { + margin: -100rpx 30rpx 0; + background: rgba(255, 255, 255, 0.95); + backdrop-filter: blur(20px); + -webkit-backdrop-filter: blur(20px); + border-radius: 48rpx; + padding: 48rpx 32rpx; + box-shadow: 0 30rpx 60rpx rgba(0, 0, 0, 0.1), + 0 10rpx 30rpx rgba(0, 0, 0, 0.05); + position: relative; + z-index: 5; + border: 1rpx solid rgba(255, 255, 255, 0.5); + opacity: 0; + transform: translateY(50rpx); + animation: cardFloat 0.6s ease-out forwards; + } + + @keyframes cardFloat { + to { + opacity: 1; + transform: translateY(0); + } + } + + /* 标题区域 */ + .title-section { + margin-bottom: 40rpx; + } + + .main-title { + display: block; + font-size: 56rpx; + font-weight: 700; + line-height: 1.3; + margin-bottom: 16rpx; + letter-spacing: -0.5rpx; + } + + .sub-title { + display: block; + font-size: 30rpx; + color: #666; + line-height: 1.5; + font-weight: 400; + opacity: 0.8; + } + + /* 装饰分割线 */ + .divider { + display: flex; + align-items: center; + margin: 30rpx 0 40rpx; + } + + .divider-line { + flex: 1; + height: 2rpx; + opacity: 0.2; + } + + .divider-dot { + width: 8rpx; + height: 8rpx; + border-radius: 4rpx; + margin: 0 20rpx; + opacity: 0.5; + } + + /* 信息网格 */ + .info-grid { + display: grid; + grid-template-columns: repeat(2, 1fr); + gap: 24rpx; + margin-bottom: 40rpx; + } + + .info-item { + background: rgba(0, 0, 0, 0.02); + border-radius: 28rpx; + padding: 28rpx 20rpx; + display: flex; + align-items: center; + border: 1rpx solid rgba(0, 0, 0, 0.03); + transition: all 0.3s ease; + } + + .info-item:active { + transform: scale(0.98); + background: rgba(0, 0, 0, 0.04); + } + + .info-icon { + font-size: 48rpx; + margin-right: 20rpx; + filter: drop-shadow(0 4rpx 8rpx rgba(0, 0, 0, 0.1)); + } + + .info-content { + flex: 1; + display: flex; + flex-direction: column; + } + + .info-label { + font-size: 22rpx; + color: #999; + margin-bottom: 8rpx; + letter-spacing: 0.5rpx; + } + + .info-value { + font-size: 28rpx; + font-weight: 600; + color: #333; + word-break: break-all; + } + + /* 状态特殊样式 */ + .status-item .info-content { + flex-direction: row; + align-items: center; + justify-content: space-between; + } + + .status-badge { + display: flex; + align-items: center; + padding: 8rpx 16rpx; + border-radius: 40rpx; + border-width: 1rpx; + border-style: solid; + background-color: rgba(76, 175, 80, 0.1); + } + + .status-dot { + width: 16rpx; + height: 16rpx; + border-radius: 8rpx; + margin-right: 8rpx; + animation: pulse 2s infinite; + } + + @keyframes pulse { + 0%, 100% { opacity: 1; } + 50% { opacity: 0.6; } + } + + .status-text { + font-size: 24rpx; + font-weight: 500; + } + + /* 备注区域 */ + .remark-section { + background: rgba(0, 0, 0, 0.02); + border-radius: 28rpx; + padding: 28rpx; + margin-bottom: 40rpx; + display: flex; + border-left: 8rpx solid var(--text-color, #2E7D32); + } + + .remark-icon { + font-size: 40rpx; + margin-right: 20rpx; + } + + .remark-content { + flex: 1; + font-size: 28rpx; + color: #444; + line-height: 1.6; + } + + + /* 始终有效标识 */ + .always-valid { + display: flex; + align-items: center; + justify-content: center; + margin-top: 30rpx; + padding: 20rpx; + background: linear-gradient(135deg, rgba(255, 215, 0, 0.1), rgba(255, 215, 0, 0.05)); + border-radius: 40rpx; + border: 1rpx solid rgba(255, 215, 0, 0.3); + } + + .valid-icon { + font-size: 32rpx; + margin-right: 12rpx; + animation: starTwinkle 1.5s infinite; + } + + @keyframes starTwinkle { + 0%, 100% { opacity: 1; transform: scale(1); } + 50% { opacity: 0.7; transform: scale(1.1); } + } + + .valid-text { + font-size: 26rpx; + color: #B8860B; + font-weight: 500; + } + + /* 响应式调整 */ + @media (min-width: 768px) { + .content-card { + max-width: 700rpx; + margin: -100rpx auto 0; + } + } \ No newline at end of file diff --git a/pagesA/pages/expertChat/expertChat.wxss b/pagesA/pages/expertChat/expertChat.wxss index 39db2c5..cb10859 100644 --- a/pagesA/pages/expertChat/expertChat.wxss +++ b/pagesA/pages/expertChat/expertChat.wxss @@ -491,7 +491,7 @@ height: 28rpx; } -/* 发送按钮 - 美观渐变绿色,完美垂直居中 */ +/* 发送按钮 */ .send-btn { background: linear-gradient(135deg, #07c160 0%, #06ae56 100%); width: 112rpx; @@ -499,7 +499,7 @@ border-radius: 10rpx; border: none; display: flex; - align-items: center;s + align-items: center; justify-content: center; transition: all 0.3s ease; padding: 0; diff --git a/pagesA/pages/todayInquiry/todayInquiry.js b/pagesA/pages/todayInquiry/todayInquiry.js new file mode 100644 index 0000000..e3e0381 --- /dev/null +++ b/pagesA/pages/todayInquiry/todayInquiry.js @@ -0,0 +1,120 @@ +import http from '../../../utils/api' +const baseUrl = require('../../../utils/baseUrl') + +Page({ + /** + * 页面的初始数据 + */ + data: { + list: [], // 问诊列表数据 + loading: true, // 首次加载loading + hasMore: false, // 是否还有更多数据(根据后端分页逻辑调整,本例简单置false) + pageNum: 1, // 当前页码(若需要分页) + pageSize: 10, + total: 0, + baseUrl: baseUrl || '' // 图片前缀 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + this.getTodayList() + }, + + /** + * 获取今日问诊列表(第一页) + */ + getTodayList() { + this.setData({ loading: false }) + http.today({ + data: { + pageNum: this.data.pageNum, + pageSize: this.data.pageSize + // 根据接口实际需要可添加其他参数 + }, + success: (res) => { + console.log('今日问诊接口返回:', res) + if (res && res.code === 200) { + const rows = res.rows || [] + const total = res.total || 0 + // 处理图片字段可能为空字符串或null + rows.forEach(item => { + if (!item.images) item.images = '' + }) + this.setData({ + list: rows, + total: total, + hasMore: rows.length < total && rows.length >= this.data.pageSize // 简单判断 + }) + } else { + wx.showToast({ title: '数据加载失败', icon: 'none' }) + } + }, + fail: (err) => { + wx.showToast({ title: '网络错误', icon: 'none' }) + console.error(err) + }, + complete: () => { + this.setData({ loading: false }) + } + }) + }, + + /** + * 加载更多(上拉触底) + */ + loadMore() { + if (!this.data.hasMore) return + // 如果有分页需求,可在此累加pageNum再次请求,并将新数据concat + // 当前根据接口示例无分页参数,故简单提示 + wx.showToast({ title: '暂无更多', icon: 'none' }) + }, + + /** + * 跳转详情页 + */ + // 查看详情 + goDetail: function (e) { + console.log(e); + const data = e.currentTarget.dataset.value + wx.navigateTo({ + url: `/pagesA/pages/askingSyDetails/askingSyDetails?data=${encodeURIComponent(JSON.stringify(data))}`, + }); + + }, + + + + + /** + * 预览图片 + */ + previewImage(e) { + const { src, list } = e.currentTarget.dataset + wx.previewImage({ + current: src, // 当前显示图片 + urls: list // 所有图片列表 + }) + }, + + /** + * 下拉刷新(如果需要) + */ + onPullDownRefresh() { + this.setData({ pageNum: 1 }, () => { + this.getTodayList() + wx.stopPullDownRefresh() + }) + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + return { + title: '今日问诊列表', + path: '/pages/consult/today/today' + } + } +}) \ No newline at end of file diff --git a/pagesA/pages/todayInquiry/todayInquiry.json b/pagesA/pages/todayInquiry/todayInquiry.json new file mode 100644 index 0000000..8db40aa --- /dev/null +++ b/pagesA/pages/todayInquiry/todayInquiry.json @@ -0,0 +1,4 @@ +{ + "navigationBarTitleText":"今日问诊列表", + "usingComponents": {} +} \ No newline at end of file diff --git a/pagesA/pages/todayInquiry/todayInquiry.wxml b/pagesA/pages/todayInquiry/todayInquiry.wxml new file mode 100644 index 0000000..c9062c9 --- /dev/null +++ b/pagesA/pages/todayInquiry/todayInquiry.wxml @@ -0,0 +1,59 @@ + + + + 加载中... + + + + + 暂无今日问诊 + + + + + + + + + + + {{item.status}} + + + + + {{item.description}} + + + {{item.animalType}} + {{item.animalGender}} + {{item.animalAge}}岁 + + + + + + 浏览 {{item.viewCount || 0}} + 回复 {{item.replyCount || 0}} + + + + + + + 加载更多... + + + 没有更多了 + + + \ No newline at end of file diff --git a/pagesA/pages/todayInquiry/todayInquiry.wxss b/pagesA/pages/todayInquiry/todayInquiry.wxss new file mode 100644 index 0000000..7609519 --- /dev/null +++ b/pagesA/pages/todayInquiry/todayInquiry.wxss @@ -0,0 +1,156 @@ +.container { + min-height: 100vh; + background-color: #f5f7fa; + padding: 0 20rpx; + box-sizing: border-box; + } + + .loading, .empty { + display: flex; + justify-content: center; + align-items: center; + height: 300rpx; + color: #999; + font-size: 28rpx; + } + + .scroll-list { + height: 100vh; + } + + .list { + padding: 20rpx 0; + } + + .card { + background: #fff; + border-radius: 24rpx; + margin-bottom: 30rpx; + padding: 30rpx; + box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.05); + } + + /* 用户行 */ + .user-row { + display: flex; + align-items: center; + margin-bottom: 24rpx; + position: relative; + } + + .avatar { + width: 72rpx; + height: 72rpx; + border-radius: 50%; + margin-right: 20rpx; + background-color: #eee; + } + + .user-info { + flex: 1; + display: flex; + flex-direction: column; + } + + .name { + font-size: 28rpx; + font-weight: 500; + color: #333; + margin-bottom: 4rpx; + } + + .time { + font-size: 22rpx; + color: #999; + } + + .status { + padding: 6rpx 20rpx; + background-color: #fff1f0; + border-radius: 30rpx; + font-size: 24rpx; + color: #f56c6c; + border: 1rpx solid #fbc4c4; + } + + /* 根据状态可设置不同颜色,例如 “未回复” 保持红色,“已回复”变绿色 */ + .status[data-status="未回复"] { + background-color: #fff1f0; + color: #f56c6c; + border-color: #fbc4c4; + } + .status[data-status="已回复"] { + background-color: #e8f7ef; + color: #2ecc71; + border-color: #a9e0c0; + } + + /* 内容块 */ + .content-block { + margin-bottom: 20rpx; + } + + .desc { + font-size: 30rpx; + color: #333; + line-height: 1.5; + margin-bottom: 20rpx; + word-break: break-word; + } + + .tag-group { + display: flex; + flex-wrap: wrap; + margin-bottom: 20rpx; + } + + .tag { + background-color: #f0f2f5; + padding: 6rpx 24rpx; + border-radius: 30rpx; + font-size: 24rpx; + color: #666; + margin-right: 16rpx; + margin-bottom: 10rpx; + } + + /* 图片九宫格简化版 */ + .image-grid { + display: flex; + flex-wrap: wrap; + margin-top: 10rpx; + } + + .grid-img { + width: 200rpx; + height: 200rpx; + border-radius: 16rpx; + margin-right: 16rpx; + margin-bottom: 16rpx; + background-color: #eee; + } + + /* 底部栏 */ + .card-footer { + display: flex; + align-items: center; + font-size: 24rpx; + color: #999; + border-top: 2rpx solid #f0f0f0; + padding-top: 20rpx; + margin-top: 10rpx; + } + + .card-footer text { + margin-right: 30rpx; + } + + + + /* 加载更多 */ + .load-more, .no-more { + text-align: center; + padding: 30rpx 0 50rpx; + font-size: 26rpx; + color: #aaa; + } \ No newline at end of file diff --git a/utils/api.js b/utils/api.js index b2097e1..990dd82 100644 --- a/utils/api.js +++ b/utils/api.js @@ -16,6 +16,11 @@ function carousel(params) { http('/muhu/ads/list', 'get', params) } +// 轮播详情 +function carouselDetail(params) { + http('/muhu/ads/' + params.data.id, 'get', params) +} + // 通知公告 function disaster(params) { http('/muhu/warning/list', 'get', params) @@ -196,7 +201,6 @@ function experienceDetails(params) { http('/vet/article/' + params.data.id, 'get', params) } - // 经验分享分类字典 function experiencezd(params) { http('/vet/article/options', 'get', params) @@ -222,7 +226,10 @@ function warningType(params) { http('/system/dict/data/list', 'get', params) } - +// 个人中心今日问诊 +function today(params) { + http('/muhu/consultation/today', 'get', params) +} export default { // 暴露接口 @@ -231,5 +238,5 @@ export default { // 暴露接口 recommendationXq,queryList,tipList,article,articleDetails,articleZd,policyelucidation, areaChildren,userCode,UserInfo,videoList,videoZd,videoDetails,forumList,forumAdd,forumDetails, forumReply,commentReply,experience,experiencezd,experienceDetails,realName,revise,feedback, - warningType,disasterDetail + warningType,disasterDetail,today,carouselDetail }