浏览代码

【大屏】【优化】【图片预加载】

tags/jenkins-front-end-screenad-250-v42^0
caserKing 5 年前
父节点
当前提交
285a1b7c75
共有 1 个文件被更改,包括 26 次插入12 次删除
  1. +26
    -12
      App.js

+ 26
- 12
App.js 查看文件

@@ -118,7 +118,8 @@ export default class MyPage extends Component {
versionInfo:'未知',
adType: 0,
curAdType02Index: 0, //广告图index
curCoverImgUrl: '',
coverImgUrl: 'https://iformall-net.s3.cn-northwest-1.amazonaws.com.cn/456/37d833d7-263f-4f97-8588-e827c2f43db4.jpg',
previewImg: 'https://iformall-net.s3.cn-northwest-1.amazonaws.com.cn/456/37d833d7-263f-4f97-8588-e827c2f43db4.jpg',

};

@@ -398,7 +399,7 @@ async routine() {
}
this.setState({
curAdType02Index: curNum,
curCoverImgUrl:adDataBgList[curNum].coverImg
previewImg:adDataBgList[curNum].coverImg
})
pageChangeCount = heartConfig.pageChangeInterval
}
@@ -657,19 +658,23 @@ getAdView(){
);
} else if (this.state.adType == 2) {
let curWidthNum = 1080/(PixelRatio.get());
let curImgObj = null;
if (!this.state.curCoverImgUrl) {
curImgObj = require('./image/background.png');
} else {
curImgObj = {
uri: this.state.curCoverImgUrl
}
}
return (
// <ImageBackground style={styles.adTypeBg} source={require('./image/ad1.jpg')}> slideInDown zoomInDown
<View style={styles.adWrapBox}>
<Animatable.View animation="slideInDown" style={styles.adWrap} key={this.state.curCoverImgUrl}>
<ImageBackground style={styles.adTypeBg} resizeMode="stretch" source={curImgObj}>
<Image style={styles.adWrapHideImg}
onLoadStart={() => {

}}
onLoad={() => {
this.setState({
coverImgUrl: this.state.previewImg
})
}}
resizeMode="stretch" source={{uri: this.state.previewImg}}>
</Image>

<Animatable.View animation="slideInDown" style={styles.adWrap} key={this.state.coverImgUrl}>
<ImageBackground style={styles.adTypeBg} resizeMode="stretch" source={{uri: this.state.coverImgUrl}}>
</ImageBackground>
</Animatable.View>
@@ -1227,6 +1232,15 @@ MyPage = CodePush(codePushOptions)(MyPage);
top: 0,
zIndex: 10,
},
adWrapHideImg: {
width: '100%',
height: '100%',
position: 'absolute',
left: 0,
top: 0,
zIndex: -1,
opacity:0,
},

adTypeSwiper02:{
flex: 1,


正在加载...
取消
保存