|
@@ -17,6 +17,7 @@ let pqtId
|
|
function PqCustom(props: PropsWithChildren<CustomPropsType>) {
|
|
function PqCustom(props: PropsWithChildren<CustomPropsType>) {
|
|
let {
|
|
let {
|
|
adpId,
|
|
adpId,
|
|
|
|
+ width,
|
|
openEmbeddedMiniProgram,
|
|
openEmbeddedMiniProgram,
|
|
onError,
|
|
onError,
|
|
onLoad,
|
|
onLoad,
|
|
@@ -67,9 +68,9 @@ function PqCustom(props: PropsWithChildren<CustomPropsType>) {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
- const { ownPlatformAlliance } = data || {}
|
|
|
|
- const { adType, platformCreativeInfo } = ownPlatformAlliance || {}
|
|
|
|
- const { landingPageAddress } = platformCreativeInfo
|
|
|
|
|
|
+ const { ownPlatform } = data || {}
|
|
|
|
+ const { adType, platformCreativeInfo } = ownPlatform || {}
|
|
|
|
+ const { landingPageAddress } = platformCreativeInfo || {}
|
|
|
|
|
|
if (!landingPageAddress) {
|
|
if (!landingPageAddress) {
|
|
catchError('数据异常', 1013)
|
|
catchError('数据异常', 1013)
|
|
@@ -80,7 +81,8 @@ function PqCustom(props: PropsWithChildren<CustomPropsType>) {
|
|
adType,
|
|
adType,
|
|
...platformCreativeInfo
|
|
...platformCreativeInfo
|
|
})
|
|
})
|
|
- }).catch(() => {
|
|
|
|
|
|
+ }).catch((e) => {
|
|
|
|
+ console.log(e)
|
|
catchError('初始化失败', 1011)
|
|
catchError('初始化失败', 1011)
|
|
})
|
|
})
|
|
}
|
|
}
|
|
@@ -198,20 +200,23 @@ function PqCustom(props: PropsWithChildren<CustomPropsType>) {
|
|
<>
|
|
<>
|
|
{show && <View className='pq-custom' onClick={clickMask}>
|
|
{show && <View className='pq-custom' onClick={clickMask}>
|
|
<View className='custom-container'>
|
|
<View className='custom-container'>
|
|
|
|
+ {/* 广告icon */}
|
|
<View className='icon'>
|
|
<View className='icon'>
|
|
广告
|
|
广告
|
|
</View>
|
|
</View>
|
|
|
|
+ {/* 关闭icon */}
|
|
<View className='close-icon' onClick={closeCustom}>
|
|
<View className='close-icon' onClick={closeCustom}>
|
|
</View>
|
|
</View>
|
|
- <Custom
|
|
|
|
- adData={adData}
|
|
|
|
- onPlay={videoPlay}
|
|
|
|
- onClick={videoClick}
|
|
|
|
- onLoad={videoLoad}
|
|
|
|
- onView={videoView}
|
|
|
|
- onError={videoError}
|
|
|
|
- onTimeUpdate={videoTimeUpdate}
|
|
|
|
- />
|
|
|
|
|
|
+ <Custom
|
|
|
|
+ width={width}
|
|
|
|
+ adData={adData}
|
|
|
|
+ onPlay={videoPlay}
|
|
|
|
+ onClick={videoClick}
|
|
|
|
+ onLoad={videoLoad}
|
|
|
|
+ onView={videoView}
|
|
|
|
+ onError={videoError}
|
|
|
|
+ onTimeUpdate={videoTimeUpdate}
|
|
|
|
+ />
|
|
</View>
|
|
</View>
|
|
</View>}
|
|
</View>}
|
|
</>
|
|
</>
|
|
@@ -219,8 +224,8 @@ function PqCustom(props: PropsWithChildren<CustomPropsType>) {
|
|
}
|
|
}
|
|
|
|
|
|
function Custom({
|
|
function Custom({
|
|
- adData, onPlay, // 播放事件
|
|
|
|
- onClick, onLoad, onView, onError, onTimeUpdate
|
|
|
|
|
|
+ width, adData, onPlay, onClick, onLoad,
|
|
|
|
+ onView, onError, onTimeUpdate
|
|
}) {
|
|
}) {
|
|
const [style, setStyle] = useState({ width: '0px', height: '0px' })
|
|
const [style, setStyle] = useState({ width: '0px', height: '0px' })
|
|
|
|
|
|
@@ -231,6 +236,12 @@ function Custom({
|
|
useGetCustomClient((customClient) => {
|
|
useGetCustomClient((customClient) => {
|
|
let clientWidth = customClient.width
|
|
let clientWidth = customClient.width
|
|
let clientHeight = customClient.height
|
|
let clientHeight = customClient.height
|
|
|
|
+
|
|
|
|
+ if (typeof width === 'number') {
|
|
|
|
+ clientWidth = width
|
|
|
|
+ clientHeight = clientWidth * 667 / 375
|
|
|
|
+ }
|
|
|
|
+
|
|
setStyle({
|
|
setStyle({
|
|
width: `${clientWidth}px`,
|
|
width: `${clientWidth}px`,
|
|
height: `${clientHeight}px`
|
|
height: `${clientHeight}px`
|
|
@@ -245,10 +256,9 @@ function Custom({
|
|
}
|
|
}
|
|
|
|
|
|
return (
|
|
return (
|
|
- <View className='custom' style={style}>
|
|
|
|
|
|
+ <View className='custom'>
|
|
<Video
|
|
<Video
|
|
- id='pq-custom'
|
|
|
|
- className='custom-video'
|
|
|
|
|
|
+ style={style}
|
|
objectFit='fill'
|
|
objectFit='fill'
|
|
controls={false}
|
|
controls={false}
|
|
autoplay
|
|
autoplay
|