try fix bili-auth load

This commit is contained in:
2024-03-13 00:46:43 +08:00
parent 1817341b20
commit 22f0f3052a
4 changed files with 14 additions and 6 deletions

View File

@@ -5,7 +5,7 @@ import { NButton, NFlex, NText, createDiscreteApi } from 'naive-ui'
import { createPinia } from 'pinia'
import { createApp, h } from 'vue'
import App from './App.vue'
import { GetSelfAccount, UpdateAccountLoop } from './api/account'
import { GetSelfAccount, UpdateAccountLoop, useAccount } from './api/account'
import { GetNotifactions } from './data/notifactions'
import router from './router'
import { useAuthStore } from './store/useAuthStore'
@@ -77,11 +77,18 @@ QueryGetAPI<string>(BASE_API + 'vtsuru/version')
apiFail.value = true
console.log('默认API调用失败, 切换至故障转移节点')
})
.finally(() => {
.finally(async () => {
//加载其他数据
GetSelfAccount()
await GetSelfAccount()
const account = useAccount()
const useAuth = useAuthStore()
if (account.value.id) {
if (account.value.biliUserAuthInfo && !useAuth.currentToken) {
useAuth.currentToken = account.value.biliUserAuthInfo.token
}
}
useAuth.getAuthInfo()
GetNotifactions()
useAuthStore().getAuthInfo()
UpdateAccountLoop()
InitTTS()
})

View File

@@ -127,6 +127,7 @@ export const useAuthStore = defineStore('BiliAuth', () => {
biliTokens,
isLoading,
isAuthed,
currentToken,
getAuthInfo,
QueryBiliAuthGetAPI,
QueryBiliAuthPostAPI,

View File

@@ -394,7 +394,7 @@ onUnmounted(() => {
<template #trigger>
<NIcon :component="Info24Filled" />
</template>
用于进行积分兑换等操作, 如果你是主播可以不用管
用于进行积分兑换等操作, 如果你是主播可以不用管, 并且即使不绑定也可以直接用认证完成给出的链接查看和使用积分
</NTooltip>
</NTag>
<NDivider vertical />

View File

@@ -577,7 +577,7 @@ onMounted(async () => {
粉丝数: 200粉以下: 每3天一次, 200-1000: 每24小时一次, 1000-10000: 每6小时一次, 10000粉以上: 每小时一次
</span>
<span> 舰长数: 10舰以下: 每24小时一次, 10-50: 每12小时一次, 50舰以上: 每6小时一次 </span>
<span> 投稿数据: 每天一次 </span>
<span> 投稿数据: 500粉以上: 每天一次 </span>
</NSpace>
</NTooltip>
<br />