【新增】:mall 客服使用轮训模拟 websocket

This commit is contained in:
puhui999
2024-07-02 17:10:53 +08:00
parent 9c05ff35db
commit 91c262fb24
2 changed files with 33 additions and 2 deletions

View File

@ -64,6 +64,22 @@ const openRightMessage = (item: KeFuConversationRespVO, index: number) => {
activeConversationIndex.value = index
emits('change', item)
}
const poller = ref<any>(null) // TODO puhui999: 轮训定时器,暂时模拟 websocket
onMounted(() => {
// TODO puhui999: 轮训相关,功能完善后移除
if (!poller.value) {
poller.value = setInterval(() => {
getConversationList()
}, 1000)
}
})
// TODO puhui999: 轮训相关,功能完善后移除
onBeforeUnmount(() => {
if (!poller.value) {
return
}
clearInterval(poller.value)
})
</script>
<style lang="scss" scoped>