|
|
@@ -72,6 +72,10 @@ var animationThemes = [ |
|
|
|
} |
|
|
|
] |
|
|
|
|
|
|
|
var hbRequestCount |
|
|
|
var getAdDataCount |
|
|
|
var pageChangeCount |
|
|
|
|
|
|
|
export default class MyPage extends Component { |
|
|
|
constructor(props) { |
|
|
|
super(props); |
|
|
@@ -83,8 +87,7 @@ export default class MyPage extends Component { |
|
|
|
contentItem2:null, |
|
|
|
animationTheme:{}, |
|
|
|
heartConfig:{ |
|
|
|
heartbeatInterval:1000*5, |
|
|
|
// heartbeatInterval:1000*5*60, |
|
|
|
heartbeatInterval:1000*5*60, |
|
|
|
dataRefreshInterval:1000*60*60, |
|
|
|
pageChangeInterval:1000*10, |
|
|
|
}, |
|
|
@@ -272,36 +275,49 @@ componentDidMount() { |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
startAd() { |
|
|
|
this.getBaseInfo() |
|
|
|
this.getAdDataList() |
|
|
|
this.hbRequest() |
|
|
|
|
|
|
|
hbRequestCount =this.state.heartConfig.pageChangeInterval; |
|
|
|
getAdDataCount =this.state.heartConfig.dataRefreshInterval; |
|
|
|
pageChangeCount =this.state.heartConfig.heartbeatInterval; |
|
|
|
|
|
|
|
setInterval(()=>{ |
|
|
|
if (this.state.contentDisplayStatus) { |
|
|
|
this.setState({ contentDisplayStatus: false}) |
|
|
|
if (this.updateContent()) { |
|
|
|
this.setState({ contentDisplayStatus: true}) |
|
|
|
|
|
|
|
hbRequestCount -=1000; |
|
|
|
getAdDataCount -=1000; |
|
|
|
pageChangeCount -=1000; |
|
|
|
|
|
|
|
if (pageChangeCount <= 0) { //页面切换间隔 |
|
|
|
if (this.state.contentDisplayStatus) { |
|
|
|
this.setState({ contentDisplayStatus: false}) |
|
|
|
if (this.updateContent()) { |
|
|
|
this.setState({ contentDisplayStatus: true}) |
|
|
|
} |
|
|
|
} else { |
|
|
|
this.getBaseInfo() |
|
|
|
this.getAdDataList() |
|
|
|
} |
|
|
|
} else { |
|
|
|
this.getBaseInfo() |
|
|
|
pageChangeCount = this.state.heartConfig.pageChangeInterval |
|
|
|
} |
|
|
|
|
|
|
|
if (getAdDataCount<=0) { |
|
|
|
this.getAdDataList() |
|
|
|
getAdDataCount = this.state.heartConfig.dataRefreshInterval |
|
|
|
} |
|
|
|
|
|
|
|
if (hbRequestCount<=0) { |
|
|
|
this.hbRequest() |
|
|
|
hbRequestCount = this.state.heartConfig.heartbeatInterval |
|
|
|
} |
|
|
|
}, |
|
|
|
//页面切换间隔 |
|
|
|
this.state.heartConfig.pageChangeInterval |
|
|
|
); |
|
|
|
setInterval(()=>{ |
|
|
|
this.getAdDataList() |
|
|
|
}, |
|
|
|
// 数据获取间隔 |
|
|
|
this.state.heartConfig.dataRefreshInterval |
|
|
|
); |
|
|
|
setInterval(()=>{ |
|
|
|
this.hbRequest() |
|
|
|
}, |
|
|
|
// 心跳间隔 |
|
|
|
this.state.heartConfig.heartbeatInterval |
|
|
|
1000 |
|
|
|
); |
|
|
|
this.getAdDataList() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
getContentViewItemUplayer(contentItem) { |
|
|
|