广告屏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.
 
 
 
 
 

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