perf(chat): 优化后台客服会话查询与状态
This commit is contained in:
@@ -87,8 +87,7 @@ const activeMembers = computed(() => {
|
||||
const participants = active.value?.participants || []
|
||||
return participants
|
||||
.map(item => {
|
||||
const remark = getParticipantRemark()
|
||||
const name = remark ? `${remark}(${item.display_name})` : item.display_name
|
||||
const name = item.remark ? `${item.remark}(${item.display_name})` : item.display_name
|
||||
return `${roleLabel(item.role)}:${name}`
|
||||
})
|
||||
.join(' / ')
|
||||
@@ -121,14 +120,6 @@ let orderLoadToken = 0
|
||||
// 桌面通知
|
||||
const desktopNotification = useDesktopNotification('admin')
|
||||
|
||||
function getParticipantRemark() {
|
||||
if (!active.value) return ''
|
||||
const myParticipant = active.value.participants?.find(
|
||||
p => p.participant_type === 'admin' && p.participant_id === currentAdminId
|
||||
)
|
||||
return myParticipant?.remark || ''
|
||||
}
|
||||
|
||||
function handleSSEEvent(event: ChatEvent) {
|
||||
if (event.type === 'conversation_updated') {
|
||||
loadConversations(false)
|
||||
@@ -433,10 +424,7 @@ function handleTransferSuccess() {
|
||||
|
||||
async function startEditRemark() {
|
||||
if (!active.value) return
|
||||
const myParticipant = active.value.participants?.find(
|
||||
p => p.participant_type === 'admin' && p.participant_id === currentAdminId
|
||||
)
|
||||
remarkValue.value = myParticipant?.remark || active.value.title
|
||||
remarkValue.value = active.value.admin_remark || active.value.title
|
||||
remarkEditing.value = true
|
||||
}
|
||||
|
||||
@@ -483,10 +471,7 @@ function senderLabel(item: ChatMessage) {
|
||||
}
|
||||
|
||||
function getConversationTitle(item: ChatConversation) {
|
||||
const myParticipant = item.participants?.find(
|
||||
p => p.participant_type === 'admin' && p.participant_id === currentAdminId
|
||||
)
|
||||
return myParticipant?.remark || item.title
|
||||
return item.admin_remark || item.title
|
||||
}
|
||||
|
||||
function getSupportName(item: ChatConversation) {
|
||||
|
||||
@@ -30,6 +30,7 @@ export interface ChatConversation {
|
||||
title: string
|
||||
status: string
|
||||
role: 'renter' | 'owner' | 'support' | 'customer' | 'admin'
|
||||
admin_remark?: string
|
||||
participants?: ChatParticipant[]
|
||||
last_message_id?: number
|
||||
last_message_preview: string
|
||||
|
||||
Reference in New Issue
Block a user