diff --git a/apps/miniprogram/src/pages/article/index.scss b/apps/miniprogram/src/pages/article/index.scss index 388b703..43d171f 100644 --- a/apps/miniprogram/src/pages/article/index.scss +++ b/apps/miniprogram/src/pages/article/index.scss @@ -1,13 +1,11 @@ @import '../../styles/variables.scss'; -@import '../../styles/mixins.scss'; -.article-page { - min-height: 100vh; - background: $bg; - padding: 24px; - padding-bottom: 40px; -} +// PageShell 已接管:min-height, background, padding +// ContentCard 已接管:article-card 背景/圆角/阴影/触摸反馈 +// LoadingCard 已接管:初始加载骨架屏 +// EmptyState 已接管:空状态样式 +/* ─── 分类筛选滚动条(页面特有) ─── */ .article-categories { white-space: nowrap; margin-bottom: 24px; @@ -31,20 +29,14 @@ } } +/* ─── 文章列表布局 ─── */ .article-list { display: flex; flex-direction: column; gap: 20px; } -.article-card { - display: flex; - background: $card; - border-radius: $r; - padding: 28px; - box-shadow: $shadow-sm; -} - +/* ─── 文章卡片内容(ContentCard 已接管外层卡片样式) ─── */ .article-card-body { flex: 1; display: flex; @@ -107,25 +99,3 @@ width: 100%; height: 100%; } - -.empty-state { - display: flex; - justify-content: center; - align-items: center; - padding: 120px 0; -} - -.empty-text { - font-size: var(--tk-font-body-lg); - color: var(--tk-text-secondary); -} - -.loading-hint { - text-align: center; - padding: 24px 0; -} - -.loading-text { - font-size: var(--tk-font-h2); - color: var(--tk-text-secondary); -} diff --git a/apps/miniprogram/src/pages/article/index.tsx b/apps/miniprogram/src/pages/article/index.tsx index d375a1e..849228c 100644 --- a/apps/miniprogram/src/pages/article/index.tsx +++ b/apps/miniprogram/src/pages/article/index.tsx @@ -3,9 +3,12 @@ import { View, Text, Image, ScrollView } from '@tarojs/components'; import Taro, { useReachBottom } from '@tarojs/taro'; import { usePageData } from '@/hooks/usePageData'; import { listArticles, listCategories, Article, ArticleCategory } from '../../services/article'; -import EmptyState from '../../components/EmptyState'; -import ErrorState from '../../components/ErrorState'; -import Loading from '../../components/Loading'; +import PageShell from '@/components/ui/PageShell'; +import ContentCard from '@/components/ui/ContentCard'; +import LoadingCard from '@/components/ui/LoadingCard'; +import EmptyState from '@/components/EmptyState'; +import ErrorState from '@/components/ErrorState'; +import Loading from '@/components/Loading'; import { useElderClass } from '../../hooks/useElderClass'; import './index.scss'; @@ -73,8 +76,12 @@ export default function ArticleList() { Taro.navigateTo({ url: `/pages/article/detail/index?id=${id}` }); }; + if (!loading && articles.length === 0 && !error && !categories.length) { + return ; + } + return ( - + {/* 分类筛选 */} {categories.length > 0 && ( @@ -96,47 +103,44 @@ export default function ArticleList() { )} - - {error ? ( - fetchData(1, false, null)} /> - ) : articles.map((a) => ( - goToDetail(a.id)} - > - - {a.title} - {a.summary && ( - {a.summary} - )} - - {(a.category_name || a.category) && ( - {a.category_name || a.category} - )} - {a.published_at && ( - - {a.published_at.slice(0, 10)} - - )} - - - {a.cover_image && ( - - - - )} - - ))} - - - {articles.length === 0 && !loading && ( + {error ? ( + fetchData(1, false, null)} /> + ) : articles.length === 0 && !loading ? ( + ) : ( + + {articles.map((a) => ( + goToDetail(a.id)} + > + + {a.title} + {a.summary && ( + {a.summary} + )} + + {(a.category_name || a.category) && ( + {a.category_name || a.category} + )} + {a.published_at && ( + + {a.published_at.slice(0, 10)} + + )} + + + {a.cover_image && ( + + + + )} + + ))} + )} - {loading && ( - - )} - + {loading && } + ); }