|
|
@ -1,12 +1,13 @@ |
|
|
|
import {FC, useCallback, useEffect, useState} from "react"; |
|
|
|
import {FC, useCallback, useEffect, useState} from "react"; |
|
|
|
import { View} from "@tarojs/components"; |
|
|
|
import {View} from "@tarojs/components"; |
|
|
|
import styles from './list.module.scss' |
|
|
|
import styles from './list.module.scss' |
|
|
|
import Taro, {useReachBottom, useRouter} from "@tarojs/taro"; |
|
|
|
import Taro, {useReachBottom, useRouter} from "@tarojs/taro"; |
|
|
|
import Collapse from "@/components/collapse/collapse"; |
|
|
|
import Collapse from "@/components/collapse/collapse"; |
|
|
|
import {illnessApi} from "@/api/illness"; |
|
|
|
import {illnessApi} from "@/api/illness"; |
|
|
|
|
|
|
|
import Empty from "@/components/empty/empty"; |
|
|
|
|
|
|
|
|
|
|
|
const BrandList: FC = () => { |
|
|
|
const BrandList: FC = () => { |
|
|
|
const params = useRouter().params as unknown as {id:number} |
|
|
|
const params = useRouter().params as unknown as { id: number } |
|
|
|
const [page, setPage] = useState(1) |
|
|
|
const [page, setPage] = useState(1) |
|
|
|
const [brands, setBrands] = useState<any[]>([]) |
|
|
|
const [brands, setBrands] = useState<any[]>([]) |
|
|
|
const [total, setTotal] = useState(0) |
|
|
|
const [total, setTotal] = useState(0) |
|
|
@ -17,7 +18,7 @@ const BrandList: FC = () => { |
|
|
|
|
|
|
|
|
|
|
|
const getData = useCallback(async () => { |
|
|
|
const getData = useCallback(async () => { |
|
|
|
try { |
|
|
|
try { |
|
|
|
const data = await illnessApi.list(params.id,1, 100) |
|
|
|
const data = await illnessApi.list(params.id, 1, 100) |
|
|
|
setTotal(data.total) |
|
|
|
setTotal(data.total) |
|
|
|
setBrands([ |
|
|
|
setBrands([ |
|
|
|
...data.list |
|
|
|
...data.list |
|
|
@ -38,23 +39,24 @@ const BrandList: FC = () => { |
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<View className='p-2'> |
|
|
|
<View className='p-2'> |
|
|
|
{ |
|
|
|
{ |
|
|
|
brands.length && |
|
|
|
brands.length > 0 ? |
|
|
|
brands.map((d) => |
|
|
|
brands.map((d) => |
|
|
|
<View className={styles.box} > |
|
|
|
<View className={styles.box}> |
|
|
|
<View className={styles.rightBox}> |
|
|
|
<View className={styles.rightBox}> |
|
|
|
<Collapse title={d.name} children={ |
|
|
|
<Collapse title={d.name} children={ |
|
|
|
<> |
|
|
|
<> |
|
|
|
{ |
|
|
|
{ |
|
|
|
d.articles?.map((d) => |
|
|
|
d.articles?.map((d) => |
|
|
|
<View onClick={() => {Taro.navigateTo({url: `/pages/preview/illness/article/article?id=${d.id}`})}} className='mt-2 font-28 ml-5'>{d.title}</View> |
|
|
|
<View onClick={() => { |
|
|
|
|
|
|
|
Taro.navigateTo({url: `/pages/preview/illness/article/article?id=${d.id}`}) |
|
|
|
|
|
|
|
}} className='mt-2 font-28 ml-5'>{d.title}</View> |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
</> |
|
|
|
</> |
|
|
|
}></Collapse> |
|
|
|
}></Collapse> |
|
|
|
</View> |
|
|
|
</View> |
|
|
|
</View> |
|
|
|
</View> |
|
|
|
) |
|
|
|
):<Empty name='暂无数据'/> |
|
|
|
} |
|
|
|
} |
|
|
|
</View> |
|
|
|
</View> |
|
|
|
) |
|
|
|
) |
|
|
|