Files
featherVoice/QXLive/Mine(音域)/Controller/道具商城/QXPropShopVC.m
2026-01-04 14:01:30 +08:00

121 lines
5.2 KiB
Objective-C

//
// QXPropShopVC.m
// QXLive
//
// Created by 启星 on 2026/1/3.
//
#import "QXPropShopVC.h"
#import "QXMineNetwork.h"
#import "QXPropShopSubVC.h"
#import <SDCycleScrollView/SDCycleScrollView.h>
#import "QXHomePageNetwork.h"
@interface QXPropShopVC ()<JXCategoryViewDelegate,JXCategoryListContainerViewDelegate,SDCycleScrollViewDelegate>
@property (nonatomic,strong)JXCategoryTitleView *categoryView;
@property (nonatomic,strong)JXCategoryListContainerView *containerView;
@property (nonatomic,strong)NSMutableArray <UIViewController*>*listVCArray;
@property (nonatomic,strong)NSMutableArray *titles;
@property (nonatomic,strong)SDCycleScrollView *cycleScrollView;
@end
@implementation QXPropShopVC
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
}
-(void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
[self.navigationController setNavigationBarHidden:NO animated:YES];
}
-(void)setNavgationItems{
[super setNavgationItems];
self.navigationItem.title = QXText(@"道具商城");
}
- (void)initSubViews{
self.view.backgroundColor = [UIColor whiteColor];
// self.titles = @[QXText(@"头像框"),QXText(@"座驾"),QXText(@"气泡"),QXText(@"个人靓号"),QXText(@"房间靓号"),QXText(@"工会靓号")];
self.listVCArray = [NSMutableArray array];
self.cycleScrollView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectMake(15, kSafeAreaTop+44, SCREEN_WIDTH-30, 100) delegate:self placeholderImage:nil];
self.cycleScrollView.bannerImageViewContentMode = UIViewContentModeScaleAspectFill;
self.cycleScrollView.backgroundColor = UIColor.clearColor;
[self.cycleScrollView addRoundedCornersWithRadius:8];
[self.view addSubview:self.cycleScrollView];
self.categoryView = [[JXCategoryTitleView alloc] init];
self.categoryView.frame = CGRectMake(15, self.cycleScrollView.bottom, SCREEN_WIDTH-30, 44);
self.categoryView.delegate = self;
// self.categoryView.titles = self.titles;
self.categoryView.titleSelectedColor = [UIColor colorWithHexString:@"#333333"];
self.categoryView.titleColor = [UIColor colorWithHexString:@"#666666"];
self.categoryView.cellWidth = JXCategoryViewAutomaticDimension;
self.categoryView.contentEdgeInsetLeft = 0;
self.categoryView.cellSpacing = 18;
self.categoryView.contentEdgeInsetLeft = 8;
// self.categoryView.titleLabelZoomScale = 1.1;
self.categoryView.titleLabelZoomEnabled = YES;
self.categoryView.titleFont = [UIFont boldSystemFontOfSize:14];
self.categoryView.titleSelectedFont = [UIFont boldSystemFontOfSize:16];
self.categoryView.averageCellSpacingEnabled = NO;
JXCategoryIndicatorImageView *indicatorView = [[JXCategoryIndicatorImageView alloc] init];
indicatorView.indicatorImageView.image = [UIImage imageNamed:@"home_slider"];
indicatorView.indicatorImageViewSize = CGSizeMake(40, 8);
indicatorView.verticalMargin = 11;
self.categoryView.indicators = @[indicatorView];
self.containerView = [[JXCategoryListContainerView alloc] initWithType:(JXCategoryListContainerType_CollectionView) delegate:self];
self.containerView.frame = CGRectMake(0, self.categoryView.bottom, SCREEN_WIDTH, SCREEN_HEIGHT-self.categoryView.bottom);
[self.view addSubview:self.categoryView];
[self.view addSubview:self.containerView];
self.categoryView.listContainer = self.containerView;
}
-(void)getData{
MJWeakSelf
[QXMineNetwork getDressTypeListSuccessBlock:^(NSArray<QXUserDressTypeModel *> * _Nonnull list) {
[weakSelf.dataArray removeAllObjects];
[weakSelf.dataArray addObjectsFromArray:list];
for (QXUserDressTypeModel*model in list) {
[weakSelf.titles addObject:model.name];
}
weakSelf.categoryView.titles = weakSelf.titles;
[weakSelf.categoryView reloadData];
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
}];
[self getBanner];
}
-(void)getBanner{
@weakify(self)
[QXHomePageNetwork homeBannerWithType:@"7" 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.cycleScrollView.imageURLStringsGroup = arr;
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
}];
}
-(NSInteger)numberOfListsInlistContainerView:(JXCategoryListContainerView *)listContainerView{
return self.dataArray.count;
}
-(id<JXCategoryListContentViewDelegate>)listContainerView:(JXCategoryListContainerView *)listContainerView initListForIndex:(NSInteger)index{
QXPropShopSubVC *vc = [[QXPropShopSubVC alloc] init];
QXUserDressTypeModel *model = self.dataArray[index];
vc.model = model;
return vc;
}
- (void)categoryView:(JXCategoryBaseView *)categoryView didSelectedItemAtIndex:(NSInteger)index {
// self.navigationController.interactivePopGestureRecognizer.enabled = (index == 0);
}
-(NSMutableArray *)titles{
if (!_titles) {
_titles = [NSMutableArray array];
}
return _titles;
}
@end