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 { createPinia } from 'pinia'
import { createApp, h } from 'vue' import { createApp, h } from 'vue'
import App from './App.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 { GetNotifactions } from './data/notifactions'
import router from './router' import router from './router'
import { useAuthStore } from './store/useAuthStore' import { useAuthStore } from './store/useAuthStore'
@@ -77,11 +77,18 @@ QueryGetAPI<string>(BASE_API + 'vtsuru/version')
apiFail.value = true apiFail.value = true
console.log('默认API调用失败, 切换至故障转移节点') 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() GetNotifactions()
useAuthStore().getAuthInfo()
UpdateAccountLoop() UpdateAccountLoop()
InitTTS() InitTTS()
}) })

View File

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

View File

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

View File

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