diff --git a/src/api/illness.ts b/src/api/illness.ts index ab0f905..1fd9c3e 100644 --- a/src/api/illness.ts +++ b/src/api/illness.ts @@ -7,6 +7,7 @@ export const illnessApi = { return request<{ list: any[], total: number }>(`/home/v1/illness/list`, "GET", {page, page_size, id}) }, articleInfo(owner_id: number, page: number, page_size: number) { - return request<{ list: any[], total: number }>(`/home/v1/article/illness_list`, "GET", {page, page_size, owner_id}) + return request<{ illness:{name:string;description:string;resource:any;album:string[]};list:{list: any[], total: number} }> + (`/home/v1/article/illness_list`, "GET", {page, page_size, owner_id}) }, } diff --git a/src/pages/home/components/feature_recommended.tsx b/src/pages/home/components/feature_recommended.tsx index 289b9bb..31fbb5f 100644 --- a/src/pages/home/components/feature_recommended.tsx +++ b/src/pages/home/components/feature_recommended.tsx @@ -61,7 +61,7 @@ const FeatureRecommended: FC = (props) => { { titleUrl: illnessTop, url: '/pages/preview/illness/sort/sort', - detailsUrl: '/pages/preview/illness/article/article', + detailsUrl: '/pages/preview/illness/list/list', data: [] }, ]) diff --git a/src/pages/preview/illness/list/list.config.ts b/src/pages/preview/illness/list/list.config.ts index 2881f86..6901b40 100644 --- a/src/pages/preview/illness/list/list.config.ts +++ b/src/pages/preview/illness/list/list.config.ts @@ -1,4 +1,4 @@ export default definePageConfig({ - navigationBarTitleText: '文章列表', + navigationBarTitleText: '', onReachBottomDistance: 50 }) diff --git a/src/pages/preview/illness/list/list.module.scss b/src/pages/preview/illness/list/list.module.scss index 1665d7f..78a510d 100644 --- a/src/pages/preview/illness/list/list.module.scss +++ b/src/pages/preview/illness/list/list.module.scss @@ -1,4 +1,4 @@ -.brands { +.articles { font-size: 28rpx; font-family: PingFang SC-Medium, PingFang SC; font-weight: 500; diff --git a/src/pages/preview/illness/list/list.tsx b/src/pages/preview/illness/list/list.tsx index 4064d2b..a146c9b 100644 --- a/src/pages/preview/illness/list/list.tsx +++ b/src/pages/preview/illness/list/list.tsx @@ -8,7 +8,8 @@ import Empty from "@/components/empty/empty"; const BrandList: FC = () => { const params = useRouter().params as unknown as { id: number } const [page, setPage] = useState(1) - const [brands, setBrands] = useState([]) + const [articles, setArticles] = useState([]) + const [illness,setIllness] = useState<{name:string;description:string;resource:any;album:string[]}>() const [total, setTotal] = useState(0) const [fetchDone, setFetchDone] = useState(false) @@ -20,8 +21,10 @@ const BrandList: FC = () => { const getData = useCallback(async () => { try { const data = await illnessApi.articleInfo(params.id, page, 20) - setTotal(data.total) - setBrands([...brands, ...data.list]) + Taro.setNavigationBarTitle({title:data.illness.name}) + setIllness(data.illness) + setTotal(data.list.total) + setArticles([...articles, ...data.list.list]) } catch (e) { } setFetchDone(true) @@ -34,17 +37,17 @@ const BrandList: FC = () => { useReachBottom(useCallback(() => { - if (brands?.length < total) { + if (articles?.length < total) { setPage(page + 1) } - }, [total, brands])) + }, [total, articles])) return ( { - brands.length > 0 ? - brands.map((d, index) => jump(d.id)}> + articles.length > 0 ? + articles.map((d, index) => jump(d.id)}> {index + 1} . {d.title} ) :