| @@ -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() | |||
| } | |||