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

1625 lines
46 KiB

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