From e133135c8f81227b4dec5c1f7bfe6084a7c74205 Mon Sep 17 00:00:00 2001 From: BTMuli Date: Wed, 8 Apr 2026 18:16:44 +0800 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20=E9=87=8D=E6=9E=84?= =?UTF-8?q?=E5=9B=BE=E5=83=8F=E4=BF=9D=E5=AD=98=E9=80=BB=E8=BE=91=EF=BC=8C?= =?UTF-8?q?=E5=AE=8C=E5=96=84=E9=94=99=E8=AF=AF=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/app/t-mi-img.vue | 21 ++++-- src/components/pageArchive/pao-birth-card.vue | 32 +++++++--- .../userGacha/gro-chart-calendar.vue | 19 +++--- .../userGacha/gro-chart-overview.vue | 17 +++-- .../userGacha/gro-chart-stackbar.vue | 17 +++-- src/components/viewPost/tp-emoticon.vue | 11 ++-- src/components/viewPost/tp-image.vue | 39 ++++++----- src/components/viewPost/tp-video.vue | 22 ++++--- src/components/viewPost/tp-vod.vue | 49 +++++++++++--- src/components/viewPost/vp-overlay-image.vue | 34 ++++++++-- src/utils/TGShare.ts | 64 +++++++++++++------ 11 files changed, 218 insertions(+), 107 deletions(-) diff --git a/src/components/app/t-mi-img.vue b/src/components/app/t-mi-img.vue index 228ae886..2e154afb 100644 --- a/src/components/app/t-mi-img.vue +++ b/src/components/app/t-mi-img.vue @@ -15,7 +15,7 @@ import useAppStore from "@store/app.js"; import { onMounted, onUnmounted, ref, watch } from "vue"; -import { saveImgLocal } from "@/utils/TGShare.js"; +import { saveImgBlob } from "@/utils/TGShare.js"; type TMiImgProps = { src: string; @@ -31,6 +31,7 @@ const emits = defineEmits(); const appStore = useAppStore(); const localUrl = ref(); +const link = ref(getRemoteLink()); onMounted(async () => { if (!props.src) return; @@ -38,24 +39,30 @@ onMounted(async () => { localUrl.value = props.src; return; } - const link = props.ori ? props.src : appStore.getImageUrl(props.src); - localUrl.value = await saveImgLocal(link); + link.value = getRemoteLink(); + localUrl.value = await saveImgBlob(link.value); }); +function getRemoteLink(): string { + return props.ori ? props.src : appStore.getImageUrl(props.src); +} + watch( () => props.src, async () => { if (!props.src) return; - if (localUrl.value) URL.revokeObjectURL(localUrl.value); + if (localUrl.value && localUrl.value !== link.value) URL.revokeObjectURL(localUrl.value); localUrl.value = undefined; - const link = props.ori ? props.src : appStore.getImageUrl(props.src); if (!props.src.startsWith("http")) localUrl.value = props.src; - else localUrl.value = await saveImgLocal(link); + else { + link.value = getRemoteLink(); + localUrl.value = await saveImgBlob(link.value); + } }, ); onUnmounted(() => { - if (localUrl.value) URL.revokeObjectURL(localUrl.value); + if (localUrl.value && localUrl.value !== link.value) URL.revokeObjectURL(localUrl.value); });