This commit is contained in:
启星
2025-08-08 10:49:36 +08:00
parent 6400cf78bb
commit b5ce3d580a
8780 changed files with 978183 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
//
// QXBackpackSubViewController.h
// QXLive
//
// Created by 启星 on 2025/5/16.
//
#import "QXBaseViewController.h"
#import "JXCategoryView.h"
NS_ASSUME_NONNULL_BEGIN
@interface QXBackpackSubViewController : QXBaseViewController<JXCategoryListContentViewDelegate>
/// 0背包道具 1背包收入 2背包支出
@property (nonatomic,assign)NSInteger type;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,167 @@
//
// QXBackpackSubViewController.m
// QXLive
//
// Created by on 2025/5/16.
//
#import "QXBackpackSubViewController.h"
#import "QXGiftCell.h"
#import "QXBackpackRecordCell.h"
#import "QXMineNetwork.h"
@interface QXBackpackSubViewController ()<UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout>
@property (nonatomic,strong)UICollectionView *collectionView;
@end
@implementation QXBackpackSubViewController
-(UIView *)listView{
return self.view;
}
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
}
- (void)initSubViews{
self.page = 1;
self.bgImageHidden = YES;
if (self.type == 0) {
[self getBagList];
self.collectionView.frame = CGRectMake(0, 12, SCREEN_WIDTH, SCREEN_HEIGHT-NavContentHeight-44-10);
}else{
[self getGiftRecordListIsIncome:self.type == 1];
[self.collectionView addRoundedCornersWithRadius:16];
self.collectionView.backgroundColor = [UIColor whiteColor];
self.collectionView.frame = CGRectMake(16, 12, SCREEN_WIDTH-32, SCREEN_HEIGHT-NavContentHeight-44-10);
}
[self.view addSubview:self.collectionView];
}
-(void)getBagList{
MJWeakSelf
[QXMineNetwork getBagListSuccessBlock:^(NSArray * _Nonnull list) {
[weakSelf.dataArray removeAllObjects];
[weakSelf.dataArray addObjectsFromArray:list];
[weakSelf.collectionView reloadData];
[weakSelf.collectionView.mj_header endRefreshing];
[weakSelf.collectionView.mj_footer endRefreshing];
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
[weakSelf.collectionView.mj_header endRefreshing];
[weakSelf.collectionView.mj_footer endRefreshing];
}];
}
-(void)getGiftRecordListIsIncome:(BOOL)isIncom{
MJWeakSelf
if (isIncom) {
[QXMineNetwork getBagIncomeListWithPage:self.page successBlock:^(NSArray * _Nonnull list) {
if (self.page == 1) {
[self.dataArray removeAllObjects];
}
if (list.count == 0) {
weakSelf.collectionView.mj_footer.state = MJRefreshStateNoMoreData;
}else{
[weakSelf.collectionView.mj_footer endRefreshing];
}
[weakSelf.dataArray addObjectsFromArray:list];
[weakSelf.collectionView reloadData];
[weakSelf.collectionView.mj_header endRefreshing];
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
[weakSelf.collectionView.mj_header endRefreshing];
[weakSelf.collectionView.mj_footer endRefreshing];
}];
}else{
[QXMineNetwork getBagOutcomeListWithPage:self.page successBlock:^(NSArray * _Nonnull list) {
if (self.page == 1) {
[self.dataArray removeAllObjects];
}
if (list.count == 0) {
weakSelf.collectionView.mj_footer.state = MJRefreshStateNoMoreData;
}else{
[weakSelf.collectionView.mj_footer endRefreshing];
}
[weakSelf.dataArray addObjectsFromArray:list];
[weakSelf.collectionView reloadData];
[weakSelf.collectionView.mj_header endRefreshing];
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
[weakSelf.collectionView.mj_header endRefreshing];
[weakSelf.collectionView.mj_footer endRefreshing];
}];
}
}
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
return self.dataArray.count;
}
-(__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
if (self.type == 0) {
QXGiftCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"QXGiftCell" forIndexPath:indexPath];
cell.cellType = QXGiftCellTypeBackpack;
cell.roomGiftModel = self.dataArray[indexPath.row];
return cell;
}else{
QXBackpackRecordCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"QXBackpackRecordCell" forIndexPath:indexPath];
if (indexPath.row == (self.dataArray.count - 1)) {
cell.lineView.hidden = YES;
}else{
cell.lineView.hidden = NO;
}
cell.model = self.dataArray[indexPath.row];
return cell;
}
}
-(CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath{
if (self.type == 0) {
CGFloat width = (SCREEN_WIDTH-15*2-22*2)/3;
return CGSizeMake(width, width/100*136);
}else{
return CGSizeMake(SCREEN_WIDTH-32, 67);
}
}
-(CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section{
if (self.type == 0) {
return 22;
}
return 0;
}
-(CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section{
if (self.type == 0) {
return 22;
}
return 0;
}
-(UICollectionView *)collectionView{
if (!_collectionView) {
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
layout.minimumLineSpacing = 22;
layout.minimumInteritemSpacing = 22;
layout.sectionInset = UIEdgeInsetsMake(0, 15, 0, 15);
_collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, 12, SCREEN_WIDTH, SCREEN_HEIGHT-NavContentHeight-44-10) collectionViewLayout:layout];
_collectionView.delegate = self;
_collectionView.dataSource = self;
_collectionView.backgroundColor = [UIColor clearColor];
[_collectionView registerNib:[UINib nibWithNibName:@"QXGiftCell" bundle:[NSBundle mainBundle]] forCellWithReuseIdentifier:@"QXGiftCell"];
[_collectionView registerNib:[UINib nibWithNibName:@"QXBackpackRecordCell" bundle:[NSBundle mainBundle]] forCellWithReuseIdentifier:@"QXBackpackRecordCell"];
MJWeakSelf
_collectionView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
weakSelf.page = 1;
if (weakSelf.type == 0) {
[weakSelf getBagList];
}else{
[weakSelf getGiftRecordListIsIncome:self.type == 1];
}
}];
_collectionView.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{
weakSelf.page++;
if (weakSelf.type == 0) {
[weakSelf getBagList];
}else{
[weakSelf getGiftRecordListIsIncome:self.type == 1];
}
}];
}
return _collectionView;
}
@end

View File

@@ -0,0 +1,16 @@
//
// QXBackpackViewController.h
// QXLive
//
// Created by 启星 on 2025/5/9.
//
#import "QXBaseViewController.h"
NS_ASSUME_NONNULL_BEGIN
@interface QXBackpackViewController : QXBaseViewController
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,77 @@
//
// QXBackpackViewController.m
// QXLive
//
// Created by on 2025/5/9.
//
#import "QXBackpackViewController.h"
#import "JXCategoryView.h"
#import "QXBackpackSubViewController.h"
@interface QXBackpackViewController ()<JXCategoryViewDelegate,JXCategoryListContainerViewDelegate>
@property (nonatomic,strong)JXCategoryTitleView *categoryView;
@property (nonatomic,strong)JXCategoryListContainerView *containerView;
@property (nonatomic,strong)NSMutableArray <UIViewController*>*listVCArray;
@property (nonatomic,strong)NSArray *titles;
@end
@implementation QXBackpackViewController
- (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 = @"我的背包";
}
- (void)initSubViews{
self.view.backgroundColor = [UIColor whiteColor];
self.titles = @[QXText(@"背包道具"),QXText(@"背包收入"),QXText(@"背包支出")];
self.listVCArray = [NSMutableArray array];
self.categoryView = [[JXCategoryTitleView alloc] init];
self.categoryView.frame = CGRectMake(15, kSafeAreaTop+44, 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_ScrollView) 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;
}
-(NSInteger)numberOfListsInlistContainerView:(JXCategoryListContainerView *)listContainerView{
return self.titles.count;
}
-(id<JXCategoryListContentViewDelegate>)listContainerView:(JXCategoryListContainerView *)listContainerView initListForIndex:(NSInteger)index{
QXBackpackSubViewController *vc = [[QXBackpackSubViewController alloc] init];
vc.type = index;
return vc;
}
- (void)categoryView:(JXCategoryBaseView *)categoryView didSelectedItemAtIndex:(NSInteger)index {
self.navigationController.interactivePopGestureRecognizer.enabled = (index == 0);
}
@end