|
|
|
@ -2,7 +2,6 @@ import {FC, useEffect, useState} from "react"; |
|
|
|
|
import {Image, Swiper, SwiperItem, View} from "@tarojs/components"; |
|
|
|
|
import styles from '../home.module.scss' |
|
|
|
|
import Taro from "@tarojs/taro"; |
|
|
|
|
import {HomeApi} from "@/api"; |
|
|
|
|
import first from '@/static/img/first.png' |
|
|
|
|
import second from '@/static/img/second.png' |
|
|
|
|
import third from '@/static/img/third.png' |
|
|
|
@ -27,7 +26,6 @@ interface Data { |
|
|
|
|
detailsUrl: string |
|
|
|
|
data: DataContent[] |
|
|
|
|
errorType: ImgErrType |
|
|
|
|
type?: 'health' | 'kill' |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
interface Props { |
|
|
|
@ -51,7 +49,6 @@ const FeatureRecommended: FC<Props> = (props) => { |
|
|
|
|
url: '/pages/preview/health/health', |
|
|
|
|
detailsUrl: '/pages/preview/videoFull/videoFull', |
|
|
|
|
data: [], |
|
|
|
|
type: "health", |
|
|
|
|
errorType: 'health' |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
@ -59,7 +56,6 @@ const FeatureRecommended: FC<Props> = (props) => { |
|
|
|
|
url: '/pages/preview/profession/profession', |
|
|
|
|
detailsUrl: '/pages/preview/videoFull/videoFull', |
|
|
|
|
data: [], |
|
|
|
|
type: 'kill', |
|
|
|
|
errorType: 'profession' |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
@ -94,7 +90,7 @@ const FeatureRecommended: FC<Props> = (props) => { |
|
|
|
|
title: d.title, |
|
|
|
|
imageUrl: d.url_path, |
|
|
|
|
description: d.introduction, |
|
|
|
|
path: `?url=${d.resource?.url}&poster=${d.url_path}&title=${d.title}` |
|
|
|
|
path: `?id=${d.id}`, |
|
|
|
|
})) |
|
|
|
|
} catch (e) { |
|
|
|
|
} |
|
|
|
@ -109,7 +105,7 @@ const FeatureRecommended: FC<Props> = (props) => { |
|
|
|
|
imageUrl: d.url_path, |
|
|
|
|
description: d.introduction, |
|
|
|
|
title: d.title, |
|
|
|
|
path: `?url=${d.resource?.url}&poster=${d.url_path}&title=${d.title}` |
|
|
|
|
path: `?id=${d.id}`, |
|
|
|
|
})) |
|
|
|
|
} catch (e) { |
|
|
|
|
} |
|
|
|
@ -142,15 +138,8 @@ const FeatureRecommended: FC<Props> = (props) => { |
|
|
|
|
}) |
|
|
|
|
}, [props]) |
|
|
|
|
|
|
|
|
|
// TODO 后续增加播放量使用公共接口
|
|
|
|
|
function jump(url: string, playId?: number, type?: 'health' | 'kill') { |
|
|
|
|
if (playId && type) { |
|
|
|
|
if (type === 'health') { |
|
|
|
|
HomeApi.healthSetPlay(playId) |
|
|
|
|
} else if (type === 'kill') { |
|
|
|
|
HomeApi.skillSetPlay(playId) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
function jump(url: string, data: any) { |
|
|
|
|
Taro.preload(data) |
|
|
|
|
Taro.navigateTo({url}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -162,13 +151,13 @@ const FeatureRecommended: FC<Props> = (props) => { |
|
|
|
|
<Image |
|
|
|
|
mode='heightFix' |
|
|
|
|
className={styles.featureTitle} |
|
|
|
|
onClick={() => jump(d.url)} src={d.titleUrl}/> |
|
|
|
|
onClick={() => jump(d.url, d)} src={d.titleUrl}/> |
|
|
|
|
{ |
|
|
|
|
d.data.length > 0 && d.data.map((c, index) => <View |
|
|
|
|
className='flex' |
|
|
|
|
style={{marginBottom: '16rpx'}} |
|
|
|
|
key={c.id} |
|
|
|
|
onClick={() => jump(d.detailsUrl + c.path, c.id, d.type)}> |
|
|
|
|
onClick={() => jump(d.detailsUrl + c.path, d)}> |
|
|
|
|
<View style={{position: 'relative'}}> |
|
|
|
|
<View className={styles.featureImage}> |
|
|
|
|
<Img src={c.imageUrl} height={100} width={140} errorType={d.errorType}/> |
|
|
|
|