From f887d00a60e5b0d7ddd3cf3842947cee177636c2 Mon Sep 17 00:00:00 2001 From: zhanchao Date: Fri, 4 Sep 2026 09:52:41 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=88=E5=B9=B6=E7=BC=BA=E5=A4=B1=E5=BC=A5?= =?UTF-8?q?=E8=A1=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/message/index.vue | 184 +++++++++++++--------------------------- 1 file changed, 57 insertions(+), 127 deletions(-) diff --git a/pages/message/index.vue b/pages/message/index.vue index e03d109..2d839be 100644 --- a/pages/message/index.vue +++ b/pages/message/index.vue @@ -5,9 +5,7 @@ {{ patientInfo.name }} - {{ patientInfo.sex }} · {{ patientInfo.age }}岁 + {{ patientInfo.sex }} · {{ patientInfo.age }}岁 @@ -21,16 +19,8 @@ - + @@ -46,21 +36,13 @@ - + }"> - + {{ formatTime(message.lastTime) }} @@ -70,29 +52,18 @@ - - + + - + {{ chatMember[message.from]?.name }} @@ -100,24 +71,15 @@ - + - 发送失败 + 发送失败 @@ -125,75 +87,38 @@ - + - + - + - + - + @@ -308,10 +233,11 @@ const env = __VITE_ENV__; const corpId = env.MP_CORP_ID || ""; // 获取登录状态 +const accountStore = useAccountStore(); const { account, openid, isIMInitialized, doctorInfo } = storeToRefs( - useAccountStore() + accountStore ); -const { initIMAfterLogin } = useAccountStore(); +const { getDoctorInfo, initIMAfterLogin } = useAccountStore(); // 聊天输入组件引用 const chatInputRef = ref(null); @@ -358,6 +284,11 @@ const teamId = ref(""); // 计算弹框显示状态 - 只有 pending 状态才显示接受问诊组件 const showConsultAccept = computed(() => orderStatus.value === "pending"); +const isBenefitEntryEnabled = computed(() => { + const value = doctorInfo.value?.benefitEntryEnabled ?? doctorInfo.value?.canBenefitEntry; + return value === true || value === 1 || ["true", "1", "yes"].includes(String(value).toLowerCase()); +}); + // 拒绝原因对话框状态 const showRejectReasonModal = ref(false); // 消息列表相关状态 @@ -529,14 +460,14 @@ const checkLoginAndInitTIM = async () => { const initTIMCallbacks = async () => { // 标记回调已初始化 isCallbacksInitialized.value = true; - + timChatManager.setCallback("onSDKReady", () => { if (messageList.value.length === 0 && !isLoading.value) { loadMessageList(); } }); - timChatManager.setCallback("onSDKNotReady", () => {}); + timChatManager.setCallback("onSDKNotReady", () => { }); timChatManager.setCallback("onMessageReceived", (message) => { console.log("页面收到消息:", { @@ -905,14 +836,14 @@ const handleScrollToUpper = async () => { }; // 页面显示 -onShow(() => { +onShow(async () => { if (!account.value || !openid.value) { uni.redirectTo({ url: "/pages-center/login/login", }); return; } - + await getDoctorInfo(); if (!isIMInitialized.value) { checkLoginAndInitTIM(); } else if (timChatManager.tim && !timChatManager.isLoggedIn) { @@ -933,13 +864,13 @@ onShow(() => { // IM已登录,只需要重新设置会话ID,不重新注册回调(避免影响正在发送的消息) console.log("✓ 页面显示,重新设置当前会话ID"); timChatManager.setConversationID(chatInfo.value.conversationID); - + // 如果回调未初始化,才进行初始化 if (!isCallbacksInitialized.value) { console.log("✓ 回调未初始化,进行初始化"); initTIMCallbacks(); } - + // 标记会话为已读 if (timChatManager.tim && timChatManager.isLoggedIn) { timChatManager.tim @@ -953,7 +884,7 @@ onShow(() => { console.error("✗ 标记会话已读失败:", error); }); } - + startIMMonitoring(30000); } @@ -1172,11 +1103,10 @@ const handleNextFromProgress = (data) => { // 跳转到病历填写页面 uni.navigateTo({ - url: `/pages/case/ai-medical-case-form?caseType=${data.caseType}&patientId=${ - patientId.value - }&groupId=${groupId.value}&formData=${encodeURIComponent( - JSON.stringify(extractedData) - )}`, + url: `/pages/case/ai-medical-case-form?caseType=${data.caseType}&patientId=${patientId.value + }&groupId=${groupId.value}&formData=${encodeURIComponent( + JSON.stringify(extractedData) + )}`, }); };