diff --git a/App.js b/App.js index 740845f..078a14b 100644 --- a/App.js +++ b/App.js @@ -22,6 +22,7 @@ import * as Animatable from 'react-native-animatable'; import Swiper from 'react-native-swiper'; import Carousel from 'react-native-snap-carousel'; // import {BoxShadow} from 'react-native-shadow'; +import StarRatingBar from 'react-native-star-rating-view/StarRatingBar'; var testMac = 'FF:FF:FF:FF:FF:FF' var curAdIndex = 0; @@ -299,7 +300,7 @@ codePushStatusDidChange(syncStatus) { adDataBgList = dataList.filter((item) => { return item.type == 2; }) - //aaa + // let num = 0; if (adDataList.length > 0 && adDataBgList.length > 0) { num = 2; @@ -309,7 +310,18 @@ codePushStatusDidChange(syncStatus) { } else if (!adDataList.length && adDataBgList.length > 0) { num = 1; } - this.setState({adType: num }) + //aaa + // this.setState({adType: num }) + this.setState({adType: 0 }) + adDataList.map(item => { + item.starNum = 3.4; + item.logoUrl = item.coverImg; + item.merchantName = '小米之家'; + + }) + adDataList = [...adDataList,...adDataList]; + adDataList = adDataList.slice(0,5); + } getAdDataList(first) { @@ -321,7 +333,7 @@ codePushStatusDidChange(syncStatus) { if (result.code != 200) { this.showErrMsg(result.message+'\n'+this.state.macAddress); } else if (result.data.list) { - //aaa + // //type==0的是券 1是? 2是广告大图 let curData = result.data.list; this.dealLoopType(curData); @@ -475,7 +487,56 @@ getContentViewItemMerchantName(contentItem) { return contentItem.target.merchantVoList[0].merchantName; } } +//排名 rank dom +renderRankDom() { + let rankDomStack = []; + adDataList.map((item) => { + rankDomStack.push(this.rankItemDom(item)); + }) + return rankDomStack; +} +//每一条 rank +rankItemDom(item) { + return ( + + {/* */} + + + {item.merchantName} + + 经营指数: {item.starNum} 分 + } + filledStarImage={} + scoreTextStyle={{color:'#fff'}} + /> + + + 人气指数: {item.starNum} 分 + } + filledStarImage={} + scoreTextStyle={{color:'#fff'}} + /> + + + + + + + {/* */} + + + ) +} +//券列表content部分 getContentViewItem(contentItem, annomation) { if (!contentItem) return ( @@ -485,7 +546,7 @@ getContentViewItem(contentItem, annomation) { actionText = this.getContentViewItemActionStr(contentItem); merchantName = this.getContentViewItemMerchantName(contentItem); - //aaa + // // contentItem.target.salePriceStr = 234005.8; // console.warn(annomation) let curNumStr = contentItem.target.salePriceStr+''; @@ -536,17 +597,25 @@ getContentViewItem(contentItem, annomation) { getContentView() { if (this.state.contentDisplayStatus) { - return ( - {this.getContentViewItem(this.state.contentItem0,this.state.animationTheme.first)} - {this.getContentViewItem(this.state.contentItem1,this.state.animationTheme.second)} - {this.getContentViewItem(this.state.contentItem2,this.state.animationTheme.third)} - ) - }else{ - return ( - - {this.state.errorMessage} - ) + //aaa + if (true) { + return ( + {this.renderRankDom()} + ) + } else { + return ( + {this.getContentViewItem(this.state.contentItem0,this.state.animationTheme.first)} + {this.getContentViewItem(this.state.contentItem1,this.state.animationTheme.second)} + {this.getContentViewItem(this.state.contentItem2,this.state.animationTheme.third)} + ) } + + }else{ + return ( + + {this.state.errorMessage} + ) + } } setAdSwiperItemDom(item) { let contentItem = item.item; @@ -568,7 +637,7 @@ setSwiperItemDom(item) { if (contentItem.subType == 7) curLogo = require('./image/groupbuy.png'); } - //aaa + // // contentItem.target.salePriceStr = 24502228; let curNumStr = contentItem.target.salePriceStr+''; let curStyleObj = {}; @@ -1335,6 +1404,48 @@ MyPage = CodePush(codePushOptions)(MyPage); backgroundColor: 'transparent', alignItems: 'center', + }, + //排名的列表样式 + rankItemBox: { + flex: 1, + flexDirection: 'row', + alignItems: 'center', + width: '92%', + height: 260/PixelRatio.get(), + backgroundColor: '#fff', + borderRadius: 26/PixelRatio.get(), + marginTop: 20/PixelRatio.get(), + borderWidth: 1, + borderColor: 'green', + }, + + rankContent: { + marginLeft: 30/PixelRatio.get(), + }, + + rankItemBg: { + flex: 1, + flexDirection: 'row', + alignItems: 'center', + width: '100%', + height: 260/PixelRatio.get(), + borderWidth: 1, + borderColor: 'blue', + }, + + RankLogo: { + width: 220/PixelRatio.get(), + height: 220/PixelRatio.get(), + marginLeft: 30/PixelRatio.get(), + borderWidth: 1, + borderColor: 'yellow', + }, + + rankQrcodeImg: { + width: 220/PixelRatio.get(), + height: 220/PixelRatio.get(), + marginLeft: 10/PixelRatio.get(), + } }); diff --git a/image/hot_gold.png b/image/hot_gold.png new file mode 100644 index 0000000..71365e0 Binary files /dev/null and b/image/hot_gold.png differ diff --git a/image/hot_gray.png b/image/hot_gray.png new file mode 100644 index 0000000..e8d31ac Binary files /dev/null and b/image/hot_gray.png differ diff --git a/image/star_gold.png b/image/star_gold.png new file mode 100644 index 0000000..d5c0c8e Binary files /dev/null and b/image/star_gold.png differ diff --git a/image/star_gray.png b/image/star_gray.png new file mode 100644 index 0000000..3340394 Binary files /dev/null and b/image/star_gray.png differ diff --git a/package-lock.json b/package-lock.json index 93d703b..b18ac2f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10108,6 +10108,14 @@ "react-addons-shallow-compare": "15.6.2" } }, + "react-native-star-rating-view": { + "version": "0.0.12", + "resolved": "https://registry.npm.taobao.org/react-native-star-rating-view/download/react-native-star-rating-view-0.0.12.tgz", + "integrity": "sha1-heW8pPARabHPkVD4LdMnvUGT6r4=", + "requires": { + "react-native-vector-icons": "^4.0.0" + } + }, "react-native-svg": { "version": "9.6.2", "resolved": "https://registry.npm.taobao.org/react-native-svg/download/react-native-svg-9.6.2.tgz", @@ -10121,6 +10129,38 @@ "prop-types": "^15.5.10" } }, + "react-native-vector-icons": { + "version": "4.6.0", + "resolved": "https://registry.npm.taobao.org/react-native-vector-icons/download/react-native-vector-icons-4.6.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Freact-native-vector-icons%2Fdownload%2Freact-native-vector-icons-4.6.0.tgz", + "integrity": "sha1-5AFDEf+m3jl9kU/8MbcJeodMyNU=", + "requires": { + "lodash": "^4.0.0", + "prop-types": "^15.5.10", + "yargs": "^8.0.2" + }, + "dependencies": { + "yargs": { + "version": "8.0.2", + "resolved": "https://registry.npm.taobao.org/yargs/download/yargs-8.0.2.tgz?cache=0&sync_timestamp=1567812322754&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fyargs%2Fdownload%2Fyargs-8.0.2.tgz", + "integrity": "sha1-YpmpBVsc78lp/355wdkY3Osiw2A=", + "requires": { + "camelcase": "^4.1.0", + "cliui": "^3.2.0", + "decamelize": "^1.1.1", + "get-caller-file": "^1.0.1", + "os-locale": "^2.0.0", + "read-pkg-up": "^2.0.0", + "require-directory": "^2.1.1", + "require-main-filename": "^1.0.1", + "set-blocking": "^2.0.0", + "string-width": "^2.0.0", + "which-module": "^2.0.0", + "y18n": "^3.2.1", + "yargs-parser": "^7.0.0" + } + } + } + }, "react-proxy": { "version": "1.1.8", "resolved": "https://registry.npm.taobao.org/react-proxy/download/react-proxy-1.1.8.tgz", diff --git a/package.json b/package.json index c36f812..0688267 100644 --- a/package.json +++ b/package.json @@ -7,15 +7,16 @@ "test": "jest" }, "dependencies": { + "code-push": "2.0.7", "react": "16.8.3", "react-native": "0.59.9", "react-native-animatable": "^1.3.2", "react-native-camera": "^1.12.0", - "code-push": "2.0.7", "react-native-code-push": "5.6.1", "react-native-device-info": "^2.1.2", "react-native-shadow": "^1.2.2", "react-native-snap-carousel": "^3.8.0", + "react-native-star-rating-view": "0.0.12", "react-native-svg": "^9.6.2", "react-native-swiper": "^1.5.14", "rn-fetch-blob": "^0.10.15"