diff --git a/src/components/uh-article-card/uh-article-card.vue b/src/components/uh-article-card/uh-article-card.vue index 1cfcf1a..e8471d0 100644 --- a/src/components/uh-article-card/uh-article-card.vue +++ b/src/components/uh-article-card/uh-article-card.vue @@ -1,125 +1,181 @@ diff --git a/src/pages-blog/archives/archives.vue b/src/pages-blog/archives/archives.vue index 79c1ce0..2253da8 100644 --- a/src/pages-blog/archives/archives.vue +++ b/src/pages-blog/archives/archives.vue @@ -3,11 +3,8 @@ import { computed, ref } from 'vue' import { onPullDownRefresh, onReachBottom } from '@dcloudio/uni-app' import { getPostList } from '@/api/halo' import { useAppConfigStore } from '@/store/appConfig' -import { useSettingStore } from '@/store/setting' import { DataLoadingStatusEnum, useDataLoadingStatus } from '@/hooks/useDataLoadingStatus' -import { checkThumbnailUrl } from '@/utils/url' import { sleep } from '@/utils/common' -import { formatTime as formatTimeUtil } from '@/utils/formatTime' import type { IPost } from '@/api/types/halo' definePage({ @@ -19,10 +16,8 @@ definePage({ }) const appConfigStore = useAppConfigStore() -const settingStore = useSettingStore() const calcAuditModeEnabled = computed(() => appConfigStore.auditModeEnabled) -const globalAppSettings = computed(() => settingStore.settings) /* ---------------- 状态 ---------------- */ const { loadingStatus, updateLoadingStatus } = useDataLoadingStatus() @@ -43,17 +38,6 @@ const loadMoreText = ref('加载中...') const postLabelYearKey = 'content.halo.run/archive-year' const postLabelMonthKey = 'content.halo.run/archive-month' -/** 卡片布局偏好 → 原子类(对应旧版 cardType 样式变体) */ -const CARD_LAYOUTS: Record = { - lr_image_text: { card: '', thumb: 'h-[170rpx] w-[200rpx]', info: 'w-0 flex-1 pl-5' }, - lr_text_image: { card: '', thumb: 'order-2 h-[170rpx] w-[200rpx]', info: 'order-1 w-0 flex-1 pr-5' }, - tb_image_text: { card: 'flex-col', thumb: 'h-[220rpx] w-full', info: 'w-full pt-3' }, - tb_text_image: { card: 'flex-col', thumb: 'order-2 h-[220rpx] w-full', info: 'order-1 w-full pb-3' }, - only_text: { card: '', thumb: 'hidden', info: 'py-1' }, -} - -const calcCardLayout = computed(() => CARD_LAYOUTS[globalAppSettings.value.layout.cardType] || CARD_LAYOUTS.lr_image_text) - /* ---------------- 数据处理 ---------------- */ /** 按 tab 分组文章 */ function handleGetPosts(list: IPost[]): Record { @@ -124,7 +108,6 @@ async function handleGetData() { const posts = handleGetPosts(filtered) dataList.value = handleGetShowDataList(posts) cacheDataList.value = filtered - c updateLoadingStatus( dataList.value.length === 0 ? DataLoadingStatusEnum.Empty : DataLoadingStatusEnum.Success, ) @@ -207,15 +190,6 @@ function handleOnTabChange(e: { index: number }) { uni.pageScrollTo({ scrollTop: 0, duration: 500 }) } -function handleToArticleDetail(article: IPost) { - if (calcAuditModeEnabled.value) - return - uni.navigateTo({ - url: `/pages-blog/article-detail/article-detail?name=${article.metadata.name}`, - animationType: 'slide-in-right', - }) -} - function handleToTopPage(duration = 500) { uni.pageScrollTo({ scrollTop: 0, @@ -226,11 +200,6 @@ function handleToTopPage(duration = 500) { }) } -function formatTime(time?: string): string { - // 与旧项目一致:yyyy年MM月dd日 星期w - return time ? formatTimeUtil({ d: time, f: 'yyyy年MM月dd日 星期w' }) : '' -} - /* ---------------- 生命周期 ---------------- */ handleGetData() @@ -301,27 +270,14 @@ onReachBottom(() => { 共 {{ item.posts.length }} 篇{{ calcAuditModeEnabled ? '内容' : '文章' }} - - + - - - + from="archives" + :article="post" + :audit-mode="calcAuditModeEnabled" + /> 该日期下暂无归档文章! diff --git a/src/pages-blog/articles/articles.vue b/src/pages-blog/articles/articles.vue index 417a6d1..6cbba70 100644 --- a/src/pages-blog/articles/articles.vue +++ b/src/pages-blog/articles/articles.vue @@ -1,9 +1,4 @@ \ No newline at end of file