fix: 修改当前在线人数icon

This commit is contained in:
tim
2025-09-06 21:09:13 +08:00
parent 0cf3e8c0f8
commit 5738ce75e8
2 changed files with 7 additions and 6 deletions

View File

@@ -39,7 +39,7 @@
</div>
<ToolTip v-if="!isMobile" content="当前在线人数" placement="bottom">
<div class="online-count">
<i class="fas fa-people-group"></i>
<peoples-two />
<span>{{ onlineCount }}</span>
</div>
</ToolTip>
@@ -143,7 +143,7 @@ async function sendPing() {
method: 'POST',
})
} catch (e) {
console.error("心跳失败", e)
console.error('心跳失败', e)
}
}
@@ -155,11 +155,10 @@ async function fetchCount() {
})
onlineCount.value = await res.json()
} catch (e) {
console.error("获取在线人数失败", e)
console.error('获取在线人数失败', e)
}
}
const search = () => {
showSearch.value = true
nextTick(() => {
@@ -311,8 +310,8 @@ onMounted(async () => {
// 新增的在线人数逻辑
sendPing()
fetchCount()
setInterval(sendPing, 120000) // 每 2 分钟发一次心跳
setInterval(fetchCount, 60000) // 每 1 分更新 UI
setInterval(sendPing, 120000) // 每 2 分钟发一次心跳
setInterval(fetchCount, 60000) // 每 1 分更新 UI
})
</script>

View File

@@ -62,6 +62,7 @@ import {
FileText,
History,
Lightning,
PeoplesTwo,
} from '@icon-park/vue-next'
export default defineNuxtPlugin((nuxtApp) => {
@@ -127,4 +128,5 @@ export default defineNuxtPlugin((nuxtApp) => {
nuxtApp.vueApp.component('FileText', FileText)
nuxtApp.vueApp.component('HistoryIcon', History)
nuxtApp.vueApp.component('Lightning', Lightning)
nuxtApp.vueApp.component('PeoplesTwo', PeoplesTwo)
})