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