This commit is contained in:
Your Name
2026-05-07 16:42:29 +08:00
parent 576ef8e033
commit a9474356ff
6 changed files with 144 additions and 12 deletions
@@ -9,17 +9,35 @@
v-for="item in notifications"
:key="item.id"
class="chat-notify-card"
:class="{ 'chat-notify-card-complete': item.type === 'consultation_complete' }"
:class="{
'chat-notify-card-complete': item.type === 'consultation_complete',
'chat-notify-card-left': item.type === 'patient_left_chat'
}"
@click="handleClick(item)"
>
<div class="chat-notify-icon" :class="{ 'chat-notify-icon-complete': item.type === 'consultation_complete' }">
<div
class="chat-notify-icon"
:class="{
'chat-notify-icon-complete': item.type === 'consultation_complete',
'chat-notify-icon-left': item.type === 'patient_left_chat'
}"
>
<el-icon :size="22">
<ChatDotRound v-if="item.type !== 'consultation_complete'" />
<CircleCheck v-else />
<ChatDotRound v-if="item.type !== 'consultation_complete' && item.type !== 'patient_left_chat'" />
<CircleCheck v-else-if="item.type === 'consultation_complete'" />
<Right v-else />
</el-icon>
</div>
<div class="chat-notify-body">
<div class="chat-notify-title">{{ item.type === 'consultation_complete' ? '面诊结束' : '患者打开会话' }}</div>
<div class="chat-notify-title">
{{
item.type === 'consultation_complete'
? '面诊结束'
: item.type === 'patient_left_chat'
? '患者离开会话'
: '患者打开会话'
}}
</div>
<div class="chat-notify-desc">
<template v-if="item.type === 'consultation_complete'">
<span class="patient-name">{{ item.patient_name || '患者' }}</span>
@@ -27,6 +45,10 @@
<span class="doctor-name">{{ item.doctor_name || '医生' }}</span>
完成请及时跟进
</template>
<template v-else-if="item.type === 'patient_left_chat'">
<span class="patient-name">{{ item.patient_name || '患者' }}</span>
已离开问诊会话页面
</template>
<template v-else>
<span class="patient-name">{{ item.patient_name || '患者' }}</span>
已打开与您的会话请及时查看
@@ -45,14 +67,14 @@
<script setup lang="ts">
import { ref, onMounted, onUnmounted } from 'vue'
import { useRouter } from 'vue-router'
import { ChatDotRound, CircleCheck, Close } from '@element-plus/icons-vue'
import { ChatDotRound, CircleCheck, Close, Right } from '@element-plus/icons-vue'
import { getChatNotifications } from '@/api/chat'
const router = useRouter()
export interface ChatNotifyItem {
id: string
type?: 'patient_opened_chat' | 'consultation_complete'
type?: 'patient_opened_chat' | 'patient_left_chat' | 'consultation_complete'
doctor_id?: number
assistant_id?: number
patient_id?: string
@@ -173,6 +195,15 @@ html.dark .chat-notify-card:hover {
background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}
.chat-notify-card-left {
border-color: rgba(148, 163, 184, 0.35);
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06), 0 0 0 1px rgba(148, 163, 184, 0.08);
}
.chat-notify-icon-left {
background: linear-gradient(135deg, #94a3b8 0%, #64748b 100%);
}
.chat-notify-body {
flex: 1;
min-width: 0;
@@ -99,6 +99,15 @@ export function parseImBusinessPayload(raw: string): FriendlyParse | null {
return { main: '患者进入聊天', sub: parts.length ? parts.join(' · ') : undefined, tag: '诊室' }
}
if (o.businessID === 'patient_closed_chat') {
const parts: string[] = []
if (o.patientName) parts.push(`患者:${String(o.patientName)}`)
if (o.patientId != null && o.patientId !== '') parts.push(`患者 ID${String(o.patientId)}`)
const t = formatBizTime(o.time)
if (t) parts.push(t)
return { main: '患者离开聊天页', sub: parts.length ? parts.join(' · ') : undefined, tag: '诊室' }
}
if (o.businessID === 'user_typing_status') {
return { main: '对方正在输入…', tag: '状态' }
}