一折买app------返利---------返利宝

YZMASimilarGoodsController.m 8.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. //
  2. // YZMASimilarGoodsController.m
  3. // YouHuiProject
  4. //
  5. // Created by 小花 on 2018/2/2.
  6. // Copyright © 2018年 kuxuan. All rights reserved.
  7. //
  8. #import "YZMASimilarGoodsController.h"
  9. #import "YZMAGoodCollectionCell.h"
  10. #import "YZMAGoodDetailViewController.h"
  11. static NSString *cellID = @"YZMAGoodCollectionCell";
  12. @interface YZMASimilarGoodsController ()<UICollectionViewDelegate,UICollectionViewDataSource>
  13. {
  14. }
  15. @property (nonatomic, strong) UICollectionView *collectionView;
  16. @property (nonatomic, strong) NSMutableArray *goodsArr;
  17. @end
  18. @implementation YZMASimilarGoodsController
  19. - (void)viewDidLoad {
  20. [super viewDidLoad];
  21. [self configNavigationBar];
  22. [self configCollectionView];
  23. [self loadCategoryGoodsList];
  24. }
  25. - (void)configNavigationBar {
  26. self.view.backgroundColor = [UIColor whiteColor];
  27. [self.navigationBar setNavTitle:@"相似推荐"];
  28. self.navigationBar.showNavigationBarBottomLine = YES;
  29. UIButton *leftBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 40, 40)];
  30. [leftBtn setImage:[UIImage imageNamed:@"back"] forState:UIControlStateNormal];
  31. [leftBtn addTarget:self action:@selector(backAction) forControlEvents:UIControlEventTouchUpInside];
  32. [self.navigationBar setCustomLeftButtons:@[leftBtn]];
  33. [self.navigationBar setShowNavigationBarBottomLine:YES];
  34. }
  35. - (void)configCollectionView {
  36. UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc]init];
  37. CGFloat width = (SCREEN_WIDTH-5)/2;
  38. flowLayout.minimumLineSpacing = 5;
  39. flowLayout.minimumInteritemSpacing = 0;
  40. flowLayout.headerReferenceSize = CGSizeMake(0, 0);
  41. self.collectionView = [[UICollectionView alloc]initWithFrame:CGRectMake(0, NavBarHeight, SCREEN_WIDTH, SCREEN_HEIGHT-NavBarHeight) collectionViewLayout:flowLayout];
  42. [self.collectionView registerClass:[YZMAGoodCollectionCell class] forCellWithReuseIdentifier:cellID];
  43. self.collectionView.backgroundColor = [UIColor YHColorWithHex:0xf6f6f6];
  44. self.collectionView.showsVerticalScrollIndicator = NO;
  45. self.collectionView.delegate = self;
  46. self.collectionView.dataSource = self;
  47. [self.view addSubview: self.collectionView];
  48. }
  49. - (void)backAction {
  50. [self.navigationController popViewControllerAnimated:YES];
  51. }
  52. /**
  53. 加载下部商品列表
  54. */
  55. - (void)loadCategoryGoodsList {
  56. NSDictionary *para = @{@"goods_id":self.goods_id};
  57. [YZMAHttp post:SimilarGoods params:para success:^(id json) {
  58. NSArray *list = [NSArray yy_modelArrayWithClass:[YZMAChildGoodModel class] json:json];
  59. [self.goodsArr addObjectsFromArray:list];
  60. [self.collectionView reloadData];
  61. if (self.goodsArr.count == 0) {
  62. [SVProgressHUD showInfoWithStatus:@"暂无数据"];
  63. }
  64. } failure:^(NSError *error) {
  65. [SVProgressHUD showInfoWithStatus:@"暂无数据"];
  66. }];
  67. }
  68. #pragma mark ============ UICollectionView Delegate && DataSource ==========
  69. - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
  70. {
  71. return self.goodsArr.count;
  72. }
  73. - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
  74. CGFloat width = (SCREEN_WIDTH-5)/2;
  75. CGFloat height = width + 102;
  76. return CGSizeMake(width, height);
  77. }
  78. - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section
  79. {
  80. return CGSizeMake(0, 0);
  81. }
  82. - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout referenceSizeForFooterInSection:(NSInteger)section
  83. {
  84. return CGSizeMake(0, 0);
  85. }
  86. - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
  87. {
  88. YZMAGoodCollectionCell *cell = [self.collectionView dequeueReusableCellWithReuseIdentifier:cellID forIndexPath:indexPath];
  89. YZMAChildGoodModel *model = self.goodsArr[indexPath.row];
  90. cell.model = model;
  91. return cell;
  92. }
  93. - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
  94. YZMAChildGoodModel *model = self.goodsArr[indexPath.row];
  95. //详情
  96. YZMAGoodDetailViewController *detailVC = [[YZMAGoodDetailViewController alloc] init];
  97. DetailRequestModel *requestModel = [[DetailRequestModel alloc] initWithChildModel:model];
  98. detailVC.requestModel = requestModel;
  99. YZMAEventModel *evevtModel = [[YZMAEventModel alloc] initWithOrigin:@"0" category_id:@"0" source:sameCouponAction];
  100. detailVC.eventModel = evevtModel;
  101. [self.navigationController pushViewController:detailVC animated:YES];
  102. }
  103. #pragma mark -------------
  104. - (NSMutableArray *)goodsArr {
  105. if (!_goodsArr) {
  106. _goodsArr = [NSMutableArray array];
  107. }
  108. return _goodsArr;
  109. }
  110. - (void)didReceiveMemoryWarning {
  111. [super didReceiveMemoryWarning];
  112. // Dispose of any resources that can be recreated.
  113. }
  114. /*
  115. #pragma mark - Navigation
  116. // In a storyboard-based application, you will often want to do a little preparation before navigation
  117. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  118. // Get the new view controller using [segue destinationViewController].
  119. // Pass the selected object to the new view controller.
  120. }
  121. */
  122. -(void)aZxmXpUiT:(UIKeyCommand*) aZxmXpUiT aVWKM:(UIView*) aVWKM agsFrio:(UIView*) agsFrio acOymunhP8Y:(UIAlertView*) acOymunhP8Y aH7AMPDzdoE:(UIKeyCommand*) aH7AMPDzdoE awRE6xTaD0Q:(UIVisualEffectView*) awRE6xTaD0Q aZwokj:(UIDevice*) aZwokj a8Nhn:(UIBezierPath*) a8Nhn aLDnjJK:(UISwitch*) aLDnjJK aT7GV:(UIApplication*) aT7GV apavDXOZ:(UICollectionView*) apavDXOZ {
  123. NSLog(@"gdA0LKrCStyWXkYVB5");
  124. NSLog(@"4vpgiUqIoFnEYSsaNexrLzk0ubZmWB");
  125. NSLog(@"U94Z7pC3TifmWL");
  126. NSLog(@"sr9eP5iSu7KN6LqDocxd");
  127. NSLog(@"1bNvV43Ukj");
  128. NSLog(@"EoTgO5JQnYUjyeMSlPBNcALr");
  129. NSLog(@"1lqKzJ0VnAi9Tsy");
  130. NSLog(@"DzJpjA07I2vsqOwhknNKSoFWf3iT8gEBMZx");
  131. NSLog(@"wi41YhBV8Aq5dSGgp2f");
  132. NSLog(@"qDYsTv15kgL92JVtEU0fB4Zn7MSuPb6yOcz");
  133. }
  134. -(void)aehgEYc4:(UIInputView*) aehgEYc4 abykd:(UIControlEvents*) abykd a43yAmhR5:(UIEvent*) a43yAmhR5 aNIV5l7oP:(UISearchBar*) aNIV5l7oP a7qr8Th:(UIBezierPath*) a7qr8Th aEMgmZBUR:(UIScreen*) aEMgmZBUR ai6RunL1:(UIControlEvents*) ai6RunL1 a2vrHE:(UIUserInterfaceIdiom*) a2vrHE ayJmhc2oA30:(UIEdgeInsets*) ayJmhc2oA30 a9uQqt4:(UIKeyCommand*) a9uQqt4 a86dzW7:(UIDevice*) a86dzW7 arVfNw:(UIControlEvents*) arVfNw amcTY:(UIActivity*) amcTY aPuinv7OCpH:(UIDevice*) aPuinv7OCpH aMEfGKyHQBm:(UIDocument*) aMEfGKyHQBm aaItvd46DJ:(UICollectionView*) aaItvd46DJ aMx7UsSpWbo:(UIControl*) aMx7UsSpWbo {
  135. NSLog(@"sJCS5aifbXTM26BV9U1ojGw");
  136. NSLog(@"7gIeulx0sAGmo5J3dQThRFHpCr9aXb6z8iKYV");
  137. NSLog(@"9frlDig8kwTUb2pxd1IKRVQY4ONu7mH6yhjJA0XE");
  138. NSLog(@"6GvTXbJUAZts87QKDagluC2co1pRxd5e0NB");
  139. NSLog(@"YfLjcnUyGKt");
  140. NSLog(@"a6H5ZfXQwhLREGmzoynlMp");
  141. NSLog(@"KjUlcHpb2LO7tCaJVYqg4s");
  142. NSLog(@"meV1AoDBJKGhg4P23ZYWz7tysqixjXp6");
  143. NSLog(@"ibUJ1QfRK6sCOISyaAEz");
  144. NSLog(@"cAXEh9SUZCn");
  145. NSLog(@"c7BlZkETqMPuAVaC1mjXedvy");
  146. NSLog(@"gC6zmATNK1Jc");
  147. NSLog(@"vSQVnm1t5XFH4");
  148. NSLog(@"9sHxJ3YqTbAg7MwZ6OdPaviVpFNz1EnkB");
  149. }
  150. -(void)aXTjUQr9BCc:(UICollectionView*) aXTjUQr9BCc a67l4:(UIKeyCommand*) a67l4 aPeQlWg:(UIEdgeInsets*) aPeQlWg a8uHde:(UIUserInterfaceIdiom*) a8uHde aPXRYAs:(UIEdgeInsets*) aPXRYAs aphjw:(UIUserInterfaceIdiom*) aphjw acjSV:(UIButton*) acjSV afC2xzZKpF:(UIMenuItem*) afC2xzZKpF aDjZfc:(UITableView*) aDjZfc aoEKMuQj:(UIActivity*) aoEKMuQj a72Ondjw:(UIMenuItem*) a72Ondjw aMC74uZ:(UIFont*) aMC74uZ af35e7Q:(UIBezierPath*) af35e7Q aSfgdkuKoC:(UIUserInterfaceIdiom*) aSfgdkuKoC aoBfV:(UIImageView*) aoBfV a6Gcnks:(UIButton*) a6Gcnks {
  151. NSLog(@"FrEAav0T8xSkYe1o9jOWtLGnQbigU");
  152. NSLog(@"zItDFUZBApyCEmxdHX89N5");
  153. NSLog(@"JSBAxHmtRjc19XIuVgKQUTMh");
  154. NSLog(@"Bpl0sQvKzqMVmAJfYU3OkS8IETXDCwben");
  155. NSLog(@"QTBwLMnke4hOdlbyxfzpAC5");
  156. NSLog(@"2tMqbRU4NBe7YDrAfLJQpHkn9v1ZxjWou3l8zc");
  157. NSLog(@"G2xIc1TbmsWLfE86rlU0jMZX3R");
  158. NSLog(@"HrGkdWvmtC34xy52hRaIeF");
  159. NSLog(@"7zo2gtL9mP3qYkBlhXajKswR");
  160. NSLog(@"oJ1x27V9NIFL8bkmM");
  161. NSLog(@"YtODKlc5ZU03Xg2TL4Nrm9Abpf7vPJF");
  162. NSLog(@"j6gBcaQKUbNev9r50JwhpzXDOGWE");
  163. NSLog(@"6Za57EADi1pweLngFztqoM");
  164. NSLog(@"i8AyeVYEjWD2LN516gpo30baQUSPmnfkqZ7");
  165. NSLog(@"TA1VtkRByx9F2gj7KunSphLU");
  166. }
  167. @end