提交
This commit is contained in:
parent
c66514e5b3
commit
1b07a9bc2d
@ -85,7 +85,6 @@
|
||||
}}</text>
|
||||
</view>
|
||||
|
||||
|
||||
<view class="message-bubble" :class="getBubbleClass(message)">
|
||||
<!-- 消息内容 -->
|
||||
<MessageTypes
|
||||
@ -113,17 +112,7 @@
|
||||
</scroll-view>
|
||||
|
||||
<!-- 取消申请组件 -->
|
||||
<ConsultCancel
|
||||
v-if="showConsultCancel"
|
||||
@cancel="handleCancelConsult"
|
||||
/>
|
||||
|
||||
<!-- 拒绝原因对话框 -->
|
||||
<RejectReasonModal
|
||||
:visible="showRejectReasonModal"
|
||||
@confirm="handleRejectReasonConfirm"
|
||||
@cancel="handleRejectReasonCancel"
|
||||
/>
|
||||
<ConsultCancel v-if="showConsultCancel" @cancel="handleCancelConsult" />
|
||||
|
||||
<!-- 聊天输入组件 -->
|
||||
<ChatInput
|
||||
@ -131,7 +120,11 @@
|
||||
ref="chatInputRef"
|
||||
:timChatManager="timChatManager"
|
||||
:formatTime="formatTime"
|
||||
:groupId="chatInfo.conversationID ? chatInfo.conversationID.replace('GROUP', '') : ''"
|
||||
:groupId="
|
||||
chatInfo.conversationID
|
||||
? chatInfo.conversationID.replace('GROUP', '')
|
||||
: ''
|
||||
"
|
||||
:userId="openid"
|
||||
:corpId="corpId"
|
||||
@scrollToBottom="() => scrollToBottom(true)"
|
||||
@ -170,13 +163,12 @@ import MessageTypes from "./components/message-types.vue";
|
||||
import ChatInput from "./components/chat-input.vue";
|
||||
import SystemMessage from "./components/system-message.vue";
|
||||
import ConsultCancel from "./components/consult-cancel.vue";
|
||||
import RejectReasonModal from "./components/reject-reason-modal.vue";
|
||||
|
||||
const timChatManager = globalTimChatManager;
|
||||
|
||||
// 获取环境变量
|
||||
const env = __VITE_ENV__;
|
||||
const corpId = env.MP_CORP_ID || '';
|
||||
const corpId = env.MP_CORP_ID || "";
|
||||
|
||||
// 获取登录状态
|
||||
const { account, openid, isIMInitialized } = storeToRefs(useAccountStore());
|
||||
@ -208,9 +200,6 @@ const isEvaluationPopupOpen = ref(false);
|
||||
// 取消申请状态
|
||||
const showConsultCancel = ref(false);
|
||||
|
||||
// 拒绝原因对话框状态
|
||||
const showRejectReasonModal = ref(false);
|
||||
|
||||
// 消息列表相关状态
|
||||
const messageList = ref([]);
|
||||
const isLoading = ref(false);
|
||||
@ -702,7 +691,6 @@ onHide(() => {
|
||||
stopIMMonitoring();
|
||||
});
|
||||
|
||||
|
||||
const sendCommonPhrase = (content) => {
|
||||
if (chatInputRef.value) {
|
||||
chatInputRef.value.sendTextMessageFromPhrase(content);
|
||||
@ -717,52 +705,27 @@ defineExpose({
|
||||
const handleCancelConsult = async () => {
|
||||
try {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确定要取消咨询申请吗?',
|
||||
title: "提示",
|
||||
content: "确定要取消咨询申请吗?",
|
||||
success: async (res) => {
|
||||
if (res.confirm) {
|
||||
uni.showLoading({
|
||||
title: "处理中...",
|
||||
});
|
||||
|
||||
try {
|
||||
// 发送取消申请的系统消息
|
||||
const customMessage = {
|
||||
data: JSON.stringify({
|
||||
type: "system_message",
|
||||
messageType: "consult_cancelled",
|
||||
content: "患者已取消咨询申请",
|
||||
timestamp: Date.now(),
|
||||
}),
|
||||
description: "系统消息标记",
|
||||
extension: "",
|
||||
};
|
||||
|
||||
const message = timChatManager.tim.createCustomMessage({
|
||||
to: chatInfo.value.conversationID.replace("GROUP", ""),
|
||||
conversationType: timChatManager.TIM.TYPES.CONV_GROUP,
|
||||
payload: customMessage,
|
||||
// 调用取消咨询申请接口
|
||||
const result = await api("cancelConsultApplication", {
|
||||
groupId: groupId.value,
|
||||
corpId: corpId,
|
||||
});
|
||||
|
||||
const sendResult = await timChatManager.tim.sendMessage(message);
|
||||
|
||||
if (sendResult.code === 0) {
|
||||
showConsultCancel.value = false;
|
||||
uni.hideLoading();
|
||||
uni.showToast({
|
||||
title: "已取消申请",
|
||||
icon: "success",
|
||||
duration: 1500,
|
||||
});
|
||||
|
||||
// 延迟返回首页
|
||||
setTimeout(() => {
|
||||
if (result.success) {
|
||||
showConsultCancel.value = false;
|
||||
uni.switchTab({
|
||||
url: "/pages/home/home",
|
||||
});
|
||||
}, 1500);
|
||||
} else {
|
||||
throw new Error(sendResult.message || "发送失败");
|
||||
throw new Error(result.message || "取消申请失败");
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("取消申请失败:", error);
|
||||
@ -773,7 +736,7 @@ const handleCancelConsult = async () => {
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
} catch (error) {
|
||||
console.error("取消申请失败:", error);
|
||||
@ -791,7 +754,7 @@ const handleEndConsult = async () => {
|
||||
title: "处理中...",
|
||||
});
|
||||
// 调用结束问诊接口,直接传入 groupId
|
||||
const result = await api('endConsultation', {
|
||||
const result = await api("endConsultation", {
|
||||
groupId: groupId.value,
|
||||
adminAccount: account.value?.userId || "",
|
||||
extraData: {
|
||||
@ -832,7 +795,6 @@ onUnmounted(() => {
|
||||
uni.$off("sendSurvey");
|
||||
});
|
||||
|
||||
|
||||
// 监听问卷发送事件
|
||||
uni.$on("sendSurvey", async (data) => {
|
||||
const { survey, corpId, userId, sendSurveyId } = data;
|
||||
|
||||
@ -56,7 +56,8 @@ const urlsConfig = {
|
||||
sendConsultRejectedMessage: "sendConsultRejectedMessage",
|
||||
endConsultation: "endConsultation",
|
||||
getGroupListByGroupId: "getGroupListByGroupId",
|
||||
createConsultGroup: "createConsultGroup"
|
||||
createConsultGroup: "createConsultGroup",
|
||||
cancelConsultApplication: "cancelConsultApplication"
|
||||
}
|
||||
}
|
||||
const urls = Object.keys(urlsConfig).reduce((acc, path) => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user