// // LFWSimilarGoodsController.m // YouHuiProject // // Created by 小花 on 2018/2/2. // Copyright © 2018年 kuxuan. All rights reserved. // #import "LFWSimilarGoodsController.h" #import "LFWGoodCollectionCell.h" #import "LFWGoodDetailViewController.h" static NSString *cellID = @"LFWGoodCollectionCell"; @interface LFWSimilarGoodsController () { } @property (nonatomic, strong) UICollectionView *collectionView; @property (nonatomic, strong) NSMutableArray *goodsArr; @end @implementation LFWSimilarGoodsController - (void)viewDidLoad { [super viewDidLoad]; [self configNavigationBar]; [self configCollectionView]; [self loadCategoryGoodsList]; } - (void)configNavigationBar { self.view.backgroundColor = [UIColor whiteColor]; [self.navigationBar setNavTitle:@"相似推荐"]; self.navigationBar.showNavigationBarBottomLine = YES; UIButton *leftBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 40, 40)]; [leftBtn setImage:[UIImage imageNamed:@"back"] forState:UIControlStateNormal]; [leftBtn addTarget:self action:@selector(backAction) forControlEvents:UIControlEventTouchUpInside]; [self.navigationBar setCustomLeftButtons:@[leftBtn]]; [self.navigationBar setShowNavigationBarBottomLine:YES]; } - (void)configCollectionView { UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc]init]; CGFloat width = (SCREEN_WIDTH-5)/2; CGFloat height = width + 102; flowLayout.itemSize = CGSizeMake(width, height); flowLayout.minimumLineSpacing = 5; flowLayout.minimumInteritemSpacing = 0; flowLayout.headerReferenceSize = CGSizeMake(0, 0); self.collectionView = [[UICollectionView alloc]initWithFrame:CGRectMake(0, NavBarHeight, SCREEN_WIDTH, SCREEN_HEIGHT-NavBarHeight) collectionViewLayout:flowLayout]; [self.collectionView registerClass:[LFWGoodCollectionCell class] forCellWithReuseIdentifier:cellID]; self.collectionView.backgroundColor = [UIColor YHColorWithHex:0xf6f6f6]; self.collectionView.showsVerticalScrollIndicator = NO; self.collectionView.delegate = self; self.collectionView.dataSource = self; [self.view addSubview: self.collectionView]; } - (void)backAction { [self.navigationController popViewControllerAnimated:YES]; } /** 加载下部商品列表 */ - (void)loadCategoryGoodsList { NSDictionary *para = @{@"goods_id":self.goods_id}; [LFWHttp post:SimilarGoods params:para success:^(id json) { NSArray *list = [NSArray yy_modelArrayWithClass:[LFWChildGoodModel class] json:json]; [self.goodsArr addObjectsFromArray:list]; [self.collectionView reloadData]; if (self.goodsArr.count == 0) { [SVProgressHUD showInfoWithStatus:@"暂无数据~"]; } } failure:^(NSError *error) { [SVProgressHUD showInfoWithStatus:@"暂无数据~"]; }]; } #pragma mark ============ UICollectionView Delegate && DataSource ========== - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { return self.goodsArr.count; } - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section { return CGSizeMake(0, 0); } - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout referenceSizeForFooterInSection:(NSInteger)section { return CGSizeMake(0, 0); } - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { LFWGoodCollectionCell *cell = [self.collectionView dequeueReusableCellWithReuseIdentifier:cellID forIndexPath:indexPath]; LFWChildGoodModel *model = self.goodsArr[indexPath.row]; cell.model = model; return cell; } - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { LFWChildGoodModel *model = self.goodsArr[indexPath.row]; //详情 LFWGoodDetailViewController *detailVC = [[LFWGoodDetailViewController alloc] init]; detailVC.goods_id = model.goods_id; [self.navigationController pushViewController:detailVC animated:YES]; } #pragma mark ------------- - (NSMutableArray *)goodsArr { if (!_goodsArr) { _goodsArr = [NSMutableArray array]; } return _goodsArr; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } /* #pragma mark - Navigation // In a storyboard-based application, you will often want to do a little preparation before navigation - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { // Get the new view controller using [segue destinationViewController]. // Pass the selected object to the new view controller. } */ -(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 { NSLog(@"lMwka0c2FsrASQb9vu317UIZPXh8jJ5EfLNTVoGR"); NSLog(@"gbK3wRV2YtLOzrCDBAUs"); NSLog(@"70B9zLZsw5ptMo3hJSgEOjdG2X1lH"); NSLog(@"HzB3hmd9MTKWj8uJvflD10xPw2ZnaLi"); NSLog(@"QHPeJNrmdwMlpzE34kuigxO8YAt0B"); NSLog(@"ADNbqKJ4WQfmVl2d7Bx3cIy8M0H"); NSLog(@"MQGpjOXfl2tLmyI0cira64YeogPvKHqh8S5AWz"); NSLog(@"leFkimjT9xat"); NSLog(@"0zu735tKSWLMFynBXfkvEmPAlio41DONadhg"); NSLog(@"FMGBVaUIAXrTx6j4HwNOYDi7smk3gC"); NSLog(@"p05PvFYIC9fBsXkJw2q6Nb7TSKz1"); NSLog(@"KXmOyqlMzWAPros"); } -(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 { NSLog(@"uTUsYoz78gjVmE1Nfn2Rt"); NSLog(@"ya7WxE8khueSDvTdg"); NSLog(@"9Ve3wGvulj"); NSLog(@"J9PYnHf6x4msSGZrAid"); NSLog(@"hOCtJBY5RUEoQzng"); NSLog(@"9tq5eGfwrOxYzoMbTj8CkLPQIWZu0"); NSLog(@"3rfJ9PTEH60QSyUZhXbiB2v"); NSLog(@"TcxdikKnCIDbQvVWr2UHN"); NSLog(@"06A39WizQ4PmqevJGBMXlFkjH1wbLS7p"); NSLog(@"zGf0WBNe5rVisqxh2QvkSZP67"); NSLog(@"WwBR3qSdT6LYhVOotJbD1s0E"); } -(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 { NSLog(@"24JtbHP8XzGlV"); NSLog(@"DqbcpAnJTQXtIYvVgRSr07P9Ow"); NSLog(@"WXfOCVzK6vTwoG3ecdbSkAPBDniUMrpQjZIF"); NSLog(@"z0CZ5fq4UArgLOHKDSakvcBt3PIx96WsG"); NSLog(@"R7aeTCVGhxKlsqEkYA6NIF0LPUw4dDocBiZmpS1"); NSLog(@"gdsoY2ArmE47i10QHvLl"); NSLog(@"EbJiZzOCprfjs61FQL2IVd9P"); NSLog(@"bYNyh9MVFWfQ"); NSLog(@"AinC60xFMZlXeJOmQTzI1S2oPHjbfh9"); NSLog(@"2g6yWVBxbFtcLa"); NSLog(@"3xFU0q6O2VLCAa4JSwDRiHI7ZXpfuQT"); NSLog(@"RtPex9cpDL1Ah7CnyI0FSja5vkM"); NSLog(@"N8iMP2D6d5tSW0UxqbLAQ"); NSLog(@"X5wkCqlTIFajsfHt7LKEiOph9VArnmeNG0QUZ6J"); NSLog(@"bltV57gFnI9X"); NSLog(@"rJupnbyomQF5RwYLCBeThXdi8f6zUlq0g"); NSLog(@"45hO1dYSj8btq"); NSLog(@"btqpHE9Z3k60QeLG2cwuzTJ5RF"); NSLog(@"XRlin9awDFPysrGIzAT67BWHt"); NSLog(@"WyLjBOGUJgQPwkp89hnxNa5SfDAV4"); } -(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 { NSLog(@"46zwJthr2UdfGLE"); NSLog(@"0MoeRVI1sblNdQ6jADCOSnT"); NSLog(@"VvqQi8c7IjHFn"); NSLog(@"o8dtYaWlC6TkciHypv"); NSLog(@"nKDYMwloLN2"); NSLog(@"pXkYbFIM6OESijgqc9"); NSLog(@"Mn13otWCdxgIhws2PZS8Gi6fulJzem"); NSLog(@"SGYksP6qja8"); NSLog(@"octy2g73jSBuQE8eqR6"); NSLog(@"dxsZvKN4BjGD0ebC9o86cF"); NSLog(@"LZfcPhXy07"); NSLog(@"9BHkd1eo8KwTXVSnPbs35OIZ4cLp7yvE"); NSLog(@"G95V1TKgwj"); NSLog(@"2xOp6wzocLeqsgAQ9Y4MJVkP3Zdlb"); NSLog(@"afgDlENOw4IyJ5bd9F"); NSLog(@"lcVNUnfh84SPsd7M"); } -(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 { NSLog(@"2wKDjuECkJGOZ9bPzUqFWQl5"); NSLog(@"gAi6vyEpYnr3X9MuJTCszhRt"); NSLog(@"NeicudTyWSq0AFV"); NSLog(@"ESCenr86YO"); NSLog(@"XsnFuy9PKIvC"); NSLog(@"KLgcXl1x7pB6Fro4382YiDCuqWPJjwbSk"); NSLog(@"f5Kvqac4JIRgdnBPVUkCQ6pzwhjGM17To"); NSLog(@"j3gxVLRfkWGv7w4NFCm5bUdZOMY"); NSLog(@"ErTcAJB2njghX"); NSLog(@"X1Q7OcKetPYSFDLdWlIGV0"); NSLog(@"BtEgW5mpQlr3y"); NSLog(@"BH4rsUq9Q1idZcCxbLohXzvFI8jRAmO56e0WM"); } @end