fix desktop account status display
This commit is contained in:
@@ -34,7 +34,7 @@ const batchProbeQueuedAccountIds = ref<readonly string[]>([])
|
||||
const batchProbeTotalCount = ref(0)
|
||||
const actionSuccess = ref<string | null>(null)
|
||||
|
||||
type AccountAuthState = 'authorized' | 'expired' | 'attention' | 'risk'
|
||||
type AccountAuthState = 'authorized' | 'expired' | 'attention'
|
||||
type AccountRow = Readonly<Omit<RuntimeAccount, 'tags'>> & { tags: readonly string[] }
|
||||
const publishPlatformIds = new Set(desktopPublishMediaCatalog.map((item) => item.id))
|
||||
|
||||
@@ -43,9 +43,8 @@ const accounts = computed(() =>
|
||||
)
|
||||
|
||||
const overview = computed(() => ({
|
||||
authorized: accounts.value.filter((item) => item.health === 'live').length,
|
||||
attention: accounts.value.filter((item) => item.health === 'captcha').length,
|
||||
risk: accounts.value.filter((item) => item.health === 'risk').length,
|
||||
authorized: accounts.value.filter((item) => authState(item) === 'authorized').length,
|
||||
attention: accounts.value.filter((item) => authState(item) !== 'authorized').length,
|
||||
onlineClients: snapshot.value?.summary.onlineClients ?? 0,
|
||||
}))
|
||||
|
||||
@@ -76,7 +75,6 @@ const statusOptions = [
|
||||
{ value: 'all', label: '全部状态' },
|
||||
{ value: 'authorized', label: '已授权' },
|
||||
{ value: 'attention', label: '待处理' },
|
||||
{ value: 'risk', label: '风险观察' },
|
||||
{ value: 'expired', label: '授权过期' },
|
||||
] as const
|
||||
|
||||
@@ -105,7 +103,7 @@ function authState(account: AccountRow): AccountAuthState {
|
||||
case 'challenge_required':
|
||||
return 'attention'
|
||||
default:
|
||||
return 'risk'
|
||||
return 'attention'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,15 +115,19 @@ function authStateLabel(account: AccountRow): string {
|
||||
return '校验中'
|
||||
}
|
||||
|
||||
switch (authState(account)) {
|
||||
case 'authorized':
|
||||
switch (account.authState) {
|
||||
case 'active':
|
||||
return '已授权'
|
||||
case 'expired':
|
||||
return '授权过期'
|
||||
case 'attention':
|
||||
case 'revoked':
|
||||
return '已停用'
|
||||
case 'challenge_required':
|
||||
return account.authReason === 'risk_control' ? '触发风控' : '需人工验证'
|
||||
default:
|
||||
case 'expiring_soon':
|
||||
return account.probeState === 'network_error' ? '最近校验失败' : '待重新校验'
|
||||
default:
|
||||
return account.probeState === 'network_error' ? '最近校验失败' : '待校验'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,13 +136,16 @@ function authTagColor(account: AccountRow): string {
|
||||
return 'processing'
|
||||
}
|
||||
|
||||
switch (authState(account)) {
|
||||
case 'authorized':
|
||||
switch (account.authState) {
|
||||
case 'active':
|
||||
return 'success'
|
||||
case 'expired':
|
||||
case 'revoked':
|
||||
return 'error'
|
||||
case 'attention':
|
||||
case 'challenge_required':
|
||||
return 'warning'
|
||||
case 'expiring_soon':
|
||||
return account.probeState === 'network_error' ? 'warning' : 'default'
|
||||
default:
|
||||
return 'default'
|
||||
}
|
||||
@@ -202,7 +207,7 @@ const filteredAccounts = computed(() => {
|
||||
return false
|
||||
}
|
||||
|
||||
if (selectedStatus.value !== 'all' && authState(account) !== selectedStatus.value) {
|
||||
if (!matchesSelectedStatus(account)) {
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -223,6 +228,17 @@ const filteredAccounts = computed(() => {
|
||||
})
|
||||
})
|
||||
|
||||
function matchesSelectedStatus(account: AccountRow): boolean {
|
||||
switch (selectedStatus.value) {
|
||||
case 'all':
|
||||
return true
|
||||
case 'attention':
|
||||
return authState(account) !== 'authorized'
|
||||
default:
|
||||
return authState(account) === selectedStatus.value
|
||||
}
|
||||
}
|
||||
|
||||
function selectPlatform(platform: string) {
|
||||
selectedPlatform.value = platform
|
||||
void refreshAccounts()
|
||||
@@ -462,10 +478,6 @@ const tableColumns = [
|
||||
<div class="stat-label">待处理</div>
|
||||
<div class="stat-value">{{ overview.attention }}</div>
|
||||
</div>
|
||||
<div class="stat-card">
|
||||
<div class="stat-label">风险观察</div>
|
||||
<div class="stat-value">{{ overview.risk }}</div>
|
||||
</div>
|
||||
<div class="stat-card">
|
||||
<div class="stat-label">在线客户端</div>
|
||||
<div class="stat-value">{{ overview.onlineClients }}</div>
|
||||
|
||||
Reference in New Issue
Block a user