新增咨询头像
This commit is contained in:
parent
38f7d74c44
commit
e57ae73dda
@ -16,7 +16,7 @@
|
|||||||
<evaluation-card v-if="item.messageType === 'consult_ended' && (item.rateId || session?.rateId)" class="rate-card" :extension="{ rateId: item.rateId || session.rateId }" :corp-id="corpId" :doctor-info="rateAssistantInfo" />
|
<evaluation-card v-if="item.messageType === 'consult_ended' && (item.rateId || session?.rateId)" class="rate-card" :extension="{ rateId: item.rateId || session.rateId }" :corp-id="corpId" :doctor-info="rateAssistantInfo" />
|
||||||
<view v-else-if="item.sender === 'system' && item.messageType !== 'risk_notice'" class="system-message" :class="{ warn: item.messageType === 'sensitive_notice' }">{{ displayContent(item) }}</view>
|
<view v-else-if="item.sender === 'system' && item.messageType !== 'risk_notice'" class="system-message" :class="{ warn: item.messageType === 'sensitive_notice' }">{{ displayContent(item) }}</view>
|
||||||
<view v-else-if="item.messageType !== 'risk_notice'" class="message-content">
|
<view v-else-if="item.messageType !== 'risk_notice'" class="message-content">
|
||||||
<image v-if="item.sender === 'assistant'" class="avatar assistant-avatar" src="/static/home/ai-consult-assistant.png" mode="aspectFill" />
|
<image v-if="item.sender === 'assistant'" class="avatar assistant-avatar" :src="assistantAvatar" mode="aspectFill" @error="handleAssistantAvatarError" />
|
||||||
<view class="message-bubble-container">
|
<view class="message-bubble-container">
|
||||||
<view v-if="item.sender === 'assistant'" class="username-label">{{ assistantDisplayName }}</view>
|
<view v-if="item.sender === 'assistant'" class="username-label">{{ assistantDisplayName }}</view>
|
||||||
<view class="message-bubble" :class="{ pending: item._sendStatus === 'pending' }">
|
<view class="message-bubble" :class="{ pending: item._sendStatus === 'pending' }">
|
||||||
@ -28,7 +28,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view v-if="waitingAi" class="message-item message-assistant">
|
<view v-if="waitingAi" class="message-item message-assistant">
|
||||||
<view class="message-content"><image class="avatar assistant-avatar" src="/static/home/ai-consult-assistant.png" mode="aspectFill" /><view class="message-bubble-container"><view class="username-label">{{ assistantDisplayName }}</view><view class="message-bubble thinking"><view class="thinking-dot"></view><view class="thinking-dot"></view><view class="thinking-dot"></view></view></view></view>
|
<view class="message-content"><image class="avatar assistant-avatar" :src="assistantAvatar" mode="aspectFill" @error="handleAssistantAvatarError" /><view class="message-bubble-container"><view class="username-label">{{ assistantDisplayName }}</view><view class="message-bubble thinking"><view class="thinking-dot"></view><view class="thinking-dot"></view><view class="thinking-dot"></view></view></view></view>
|
||||||
</view>
|
</view>
|
||||||
<view id="bottom" />
|
<view id="bottom" />
|
||||||
</view>
|
</view>
|
||||||
@ -62,8 +62,11 @@ const waitingAi = ref(false);
|
|||||||
const bottomId = ref('');
|
const bottomId = ref('');
|
||||||
const active = ref(false);
|
const active = ref(false);
|
||||||
const keyboardHeight = ref(0);
|
const keyboardHeight = ref(0);
|
||||||
|
const avatarLoadFailed = ref(false);
|
||||||
|
const defaultAssistantAvatar = '/static/home/ai-consult-assistant.png';
|
||||||
const assistantDisplayName = computed(() => removeAiLabel(session.value?.assistantName, '咨询助理'));
|
const assistantDisplayName = computed(() => removeAiLabel(session.value?.assistantName, '咨询助理'));
|
||||||
const rateAssistantInfo = computed(() => ({ name: assistantDisplayName.value, title: '咨询助理', department: session.value?.teamName || '', avatar: '' }));
|
const assistantAvatar = computed(() => avatarLoadFailed.value ? defaultAssistantAvatar : (session.value?.assistantAvatar || defaultAssistantAvatar));
|
||||||
|
const rateAssistantInfo = computed(() => ({ name: assistantDisplayName.value, title: '咨询助理', department: session.value?.teamName || '', avatar: assistantAvatar.value }));
|
||||||
const patientDisplayName = computed(() => patientInfo.value?.name || session.value?.customerName || '未建档患者');
|
const patientDisplayName = computed(() => patientInfo.value?.name || session.value?.customerName || '未建档患者');
|
||||||
const patientDetail = computed(() => {
|
const patientDetail = computed(() => {
|
||||||
const patient = patientInfo.value || {};
|
const patient = patientInfo.value || {};
|
||||||
@ -109,6 +112,9 @@ function handleKeyboardHeightChange(res) {
|
|||||||
keyboardHeight.value = Math.max(0, Number(res?.height) || 0);
|
keyboardHeight.value = Math.max(0, Number(res?.height) || 0);
|
||||||
if (keyboardHeight.value > 0) scrollToBottom();
|
if (keyboardHeight.value > 0) scrollToBottom();
|
||||||
}
|
}
|
||||||
|
function handleAssistantAvatarError() {
|
||||||
|
avatarLoadFailed.value = true;
|
||||||
|
}
|
||||||
function openPatientInfo() {
|
function openPatientInfo() {
|
||||||
const customerId = session.value?.archiveCustomerId;
|
const customerId = session.value?.archiveCustomerId;
|
||||||
if (!customerId) return uni.showToast({ title: '暂无可查看的患者档案', icon: 'none' });
|
if (!customerId) return uni.showToast({ title: '暂无可查看的患者档案', icon: 'none' });
|
||||||
@ -123,6 +129,7 @@ async function detail() {
|
|||||||
const res = await api('getAiConsultSessionDetail', { corpId: corpId.value, sessionId: sessionId.value, miniAppId: openid.value || uni.getStorageSync('openid') }, false);
|
const res = await api('getAiConsultSessionDetail', { corpId: corpId.value, sessionId: sessionId.value, miniAppId: openid.value || uni.getStorageSync('openid') }, false);
|
||||||
if (!res?.success) return uni.showToast({ title: removeAiLabel(res?.message, '加载失败'), icon: 'none' });
|
if (!res?.success) return uni.showToast({ title: removeAiLabel(res?.message, '加载失败'), icon: 'none' });
|
||||||
session.value = res.data.session;
|
session.value = res.data.session;
|
||||||
|
avatarLoadFailed.value = false;
|
||||||
patientInfo.value = res.data.patient || null;
|
patientInfo.value = res.data.patient || null;
|
||||||
messages.value = res.data.messages || [];
|
messages.value = res.data.messages || [];
|
||||||
active.value = session.value.status === 'active';
|
active.value = session.value.status === 'active';
|
||||||
|
|||||||
@ -11,7 +11,7 @@
|
|||||||
<view v-for="conversation in conversationList" :key="conversation.source === 'ai' ? `ai-${conversation.sessionId}` : (conversation.groupID || conversation.conversationID)"
|
<view v-for="conversation in conversationList" :key="conversation.source === 'ai' ? `ai-${conversation.sessionId}` : (conversation.groupID || conversation.conversationID)"
|
||||||
class="message-item" @click="handleClickConversation(conversation)">
|
class="message-item" @click="handleClickConversation(conversation)">
|
||||||
<view class="avatar-container">
|
<view class="avatar-container">
|
||||||
<image v-if="conversation.source === 'ai'" class="avatar" src="/static/home/ai-consult-assistant.png" mode="aspectFill" />
|
<image v-if="conversation.source === 'ai'" class="avatar" :src="conversation.assistantAvatar || defaultAssistantAvatar" mode="aspectFill" @error="handleConversationAvatarError(conversation)" />
|
||||||
<GroupAvatar v-else :avatarList="getAvatarList(conversation.groupID)" :size="96" classType="square" />
|
<GroupAvatar v-else :avatarList="getAvatarList(conversation.groupID)" :size="96" classType="square" />
|
||||||
<view v-if="conversation.unreadCount > 0" class="unread-badge">
|
<view v-if="conversation.unreadCount > 0" class="unread-badge">
|
||||||
<text class="unread-text">{{
|
<text class="unread-text">{{
|
||||||
@ -101,6 +101,7 @@ const hasMore = ref(false);
|
|||||||
const refreshing = ref(false);
|
const refreshing = ref(false);
|
||||||
const showSubscribeEntry = ref(false);
|
const showSubscribeEntry = ref(false);
|
||||||
const HOME_CURRENT_TEAM_CACHE_KEY = "home-current-team-info";
|
const HOME_CURRENT_TEAM_CACHE_KEY = "home-current-team-info";
|
||||||
|
const defaultAssistantAvatar = "/static/home/ai-consult-assistant.png";
|
||||||
|
|
||||||
// 群聊头像管理
|
// 群聊头像管理
|
||||||
const { loadGroupAvatars, getAvatarList } = useGroupAvatars();
|
const { loadGroupAvatars, getAvatarList } = useGroupAvatars();
|
||||||
@ -262,6 +263,10 @@ function mergeConsultationList(imConversations) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handleConversationAvatarError(conversation) {
|
||||||
|
conversation.assistantAvatar = defaultAssistantAvatar;
|
||||||
|
}
|
||||||
|
|
||||||
const loadAiConsultationList = async () => {
|
const loadAiConsultationList = async () => {
|
||||||
const corpId = getCurrentTeamCorpId();
|
const corpId = getCurrentTeamCorpId();
|
||||||
const miniAppId = openid.value || account.value?.openid || "";
|
const miniAppId = openid.value || account.value?.openid || "";
|
||||||
@ -281,6 +286,7 @@ const loadAiConsultationList = async () => {
|
|||||||
sessionId: item.id,
|
sessionId: item.id,
|
||||||
corpId: item.corpId,
|
corpId: item.corpId,
|
||||||
displayName: removeAiLabel(item.assistantName, "咨询助理"),
|
displayName: removeAiLabel(item.assistantName, "咨询助理"),
|
||||||
|
assistantAvatar: item.assistantAvatar || defaultAssistantAvatar,
|
||||||
teamName: item.teamName || "",
|
teamName: item.teamName || "",
|
||||||
patientName: item.customerName || "未命名患者",
|
patientName: item.customerName || "未命名患者",
|
||||||
lastMessage: removeAiLabel(item.statusLabel, "咨询"),
|
lastMessage: removeAiLabel(item.statusLabel, "咨询"),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user