From ae105a62e9b3aaa4c0b357a9be72169c7af6bd12 Mon Sep 17 00:00:00 2001 From: tone <3341154833@qq.com> Date: Sun, 16 Feb 2025 23:40:29 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E6=97=A0=E7=94=A8=E7=9A=84?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tonecn/src/components/Blog/BlogComment.vue | 1 - tonecn/src/components/Console/Blogs.vue | 1 - tonecn/src/lib/timestampToString.ts | 20 +------------------- tonecn/src/views/Blog.vue | 1 - tonecn/src/views/BlogContent.vue | 1 - 5 files changed, 1 insertion(+), 23 deletions(-) diff --git a/tonecn/src/components/Blog/BlogComment.vue b/tonecn/src/components/Blog/BlogComment.vue index 2a2d216..bc7badb 100644 --- a/tonecn/src/components/Blog/BlogComment.vue +++ b/tonecn/src/components/Blog/BlogComment.vue @@ -2,7 +2,6 @@ import { request, type BaseResponseData } from '@/lib/request'; import { computed, onMounted, reactive, ref, watch, watchEffect } from 'vue'; import { useRoute } from 'vue-router'; -import { timestampToString } from '@/lib/timestampToString'; const model = defineModel(); const route = useRoute() const bloguuid = route.params.uuid; diff --git a/tonecn/src/components/Console/Blogs.vue b/tonecn/src/components/Console/Blogs.vue index f07fc72..ee17b52 100644 --- a/tonecn/src/components/Console/Blogs.vue +++ b/tonecn/src/components/Console/Blogs.vue @@ -2,7 +2,6 @@ import { onMounted, reactive, ref, type Ref } from 'vue'; import { request, type BaseResponseData } from '../../lib/request' import { ElMessage, ElMessageBox } from 'element-plus'; -import { timestampToString } from '@/lib/timestampToString'; const tableData: Ref = ref([]) const dialogEditFormVisible = ref(false); type BlogContentData = { diff --git a/tonecn/src/lib/timestampToString.ts b/tonecn/src/lib/timestampToString.ts index 28b8c34..f67da06 100644 --- a/tonecn/src/lib/timestampToString.ts +++ b/tonecn/src/lib/timestampToString.ts @@ -1,21 +1,3 @@ - -function timestampToString(timestamp: string | number) { - if (timestamp === undefined || timestamp === null) { - throw new Error('Timestamp cannot be undefined or null'); - } - - const date = new Date(+timestamp); - - const year = date.getFullYear(); - const month = String(date.getMonth() + 1).padStart(2, '0'); // getMonth() returns 0-11, so we add 1 - const day = String(date.getDate()).padStart(2, '0'); - const hours = String(date.getHours()).padStart(2, '0'); - const minutes = String(date.getMinutes()).padStart(2, '0'); - const seconds = String(date.getSeconds()).padStart(2, '0'); - - return `${year}/${month}/${day} ${hours}:${minutes}:${seconds}`; -} - function timestampToRelativeWeekday(timestamp: string | number) { if (timestamp === undefined || timestamp === null) { throw new Error('Timestamp cannot be undefined or null'); @@ -43,4 +25,4 @@ function timestampToRelativeWeekday(timestamp: string | number) { } } -export { timestampToString, timestampToRelativeWeekday } \ No newline at end of file +export { timestampToRelativeWeekday } \ No newline at end of file diff --git a/tonecn/src/views/Blog.vue b/tonecn/src/views/Blog.vue index 2daacfa..3f49903 100644 --- a/tonecn/src/views/Blog.vue +++ b/tonecn/src/views/Blog.vue @@ -1,7 +1,6 @@