feat: 列表 logo 尝试加载主页 favicon,失败回退首字母

- 列表接口补充 homepage 字段
- Top30Panel / PackageCard 的 PkgLogo 传入 homepage,优先尝试加载 {域名}/favicon.ico
- 加载失败或离线时自动回退首字母徽标(抽屉此前已支持)
This commit is contained in:
陈银军
2026-09-19 21:32:28 +08:00
parent 0925c8fb62
commit 764022dcbf
4 changed files with 3 additions and 2 deletions
+1
View File
@@ -143,6 +143,7 @@ function buildPackages(keyword = '') {
status, status,
ignoredAt: ignoredAtMap[p.name] || null, ignoredAt: ignoredAtMap[p.name] || null,
description: p.description || null, description: p.description || null,
homepage: p.homepage || null,
// 列表不携带 versionsDetail(包多时响应巨大拖慢加载),详情走 GET /api/packages/:name // 列表不携带 versionsDetail(包多时响应巨大拖慢加载),详情走 GET /api/packages/:name
} }
}) })
+1 -1
View File
@@ -22,7 +22,7 @@ function splitName(name) {
@click="emit('open', pkg)" @click="emit('open', pkg)"
> >
<div class="p-top"> <div class="p-top">
<PkgLogo :name="pkg.name" :size="44" /> <PkgLogo :name="pkg.name" :size="44" :homepage="pkg.homepage" />
<div style="flex: 1; min-width: 0"> <div style="flex: 1; min-width: 0">
<div class="pkg-name"> <div class="pkg-name">
<span class="nm"> <span class="nm">
+1 -1
View File
@@ -36,7 +36,7 @@ function fmtSize(mb) {
</td> </td>
<td> <td>
<span class="rank-pkg"> <span class="rank-pkg">
<PkgLogo :name="p.name" :size="30" /> <PkgLogo :name="p.name" :size="30" :homepage="p.homepage" />
<span class="nm"> <span class="nm">
<span v-if="p.name.includes('/')" class="scope">{{ p.name.slice(0, p.name.lastIndexOf('/') + 1) }}</span>{{ p.name.split('/').pop() }} <span v-if="p.name.includes('/')" class="scope">{{ p.name.slice(0, p.name.lastIndexOf('/') + 1) }}</span>{{ p.name.split('/').pop() }}
</span> </span>
Binary file not shown.