diff --git a/App.js b/App.js index 577bf07..0eec569 100644 --- a/App.js +++ b/App.js @@ -56,9 +56,9 @@ var animationThemes = [ third:"slideInRight" }, { - first:"fadeInDownBig", - second:"fadeInLeftBig", - third:"fadeInRightBig" + first:"fadeIn", + second:"fadeIn", + third:"fadeIn" }, { first:"zoomInDown", @@ -83,7 +83,7 @@ export default class MyPage extends Component { contentItem2:null, animationTheme:{}, heartConfig:{ - heartbeatInterval:1000*60*5, + heartbeatInterval:1000 * 5, dataRefreshInterval:1000*60*60, pageChangeInterval:1000*10, }, @@ -160,37 +160,38 @@ codePushStatusDidChange(syncStatus) { +encodeURIComponent(this.state.macAddress), {version:this.state.versionInfo}) .then(result => { + let config = JSON.parse(result.data.config); this.setState({ heartConfig:{ - heartbeatInterval:JSON.parse(result.data.config).heartbeatInterval, - dataRefreshInterval:JSON.parse(result.data.config).dataRefreshInterval, - pageChangeInterval:JSON.parse(result.data.config).pageChangeInterval + heartbeatInterval:config.heartbeatInterval, + dataRefreshInterval:config.dataRefreshInterval, + pageChangeInterval:config.pageChangeInterval } }) // 动画 - // this.setState({ - // animationTheme:animationThemes[2] - // }) - if(JSON.parse(result.data.config).animationThem == 0){ + if(config.animationTheme == 0){ this.setState({ animationTheme:animationThemes[0] }) - }else if(JSON.parse(result.data.config).animationThem == 1){ + }else if(config.animationTheme == 1){ this.setState({ animationTheme:animationThemes[1] }) - }else if(JSON.parse(result.data.config).animationThem == 2){ + + }else if(config.animationTheme == 2){ this.setState({ animationTheme:animationThemes[2] }) - }else if(JSON.parse(result.data.config).animationThem == 3){ + }else if(config.animationTheme == 3){ this.setState({ animationTheme:animationThemes[3] }) } + }) .catch(error => { - this.setState({ errorMessage : ERR_HEARTBEAT}); + console.warn(error) + this.setState({ errorMessage : error}); }) } @@ -271,8 +272,7 @@ componentDidMount() { startAd() { this.getBaseInfo() this.hbRequest() - setInterval( - ()=>{ + setInterval(()=>{ if (this.state.contentDisplayStatus) { this.setState({ contentDisplayStatus: false}) if (this.updateContent()) { @@ -285,26 +285,20 @@ startAd() { }, //页面切换间隔 this.state.heartConfig.pageChangeInterval - // 1000*10, //10秒更新一下页面 ); - setInterval( - ()=>{ + setInterval(()=>{ this.getAdDataList() }, // 数据获取间隔 this.state.heartConfig.dataRefreshInterval - // 1000*60*60, //1小时一次 ); - setInterval( - ()=>{ + setInterval(()=>{ this.hbRequest() }, // 心跳间隔 this.state.heartConfig.heartbeatInterval - // 1000*60*5, //5分钟一次 ); this.getAdDataList() - } getContentViewItemUplayer(contentItem) { @@ -350,17 +344,9 @@ getContentViewItem(contentItem, annomation) { ) - actionText = '扫码领取'; - if (contentItem.target.type == 8) - actionText = '扫码砍价'; - else if (contentItem.target.type == 9) - actionText = '扫码拼团'; - merchantName = ""; - if (contentItem.target.merchantVoList.length > 1) - merchantName = '多商户通用'; - else - merchantName = contentItem.target.merchantVoList[0].merchantName; - + actionText = this.getContentViewItemActionStr(contentItem); + merchantName = this.getContentViewItemMerchantName(contentItem); + // console.warn(annomation) return (