|
@@ -7,14 +7,9 @@ import './index.less'
|
|
|
import http from '@/http/index'
|
|
|
import { adSelfPredict } from '@/http/api/index'
|
|
|
|
|
|
-// const WEB_VIEW_URL = 'plugin-private://wxf7261ed54f2e450e/pages/customPage/index'
|
|
|
-const VIDEO_SRC = 'https://xycdn.yishihui.com/ad/prod/video/material_AD_1708595757_1708595757542.mp4'
|
|
|
-const VIDEO_COVER = 'http://rescdn.yishihui.com/ad/prod/video/material_AD_1702267670_1702267670233.mp4?x-oss-process=video/snapshot,t_5000,f_jpg,w_0,h_0,m_fast'
|
|
|
-
|
|
|
// 在一些场景下 loadedMetaFiredInOnce 被触发了很多次
|
|
|
let loadedMetaFiredInOnce = 0
|
|
|
|
|
|
-
|
|
|
function PqCustom(props: PropsWithChildren<CustomPropsType>) {
|
|
|
let {
|
|
|
adpId,
|
|
@@ -36,6 +31,7 @@ function PqCustom(props: PropsWithChildren<CustomPropsType>) {
|
|
|
onClose
|
|
|
} = wrapProps(props)
|
|
|
const [show, setShow] = useState(true)
|
|
|
+ const [adData, setAdData] = useState<any>({})
|
|
|
|
|
|
useReady(() => {
|
|
|
getAdConfig()
|
|
@@ -51,7 +47,22 @@ function PqCustom(props: PropsWithChildren<CustomPropsType>) {
|
|
|
}, {
|
|
|
header: { 'content-type': 'application/json;' }
|
|
|
}).then((res: RequestType) => {
|
|
|
- console.log(res)
|
|
|
+ const { code, message, data } = res
|
|
|
+ // TODO: onError、logUpload
|
|
|
+ if(code !== 0) {
|
|
|
+ onError()
|
|
|
+ // logUpload()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ const { ownPlatformAlliance } = data || {}
|
|
|
+ const { adType, platformCreativeInfo } = ownPlatformAlliance || {}
|
|
|
+ setAdData({
|
|
|
+ adType,
|
|
|
+ ...platformCreativeInfo
|
|
|
+ })
|
|
|
+
|
|
|
+ console.log(data)
|
|
|
})
|
|
|
}
|
|
|
|
|
@@ -104,8 +115,7 @@ function PqCustom(props: PropsWithChildren<CustomPropsType>) {
|
|
|
autoplay={autoplay}
|
|
|
loop={loop}
|
|
|
muted={muted}
|
|
|
- src={VIDEO_SRC}
|
|
|
- poster={VIDEO_COVER}
|
|
|
+ adData={adData}
|
|
|
onPlay={videoPlay}
|
|
|
onTimeUpdate={videoTimeUpdate}
|
|
|
onPause={videoPause}
|
|
@@ -125,7 +135,7 @@ function PqCustom(props: PropsWithChildren<CustomPropsType>) {
|
|
|
}
|
|
|
|
|
|
function Custom({
|
|
|
- autoplay, loop, muted, src, poster,
|
|
|
+ autoplay, loop, muted, adData,
|
|
|
onPlay, onPause, onEnded, onTimeUpdate, onStop, // 播放事件
|
|
|
onClick, onLoad, onView, onError
|
|
|
}) {
|
|
@@ -163,8 +173,8 @@ function Custom({
|
|
|
autoplay={autoplay}
|
|
|
loop={loop}
|
|
|
muted={muted}
|
|
|
- src={src}
|
|
|
- poster={poster}
|
|
|
+ src={adData.materialAddress}
|
|
|
+ poster={adData.materialCoverPic}
|
|
|
// video事件
|
|
|
onPlay={onPlay}
|
|
|
onTimeUpdate={onTimeUpdate}
|
|
@@ -178,9 +188,9 @@ function Custom({
|
|
|
onLoadedMetaData={onLoadedMetaData}
|
|
|
/>
|
|
|
<View className='custom-bottom'>
|
|
|
- <Image src='http://rescdn.yishihui.com/ad/prod/image/logo_AD_1702267670_1702267670233.png' className='logo' />
|
|
|
- <View className='title'>5天站桩入门课</View>
|
|
|
- <View className='button'>免费领取</View>
|
|
|
+ <Image src={adData.creativeLogoAddress} className='logo' />
|
|
|
+ <View className='title'>{adData.creativeTitle}</View>
|
|
|
+ <View className='button'>{adData.clickButtonText}</View>
|
|
|
</View>
|
|
|
</View>
|
|
|
)
|