From f2ec18314b06dd6cc82c274fe521221469eb7805 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9B=AE=E6=A3=83?= Date: Wed, 4 Sep 2024 23:08:22 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20=E4=BF=AE=E5=A4=8D=E7=89=B9?= =?UTF-8?q?=E5=AE=9A=E6=83=85=E5=86=B5=E4=B8=8B=E7=9A=84=E6=B8=B2=E6=9F=93?= =?UTF-8?q?=E9=94=99=E8=AF=AF=EF=BC=8C=E8=B0=83=E6=95=B4=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/post/tp-parser.vue | 2 +- src/components/postReply/tpr-reply.vue | 16 +++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/components/post/tp-parser.vue b/src/components/post/tp-parser.vue index f4e5c54a..4e87b7db 100644 --- a/src/components/post/tp-parser.vue +++ b/src/components/post/tp-parser.vue @@ -70,7 +70,7 @@ function getParsedData(data: TGApp.Plugins.Mys.SctPost.Base[]): TGApp.Plugins.My child = []; } } - if (check !== parsedText.length && check !== 0) { + if (check < parsedText.length && check !== 0) { res.push(...child); child = []; } diff --git a/src/components/postReply/tpr-reply.vue b/src/components/postReply/tpr-reply.vue index 18d5b261..3a56b4ea 100644 --- a/src/components/postReply/tpr-reply.vue +++ b/src/components/postReply/tpr-reply.vue @@ -30,7 +30,7 @@
- {{ getTime() }} + {{ getTime() }} {{ props.modelValue.user.ip_region }}
@@ -128,7 +128,6 @@ watch( async (value) => { if (value) { await event.emit("openReplySub", props.modelValue.reply.reply_id); - console.error("emit openReplySub"); } }, ); @@ -136,13 +135,16 @@ watch( async function listenSub(): Promise { return await event.listen("openReplySub", async (e: Event) => { if (e.payload !== props.modelValue.reply.reply_id) { - if (showSub.value) { - showSub.value = false; - } + if (showSub.value) showSub.value = false; } }); } +function getFullTime(): string { + const time = new Date(props.modelValue.reply.created_at * 1000); + return time.toLocaleString().replace(/\//g, "-"); +} + function getTime(): string { const time = new Date(props.modelValue.reply.created_at * 1000); const now = new Date(); @@ -152,10 +154,10 @@ function getTime(): string { } // 如果是今年,显示 MM-dd if (time.getFullYear() === now.getFullYear()) { - return time.toLocaleDateString().slice(5); + return time.toLocaleDateString().slice(5).replace(/\//g, "-"); } // 否则显示 yyyy-MM-dd - return time.toLocaleDateString(); + return time.toLocaleDateString().replace(/\//g, "-"); } async function showReply(): Promise {