广告屏react-native项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

1471 rivejä
41 KiB

  1. import React, { Component } from 'react';
  2. import {
  3. Platform,
  4. StyleSheet,
  5. Text,
  6. View,
  7. Image,
  8. ImageBackground,
  9. PixelRatio,
  10. NativeModules,
  11. } from 'react-native';
  12. //引用插件
  13. import Package from './package.json'
  14. import HttpUtils from './HttpUtils.js';
  15. import CodePush from "react-native-code-push";
  16. import DeviceInfo from "react-native-device-info";
  17. import * as Animatable from 'react-native-animatable';
  18. import Swiper from 'react-native-swiper';
  19. import Carousel from 'react-native-snap-carousel';
  20. // import {BoxShadow} from 'react-native-shadow';
  21. import StarRatingBar from 'react-native-star-rating-view/StarRatingBar';
  22. var testMac = 'FF:FF:FF:FF:FF:FF'
  23. var curAdIndex = 0;
  24. var errorMsg = {
  25. ERR_MAC_GET:'设备编号获取错误',
  26. ERR_START_AD:'广告播放系统错误',
  27. ERR_DATA_GET:'广告数据获取错误',
  28. ERR_HEARTBEAT:'设备心跳数据错误',
  29. ERR_NO_DATA:'暂无优惠信息'
  30. }
  31. var animationThemes = [
  32. // 滑入
  33. {
  34. first:"slideInDown",
  35. second:"slideInLeft",
  36. third:"slideInRight"
  37. },
  38. // 放大
  39. {
  40. first:"zoomInDown",
  41. second:"zoomInLeft",
  42. third:"zoomInRight"
  43. },
  44. // 翻转
  45. {
  46. first:"flipInX",
  47. second:"flipInY",
  48. third:"flipInX"
  49. },
  50. // 弹出
  51. {
  52. first:"bounceInDown",
  53. second:"bounceInLeft",
  54. third:"bounceInRight"
  55. }
  56. ]
  57. const shadowOpt = {
  58. width: 800/PixelRatio.get(),
  59. height: 240/PixelRatio.get(),
  60. color:"#000",
  61. border:2,
  62. radius:3,
  63. opacity:0.5,
  64. x:2,
  65. y:3,
  66. style:{marginVertical:5}
  67. }
  68. var curTimer = null;
  69. var hbRequestCount
  70. var getAdDataCount
  71. var pageChangeCount
  72. var adDataList = [];
  73. var adDataBgList = [];
  74. var heartConfig = {
  75. heartbeatInterval:300,
  76. dataRefreshInterval:3600,
  77. pageChangeInterval:10,
  78. }
  79. var requestFailedCount = 0;
  80. var versionInfo = '';
  81. let codePushOptions = {
  82. //设置检查更新的频率
  83. //ON_APP_RESUME APP恢复到前台的时候
  84. //ON_APP_START APP开启的时候
  85. //MANUAL 手动检查
  86. checkFrequency : CodePush.CheckFrequency.ON_APP_START
  87. };
  88. export default class MyPage extends Component {
  89. constructor(props) {
  90. super(props);
  91. this.state = {
  92. baseInfo: null,
  93. contentItem0:null,
  94. contentItem1:null,
  95. contentItem2:null,
  96. animationTheme:animationThemes[0],
  97. contentDisplayStatus:false,
  98. syncMessage: "初始化..." ,
  99. errorMessage: '加载中...',
  100. progress: {
  101. receivedBytes:0,
  102. totalBytes:0
  103. },
  104. updating:true,
  105. macAddress: '',
  106. versionInfo:'未知',
  107. adType: 0,
  108. curAdType02Index: 0, //广告图index
  109. coverImgUrl: '',
  110. previewImg: '',
  111. curImgState: false,
  112. };
  113. /* this.codePushUpdate = this.codePushUpdate.bind(this);
  114. this.startAd = this.startAd.bind(this);
  115. this.showErrMsg = this.showErrMsg.bind(this); */
  116. }
  117. componentDidMount() {
  118. this.codePushUpdate();
  119. DeviceInfo.getMACAddress().then((mac)=>{
  120. if (mac=='' || mac==null ) {
  121. if (NativeModules.BuildConfig.buildType == 'debug') {
  122. this.setState({macAddress : this.testMac})
  123. this.startAd()
  124. } else {
  125. this.showErrMsg(errorMsg.ERR_MAC_GET);
  126. }
  127. } else {
  128. this.setState({macAddress : mac})
  129. this.startAd()
  130. }
  131. }).catch(e => {
  132. this.showErrMsg(errorMsg.ERR_START_AD);
  133. })
  134. }
  135. componentDidUpdate() {
  136. /* console.log(this.refs.scrollView)
  137. if (this.refs.scrollView != undefined) {
  138. var ScrollView = this.refs.scrollView;
  139. ScrollView.scrollBy(0, true);
  140. } */
  141. }
  142. //更新函数
  143. async codePushUpdate() {
  144. CodePush.allowRestart();
  145. await CodePush.getUpdateMetadata(CodePush.UpdateState.RUNNING)
  146. .then((metadata: LocalPackage) => {
  147. this.setState({ versionInfo: metadata ? 'b'+NativeModules.BuildConfig.versionCode+"-" + metadata.label : 'b'+ NativeModules.BuildConfig.versionCode});
  148. versionInfo = this.state.versionInfo;
  149. }, (error: any) => {
  150. this.setState({ versionInfo: "Unknown"});
  151. versionInfo = this.state.versionInfo;
  152. });
  153. await CodePush.sync(
  154. { mandatoryInstallMode: CodePush.InstallMode.ON_NEXT_RESTART,
  155. installMode: CodePush.InstallMode.ON_NEXT_RESTART},
  156. this.codePushStatusDidChange.bind(this),
  157. this.codePushDownloadDidProgress.bind(this)
  158. ).then((status: SyncStatus) => {
  159. }, (error: any) => {
  160. console.log(error)
  161. // CodePush.restartApp();
  162. });
  163. }
  164. // 监听更新状态
  165. codePushStatusDidChange(syncStatus) {
  166. switch(syncStatus) {
  167. case CodePush.SyncStatus.CHECKING_FOR_UPDATE:
  168. this.setState({ syncMessage: "检查更新" });
  169. break;
  170. case CodePush.SyncStatus.DOWNLOADING_PACKAGE:
  171. this.setState({ syncMessage: "下载更新" });
  172. break;
  173. case CodePush.SyncStatus.AWAITING_USER_ACTION:
  174. this.setState({ syncMessage: "等待用户操作" });
  175. break;
  176. case CodePush.SyncStatus.INSTALLING_UPDATE:
  177. this.setState({ syncMessage: "安装更新" });
  178. break;
  179. case CodePush.SyncStatus.UP_TO_DATE:
  180. this.setState({ syncMessage: "已更新到最新程序", updating: false });
  181. break;
  182. case CodePush.SyncStatus.UPDATE_IGNORED:
  183. this.setState({ syncMessage: "更新被取消", updating: false });
  184. break;
  185. case CodePush.SyncStatus.UPDATE_INSTALLED:
  186. this.setState({ syncMessage: "更新已安装,重启应用后生效", updating: false });
  187. break;
  188. case CodePush.SyncStatus.UNKNOWN_ERROR:
  189. this.setState({ syncMessage: "未知错误", updating: false });
  190. break;
  191. }
  192. }
  193. codePushDownloadDidProgress(progress) {
  194. this.setState({ progress });
  195. }
  196. // 列表滚动
  197. updateContent() {
  198. if (adDataList.length <=0)
  199. return false;
  200. if (curAdIndex >= adDataList.length) {
  201. curAdIndex = 0;
  202. }
  203. this.setState({contentItem0:adDataList[curAdIndex]});
  204. if (curAdIndex + 1 < adDataList.length)
  205. this.setState({contentItem1:adDataList[curAdIndex+1]});
  206. else
  207. this.setState({contentItem1:null});
  208. if (curAdIndex + 2 < adDataList.length)
  209. this.setState({contentItem2:adDataList[curAdIndex+2]});
  210. else
  211. this.setState({contentItem2:null});
  212. curAdIndex+=3
  213. return true;
  214. }
  215. hbRequest() {
  216. return HttpUtils.post(NativeModules.BuildConfig.apiHost
  217. + 'api/wxDeviceScreenAd/heartbeat?deviceId='
  218. + encodeURIComponent(this.state.macAddress),
  219. {version:this.state.versionInfo})
  220. .then(result => {
  221. if (result.code == 200) {
  222. let config = JSON.parse(result.data.config);
  223. heartConfig.heartbeatInterval = config.heartbeatInterval
  224. heartConfig.dataRefreshInterval=config.dataRefreshInterval
  225. heartConfig.pageChangeInterval=config.pageChangeInterval
  226. // 动画划入
  227. if(config.animationTheme == 0){
  228. this.setState({
  229. animationTheme:animationThemes[0]
  230. })
  231. }else if(config.animationTheme == 1){
  232. // 放大
  233. this.setState({
  234. animationTheme:animationThemes[1]
  235. })
  236. }else if(config.animationTheme == 2){
  237. // 淡入
  238. this.setState({
  239. animationTheme:animationThemes[2]
  240. })
  241. }else if(config.animationTheme == 3){
  242. // 弹入
  243. this.setState({
  244. animationTheme:animationThemes[3]
  245. })
  246. }
  247. } else {
  248. //do nothing
  249. }
  250. })
  251. .catch(error => {
  252. requestFailedCount++
  253. this.setState({ versionInfo: versionInfo+`[${requestFailedCount}]`});
  254. })
  255. }
  256.  showErrMsg(errMsg) {
  257. this.setState({contentDisplayStatus: false})
  258. this.setState({errorMessage : errMsg});
  259. }
  260. //判断播放类型adType
  261. dealLoopType(dataList) {
  262. adDataList = dataList.filter((item) => {
  263. return item.type == 0;
  264. })
  265. adDataBgList = dataList.filter((item) => {
  266. return item.type == 2;
  267. })
  268. //
  269. let num = 0;
  270. if (adDataList.length > 0 && adDataBgList.length > 0) {
  271. num = 2;
  272. this.setState({previewImg: adDataBgList[0].coverImg});
  273. } else if (adDataList.length > 0 && !adDataBgList.length) {
  274. num = 0;
  275. } else if (!adDataList.length && adDataBgList.length > 0) {
  276. num = 1;
  277. }
  278. //aaa
  279. // this.setState({adType: num })
  280. this.setState({adType: 0 })
  281. adDataList.map(item => {
  282. item.starNum = 3.4;
  283. item.logoUrl = item.coverImg;
  284. item.merchantName = '小米之家';
  285. })
  286. adDataList = [...adDataList,...adDataList];
  287. adDataList = adDataList.slice(0,5);
  288. }
  289. getAdDataList(first) {
  290. HttpUtils.get(NativeModules.BuildConfig.apiHost
  291. + 'api/wxDeviceScreenAd/list?deviceId='
  292. + encodeURIComponent(this.state.macAddress)
  293. + '&pageNum=1&pageSize=1000')
  294. .then(result => {
  295. if (result.code != 200) {
  296. this.showErrMsg(result.message+'\n'+this.state.macAddress);
  297. } else if (result.data.list) {
  298. //
  299. //type==0的是券 1是? 2是广告大图
  300. let curData = result.data.list;
  301. this.dealLoopType(curData);
  302. if (this.updateContent()) {
  303. this.setState({contentDisplayStatus: true})
  304. } else {
  305. this.showErrMsg(errorMsg.ERR_NO_DATA);
  306. }
  307. } else {
  308.  this.showErrMsg(errorMsg.ERR_DATA_GET);
  309. }
  310. })
  311. .catch(error => {
  312. if (first) {
  313. this.showErrMsg(error.message);
  314. }
  315. else {
  316. requestFailedCount++
  317. this.setState({ versionInfo: versionInfo+`[${requestFailedCount}]`});
  318. }
  319. })
  320. }
  321. getBaseInfo() {
  322. HttpUtils.get(NativeModules.BuildConfig.apiHost
  323. + 'api/wxDeviceScreenAd/info?deviceId='
  324. + encodeURIComponent(this.state.macAddress))
  325. .then(result => {
  326. if (result.code != 200) {
  327. this.showErrMsg(result.message+'\n'+this.state.macAddress);
  328. } else if (result.data) {
  329. this.setState({baseInfo:result.data});
  330. } else {
  331. this.showErrMsg(errorMsg.ERR_DATA_GET);
  332. }
  333. })
  334. .catch(error => {
  335. this.showErrMsg(error.message);
  336. })
  337. }
  338. componentWillUnmount(){
  339. if (curTimer)
  340. clearTimeout(curTimer)
  341. }
  342. async routine() {
  343. hbRequestCount -=1;
  344. getAdDataCount -=1;
  345. if (this.state.adType == 2 && this.state.curImgState) {
  346. pageChangeCount -=1;
  347. }
  348. if (this.state.adType != 2) {
  349. pageChangeCount -=1;
  350. }
  351. try {
  352. if (getAdDataCount<=0) {
  353. this.getAdDataList(false)
  354. getAdDataCount = heartConfig.dataRefreshInterval
  355. } else if (hbRequestCount<=0) {
  356. this.hbRequest()
  357. hbRequestCount = heartConfig.heartbeatInterval
  358. }
  359. //如果是adType == 2时间间隔到了,要检验轮播是否走完在决定切换
  360. if (this.state.adType == 2) {
  361. if (pageChangeCount<=0) {
  362. let curNum = this.state.curAdType02Index + 1;
  363. if (curNum >= adDataBgList.length) {
  364. curNum = 0;
  365. }
  366. this.setState({
  367. curAdType02Index: curNum,
  368. previewImg:adDataBgList[curNum].coverImg
  369. })
  370. pageChangeCount = heartConfig.pageChangeInterval
  371. }
  372. } else if (this.state.adType == 0) {
  373. if (pageChangeCount <= 0) { //页面切换间隔
  374. if (this.state.contentDisplayStatus && this.state.baseInfo) {
  375. this.setState({ contentDisplayStatus: false})
  376. if (this.updateContent()) {
  377. this.setState({ contentDisplayStatus: true})
  378. }
  379. } else {
  380. await this.getBaseInfo()
  381. await this.getAdDataList(true)
  382. getAdDataCount = heartConfig.dataRefreshInterval
  383. hbRequestCount = heartConfig.heartbeatInterval
  384. }
  385. pageChangeCount = heartConfig.pageChangeInterval
  386. }
  387. }
  388. } catch(e){
  389. this.setState({ versionInfo: versionInfo+'[E]'});
  390. }
  391. curTimer = setTimeout(()=>{
  392. this.routine();
  393. },1000);
  394. }
  395. startAd() {
  396. hbRequestCount = 0;
  397. getAdDataCount = 0;
  398. pageChangeCount = 0;
  399. this.routine();
  400. }
  401. getContentViewItemUplayer(contentItem) {
  402. if (contentItem.type == 0) {
  403. if (contentItem.subType == 2)
  404. return (<Image source={require('./image/timed.png')} resizeMode='center' style={styles.contentItemUpLayer} /> )
  405. if (contentItem.subType == 6)
  406. return (<Image source={require('./image/discount.png')} resizeMode='center' style={styles.contentItemUpLayer} /> )
  407. if (contentItem.subType == 7)
  408. return (<Image source={require('./image/groupbuy.png')} resizeMode='center' style={styles.contentItemUpLayer} /> )
  409. return null;
  410. }
  411. }
  412. getContentViewItemActionStr(contentItem) {
  413. if (contentItem.type == 0) {
  414. if (contentItem.subType == 2)
  415. return '扫码秒杀';
  416. else if (contentItem.subType == 6)
  417. return '扫码砍价';
  418. else if (contentItem.subType == 7)
  419. return '扫码拼团';
  420. else
  421. return '扫码领取';
  422. }
  423. }
  424. getContentViewItemMerchantName(contentItem) {
  425. if (contentItem.type == 0) {
  426. if (contentItem.target.merchantVoList.length > 1)
  427. return '多商户通用';
  428. else
  429. return contentItem.target.merchantVoList[0].merchantName;
  430. }
  431. }
  432. //排名 rank dom
  433. renderRankDom() {
  434. let rankDomStack = [];
  435. adDataList.map((item,index) => {
  436. rankDomStack.push(this.rankItemDom(item,index));
  437. })
  438. return rankDomStack;
  439. }
  440. //每一条 rank
  441. rankItemDom(item,index) {
  442. let fontSizeNum = 40/(PixelRatio.get());
  443. let curStyleObj = {
  444. width: fontSizeNum,
  445. height: fontSizeNum
  446. }
  447. return (
  448. <View style={styles.rankItemBox} key={index}>
  449. {/* <ImageBackground source={require('./image/item-background.png')} resizeMode="stretch" style={styles.rankItemBg}> */}
  450. <Image style={styles.RankLogo} resizeMode="stretch" source={{uri:item.logoUrl}}></Image>
  451. <View style={styles.rankContent}>
  452. <Text style={styles.merchantText}>{item.merchantName}</Text>
  453. <View style={styles.rankRun}>
  454. <Text style={styles.starTitle}>经营指数: {item.starNum} 分</Text>
  455. <StarRatingBar
  456. score={item.starNum}
  457. allowsHalfStars={true}
  458. accurateHalfStars={true}
  459. emptyStarImage={<Image style={curStyleObj} source={require('./image/star_gray.png')} />}
  460. filledStarImage={<Image style={curStyleObj} source={require('./image/star_red.png')} />}
  461. scoreTextStyle={{color:'#fff'}}
  462. />
  463. </View>
  464. <View style={styles.rankRun}>
  465. <Text style={styles.starTitle}>人气指数: {item.starNum} 分</Text>
  466. <StarRatingBar
  467. score={item.starNum}
  468. allowsHalfStars={true}
  469. accurateHalfStars={true}
  470. emptyStarImage={<Image style={curStyleObj} source={require('./image/hot_gray.png')} />}
  471. filledStarImage={<Image style={curStyleObj} source={require('./image/hot_red.png')} />}
  472. scoreTextStyle={{color:'#fff'}}
  473. />
  474. </View>
  475. </View>
  476. <Image source={{uri:item.target.qrCode}} resizeMode="stretch" style={styles.rankQrcodeImg}></Image>
  477. {/* </ImageBackground> */}
  478. </View>
  479. )
  480. }
  481. //券列表content部分
  482. getContentViewItem(contentItem, annomation) {
  483. if (!contentItem)
  484. return (
  485. <View style={styles.contentItem}>
  486. </View>
  487. )
  488. actionText = this.getContentViewItemActionStr(contentItem);
  489. merchantName = this.getContentViewItemMerchantName(contentItem);
  490. //
  491. // contentItem.target.salePriceStr = 234005.8;
  492. // console.warn(annomation)
  493. let curNumStr = contentItem.target.salePriceStr+'';
  494. let curStyleObj = {};
  495. if (curNumStr.length > 5 || Number(curNumStr) > 10000) {
  496. curStyleObj = styles.contentItemTopDetailCurPriceStr02;
  497. } else {
  498. curStyleObj = styles.contentItemTopDetailCurPriceStr01;
  499. }
  500. return (
  501. <Animatable.View animation={annomation} style={styles.contentItem}>
  502. <ImageBackground source={require('./image/item-background.png')} resizeMode='center' style={styles.contentItemDownLayer} >
  503. {/* 列表 */}
  504. <View style={styles.contentItemTop}>
  505. <Image source={{uri: contentItem.coverImg}} resizeMode='cover' style={styles.contentItemTopCoverImg} />
  506. <View style={styles.contentItemTopDetail}>
  507. {/* 券的title */}
  508. <Text style={styles.contentItemTopDetailTitle} numberOfLines={2} ellipsizeMode="tail">{contentItem.target.title}</Text>
  509. <View style={styles.contentItemTopDetailPrice}>
  510. {/* 售价 */}
  511. <View style={styles.contentItemTopDetailCurPrice}>
  512. <Text style={styles.contentItemTopDetailCurPriceStrUnit}>¥</Text>
  513. <Text style={curStyleObj}>{contentItem.target.salePriceStr}</Text>
  514. {/* <Text style={styles.contentItemTopDetailCurPriceStr}>{contentItem.target.salePriceStr}</Text> */}
  515. </View>
  516. {/* 面额 */}
  517. <View style={styles.contentItemTopDetailSalePrice}>
  518. <Text style={styles.contentItemTopDetailSalePriceStr} >¥{contentItem.target.priceStr}</Text>
  519. </View>
  520. </View>
  521. </View>
  522. {/* <Image source={{uri:'data:image/png;base64,'+contentItem.qrcode}} resizeMode='contain' style={styles.contentItemTopQrcode} /> */}
  523. <Image source={{uri:contentItem.target.qrCode}} resizeMode='contain' style={styles.contentItemTopQrcode} />
  524. </View>
  525. {/* 优惠券底部商户名称 */}
  526. <View style={styles.contentItemBottom}>
  527. <Text style={styles.contentItemBottomMerchantName}>{merchantName}</Text>
  528. <Text style={styles.contentItemBottomPlacehold}>{contentItem.target.merchantVoList[0].buildingName}{contentItem.target.merchantVoList[0].floorName}</Text>
  529. <Text style={styles.contentItemBottomAction}>{actionText}</Text>
  530. </View>
  531. </ImageBackground>
  532. {this.getContentViewItemUplayer(contentItem)}
  533. </Animatable.View>
  534. )
  535. }
  536. getContentView() {
  537. if (this.state.contentDisplayStatus) {
  538. //aaa
  539. if (true) {
  540. return (<View style={styles.content}>
  541. {this.renderRankDom()}
  542. </View>)
  543. } else {
  544. return (<View style={styles.content}>
  545. {this.getContentViewItem(this.state.contentItem0,this.state.animationTheme.first)}
  546. {this.getContentViewItem(this.state.contentItem1,this.state.animationTheme.second)}
  547. {this.getContentViewItem(this.state.contentItem2,this.state.animationTheme.third)}
  548. </View>)
  549. }
  550. }else{
  551. return (
  552. <View style={styles.content}>
  553. <Text style={styles.updatePage}>{this.state.errorMessage}</Text>
  554. </View>)
  555. }
  556. }
  557. setAdSwiperItemDom(item) {
  558. let contentItem = item.item;
  559. return (
  560. <View style={styles.onlyAdSwiperItem}>
  561. <Image source={{uri: contentItem.coverImg}} resizeMode='stretch' style={styles.onlyAdTypeItemImg} />
  562. </View>
  563. )
  564. }
  565. setSwiperItemDom(item) {
  566. let contentItem = item.item;
  567. let index = item.index;
  568. let curLogo = null;
  569. if (contentItem.type == 0) {
  570. if (contentItem.subType == 2)
  571. curLogo = require('./image/timed.png');
  572. if (contentItem.subType == 6)
  573. curLogo = require('./image/discount.png');
  574. if (contentItem.subType == 7)
  575. curLogo = require('./image/groupbuy.png');
  576. }
  577. //
  578. // contentItem.target.salePriceStr = 24502228;
  579. let curNumStr = contentItem.target.salePriceStr+'';
  580. let curStyleObj = {};
  581. if (curNumStr.length > 6 || Number(curNumStr) > 100000) {
  582. curStyleObj = styles.contentItemTopDetailCurPriceStr04;
  583. } else {
  584. curStyleObj = styles.contentItemTopDetailCurPriceStr03;
  585. }
  586. return (
  587. <View style={styles.carouselItemWrap}>
  588. {/* <BoxShadow setting={shadowOpt}> */}
  589. <View setting={shadowOpt}>
  590. <View style={styles.contentItemTopForAd} key={index}>
  591. <Image source={curLogo} resizeMode='center' style={styles.contentItemUpLayerLogo} />
  592. {/* <ImageBackground style={styles.adTypeSwiper02} resizeMode="stretch" source={require('./image/item-background.png')}></ImageBackground> */}
  593. <Image source={{uri: contentItem.coverImg}} resizeMode='cover' style={styles.adTypeItemImg} />
  594. <View style={styles.contentItemTopDetail}>
  595. {/* 券的title */}
  596. <Text style={styles.contentItemTopDetailTitle02} numberOfLines={2} ellipsizeMode="tail">{contentItem.target.title}</Text>
  597. <View style={styles.contentItemTopDetailPrice}>
  598. {/* 售价 */}
  599. <View style={styles.contentItemTopDetailCurPrice}>
  600. <Text style={styles.contentItemTopDetailCurPriceStrUnit02}>¥</Text>
  601. <Text style={curStyleObj}>{contentItem.target.salePriceStr}</Text>
  602. </View>
  603. {/* 面额 */}
  604. <View style={styles.contentItemTopDetailSalePrice02}>
  605. <Text style={styles.contentItemTopDetailSalePriceStr02} >¥{contentItem.target.priceStr}</Text>
  606. </View>
  607. </View>
  608. </View>
  609. {/* <Image source={{uri:'data:image/png;base64,'+contentItem.qrcode}} resizeMode='contain' style={styles.contentItemTopQrcode} /> */}
  610. <View style={styles.contentItemTopQrcodeBox}>
  611. <Image source={{uri:contentItem.target.qrCode}} resizeMode='contain' style={styles.contentItemTopQrcode02} />
  612. </View>
  613. </View>
  614. </View>
  615. {/* </BoxShadow> */}
  616. </View>
  617. )
  618. }
  619. getUpdateView() {
  620. if (this.state.progress.totalBytes > 0)
  621. return (
  622. <Text style={styles.updatePage}>{this.state.syncMessage}{'\n'}
  623. {this.state.progress.receivedBytes} of {this.state.progress.totalBytes} bytes received{'\n'}
  624. </Text>
  625. );
  626. return (
  627. <Text style={styles.updatePage}>{this.state.syncMessage}
  628. </Text>
  629. );
  630. }
  631. rendDefaultImg() {
  632. if (this.state.coverImgUrl) {
  633. return (
  634. <ImageBackground style={styles.adTypeBg} resizeMode="stretch" source={{uri: this.state.coverImgUrl}}></ImageBackground>
  635. )
  636. } else {
  637. return (
  638. <ImageBackground style={styles.adTypeBg} resizeMode="stretch" source={require('./image/background.png')}></ImageBackground>
  639. )
  640. }
  641. }
  642. getAdView(){
  643. if (this.state.baseInfo) {
  644. if (this.state.adType == 0) {
  645. return (
  646. <ImageBackground style={styles.background} resizeMode='center' source={require('./image/background.png')}>
  647. {/* 头部title二维码开始 */}
  648. <View style={styles.title}>
  649. <View style={styles.titleImagePlace}>
  650. <Image source={require('./image/title.png')} resizeMode='center' style={styles.titleImage} />
  651. </View>
  652. <ImageBackground source={require('./image/title-qrcode.png') } resizeMode='center' style={styles.titleQrcodeBonder} >
  653. <View style={styles.titleQrcodePlacehold}></View>
  654. <Image source={{uri: this.state.baseInfo.imgQrcodeWeapp}} resizeMode='center' style={styles.titleQrcode} />
  655. <View style={styles.titleQrcodePlacehold}></View>
  656. </ImageBackground>
  657. </View>
  658. {/* 券列表展示列表开始 */}
  659. {this.getContentView()}
  660. {/* 底部商场信息展示开始 */}
  661. <View style={styles.bottom}>
  662. <View style={styles.bottomLogoBackground}>
  663. <Image source={{ uri: this.state.baseInfo.imgUrlH}} resizeMode='contain' style={styles.bottomLogo} />
  664. </View>
  665. <View style={styles.bottomQrcode1Background}>
  666. <Image source={{ uri: this.state.baseInfo.imgQrcodeWeapp}} resizeMode='center' style={styles.bottomQrcode1} />
  667. <Text style={styles.bottomQrcode1Str}>小程序</Text>
  668. </View>
  669. <View style={styles.bottomQrcode2Background}>
  670. <Image source={{ uri: this.state.baseInfo.imgQrcodeWemp}} resizeMode='center' style={styles.bottomQrcode2} />
  671. <Text style={styles.bottomQrcode1Str}>公众号</Text>
  672. </View>
  673. <Text style={styles.bottomPlacehold}>{this.state.versionInfo}</Text>
  674. </View>
  675. </ImageBackground>
  676. );
  677. } else if (this.state.adType == 2) {
  678. let curWidthNum = 1080/(PixelRatio.get());
  679. return (
  680. // <ImageBackground style={styles.adTypeBg} source={require('./image/ad1.jpg')}> slideInDown zoomInDown
  681. <View style={styles.adWrapBox}>
  682. <Image style={styles.adWrapHideImg}
  683. onLoadStart={() => {
  684. this.setState({
  685. curImgState: false
  686. })
  687. }}
  688. onLoad={() => {
  689. this.setState({
  690. coverImgUrl: this.state.previewImg,
  691. curImgState: true
  692. })
  693. }}
  694. resizeMode="stretch" source={{uri: this.state.previewImg}}>
  695. </Image>
  696. <Animatable.View animation="fadeIn" style={styles.adWrap} key={this.state.coverImgUrl}>
  697. {this.rendDefaultImg()}
  698. </Animatable.View>
  699. <View style={styles.adTypeSwiper02}>
  700. <Carousel
  701. style={styles.adTypeSwiper02Content}
  702. ref={'carousel02'}
  703. data={adDataList}
  704. renderItem={this.setSwiperItemDom}
  705. sliderWidth={curWidthNum}
  706. itemWidth={curWidthNum}
  707. layout={'stack'}
  708. activeSlideOffset={0}
  709. autoplay={true}
  710. loop={true}
  711. autoplayInterval={5000}
  712. />
  713. </View>
  714. </View>
  715. );
  716. } else if (this.state.adType == 1) {
  717. let curWidthNum = 1080/(PixelRatio.get())
  718. return(
  719. <Carousel
  720. ref={'carousel01'}
  721. data={adDataBgList}
  722. renderItem={this.setAdSwiperItemDom}
  723. sliderWidth={curWidthNum}
  724. itemWidth={curWidthNum}
  725. activeSlideOffset={0}
  726. autoplay={true}
  727. loop={true}
  728. autoplayInterval={5000}
  729. />
  730. )
  731. }
  732. }
  733. else {
  734. return (
  735. <ImageBackground style={styles.background} resizeMode='center' source={require('./image/background.png')}>
  736. {/* 头部title二维码开始 */}
  737. <View style={styles.title}>
  738. </View>
  739. {/* 券列表展示列表开始 */}
  740. {this.getContentView()}
  741. {/* 底部商场信息展示开始 */}
  742. <View style={styles.bottom}>
  743. <View style={styles.bottomLogoBackground}>
  744. </View>
  745. <View style={styles.bottomQrcode1Background}>
  746. </View>
  747. <View style={styles.bottomQrcode2Background}>
  748. </View>
  749. <Text style={styles.bottomPlacehold}>{this.state.versionInfo}</Text>
  750. </View>
  751. </ImageBackground>
  752. );
  753. }
  754. }
  755. render() {
  756. if (this.state.updating) {
  757. return this.getUpdateView();
  758. }
  759. return this.getAdView();
  760. }
  761. }
  762. MyPage = CodePush(codePushOptions)(MyPage);
  763. const styles = StyleSheet.create({
  764. updatePage:{
  765. flex: 2,
  766. width:'100%',
  767. height:'100%',
  768. backgroundColor:'transparent',
  769. textAlign :'center',
  770. textAlignVertical:'center',
  771. fontSize: 63/PixelRatio.get(),
  772. color: 'darkblue'
  773. },
  774. //layer background
  775. background:{
  776. flex: 1,
  777. width:'100%',
  778. height:'100%'
  779. },
  780. //layer top
  781. title:{
  782. flex: 6,
  783. flexDirection: 'row',
  784. alignItems: 'center',
  785. paddingLeft:42/PixelRatio.get(),
  786. paddingRight:42/PixelRatio.get(),
  787. backgroundColor:'transparent'
  788. },
  789. content:{
  790. flex: 18,
  791. flexDirection: 'column',
  792. alignItems: 'center',
  793. backgroundColor:'transparent'
  794. },
  795. bottom:{
  796. flex: 2,
  797. flexDirection: 'row',
  798. alignItems: 'center',
  799. paddingLeft:42/PixelRatio.get(),
  800. paddingRight:42/PixelRatio.get(),
  801. backgroundColor:'transparent'
  802. },
  803. //layer title
  804. titleImagePlace: {
  805. flex: 2,
  806. paddingTop: '20%',
  807. paddingLeft: '15%',
  808. alignItems: 'center',
  809. backgroundColor:'transparent'
  810. },
  811. titleImage: {
  812. width:'100%',
  813. height:'100%',
  814. flex: 1,
  815. backgroundColor:'transparent'
  816. },
  817. titleQrcodeBonder: {
  818. width:'100%',
  819. height:'100%',
  820. alignItems: 'center',
  821. flexDirection: 'column',
  822. flex: 1,
  823. backgroundColor:'transparent'
  824. },
  825. titleQrcodePlacehold: {
  826. flex: 5,
  827. backgroundColor:'transparent'
  828. },
  829. titleQrcode: {
  830. flex: 6,
  831. width:'100%',
  832. height:'100%',
  833. backgroundColor:'transparent'
  834. },
  835. //layer bottom
  836. bottomLogoBackground: {
  837. flex: 3,
  838. borderRadius:16/PixelRatio.get(),
  839. marginTop: 26/PixelRatio.get(),
  840. marginBottom: 26/PixelRatio.get(),
  841. backgroundColor:'transparent',//'rgba(255,255,255,0.5)',
  842. },
  843. bottomLogo: {
  844. width:'100%',
  845. height:'100%',
  846. backgroundColor:'transparent'
  847. },
  848. bottomQrcode1Background : {
  849. flex: 1,
  850. width:'100%',
  851. height:'100%',
  852. marginLeft: 21/PixelRatio.get(),
  853. paddingTop: 27/PixelRatio.get(),
  854. paddingBottom: 11/PixelRatio.get(),
  855. flexDirection: 'column',
  856. backgroundColor:'transparent'
  857. },
  858. bottomQrcode2Background : {
  859. flex: 1,
  860. width:'100%',
  861. height:'100%',
  862. marginLeft: 21/PixelRatio.get(),
  863. paddingTop: 26/PixelRatio.get(),
  864. paddingBottom: 11/PixelRatio.get(),
  865. flexDirection: 'column',
  866. backgroundColor:'transparent'
  867. },
  868. bottomQrcode1: {
  869. flex: 2,
  870. width:'100%',
  871. height:'100%',
  872. backgroundColor:'transparent'
  873. },
  874. bottomQrcode2: {
  875. flex: 2,
  876. width:'100%',
  877. height:'100%',
  878. backgroundColor:'transparent'
  879. },
  880. bottomQrcode1Str: {
  881. flex: 1,
  882. textAlign :'center',
  883. textAlignVertical:'center',
  884. fontSize: 16/PixelRatio.get(),
  885. color : 'white',
  886. backgroundColor:'transparent'
  887. },
  888. bottomQrcode2Str: {
  889. flex: 1,
  890. textAlign :'center',
  891. textAlignVertical:'center',
  892. fontSize: 16/PixelRatio.get(),
  893. color : 'white',
  894. backgroundColor:'transparent'
  895. },
  896. bottomPlacehold: {
  897. flex: 8,
  898. width:'100%',
  899. height:'100%',
  900. backgroundColor:'transparent',
  901. textAlign :'right',
  902. textAlignVertical:'bottom',
  903. fontSize: 27/PixelRatio.get(),
  904. color : 'gray'
  905. },
  906. //layer content item
  907. contentItem:{
  908. flex: 1,
  909. width:'100%',
  910. height:'100%',
  911. flexDirection: 'column',
  912. backgroundColor:'transparent'
  913. },
  914. contentItemDownLayer:{
  915. position:'absolute',
  916. width:'100%',
  917. height:'100%',
  918. flexDirection: 'column',
  919. alignItems: 'center',
  920. backgroundColor:'transparent'
  921. },
  922. contentItemUpLayer:{
  923. width:210/PixelRatio.get(),
  924. height:153/PixelRatio.get(),
  925. position:'absolute',
  926. backgroundColor:'transparent'
  927. },
  928. contentItemUpLayerLogo: {
  929. width:160/PixelRatio.get(),
  930. height:83/PixelRatio.get(),
  931. position: 'absolute',
  932. left: -20/PixelRatio.get(),
  933. top: 20/PixelRatio.get(),
  934. zIndex:100,
  935. backgroundColor: 'transparent',
  936. },
  937. contentItemTop:{
  938. flex: 3,
  939. width:'100%',
  940. height:'100%',
  941. paddingLeft: 66/PixelRatio.get(),
  942. paddingRight: 53/PixelRatio.get(),
  943. paddingTop: 40/PixelRatio.get(),
  944. flexDirection: 'row',
  945. alignItems: 'center',
  946. backgroundColor:'transparent'
  947. },
  948. contentItemBottom:{
  949. flex: 1,
  950. width:'100%',
  951. height:'100%',
  952. paddingLeft: 66/PixelRatio.get(),
  953. paddingRight: 53/PixelRatio.get(),
  954. paddingBottom: 40/PixelRatio.get(),
  955. flexDirection: 'row',
  956. alignItems: 'center',
  957. backgroundColor:'transparent'
  958. },
  959. //layer content item top
  960. contentItemTopCoverImg:{
  961. flex: 5,
  962. width:'100%',
  963. height:'100%',
  964. borderRadius:27/PixelRatio.get(),
  965. backgroundColor:'transparent'
  966. },
  967. contentItemTopDetail:{
  968. flex: 6,
  969. width:'100%',
  970. height:'100%',
  971. paddingLeft: 20/PixelRatio.get(),
  972. paddingRight: 20/PixelRatio.get(),
  973. alignItems: 'center',
  974. backgroundColor:'transparent'
  975. },
  976. contentItemTopQrcode:{
  977. flex: 5,
  978. width:'100%',
  979. height:'100%',
  980. marginLeft:18/PixelRatio.get(),
  981. // backgroundColor:'transparent'
  982. },
  983. contentItemTopQrcodeBox:{
  984. flex: 5,
  985. width:'100%',
  986. height:'100%',
  987. flexDirection: 'column',
  988. alignItems: 'center',
  989. justifyContent: 'center',
  990. marginLeft: -28/PixelRatio.get(),
  991. // backgroundColor:'transparent'
  992. },
  993. contentItemTopQrcode02:{
  994. width:'90%',
  995. height:'90%',
  996. },
  997. //layer content item bottom
  998. contentItemBottomMerchantName:{
  999. flex: 5,
  1000. width:'100%',
  1001. height:'100%',
  1002. alignItems: 'center',
  1003. color:"black",
  1004. backgroundColor:'transparent',
  1005. textAlign :'center',
  1006. textAlignVertical:'center',
  1007. fontSize: 27/PixelRatio.get(),
  1008. fontWeight : 'bold',
  1009. },
  1010. contentItemBottomPlacehold:{
  1011. flex: 6,
  1012. fontSize: 27/PixelRatio.get(),
  1013. paddingLeft: 27/PixelRatio.get(),
  1014. paddingRight: 79/PixelRatio.get(),
  1015. width:'100%',
  1016. height:'100%',
  1017. color:"black",
  1018. textAlignVertical:'center',
  1019. backgroundColor:'transparent',
  1020. },
  1021. contentItemBottomAction:{
  1022. flex: 5,
  1023. width:'100%',
  1024. height:'100%',
  1025. backgroundColor:'transparent',
  1026. textAlign :'center',
  1027. textAlignVertical:'center',
  1028. fontSize: 36/PixelRatio.get(),
  1029. color: 'black',
  1030. },
  1031. contentItemBottomAction02:{
  1032. width:'100%',
  1033. height: 60/PixelRatio.get(),
  1034. backgroundColor:'transparent',
  1035. textAlign :'center',
  1036. textAlignVertical:'center',
  1037. fontSize: 36/PixelRatio.get(),
  1038. color: 'black',
  1039. },
  1040. // 券的title
  1041. contentItemTopDetailTitle:{
  1042. flex: 2,
  1043. // height:'100%',
  1044. width:'100%',
  1045. marginTop:"2%",
  1046. backgroundColor:'transparent',
  1047. textAlign :'left',
  1048. color:"black",
  1049. textAlignVertical:'center',
  1050. fontSize: 53/PixelRatio.get(),
  1051. },
  1052. // 券的title
  1053. contentItemTopDetailTitle02:{
  1054. flex: 2,
  1055. // height:'100%',
  1056. width:'100%',
  1057. marginTop:"2%",
  1058. paddingRight: 14/PixelRatio.get(),
  1059. backgroundColor:'transparent',
  1060. textAlign :'left',
  1061. color:"black",
  1062. textAlignVertical:'center',
  1063. fontSize: 42/PixelRatio.get(),
  1064. },
  1065. /*
  1066. contentItemTopDetailRemark:{
  1067. flex: 1,
  1068. width:'100%',
  1069. height:'100%',
  1070. backgroundColor:'transparent',
  1071. textAlign :'left',
  1072. textAlignVertical:'center',
  1073. fontSize: 27/PixelRatio.get(),
  1074. color : 'gray'
  1075. },
  1076. */
  1077. contentItemTopDetailPrice:{
  1078. flex: 2,
  1079. width:'100%',
  1080. height:'100%',
  1081. backgroundColor:'transparent',
  1082. flexDirection: 'row',
  1083. },
  1084. // 售价的样式
  1085. contentItemTopDetailCurPrice:{
  1086. position:"absolute",
  1087. bottom:10,
  1088. left:0,
  1089. width:'100%',
  1090. height:'100%',
  1091. flexDirection: 'row',
  1092. backgroundColor:'transparent',
  1093. },
  1094. contentItemTopDetailCurPriceStr01:{
  1095. backgroundColor:'transparent',
  1096. fontSize:96/PixelRatio.get(),
  1097. fontFamily:"PingFangSC-Bold",
  1098. fontWeight: "bold",
  1099. textAlign :'left',
  1100. textAlignVertical:'bottom',
  1101. color : 'red'
  1102. },
  1103. //金额超10000,字号修改
  1104. contentItemTopDetailCurPriceStr02:{
  1105. backgroundColor:'transparent',
  1106. fontSize:64/PixelRatio.get(),
  1107. fontFamily:"PingFangSC-Bold",
  1108. fontWeight: "bold",
  1109. textAlign :'left',
  1110. textAlignVertical:'bottom',
  1111. paddingBottom: 8/PixelRatio.get(),
  1112. color : 'red'
  1113. },
  1114. contentItemTopDetailCurPriceStr03:{
  1115. backgroundColor:'transparent',
  1116. fontSize:72/PixelRatio.get(),
  1117. fontFamily:"PingFangSC-Bold",
  1118. fontWeight: "bold",
  1119. textAlign :'left',
  1120. color : 'red'
  1121. },
  1122. //金额超10000,字号修改
  1123. contentItemTopDetailCurPriceStr04:{
  1124. backgroundColor:'transparent',
  1125. fontSize:52/PixelRatio.get(),
  1126. fontFamily:"PingFangSC-Bold",
  1127. fontWeight: "bold",
  1128. textAlign :'left',
  1129. paddingTop: 16/PixelRatio.get(),
  1130. color : 'red'
  1131. },
  1132. contentItemTopDetailCurPriceStrUnit:{
  1133. backgroundColor:'transparent',
  1134. textAlign :'left',
  1135. textAlignVertical:'bottom',
  1136. paddingBottom: 16/PixelRatio.get(),
  1137. fontSize: 48/PixelRatio.get(),
  1138. color : 'red',
  1139. },
  1140. contentItemTopDetailCurPriceStrUnit02:{
  1141. backgroundColor:'transparent',
  1142. textAlign :'left',
  1143. textAlignVertical:'center',
  1144. paddingBottom: 16/PixelRatio.get(),
  1145. fontSize: 48/PixelRatio.get(),
  1146. color : 'red'
  1147. },
  1148. // 面额的样式
  1149. contentItemTopDetailSalePrice:{
  1150. position:"absolute",
  1151. bottom:2,
  1152. left:0,
  1153. // flex: 1,
  1154. paddingTop:138/PixelRatio.get(),
  1155. width:'100%',
  1156. // height:'100%',
  1157. backgroundColor:'transparent',
  1158. },
  1159. contentItemTopDetailSalePrice02:{
  1160. position:"absolute",
  1161. bottom:14/PixelRatio.get(),
  1162. left:0,
  1163. // flex: 1,
  1164. paddingTop:138/PixelRatio.get(),
  1165. width:'100%',
  1166. // height:'100%',
  1167. backgroundColor:'transparent',
  1168. },
  1169. contentItemTopDetailSalePriceStr:{
  1170. width:'100%',
  1171. height:'100%',
  1172. backgroundColor:'transparent',
  1173. textAlign :'left',
  1174. textAlignVertical:'bottom',
  1175. fontSize: 27/PixelRatio.get(),
  1176. textDecorationLine: 'line-through',
  1177. color : 'gray'
  1178. },
  1179. contentItemTopDetailSalePriceStr02:{
  1180. width:'100%',
  1181. height:'100%',
  1182. backgroundColor:'transparent',
  1183. textAlignVertical:'center',
  1184. textAlign :'left',
  1185. fontSize: 27/PixelRatio.get(),
  1186. textDecorationLine: 'line-through',
  1187. color : 'gray'
  1188. },
  1189. adTypeBg:{
  1190. flex: 1,
  1191. width: '100%',
  1192. height: '100%',
  1193. },
  1194. adWrapBox: {
  1195. width: '100%',
  1196. height: '100%',
  1197. position: 'relative',
  1198. },
  1199. adWrap: {
  1200. width: '100%',
  1201. height: '100%',
  1202. position: 'absolute',
  1203. left: 0,
  1204. top: 0,
  1205. zIndex: 10,
  1206. },
  1207. adWrapHideImg: {
  1208. width: '100%',
  1209. height: '100%',
  1210. position: 'absolute',
  1211. left: 0,
  1212. top: 0,
  1213. zIndex: -1,
  1214. opacity:0,
  1215. },
  1216. adTypeSwiper02:{
  1217. flex: 1,
  1218. alignItems: 'center',
  1219. position: 'absolute',
  1220. left: 0,
  1221. bottom: 60/PixelRatio.get(),
  1222. width: '100%',
  1223. height: 270/PixelRatio.get(),
  1224. paddingTop: 10/PixelRatio.get(),
  1225. paddingBottom: 10/PixelRatio.get(),
  1226. backgroundColor: 'rgba(0,0,0,.1)',
  1227. },
  1228. adTypeItemImgWrap:{
  1229. flex: 1,
  1230. width: '100%',
  1231. height: 369/PixelRatio.get(),
  1232. flexDirection: 'row',
  1233. alignItems: 'center',
  1234. },
  1235. adTypeItemImg:{
  1236. width: 200/PixelRatio.get(),
  1237. height: 200/PixelRatio.get(),
  1238. marginLeft: 8/PixelRatio.get(),
  1239. marginTop: 20/PixelRatio.get(),
  1240. borderRadius:27/PixelRatio.get(),
  1241. backgroundColor:'transparent'
  1242. },
  1243. bottomBox:{
  1244. position: 'absolute',
  1245. bottom: 20/PixelRatio.get(),
  1246. left: 0,
  1247. width: '100%',
  1248. height: 130/PixelRatio.get(),
  1249. flexDirection: 'row',
  1250. alignItems: 'center',
  1251. backgroundColor:'transparent',
  1252. },
  1253. contentItemTopForAd:{
  1254. position: 'relative',
  1255. flex: 1,
  1256. width: 800/PixelRatio.get(),
  1257. // width: '100%',
  1258. height:'100%',
  1259. paddingLeft: 12/PixelRatio.get(),
  1260. paddingRight: 26/PixelRatio.get(),
  1261. flexDirection: 'row',
  1262. alignItems: 'flex-start',
  1263. borderRadius: 6,
  1264. backgroundColor:'rgba(255,255,255,.8)',
  1265. },
  1266. onlyAdSwiperItem:{
  1267. width: '100%',
  1268. height: '100%',
  1269. },
  1270. onlyAdTypeItemImg:{
  1271. width: '100%',
  1272. height: '100%',
  1273. },
  1274. carouselItemWrap: {
  1275. flex: 1,
  1276. width: '100%',
  1277. backgroundColor: 'transparent',
  1278. alignItems: 'center',
  1279. },
  1280. //排名的列表样式
  1281. rankItemBox: {
  1282. position: 'relative',
  1283. flex: 1,
  1284. flexDirection: 'row',
  1285. alignItems: 'center',
  1286. width: '92%',
  1287. height: 260/PixelRatio.get(),
  1288. backgroundColor: '#fff',
  1289. borderRadius: 26/PixelRatio.get(),
  1290. marginTop: 20/PixelRatio.get(),
  1291. borderWidth: 1,
  1292. borderColor: 'green',
  1293. },
  1294. rankContent: {
  1295. marginLeft: 30/PixelRatio.get(),
  1296. },
  1297. rankItemBg: {
  1298. flex: 1,
  1299. flexDirection: 'row',
  1300. alignItems: 'center',
  1301. width: '100%',
  1302. height: 260/PixelRatio.get(),
  1303. borderWidth: 1,
  1304. borderColor: 'blue',
  1305. },
  1306. RankLogo: {
  1307. width: 220/PixelRatio.get(),
  1308. height: 220/PixelRatio.get(),
  1309. marginLeft: 30/PixelRatio.get(),
  1310. borderWidth: 1,
  1311. borderColor: 'yellow',
  1312. },
  1313. rankQrcodeImg: {
  1314. width: 220/PixelRatio.get(),
  1315. height: 220/PixelRatio.get(),
  1316. marginLeft: 10/PixelRatio.get(),
  1317. position: 'absolute',
  1318. top: 34/PixelRatio.get(),
  1319. right: 20/PixelRatio.get(),
  1320. },
  1321. starTitle: {
  1322. fontSize: 30/PixelRatio.get(),
  1323. },
  1324. merchantText: {
  1325. fontSize: 34/PixelRatio.get(),
  1326. fontWeight : 'bold',
  1327. marginBottom: 10/PixelRatio.get(),
  1328. marginTop: 6/PixelRatio.get(),
  1329. }
  1330. });