|
|
@ -6,6 +6,11 @@ import {HomeApi} from "@/api"; |
|
|
|
import first from '@/static/img/first.png' |
|
|
|
import first from '@/static/img/first.png' |
|
|
|
import second from '@/static/img/second.png' |
|
|
|
import second from '@/static/img/second.png' |
|
|
|
import third from '@/static/img/third.png' |
|
|
|
import third from '@/static/img/third.png' |
|
|
|
|
|
|
|
import brandTop from '@/static/img/brandTop.png' |
|
|
|
|
|
|
|
import illnessTop from '@/static/img/illnessTop.png' |
|
|
|
|
|
|
|
import healthTop from '@/static/img/healthTop.png' |
|
|
|
|
|
|
|
import professionTop from '@/static/img/professionTop.png' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
interface DataContent { |
|
|
|
interface DataContent { |
|
|
|
id: number, |
|
|
|
id: number, |
|
|
@ -16,7 +21,7 @@ interface DataContent { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
interface Data { |
|
|
|
interface Data { |
|
|
|
title: string |
|
|
|
titleUrl: string |
|
|
|
url: string |
|
|
|
url: string |
|
|
|
detailsUrl: string |
|
|
|
detailsUrl: string |
|
|
|
data: DataContent[] |
|
|
|
data: DataContent[] |
|
|
@ -25,25 +30,25 @@ interface Data { |
|
|
|
const FeatureRecommended: FC = () => { |
|
|
|
const FeatureRecommended: FC = () => { |
|
|
|
const [data, setData] = useState<Data[]>([ |
|
|
|
const [data, setData] = useState<Data[]>([ |
|
|
|
{ |
|
|
|
{ |
|
|
|
title: "品牌TOP3", |
|
|
|
titleUrl: brandTop, |
|
|
|
url: '/pages/preview/brand/list/list', |
|
|
|
url: '/pages/preview/brand/list/list', |
|
|
|
detailsUrl: '/pages/preview/brand/info/info', |
|
|
|
detailsUrl: '/pages/preview/brand/info/info', |
|
|
|
data: [] |
|
|
|
data: [] |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
title: "健康知识TOP3", |
|
|
|
titleUrl: healthTop, |
|
|
|
url: '/pages/preview/health/health', |
|
|
|
url: '/pages/preview/health/health', |
|
|
|
detailsUrl: '/pages/preview/videoFull/videoFull', |
|
|
|
detailsUrl: '/pages/preview/videoFull/videoFull', |
|
|
|
data: [] |
|
|
|
data: [] |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
titleUrl: professionTop, |
|
|
|
url: '/pages/preview/profession/profession', |
|
|
|
url: '/pages/preview/profession/profession', |
|
|
|
title: "专业技能TOP3", |
|
|
|
|
|
|
|
detailsUrl: '/pages/preview/videoFull/videoFull', |
|
|
|
detailsUrl: '/pages/preview/videoFull/videoFull', |
|
|
|
data: [] |
|
|
|
data: [] |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
title: "疾病知识TOP3", |
|
|
|
titleUrl: illnessTop, |
|
|
|
url: '/pages/preview/illness/sort/sort', |
|
|
|
url: '/pages/preview/illness/sort/sort', |
|
|
|
detailsUrl: '/pages/preview/illness/article/article', |
|
|
|
detailsUrl: '/pages/preview/illness/article/article', |
|
|
|
data: [] |
|
|
|
data: [] |
|
|
@ -75,7 +80,7 @@ const FeatureRecommended: FC = () => { |
|
|
|
title: d.title, |
|
|
|
title: d.title, |
|
|
|
imageUrl: d.url_path, |
|
|
|
imageUrl: d.url_path, |
|
|
|
description: d.introduction, |
|
|
|
description: d.introduction, |
|
|
|
path: `?url=${d.resource.url}` |
|
|
|
path: `?url=${d.resource.url}&poster=${d.url_path}&title=${d.resource.name}` |
|
|
|
})) |
|
|
|
})) |
|
|
|
} catch (e) { |
|
|
|
} catch (e) { |
|
|
|
} |
|
|
|
} |
|
|
@ -91,7 +96,7 @@ const FeatureRecommended: FC = () => { |
|
|
|
imageUrl: d.url_path, |
|
|
|
imageUrl: d.url_path, |
|
|
|
description: '', |
|
|
|
description: '', |
|
|
|
title: d.resource.name, |
|
|
|
title: d.resource.name, |
|
|
|
path: `?url=${d.resource.url}` |
|
|
|
path: `?url=${d.resource.url}&poster=${d.url_path}&title=${d.resource.name}` |
|
|
|
})) |
|
|
|
})) |
|
|
|
} catch (e) { |
|
|
|
} catch (e) { |
|
|
|
} |
|
|
|
} |
|
|
@ -132,17 +137,20 @@ const FeatureRecommended: FC = () => { |
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<View className={styles.feature}> |
|
|
|
<View className={styles.feature}> |
|
|
|
<Swiper nextMargin='30px' style={{height: '225px'}}> |
|
|
|
<Swiper nextMargin='30px' style={{height: '250px'}}> |
|
|
|
{ |
|
|
|
{ |
|
|
|
data.map(d => <SwiperItem key={d.title}> |
|
|
|
data.map(d => <SwiperItem key={d.url}> |
|
|
|
<View className={styles.featureTitle} onClick={() => jump(d.url)}>{d.title}</View> |
|
|
|
<Image |
|
|
|
|
|
|
|
mode='heightFix' |
|
|
|
|
|
|
|
className={styles.featureTitle} |
|
|
|
|
|
|
|
onClick={() => jump(d.url)} src={d.titleUrl}/> |
|
|
|
{ |
|
|
|
{ |
|
|
|
d.data.map((c, index) => <View |
|
|
|
d.data.map((c, index) => <View |
|
|
|
className='flex mb-3' |
|
|
|
className='flex mb-3' |
|
|
|
key={c.id} |
|
|
|
key={c.id} |
|
|
|
onClick={() => jump(d.detailsUrl + c.path)}> |
|
|
|
onClick={() => jump(d.detailsUrl + c.path)}> |
|
|
|
<View> |
|
|
|
<View> |
|
|
|
<Image src={c.imageUrl} className={styles.featureImage} mode='widthFix'/> |
|
|
|
<Image src={c.imageUrl} className={styles.featureImage} mode='aspectFill'/> |
|
|
|
<Image src={[first, second, third][index]} className={styles.ranking} mode='aspectFill'/> |
|
|
|
<Image src={[first, second, third][index]} className={styles.ranking} mode='aspectFill'/> |
|
|
|
</View> |
|
|
|
</View> |
|
|
|
<View className={styles.featureText}> |
|
|
|
<View className={styles.featureText}> |
|
|
|