🚨 fix command warn

This commit is contained in:
目棃
2025-03-17 16:11:48 +08:00
parent a3e42b63e6
commit 3be703d329
10 changed files with 54 additions and 44 deletions

View File

@@ -28,7 +28,7 @@
<div class="tpr-info">
<div class="tpri-left">
<span :title="timestampToDate(props.modelValue.reply.created_at * 1000)">
{{ getTime() }}
{{ getNearTime(props.modelValue.reply.created_at) }}
</span>
<span>{{ props.modelValue.user.ip_region }}</span>
</div>
@@ -112,7 +112,7 @@ import { computed, onMounted, onUnmounted, ref, shallowRef, toRaw, watch } from
import TpParser from "./tp-parser.vue";
import { generateShareImg } from "@/utils/TGShare.js";
import { timestampToDate } from "@/utils/toolFunc.js";
import { getNearTime, timestampToDate } from "@/utils/toolFunc.js";
import postReq from "@/web/request/postReq.js";
type TprReplyProps =
@@ -166,21 +166,6 @@ async function share(): Promise<void> {
await generateShareImg(replyId, replyDom, 3);
}
function getTime(): string {
const time = new Date(props.modelValue.reply.created_at * 1000);
const now = new Date();
// 如果是今天,只显示 hh:mm
if (time.toDateString() === now.toDateString()) {
return time.toLocaleTimeString();
}
// 如果是今年,显示 MM-dd
if (time.getFullYear() === now.getFullYear()) {
return time.toLocaleDateString().slice(5).replace(/\//g, "-");
}
// 否则显示 yyyy-MM-dd
return time.toLocaleDateString().replace(/\//g, "-");
}
async function showReply(): Promise<void> {
if (subReplies.value.length > 0) return;
if (isLast.value) return;