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