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} 分