兑换复验增加时间展示
This commit is contained in:
@@ -67,6 +67,22 @@ const verifyStats = computed(() => {
|
||||
return { verified, noRecord, failed, total: entries.length }
|
||||
})
|
||||
|
||||
// 格式化时间戳
|
||||
const formatTime = (timestamp: string) => {
|
||||
if (!timestamp) return ''
|
||||
const ts = parseInt(timestamp)
|
||||
if (isNaN(ts)) return timestamp
|
||||
// 斗鱼返回的是秒级时间戳
|
||||
const date = new Date(ts * 1000)
|
||||
return date.toLocaleString('zh-CN', {
|
||||
month: '2-digit',
|
||||
day: '2-digit',
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
second: '2-digit'
|
||||
})
|
||||
}
|
||||
|
||||
// 执行复验
|
||||
const handleVerify = async () => {
|
||||
showToast('复验开始', '正在查询斗鱼兑换记录...', 'info')
|
||||
@@ -203,6 +219,7 @@ const handleVerify = async () => {
|
||||
<template v-if="entry.success">
|
||||
<div v-if="entry.count > 0" class="verify-records">
|
||||
<div v-for="(record, idx) in entry.records" :key="idx" class="verify-record">
|
||||
<span class="record-time">{{ formatTime(record.time) }}</span>
|
||||
<span class="record-name">{{ record.commodityName }}</span>
|
||||
<span class="record-role">{{ record.showName }}</span>
|
||||
</div>
|
||||
@@ -412,6 +429,14 @@ const handleVerify = async () => {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
font-size: 12px;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.record-time {
|
||||
color: var(--muted);
|
||||
font-size: 11px;
|
||||
white-space: nowrap;
|
||||
min-width: 100px;
|
||||
}
|
||||
|
||||
.record-name {
|
||||
@@ -421,6 +446,7 @@ const handleVerify = async () => {
|
||||
|
||||
.record-role {
|
||||
color: var(--muted);
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.verify-no-record {
|
||||
|
||||
@@ -172,20 +172,15 @@ export function useVerifyExchange() {
|
||||
|
||||
const verifyAll = async () => {
|
||||
verifying.value = true
|
||||
const results: Record<string, any> = {}
|
||||
|
||||
for (const account of accounts.value) {
|
||||
try {
|
||||
const result = await App.VerifyExchange(account.name)
|
||||
results[account.name] = result
|
||||
} catch (e: any) {
|
||||
results[account.name] = { success: false, error: e.message }
|
||||
}
|
||||
try {
|
||||
// 使用后端批量查询接口,自带间隔
|
||||
const results = await App.VerifyAllExchange()
|
||||
verifyResults.value = results || {}
|
||||
} catch (e: any) {
|
||||
console.error('批量复验失败:', e)
|
||||
} finally {
|
||||
verifying.value = false
|
||||
}
|
||||
|
||||
verifyResults.value = results
|
||||
verifying.value = false
|
||||
return results
|
||||
}
|
||||
|
||||
const clearResults = () => {
|
||||
|
||||
Vendored
+1
@@ -26,6 +26,7 @@ interface Window {
|
||||
GetSettings: () => Promise<any>
|
||||
SaveSettings: (cfg: any) => Promise<any>
|
||||
VerifyExchange: (accountName: string) => Promise<any>
|
||||
VerifyAllExchange: () => Promise<any>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user