广告屏react-native项目
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 
 

899 linhas
25 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 RNFetchBlob from 'react-native-fetch-blob';
  18. import * as Animatable from 'react-native-animatable';
  19. import {CachedImage,ImageCache} from "react-native-img-cache";
  20. var testMac = 'FF:FF:FF:FF:FF:FF'
  21. var curAdIndex = 0;
  22. var errorMsg = {
  23. ERR_MAC_GET:'设备编号获取错误',
  24. ERR_START_AD:'广告播放系统错误',
  25. ERR_DATA_GET:'广告数据获取错误',
  26. ERR_HEARTBEAT:'设备心跳数据错误',
  27. ERR_NO_DATA:'暂无优惠信息'
  28. }
  29. var animationThemes = [
  30. // 滑入
  31. {
  32. first:"slideInDown",
  33. second:"slideInLeft",
  34. third:"slideInRight"
  35. },
  36. // 放大
  37. {
  38. first:"zoomInDown",
  39. second:"zoomInLeft",
  40. third:"zoomInRight"
  41. },
  42. // 翻转
  43. {
  44. first:"flipInX",
  45. second:"flipInY",
  46. third:"flipInX"
  47. },
  48. // 弹出
  49. {
  50. first:"bounceInDown",
  51. second:"bounceInLeft",
  52. third:"bounceInRight"
  53. }
  54. ]
  55. var timer = null;
  56. var hbRequestCount
  57. var getAdDataCount
  58. var pageChangeCount
  59. var adDataList = []
  60. var heartConfig = {
  61. heartbeatInterval:10,
  62. dataRefreshInterval:3600,
  63. pageChangeInterval:10,
  64. }
  65. var requestFailedCount = 0;
  66. var versionInfo = '';
  67. let codePushOptions = {
  68. //设置检查更新的频率
  69. //ON_APP_RESUME APP恢复到前台的时候
  70. //ON_APP_START APP开启的时候
  71. //MANUAL 手动检查
  72. checkFrequency : CodePush.CheckFrequency.ON_APP_START
  73. };
  74. export default class MyPage extends Component {
  75. constructor(props) {
  76. super(props);
  77. this.state = {
  78. baseInfo: null,
  79. contentItem0:null,
  80. contentItem1:null,
  81. contentItem2:null,
  82. animationTheme:{},
  83. contentDisplayStatus:false,
  84. syncMessage: "初始化..." ,
  85. errorMessage: '加载中...',
  86. progress: {
  87. receivedBytes:0,
  88. totalBytes:0
  89. },
  90. updating:true,
  91. macAddress: '',
  92. versionInfo:'未知'
  93. };
  94. }
  95. //更新函数
  96. async codePushUpdate() {
  97. await CodePush.getUpdateMetadata(CodePush.UpdateState.RUNNING)
  98. .then((metadata: LocalPackage) => {
  99. this.setState({ versionInfo: metadata ? 'b'+NativeModules.BuildConfig.versionCode+"-" + metadata.label : 'b'+ NativeModules.BuildConfig.versionCode});
  100. versionInfo = this.state.versionInfo;
  101. }, (error: any) => {
  102. this.setState({ versionInfo: "Unknown"});
  103. versionInfo = this.state.versionInfo;
  104. });
  105. await CodePush.disallowRestart();
  106. await CodePush.sync(
  107. { mandatoryInstallMode: CodePush.InstallMode.IMMEDIATE,
  108. installMode: CodePush.InstallMode.IMMEDIATE},
  109. this.codePushStatusDidChange.bind(this),
  110. this.codePushDownloadDidProgress.bind(this)
  111. );
  112. await CodePush.allowRestart();
  113. }
  114. // 监听更新状态
  115. codePushStatusDidChange(syncStatus) {
  116. switch(syncStatus) {
  117. case CodePush.SyncStatus.CHECKING_FOR_UPDATE:
  118. this.setState({ syncMessage: "检查更新" });
  119. break;
  120. case CodePush.SyncStatus.DOWNLOADING_PACKAGE:
  121. this.setState({ syncMessage: "下载更新" });
  122. break;
  123. case CodePush.SyncStatus.AWAITING_USER_ACTION:
  124. this.setState({ syncMessage: "等待用户操作" });
  125. break;
  126. case CodePush.SyncStatus.INSTALLING_UPDATE:
  127. this.setState({ syncMessage: "安装更新" });
  128. break;
  129. case CodePush.SyncStatus.UP_TO_DATE:
  130. this.setState({ syncMessage: "已更新到最新程序", updating: false });
  131. break;
  132. case CodePush.SyncStatus.UPDATE_IGNORED:
  133. this.setState({ syncMessage: "更新被取消", updating: false });
  134. break;
  135. case CodePush.SyncStatus.UPDATE_INSTALLED:
  136. this.setState({ syncMessage: "更新已安装,重启应用后生效", updating: false });
  137. break;
  138. case CodePush.SyncStatus.UNKNOWN_ERROR:
  139. this.setState({ syncMessage: "未知错误", updating: false });
  140. break;
  141. }
  142. }
  143. codePushDownloadDidProgress(progress) {
  144. this.setState({ progress });
  145. }
  146. // 列表滚动
  147. updateContent() {
  148. if (adDataList.length <=0)
  149. return false;
  150. if (curAdIndex >= adDataList.length) {
  151. curAdIndex = 0
  152. }
  153. this.setState({contentItem0:adDataList[curAdIndex]});
  154. if (curAdIndex + 1 < adDataList.length)
  155. this.setState({contentItem1:adDataList[curAdIndex+1]});
  156. else
  157. this.setState({contentItem1:null});
  158. if (curAdIndex + 2 < adDataList.length)
  159. this.setState({contentItem2:adDataList[curAdIndex+2]});
  160. else
  161. this.setState({contentItem2:null});
  162. curAdIndex+=3
  163. return true;
  164. }
  165. hbRequest() {
  166. return HttpUtils.post(NativeModules.BuildConfig.apiHost
  167. + 'api/wxDeviceScreenAd/heartbeat?deviceId='
  168. + encodeURIComponent(this.state.macAddress),
  169. {version:this.state.versionInfo})
  170. .then(result => {
  171. if (result.code == 200) {
  172. let config = JSON.parse(result.data.config);
  173. heartConfig.heartbeatInterval = config.heartbeatInterval
  174. heartConfig.dataRefreshInterval=config.dataRefreshInterval
  175. heartConfig.pageChangeInterval=config.pageChangeInterval
  176. // 动画划入
  177. if(config.animationTheme == 0){
  178. this.setState({
  179. animationTheme:animationThemes[0]
  180. })
  181. }else if(config.animationTheme == 1){
  182. // 放大
  183. this.setState({
  184. animationTheme:animationThemes[1]
  185. })
  186. }else if(config.animationTheme == 2){
  187. // 淡入
  188. this.setState({
  189. animationTheme:animationThemes[2]
  190. })
  191. }else if(config.animationTheme == 3){
  192. // 弹入
  193. this.setState({
  194. animationTheme:animationThemes[3]
  195. })
  196. }
  197. } else {
  198. //do nothing
  199. }
  200. })
  201. .catch(error => {
  202. requestFailedCount++
  203. this.setState({ versionInfo: versionInfo+`[${requestFailedCount}]`});
  204. })
  205. }
  206.  showErrMsg(errMsg) {
  207. this.setState({contentDisplayStatus: false})
  208. this.setState({errorMessage : errMsg});
  209. }
  210. getAdDataList(first) {
  211. HttpUtils.get(NativeModules.BuildConfig.apiHost
  212. + 'api/wxDeviceScreenAd/list?deviceId='
  213. + encodeURIComponent(this.state.macAddress)
  214. + '&pageNum=1&pageSize=1000')
  215. .then(result => {
  216. if (result.code != 200) {
  217. this.showErrMsg(result.message+'\n'+this.state.macAddress);
  218. } else if (result.data.list) {
  219. adDataList = result.data.list;
  220. if (this.updateContent()) {
  221. this.setState({contentDisplayStatus: true})
  222. } else {
  223. this.showErrMsg(errorMsg.ERR_NO_DATA);
  224. }
  225. } else {
  226.  this.showErrMsg(errorMsg.ERR_DATA_GET);
  227. }
  228. })
  229. .catch(error => {
  230. if (first) {
  231. this.showErrMsg(error.message);
  232. }
  233. else {
  234. requestFailedCount++
  235. this.setState({ versionInfo: versionInfo+`[${requestFailedCount}]`});
  236. }
  237. })
  238. }
  239. getBaseInfo() {
  240. HttpUtils.get(NativeModules.BuildConfig.apiHost
  241. + 'api/wxDeviceScreenAd/info?deviceId='
  242. + encodeURIComponent(this.state.macAddress))
  243. .then(result => {
  244. if (result.code != 200) {
  245. this.showErrMsg(result.message+'\n'+this.state.macAddress);
  246. } else if (result.data) {
  247. this.setState({baseInfo:result.data});
  248. } else {
  249. this.showErrMsg(errorMsg.ERR_DATA_GET);
  250. }
  251. })
  252. .catch(error => {
  253. this.showErrMsg(error.message);
  254. })
  255. }
  256. componentDidMount() {
  257. this.codePushUpdate();
  258. DeviceInfo.getMACAddress().then((mac)=>{
  259. if (mac=='' || mac==null ) {
  260. if (NativeModules.BuildConfig.buildType == 'debug') {
  261. this.setState({macAddress : this.testMac})
  262. this.startAd()
  263. } else {
  264. this.showErrMsg(errorMsg.ERR_MAC_GET);
  265. }
  266. } else {
  267. this.setState({macAddress : mac})
  268. this.startAd()
  269. }
  270. }).catch(e => {
  271. this.showErrMsg(errorMsg.ERR_START_AD);
  272. })
  273. }
  274. componentWillUnmount(){
  275. if (timer)
  276. clearTimeout(timer)
  277. }
  278. async routine() {
  279. hbRequestCount -=1;
  280. getAdDataCount -=1;
  281. pageChangeCount -=1;
  282. try {
  283. if (getAdDataCount<=0) {
  284. this.getAdDataList(false)
  285. getAdDataCount = heartConfig.dataRefreshInterval
  286. } else if (hbRequestCount<=0) {
  287. this.hbRequest()
  288. hbRequestCount = heartConfig.heartbeatInterval
  289. }
  290. if (pageChangeCount <= 0) { //页面切换间隔
  291. if (this.state.contentDisplayStatus && this.state.baseInfo) {
  292. this.setState({ contentDisplayStatus: false})
  293. if (this.updateContent()) {
  294. this.setState({ contentDisplayStatus: true})
  295. }
  296. } else {
  297. await this.getBaseInfo()
  298. await this.getAdDataList(true)
  299. getAdDataCount = heartConfig.dataRefreshInterval
  300. hbRequestCount = heartConfig.heartbeatInterval
  301. }
  302. pageChangeCount = heartConfig.pageChangeInterval
  303. }
  304. } catch(e){
  305. this.setState({ versionInfo: versionInfo+'[E]'});
  306. }
  307. timer = setTimeout(()=>{
  308. this.routine();
  309. },1000);
  310. }
  311. startAd() {
  312. hbRequestCount = 0;
  313. getAdDataCount = 0;
  314. pageChangeCount = 0;
  315. this.routine();
  316. }
  317. getContentViewItemUplayer(contentItem) {
  318. if (contentItem.type == 0) {
  319. if (contentItem.subType == 2)
  320. return (<Image source={require('./image/timed.png')} resizeMode='center' style={styles.contentItemUpLayer} /> )
  321. if (contentItem.subType == 6)
  322. return (<Image source={require('./image/discount.png')} resizeMode='center' style={styles.contentItemUpLayer} /> )
  323. if (contentItem.subType == 7)
  324. return (<Image source={require('./image/groupbuy.png')} resizeMode='center' style={styles.contentItemUpLayer} /> )
  325. return null;
  326. }
  327. }
  328. getContentViewItemActionStr(contentItem) {
  329. if (contentItem.type == 0) {
  330. if (contentItem.subType == 2)
  331. return '扫码秒杀';
  332. else if (contentItem.subType == 6)
  333. return '扫码砍价';
  334. else if (contentItem.subType == 7)
  335. return '扫码拼团';
  336. else
  337. return '扫码领取';
  338. }
  339. }
  340. getContentViewItemMerchantName(contentItem) {
  341. if (contentItem.type == 0) {
  342. if (contentItem.target.merchantVoList.length > 1)
  343. return '多商户通用';
  344. else
  345. return contentItem.target.merchantVoList[0].merchantName;
  346. }
  347. }
  348. getContentViewItem(contentItem, annomation) {
  349. if (!contentItem)
  350. return (
  351. <View style={styles.contentItem}>
  352. </View>
  353. )
  354. actionText = this.getContentViewItemActionStr(contentItem);
  355. merchantName = this.getContentViewItemMerchantName(contentItem);
  356. // console.warn(annomation)
  357. return (
  358. <Animatable.View animation={annomation} style={styles.contentItem}>
  359. <ImageBackground source={require('./image/item-background.png')} resizeMode='center' style={styles.contentItemDownLayer} >
  360. {/* 列表 */}
  361. <View style={styles.contentItemTop}>
  362. <CachedImage source={{uri: contentItem.coverImg}} resizeMode='cover' style={styles.contentItemTopCoverImg} />
  363. <View style={styles.contentItemTopDetail}>
  364. {/* 券的title */}
  365. <Text style={styles.contentItemTopDetailTitle} numberOfLines={2} ellipsizeMode="tail">{contentItem.target.title}</Text>
  366. <View style={styles.contentItemTopDetailPrice}>
  367. {/* 售价 */}
  368. <View style={styles.contentItemTopDetailCurPrice}>
  369. <Text style={styles.contentItemTopDetailCurPriceStrUnit}>¥</Text>
  370. <Text style={styles.contentItemTopDetailCurPriceStr}>{contentItem.target.salePriceStr}</Text>
  371. </View>
  372. {/* 面额 */}
  373. <View style={styles.contentItemTopDetailSalePrice}>
  374. <Text style={styles.contentItemTopDetailSalePriceStr} >¥{contentItem.target.priceStr}</Text>
  375. </View>
  376. </View>
  377. </View>
  378. {/* <Image source={{uri:'data:image/png;base64,'+contentItem.qrcode}} resizeMode='contain' style={styles.contentItemTopQrcode} /> */}
  379. <CachedImage source={{uri:contentItem.target.qrCode}} resizeMode='contain' style={styles.contentItemTopQrcode} />
  380. </View>
  381. {/* 优惠券底部商户名称 */}
  382. <View style={styles.contentItemBottom}>
  383. <Text style={styles.contentItemBottomMerchantName}>{merchantName}</Text>
  384. <Text style={styles.contentItemBottomPlacehold}>{contentItem.target.merchantVoList[0].buildingName}{contentItem.target.merchantVoList[0].floorName}</Text>
  385. <Text style={styles.contentItemBottomAction}>{actionText}</Text>
  386. </View>
  387. </ImageBackground>
  388. {this.getContentViewItemUplayer(contentItem)}
  389. </Animatable.View>
  390. )
  391. }
  392. getContentView() {
  393. if (this.state.contentDisplayStatus) {
  394. return (<View style={styles.content}>
  395. {this.getContentViewItem(this.state.contentItem0,this.state.animationTheme.first)}
  396. {this.getContentViewItem(this.state.contentItem1,this.state.animationTheme.second)}
  397. {this.getContentViewItem(this.state.contentItem2,this.state.animationTheme.third)}
  398. </View>)
  399. }else{
  400. return (
  401. <View style={styles.content}>
  402. <Text style={styles.updatePage}>{this.state.errorMessage}</Text>
  403. </View>)
  404. }
  405. }
  406. getUpdateView() {
  407. if (this.state.progress.totalBytes > 0)
  408. return (
  409. <Text style={styles.updatePage}>{this.state.syncMessage}{'\n'}
  410. {this.state.progress.receivedBytes} of {this.state.progress.totalBytes} bytes received{'\n'}
  411. </Text>
  412. );
  413. return (
  414. <Text style={styles.updatePage}>{this.state.syncMessage}
  415. </Text>
  416. );
  417. }
  418. getAdView(){
  419. if (this.state.baseInfo) {
  420. return (
  421. <ImageBackground style={styles.background} resizeMode='center' source={require('./image/background.png')}>
  422. {/* 头部title二维码开始 */}
  423. <View style={styles.title}>
  424. <View style={styles.titleImagePlace}>
  425. <Image source={require('./image/title.png')} resizeMode='center' style={styles.titleImage} />
  426. </View>
  427. <ImageBackground source={require('./image/title-qrcode.png') } resizeMode='center' style={styles.titleQrcodeBonder} >
  428. <View style={styles.titleQrcodePlacehold}></View>
  429. <Image source={{uri: this.state.baseInfo.imgQrcodeWeapp}} resizeMode='center' style={styles.titleQrcode} />
  430. <View style={styles.titleQrcodePlacehold}></View>
  431. </ImageBackground>
  432. </View>
  433. {/* 券列表展示列表开始 */}
  434. {this.getContentView()}
  435. {/* 底部商场信息展示开始 */}
  436. <View style={styles.bottom}>
  437. <View style={styles.bottomLogoBackground}>
  438. <Image source={{ uri: this.state.baseInfo.imgUrlH}} resizeMode='contain' style={styles.bottomLogo} />
  439. </View>
  440. <View style={styles.bottomQrcode1Background}>
  441. <Image source={{ uri: this.state.baseInfo.imgQrcodeWeapp}} resizeMode='center' style={styles.bottomQrcode1} />
  442. <Text style={styles.bottomQrcode1Str}>小程序</Text>
  443. </View>
  444. <View style={styles.bottomQrcode2Background}>
  445. <Image source={{ uri: this.state.baseInfo.imgQrcodeWemp}} resizeMode='center' style={styles.bottomQrcode2} />
  446. <Text style={styles.bottomQrcode1Str}>公众号</Text>
  447. </View>
  448. <Text style={styles.bottomPlacehold}>{this.state.versionInfo}</Text>
  449. </View>
  450. </ImageBackground>
  451. );}
  452. else {
  453. return (
  454. <ImageBackground style={styles.background} resizeMode='center' source={require('./image/background.png')}>
  455. {/* 头部title二维码开始 */}
  456. <View style={styles.title}>
  457. </View>
  458. {/* 券列表展示列表开始 */}
  459. {this.getContentView()}
  460. {/* 底部商场信息展示开始 */}
  461. <View style={styles.bottom}>
  462. <View style={styles.bottomLogoBackground}>
  463. </View>
  464. <View style={styles.bottomQrcode1Background}>
  465. </View>
  466. <View style={styles.bottomQrcode2Background}>
  467. </View>
  468. <Text style={styles.bottomPlacehold}>{this.state.versionInfo}</Text>
  469. </View>
  470. </ImageBackground>
  471. );
  472. }
  473. }
  474. render() {
  475. if (this.state.updating) {
  476. return this.getUpdateView();
  477. }
  478. return this.getAdView();
  479. }
  480. }
  481. const styles = StyleSheet.create({
  482. updatePage:{
  483. flex: 2,
  484. width:'100%',
  485. height:'100%',
  486. backgroundColor:'transparent',
  487. textAlign :'center',
  488. textAlignVertical:'center',
  489. fontSize: 63/PixelRatio.get(),
  490. color: 'darkblue'
  491. },
  492. //layer background
  493. background:{
  494. flex: 1,
  495. width:'100%',
  496. height:'100%'
  497. },
  498. //layer top
  499. title:{
  500. flex: 6,
  501. flexDirection: 'row',
  502. alignItems: 'center',
  503. paddingLeft:42/PixelRatio.get(),
  504. paddingRight:42/PixelRatio.get(),
  505. backgroundColor:'transparent'
  506. },
  507. content:{
  508. flex: 18,
  509. flexDirection: 'column',
  510. alignItems: 'center',
  511. backgroundColor:'transparent'
  512. },
  513. bottom:{
  514. flex: 2,
  515. flexDirection: 'row',
  516. alignItems: 'center',
  517. paddingLeft:42/PixelRatio.get(),
  518. paddingRight:42/PixelRatio.get(),
  519. backgroundColor:'transparent'
  520. },
  521. //layer title
  522. titleImagePlace: {
  523. flex: 2,
  524. paddingTop: '20%',
  525. paddingLeft: '15%',
  526. alignItems: 'center',
  527. backgroundColor:'transparent'
  528. },
  529. titleImage: {
  530. width:'100%',
  531. height:'100%',
  532. flex: 1,
  533. backgroundColor:'transparent'
  534. },
  535. titleQrcodeBonder: {
  536. width:'100%',
  537. height:'100%',
  538. alignItems: 'center',
  539. flexDirection: 'column',
  540. flex: 1,
  541. backgroundColor:'transparent'
  542. },
  543. titleQrcodePlacehold: {
  544. flex: 5,
  545. backgroundColor:'transparent'
  546. },
  547. titleQrcode: {
  548. flex: 6,
  549. width:'100%',
  550. height:'100%',
  551. backgroundColor:'transparent'
  552. },
  553. //layer bottom
  554. bottomLogoBackground: {
  555. flex: 3,
  556. borderRadius:16/PixelRatio.get(),
  557. marginTop: 26/PixelRatio.get(),
  558. marginBottom: 26/PixelRatio.get(),
  559. backgroundColor:'transparent',//'rgba(255,255,255,0.5)',
  560. },
  561. bottomLogo: {
  562. width:'100%',
  563. height:'100%',
  564. backgroundColor:'transparent'
  565. },
  566. bottomQrcode1Background : {
  567. flex: 1,
  568. width:'100%',
  569. height:'100%',
  570. marginLeft: 21/PixelRatio.get(),
  571. paddingTop: 27/PixelRatio.get(),
  572. paddingBottom: 11/PixelRatio.get(),
  573. flexDirection: 'column',
  574. backgroundColor:'transparent'
  575. },
  576. bottomQrcode2Background : {
  577. flex: 1,
  578. width:'100%',
  579. height:'100%',
  580. marginLeft: 21/PixelRatio.get(),
  581. paddingTop: 26/PixelRatio.get(),
  582. paddingBottom: 11/PixelRatio.get(),
  583. flexDirection: 'column',
  584. backgroundColor:'transparent'
  585. },
  586. bottomQrcode1: {
  587. flex: 2,
  588. width:'100%',
  589. height:'100%',
  590. backgroundColor:'transparent'
  591. },
  592. bottomQrcode2: {
  593. flex: 2,
  594. width:'100%',
  595. height:'100%',
  596. backgroundColor:'transparent'
  597. },
  598. bottomQrcode1Str: {
  599. flex: 1,
  600. textAlign :'center',
  601. textAlignVertical:'center',
  602. fontSize: 16/PixelRatio.get(),
  603. color : 'white',
  604. backgroundColor:'transparent'
  605. },
  606. bottomQrcode2Str: {
  607. flex: 1,
  608. textAlign :'center',
  609. textAlignVertical:'center',
  610. fontSize: 16/PixelRatio.get(),
  611. color : 'white',
  612. backgroundColor:'transparent'
  613. },
  614. bottomPlacehold: {
  615. flex: 8,
  616. width:'100%',
  617. height:'100%',
  618. backgroundColor:'transparent',
  619. textAlign :'right',
  620. textAlignVertical:'bottom',
  621. fontSize: 27/PixelRatio.get(),
  622. color : 'gray'
  623. },
  624. //layer content item
  625. contentItem:{
  626. flex: 1,
  627. width:'100%',
  628. height:'100%',
  629. flexDirection: 'column',
  630. backgroundColor:'transparent'
  631. },
  632. contentItemDownLayer:{
  633. position:'absolute',
  634. width:'100%',
  635. height:'100%',
  636. flexDirection: 'column',
  637. alignItems: 'center',
  638. backgroundColor:'transparent'
  639. },
  640. contentItemUpLayer:{
  641. width:210/PixelRatio.get(),
  642. height:153/PixelRatio.get(),
  643. position:'absolute',
  644. backgroundColor:'transparent'
  645. },
  646. contentItemTop:{
  647. flex: 3,
  648. width:'100%',
  649. height:'100%',
  650. paddingLeft: 66/PixelRatio.get(),
  651. paddingRight: 53/PixelRatio.get(),
  652. paddingTop: 40/PixelRatio.get(),
  653. flexDirection: 'row',
  654. alignItems: 'center',
  655. backgroundColor:'transparent'
  656. },
  657. contentItemBottom:{
  658. flex: 1,
  659. width:'100%',
  660. height:'100%',
  661. paddingLeft: 66/PixelRatio.get(),
  662. paddingRight: 53/PixelRatio.get(),
  663. paddingBottom: 40/PixelRatio.get(),
  664. flexDirection: 'row',
  665. alignItems: 'center',
  666. backgroundColor:'transparent'
  667. },
  668. //layer content item top
  669. contentItemTopCoverImg:{
  670. flex: 5,
  671. width:'100%',
  672. height:'100%',
  673. borderRadius:27/PixelRatio.get(),
  674. backgroundColor:'transparent'
  675. },
  676. contentItemTopDetail:{
  677. flex: 6,
  678. width:'100%',
  679. height:'100%',
  680. paddingLeft: 20/PixelRatio.get(),
  681. paddingRight: 20/PixelRatio.get(),
  682. alignItems: 'center',
  683. backgroundColor:'transparent'
  684. },
  685. contentItemTopQrcode:{
  686. flex: 5,
  687. width:'100%',
  688. height:'100%',
  689. // borderStyle:"solid",
  690. // borderWidth:1,
  691. // borderColor:"red",
  692. marginLeft:18/PixelRatio.get(),
  693. backgroundColor:'transparent'
  694. },
  695. //layer content item bottom
  696. contentItemBottomMerchantName:{
  697. flex: 5,
  698. width:'100%',
  699. height:'100%',
  700. alignItems: 'center',
  701. color:"black",
  702. backgroundColor:'transparent',
  703. textAlign :'center',
  704. textAlignVertical:'center',
  705. fontSize: 27/PixelRatio.get(),
  706. fontWeight : 'bold'
  707. },
  708. contentItemBottomPlacehold:{
  709. flex: 6,
  710. fontSize: 27/PixelRatio.get(),
  711. paddingLeft: 27/PixelRatio.get(),
  712. paddingRight: 79/PixelRatio.get(),
  713. width:'100%',
  714. height:'100%',
  715. color:"black",
  716. textAlignVertical:'center',
  717. backgroundColor:'transparent',
  718. },
  719. contentItemBottomAction:{
  720. flex: 5,
  721. width:'100%',
  722. height:'100%',
  723. backgroundColor:'transparent',
  724. textAlign :'center',
  725. textAlignVertical:'center',
  726. fontSize: 36/PixelRatio.get(),
  727. color: 'black',
  728. // borderStyle:"solid",
  729. // borderWidth:1,
  730. // borderColor:"red"
  731. },
  732. // 券的title
  733. contentItemTopDetailTitle:{
  734. flex: 2,
  735. // height:'100%',
  736. width:'100%',
  737. marginTop:"2%",
  738. // borderStyle:"solid",
  739. // borderWidth:1,
  740. // borderColor:"red",
  741. backgroundColor:'transparent',
  742. textAlign :'left',
  743. color:"black",
  744. textAlignVertical:'center',
  745. fontSize: 53/PixelRatio.get(),
  746. },
  747. /*
  748. contentItemTopDetailRemark:{
  749. flex: 1,
  750. width:'100%',
  751. height:'100%',
  752. backgroundColor:'transparent',
  753. textAlign :'left',
  754. textAlignVertical:'center',
  755. fontSize: 27/PixelRatio.get(),
  756. color : 'gray'
  757. },
  758. */
  759. contentItemTopDetailPrice:{
  760. flex: 2,
  761. width:'100%',
  762. height:'100%',
  763. backgroundColor:'transparent',
  764. flexDirection: 'row',
  765. },
  766. // 售价的样式
  767. contentItemTopDetailCurPrice:{
  768. position:"absolute",
  769. bottom:10,
  770. left:0,
  771. width:'100%',
  772. height:'100%',
  773. flexDirection: 'row',
  774. backgroundColor:'transparent',
  775. },
  776. contentItemTopDetailCurPriceStr:{
  777. backgroundColor:'transparent',
  778. fontSize:96/PixelRatio.get(),
  779. fontFamily:"PingFangSC-Bold",
  780. fontWeight: "bold",
  781. textAlign :'left',
  782. textAlignVertical:'bottom',
  783. color : 'red'
  784. },
  785. contentItemTopDetailCurPriceStrUnit:{
  786. backgroundColor:'transparent',
  787. textAlign :'left',
  788. textAlignVertical:'bottom',
  789. paddingBottom: 16/PixelRatio.get(),
  790. fontSize: 48/PixelRatio.get(),
  791. color : 'red'
  792. },
  793. // 面额的样式
  794. contentItemTopDetailSalePrice:{
  795. position:"absolute",
  796. bottom:2,
  797. left:0,
  798. // flex: 1,
  799. paddingTop:50,
  800. width:'100%',
  801. // height:'100%',
  802. backgroundColor:'transparent',
  803. },
  804. contentItemTopDetailSalePriceStr:{
  805. width:'100%',
  806. height:'100%',
  807. backgroundColor:'transparent',
  808. textAlign :'left',
  809. textAlignVertical:'bottom',
  810. fontSize: 27/PixelRatio.get(),
  811. textDecorationLine: 'line-through',
  812. color : 'gray'
  813. },
  814. });