From 0fb5abcec5de3845ba05507f54f5fb93c05edc77 Mon Sep 17 00:00:00 2001 From: hupeng Date: Thu, 20 Jun 2019 21:42:03 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=BC=82=E5=B8=B8][=E4=BF=AE=E5=A4=8D]:?= =?UTF-8?q?=E6=8D=95=E8=8E=B7=E6=9B=B4=E6=96=B0=E4=B8=AD=E7=9A=84=E5=BC=82?= =?UTF-8?q?=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.js | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/App.js b/App.js index f96d4ea..75b2b31 100644 --- a/App.js +++ b/App.js @@ -294,27 +294,30 @@ async routine() { getAdDataCount -=1; pageChangeCount -=1; + try { + if (getAdDataCount<=0) { + await this.getAdDataList() + getAdDataCount = heartConfig.dataRefreshInterval + } else if (hbRequestCount<=0) { + await this.hbRequest() + hbRequestCount = heartConfig.heartbeatInterval + } - if (getAdDataCount<=0) { - await this.getAdDataList() - getAdDataCount = heartConfig.dataRefreshInterval - } else if (hbRequestCount<=0) { - await this.hbRequest() - hbRequestCount = heartConfig.heartbeatInterval - } - - if (pageChangeCount <= 0) { //页面切换间隔 - if (this.state.contentDisplayStatus) { - this.setState({ contentDisplayStatus: false}) - if (this.updateContent()) { - this.setState({ contentDisplayStatus: true}) + if (pageChangeCount <= 0) { //页面切换间隔 + if (this.state.contentDisplayStatus) { + this.setState({ contentDisplayStatus: false}) + if (this.updateContent()) { + this.setState({ contentDisplayStatus: true}) + } + } else { + await this.getBaseInfo() + await this.getAdDataList() } - } else { - await this.getBaseInfo() - await this.getAdDataList() + pageChangeCount = heartConfig.pageChangeInterval } - pageChangeCount = heartConfig.pageChangeInterval - } + } catch(e){ + this.setState({ versionInfo: this.state.versionInfo+'[E]'}); + } setTimeout(()=>{ this.routine();