684 lines
26 KiB
Objective-C
684 lines
26 KiB
Objective-C
//
|
|
// QXHomeViewController.m
|
|
// QXLive
|
|
//
|
|
// Created by 启星 on 2025/4/24.
|
|
//
|
|
|
|
#import "QXHomeViewController.h"
|
|
#import "JXCategoryView.h"
|
|
#import "GKCycleScrollView.h"
|
|
#import "QXHomeTopCell.h"
|
|
#import "QXHomeSubViewController.h"
|
|
#import "QXSearchViewController.h"
|
|
#import "QXRankHomeVC.h"
|
|
#import "SDCycleScrollView.h"
|
|
#import "JXPagerView.h"
|
|
#import "QXHomePageNetwork.h"
|
|
#import "QXMyRoomViewController.h"
|
|
#import "QXUserHomePageViewController.h"
|
|
#import "QXNewPeoplePopView.h"
|
|
#import "QXRechargeView.h"
|
|
#import "QXAppstoreHomeView.h"
|
|
#import "QXConfig.h"
|
|
#import "QXSkyPraizeView.h"
|
|
#import "QXRechargePermissionModel.h"
|
|
#import "QXNiceGiftPopView.h" // 天降好礼
|
|
#import "QXFirstRechargeView.h" // 首充好礼
|
|
#import "QXHomeTopView.h"
|
|
#import "QXSystemNoticeViewController.h"
|
|
#import "QXHotRoomViewController.h"
|
|
|
|
@interface QXHomeViewController ()<JXPagerViewDelegate,JXCategoryViewDelegate,GKCycleScrollViewDataSource,GKCycleScrollViewDelegate,QXGiftScrollViewDelegate,SDCycleScrollViewDelegate,QXHomeTopViewDelegate>
|
|
@property (nonatomic, strong) JXPagerView *pagingView;
|
|
@property (nonatomic,strong)JXCategoryTitleView *categoryView;
|
|
@property (nonatomic,strong)NSMutableArray <UIViewController*>*listVCArray;
|
|
@property (nonatomic,strong)NSMutableArray *titles;
|
|
@property (nonatomic,strong)NSArray *titleModelArray;
|
|
//@property (nonatomic,strong)GKCycleScrollView *cycleScrollView;
|
|
@property (nonatomic,strong)QXHomeTopView *topView;
|
|
@property (nonatomic,strong)JXCategoryIndicatorImageView *indicatorView;
|
|
@property (nonatomic,strong)UIButton *rankRightBtn;
|
|
@property (nonatomic,strong)UIButton *searchRightBtn;
|
|
@property (nonatomic,strong)UIButton *roomBtn;
|
|
@property (nonatomic,strong)QXGiftScrollView *giftScrollView;
|
|
@property (nonatomic,strong)SDCycleScrollView *bannerScrollView;
|
|
@property (nonatomic,assign)BOOL isShowGiftScrollView;
|
|
@property (nonatomic,strong)NSMutableArray *bannerArry;
|
|
|
|
@property (nonatomic,strong)UIView *headerView;
|
|
@property (nonatomic,strong)UIView *sectionView;
|
|
|
|
//@property (nonatomic,strong)UIButton *firstRechargeBtn;
|
|
@property (nonatomic,strong)UIButton *skyDownBtn;
|
|
@property (nonatomic,strong)QXNewPeoplePopView *nPeopleRechargeView;
|
|
|
|
//@property (nonatomic,strong)QXAppstoreHomeView *appStoreView;
|
|
@property (nonatomic,strong)SDCycleScrollView *rechargePermissionView;
|
|
@property (nonatomic,strong)NSMutableArray *rechargePermissionArray;
|
|
|
|
@property (nonatomic,strong)QXRechargePermissionModel *permissionModel;
|
|
@end
|
|
|
|
@implementation QXHomeViewController
|
|
|
|
- (void)viewDidLoad {
|
|
self.isNoChangeBgImage = YES;
|
|
[super viewDidLoad];
|
|
// Do any additional setup after loading the view.
|
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(loginSuccess) name:noticeUserLogin object:nil];
|
|
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(rechargeSuccess) name:noticeAlipayResult object:nil];
|
|
}
|
|
-(void)viewWillAppear:(BOOL)animated{
|
|
[super viewWillAppear:animated];
|
|
[self.navigationController setNavigationBarHidden:YES animated:YES];
|
|
[self getRechargePermission];
|
|
}
|
|
|
|
- (void)initSubViews{
|
|
[self updateBgImage:@"app_home_bg"];
|
|
UIImageView *logoImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"yusheng"]];
|
|
[self.view addSubview:logoImageView];
|
|
[logoImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.left.mas_equalTo(16);
|
|
make.top.mas_equalTo(kSafeAreaTop +8);
|
|
make.width.mas_equalTo(110);
|
|
make.height.mas_equalTo(32);
|
|
}];
|
|
|
|
// [self.view addSubview:self.rankRightBtn];
|
|
[self.view addSubview:self.searchRightBtn];
|
|
// [self.view addSubview:self.roomBtn];
|
|
//
|
|
// [self.roomBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
// make.width.mas_equalTo(54);
|
|
// make.height.mas_equalTo(26);
|
|
// make.centerY.equalTo(logoImageView);
|
|
// make.right.equalTo(self.view).offset(-10);
|
|
// }];
|
|
//
|
|
// [self.rankRightBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
// make.right.equalTo(self.roomBtn.mas_left).offset(-10);
|
|
// make.centerY.equalTo(self.roomBtn);
|
|
// make.width.height.mas_equalTo(32);
|
|
// }];
|
|
//
|
|
[self.searchRightBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.width.height.mas_equalTo(32);
|
|
make.centerY.equalTo(logoImageView);
|
|
make.right.equalTo(self.view).offset(-10);
|
|
}];
|
|
|
|
|
|
self.listVCArray = [NSMutableArray array];
|
|
[self requestSlideToolData];
|
|
[self getTopRoomList];
|
|
_pagingView = [[JXPagerView alloc] initWithDelegate:self];
|
|
_pagingView.mainTableView.backgroundColor = [UIColor clearColor];
|
|
self.pagingView.backgroundColor = [UIColor clearColor];
|
|
[self.view addSubview:self.pagingView];
|
|
|
|
self.categoryView.listContainer = (id<JXCategoryViewListContainer>)self.pagingView.listContainerView;
|
|
self.pagingView.listContainerView.listCellBackgroundColor = [UIColor clearColor];
|
|
// [self performSelector:@selector(giftScrollViewShow) afterDelay:5];
|
|
// MJWeakSelf
|
|
@weakify(self)
|
|
self.pagingView.mainTableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
|
|
@strongify(self)
|
|
[self requestSlideToolData];
|
|
[self getTopRoomList];
|
|
[self getBanner];
|
|
}];
|
|
|
|
// self.firstRechargeBtn.hidden = YES;
|
|
// [self.view addSubview:self.firstRechargeBtn];
|
|
// [self.firstRechargeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
// make.bottom.mas_equalTo(-(TabbarContentHeight+5));
|
|
// make.right.equalTo(self.view).offset(-17);
|
|
// make.width.height.mas_equalTo(ScaleWidth(57));
|
|
// }];
|
|
[self getBanner];
|
|
// [self getRechargePermission];
|
|
// self.appStoreView.hidden = YES;
|
|
// [self.view addSubview:self.appStoreView];
|
|
|
|
self.rechargePermissionView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectMake(SCREEN_WIDTH-80-17, SCREEN_HEIGHT-(TabbarContentHeight+90+80), 80, 80) delegate:self placeholderImage:nil];
|
|
self.rechargePermissionView.pageControlBottomOffset = -15;
|
|
self.rechargePermissionView.backgroundColor = [UIColor clearColor];
|
|
self.rechargePermissionView.hidden = YES;
|
|
[self.view addSubview:self.rechargePermissionView];
|
|
}
|
|
- (void)viewDidLayoutSubviews {
|
|
[super viewDidLayoutSubviews];
|
|
|
|
self.pagingView.frame = CGRectMake(0, NavContentHeight, SCREEN_WIDTH, SCREEN_HEIGHT-NavContentHeight-TabbarContentHeight);
|
|
}
|
|
-(void)loginSuccess{
|
|
[self requestSlideToolData];
|
|
[self getTopRoomList];
|
|
[self getBanner];
|
|
}
|
|
-(void)rechargeSuccess{
|
|
[self getRechargePermission];
|
|
}
|
|
- (void)requestSlideToolData {
|
|
@weakify(self)
|
|
[QXHomePageNetwork homeRoomLabelListsuccessBlock:^(NSArray<QXMyRoomType *> * _Nonnull list) {
|
|
@strongify(self)
|
|
[self.titles removeAllObjects];
|
|
NSMutableArray *arr = [NSMutableArray array];
|
|
[self.titles addObjectsFromArray:list];
|
|
for (QXMyRoomType *md in list) {
|
|
[arr addObject:md.label_name];
|
|
}
|
|
self.categoryView.titles = arr;
|
|
[self.categoryView reloadData];
|
|
[self.pagingView.mainTableView.mj_header endRefreshing];
|
|
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
|
[self.pagingView.mainTableView.mj_header endRefreshing];
|
|
}];
|
|
}
|
|
|
|
//-(void)getFirstRechargePermission{
|
|
// @weakify(self)
|
|
// [QXHomePageNetwork getFirstRechargePermissionSuccessBlock:^(BOOL isShow) {
|
|
// @strongify(self)
|
|
// self.firstRechargeBtn.hidden = !isShow;
|
|
// } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
|
//
|
|
// }];
|
|
//}
|
|
-(void)getRechargePermission{
|
|
// sky_drop_gift_icon ,new_people_recharge_icon ,first_recharge_icon
|
|
@weakify(self)
|
|
[QXHomePageNetwork getRechargePermissionSuccessBlock:^(QXRechargePermissionModel * _Nonnull model, BOOL isAppStore) {
|
|
@strongify(self)
|
|
self.permissionModel = model;
|
|
[self.rechargePermissionArray removeAllObjects];
|
|
NSMutableArray *imgs = [NSMutableArray array];
|
|
if (model.day_drop_permission.intValue == 1) {
|
|
[imgs addObject:@"sky_drop_gift_icon"];
|
|
QXRechargeTypeModel *md = [[QXRechargeTypeModel alloc] init];
|
|
md.icon = @"sky_drop_gift_icon";
|
|
md.type = 2;
|
|
[self.rechargePermissionArray addObject:md];
|
|
}
|
|
if (model.first_charge_permission.intValue == 1) {
|
|
[imgs addObject:@"first_recharge_icon"];
|
|
QXRechargeTypeModel *md = [[QXRechargeTypeModel alloc] init];
|
|
md.icon = @"first_recharge_icon";
|
|
md.type = 3;
|
|
[self.rechargePermissionArray addObject:md];
|
|
}
|
|
if (model.n_people_permission.intValue == 1) {
|
|
[imgs addObject:@"new_people_recharge_icon"];
|
|
QXRechargeTypeModel *md = [[QXRechargeTypeModel alloc] init];
|
|
md.icon = @"new_people_recharge_icon";
|
|
md.type = 1;
|
|
[self.rechargePermissionArray addObject:md];
|
|
}
|
|
if (imgs.count==0) {
|
|
return;
|
|
}
|
|
if (isAppStore) {
|
|
self.rechargePermissionView.hidden = YES;
|
|
}else{
|
|
self.rechargePermissionView.hidden = NO;
|
|
}
|
|
self.rechargePermissionView.imageURLStringsGroup = imgs;
|
|
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
|
|
|
}];
|
|
}
|
|
|
|
|
|
//-(void)firstAction{
|
|
// [self popnPeopleRechargeView];
|
|
//// QXSkyPraizeView *v = [[QXSkyPraizeView alloc] init];
|
|
//// [v showInView:self.view];
|
|
//}
|
|
-(void)popnPeopleRechargeView{
|
|
// MJWeakSelf
|
|
// view.giftArray = @[@"",@"",@"",@"",@"",@""];
|
|
self.nPeopleRechargeView.closeActionBlock = ^{
|
|
[[QXGlobal shareGlobal].alertViewController hideViewFinishBlock:^{
|
|
QXLOG(@"页面关闭");
|
|
|
|
}];
|
|
};
|
|
self.nPeopleRechargeView.rechargeActionBlock = ^(NSString * _Nonnull money, NSString * _Nonnull gift_bag_id) {
|
|
[[QXGlobal shareGlobal].alertViewController hideViewFinishBlock:^{
|
|
QXLOG(@"页面关闭");
|
|
QXRechargeView *recharge = [[QXRechargeView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)];
|
|
QXRechargeListModel *model = [[QXRechargeListModel alloc] init];
|
|
model.money = money;
|
|
recharge.selectedModel = model;
|
|
recharge.isPop = YES;
|
|
recharge.gift_bag_id = gift_bag_id;
|
|
recharge.isOnlyDisplayPayType = YES;
|
|
[recharge showInView:KEYWINDOW];
|
|
}];
|
|
};
|
|
[self.nPeopleRechargeView reloadData];
|
|
[[QXGlobal shareGlobal] showView:self.nPeopleRechargeView popType:(PopViewTypeTopToCenter) tapDismiss:NO finishBlock:^{
|
|
|
|
}];
|
|
}
|
|
|
|
-(void)popNiceGiftView{
|
|
MJWeakSelf
|
|
QXNiceGiftPopView *view = [[QXNiceGiftPopView alloc] init];
|
|
view.closeActionBlock = ^{
|
|
[[QXGlobal shareGlobal].alertViewController hideViewFinishBlock:^{
|
|
QXLOG(@"页面关闭");
|
|
|
|
}];
|
|
};
|
|
view.rechargeActionBlock = ^(NSString * _Nonnull money, NSString * _Nonnull gift_bag_id) {
|
|
[[QXGlobal shareGlobal].alertViewController hideViewFinishBlock:^{
|
|
QXLOG(@"页面关闭");
|
|
QXRechargeView *recharge = [[QXRechargeView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)];
|
|
QXRechargeListModel *model = [[QXRechargeListModel alloc] init];
|
|
model.money = money;
|
|
recharge.selectedModel = model;
|
|
recharge.isPop = YES;
|
|
recharge.gift_bag_id = gift_bag_id;
|
|
recharge.isOnlyDisplayPayType = YES;
|
|
[recharge showInView:KEYWINDOW];
|
|
}];
|
|
};
|
|
|
|
view.refreshBlcock = ^{
|
|
[weakSelf getRechargePermission];
|
|
[[QXGlobal shareGlobal].alertViewController hideViewFinishBlock:^{
|
|
QXLOG(@"页面关闭");
|
|
}];
|
|
};
|
|
[[QXGlobal shareGlobal] showView:view popType:(PopViewTypeTopToCenter) tapDismiss:NO finishBlock:^{
|
|
|
|
}];
|
|
}
|
|
-(void)popFirstRechargeView{
|
|
if ([QXGlobal shareGlobal].isAppStore) {
|
|
return;
|
|
}
|
|
if (self.permissionModel.first_charge_permission.intValue != 1) {
|
|
return;
|
|
}
|
|
MJWeakSelf
|
|
QXFirstRechargeView *view = [[QXFirstRechargeView alloc] init];
|
|
view.closeActionBlock = ^{
|
|
[[QXGlobal shareGlobal].alertViewController hideViewFinishBlock:^{
|
|
QXLOG(@"页面关闭");
|
|
|
|
}];
|
|
};
|
|
view.rechargeActionBlock = ^(NSString * _Nonnull money, NSString * _Nonnull gift_bag_id) {
|
|
[[QXGlobal shareGlobal].alertViewController hideViewFinishBlock:^{
|
|
QXLOG(@"页面关闭");
|
|
QXRechargeView *recharge = [[QXRechargeView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)];
|
|
QXRechargeListModel *model = [[QXRechargeListModel alloc] init];
|
|
model.money = money;
|
|
recharge.selectedModel = model;
|
|
recharge.isPop = YES;
|
|
recharge.gift_bag_id = gift_bag_id;
|
|
recharge.isOnlyDisplayPayType = YES;
|
|
[recharge showInView:KEYWINDOW];
|
|
}];
|
|
};
|
|
|
|
view.refreshBlcock = ^{
|
|
[weakSelf getRechargePermission];
|
|
[[QXGlobal shareGlobal].alertViewController hideViewFinishBlock:^{
|
|
QXLOG(@"页面关闭");
|
|
}];
|
|
};
|
|
[[QXGlobal shareGlobal] showView:view popType:(PopViewTypeTopToCenter) tapDismiss:NO finishBlock:^{
|
|
|
|
}];
|
|
}
|
|
|
|
#pragma mark - JXPagingViewDelegate
|
|
|
|
- (UIView *)tableHeaderViewInPagerView:(JXPagerView *)pagerView {
|
|
return self.headerView;
|
|
}
|
|
- (NSUInteger)tableHeaderViewHeightInPagerView:(JXPagerView *)pagerView {
|
|
return self.headerView.height;
|
|
}
|
|
|
|
- (NSUInteger)heightForPinSectionHeaderInPagerView:(JXPagerView *)pagerView {
|
|
return 48;
|
|
}
|
|
- (UIView *)viewForPinSectionHeaderInPagerView:(JXPagerView *)pagerView {
|
|
return self.sectionView;
|
|
}
|
|
|
|
- (NSInteger)numberOfListsInPagerView:(JXPagerView *)pagerView {
|
|
return self.titles.count;
|
|
}
|
|
|
|
- (id<JXPagerViewListViewDelegate>)pagerView:(JXPagerView *)pagerView initListAtIndex:(NSInteger)index {
|
|
QXHomeSubViewController *vc = [[QXHomeSubViewController alloc] init];
|
|
QXMyRoomType *model = self.titles[index];
|
|
vc.roomType = model;
|
|
return vc;
|
|
}
|
|
-(void)categoryView:(JXCategoryBaseView *)categoryView didClickSelectedItemAtIndex:(NSInteger)index{
|
|
|
|
}
|
|
|
|
-(void)giftScrollViewShowWithModel:(QXGiftScrollModel*)model{
|
|
if (self.isShowGiftScrollView == NO) {
|
|
// self.categoryView.frame = CGRectMake(15, self.giftScrollView.bottom, SCREEN_WIDTH-30, 44);
|
|
// self.containerView.frame = CGRectMake(0, self.categoryView.bottom, SCREEN_WIDTH, SCREEN_HEIGHT-self.categoryView.bottom-TabbarHeight);
|
|
self.bannerScrollView.top = self.giftScrollView.bottom+12;
|
|
self.headerView.height += 12+self.giftScrollView.height;
|
|
[self.headerView addSubview:self.giftScrollView];
|
|
// [self.pagingView reloadData];
|
|
[self.pagingView resizeTableHeaderViewHeightWithAnimatable:YES duration:0.1 curve:UIViewAnimationCurveLinear];
|
|
}
|
|
++self.page;
|
|
self.giftScrollView.model = model;
|
|
self.isShowGiftScrollView = YES;
|
|
}
|
|
-(void)giftScrollViewShowWithModelList:(NSArray<QXGiftScrollModel*>*)list{
|
|
if (self.isShowGiftScrollView == NO) {
|
|
self.bannerScrollView.top = self.giftScrollView.bottom+12;
|
|
self.headerView.height += 12+self.giftScrollView.height;
|
|
[self.headerView addSubview:self.giftScrollView];
|
|
[self.pagingView resizeTableHeaderViewHeightWithAnimatable:YES duration:0.1 curve:UIViewAnimationCurveLinear];
|
|
}
|
|
++self.page;
|
|
self.giftScrollView.list = list;
|
|
self.isShowGiftScrollView = YES;
|
|
}
|
|
-(void)didClickGiftScrollView:(QXGiftScrollView *)giftScrollView index:(NSInteger)index model:(QXGiftScrollModel *)model{
|
|
[[QXGlobal shareGlobal] joinRoomWithRoomId:model.roomId isRejoin:NO navagationController:self.navigationController];
|
|
}
|
|
- (void)getTopRoomList {
|
|
@weakify(self)
|
|
[QXHomePageNetwork homeRoomListWithPage:0 is_top:YES label_id:@"" successBlock:^(NSArray<QXRoomListModel *> * _Nonnull list, BOOL isAppStore) {
|
|
@strongify(self)
|
|
[self.dataArray removeAllObjects];
|
|
[self.dataArray addObjectsFromArray:list];
|
|
// if (isAppStore) {
|
|
// self.appStoreView.hidden = NO;
|
|
// }else{
|
|
// self.appStoreView.hidden = YES;
|
|
// }
|
|
// weakSelf.appStoreView.dataArray = list;
|
|
self.topView.dataArray = list;
|
|
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
|
|
|
}];
|
|
|
|
}
|
|
-(void)getBanner{
|
|
@weakify(self)
|
|
[QXHomePageNetwork homeBannerWithType:@"3" successBlock:^(NSArray<QXBanner *> * _Nonnull list) {
|
|
@strongify(self)
|
|
NSMutableArray *arr = [NSMutableArray array];
|
|
for (QXBanner *banner in list) {
|
|
[arr addObject:banner.image];
|
|
}
|
|
[self.bannerArry removeAllObjects];
|
|
[self.bannerArry addObjectsFromArray:list];
|
|
// self.appStoreView.bannerArray = list;
|
|
self.bannerScrollView.imageURLStringsGroup = arr;
|
|
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
|
|
|
}];
|
|
}
|
|
#pragma mark - GKCycleScrollViewDataSource,GKCycleScrollViewDelegate
|
|
- (NSInteger)numberOfCellsInCycleScrollView:(GKCycleScrollView *)cycleScrollView {
|
|
return self.dataArray.count;
|
|
}
|
|
- (GKCycleScrollViewCell *)cycleScrollView:(GKCycleScrollView *)cycleScrollView cellForViewAtIndex:(NSInteger)index {
|
|
GKCycleScrollViewCell *cell = [cycleScrollView dequeueReusableCell];
|
|
if (!cell) {
|
|
cell = [QXHomeTopCell new];
|
|
}
|
|
QXHomeTopCell *topcell = (QXHomeTopCell*)cell;
|
|
topcell.roomModel = [self.dataArray objectAtIndex:index];
|
|
return cell;
|
|
}
|
|
|
|
- (CGSize)sizeForCellInCycleScrollView:(GKCycleScrollView *)cycleScrollView {
|
|
return CGSizeMake(180, 155);
|
|
}
|
|
|
|
- (void)cycleScrollView:(GKCycleScrollView *)cycleScrollView didSelectCellAtIndex:(NSInteger)index {
|
|
QXRoomListModel *model = self.dataArray[index];
|
|
[[QXGlobal shareGlobal] joinRoomWithRoomId:model.room_id isRejoin:NO navagationController:self.navigationController];
|
|
}
|
|
|
|
|
|
#pragma mark - SDCycleScrollViewDelegate
|
|
-(void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didSelectItemAtIndex:(NSInteger)index{
|
|
if (!QXGlobal.shareGlobal.isLogin) {
|
|
[[QXGlobal shareGlobal] logOut];
|
|
return;
|
|
}
|
|
if (cycleScrollView == self.rechargePermissionView) {
|
|
QXRechargeTypeModel *md = self.rechargePermissionArray[index];
|
|
if (md.type == 1) {
|
|
[self popnPeopleRechargeView];
|
|
return;
|
|
}
|
|
if (md.type == 2) {
|
|
[self popNiceGiftView];
|
|
return;
|
|
}
|
|
if (md.type == 3) {
|
|
[self popFirstRechargeView];
|
|
return;
|
|
}
|
|
return;
|
|
}
|
|
|
|
QXBanner *banner = self.bannerArry[index];
|
|
if ([banner.type isEqualToString:@"2"]) {
|
|
QXBaseWebViewController *webVc = [[QXBaseWebViewController alloc] init];
|
|
webVc.urlStr = banner.url;
|
|
[self.navigationController pushViewController:webVc animated:YES];
|
|
}else if ([banner.type isEqualToString:@"3"]){
|
|
[[QXGlobal shareGlobal] joinRoomWithRoomId:banner.aid isRejoin:NO navagationController:self.navigationController];
|
|
}else if ([banner.type isEqualToString:@"4"]){
|
|
QXUserHomePageViewController *userHomePage = [[QXUserHomePageViewController alloc] init];
|
|
userHomePage.user_id = banner.aid;
|
|
[self.navigationController pushViewController:userHomePage animated:YES];
|
|
}
|
|
}
|
|
#pragma mark - QXHomeTopViewDelegate
|
|
-(void)didClickTopViewType:(QXHomeTopClickType)type{
|
|
switch (type) {
|
|
case QXHomeTopClickTypeHotRoom:{
|
|
QXHotRoomViewController *vc = [[QXHotRoomViewController alloc] init];
|
|
vc.list = self.topView.dataArray;
|
|
[self.navigationController pushViewController:vc animated:YES];
|
|
}
|
|
break;
|
|
case QXHomeTopClickTypeMyRoom:
|
|
[self gotoRoom];
|
|
break;
|
|
case QXHomeTopClickTypeRank:
|
|
[self gotoRankVC];
|
|
break;
|
|
case QXHomeTopClickTypeNotice:{
|
|
QXSystemNoticeViewController *vc = [[QXSystemNoticeViewController alloc] init];
|
|
vc.type = 0;
|
|
[self.navigationController pushViewController:vc animated:YES];
|
|
}
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
-(void)gotoRoom{
|
|
if (!QXGlobal.shareGlobal.isLogin) {
|
|
[[QXGlobal shareGlobal] logOut];
|
|
return;
|
|
}
|
|
QXMyRoomViewController *vc = [[QXMyRoomViewController alloc] init];
|
|
[self.navigationController pushViewController:vc animated:YES];
|
|
}
|
|
-(void)gotoSearchVC{
|
|
if (!QXGlobal.shareGlobal.isLogin) {
|
|
[[QXGlobal shareGlobal] logOut];
|
|
return;
|
|
}
|
|
QXSearchViewController *vc = [[QXSearchViewController alloc] init];
|
|
[self.navigationController pushViewController:vc animated:YES];
|
|
}
|
|
-(void)gotoRankVC{
|
|
if (!QXGlobal.shareGlobal.isLogin) {
|
|
[[QXGlobal shareGlobal] logOut];
|
|
return;
|
|
}
|
|
QXRankHomeVC *vc = [[QXRankHomeVC alloc] init];
|
|
[self.navigationController pushViewController:vc animated:YES];
|
|
}
|
|
-(UIButton *)roomBtn{
|
|
if (!_roomBtn) {
|
|
_roomBtn = [[UIButton alloc] init];
|
|
[_roomBtn setImage:[UIImage imageNamed:@"home_room"] forState:UIControlStateNormal];
|
|
[_roomBtn setImage:[UIImage imageNamed:@"home_room"] forState:UIControlStateHighlighted];
|
|
[_roomBtn addTarget:self action:@selector(gotoRoom) forControlEvents:UIControlEventTouchUpInside];
|
|
}
|
|
return _roomBtn;
|
|
}
|
|
- (UIButton *)rankRightBtn {
|
|
if (!_rankRightBtn) {
|
|
_rankRightBtn = [[UIButton alloc] init];
|
|
[_rankRightBtn setImage:[UIImage imageNamed:@"home_ranking"] forState:UIControlStateNormal];
|
|
[_rankRightBtn setImage:[UIImage imageNamed:@"home_ranking"] forState:UIControlStateHighlighted];
|
|
[_rankRightBtn addTarget:self action:@selector(gotoRankVC) forControlEvents:UIControlEventTouchUpInside];
|
|
}
|
|
return _rankRightBtn;
|
|
}
|
|
|
|
- (UIButton *)searchRightBtn {
|
|
if (!_searchRightBtn) {
|
|
_searchRightBtn = [[UIButton alloc] init];
|
|
[_searchRightBtn setImage:[UIImage imageNamed:@"home_search"] forState:UIControlStateNormal];
|
|
[_searchRightBtn setImage:[UIImage imageNamed:@"home_search"] forState:UIControlStateHighlighted];
|
|
[_searchRightBtn addTarget:self action:@selector(gotoSearchVC) forControlEvents:UIControlEventTouchUpInside];
|
|
}
|
|
return _searchRightBtn;
|
|
}
|
|
-(UIView *)sectionView{
|
|
if (!_sectionView) {
|
|
_sectionView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 44)];
|
|
[_sectionView addSubview:self.categoryView];
|
|
}
|
|
return _sectionView;
|
|
}
|
|
-(JXCategoryTitleView *)categoryView{
|
|
if (!_categoryView) {
|
|
_categoryView = [[JXCategoryTitleView alloc] init];
|
|
_categoryView.frame = CGRectMake(15, 0, SCREEN_WIDTH-30, 44);
|
|
_categoryView.delegate = self;
|
|
_categoryView.titleSelectedColor = [UIColor colorWithHexString:@"#FFFFFF"];
|
|
_categoryView.titleColor = RGB16A(0xF1ECFF, 0.45);
|
|
_categoryView.cellWidth = JXCategoryViewAutomaticDimension;
|
|
_categoryView.contentEdgeInsetLeft = 3;
|
|
_categoryView.cellSpacing = 16;
|
|
_categoryView.titleLabelZoomEnabled = YES;
|
|
_categoryView.titleFont = [UIFont boldSystemFontOfSize:16];
|
|
_categoryView.titleSelectedFont = [UIFont boldSystemFontOfSize:20];
|
|
_categoryView.averageCellSpacingEnabled = NO;
|
|
JXCategoryIndicatorImageView *indicatorView = [[JXCategoryIndicatorImageView alloc] init];
|
|
indicatorView.indicatorWidth = JXCategoryViewAutomaticDimension;
|
|
indicatorView.indicatorImageView.image = [UIImage imageNamed:@"home_slider"];
|
|
indicatorView.indicatorImageViewSize = CGSizeMake(50, 28);
|
|
self.indicatorView = indicatorView;
|
|
indicatorView.verticalMargin = 5;
|
|
_categoryView.indicators = @[indicatorView];
|
|
}
|
|
return _categoryView;
|
|
}
|
|
-(UIView *)headerView{
|
|
if (!_headerView) {
|
|
_headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, self.topView.height+self.bannerScrollView.height+10)];
|
|
[_headerView addSubview:self.topView];
|
|
[_headerView addSubview:self.bannerScrollView];
|
|
}
|
|
return _headerView;
|
|
}
|
|
-(SDCycleScrollView *)bannerScrollView{
|
|
if (!_bannerScrollView) {
|
|
_bannerScrollView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectMake(16, self.topView.bottom+10, SCREEN_WIDTH-32, ScaleWidth(95)) delegate:self placeholderImage:nil];
|
|
_bannerScrollView.backgroundColor = [UIColor clearColor];
|
|
_bannerScrollView.bannerImageViewContentMode = UIViewContentModeScaleAspectFill;
|
|
[_bannerScrollView addRoundedCornersWithRadius:8] ;
|
|
_bannerScrollView.delegate = self;
|
|
}
|
|
return _bannerScrollView;
|
|
}
|
|
//-(GKCycleScrollView *)cycleScrollView{
|
|
// if (!_cycleScrollView) {
|
|
// _cycleScrollView = [[GKCycleScrollView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 155)];
|
|
// _cycleScrollView.dataSource = self;
|
|
// _cycleScrollView.delegate = self;
|
|
// _cycleScrollView.minimumCellAlpha = 0.0;
|
|
// _cycleScrollView.leftRightMargin = 16.0f;
|
|
// _cycleScrollView.topBottomMargin = 15.0f;
|
|
// _cycleScrollView.isInfiniteLoop = YES;
|
|
// _cycleScrollView.isAutoScroll = YES;
|
|
// }
|
|
// return _cycleScrollView;
|
|
//}
|
|
-(QXHomeTopView *)topView{
|
|
if (!_topView) {
|
|
_topView = [[QXHomeTopView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, ScaleWidth(184))];
|
|
_topView.delegate = self;
|
|
}
|
|
return _topView;
|
|
}
|
|
-(QXGiftScrollView *)giftScrollView{
|
|
if (!_giftScrollView) {
|
|
_giftScrollView = [[QXGiftScrollView alloc] initWithFrame:CGRectMake(16, self.topView.bottom+12, SCREEN_WIDTH-32, 36)];
|
|
_giftScrollView.delegate = self;
|
|
}
|
|
return _giftScrollView;
|
|
}
|
|
-(NSMutableArray *)titles{
|
|
if (!_titles) {
|
|
_titles = [NSMutableArray array];
|
|
}
|
|
return _titles;
|
|
}
|
|
-(NSMutableArray *)bannerArry{
|
|
if (!_bannerArry) {
|
|
_bannerArry = [NSMutableArray array];
|
|
}
|
|
return _bannerArry;
|
|
}
|
|
|
|
-(QXNewPeoplePopView *)nPeopleRechargeView{
|
|
if (!_nPeopleRechargeView) {
|
|
_nPeopleRechargeView = [[QXNewPeoplePopView alloc] init];
|
|
}
|
|
return _nPeopleRechargeView;
|
|
}
|
|
-(NSMutableArray *)rechargePermissionArray{
|
|
if (!_rechargePermissionArray) {
|
|
_rechargePermissionArray = [NSMutableArray array];
|
|
}
|
|
return _rechargePermissionArray;
|
|
}
|
|
|
|
//-(QXAppstoreHomeView *)appStoreView{
|
|
// if (!_appStoreView) {
|
|
// _appStoreView = [[QXAppstoreHomeView alloc] initWithFrame:CGRectMake(0, NavContentHeight, SCREEN_WIDTH, SCREEN_HEIGHT-NavContentHeight-TabbarContentHeight)];
|
|
// }
|
|
// return _appStoreView;
|
|
//}
|
|
-(void)dealloc{
|
|
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
|
}
|
|
@end
|