fix: 问题修复
This commit is contained in:
parent
ed85ad990e
commit
4d562fc3f1
@ -295,18 +295,21 @@ const sendVoiceMessage = async (voiceFile, duration) => {
|
|||||||
|
|
||||||
// 发送消息的通用方法(文本、图片、语音)
|
// 发送消息的通用方法(文本、图片、语音)
|
||||||
const sendMessage = async (messageType, data) => {
|
const sendMessage = async (messageType, data) => {
|
||||||
await sendMessageUtil(
|
const result = await sendMessageUtil(
|
||||||
messageType,
|
messageType,
|
||||||
data,
|
data,
|
||||||
props.timChatManager,
|
props.timChatManager,
|
||||||
() => validateBeforeSend(false, false, props.timChatManager),
|
() => validateBeforeSend(false, false, props.timChatManager),
|
||||||
() => {
|
() => {
|
||||||
showMorePanel.value = false;
|
showMorePanel.value = false;
|
||||||
// 发送成功后滚动到底部
|
|
||||||
emit("messageSent");
|
|
||||||
},
|
},
|
||||||
cloudCustomData.value
|
cloudCustomData.value
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (result?.success) {
|
||||||
|
// 让页面直接将本地消息加入列表,避免依赖全局 IM 回调的注册时机。
|
||||||
|
emit("messageSent", result.message);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// 发送自定义消息的通用方法
|
// 发送自定义消息的通用方法
|
||||||
|
|||||||
@ -101,7 +101,7 @@
|
|||||||
" :userId="openid" :teamId="teamId" :patientId="patientId" :corpId="corpId" :patientInfo="patientInfo"
|
" :userId="openid" :teamId="teamId" :patientId="patientId" :corpId="corpId" :patientInfo="patientInfo"
|
||||||
:orderStatus="orderStatus" :isGenerating="isGenerating"
|
:orderStatus="orderStatus" :isGenerating="isGenerating"
|
||||||
:canBenefitEntry="isBenefitEntryEnabled"
|
:canBenefitEntry="isBenefitEntryEnabled"
|
||||||
@scrollToBottom="() => scrollToBottom(true)" @messageSent="() => scrollToBottom(true)"
|
@scrollToBottom="() => scrollToBottom(true)" @messageSent="handleMessageSent"
|
||||||
@endConsult="handleEndConsult" @openConsult="handleOpenConsult">
|
@endConsult="handleEndConsult" @openConsult="handleOpenConsult">
|
||||||
<!-- AI助手按钮组插槽 -->
|
<!-- AI助手按钮组插槽 -->
|
||||||
<template #ai-assistant>
|
<template #ai-assistant>
|
||||||
@ -766,6 +766,29 @@ const scrollToBottom = (immediate = false) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 发送成功后直接写入当前页面列表,避免全局 IM 回调被其他页面覆盖时消息不显示。
|
||||||
|
const handleMessageSent = (message) => {
|
||||||
|
if (
|
||||||
|
!message ||
|
||||||
|
!message.ID ||
|
||||||
|
message.conversationID !== chatInfo.value.conversationID
|
||||||
|
) {
|
||||||
|
scrollToBottom(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const existingMessage = messageList.value.find(
|
||||||
|
(item) => item.ID === message.ID
|
||||||
|
);
|
||||||
|
if (!existingMessage) {
|
||||||
|
messageList.value.push(message);
|
||||||
|
} else {
|
||||||
|
existingMessage.status = message.status;
|
||||||
|
}
|
||||||
|
|
||||||
|
nextTick(() => scrollToBottom(true));
|
||||||
|
};
|
||||||
|
|
||||||
// 关闭功能栏
|
// 关闭功能栏
|
||||||
const closeMorePanel = () => {
|
const closeMorePanel = () => {
|
||||||
uni.$emit("closeMorePanel");
|
uni.$emit("closeMorePanel");
|
||||||
|
|||||||
@ -116,7 +116,7 @@ const rule = computed(() => {
|
|||||||
title: { name: "职称", disabled: false },
|
title: { name: "职称", disabled: false },
|
||||||
dept: { name: "科室", disabled: false },
|
dept: { name: "科室", disabled: false },
|
||||||
}
|
}
|
||||||
if (doctorInfo.value) {
|
if (doctorInfo.value?.verifyStatus === "verified") {
|
||||||
data.job.name = "岗位 (不可修改)";
|
data.job.name = "岗位 (不可修改)";
|
||||||
data.job.disabled = true;
|
data.job.disabled = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -513,6 +513,8 @@ export const sendMessage = async (messageType, data, timChatManager, validateBef
|
|||||||
console.error('发送消息失败:', result?.error);
|
console.error('发送消息失败:', result?.error);
|
||||||
showMessage('发送失败,请重试');
|
showMessage('发送失败,请重试');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
// ==================== 状态检查相关工具方法 ====================
|
// ==================== 状态检查相关工具方法 ====================
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user