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

1627 rivejä
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. })
  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 = 48/(PixelRatio.get());
  513. let curStyleObj = {
  514. width: fontSizeNum,
  515. height: fontSizeNum,
  516. }
  517. return (
  518. <Animatable.View animation={animation} style={styles.rankItemBox} key={index}>
  519. <Image style={styles.RankLogo} resizeMode="stretch" source={{uri:item.coverImg}}></Image>
  520. <View style={styles.rankContent}>
  521. <Text style={styles.merchantText} numberOfLines={1} ellipsizeMode="tail">{item.title}</Text>
  522. <View style={styles.rankRunBox}>
  523. <View style={styles.rankRun01}>
  524. <Text style={styles.starTitle}>经营指数: {item.extInfo.executionIndex} 分</Text>
  525. <View style={{height: fontSizeNum,flexDirection: 'row', alignItems: 'center',marginTop:18/PixelRatio.get()}}>
  526. <StarRatingBar
  527. score={item.extInfo.executionIndex}
  528. allowsHalfStars={true}
  529. accurateHalfStars={true}
  530. starStyle={curStyleObj}
  531. emptyStarImage={<Image style={curStyleObj} resizeMode="stretch" source={require('./image/star_gray.png')} />}
  532. filledStarImage={<Image style={curStyleObj} resizeMode="stretch" source={require('./image/star_red.png')} />}
  533. scoreTextStyle={{color:'transparent'}}
  534. />
  535. </View>
  536. </View>
  537. <View style={styles.rankRun02}>
  538. <Text style={styles.starTitle}>人气指数: {item.extInfo.populationIndex} 分</Text>
  539. <View style={{height: fontSizeNum,flexDirection: 'row', alignItems: 'center',marginTop:18/PixelRatio.get()}}>
  540. <StarRatingBar
  541. score={item.extInfo.populationIndex}
  542. allowsHalfStars={true}
  543. accurateHalfStars={true}
  544. starStyle={curStyleObj}
  545. emptyStarImage={<Image style={curStyleObj} resizeMode="stretch" source={require('./image/hot_gray.png')} />}
  546. filledStarImage={<Image style={curStyleObj} resizeMode="stretch" source={require('./image/hot_red.png')} />}
  547. scoreTextStyle={{color:'transparent'}}
  548. />
  549. </View>
  550. </View>
  551. </View>
  552. </View>
  553. <Image source={{uri:item.target.qrCode}} resizeMode="stretch" style={styles.rankQrcodeImg}></Image>
  554. </Animatable.View>
  555. )
  556. }
  557. //券列表content部分
  558. getContentViewItem(contentItem, annomation) {
  559. if (!contentItem)
  560. return (
  561. <View style={styles.contentItem}>
  562. </View>
  563. )
  564. actionText = this.getContentViewItemActionStr(contentItem);
  565. merchantName = this.getContentViewItemMerchantName(contentItem);
  566. //
  567. // contentItem.target.salePriceStr = 234005.8;
  568. // console.warn(annomation)
  569. let curNumStr = contentItem.target.salePriceStr+'';
  570. let curStyleObj = {};
  571. if (curNumStr.length > 5 || Number(curNumStr) > 10000) {
  572. curStyleObj = styles.contentItemTopDetailCurPriceStr02;
  573. } else {
  574. curStyleObj = styles.contentItemTopDetailCurPriceStr01;
  575. }
  576. return (
  577. <Animatable.View animation={annomation} style={styles.contentItem}>
  578. <ImageBackground source={require('./image/item-background.png')} resizeMode='center' style={styles.contentItemDownLayer} >
  579. {/* 列表 */}
  580. <View style={styles.contentItemTop}>
  581. <Image source={{uri: contentItem.coverImg}} resizeMode='cover' style={styles.contentItemTopCoverImg} />
  582. <View style={styles.contentItemTopDetail}>
  583. {/* 券的title */}
  584. <Text style={styles.contentItemTopDetailTitle} numberOfLines={2} ellipsizeMode="tail">{contentItem.target.title}</Text>
  585. <View style={styles.contentItemTopDetailPrice}>
  586. {/* 售价 */}
  587. <View style={styles.contentItemTopDetailCurPrice}>
  588. <Text style={styles.contentItemTopDetailCurPriceStrUnit}>¥</Text>
  589. <Text style={curStyleObj}>{contentItem.target.salePriceStr}</Text>
  590. {/* <Text style={styles.contentItemTopDetailCurPriceStr}>{contentItem.target.salePriceStr}</Text> */}
  591. </View>
  592. {/* 面额 */}
  593. <View style={styles.contentItemTopDetailSalePrice}>
  594. <Text style={styles.contentItemTopDetailSalePriceStr} >¥{contentItem.target.priceStr}</Text>
  595. </View>
  596. </View>
  597. </View>
  598. {/* <Image source={{uri:'data:image/png;base64,'+contentItem.qrcode}} resizeMode='contain' style={styles.contentItemTopQrcode} /> */}
  599. <Image source={{uri:contentItem.target.qrCode}} resizeMode='contain' style={styles.contentItemTopQrcode} />
  600. </View>
  601. {/* 优惠券底部商户名称 */}
  602. <View style={styles.contentItemBottom}>
  603. <Text style={styles.contentItemBottomMerchantName}>{merchantName}</Text>
  604. <Text style={styles.contentItemBottomPlacehold}>{contentItem.target.merchantVoList[0].buildingName}{contentItem.target.merchantVoList[0].floorName}</Text>
  605. <Text style={styles.contentItemBottomAction}>{actionText}</Text>
  606. </View>
  607. </ImageBackground>
  608. {this.getContentViewItemUplayer(contentItem)}
  609. </Animatable.View>
  610. )
  611. }
  612. getContentView() {
  613. if (this.state.contentDisplayStatus) {
  614. //aaa
  615. return (<View style={styles.content}>
  616. {this.getContentViewItem(this.state.contentItem0,this.state.animationTheme.first)}
  617. {this.getContentViewItem(this.state.contentItem1,this.state.animationTheme.second)}
  618. {this.getContentViewItem(this.state.contentItem2,this.state.animationTheme.third)}
  619. </View>)
  620. }else{
  621. return (
  622. <View style={styles.content}>
  623. <Text style={styles.updatePage}>{this.state.errorMessage}</Text>
  624. </View>)
  625. }
  626. }
  627. setAdSwiperItemDom(item) {
  628. let contentItem = item.item;
  629. if (this.state.hasRankList && contentItem.hasRank != undefined && contentItem.hasRank) {
  630. return (
  631. this.renderRankDom()
  632. )
  633. } else {
  634. return (
  635. <View style={styles.onlyAdSwiperItem}>
  636. <Image source={{uri: contentItem.coverImg}} resizeMode='stretch' style={styles.onlyAdTypeItemImg} />
  637. </View>
  638. )
  639. }
  640. }
  641. setSwiperItemDom(item) {
  642. let contentItem = item.item;
  643. let index = item.index;
  644. let curLogo = null;
  645. if (contentItem.type == 0) {
  646. if (contentItem.subType == 2)
  647. curLogo = require('./image/timed.png');
  648. if (contentItem.subType == 6)
  649. curLogo = require('./image/discount.png');
  650. if (contentItem.subType == 7)
  651. curLogo = require('./image/groupbuy.png');
  652. }
  653. //
  654. // contentItem.target.salePriceStr = 24502228;
  655. let curNumStr = contentItem.target.salePriceStr+'';
  656. let curStyleObj = {};
  657. if (curNumStr.length > 6 || Number(curNumStr) > 100000) {
  658. curStyleObj = styles.contentItemTopDetailCurPriceStr04;
  659. } else {
  660. curStyleObj = styles.contentItemTopDetailCurPriceStr03;
  661. }
  662. return (
  663. <View style={styles.carouselItemWrap}>
  664. {/* <BoxShadow setting={shadowOpt}> */}
  665. <View>
  666. <View style={styles.contentItemTopForAd} key={index}>
  667. <Image source={curLogo} resizeMode='center' style={styles.contentItemUpLayerLogo} />
  668. {/* <ImageBackground style={styles.adTypeSwiper02} resizeMode="stretch" source={require('./image/item-background.png')}></ImageBackground> */}
  669. <Image source={{uri: contentItem.coverImg}} resizeMode='cover' style={styles.adTypeItemImg} />
  670. <View style={styles.contentItemTopDetail}>
  671. {/* 券的title */}
  672. <Text style={styles.contentItemTopDetailTitle02} numberOfLines={2} ellipsizeMode="tail">{contentItem.target.title}</Text>
  673. <View style={styles.contentItemTopDetailPrice}>
  674. {/* 售价 */}
  675. <View style={styles.contentItemTopDetailCurPrice}>
  676. <Text style={styles.contentItemTopDetailCurPriceStrUnit02}>¥</Text>
  677. <Text style={curStyleObj}>{contentItem.target.salePriceStr}</Text>
  678. </View>
  679. {/* 面额 */}
  680. <View style={styles.contentItemTopDetailSalePrice02}>
  681. <Text style={styles.contentItemTopDetailSalePriceStr02} >¥{contentItem.target.priceStr}</Text>
  682. </View>
  683. </View>
  684. </View>
  685. {/* <Image source={{uri:'data:image/png;base64,'+contentItem.qrcode}} resizeMode='contain' style={styles.contentItemTopQrcode} /> */}
  686. <View style={styles.contentItemTopQrcodeBox}>
  687. <Image source={{uri:contentItem.target.qrCode}} resizeMode='contain' style={styles.contentItemTopQrcode02} />
  688. </View>
  689. </View>
  690. </View>
  691. {/* </BoxShadow> */}
  692. </View>
  693. )
  694. }
  695. getUpdateView() {
  696. if (this.state.progress.totalBytes > 0)
  697. return (
  698. <Text style={styles.updatePage}>{this.state.syncMessage}{'\n'}
  699. {this.state.progress.receivedBytes} of {this.state.progress.totalBytes} bytes received{'\n'}
  700. </Text>
  701. );
  702. return (
  703. <Text style={styles.updatePage}>{this.state.syncMessage}
  704. </Text>
  705. );
  706. }
  707. rendDefaultImg() {
  708. if (this.state.coverImgUrl) {
  709. return (
  710. <ImageBackground style={styles.adTypeBg} resizeMode="stretch" source={{uri: this.state.coverImgUrl}}></ImageBackground>
  711. )
  712. } else {
  713. return (
  714. <ImageBackground style={styles.adTypeBg} resizeMode="stretch" source={require('./image/background.png')}></ImageBackground>
  715. )
  716. }
  717. }
  718. renderTicketDom() {
  719. return (
  720. <ImageBackground style={styles.background} resizeMode='center' source={require('./image/background.png')}>
  721. {/* 头部title二维码开始 */}
  722. <View style={styles.title}>
  723. <View style={styles.titleImagePlace}>
  724. <Image source={require('./image/title.png')} resizeMode='center' style={styles.titleImage} />
  725. </View>
  726. <ImageBackground source={require('./image/title-qrcode.png') } resizeMode='center' style={styles.titleQrcodeBonder} >
  727. <View style={styles.titleQrcodePlacehold}></View>
  728. <Image source={{uri: this.state.baseInfo.imgQrcodeWeapp}} resizeMode='center' style={styles.titleQrcode} />
  729. <View style={styles.titleQrcodePlacehold}></View>
  730. </ImageBackground>
  731. </View>
  732. {/* 券列表展示列表开始 */}
  733. {this.getContentView()}
  734. {/* 底部商场信息展示开始 */}
  735. <View style={styles.bottom}>
  736. <View style={styles.bottomLogoBackground}>
  737. <Image source={{ uri: this.state.baseInfo.imgUrlH}} resizeMode='contain' style={styles.bottomLogo} />
  738. </View>
  739. <View style={styles.bottomQrcode1Background}>
  740. <Image source={{ uri: this.state.baseInfo.imgQrcodeWeapp}} resizeMode='center' style={styles.bottomQrcode1} />
  741. <Text style={styles.bottomQrcode1Str}>小程序</Text>
  742. </View>
  743. <View style={styles.bottomQrcode2Background}>
  744. <Image source={{ uri: this.state.baseInfo.imgQrcodeWemp}} resizeMode='center' style={styles.bottomQrcode2} />
  745. <Text style={styles.bottomQrcode1Str}>公众号</Text>
  746. </View>
  747. <Text style={styles.bottomPlacehold}>{this.state.versionInfo}</Text>
  748. </View>
  749. </ImageBackground>
  750. );
  751. }
  752. //rank page aaa
  753. renderRankDom() {
  754. return (
  755. <ImageBackground style={styles.background} resizeMode='center' source={require('./image/background-yellow.png')}>
  756. {/* 头部title二维码开始 */}
  757. <View style={styles.title}>
  758. <View style={styles.titleImagePlace}>
  759. <Image source={require('./image/title.png')} resizeMode='center' style={styles.titleImage} />
  760. </View>
  761. <ImageBackground source={require('./image/title-qrcode.png') } resizeMode='center' style={styles.titleQrcodeBonder} >
  762. <View style={styles.titleQrcodePlacehold}></View>
  763. <Image source={{uri: this.state.baseInfo.imgQrcodeWeapp}} resizeMode='center' style={styles.titleQrcode} />
  764. <View style={styles.titleQrcodePlacehold}></View>
  765. </ImageBackground>
  766. </View>
  767. {/* 券列表展示列表开始 */}
  768. <View style={styles.content}>
  769. {this.rankDom()}
  770. </View>
  771. {/* 底部商场信息展示开始 */}
  772. <View style={styles.bottom}>
  773. <View style={styles.bottomLogoBackground}>
  774. <Image source={{ uri: this.state.baseInfo.imgUrlH}} resizeMode='contain' style={styles.bottomLogo} />
  775. </View>
  776. <View style={styles.bottomQrcode1Background}>
  777. <Image source={{ uri: this.state.baseInfo.imgQrcodeWeapp}} resizeMode='center' style={styles.bottomQrcode1} />
  778. <Text style={styles.bottomQrcode1Str}>小程序</Text>
  779. </View>
  780. <View style={styles.bottomQrcode2Background}>
  781. <Image source={{ uri: this.state.baseInfo.imgQrcodeWemp}} resizeMode='center' style={styles.bottomQrcode2} />
  782. <Text style={styles.bottomQrcode1Str}>公众号</Text>
  783. </View>
  784. <Text style={styles.bottomPlacehold}>{this.state.versionInfo}</Text>
  785. </View>
  786. </ImageBackground>
  787. );
  788. }
  789. renderAdDom() {
  790. let curWidthNum = 1080/(PixelRatio.get());
  791. return (
  792. // <ImageBackground style={styles.adTypeBg} source={require('./image/ad1.jpg')}> slideInDown zoomInDown
  793. <View style={styles.adWrapBox}>
  794. <Image style={styles.adWrapHideImg}
  795. onLoadStart={() => {
  796. this.setState({
  797. curImgState: false
  798. })
  799. }}
  800. onLoad={() => {
  801. this.setState({
  802. coverImgUrl: this.state.previewImg,
  803. curImgState: true
  804. })
  805. }}
  806. resizeMode="stretch" source={{uri: this.state.previewImg}}>
  807. </Image>
  808. <Animatable.View animation="fadeIn" style={styles.adWrap} key={this.state.coverImgUrl}>
  809. {this.rendDefaultImg()}
  810. </Animatable.View>
  811. <View style={styles.adTypeSwiper02}>
  812. <Carousel
  813. style={styles.adTypeSwiper02Content}
  814. ref={'carousel02'}
  815. data={adDataList}
  816. renderItem={this.setSwiperItemDom}
  817. sliderWidth={curWidthNum}
  818. itemWidth={curWidthNum}
  819. layout={'stack'}
  820. activeSlideOffset={0}
  821. autoplay={true}
  822. loop={true}
  823. autoplayInterval={5000}
  824. />
  825. </View>
  826. </View>
  827. );
  828. }
  829. getAdView(){
  830. if (this.state.baseInfo) {
  831. if (this.state.adType == 0) {
  832. console.log(this.state.hasRankList)
  833. console.log(this.state.openRankList)
  834. if (this.state.hasRankList && this.state.openRankList) {
  835. console.log(111)
  836. return (
  837. this.renderRankDom()
  838. )
  839. } else {
  840. console.log(222)
  841. return (
  842. this.renderTicketDom()
  843. )
  844. }
  845. } else if (this.state.adType == 2) {
  846. if (this.state.hasRankList && this.state.openRankList) {
  847. console.log(333)
  848. return (
  849. this.renderRankDom()
  850. )
  851. } else {
  852. console.log(444)
  853. return (
  854. this.renderAdDom()
  855. )
  856. }
  857. } else if (this.state.adType == 1) {
  858. let curWidthNum = 1080/(PixelRatio.get())
  859. return(
  860. <Carousel
  861. ref={'carousel01'}
  862. data={adDataBgList}
  863. renderItem={this.setAdSwiperItemDom}
  864. sliderWidth={curWidthNum}
  865. itemWidth={curWidthNum}
  866. activeSlideOffset={0}
  867. autoplay={true}
  868. loop={true}
  869. autoplayInterval={5000}
  870. />
  871. )
  872. }
  873. }
  874. else {
  875. return (
  876. <ImageBackground style={styles.background} resizeMode='center' source={require('./image/background.png')}>
  877. {/* 头部title二维码开始 */}
  878. <View style={styles.title}>
  879. </View>
  880. {/* 券列表展示列表开始 */}
  881. {this.getContentView()}
  882. {/* 底部商场信息展示开始 */}
  883. <View style={styles.bottom}>
  884. <View style={styles.bottomLogoBackground}>
  885. </View>
  886. <View style={styles.bottomQrcode1Background}>
  887. </View>
  888. <View style={styles.bottomQrcode2Background}>
  889. </View>
  890. <Text style={styles.bottomPlacehold}>{this.state.versionInfo}</Text>
  891. </View>
  892. </ImageBackground>
  893. );
  894. }
  895. }
  896. render() {
  897. if (this.state.updating) {
  898. return this.getUpdateView();
  899. }
  900. return this.getAdView();
  901. }
  902. }
  903. MyPage = CodePush(codePushOptions)(MyPage);
  904. const styles = StyleSheet.create({
  905. updatePage:{
  906. flex: 2,
  907. width:'100%',
  908. height:'100%',
  909. backgroundColor:'transparent',
  910. textAlign :'center',
  911. textAlignVertical:'center',
  912. fontSize: 63/PixelRatio.get(),
  913. color: 'darkblue'
  914. },
  915. //layer background
  916. background:{
  917. flex: 1,
  918. width:'100%',
  919. height:'100%'
  920. },
  921. //layer top
  922. title:{
  923. flex: 6,
  924. flexDirection: 'row',
  925. alignItems: 'center',
  926. paddingLeft:42/PixelRatio.get(),
  927. paddingRight:42/PixelRatio.get(),
  928. backgroundColor:'transparent'
  929. },
  930. content:{
  931. flex: 18,
  932. flexDirection: 'column',
  933. alignItems: 'center',
  934. backgroundColor:'transparent'
  935. },
  936. bottom:{
  937. flex: 2,
  938. flexDirection: 'row',
  939. alignItems: 'center',
  940. paddingLeft:42/PixelRatio.get(),
  941. paddingRight:42/PixelRatio.get(),
  942. backgroundColor:'transparent'
  943. },
  944. //layer title
  945. titleImagePlace: {
  946. flex: 2,
  947. paddingTop: '20%',
  948. paddingLeft: '15%',
  949. alignItems: 'center',
  950. backgroundColor:'transparent'
  951. },
  952. titleImage: {
  953. width:'100%',
  954. height:'100%',
  955. flex: 1,
  956. backgroundColor:'transparent'
  957. },
  958. titleQrcodeBonder: {
  959. width:'100%',
  960. height:'100%',
  961. alignItems: 'center',
  962. flexDirection: 'column',
  963. flex: 1,
  964. backgroundColor:'transparent'
  965. },
  966. titleQrcodePlacehold: {
  967. flex: 5,
  968. backgroundColor:'transparent'
  969. },
  970. titleQrcode: {
  971. flex: 6,
  972. width:'100%',
  973. height:'100%',
  974. backgroundColor:'transparent'
  975. },
  976. //layer bottom
  977. bottomLogoBackground: {
  978. flex: 3,
  979. borderRadius:16/PixelRatio.get(),
  980. marginTop: 26/PixelRatio.get(),
  981. marginBottom: 26/PixelRatio.get(),
  982. backgroundColor:'transparent',//'rgba(255,255,255,0.5)',
  983. },
  984. bottomLogo: {
  985. width:'100%',
  986. height:'100%',
  987. backgroundColor:'transparent'
  988. },
  989. bottomQrcode1Background : {
  990. flex: 1,
  991. width:'100%',
  992. height:'100%',
  993. marginLeft: 21/PixelRatio.get(),
  994. paddingTop: 27/PixelRatio.get(),
  995. paddingBottom: 11/PixelRatio.get(),
  996. flexDirection: 'column',
  997. backgroundColor:'transparent'
  998. },
  999. bottomQrcode2Background : {
  1000. flex: 1,
  1001. width:'100%',
  1002. height:'100%',
  1003. marginLeft: 21/PixelRatio.get(),
  1004. paddingTop: 26/PixelRatio.get(),
  1005. paddingBottom: 11/PixelRatio.get(),
  1006. flexDirection: 'column',
  1007. backgroundColor:'transparent'
  1008. },
  1009. bottomQrcode1: {
  1010. flex: 2,
  1011. width:'100%',
  1012. height:'100%',
  1013. backgroundColor:'transparent'
  1014. },
  1015. bottomQrcode2: {
  1016. flex: 2,
  1017. width:'100%',
  1018. height:'100%',
  1019. backgroundColor:'transparent'
  1020. },
  1021. bottomQrcode1Str: {
  1022. flex: 1,
  1023. textAlign :'center',
  1024. textAlignVertical:'center',
  1025. fontSize: 16/PixelRatio.get(),
  1026. color : 'white',
  1027. backgroundColor:'transparent'
  1028. },
  1029. bottomQrcode2Str: {
  1030. flex: 1,
  1031. textAlign :'center',
  1032. textAlignVertical:'center',
  1033. fontSize: 16/PixelRatio.get(),
  1034. color : 'white',
  1035. backgroundColor:'transparent'
  1036. },
  1037. bottomPlacehold: {
  1038. flex: 8,
  1039. width:'100%',
  1040. height:'100%',
  1041. backgroundColor:'transparent',
  1042. textAlign :'right',
  1043. textAlignVertical:'bottom',
  1044. fontSize: 27/PixelRatio.get(),
  1045. color : 'gray'
  1046. },
  1047. //layer content item
  1048. contentItem:{
  1049. flex: 1,
  1050. width:'100%',
  1051. height:'100%',
  1052. flexDirection: 'column',
  1053. backgroundColor:'transparent'
  1054. },
  1055. contentItemDownLayer:{
  1056. position:'absolute',
  1057. width:'100%',
  1058. height:'100%',
  1059. flexDirection: 'column',
  1060. alignItems: 'center',
  1061. backgroundColor:'transparent'
  1062. },
  1063. contentItemUpLayer:{
  1064. width:210/PixelRatio.get(),
  1065. height:153/PixelRatio.get(),
  1066. position:'absolute',
  1067. backgroundColor:'transparent'
  1068. },
  1069. contentItemUpLayerLogo: {
  1070. width:160/PixelRatio.get(),
  1071. height:83/PixelRatio.get(),
  1072. position: 'absolute',
  1073. left: -20/PixelRatio.get(),
  1074. top: 20/PixelRatio.get(),
  1075. zIndex:100,
  1076. backgroundColor: 'transparent',
  1077. },
  1078. contentItemTop:{
  1079. flex: 3,
  1080. width:'100%',
  1081. height:'100%',
  1082. paddingLeft: 66/PixelRatio.get(),
  1083. paddingRight: 53/PixelRatio.get(),
  1084. paddingTop: 40/PixelRatio.get(),
  1085. flexDirection: 'row',
  1086. alignItems: 'center',
  1087. backgroundColor:'transparent'
  1088. },
  1089. contentItemBottom:{
  1090. flex: 1,
  1091. width:'100%',
  1092. height:'100%',
  1093. paddingLeft: 66/PixelRatio.get(),
  1094. paddingRight: 53/PixelRatio.get(),
  1095. paddingBottom: 40/PixelRatio.get(),
  1096. flexDirection: 'row',
  1097. alignItems: 'center',
  1098. backgroundColor:'transparent'
  1099. },
  1100. //layer content item top
  1101. contentItemTopCoverImg:{
  1102. flex: 5,
  1103. width:'100%',
  1104. height:'100%',
  1105. borderRadius:27/PixelRatio.get(),
  1106. backgroundColor:'transparent'
  1107. },
  1108. contentItemTopDetail:{
  1109. flex: 6,
  1110. width:'100%',
  1111. height:'100%',
  1112. paddingLeft: 20/PixelRatio.get(),
  1113. paddingRight: 20/PixelRatio.get(),
  1114. alignItems: 'center',
  1115. backgroundColor:'transparent'
  1116. },
  1117. contentItemTopQrcode:{
  1118. flex: 5,
  1119. width:'100%',
  1120. height:'100%',
  1121. marginLeft:18/PixelRatio.get(),
  1122. // backgroundColor:'transparent'
  1123. },
  1124. contentItemTopQrcodeBox:{
  1125. flex: 5,
  1126. width:'100%',
  1127. height:'100%',
  1128. flexDirection: 'column',
  1129. alignItems: 'center',
  1130. justifyContent: 'center',
  1131. marginLeft: -28/PixelRatio.get(),
  1132. // backgroundColor:'transparent'
  1133. },
  1134. contentItemTopQrcode02:{
  1135. width:'90%',
  1136. height:'90%',
  1137. },
  1138. //layer content item bottom
  1139. contentItemBottomMerchantName:{
  1140. flex: 5,
  1141. width:'100%',
  1142. height:'100%',
  1143. alignItems: 'center',
  1144. color:"black",
  1145. backgroundColor:'transparent',
  1146. textAlign :'center',
  1147. textAlignVertical:'center',
  1148. fontSize: 27/PixelRatio.get(),
  1149. fontWeight : 'bold',
  1150. },
  1151. contentItemBottomPlacehold:{
  1152. flex: 6,
  1153. fontSize: 27/PixelRatio.get(),
  1154. paddingLeft: 27/PixelRatio.get(),
  1155. paddingRight: 79/PixelRatio.get(),
  1156. width:'100%',
  1157. height:'100%',
  1158. color:"black",
  1159. textAlignVertical:'center',
  1160. backgroundColor:'transparent',
  1161. },
  1162. contentItemBottomAction:{
  1163. flex: 5,
  1164. width:'100%',
  1165. height:'100%',
  1166. backgroundColor:'transparent',
  1167. textAlign :'center',
  1168. textAlignVertical:'center',
  1169. fontSize: 36/PixelRatio.get(),
  1170. color: 'black',
  1171. },
  1172. contentItemBottomAction02:{
  1173. width:'100%',
  1174. height: 60/PixelRatio.get(),
  1175. backgroundColor:'transparent',
  1176. textAlign :'center',
  1177. textAlignVertical:'center',
  1178. fontSize: 36/PixelRatio.get(),
  1179. color: 'black',
  1180. },
  1181. // 券的title
  1182. contentItemTopDetailTitle:{
  1183. flex: 2,
  1184. // height:'100%',
  1185. width:'100%',
  1186. marginTop:"2%",
  1187. backgroundColor:'transparent',
  1188. textAlign :'left',
  1189. color:"black",
  1190. textAlignVertical:'center',
  1191. fontSize: 53/PixelRatio.get(),
  1192. },
  1193. // 券的title
  1194. contentItemTopDetailTitle02:{
  1195. flex: 2,
  1196. // height:'100%',
  1197. width:'100%',
  1198. marginTop:"2%",
  1199. paddingRight: 14/PixelRatio.get(),
  1200. backgroundColor:'transparent',
  1201. textAlign :'left',
  1202. color:"black",
  1203. textAlignVertical:'center',
  1204. fontSize: 42/PixelRatio.get(),
  1205. },
  1206. /*
  1207. contentItemTopDetailRemark:{
  1208. flex: 1,
  1209. width:'100%',
  1210. height:'100%',
  1211. backgroundColor:'transparent',
  1212. textAlign :'left',
  1213. textAlignVertical:'center',
  1214. fontSize: 27/PixelRatio.get(),
  1215. color : 'gray'
  1216. },
  1217. */
  1218. contentItemTopDetailPrice:{
  1219. flex: 2,
  1220. width:'100%',
  1221. height:'100%',
  1222. backgroundColor:'transparent',
  1223. flexDirection: 'row',
  1224. },
  1225. // 售价的样式
  1226. contentItemTopDetailCurPrice:{
  1227. position:"absolute",
  1228. bottom:10,
  1229. left:0,
  1230. width:'100%',
  1231. height:'100%',
  1232. flexDirection: 'row',
  1233. backgroundColor:'transparent',
  1234. },
  1235. contentItemTopDetailCurPriceStr01:{
  1236. backgroundColor:'transparent',
  1237. fontSize:96/PixelRatio.get(),
  1238. fontFamily:"PingFangSC-Bold",
  1239. fontWeight: "bold",
  1240. textAlign :'left',
  1241. textAlignVertical:'bottom',
  1242. color : 'red'
  1243. },
  1244. //金额超10000,字号修改
  1245. contentItemTopDetailCurPriceStr02:{
  1246. backgroundColor:'transparent',
  1247. fontSize:64/PixelRatio.get(),
  1248. fontFamily:"PingFangSC-Bold",
  1249. fontWeight: "bold",
  1250. textAlign :'left',
  1251. textAlignVertical:'bottom',
  1252. paddingBottom: 8/PixelRatio.get(),
  1253. color : 'red'
  1254. },
  1255. contentItemTopDetailCurPriceStr03:{
  1256. backgroundColor:'transparent',
  1257. fontSize:72/PixelRatio.get(),
  1258. fontFamily:"PingFangSC-Bold",
  1259. fontWeight: "bold",
  1260. textAlign :'left',
  1261. color : 'red'
  1262. },
  1263. //金额超10000,字号修改
  1264. contentItemTopDetailCurPriceStr04:{
  1265. backgroundColor:'transparent',
  1266. fontSize:52/PixelRatio.get(),
  1267. fontFamily:"PingFangSC-Bold",
  1268. fontWeight: "bold",
  1269. textAlign :'left',
  1270. paddingTop: 16/PixelRatio.get(),
  1271. color : 'red'
  1272. },
  1273. contentItemTopDetailCurPriceStrUnit:{
  1274. backgroundColor:'transparent',
  1275. textAlign :'left',
  1276. textAlignVertical:'bottom',
  1277. paddingBottom: 16/PixelRatio.get(),
  1278. fontSize: 48/PixelRatio.get(),
  1279. color : 'red',
  1280. },
  1281. contentItemTopDetailCurPriceStrUnit02:{
  1282. backgroundColor:'transparent',
  1283. textAlign :'left',
  1284. textAlignVertical:'center',
  1285. paddingBottom: 16/PixelRatio.get(),
  1286. fontSize: 48/PixelRatio.get(),
  1287. color : 'red'
  1288. },
  1289. // 面额的样式
  1290. contentItemTopDetailSalePrice:{
  1291. position:"absolute",
  1292. bottom:2,
  1293. left:0,
  1294. // flex: 1,
  1295. paddingTop:138/PixelRatio.get(),
  1296. width:'100%',
  1297. // height:'100%',
  1298. backgroundColor:'transparent',
  1299. },
  1300. contentItemTopDetailSalePrice02:{
  1301. position:"absolute",
  1302. bottom:14/PixelRatio.get(),
  1303. left:0,
  1304. // flex: 1,
  1305. paddingTop:138/PixelRatio.get(),
  1306. width:'100%',
  1307. // height:'100%',
  1308. backgroundColor:'transparent',
  1309. },
  1310. contentItemTopDetailSalePriceStr:{
  1311. width:'100%',
  1312. height:'100%',
  1313. backgroundColor:'transparent',
  1314. textAlign :'left',
  1315. textAlignVertical:'bottom',
  1316. fontSize: 27/PixelRatio.get(),
  1317. textDecorationLine: 'line-through',
  1318. color : 'gray'
  1319. },
  1320. contentItemTopDetailSalePriceStr02:{
  1321. width:'100%',
  1322. height:'100%',
  1323. backgroundColor:'transparent',
  1324. textAlignVertical:'center',
  1325. textAlign :'left',
  1326. fontSize: 27/PixelRatio.get(),
  1327. textDecorationLine: 'line-through',
  1328. color : 'gray'
  1329. },
  1330. adTypeBg:{
  1331. flex: 1,
  1332. width: '100%',
  1333. height: '100%',
  1334. },
  1335. adWrapBox: {
  1336. width: '100%',
  1337. height: '100%',
  1338. position: 'relative',
  1339. },
  1340. adWrap: {
  1341. width: '100%',
  1342. height: '100%',
  1343. position: 'absolute',
  1344. left: 0,
  1345. top: 0,
  1346. zIndex: 10,
  1347. },
  1348. adWrapHideImg: {
  1349. width: '100%',
  1350. height: '100%',
  1351. position: 'absolute',
  1352. left: 0,
  1353. top: 0,
  1354. zIndex: -1,
  1355. opacity:0,
  1356. },
  1357. adTypeSwiper02:{
  1358. flex: 1,
  1359. alignItems: 'center',
  1360. position: 'absolute',
  1361. left: 0,
  1362. bottom: 60/PixelRatio.get(),
  1363. width: '100%',
  1364. height: 270/PixelRatio.get(),
  1365. paddingTop: 10/PixelRatio.get(),
  1366. paddingBottom: 10/PixelRatio.get(),
  1367. backgroundColor: 'rgba(0,0,0,.1)',
  1368. },
  1369. adTypeItemImgWrap:{
  1370. flex: 1,
  1371. width: '100%',
  1372. height: 369/PixelRatio.get(),
  1373. flexDirection: 'row',
  1374. alignItems: 'center',
  1375. },
  1376. adTypeItemImg:{
  1377. width: 200/PixelRatio.get(),
  1378. height: 200/PixelRatio.get(),
  1379. marginLeft: 8/PixelRatio.get(),
  1380. marginTop: 20/PixelRatio.get(),
  1381. borderRadius:27/PixelRatio.get(),
  1382. backgroundColor:'transparent'
  1383. },
  1384. bottomBox:{
  1385. position: 'absolute',
  1386. bottom: 20/PixelRatio.get(),
  1387. left: 0,
  1388. width: '100%',
  1389. height: 130/PixelRatio.get(),
  1390. flexDirection: 'row',
  1391. alignItems: 'center',
  1392. backgroundColor:'transparent',
  1393. },
  1394. contentItemTopForAd:{
  1395. position: 'relative',
  1396. flex: 1,
  1397. width: 800/PixelRatio.get(),
  1398. // width: '100%',
  1399. height:'100%',
  1400. paddingLeft: 12/PixelRatio.get(),
  1401. paddingRight: 26/PixelRatio.get(),
  1402. flexDirection: 'row',
  1403. alignItems: 'flex-start',
  1404. borderRadius: 6,
  1405. backgroundColor:'rgba(255,255,255,.8)',
  1406. },
  1407. onlyAdSwiperItem:{
  1408. width: '100%',
  1409. height: '100%',
  1410. },
  1411. onlyAdTypeItemImg:{
  1412. width: '100%',
  1413. height: '100%',
  1414. },
  1415. carouselItemWrap: {
  1416. flex: 1,
  1417. width: '100%',
  1418. backgroundColor: 'transparent',
  1419. alignItems: 'center',
  1420. },
  1421. //排名的列表样式
  1422. rankItemBox: {
  1423. flex: 1,
  1424. flexDirection: 'row',
  1425. alignItems: 'center',
  1426. width: '92%',
  1427. height: 250/PixelRatio.get(),
  1428. backgroundColor: '#fff',
  1429. borderRadius: 18/PixelRatio.get(),
  1430. marginTop: 30/PixelRatio.get(),
  1431. },
  1432. rankContent: {
  1433. flex: 1,
  1434. flexDirection: 'column',
  1435. marginLeft: 22/PixelRatio.get(),
  1436. },
  1437. rankItemBg: {
  1438. flex: 1,
  1439. flexDirection: 'row',
  1440. alignItems: 'center',
  1441. width: '100%',
  1442. height: 250/PixelRatio.get(),
  1443. },
  1444. RankLogo: {
  1445. width: 200/PixelRatio.get(),
  1446. height: 200/PixelRatio.get(),
  1447. marginLeft: 20/PixelRatio.get(),
  1448. },
  1449. rankQrcodeImg: {
  1450. width: 200/PixelRatio.get(),
  1451. height: 200/PixelRatio.get(),
  1452. marginLeft: 8/PixelRatio.get(),
  1453. },
  1454. starTitle: {
  1455. fontSize: 32/PixelRatio.get(),
  1456. },
  1457. rankRun01: {
  1458. marginTop: 12/PixelRatio.get(),
  1459. },
  1460. rankRun02: {
  1461. marginTop: 12/PixelRatio.get(),
  1462. marginLeft: -18/PixelRatio.get(),
  1463. },
  1464. merchantText: {
  1465. fontSize: 40/PixelRatio.get(),
  1466. fontWeight : 'bold',
  1467. marginBottom: 10/PixelRatio.get(),
  1468. marginTop: 22/PixelRatio.get(),
  1469. },
  1470. rankRunBox: {
  1471. flex: 1,
  1472. flexDirection: 'row',
  1473. }
  1474. });