feat(chat): ChatTimeline 双栏化(左会话列表)+ 路由可选参 + badge 账号级入口
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
import { computed, onMounted, reactive, ref } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { getAccounts, getCustomers, getMessages, getStaffChatStats } from '@/api'
|
||||
import { getAccounts, getCustomers, getStaffChatStats } from '@/api'
|
||||
import type { Account, Channel, Page, StaffChatCustomer, StaffChatStats } from '@/api/types'
|
||||
import YkStaffDetailModal from '@/components/YkStaffDetailModal.vue'
|
||||
import { useChannelStore } from '@/stores/channel'
|
||||
@@ -250,28 +250,8 @@ function viewGroups(row: Account): void {
|
||||
}
|
||||
|
||||
async function viewChat(row: Account) {
|
||||
// 取该账号最近一条会话,跳 ChatTimeline(降级:云客是会话列表,我们跳最近一条)
|
||||
const res = await getMessages({
|
||||
channel: row.channel,
|
||||
owner_account_id: row.account_id,
|
||||
page: 1,
|
||||
page_size: 1,
|
||||
})
|
||||
const m = res.items[0]
|
||||
if (!m) {
|
||||
ElMessage.info('该账号暂无聊天记录')
|
||||
return
|
||||
}
|
||||
const target = m.room_id ?? m.talker_id
|
||||
if (!target) {
|
||||
ElMessage.info('最近一条消息无会话标识')
|
||||
return
|
||||
}
|
||||
await router.push(
|
||||
m.room_id
|
||||
? `/group/${row.channel}/${row.account_id}/${m.room_id}`
|
||||
: `/chat/${row.channel}/${row.account_id}/${m.talker_id}`,
|
||||
)
|
||||
// 账号级聊天窗口(左侧会话列表 + 右消息流);对齐云客 badge→聊天窗口。
|
||||
await router.push({ name: 'chat', params: { channel: row.channel, ownerId: row.account_id } })
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user