diff --git a/src/api/article.ts b/src/api/article.ts index b4ceadf..16f1fd6 100755 --- a/src/api/article.ts +++ b/src/api/article.ts @@ -8,12 +8,13 @@ export const getArticleDataAPI = async (id: number, password?: string) => { // 获取文章列表 export const getArticleListAPI = async () => { - return await Request('POST', `/article/list`); + return await Request('GET', `/article?page=1&size=9999999999`,); } // 分页获取文章数据 -export const getArticlePagingAPI = async (data: QueryData) => { - return await Request>('POST', `/article/paging?page=${data.pagination?.page}&size=${data.pagination?.size ? data.pagination?.size : 8}`, data.query); +export const getArticlePagingAPI = async (data: { page: number, size: number, key?: string }) => { + // 搜索暂时,晚点修复,先上线 + return await Request>('GET', `/article?page=${data.page}&size=${data.size}`); } // 获取随机文章列表 diff --git a/src/api/cate.ts b/src/api/cate.ts index f10ef5c..6468d0a 100755 --- a/src/api/cate.ts +++ b/src/api/cate.ts @@ -4,7 +4,7 @@ import Request from '@/utils/request' // 获取分类列表 export const getCateListAPI = async () => { - return await Request('POST', '/cate/list') + return await Request('GET', '/cate?pattern=tree') } // 获取指定分类中的所有文章 diff --git a/src/app/api/rss/route.ts b/src/app/api/rss/route.ts index 91af844..e64a3d8 100755 --- a/src/app/api/rss/route.ts +++ b/src/app/api/rss/route.ts @@ -12,7 +12,7 @@ export async function GET() { const webResponse = await getWebConfigDataAPI<{ value: Web }>('web'); const web = webResponse?.data?.value as Web; const { data: user } = await getAuthorDataAPI(); - const { data: article } = await getArticlePagingAPI({ pagination: { page: 1, size: 8 } }); + const { data: article } = await getArticlePagingAPI({ page: 1, size: 8 }); const { data: record } = await getRecordPagingAPI({ pagination: { page: 1, size: 8 } }); const articleList = article?.result ?? []; diff --git a/src/components/ArticleLayout/index.tsx b/src/components/ArticleLayout/index.tsx index 5f96089..3219acb 100755 --- a/src/components/ArticleLayout/index.tsx +++ b/src/components/ArticleLayout/index.tsx @@ -18,10 +18,8 @@ export default async ({ page }: { page: number }) => { // 如果是瀑布流布局就显示28条数据,否则显示8条 const { data } = await getArticlePagingAPI({ - pagination: { - page, - size: theme.is_article_layout === 'waterfall' ? 28 : 8 - } + page, + size: theme.is_article_layout === 'waterfall' ? 28 : 8 }); // 过滤掉不显示在首页的文章 data.result = data?.result?.filter((item) => item.config.status !== 'no_home') ?? []; @@ -35,7 +33,7 @@ export default async ({ page }: { page: number }) => { {theme.is_article_layout === 'card' && } {theme.is_article_layout === 'waterfall' && } - {data.total && } + {!!data.total && } ); };