【优化】mall 客服会话置顶排序,右键菜单适配折叠菜单产生的位置偏移

pull/478/head
puhui999 2024-07-10 17:05:46 +08:00
parent 993d070560
commit b6cd12a300
1 changed files with 7 additions and 3 deletions

View File

@ -72,18 +72,22 @@ import { KeFuConversationApi, KeFuConversationRespVO } from '@/api/mall/promotio
import { useEmoji } from './tools/emoji' import { useEmoji } from './tools/emoji'
import { formatDate } from '@/utils/formatTime' import { formatDate } from '@/utils/formatTime'
import { KeFuMessageContentTypeEnum } from './tools/constants' import { KeFuMessageContentTypeEnum } from './tools/constants'
import { useAppStore } from '@/store/modules/app'
defineOptions({ name: 'KeFuConversationList' }) defineOptions({ name: 'KeFuConversationList' })
const message = useMessage() // const message = useMessage() //
const appStore = useAppStore()
const { replaceEmoji } = useEmoji() const { replaceEmoji } = useEmoji()
const conversationList = ref<KeFuConversationRespVO[]>([]) // const conversationList = ref<KeFuConversationRespVO[]>([]) //
const activeConversationId = ref(-1) // const activeConversationId = ref(-1) //
const collapse = computed(() => appStore.getCollapse) //
/** 加载会话列表 */ /** 加载会话列表 */
const getConversationList = async () => { const getConversationList = async () => {
conversationList.value = await KeFuConversationApi.getConversationList() const list = await KeFuConversationApi.getConversationList()
list.sort((a: KeFuConversationRespVO, _) => (a.adminPinned ? -1 : 1))
conversationList.value = list
} }
defineExpose({ getConversationList }) defineExpose({ getConversationList })
@ -132,7 +136,7 @@ const rightClick = (mouseEvent: PointerEvent, item: KeFuConversationRespVO) => {
showRightMenu.value = true showRightMenu.value = true
rightMenuStyle.value = { rightMenuStyle.value = {
top: mouseEvent.clientY - 110 + 'px', top: mouseEvent.clientY - 110 + 'px',
left: mouseEvent.clientX - 80 + 'px' left: collapse.value ? mouseEvent.clientX - 80 + 'px' : mouseEvent.clientX - 210 + 'px'
} }
} }
/** 关闭右键菜单 */ /** 关闭右键菜单 */