修复博客内容时间字段问题

This commit is contained in:
2025-02-16 23:16:54 +08:00
parent 5c0951fc64
commit 58f5a715f2
2 changed files with 9 additions and 7 deletions

View File

@@ -29,12 +29,14 @@ onMounted(async () => {
<div class="text-center mt-[20px] mb-[300px] dark:text-white" v-if="loadStatus == 0">加载中请稍后...</div>
<el-empty description="暂无数据" style="margin: 0 auto;" v-if="loadStatus == 1 && blogList.length == 0" />
<div class="mx-auto max-w-[400px] w-full flex flex-col" v-for="item of blogList">
<a class="text-[26px] font-semibold cursor-pointer block hover:underline dark:text-white text-[#333]" :href="`/blogContent/${item.uuid}`" target="_blank">
<a class="text-[26px] font-semibold cursor-pointer block hover:underline dark:text-white text-[#333]"
:href="`/blogContent/${item.uuid}`" target="_blank">
{{ item.title }}
<span v-if="item.access_level == 9" class="text-[10px] text-[#666] dark:text-[#ccc] font-normal border border-[#d7d9de] py-[2px] px-[4px] rounded-[10px] bg-[#ebecf0] dark:border-[#999] dark:!bg-[#ffffff22]">受密码保护</span>
<span v-if="item.access_level == 9"
class="text-[10px] text-[#666] dark:text-[#ccc] font-normal border border-[#d7d9de] py-[2px] px-[4px] rounded-[10px] bg-[#ebecf0] dark:border-[#999] dark:!bg-[#ffffff22]">受密码保护</span>
</a>
<div class="text-[#666] dark:text-[#ccc]">{{ item.description }}</div>
<div class="text-[#888] mt-[15px] text-[14px]">{{ timestampToString(+item.publish_time) }} ·
<div class="text-[#888] mt-[15px] text-[14px]">{{ new Date(item.created_at).toLocaleString() }} ·
{{ formateTimes(item.visit_count) }} 次访问</div>
</div>
</div>

View File

@@ -12,7 +12,7 @@ import BlogComment from '@/components/Blog/BlogComment.vue';
type BlogInfo = {
visit_count: number,
title: string,
publish_time: string,
created_at: string,
like_count: number,
description: string
}
@@ -23,7 +23,7 @@ const blogContent = ref('');
const blogInfo: Ref<BlogInfo> = ref({
visit_count: 0,
title: '',
publish_time: '',
created_at: '',
like_count: 0,
description: ''
});
@@ -93,7 +93,7 @@ onUnmounted(() => {
<div>
<h1 class="text-center text-[28px] font-semibold dark:text-white text-[#222]">{{ blogInfo.title }}</h1>
<p class="my-[15px] mx-auto text-[14px] text-[#888] dark:text-[#ccc] text-center">发布于 {{
timestampToString(blogInfo.publish_time) }} {{ blogInfo.like_count }} 点赞</p>
new Date(blogInfo.created_at).toLocaleString() }} {{ blogInfo.like_count }} 点赞</p>
<!-- TODO <p class="mt-[-10px] mx-auto text-[14px] text-[#888] dark:text-[#ccc] text-center whitespace-pre">
{{ blogInfo.visit_count }} 访问
{{ blogInfo.like_count }} 点赞