From 5b696be3e9def75f5273d47aa772a2fe01cd39f2 Mon Sep 17 00:00:00 2001 From: meo <18801474720@163.com> Date: Thu, 21 Mar 2019 16:58:02 +0800 Subject: [PATCH] =?UTF-8?q?[=E6=95=B0=E6=8D=AE=E5=8A=A8=E6=80=81=E5=8C=96]?= =?UTF-8?q?=E4=BF=AE=E6=94=B9]:[=E4=BF=AE=E6=94=B9=E5=BF=83=E8=B7=B3?= =?UTF-8?q?=E7=9A=84=E6=95=B0=E6=8D=AE=E5=8A=A8=E6=80=81=E5=8C=96]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.js | 107 ++++++++++++++++++++++++++++----------------------------- 1 file changed, 52 insertions(+), 55 deletions(-) diff --git a/App.js b/App.js index b646204..577bf07 100644 --- a/App.js +++ b/App.js @@ -58,7 +58,7 @@ var animationThemes = [ { first:"fadeInDownBig", second:"fadeInLeftBig", - third:"fadeInRightBig" + third:"fadeInRightBig" }, { first:"zoomInDown", @@ -73,32 +73,31 @@ var animationThemes = [ ] export default class MyPage extends Component { - constructor(props) { - super(props); - this.state = { - baseInfo: baseInfoDefault, - adDataList:[], - contentItem0:null, - contentItem1:null, - contentItem2:null, - animationTheme:{}, - heartConfig:{ - heartbeatInterval:1000*60*5, - dataRefreshInterval:1000*60*60, - pageChangeInterval:1000*10, - }, - contentDisplayStatus:false, - syncMessage: "初始化..." , - errorMessage: '加载中...', - progress: { - receivedBytes:0, - totalBytes:0 - }, - macAddress: '', - versionInfo:'未知' - }; + constructor(props) { + super(props); + this.state = { + baseInfo: baseInfoDefault, + adDataList:[], + contentItem0:null, + contentItem1:null, + contentItem2:null, + animationTheme:{}, + heartConfig:{ + heartbeatInterval:1000*60*5, + dataRefreshInterval:1000*60*60, + pageChangeInterval:1000*10, + }, + contentDisplayStatus:false, + syncMessage: "初始化..." , + errorMessage: '加载中...', + progress: { + receivedBytes:0, + totalBytes:0 + }, + macAddress: '', + versionInfo:'未知' + }; } - // 监听更新状态 codePushStatusDidChange(syncStatus) { switch(syncStatus) { @@ -162,33 +161,33 @@ codePushStatusDidChange(syncStatus) { {version:this.state.versionInfo}) .then(result => { this.setState({ - // heartConfig:{ - // heartbeatInterval:JSON.parse(result.data.config).heartbeatInterval, - // dataRefreshInterval:JSON.parse(result.data.config).dataRefreshInterval, - // pageChangeInterval:JSON.parse(result.data.config).pageChangeInterval - // } + heartConfig:{ + heartbeatInterval:JSON.parse(result.data.config).heartbeatInterval, + dataRefreshInterval:JSON.parse(result.data.config).dataRefreshInterval, + pageChangeInterval:JSON.parse(result.data.config).pageChangeInterval + } }) // 动画 - this.setState({ - animationTheme:animationThemes[2] - }) - // if(JSON.parse(result.data.config).animationThem == 0){ - // this.setState({ - // animationTheme:animationThemes[0] - // }) - // }else if(JSON.parse(result.data.config).animationThem == 1){ - // this.setState({ - // animationTheme:animationThemes[1] - // }) - // }else if(JSON.parse(result.data.config).animationThem == 2){ - // this.setState({ - // animationTheme:animationThemes[2] - // }) - // }else if(JSON.parse(result.data.config).animationThem == 3){ - // this.setState({ - // animationTheme:animationThemes[3] - // }) - // } + // this.setState({ + // animationTheme:animationThemes[2] + // }) + if(JSON.parse(result.data.config).animationThem == 0){ + this.setState({ + animationTheme:animationThemes[0] + }) + }else if(JSON.parse(result.data.config).animationThem == 1){ + this.setState({ + animationTheme:animationThemes[1] + }) + }else if(JSON.parse(result.data.config).animationThem == 2){ + this.setState({ + animationTheme:animationThemes[2] + }) + }else if(JSON.parse(result.data.config).animationThem == 3){ + this.setState({ + animationTheme:animationThemes[3] + }) + } }) .catch(error => { this.setState({ errorMessage : ERR_HEARTBEAT}); @@ -215,9 +214,7 @@ codePushStatusDidChange(syncStatus) { this.setState({contentDisplayStatus: false}) this.setState({errorMessage : error.message}); }) - - } - + } getBaseInfo() { HttpUtils.get(NativeModules.BuildConfig.apiHost + 'api/wxDeviceScreenAd/info?deviceId='+encodeURIComponent(this.state.macAddress)) .then(result => { @@ -274,7 +271,6 @@ componentDidMount() { startAd() { this.getBaseInfo() this.hbRequest() - this.getAdDataList() setInterval( ()=>{ if (this.state.contentDisplayStatus) { @@ -307,6 +303,7 @@ startAd() { this.state.heartConfig.heartbeatInterval // 1000*60*5, //5分钟一次 ); + this.getAdDataList() }