| @@ -321,6 +321,14 @@ codePushStatusDidChange(syncStatus) { | |||||
| adDataBgList = dataList.filter((item) => { | adDataBgList = dataList.filter((item) => { | ||||
| return item.type == 2; | 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; | let num = 0; | ||||
| if (adDataList.length > 0 && adDataBgList.length > 0) { | if (adDataList.length > 0 && adDataBgList.length > 0) { | ||||
| @@ -332,18 +340,9 @@ codePushStatusDidChange(syncStatus) { | |||||
| num = 1; | num = 1; | ||||
| } | } | ||||
| //aaa | //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({ | this.setState({ | ||||
| merchantRankList: arr | |||||
| merchantRankList: merchantRankList | |||||
| }) | }) | ||||
| //aaa | //aaa | ||||
| if (this.state.adType == 1 && this.state.hasRankList) { | if (this.state.adType == 1 && this.state.hasRankList) { | ||||
| @@ -398,6 +397,7 @@ codePushStatusDidChange(syncStatus) { | |||||
| if (result.code != 200) { | if (result.code != 200) { | ||||
| this.showErrMsg(result.message+'\n'+this.state.macAddress); | this.showErrMsg(result.message+'\n'+this.state.macAddress); | ||||
| } else if (result.data) { | } else if (result.data) { | ||||
| console.log(result.data) | |||||
| this.setState({baseInfo:result.data}); | this.setState({baseInfo:result.data}); | ||||
| } else { | } else { | ||||
| this.showErrMsg(errorMsg.ERR_DATA_GET); | this.showErrMsg(errorMsg.ERR_DATA_GET); | ||||
| @@ -545,9 +545,10 @@ getContentViewItemMerchantName(contentItem) { | |||||
| rankDom() { | rankDom() { | ||||
| let rankDomStack = []; | let rankDomStack = []; | ||||
| let {merchantRankList,} = this.state; | let {merchantRankList,} = this.state; | ||||
| let animation = ''; | |||||
| if (merchantRankList.length > 0) { | if (merchantRankList.length > 0) { | ||||
| merchantRankList.map((item,index) => { | merchantRankList.map((item,index) => { | ||||
| let animation = ''; | |||||
| if (this.state.adType == 0) { | if (this.state.adType == 0) { | ||||
| if (index == 0) { | if (index == 0) { | ||||
| animation = this.state.animationTheme.first; | animation = this.state.animationTheme.first; | ||||
| @@ -580,15 +581,15 @@ rankItemDom(item,index,animation) { | |||||
| } | } | ||||
| return ( | return ( | ||||
| <Animatable.View animation={animation} style={styles.rankItemBox} key={index}> | <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}> | <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.rankRunBox}> | ||||
| <View style={styles.rankRun01}> | <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()}}> | <View style={{height: fontSizeNum,flexDirection: 'row', alignItems: 'center',marginTop:18/PixelRatio.get()}}> | ||||
| <StarRatingBar | <StarRatingBar | ||||
| score={item.starNum} | |||||
| score={item.extInfo.executionIndex} | |||||
| allowsHalfStars={true} | allowsHalfStars={true} | ||||
| accurateHalfStars={true} | accurateHalfStars={true} | ||||
| starStyle={curStyleObj} | starStyle={curStyleObj} | ||||
| @@ -601,10 +602,10 @@ rankItemDom(item,index,animation) { | |||||
| </View> | </View> | ||||
| <View style={styles.rankRun02}> | <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()}}> | <View style={{height: fontSizeNum,flexDirection: 'row', alignItems: 'center',marginTop:18/PixelRatio.get()}}> | ||||
| <StarRatingBar | <StarRatingBar | ||||
| score={item.starNum} | |||||
| score={item.extInfo.populationIndex} | |||||
| allowsHalfStars={true} | allowsHalfStars={true} | ||||
| accurateHalfStars={true} | accurateHalfStars={true} | ||||
| starStyle={curStyleObj} | starStyle={curStyleObj} | ||||
| @@ -910,21 +911,27 @@ renderAdDom() { | |||||
| getAdView(){ | getAdView(){ | ||||
| if (this.state.baseInfo) { | if (this.state.baseInfo) { | ||||
| if (this.state.adType == 0) { | if (this.state.adType == 0) { | ||||
| console.log(this.state.hasRankList) | |||||
| console.log(this.state.openRankList) | |||||
| if (this.state.hasRankList && this.state.openRankList) { | if (this.state.hasRankList && this.state.openRankList) { | ||||
| console.log(111) | |||||
| return ( | return ( | ||||
| this.renderRankDom() | this.renderRankDom() | ||||
| ) | ) | ||||
| } else { | } else { | ||||
| console.log(222) | |||||
| return ( | return ( | ||||
| this.renderTicketDom() | this.renderTicketDom() | ||||
| ) | ) | ||||
| } | } | ||||
| } else if (this.state.adType == 2) { | } else if (this.state.adType == 2) { | ||||
| if (this.state.hasRankList && this.state.openRankList) { | if (this.state.hasRankList && this.state.openRankList) { | ||||
| console.log(333) | |||||
| return ( | return ( | ||||
| this.renderRankDom() | this.renderRankDom() | ||||
| ) | ) | ||||
| } else { | } else { | ||||
| console.log(444) | |||||
| return ( | return ( | ||||
| this.renderAdDom() | this.renderAdDom() | ||||
| ) | ) | ||||