【增加】对话增加排序

This commit is contained in:
cherishsince 2024-05-16 23:49:03 +08:00
parent c3884c5dfd
commit 80746d20fd

View File

@ -128,14 +128,20 @@ const handleConversationClick = async (id: string) => {
*/ */
const getChatConversationList = async () => { const getChatConversationList = async () => {
// 1 // 1
conversationList.value = await ChatConversationApi.getChatConversationMyList() const res = await ChatConversationApi.getChatConversationMyList()
// 2 // 2
res.sort((a, b) => {
console.log('sort', a, b)
return b.updateTime - a.updateTime
})
conversationList.value = res
// 3
if (conversationList.value.length === 0) { if (conversationList.value.length === 0) {
activeConversationId.value = null activeConversationId.value = null
conversationMap.value = {} conversationMap.value = {}
return return
} }
// 3(30) // 4(30)
conversationMap.value = await conversationTimeGroup(conversationList.value) conversationMap.value = await conversationTimeGroup(conversationList.value)
} }