diff --git a/App.js b/App.js index 0efb895..48e4d5d 100644 --- a/App.js +++ b/App.js @@ -8,7 +8,7 @@ import { Image, ImageBackground, PixelRatio, - NativeModules + NativeModules, } from 'react-native'; @@ -21,6 +21,7 @@ import * as Animatable from 'react-native-animatable'; import Swiper from 'react-native-swiper'; var testMac = 'FF:FF:FF:FF:FF:FF' var curAdIndex = 0; +var curAdType02Index =0; var errorMsg = { ERR_MAC_GET:'设备编号获取错误', ERR_START_AD:'广告播放系统错误', @@ -103,6 +104,7 @@ export default class MyPage extends Component { macAddress: '', versionInfo:'未知', adType: 0, + }; @@ -132,11 +134,11 @@ export default class MyPage extends Component { } componentDidUpdate() { - console.log(this.refs.scrollView) + /* console.log(this.refs.scrollView) if (this.refs.scrollView != undefined) { var ScrollView = this.refs.scrollView; - ScrollView.scrollBy(0.1, false); - } + ScrollView.scrollBy(0, true); + } */ } @@ -204,10 +206,22 @@ codePushStatusDidChange(syncStatus) { if (curAdIndex >= adDataList.length) { curAdIndex = 0; + if (this.state.adType == 0) { - this.setState({adType: 2}); + this.setState({ + adType: 2, + curAdType02Index: 0, + }); } else if (this.state.adType == 2) { - this.setState({adType: 0}); + if (curAdType02Index+1 < adDataBgList.length) { + curAdType02Index++; + } else { + this.setState({ + adType: 0, + curAdType02Index: 0, + }); + } + } } @@ -236,13 +250,12 @@ codePushStatusDidChange(syncStatus) { .then(result => { if (result.code == 200) { let config = JSON.parse(result.data.config); - console.log(config) - // heartConfig.heartbeatInterval = config.heartbeatInterval - // heartConfig.dataRefreshInterval=config.dataRefreshInterval - // heartConfig.pageChangeInterval=config.pageChangeInterval - heartConfig.heartbeatInterval = 20 + heartConfig.heartbeatInterval = config.heartbeatInterval + heartConfig.dataRefreshInterval=config.dataRefreshInterval + heartConfig.pageChangeInterval=config.pageChangeInterval + /* heartConfig.heartbeatInterval = 20 heartConfig.dataRefreshInterval=20 - heartConfig.pageChangeInterval=2 + heartConfig.pageChangeInterval=2 */ // 动画划入 if(config.animationTheme == 0){ @@ -291,7 +304,10 @@ codePushStatusDidChange(syncStatus) { this.showErrMsg(result.message+'\n'+this.state.macAddress); } else if (result.data.list) { //aaa + result.data.list[4].type = 2; + // result.data.list[4].coverImg = './image/ad1.jpg'; result.data.list[5].type = 2; + // result.data.list[5].coverImg = './image/ad2.jpg'; console.log(result.data) //type==0的是券 1是? 2是广告大图 adDataList = result.data.list.filter((item) => { @@ -302,6 +318,7 @@ codePushStatusDidChange(syncStatus) { }) console.log(adDataList) console.log(adDataBgList) + console.log(adDataBgList[curAdType02Index].coverImg) //aaa // this.setState({adType: 2 }) @@ -582,10 +599,11 @@ getAdView(){ ); } else if (this.state.adType == 2) { return ( - + // + {/* adType == 2 滚动轮播 */} - + {this.renderAdTypeSwiper()} @@ -1038,9 +1056,10 @@ MyPage = CodePush(codePushOptions)(MyPage); bottomBox:{ position: 'absolute', - bottom: 0, + bottom: 20/PixelRatio.get(), left: 0, - flex: 2, + width: '100%', + height: 130/PixelRatio.get(), flexDirection: 'row', alignItems: 'center', backgroundColor:'transparent', diff --git a/image/ad2.jpg b/image/ad2.jpg new file mode 100644 index 0000000..fb35e40 Binary files /dev/null and b/image/ad2.jpg differ