diff --git a/manifest.json b/manifest.json index dbbc303..36d7ad9 100644 --- a/manifest.json +++ b/manifest.json @@ -50,7 +50,7 @@ "quickapp" : {}, /* 小程序特有相关 */ "mp-weixin" : { - "appid" : "wx93af55767423938e", + "appid" : "wx1d8337a40c11d66c", "setting" : { "urlCheck" : false }, diff --git a/pages/login/login.vue b/pages/login/login.vue index d339408..6cd4ed2 100644 --- a/pages/login/login.vue +++ b/pages/login/login.vue @@ -5,12 +5,12 @@ 生命全周期健康管理伙伴 - - + diff --git a/pages/message/article-list.vue b/pages/message/article-list.vue index 97e66ac..2954537 100644 --- a/pages/message/article-list.vue +++ b/pages/message/article-list.vue @@ -120,7 +120,7 @@ const corpId = env.MP_CORP_ID; // 从页面参数获取群组信息 const pageParams = ref({ groupId: "", - userId: "", + patientId: "", corpId: "", }); @@ -323,8 +323,19 @@ const sendArticle = async (article) => { imgUrl: article.cover || "", desc: "点击查看详情", }); - if (result.success) { + // 记录文章发送记录 + try { + await api("addArticleSendRecord", { + articleId: article._id, + userId: doctorInfo.userid, + customerId: pageParams.value.patientId, + corpId: corpId, + }); + } catch (recordError) { + console.error("记录文章发送失败:", recordError); + } + uni.navigateBack(); } else { throw new Error(result.message || "发送失败"); @@ -350,8 +361,8 @@ onLoad((options) => { if (options.groupId) { pageParams.value.groupId = options.groupId; } - if (options.userId) { - pageParams.value.userId = options.userId; + if (options.patientId) { + pageParams.value.patientId = options.patientId; } if (options.corpId) { pageParams.value.corpId = options.corpId; diff --git a/pages/message/chat.scss b/pages/message/chat.scss index 11736c7..83bb6a9 100644 --- a/pages/message/chat.scss +++ b/pages/message/chat.scss @@ -436,10 +436,8 @@ $primary-color: #0877F1; height: 80rpx; display: flex; align-items: center; + justify-content: center; padding: 0 46rpx; -} - -.voice-input-btn { text-align: center; line-height: 80rpx; } @@ -1003,7 +1001,15 @@ $primary-color: #0877F1; .text-input::-moz-placeholder, .text-input:-ms-input-placeholder, .text-input::placeholder { - line-height: 96rpx; + line-height: normal; +} + +.voice-input-btn::-webkit-input-placeholder, +.voice-input-btn:-moz-placeholder, +.voice-input-btn::-moz-placeholder, +.voice-input-btn:-ms-input-placeholder, +.voice-input-btn::placeholder { + line-height: 80rpx; } /* 时间分割线 */ diff --git a/pages/message/components/chat-input.vue b/pages/message/components/chat-input.vue index b6727d1..2ef7f6c 100644 --- a/pages/message/components/chat-input.vue +++ b/pages/message/components/chat-input.vue @@ -75,6 +75,7 @@ const props = defineProps({ formatTime: { type: Function, required: true }, groupId: { type: String, default: '' }, userId: { type: String, default: '' }, + patientId: { type: String, default: '' }, corpId: { type: String, default: '' }, }); @@ -385,7 +386,7 @@ const goToCommonPhrases = () => { // 跳转到宣教文章页面 const goToArticleList = () => { uni.navigateTo({ - url: `/pages/message/article-list?groupId=${props.groupId}&userId=${props.userId}&corpId=${props.corpId}` + url: `/pages/message/article-list?groupId=${props.groupId}&patientId=${props.patientId}&corpId=${props.corpId}` }); }; diff --git a/pages/message/index.vue b/pages/message/index.vue index 5357584..b8d2aa8 100644 --- a/pages/message/index.vue +++ b/pages/message/index.vue @@ -5,7 +5,9 @@ {{ patientInfo.name }} - {{ patientInfo.sex }} · {{ patientInfo.age }}岁 + {{ patientInfo.sex }} · {{ patientInfo.age }}岁 查看档案 @@ -164,6 +166,7 @@ : '' " :userId="openid" + :patientId="patientId" :corpId="corpId" @scrollToBottom="() => scrollToBottom(true)" @messageSent="() => scrollToBottom(true)" @@ -247,6 +250,9 @@ const patientInfo = ref({ mobile: "", }); +// 患者ID +const patientId = ref(""); + // 计算弹框显示状态 - 只有 pending 状态才显示接受问诊组件 const showConsultAccept = computed(() => orderStatus.value === "pending"); @@ -320,6 +326,10 @@ const fetchGroupOrderStatus = async () => { mobile: result.data.patient.mobile || "", }; } + // 更新患者ID + if (result.data.patientId) { + patientId.value = result.data.patientId.toString(); + } console.log("获取群组订单状态:", { orderStatus: orderStatus.value, @@ -335,12 +345,6 @@ const fetchGroupOrderStatus = async () => { } }; -// 检查是否有待接诊的系统消息 -function checkConsultPendingStatus() { - // 直接获取最新的订单状态 - fetchGroupOrderStatus(); -} - // 获取消息气泡样式类 function getBubbleClass(message) { // 图片消息不需要气泡背景 @@ -454,11 +458,6 @@ const initTIMCallbacks = async () => { }) .then(() => { console.log("✓ 收到新消息后已标记为已读"); - // 触发会话列表更新,确保未读数为0 - timChatManager.triggerCallback("onConversationListUpdated", { - conversationID: chatInfo.value.conversationID, - unreadCount: 0, - }); }) .catch((error) => { console.error("✗ 标记已读失败:", error); @@ -518,9 +517,6 @@ const initTIMCallbacks = async () => { isCompleted.value = data.isCompleted || false; isLoadingMore.value = false; - // 检查是否有待接诊的系统消息 - checkConsultPendingStatus(); - nextTick(() => { if (data.isRefresh) { console.log("后台刷新完成,保持当前滚动位置"); @@ -615,11 +611,6 @@ const loadMessageList = async () => { }) .then(() => { console.log("✓ 会话已标记为已读:", chatInfo.value.conversationID); - // 触发会话列表更新回调,通知消息列表页面清空未读数 - timChatManager.triggerCallback("onConversationListUpdated", { - conversationID: chatInfo.value.conversationID, - unreadCount: 0, - }); }) .catch((error) => { console.error("✗ 标记会话已读失败:", error); @@ -776,6 +767,9 @@ onShow(() => { // 页面隐藏 onHide(() => { stopIMMonitoring(); + // 清空当前会话ID,避免离开页面后收到的消息被错误标记为已读 + timChatManager.currentConversationID = null; + console.log("✓ 页面隐藏,已清空当前会话ID"); }); const sendCommonPhrase = (content) => { @@ -900,10 +894,16 @@ const handleRejectReasonCancel = () => { // 处理查看患者详情 const handleViewPatientDetail = () => { - // TODO: 跳转到患者详情页面 - uni.showToast({ - title: "患者详情功能开发中", - icon: "none", + if (!patientId.value) { + uni.showToast({ + title: "患者信息不完整", + icon: "none", + }); + return; + } + + uni.navigateTo({ + url: `/pages/case/archive-detail?id=${patientId.value}`, }); }; // 处理结束问诊 diff --git a/pages/message/message.vue b/pages/message/message.vue index 872161d..ae2c985 100644 --- a/pages/message/message.vue +++ b/pages/message/message.vue @@ -84,7 +84,7 @@