123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659 |
- //
- // DRChildPageViewController.m
- // YouHuiProject
- //
- // Created by 小花 on 2018/1/16.
- // Copyright © 2018年 kuxuan. All rights reserved.
- //
- #import "DRChildPageViewController.h"
- #import "DRChildPageViewController.h"
- #import "DRChildHeaderView.h"
- #import "DRTypeButtonHeader.h"
- #import "XLPlainFlowLayout.h"
- #import "DRHeaderReusableView.h"
- #import "DRGoodCollectionCell.h"
- #import "DRChildCategoryModel.h"
- #import "DRChildGoodModel.h"
- #import "DRItemListViewController.h"
- #import "DRGoodListViewController.h"
- #import "DRGoodDetailViewController.h"
- #import "SelectView.h"
- #import "DROtherFilterView.h"
- #import "DRTodayModelView.h"
- #import "DRClassifyListController.h"
- #import "DROtherTopCollectionCell.h"
- #import "FSBaseViewController.h"
- #import "FSBaseViewController.h"
- #import "DRChildPageAdView.h"
- #import "AdJumpManager.h"
- #import "DRChildSuperBrand.h"
- #import "DRSuperBrandModel.h"
- #import "DRSearchCoupleWebViewController.h"
- #import <AlibcTradeSDK/AlibcTradeSDK.h>
- #import <AlibabaAuthSDK/ALBBSession.h>
- #import <AlibabaAuthSDK/ALBBSDK.h>
- #import "DRLoginViewController.h"
- static NSString *headerID = @"headerID";
- static NSString *cellID = @"DRGoodCollectionCell";
- static NSString *KSectionHeader = @"SectionHeader";
- static NSString *KLDOtherTopCollectionCell = @"DROtherTopCollectionCell";
- static NSString *KSuperBrandCell = @"KSuperBrandCell";
- static CGFloat selectedViewHeight = 40.f;
- @interface DRChildPageViewController ()
- <
- UICollectionViewDelegate,
- UICollectionViewDataSource,
- XHCollectionViewDelegateFlowLayout,
- JC_SelectViewDelegate,
- YHChildHeaderViewDelegate
- >
- {
- NSInteger _page;
- NSInteger _type;
- NSInteger _is_has_coupon;
- BOOL _changeType;
- CGFloat _lastContentOffset;
- }
- @property (nonatomic, strong) UICollectionView *collectionView;
- @property (nonatomic, strong) NSArray *categoryArr;
- @property (nonatomic, strong) NSMutableArray *goodsArr;
- @property (nonatomic, strong) NSArray *adDataArr;
- @property (nonatomic, strong) NSArray *superBrandList;
- @property (nonatomic, strong) DROtherFilterView *selectedView;
- @property (nonatomic, strong) NSArray *filtrateArray;
- @property (nonatomic, strong) DRChildHeaderView *channelHeader;
- @property (nonatomic, strong) DRChildPageAdView *headAdView;
- @property (nonatomic, strong) DROtherTopCollectionCell *topCell;
- @property (nonatomic, strong) DRChildSuperBrand *childSuperBrand ;
- @end
- @implementation DRChildPageViewController
- - (void)viewDidLoad {
- [super viewDidLoad];
-
- [self configParam];
- [self configCollectionView];
- [self requesFiltrateParam];
- [self loadChannelHeader];
- [self loadAdData];
- [self loadChildSuperBrandData];
- }
- - (void)configParam {
- _page = 0;
- _type = 1; //默认请求推荐的数据
- }
- - (void)configCollectionView {
-
- [self.collectionView removeFromSuperview];
- XLPlainFlowLayout *flowLayout = [[XLPlainFlowLayout alloc]init];
- flowLayout.naviHeight = 0;
- flowLayout.minimumLineSpacing = 5;
- flowLayout.minimumInteritemSpacing = 0;
- flowLayout.headerReferenceSize = CGSizeMake(0, 0);
- self.collectionView = [[UICollectionView alloc]initWithFrame:CGRectMake(0, 2, SCREEN_WIDTH, SCREEN_HEIGHT) collectionViewLayout:flowLayout];
- [self.collectionView registerClass:[DRGoodCollectionCell class] forCellWithReuseIdentifier:cellID];
- [self.collectionView registerClass:[DROtherTopCollectionCell class] forCellWithReuseIdentifier:KLDOtherTopCollectionCell];
- [self.collectionView registerClass:[DRHeaderReusableView class] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:headerID];
- [self.collectionView registerClass:[UICollectionReusableView class] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:KSectionHeader];
- [self.collectionView registerClass:[UICollectionViewCell class] forCellWithReuseIdentifier:KSuperBrandCell];
-
- self.collectionView.backgroundColor = [UIColor clearColor];
- self.collectionView.showsVerticalScrollIndicator = NO;
- self.collectionView.delegate = self;
- self.collectionView.dataSource = self;
- MJRefreshStateHeader *header = [MJRefreshStateHeader headerWithRefreshingBlock:^{
- [self refreshData];
- }];
- header.lastUpdatedTimeLabel.hidden = YES;
-
- self.collectionView.mj_header = header;
-
- self.collectionView.mj_footer = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{
- [self loadMoreData];
- }];
- [self.collectionView.mj_footer beginRefreshing];
- [self.view addSubview: self.collectionView];
-
- [self configCollectionHeader];
- }
- - (void)configCollectionHeader {
-
- // UIView *recomView = [[UIView alloc] initWithFrame:CGRectMake(Fitsize(10), 0, SCREEN_WIDTH-Fitsize(20), Fitsize(208))];
- // recomView.layer.cornerRadius = Fitsize(8);
- // recomView.layer.masksToBounds = YES;
- // topRecomView = recomView;
- // recomView.backgroundColor = [UIColor whiteColor];
- // UILabel *title = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, Fitsize(65), Fitsize(40))];
- // title.font = [UIFont systemFontOfSize:Fitsize(14)];
- // title.textColor = [UIColor homeRedColor];
- // title.centerX = SCREEN_WIDTH/2;
- // title.textAlignment = NSTextAlignmentCenter;
- // title.text = @"热门商品";
- // [recomView addSubview:title];
- //
- // UIImageView *icon = [[UIImageView alloc] initWithFrame:CGRectMake(title.left-15, 0, Fitsize(13), Fitsize(15))];
- // icon.centerY = title.centerY;
- // icon.image = [UIImage imageNamed:@"hotRecom"];
- // [recomView addSubview:icon];
- //
- // UIView *leftLine = [[UIView alloc] initWithFrame:CGRectMake(icon.left-10, 0, 50, 1)];
- // leftLine.right = icon.left-10;
- // leftLine.backgroundColor = [UIColor homeRedColor];
- // leftLine.centerY = title.centerY;
- // [recomView addSubview:leftLine];
- //
- // UIView *rightLine = [[UIView alloc] initWithFrame:CGRectMake(title.right+10, 0, 50, 1)];
- // rightLine.backgroundColor = [UIColor homeRedColor];
- // rightLine.centerY = title.centerY;
- // [recomView addSubview:rightLine];
- //
- // DRTodayModelView *modelView = [[DRTodayModelView alloc] initWithFrame:CGRectMake(0, Fitsize(40), SCREEN_WIDTH-Fitsize(20), Fitsize(168)) titleNumOfLine:1];
- // modelView.isOhterPage = YES;
- // modelView.name = self.model.name;
- // modelView.Id = self.model.Id;
- // self.recommonView = modelView;
- // [recomView addSubview:modelView];
- self.channelHeader = [[DRChildHeaderView alloc] initWithFrame:CGRectMake(Fitsize(10), 0, SCREEN_WIDTH-Fitsize(20), 0) delegete:self];
-
-
- self.headAdView = [[DRChildPageAdView alloc] initWithFrame:CGRectMake(Fitsize(10), 0, SCREEN_WIDTH-Fitsize(20), 0)];
- __weak typeof(self) weakSelf = self;
- self.headAdView.tapAdBlock = ^(AdPopModel * _Nonnull model) {
- if (model) {
- [AdJumpManager jumpToPageWithModel:model ParentViewControll:weakSelf];
- }
- };
-
-
-
- }
- #pragma mark ====================== Load Data ==========
- - (void)loadAdData {
- NSString *url = [NSString stringWithFormat:@"%@/api/v2/adv/advByType",BaseURL];
- NSDictionary *para = @{@"adv_type":@"7",
- @"category_id":self.model.Id};
- [DRHttp get:url params:para success:^(id json) {
-
- self.adDataArr = [NSArray yy_modelArrayWithClass:[AdPopModel class] json:json[@"data"]];
- if (self.adDataArr.count > 0) {
- //展示广告
- self.headAdView.height = Fitsize(111);
- self.headAdView.y = self.channelHeader.height+5;
- AdPopModel *model = self.adDataArr.firstObject;
- [self.headAdView setAdModel:model];
- }else {
- //隐藏广告
- self.headAdView.y = self.channelHeader.height+5;
- self.headAdView.height = 0;
- }
- [self.collectionView reloadData];
- } failure:^(NSError *error) {
-
- }];
- }
- /**
- 加载超级大牌
- */
- - (void)loadChildSuperBrandData {
- NSString *url = [NSString stringWithFormat:@"%@/api/v2/channel/SuperBrand",BaseURL];
- NSDictionary *para = @{@"position":@"2",
- @"category_id":self.model.Id
- };
- [DRCacheHttp post:url params:para success:^(id json, BOOL isCache) {
- self.superBrandList = [NSArray yy_modelArrayWithClass:[DRSuperBrandModel class] json:json[@"data"]];
- [self.childSuperBrand setSuperBrandData:self.superBrandList];
- [self.collectionView reloadData];
- } failure:^(NSError *error) {
-
- }];
- }
- #pragma mark ====================== Load Data ==========
- /**
- 加载筛选范围
- */
- - (void)requesFiltrateParam {
- NSString *urlString = [NSString stringWithFormat:@"%@/api/categoryNew/priceSection", BaseURL];
- [DRHttp post:urlString params:nil success:^(id json) {
- self.filtrateArray = json[@"data"];
- // [self.view addSubview:self.selectedView];
-
- } failure:^(NSError *error) {
-
- }];
- }
- /**
- 加载下部商品列表
- */
- - (void)loadCategoryGoodsList:(BOOL)refresh switchButton:(UIButton *)switchButton{
-
-
- NSDictionary *param = @{@"page":@(_page),
- @"category_id":self.model.Id,
- @"sort":@(_type),
- @"is_has_coupon":@(_is_has_coupon),
- @"stype":@"0"
- };
- NSString *url = [NSString stringWithFormat:@"%@/api/v2/goods/stockTopCategoryList",BaseURL];
- [DRHttp post:url params:param success:^(id json) {
-
- if (refresh) [self.goodsArr removeAllObjects];
- if ([self.collectionView.mj_header isRefreshing])[self.goodsArr removeAllObjects];
-
-
- NSArray *list = [NSArray yy_modelArrayWithClass:[DRChildGoodModel class] json:json[@"data"][@"list"]];
- [self.goodsArr addObjectsFromArray:list];
- [self noMoreDataWithArray:list];
- [self.collectionView reloadData];
-
- [self.collectionView.mj_header endRefreshing];
- [self.collectionView.mj_footer endRefreshing];
- [SVProgressHUD dismiss];
- switchButton.selected = !switchButton.selected;
-
-
- } failure:^(NSError *error) {
- [self.collectionView.mj_header endRefreshing];
- [self.collectionView.mj_footer endRefreshing];
- [SVProgressHUD dismiss];
- [MBProgressHUD showMessage:@"加载失败"];
- }];
- }
- - (void)noMoreDataWithArray:(NSArray *)array {
- if (array > 0) {
- self.collectionView.footRefreshState = MJFooterRefreshStateLoadMore;
- }else {
- self.collectionView.footRefreshState = MJFooterRefreshStateNoMore;
- }
- }
- /**
- 加载头部分类
- */
- - (void)loadChannelHeader {
- NSString *url = [NSString stringWithFormat:@"%@/api/v2/channel/getSonGroup",BaseURL];
- NSDictionary *para = @{@"category_id":self.model.Id};
- [DRHttp post:url params:para success:^(id json) {
-
- NSArray *list = [NSArray yy_modelArrayWithClass:[DRChildCategoryModel class] json:json[@"data"]];
- [self.channelHeader setChannelDataArr:list];
- self.headAdView.y = self.channelHeader.bottom+5;
-
- [self.collectionView reloadData];
- [self loadCategoryGoodsList:NO switchButton:nil];
-
- } failure:^(NSError *error) {
- [self.collectionView.mj_header endRefreshing];
- [self.collectionView.mj_footer endRefreshing];
- }];
- }
- /**
- 上拉加载
- */
- - (void)loadMoreData {
- _page++;
- [self loadCategoryGoodsList:NO switchButton:nil];
- }
- - (void)refreshData {
- _page = 1;
- [self loadChannelHeader];
- [self loadChildSuperBrandData];
- // [self loadCategoryGoodsList:YES switchButton:nil];
- }
- #pragma mark ------ YHChildHeaderViewDelegate --------
- - (void)YHChildHeaderViewDidSelectedIndex:(NSInteger)index model:(DRChildCategoryModel *)model {
- DRClassifyListController *list = [[DRClassifyListController alloc] init];
- list.firstCategoryId = self.model.Id;
- list.cate_id = model.Id;
- list.name = model.name;
- list.isOtherPage = YES;
- [self.navigationController pushViewController:list animated:YES];
-
- NSString *tag = [NSString stringWithFormat:@"%@-%@",self.model.name,model.name];
- [MobClick event:CategoryClassify label:tag];
- }
- #pragma mark -------JC_SelectViewDelegate
- //仅显示优惠券
- - (void)selectItme:(DROtherFilterView *)selectView onlyTicketClick:(UIButton *)switchBtn {
- [SVProgressHUD show];
- [self.collectionView scrollToTop];
- _is_has_coupon = switchBtn.selected ? 0 : 1;
- [self loadCategoryGoodsList:YES switchButton:switchBtn];
- }
- //上方条件选择
- - (void)selectTopButton:(DROtherFilterView *)selectView withIndex:(NSInteger)index withButtonType:(JCButtonClickType )type1 button:(UIButton *)button{
- [SVProgressHUD show];
- //价格
- if (index == 2&&type1) {
- switch (type1) {
- case JCButtonClickTypeNormal:
- //正常价格
- {
- NSLog(@"上边按钮的正常价格");
- }
- break;
- case JCButtonClickTypeUp:
- //价格升序排列
- {
- NSLog(@"上边按钮的价格升序排列");
- _type = 3;
- }
- break;
- case JCButtonClickTypeDown:
- //价格降序排列
- {
- NSLog(@"上边按钮的价格降序排列");
- _type = 4;
- }
- break;
- default:
- break;
- }
- }else if (index == 0){//综合
-
- NSLog(@"上边按钮的综合");
- _type = 1;
-
- }else if (index == 1){//销量
-
- NSLog(@"上边按钮的销量");
- _type = 2;
-
- }else{//筛选
- _is_has_coupon = button.selected ? 0 : 1;
- [self loadCategoryGoodsList:YES switchButton:button];
- return;
- NSLog(@"上边有券按钮");
- }
-
- [self loadCategoryGoodsList:YES switchButton:nil];
- }
- #pragma mark ------
- #pragma mark - scrollView
- - (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate {
-
- }
- - (void)scrollViewDidScroll:(UIScrollView *)scrollView
- {
- if (scrollView.contentOffset.y < 0 || [self.collectionView.mj_footer isRefreshing]) {
- return;
- }
- //scrollView已经有拖拽手势,直接拿到scrollView的拖拽手势
- UIPanGestureRecognizer *pan = scrollView.panGestureRecognizer;
- //获取到拖拽的速度 >0 向下拖动 <0 向上拖动
- CGFloat velocity = [pan velocityInView:scrollView].y;
- // if (velocity <- 10) {
- // //向上拖动,隐藏导航栏
- //
- // self.collectionView.height = ChildTableViewHeight+NavBarHeight-KStatusBarHeight;
- // }else if (velocity > 10) {
- // //向下拖动,显示导航栏
- //
- // self.collectionView.height = ChildTableViewHeight;
- // }else if(velocity == 0){
- // //停止拖拽
- // }
- //
- CGFloat offY = scrollView.contentOffset.y - _lastContentOffset;
- NSNotification *noti = [[NSNotification alloc] initWithName:ScrollDirectorNoti object:nil userInfo:@{@"director":@(velocity),@"offY":@(offY)}];
- [[NSNotificationCenter defaultCenter] postNotification:noti];
- _lastContentOffset = scrollView.contentOffset.y;
-
- }
- #pragma mark ============ UICollectionView Delegate && DataSource ==========
- - (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView {
- return 2;
- }
- - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
- {
- if (section == 0) {
- if (self.superBrandList.count == 0) {
- //没有拿到超级大牌数据
- return 1;
- }
- return 2;
- }else {
- return self.goodsArr.count;
- }
-
- }
- - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
-
- if (indexPath.section == 0) {
- if (indexPath.row == 0) {
- CGFloat height = self.headAdView.bottom+.1;
- return CGSizeMake(SCREEN_WIDTH, height);
- }else {
- return CGSizeMake(SCREEN_WIDTH-20, 105+SCREEN_WIDTH*72/710);
- }
-
- }else {
- DRChildGoodModel *model = self.goodsArr[indexPath.row];
- CGFloat width = (SCREEN_WIDTH-25)/2;
- CGFloat height = width + 122;
- if (model.commission_price.length > 0) {
-
- }
- return CGSizeMake(width, height);
- }
-
-
- }
- - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
- {
-
- if (indexPath.section == 0) {
- if (indexPath.row == 0) {
- self.topCell = [collectionView dequeueReusableCellWithReuseIdentifier:KLDOtherTopCollectionCell forIndexPath:indexPath];
- [self.topCell addSubview:self.channelHeader];
- [self.topCell addSubview:self.headAdView];
- return self.topCell;
- }else {
- UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:KSuperBrandCell forIndexPath:indexPath];
- [cell addSubview:self.childSuperBrand];
- return cell;
- }
-
- }else {
- DRGoodCollectionCell *cell = [self.collectionView dequeueReusableCellWithReuseIdentifier:cellID forIndexPath:indexPath];
- DRChildGoodModel *model = self.goodsArr[indexPath.row];
- cell.model = model;
- return cell;
- }
-
- }
- - (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section {
- if (section == 0 ) {
- if (self.adDataArr.count==0) {
- return 0;
- }else {
-
- }
-
- }
- return 5;
- }
- - (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath {
- UICollectionReusableView *header = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:KSectionHeader forIndexPath:indexPath];
- [header addSubview:self.selectedView];
- return header;
- }
- - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
- if (indexPath.section == 0) {
- if (indexPath.row == 1) {
- FSBaseViewController *faVC= [[FSBaseViewController alloc]init];
- faVC.model = self.model;
- [self.navigationController pushViewController:faVC animated:YES];
- }
- }
-
- if (indexPath.section == 1) {
- DRChildGoodModel *model = self.goodsArr[indexPath.row];
- if ([model.type isEqualToString:@"1"]) {
- //专场
- DRGoodListViewController *list = [[DRGoodListViewController alloc] init];
- list.cate_id = model.goods_id;
- list.topRequest = 1;
- [self.navigationController pushViewController:list animated:YES];
- }else {
- //详情
- DRGoodDetailViewController *detail = [[DRGoodDetailViewController alloc] init];
- DetailRequestModel *requestModel = [[DetailRequestModel alloc] initWithChildModel:model];
- detail.requestModel = requestModel;
-
- DREventModel *evevtModel = [[DREventModel alloc] initWithOrigin:model.origin category_id:self.model.Id source:homeAction];
- detail.eventModel = evevtModel;
-
- [self.navigationController pushViewController:detail animated:YES];
-
- }
- }
-
-
-
- [MobClick event:category_goods label:self.model.name];
- }
- - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section {
- if (section == 0) {
- return CGSizeMake(0, 0);
- }else {
- return CGSizeMake(SCREEN_WIDTH, selectedViewHeight);
- }
-
- }
- - (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout insetForSectionAtIndex:(NSInteger)section{
- if (section == 0) {
- return UIEdgeInsetsMake(0, 0, 0, 0);
- }else{
- return UIEdgeInsetsMake(0, FITSIZE(10), 0, FITSIZE(10));
- }
- }
- - (UIColor *)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout backgroundColorForSection:(NSInteger)section {
- if (section == 0) {
- return [UIColor clearColor];
- }else {
- return [UIColor yhGrayColor];
- }
- }
- #pragma mark -------------
- - (NSMutableArray *)goodsArr {
- if (!_goodsArr) {
- _goodsArr = [NSMutableArray array];
- }
- return _goodsArr;
- }
- - (DROtherFilterView *)selectedView {
- if (!_selectedView) {
- _selectedView = [[DROtherFilterView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, selectedViewHeight) withArr:self.filtrateArray];
- _selectedView.delegate = self;
- }
- return _selectedView;
- }
- - (DRChildSuperBrand *)childSuperBrand {
- if (!_childSuperBrand) {
- _childSuperBrand = [[DRChildSuperBrand alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH-20, 100+SCREEN_WIDTH*72/710)];
- _childSuperBrand.layer.cornerRadius = 6;
- _childSuperBrand.layer.masksToBounds = YES;
- __weak typeof(self) weakSelf = self;
- _childSuperBrand.selectedClick = ^(DRSuperBrandModel *model) {
- //点击大牌商品
- DRSearchCoupleWebViewController *searchCoupleWeb = [[DRSearchCoupleWebViewController alloc] init];
-
- searchCoupleWeb.url = model.url;
- searchCoupleWeb.jsString = model.ios_js_string;
- searchCoupleWeb.name = model.name;
- if ([[ALBBSession sharedInstance] isLogin]) {
- //进入
- [weakSelf.navigationController pushViewController:searchCoupleWeb animated:YES];
- }else{
- //淘宝未授权
- ALBBSDK *albbSDK = [ALBBSDK sharedInstance];
- [albbSDK setAppkey:ALBC_APP_KEY];
- [albbSDK setAuthOption:NormalAuth];
-
- [albbSDK auth:weakSelf successCallback:^(ALBBSession *session){
- [[NSNotificationCenter defaultCenter] postNotificationName:ChangeTaoBaoAuthor object:nil];
- [weakSelf.navigationController pushViewController:searchCoupleWeb animated:YES];
- } failureCallback:^(ALBBSession *session,NSError *error){
- NSLog(@"session == %@,error == %@",session,error);
- }];
- }
- };
- _childSuperBrand.moreClick = ^{
- //点击更多
- //点击更多
- FSBaseViewController *faVC= [[FSBaseViewController alloc]init];
- faVC.model=weakSelf.model;
- [weakSelf.navigationController pushViewController:faVC animated:YES];
- };
- }
- return _childSuperBrand;
- }
- - (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.
- }
- */
- @end
|