优化一些功能
This commit is contained in:
@@ -1,5 +1,12 @@
|
||||
import { ref } from 'vue'
|
||||
import { useToast } from './useToast'
|
||||
import {
|
||||
GetAccounts,
|
||||
QueryScore,
|
||||
ReloadAccounts,
|
||||
VerifyAllExchange,
|
||||
VerifyExchange
|
||||
} from '@wails/go/app/App'
|
||||
|
||||
export interface Account {
|
||||
index: number
|
||||
@@ -13,8 +20,6 @@ export interface AccountStatus {
|
||||
message?: string
|
||||
}
|
||||
|
||||
const App = window.go.app.App
|
||||
|
||||
const accounts = ref<Account[]>([])
|
||||
const selectedIndices = ref<Set<number>>(new Set())
|
||||
const statusMap = ref<Record<string, AccountStatus | boolean>>({})
|
||||
@@ -24,7 +29,7 @@ export function useAccounts() {
|
||||
const { showToast } = useToast()
|
||||
|
||||
const loadAccounts = async () => {
|
||||
const data = await App.GetAccounts()
|
||||
const data = await GetAccounts()
|
||||
accounts.value = data || []
|
||||
|
||||
// 清理无效选择
|
||||
@@ -35,7 +40,7 @@ export function useAccounts() {
|
||||
}
|
||||
|
||||
const reloadAccounts = async () => {
|
||||
const data = await App.ReloadAccounts()
|
||||
const data = await ReloadAccounts()
|
||||
await loadAccounts()
|
||||
showToast('账号已刷新', `共 ${data.count} 个账号`, 'success')
|
||||
}
|
||||
@@ -81,7 +86,7 @@ export function useAccounts() {
|
||||
showToast('查询积分', '正在并发查询...', 'info')
|
||||
const tasks = accounts.value.map(async (a) => {
|
||||
try {
|
||||
const d = await App.QueryScore(a.name)
|
||||
const d = await QueryScore(a.name)
|
||||
const score = d.score ?? 'N/A'
|
||||
scoreMap.value[a.name] = String(score)
|
||||
localStorage.setItem('accScore_' + a.name, String(score))
|
||||
@@ -193,7 +198,7 @@ export function useVerifyExchange() {
|
||||
|
||||
const verifyAccount = async (accountName: string) => {
|
||||
try {
|
||||
const result = await App.VerifyExchange(accountName)
|
||||
const result = await VerifyExchange(accountName)
|
||||
verifyResults.value[accountName] = result
|
||||
return result
|
||||
} catch (e: any) {
|
||||
@@ -206,8 +211,8 @@ export function useVerifyExchange() {
|
||||
verifying.value = true
|
||||
try {
|
||||
// 使用后端批量查询接口,自带间隔
|
||||
const results = await App.VerifyAllExchange()
|
||||
verifyResults.value = results || {}
|
||||
const results = await VerifyAllExchange()
|
||||
verifyResults.value = results?.results || {}
|
||||
} catch (e: any) {
|
||||
console.error('批量复验失败:', e)
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user