From c4bd07069ccce02d49167986049a5941f9987a58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9B=AE=E6=A3=83?= Date: Tue, 25 Feb 2025 12:00:14 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20=E7=A7=BB=E9=99=A4=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E7=82=B9=E5=87=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/common/PageConfig.vue | 2 +- src/views/t-post.vue | 31 +++++-------------------------- 2 files changed, 6 insertions(+), 27 deletions(-) diff --git a/src/pages/common/PageConfig.vue b/src/pages/common/PageConfig.vue index fbd2adb4..f9588d5e 100644 --- a/src/pages/common/PageConfig.vue +++ b/src/pages/common/PageConfig.vue @@ -513,7 +513,7 @@ function submitResize(): void { // 开启无痕浏览 async function switchIncognito(): Promise { - await event.emit("switchIncognito"); + await event.emitTo("Sub_window", "switchIncognito"); if (appStore.incognito) { showSnackbar.success("已关闭无痕浏览!"); return; diff --git a/src/views/t-post.vue b/src/views/t-post.vue index 41d04b61..baeb5a43 100644 --- a/src/views/t-post.vue +++ b/src/views/t-post.vue @@ -36,7 +36,7 @@ mdi-thumb-up {{ postData?.stat?.like_num }} -
+
mdi-share-variant {{ postData?.stat?.forward_num }}
@@ -138,13 +138,6 @@ onBeforeMount(async () => { incognitoListener = await listen("switchIncognito", () => window.location.reload()); }); -onUnmounted(() => { - if (incognitoListener !== null) { - incognitoListener(); - incognitoListener = null; - } -}); - onMounted(async () => { await showLoading.start(`正在加载帖子数据`); appVersion.value = await app.getVersion(); @@ -295,24 +288,6 @@ async function tryLike(): Promise { showSnackbar.success(isLike.value ? "点赞成功" : "取消点赞成功"); } -async function tryShare(): Promise { - if (!cookie.value) { - showSnackbar.error("请先登录"); - return; - } - if (!postData.value) { - showSnackbar.error("数据未加载"); - return; - } - const ck = { stoken: cookie.value.stoken, stuid: cookie.value.stuid, mid: cookie.value.mid }; - const resp = await apiHubReq.post.share(postData.value.post.post_id, ck); - if (resp.retcode !== 0) { - showSnackbar.error(`[${resp.retcode}] ${resp.message}`); - return; - } - console.log("share success", resp); -} - async function toPost(): Promise { const channel = TGBbs.channels.find((item) => item.gid === postData.value?.post.game_id); const link = channel @@ -335,6 +310,10 @@ onUnmounted(() => { clearInterval(shareTimer); shareTimer = null; } + if (incognitoListener !== null) { + incognitoListener(); + incognitoListener = null; + } });