Skip to content

Commit

Permalink
🐛 修复封面503
Browse files Browse the repository at this point in the history
  • Loading branch information
BTMuli committed Oct 12, 2024
1 parent 2e15296 commit 18507b6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
21 changes: 16 additions & 5 deletions src/components/main/t-postcard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
</div>
</template>
<script lang="ts" setup>
import { computed, onBeforeMount, onUnmounted, ref } from "vue";
import { computed, onMounted, onUnmounted, ref, watch } from "vue";
import { generateShareImg, saveImgLocal } from "../../utils/TGShare.js";
import { createPost } from "../../utils/TGWindow.js";
Expand Down Expand Up @@ -90,15 +90,26 @@ const selectedList = computed({
},
});
onBeforeMount(async () => {
card.value = getPostCard(props.modelValue);
onMounted(async () => await reload(props.modelValue));
watch(() => props.modelValue, reload);
async function reload(data: TGApp.Plugins.Mys.Post.FullData): Promise<void> {
if (localCover.value) {
URL.revokeObjectURL(localCover.value);
localCover.value = undefined;
}
card.value = getPostCard(data);
if (card.value && card.value.cover !== "") {
localCover.value = await saveImgLocal(card.value.cover);
}
});
}
onUnmounted(() => {
if (localCover.value) URL.revokeObjectURL(localCover.value);
if (localCover.value) {
URL.revokeObjectURL(localCover.value);
localCover.value = undefined;
}
});
/**
Expand Down
1 change: 1 addition & 0 deletions src/pages/User/Characters.vue
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ async function refresh(): Promise<void> {
const indexRes = await TGRequest.User.byCookie.getAvatarIndex(userStore.cookie.value, user.value);
if (indexRes.retcode !== 0) {
showSnackbar({ text: `[${indexRes.retcode}] ${indexRes.message}` });
await TGLogger.Error(JSON.stringify(indexRes.message));
loading.value = false;
loadData.value = false;
return;
Expand Down

0 comments on commit 18507b6

Please sign in to comment.