From 3f0b11fb079e9b49293ab623d8055187069714b0 Mon Sep 17 00:00:00 2001 From: caserKing Date: Tue, 24 Sep 2019 10:01:58 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E5=A4=A7=E5=B1=8F=E3=80=91=E3=80=90?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E3=80=91=E3=80=90=E6=8E=92=E5=90=8D=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3screen=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.js | 43 +++++++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/App.js b/App.js index 1501ac6..a5672b9 100644 --- a/App.js +++ b/App.js @@ -321,6 +321,14 @@ codePushStatusDidChange(syncStatus) { adDataBgList = dataList.filter((item) => { return item.type == 2; }) + let merchantRankList = dataList.filter((item) => { + if (item.type == 3) { + item.extInfo = JSON.parse(item.extInfo); + item.extInfo.executionIndex = Number(item.extInfo.executionIndex); + item.extInfo.populationIndex = Number(item.extInfo.populationIndex); + } + return item.type == 3; + }) // let num = 0; if (adDataList.length > 0 && adDataBgList.length > 0) { @@ -332,18 +340,9 @@ codePushStatusDidChange(syncStatus) { num = 1; } //aaa - // this.setState({adType: num }) - this.setState({adType: 0 }) - adDataList.map(item => { - item.starNum = 3.4; - item.logoUrl = item.coverImg; - item.merchantName = '小米之家'; - - }) - let arr = [...adDataList,...adDataList]; - arr = arr.slice(0,5); + this.setState({adType: num }) this.setState({ - merchantRankList: arr + merchantRankList: merchantRankList }) //aaa if (this.state.adType == 1 && this.state.hasRankList) { @@ -398,6 +397,7 @@ codePushStatusDidChange(syncStatus) { if (result.code != 200) { this.showErrMsg(result.message+'\n'+this.state.macAddress); } else if (result.data) { + console.log(result.data) this.setState({baseInfo:result.data}); } else { this.showErrMsg(errorMsg.ERR_DATA_GET); @@ -545,9 +545,10 @@ getContentViewItemMerchantName(contentItem) { rankDom() { let rankDomStack = []; let {merchantRankList,} = this.state; - let animation = ''; + if (merchantRankList.length > 0) { merchantRankList.map((item,index) => { + let animation = ''; if (this.state.adType == 0) { if (index == 0) { animation = this.state.animationTheme.first; @@ -580,15 +581,15 @@ rankItemDom(item,index,animation) { } return ( - + - {item.merchantName} + {item.title} - 经营指数: {item.starNum} 分 + 经营指数: {item.extInfo.executionIndex} 分 - 人气指数: {item.starNum} 分 + 人气指数: {item.extInfo.populationIndex} 分