浏览代码

[数据动态化]修改]:[修改心跳的数据动态化]

tags/jenkins-front-end-screenad-89-v63^0
meo 6 年前
父节点
当前提交
5b696be3e9
共有 1 个文件被更改,包括 52 次插入55 次删除
  1. +52
    -55
      App.js

+ 52
- 55
App.js 查看文件

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


} }




正在加载...
取消
保存