修复博客内容时间字段问题
This commit is contained in:
@@ -8,7 +8,7 @@ const blogList: any[] = reactive([]);
|
|||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
try {
|
try {
|
||||||
const blogListRes:BaseResponseData = await request.get('/blogList');
|
const blogListRes: BaseResponseData = await request.get('/blogList');
|
||||||
if (blogListRes.code == 0) {
|
if (blogListRes.code == 0) {
|
||||||
blogList.push(...blogListRes.data);
|
blogList.push(...blogListRes.data);
|
||||||
loadStatus.value = 1;
|
loadStatus.value = 1;
|
||||||
@@ -29,12 +29,14 @@ onMounted(async () => {
|
|||||||
<div class="text-center mt-[20px] mb-[300px] dark:text-white" v-if="loadStatus == 0">加载中,请稍后...</div>
|
<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" />
|
<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">
|
<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 }}
|
{{ 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>
|
</a>
|
||||||
<div class="text-[#666] dark:text-[#ccc]">{{ item.description }}</div>
|
<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>
|
{{ formateTimes(item.visit_count) }} 次访问</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import BlogComment from '@/components/Blog/BlogComment.vue';
|
|||||||
type BlogInfo = {
|
type BlogInfo = {
|
||||||
visit_count: number,
|
visit_count: number,
|
||||||
title: string,
|
title: string,
|
||||||
publish_time: string,
|
created_at: string,
|
||||||
like_count: number,
|
like_count: number,
|
||||||
description: string
|
description: string
|
||||||
}
|
}
|
||||||
@@ -23,7 +23,7 @@ const blogContent = ref('');
|
|||||||
const blogInfo: Ref<BlogInfo> = ref({
|
const blogInfo: Ref<BlogInfo> = ref({
|
||||||
visit_count: 0,
|
visit_count: 0,
|
||||||
title: '',
|
title: '',
|
||||||
publish_time: '',
|
created_at: '',
|
||||||
like_count: 0,
|
like_count: 0,
|
||||||
description: ''
|
description: ''
|
||||||
});
|
});
|
||||||
@@ -93,7 +93,7 @@ onUnmounted(() => {
|
|||||||
<div>
|
<div>
|
||||||
<h1 class="text-center text-[28px] font-semibold dark:text-white text-[#222]">{{ blogInfo.title }}</h1>
|
<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">发布于 {{
|
<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">
|
<!-- TODO <p class="mt-[-10px] mx-auto text-[14px] text-[#888] dark:text-[#ccc] text-center whitespace-pre">
|
||||||
{{ blogInfo.visit_count }} 访问
|
{{ blogInfo.visit_count }} 访问
|
||||||
{{ blogInfo.like_count }} 点赞
|
{{ blogInfo.like_count }} 点赞
|
||||||
|
|||||||
Reference in New Issue
Block a user