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

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