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

View File

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