字段对接
All checks were successful
site-dist-deploy / build-and-deploy (push) Successful in 1m12s

This commit is contained in:
speakeloudest 2026-02-02 10:42:01 +02:00
parent e52ec9bd01
commit 519bc32be6
3 changed files with 19 additions and 21 deletions

View File

@ -35,7 +35,7 @@
</div> </div>
<!-- Main Content Container --> <!-- Main Content Container -->
<div class="container mx-auto flex flex-col"> <div class="container mx-auto flex max-w-[1220px] flex-col">
<main class="pt-10"> <main class="pt-10">
<!-- module0 --> <!-- module0 -->
<div class="mb-[80px] flex justify-between"> <div class="mb-[80px] flex justify-between">

Binary file not shown.

Before

Width:  |  Height:  |  Size: 144 KiB

After

Width:  |  Height:  |  Size: 146 KiB

View File

@ -4,7 +4,7 @@
> >
<div class="mb-2 flex items-center justify-between border-b-1 border-dashed pb-3"> <div class="mb-2 flex items-center justify-between border-b-1 border-dashed pb-3">
<div class="relative ml-1 text-base font-bold text-white">各端下载量</div> <div class="relative ml-1 text-base font-bold text-white">各端下载量</div>
<div class="mr-1 text-2xl font-bold text-white tabular-nums">{{ totalDownloads }}</div> <div class="mr-1 text-2xl font-bold text-white tabular-nums">{{ info.total }}</div>
</div> </div>
<div class="flex min-h-[100px] flex-col gap-3"> <div class="flex min-h-[100px] flex-col gap-3">
@ -17,13 +17,16 @@
<component :is="item.icon" class="text-white" /> <component :is="item.icon" class="text-white" />
</div> </div>
<div class="mr-1 text-base font-semibold tabular-nums"> <div class="mr-1 text-base font-semibold tabular-nums">
<span v-if="loading" class="inline-block h-4 w-8 animate-pulse rounded bg-white/20"></span> <span
v-if="loading"
class="inline-block h-4 w-8 animate-pulse rounded bg-white/20"
></span>
<span v-else>{{ item.visits }}</span> <span v-else>{{ item.visits }}</span>
</div> </div>
</div> </div>
</div> </div>
<div class="mt-2 text-xs text-white/40">相比前一个月 --</div> <div class="mt-2 text-xs text-white/40">相比前一个月 {{ info.comparison_rate }}</div>
</div> </div>
</template> </template>
@ -36,38 +39,33 @@ import AndroidIcon from './Group 232.svg?component'
import MacIcon from './Group 233.svg?component' import MacIcon from './Group 233.svg?component'
const loading = ref(false) const loading = ref(false)
const rawStats = ref<any[]>([]) const info = ref({
comparison_rate: '--',
total: 0,
platforms: {},
})
const platformList = [ const platformList = [
{ platform: 'iOS', icon: IosIcon, match: ['ios', 'iphone', 'ipad'] }, { platform: 'ios', icon: IosIcon },
{ platform: 'Windows', icon: WinIcon, match: ['win'] }, { platform: 'windows', icon: WinIcon },
{ platform: 'Android', icon: AndroidIcon, match: ['android'] }, { platform: 'android', icon: AndroidIcon },
{ platform: 'Mac', icon: MacIcon, match: ['mac'] }, { platform: 'mac', icon: MacIcon },
] ]
const displayStats = computed(() => { const displayStats = computed(() => {
return platformList.map((p) => { return platformList.map((p) => {
const data = rawStats.value.find((item) => const visits = info.value?.platforms[p.platform] || 0
p.match.some((m) => item.platform.toLowerCase().includes(m))
)
return { return {
...p, ...p,
visits: data?.visits || 0, visits: visits || 0,
} }
}) })
}) })
const totalDownloads = computed(() => {
return displayStats.value.reduce((acc, item) => acc + (item.visits || 0), 0)
})
async function fetchDownloads() { async function fetchDownloads() {
loading.value = true loading.value = true
try { try {
const res: any = await request.get('/api/v1/public/user/agent/downloads') const res: any = await request.get('/api/v1/public/user/agent/downloads')
rawStats.value = res.list || [] info.value = res
} catch (error) {
console.error('Fetch downloads error:', error)
} finally { } finally {
loading.value = false loading.value = false
} }