| @@ -58,7 +58,7 @@ var animationThemes = [ | |||||
| { | { | ||||
| first:"fadeInDownBig", | first:"fadeInDownBig", | ||||
| second:"fadeInLeftBig", | second:"fadeInLeftBig", | ||||
| third:"fadeInRightBig" | |||||
| third:"fadeInRightBig" | |||||
| }, | }, | ||||
| { | { | ||||
| first:"zoomInDown", | first:"zoomInDown", | ||||
| @@ -73,32 +73,31 @@ var animationThemes = [ | |||||
| ] | ] | ||||
| export default class MyPage extends Component { | 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) { | codePushStatusDidChange(syncStatus) { | ||||
| switch(syncStatus) { | switch(syncStatus) { | ||||
| @@ -162,33 +161,33 @@ codePushStatusDidChange(syncStatus) { | |||||
| {version:this.state.versionInfo}) | {version:this.state.versionInfo}) | ||||
| .then(result => { | .then(result => { | ||||
| this.setState({ | 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 => { | .catch(error => { | ||||
| this.setState({ errorMessage : ERR_HEARTBEAT}); | this.setState({ errorMessage : ERR_HEARTBEAT}); | ||||
| @@ -215,9 +214,7 @@ codePushStatusDidChange(syncStatus) { | |||||
| this.setState({contentDisplayStatus: false}) | this.setState({contentDisplayStatus: false}) | ||||
| this.setState({errorMessage : error.message}); | this.setState({errorMessage : error.message}); | ||||
| }) | }) | ||||
| } | |||||
| } | |||||
| getBaseInfo() { | getBaseInfo() { | ||||
| HttpUtils.get(NativeModules.BuildConfig.apiHost + 'api/wxDeviceScreenAd/info?deviceId='+encodeURIComponent(this.state.macAddress)) | HttpUtils.get(NativeModules.BuildConfig.apiHost + 'api/wxDeviceScreenAd/info?deviceId='+encodeURIComponent(this.state.macAddress)) | ||||
| .then(result => { | .then(result => { | ||||
| @@ -274,7 +271,6 @@ componentDidMount() { | |||||
| startAd() { | startAd() { | ||||
| this.getBaseInfo() | this.getBaseInfo() | ||||
| this.hbRequest() | this.hbRequest() | ||||
| this.getAdDataList() | |||||
| setInterval( | setInterval( | ||||
| ()=>{ | ()=>{ | ||||
| if (this.state.contentDisplayStatus) { | if (this.state.contentDisplayStatus) { | ||||
| @@ -307,6 +303,7 @@ startAd() { | |||||
| this.state.heartConfig.heartbeatInterval | this.state.heartConfig.heartbeatInterval | ||||
| // 1000*60*5, //5分钟一次 | // 1000*60*5, //5分钟一次 | ||||
| ); | ); | ||||
| this.getAdDataList() | |||||
| } | } | ||||