소스 검색

尝试处理轮播销毁操作

tags/jenkins-front-end-screenad-211-v114
caserKing 5 년 전
부모
커밋
08836f2d63
2개의 변경된 파일36개의 추가작업 그리고 17개의 파일을 삭제
  1. +36
    -17
      App.js
  2. BIN
      image/ad2.jpg

+ 36
- 17
App.js 파일 보기

@@ -8,7 +8,7 @@ import {
Image, Image,
ImageBackground, ImageBackground,
PixelRatio, PixelRatio,
NativeModules
NativeModules,
} from 'react-native'; } from 'react-native';




@@ -21,6 +21,7 @@ import * as Animatable from 'react-native-animatable';
import Swiper from 'react-native-swiper'; import Swiper from 'react-native-swiper';
var testMac = 'FF:FF:FF:FF:FF:FF' var testMac = 'FF:FF:FF:FF:FF:FF'
var curAdIndex = 0; var curAdIndex = 0;
var curAdType02Index =0;
var errorMsg = { var errorMsg = {
ERR_MAC_GET:'设备编号获取错误', ERR_MAC_GET:'设备编号获取错误',
ERR_START_AD:'广告播放系统错误', ERR_START_AD:'广告播放系统错误',
@@ -103,6 +104,7 @@ export default class MyPage extends Component {
macAddress: '', macAddress: '',
versionInfo:'未知', versionInfo:'未知',
adType: 0, adType: 0,


}; };


@@ -132,11 +134,11 @@ export default class MyPage extends Component {
} }


componentDidUpdate() { componentDidUpdate() {
console.log(this.refs.scrollView)
/* console.log(this.refs.scrollView)
if (this.refs.scrollView != undefined) { if (this.refs.scrollView != undefined) {
var ScrollView = this.refs.scrollView; var ScrollView = this.refs.scrollView;
ScrollView.scrollBy(0.1, false);
}
ScrollView.scrollBy(0, true);
} */
} }


@@ -204,10 +206,22 @@ codePushStatusDidChange(syncStatus) {
if (curAdIndex >= adDataList.length) { if (curAdIndex >= adDataList.length) {
curAdIndex = 0; curAdIndex = 0;

if (this.state.adType == 0) { if (this.state.adType == 0) {
this.setState({adType: 2});
this.setState({
adType: 2,
curAdType02Index: 0,
});
} else if (this.state.adType == 2) { } 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 => { .then(result => {
if (result.code == 200) { if (result.code == 200) {
let config = JSON.parse(result.data.config); 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.dataRefreshInterval=20
heartConfig.pageChangeInterval=2
heartConfig.pageChangeInterval=2 */
// 动画划入 // 动画划入
if(config.animationTheme == 0){ if(config.animationTheme == 0){
@@ -291,7 +304,10 @@ codePushStatusDidChange(syncStatus) {
this.showErrMsg(result.message+'\n'+this.state.macAddress); this.showErrMsg(result.message+'\n'+this.state.macAddress);
} else if (result.data.list) { } else if (result.data.list) {
//aaa //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].type = 2;
// result.data.list[5].coverImg = './image/ad2.jpg';
console.log(result.data) console.log(result.data)
//type==0的是券 1是? 2是广告大图 //type==0的是券 1是? 2是广告大图
adDataList = result.data.list.filter((item) => { adDataList = result.data.list.filter((item) => {
@@ -302,6 +318,7 @@ codePushStatusDidChange(syncStatus) {
}) })
console.log(adDataList) console.log(adDataList)
console.log(adDataBgList) console.log(adDataBgList)
console.log(adDataBgList[curAdType02Index].coverImg)
//aaa //aaa
// this.setState({adType: 2 }) // this.setState({adType: 2 })


@@ -582,10 +599,11 @@ getAdView(){
); );
} else if (this.state.adType == 2) { } else if (this.state.adType == 2) {
return ( return (
<ImageBackground style={styles.adTypeBg} source={require('./image/ad1.jpg')}>
// <ImageBackground style={styles.adTypeBg} source={require('./image/ad1.jpg')}>
<ImageBackground style={styles.adTypeBg} source={{ uri: adDataBgList[curAdType02Index].coverImg}}>
{/* adType == 2 滚动轮播 */} {/* adType == 2 滚动轮播 */}
<Swiper ref='scrollView' style={styles.adTypeSwiper02} autoplay={true} autoplayTimeout={0.5} showPagination={false}
dotColor="gray" activeDotColor="#fff" horizontal={true} loop={true} index={0} showsButtons={false}>
<Swiper ref='scrollView' style={styles.adTypeSwiper02} autoplay={true} autoplayTimeout={1} showPagination={false}
dotColor="transparent" activeDotColor="transparent" horizontal={true} showsButtons={false}>
{this.renderAdTypeSwiper()} {this.renderAdTypeSwiper()}
</Swiper> </Swiper>


@@ -1038,9 +1056,10 @@ MyPage = CodePush(codePushOptions)(MyPage);


bottomBox:{ bottomBox:{
position: 'absolute', position: 'absolute',
bottom: 0,
bottom: 20/PixelRatio.get(),
left: 0, left: 0,
flex: 2,
width: '100%',
height: 130/PixelRatio.get(),
flexDirection: 'row', flexDirection: 'row',
alignItems: 'center', alignItems: 'center',
backgroundColor:'transparent', backgroundColor:'transparent',


BIN
image/ad2.jpg 파일 보기

Before After
Width: 1080  |  Height: 1920  |  Size: 243 KiB

불러오는 중...
취소
저장