feat: add SPK share link support and optimize category count calculation

- add SPK share button in app detail pages and support parsing SPK links in search box
- fix category total count to exclude the all entry
- remove redundant count badge from sidebar tabs
- rewrite category count calculation with proper filtering of all entry
- update search category count logic to use base apps for all tab count
This commit is contained in:
2026-07-14 13:39:20 +08:00
parent b233fea4d5
commit 750e1d89e4
6 changed files with 101 additions and 9 deletions
+29
View File
@@ -125,6 +125,17 @@
<i class="fas fa-star text-xs"></i>
<span>{{ favoriteButtonText }}</span>
</button>
<button
type="button"
class="inline-flex w-full items-center justify-center gap-2 rounded-xl border border-slate-300 bg-white px-4 py-2.5 text-sm font-medium text-slate-600 transition hover:bg-slate-50 hover:text-slate-900 dark:border-slate-600 dark:bg-slate-800 dark:text-slate-300 dark:hover:bg-slate-700"
@click="copySpkLink"
>
<i
class="fas text-xs"
:class="spkCopied ? 'fa-check' : 'fa-share-alt'"
></i>
<span>{{ spkCopied ? '已复制链接' : 'SPK 分享' }}</span>
</button>
</div>
<dl
@@ -381,4 +392,22 @@ const handleFavorite = () => {
const hideImage = (event: Event) => {
(event.target as HTMLElement).style.display = "none";
};
const spkCopied = ref(false);
let spkCopiedTimer: ReturnType<typeof setTimeout> | null = null;
const copySpkLink = async () => {
if (!displayApp.value?.pkgname) return;
const spkLink = `spk://store/${displayApp.value.category || "unknown"}/${displayApp.value.pkgname}`;
try {
await navigator.clipboard.writeText(spkLink);
spkCopied.value = true;
if (spkCopiedTimer) clearTimeout(spkCopiedTimer);
spkCopiedTimer = setTimeout(() => {
spkCopied.value = false;
}, 2000);
} catch {
prompt("请手动复制 SPK 分享链接:", spkLink);
}
};
</script>