更新
This commit is contained in:
@@ -69,16 +69,21 @@ const fetchRecentLogs = async () => {
|
||||
}
|
||||
|
||||
let statsInterval = null
|
||||
const refreshVisibleStats = () => {
|
||||
if (document.visibilityState === 'visible') fetchStats()
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
fetchStats()
|
||||
fetchRecentLogs()
|
||||
// 统计卡片每10秒自动刷新一次
|
||||
statsInterval = setInterval(fetchStats, 10000)
|
||||
// 汇总统计需要扫描日志索引,分钟级刷新足够且不会持续压迫数据库。
|
||||
statsInterval = setInterval(refreshVisibleStats, 60000)
|
||||
document.addEventListener('visibilitychange', refreshVisibleStats)
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
if (statsInterval) clearInterval(statsInterval)
|
||||
document.removeEventListener('visibilitychange', refreshVisibleStats)
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
@@ -172,7 +172,7 @@ const onConvListScroll = (e) => {
|
||||
|
||||
const fetchAccounts = async () => {
|
||||
try {
|
||||
const res = await api.get('/accounts')
|
||||
const res = await api.get('/account-options')
|
||||
accounts.value = Array.isArray(res.data) ? res.data : res.data?.items || []
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
|
||||
@@ -39,7 +39,7 @@ const formatPeerId = (conv) => {
|
||||
}
|
||||
|
||||
const fetchAccounts = async () => {
|
||||
const res = await api.get(`/accounts`)
|
||||
const res = await api.get(`/account-options`)
|
||||
accounts.value = res.data.filter(a => a.has_cookie)
|
||||
if (selectedAccount.value) {
|
||||
const current = accounts.value.find(a => a.id === selectedAccount.value)
|
||||
|
||||
@@ -72,7 +72,7 @@ const fetchLogs = async () => {
|
||||
|
||||
const fetchAccounts = async () => {
|
||||
try {
|
||||
const res = await api.get('/accounts')
|
||||
const res = await api.get('/account-options')
|
||||
accounts.value = res.data
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
|
||||
@@ -219,7 +219,7 @@ watch(filterAccountId, () => {
|
||||
|
||||
const fetchAccounts = async () => {
|
||||
try {
|
||||
const res = await api.get('/accounts')
|
||||
const res = await api.get('/account-options')
|
||||
accounts.value = Array.isArray(res.data) ? res.data : res.data?.items || []
|
||||
if (!cooldownAccountId.value && accounts.value.length) {
|
||||
cooldownAccountId.value = filterAccountId.value
|
||||
|
||||
@@ -85,7 +85,7 @@ const fetchLogs = async () => {
|
||||
|
||||
const fetchAccounts = async () => {
|
||||
try {
|
||||
const res = await api.get(`/accounts`)
|
||||
const res = await api.get(`/account-options`)
|
||||
accounts.value = res.data
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
|
||||
Reference in New Issue
Block a user