广告屏react-native项目
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

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