| @@ -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 ( | |||
| <Animatable.View animation={animation} style={styles.rankItemBox} key={index}> | |||
| <Image style={styles.RankLogo} resizeMode="stretch" source={{uri:item.logoUrl}}></Image> | |||
| <Image style={styles.RankLogo} resizeMode="stretch" source={{uri:item.coverImg}}></Image> | |||
| <View style={styles.rankContent}> | |||
| <Text style={styles.merchantText} numberOfLines={1} ellipsizeMode="tail">{item.merchantName}</Text> | |||
| <Text style={styles.merchantText} numberOfLines={1} ellipsizeMode="tail">{item.title}</Text> | |||
| <View style={styles.rankRunBox}> | |||
| <View style={styles.rankRun01}> | |||
| <Text style={styles.starTitle}>经营指数: {item.starNum} 分</Text> | |||
| <Text style={styles.starTitle}>经营指数: {item.extInfo.executionIndex} 分</Text> | |||
| <View style={{height: fontSizeNum,flexDirection: 'row', alignItems: 'center',marginTop:18/PixelRatio.get()}}> | |||
| <StarRatingBar | |||
| score={item.starNum} | |||
| score={item.extInfo.executionIndex} | |||
| allowsHalfStars={true} | |||
| accurateHalfStars={true} | |||
| starStyle={curStyleObj} | |||
| @@ -601,10 +602,10 @@ rankItemDom(item,index,animation) { | |||
| </View> | |||
| <View style={styles.rankRun02}> | |||
| <Text style={styles.starTitle}>人气指数: {item.starNum} 分</Text> | |||
| <Text style={styles.starTitle}>人气指数: {item.extInfo.populationIndex} 分</Text> | |||
| <View style={{height: fontSizeNum,flexDirection: 'row', alignItems: 'center',marginTop:18/PixelRatio.get()}}> | |||
| <StarRatingBar | |||
| score={item.starNum} | |||
| score={item.extInfo.populationIndex} | |||
| allowsHalfStars={true} | |||
| accurateHalfStars={true} | |||
| starStyle={curStyleObj} | |||
| @@ -910,21 +911,27 @@ renderAdDom() { | |||
| getAdView(){ | |||
| if (this.state.baseInfo) { | |||
| if (this.state.adType == 0) { | |||
| console.log(this.state.hasRankList) | |||
| console.log(this.state.openRankList) | |||
| if (this.state.hasRankList && this.state.openRankList) { | |||
| console.log(111) | |||
| return ( | |||
| this.renderRankDom() | |||
| ) | |||
| } else { | |||
| console.log(222) | |||
| return ( | |||
| this.renderTicketDom() | |||
| ) | |||
| } | |||
| } else if (this.state.adType == 2) { | |||
| if (this.state.hasRankList && this.state.openRankList) { | |||
| console.log(333) | |||
| return ( | |||
| this.renderRankDom() | |||
| ) | |||
| } else { | |||
| console.log(444) | |||
| return ( | |||
| this.renderAdDom() | |||
| ) | |||