mirror of
https://gitee.com/lijingbo-2021/open-anylink-web.git
synced 2025-12-30 11:02:25 +00:00
sessionList排序
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -29,4 +29,5 @@ coverage
|
||||
|
||||
*.tsbuildinfo
|
||||
note.md
|
||||
*.bak
|
||||
*.bak
|
||||
*.xlsx
|
||||
@@ -84,6 +84,7 @@ const onShowCard = () => {
|
||||
}
|
||||
}
|
||||
|
||||
// 这里有防抖动效果
|
||||
let timer
|
||||
const switchTag = (func) => {
|
||||
func()
|
||||
@@ -98,7 +99,7 @@ const switchTag = (func) => {
|
||||
top: top.value,
|
||||
muted: muted.value
|
||||
})
|
||||
}, 1000)
|
||||
}, 100) // 这个时间太长会影响置顶按钮的响应时长
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -129,7 +129,7 @@ const handleMsgListWheel = async () => {
|
||||
const clientHeight = document.querySelector('.message-main').clientHeight
|
||||
const diffToBottom = msgListDiv.value.scrollHeight - msgListDiv.value.scrollTop - clientHeight
|
||||
newMsgTips.value.isShowBottomTips = diffToBottom < 50 ? false : newMsgTips.value.isShowBottomTips
|
||||
// isShowReturnBottom.value = diffToBottom > 300 // 暂时取消这个提示功能
|
||||
// isShowReturnBottom.value = diffToBottom > 300 // 暂时取消这个提示功能,与消息提示的按钮显得有点重复
|
||||
|
||||
if (newMsgTips.value.firstElement?.getBoundingClientRect().top > 0) {
|
||||
newMsgTips.value.isShowTopTips = false
|
||||
@@ -143,7 +143,26 @@ const sessionListSorted = computed(() => {
|
||||
}
|
||||
else {
|
||||
let sessionArr = Object.values(messageData.sessionList)
|
||||
return sessionArr.sort((a, b) => b.lastMsgTime - a.lastMsgTime)
|
||||
return sessionArr.sort((a, b) => {
|
||||
if (a.top && !b.top) { // 排序第一优先级:是否置顶
|
||||
return -1
|
||||
}
|
||||
else if (!a.top && b.top) {
|
||||
return 1
|
||||
}
|
||||
else {
|
||||
if (a.draft && !b.draft) { // 排序第二优先级:是否有草稿
|
||||
return -1
|
||||
}
|
||||
else if (!a.draft && b.draft) {
|
||||
return 1
|
||||
}
|
||||
else {
|
||||
// 排序第三优先级:最后一条消息的时间
|
||||
return new Date(b.lastMsgTime).getTime() - new Date(a.lastMsgTime).getTime()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user