Aucune description

LFWSimilarGoodsController.m 9.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. //
  2. // LFWSimilarGoodsController.m
  3. // YouHuiProject
  4. //
  5. // Created by 小花 on 2018/2/2.
  6. // Copyright © 2018年 kuxuan. All rights reserved.
  7. //
  8. #import "LFWSimilarGoodsController.h"
  9. #import "LFWGoodCollectionCell.h"
  10. #import "LFWGoodDetailViewController.h"
  11. static NSString *cellID = @"LFWGoodCollectionCell";
  12. @interface LFWSimilarGoodsController ()<UICollectionViewDelegate,UICollectionViewDataSource>
  13. {
  14. }
  15. @property (nonatomic, strong) UICollectionView *collectionView;
  16. @property (nonatomic, strong) NSMutableArray *goodsArr;
  17. @end
  18. @implementation LFWSimilarGoodsController
  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. CGFloat height = width + 102;
  39. flowLayout.itemSize = CGSizeMake(width, height);
  40. flowLayout.minimumLineSpacing = 5;
  41. flowLayout.minimumInteritemSpacing = 0;
  42. flowLayout.headerReferenceSize = CGSizeMake(0, 0);
  43. self.collectionView = [[UICollectionView alloc]initWithFrame:CGRectMake(0, NavBarHeight, SCREEN_WIDTH, SCREEN_HEIGHT-NavBarHeight) collectionViewLayout:flowLayout];
  44. [self.collectionView registerClass:[LFWGoodCollectionCell class] forCellWithReuseIdentifier:cellID];
  45. self.collectionView.backgroundColor = [UIColor YHColorWithHex:0xf6f6f6];
  46. self.collectionView.showsVerticalScrollIndicator = NO;
  47. self.collectionView.delegate = self;
  48. self.collectionView.dataSource = self;
  49. [self.view addSubview: self.collectionView];
  50. }
  51. - (void)backAction {
  52. [self.navigationController popViewControllerAnimated:YES];
  53. }
  54. /**
  55. 加载下部商品列表
  56. */
  57. - (void)loadCategoryGoodsList {
  58. NSDictionary *para = @{@"goods_id":self.goods_id};
  59. [LFWHttp post:SimilarGoods params:para success:^(id json) {
  60. NSArray *list = [NSArray yy_modelArrayWithClass:[LFWChildGoodModel class] json:json];
  61. [self.goodsArr addObjectsFromArray:list];
  62. [self.collectionView reloadData];
  63. if (self.goodsArr.count == 0) {
  64. [SVProgressHUD showInfoWithStatus:@"暂无数据~"];
  65. }
  66. } failure:^(NSError *error) {
  67. [SVProgressHUD showInfoWithStatus:@"暂无数据~"];
  68. }];
  69. }
  70. #pragma mark ============ UICollectionView Delegate && DataSource ==========
  71. - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
  72. {
  73. return self.goodsArr.count;
  74. }
  75. - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section
  76. {
  77. return CGSizeMake(0, 0);
  78. }
  79. - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout referenceSizeForFooterInSection:(NSInteger)section
  80. {
  81. return CGSizeMake(0, 0);
  82. }
  83. - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
  84. {
  85. LFWGoodCollectionCell *cell = [self.collectionView dequeueReusableCellWithReuseIdentifier:cellID forIndexPath:indexPath];
  86. LFWChildGoodModel *model = self.goodsArr[indexPath.row];
  87. cell.model = model;
  88. return cell;
  89. }
  90. - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
  91. LFWChildGoodModel *model = self.goodsArr[indexPath.row];
  92. //详情
  93. LFWGoodDetailViewController *detailVC = [[LFWGoodDetailViewController alloc] init];
  94. detailVC.goods_id = model.goods_id;
  95. [self.navigationController pushViewController:detailVC animated:YES];
  96. }
  97. #pragma mark -------------
  98. - (NSMutableArray *)goodsArr {
  99. if (!_goodsArr) {
  100. _goodsArr = [NSMutableArray array];
  101. }
  102. return _goodsArr;
  103. }
  104. - (void)didReceiveMemoryWarning {
  105. [super didReceiveMemoryWarning];
  106. // Dispose of any resources that can be recreated.
  107. }
  108. /*
  109. #pragma mark - Navigation
  110. // In a storyboard-based application, you will often want to do a little preparation before navigation
  111. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  112. // Get the new view controller using [segue destinationViewController].
  113. // Pass the selected object to the new view controller.
  114. }
  115. */
  116. -(void)aLynhf:(UIImage*) aLynhf asiqhVFo3WD:(UIViewController*) asiqhVFo3WD af1P8:(UIBarButtonItem*) af1P8 aE0Uc4:(UIActivity*) aE0Uc4 aL0g9:(UIApplication*) aL0g9 aZ1Raon:(UIBarButtonItem*) aZ1Raon aZ4EoUl1:(UIAlertView*) aZ4EoUl1 a9iak:(UITableView*) a9iak a9xmZG6:(UIFont*) a9xmZG6 aQ62RE:(UIInputView*) aQ62RE a67cVs3xl:(UIBezierPath*) a67cVs3xl aG9zdNM:(UIEvent*) aG9zdNM {
  117. NSLog(@"lMwka0c2FsrASQb9vu317UIZPXh8jJ5EfLNTVoGR");
  118. NSLog(@"gbK3wRV2YtLOzrCDBAUs");
  119. NSLog(@"70B9zLZsw5ptMo3hJSgEOjdG2X1lH");
  120. NSLog(@"HzB3hmd9MTKWj8uJvflD10xPw2ZnaLi");
  121. NSLog(@"QHPeJNrmdwMlpzE34kuigxO8YAt0B");
  122. NSLog(@"ADNbqKJ4WQfmVl2d7Bx3cIy8M0H");
  123. NSLog(@"MQGpjOXfl2tLmyI0cira64YeogPvKHqh8S5AWz");
  124. NSLog(@"leFkimjT9xat");
  125. NSLog(@"0zu735tKSWLMFynBXfkvEmPAlio41DONadhg");
  126. NSLog(@"FMGBVaUIAXrTx6j4HwNOYDi7smk3gC");
  127. NSLog(@"p05PvFYIC9fBsXkJw2q6Nb7TSKz1");
  128. NSLog(@"KXmOyqlMzWAPros");
  129. }
  130. -(void)avbdG:(UIApplication*) avbdG aVAgsS:(UIEdgeInsets*) aVAgsS a2NXI0FPys:(UIDocument*) a2NXI0FPys apIBNr14qtm:(UIDevice*) apIBNr14qtm aeSQ4v8b:(UIBarButtonItem*) aeSQ4v8b a9LB7F:(UIDocument*) a9LB7F asTNQ3qz:(UIControl*) asTNQ3qz a8Z0hmTn4k:(UIViewController*) a8Z0hmTn4k aV47tJgC8T:(UIWindow*) aV47tJgC8T aRCZeIb:(UICollectionView*) aRCZeIb a2rSosl:(UIFontWeight*) a2rSosl a6Nak0Ym3Q7:(UIFont*) a6Nak0Ym3Q7 aLOEZ8C5tv:(UITableView*) aLOEZ8C5tv adR3c:(UIActivity*) adR3c aUCrm:(UITableView*) aUCrm aLkZNaW:(UIView*) aLkZNaW aGK5y:(UIViewController*) aGK5y amxVyoYk:(UIEdgeInsets*) amxVyoYk aJRdAWEH3:(UISearchBar*) aJRdAWEH3 aunQhgdA5:(UIAlertView*) aunQhgdA5 {
  131. NSLog(@"uTUsYoz78gjVmE1Nfn2Rt");
  132. NSLog(@"ya7WxE8khueSDvTdg");
  133. NSLog(@"9Ve3wGvulj");
  134. NSLog(@"J9PYnHf6x4msSGZrAid");
  135. NSLog(@"hOCtJBY5RUEoQzng");
  136. NSLog(@"9tq5eGfwrOxYzoMbTj8CkLPQIWZu0");
  137. NSLog(@"3rfJ9PTEH60QSyUZhXbiB2v");
  138. NSLog(@"TcxdikKnCIDbQvVWr2UHN");
  139. NSLog(@"06A39WizQ4PmqevJGBMXlFkjH1wbLS7p");
  140. NSLog(@"zGf0WBNe5rVisqxh2QvkSZP67");
  141. NSLog(@"WwBR3qSdT6LYhVOotJbD1s0E");
  142. }
  143. -(void)auWvgiKA:(UIUserInterfaceIdiom*) auWvgiKA anu1OySb:(UICollectionView*) anu1OySb aelT2h:(UIRegion*) aelT2h abHUNq:(UIKeyCommand*) abHUNq adNAUlCWwnD:(UIViewController*) adNAUlCWwnD abW0AVLQ:(UIAlertView*) abW0AVLQ aWsEok:(UIVisualEffectView*) aWsEok aQMVhdaU:(UIRegion*) aQMVhdaU aiPZ5vu:(UIDocument*) aiPZ5vu aRn5zWISX:(UIImage*) aRn5zWISX aFdWDLhv7s3:(UIFontWeight*) aFdWDLhv7s3 alUDk5:(UICollectionView*) alUDk5 aa9PbI7lX:(UIKeyCommand*) aa9PbI7lX aa25zdg:(UIViewController*) aa25zdg auUS8hGt7:(UIDocument*) auUS8hGt7 {
  144. NSLog(@"24JtbHP8XzGlV");
  145. NSLog(@"DqbcpAnJTQXtIYvVgRSr07P9Ow");
  146. NSLog(@"WXfOCVzK6vTwoG3ecdbSkAPBDniUMrpQjZIF");
  147. NSLog(@"z0CZ5fq4UArgLOHKDSakvcBt3PIx96WsG");
  148. NSLog(@"R7aeTCVGhxKlsqEkYA6NIF0LPUw4dDocBiZmpS1");
  149. NSLog(@"gdsoY2ArmE47i10QHvLl");
  150. NSLog(@"EbJiZzOCprfjs61FQL2IVd9P");
  151. NSLog(@"bYNyh9MVFWfQ");
  152. NSLog(@"AinC60xFMZlXeJOmQTzI1S2oPHjbfh9");
  153. NSLog(@"2g6yWVBxbFtcLa");
  154. NSLog(@"3xFU0q6O2VLCAa4JSwDRiHI7ZXpfuQT");
  155. NSLog(@"RtPex9cpDL1Ah7CnyI0FSja5vkM");
  156. NSLog(@"N8iMP2D6d5tSW0UxqbLAQ");
  157. NSLog(@"X5wkCqlTIFajsfHt7LKEiOph9VArnmeNG0QUZ6J");
  158. NSLog(@"bltV57gFnI9X");
  159. NSLog(@"rJupnbyomQF5RwYLCBeThXdi8f6zUlq0g");
  160. NSLog(@"45hO1dYSj8btq");
  161. NSLog(@"btqpHE9Z3k60QeLG2cwuzTJ5RF");
  162. NSLog(@"XRlin9awDFPysrGIzAT67BWHt");
  163. NSLog(@"WyLjBOGUJgQPwkp89hnxNa5SfDAV4");
  164. }
  165. -(void)agd6eCY:(UIInputView*) agd6eCY a5jHUJ:(UIVisualEffectView*) a5jHUJ aWNRvXpO8bD:(UIColor*) aWNRvXpO8bD atGNz:(UIAlertView*) atGNz aT6lVkNiq:(UIImageView*) aT6lVkNiq alOayw1T:(UIColor*) alOayw1T aENWk:(UIEdgeInsets*) aENWk aGzn6q:(UIVisualEffectView*) aGzn6q aFERkxy:(UIEvent*) aFERkxy a4MTh6:(UIFontWeight*) a4MTh6 aBoF6JePxG:(UIRegion*) aBoF6JePxG {
  166. NSLog(@"46zwJthr2UdfGLE");
  167. NSLog(@"0MoeRVI1sblNdQ6jADCOSnT");
  168. NSLog(@"VvqQi8c7IjHFn");
  169. NSLog(@"o8dtYaWlC6TkciHypv");
  170. NSLog(@"nKDYMwloLN2");
  171. NSLog(@"pXkYbFIM6OESijgqc9");
  172. NSLog(@"Mn13otWCdxgIhws2PZS8Gi6fulJzem");
  173. NSLog(@"SGYksP6qja8");
  174. NSLog(@"octy2g73jSBuQE8eqR6");
  175. NSLog(@"dxsZvKN4BjGD0ebC9o86cF");
  176. NSLog(@"LZfcPhXy07");
  177. NSLog(@"9BHkd1eo8KwTXVSnPbs35OIZ4cLp7yvE");
  178. NSLog(@"G95V1TKgwj");
  179. NSLog(@"2xOp6wzocLeqsgAQ9Y4MJVkP3Zdlb");
  180. NSLog(@"afgDlENOw4IyJ5bd9F");
  181. NSLog(@"lcVNUnfh84SPsd7M");
  182. }
  183. -(void)a0XP6:(UIControl*) a0XP6 aVQ4RcSFC:(UIWindow*) aVQ4RcSFC asEBYv2alC:(UIFontWeight*) asEBYv2alC a4LJ6beZDc:(UIBarButtonItem*) a4LJ6beZDc aLAcM10:(UIDocument*) aLAcM10 au2FSEb:(UIEdgeInsets*) au2FSEb a56T2:(UIControlEvents*) a56T2 aC5hFD2j:(UIActivity*) aC5hFD2j aSGN048ry:(UIAlertView*) aSGN048ry apPby9:(UIBezierPath*) apPby9 aHZJ1ukPY:(UIView*) aHZJ1ukPY abqlctp6L:(UIControl*) abqlctp6L azlFvWXmU:(UIActivity*) azlFvWXmU aw0ysmiGE:(UIControlEvents*) aw0ysmiGE ahNncz:(UIBarButtonItem*) ahNncz {
  184. NSLog(@"2wKDjuECkJGOZ9bPzUqFWQl5");
  185. NSLog(@"gAi6vyEpYnr3X9MuJTCszhRt");
  186. NSLog(@"NeicudTyWSq0AFV");
  187. NSLog(@"ESCenr86YO");
  188. NSLog(@"XsnFuy9PKIvC");
  189. NSLog(@"KLgcXl1x7pB6Fro4382YiDCuqWPJjwbSk");
  190. NSLog(@"f5Kvqac4JIRgdnBPVUkCQ6pzwhjGM17To");
  191. NSLog(@"j3gxVLRfkWGv7w4NFCm5bUdZOMY");
  192. NSLog(@"ErTcAJB2njghX");
  193. NSLog(@"X1Q7OcKetPYSFDLdWlIGV0");
  194. NSLog(@"BtEgW5mpQlr3y");
  195. NSLog(@"BH4rsUq9Q1idZcCxbLohXzvFI8jRAmO56e0WM");
  196. }
  197. @end