mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-12 09:18:14 +08:00
🐛 修复封面503
This commit is contained in:
@@ -59,7 +59,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<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 { generateShareImg, saveImgLocal } from "../../utils/TGShare.js";
|
||||||
import { createPost } from "../../utils/TGWindow.js";
|
import { createPost } from "../../utils/TGWindow.js";
|
||||||
@@ -90,15 +90,26 @@ const selectedList = computed({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
onBeforeMount(async () => {
|
onMounted(async () => await reload(props.modelValue));
|
||||||
card.value = getPostCard(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 !== "") {
|
if (card.value && card.value.cover !== "") {
|
||||||
localCover.value = await saveImgLocal(card.value.cover);
|
localCover.value = await saveImgLocal(card.value.cover);
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
if (localCover.value) URL.revokeObjectURL(localCover.value);
|
if (localCover.value) {
|
||||||
|
URL.revokeObjectURL(localCover.value);
|
||||||
|
localCover.value = undefined;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -283,6 +283,7 @@ async function refresh(): Promise<void> {
|
|||||||
const indexRes = await TGRequest.User.byCookie.getAvatarIndex(userStore.cookie.value, user.value);
|
const indexRes = await TGRequest.User.byCookie.getAvatarIndex(userStore.cookie.value, user.value);
|
||||||
if (indexRes.retcode !== 0) {
|
if (indexRes.retcode !== 0) {
|
||||||
showSnackbar({ text: `[${indexRes.retcode}] ${indexRes.message}` });
|
showSnackbar({ text: `[${indexRes.retcode}] ${indexRes.message}` });
|
||||||
|
await TGLogger.Error(JSON.stringify(indexRes.message));
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
loadData.value = false;
|
loadData.value = false;
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user