Files
yuyin_ios/SweetParty/主类/Mine/GongHui/SPGonghuiVC.m

152 lines
5.4 KiB
Mathematica
Raw Normal View History

2025-08-08 11:05:33 +08:00
//
// SPGonghuiVC.m
// SweetParty
//
// Created by bj_szd on 2022/6/29.
//
#import "SPGonghuiVC.h"
#import "SPGonghuiListVC.h"
#import "SPGonghuiDetailVC.h"
#import "SPGonghuiSearchView.h"
#import "LMGonghuiDetailsViewController.h"
@interface SPGonghuiVC ()<JXCategoryListContainerViewDelegate, JXCategoryViewDelegate>
@property (nonatomic, strong) NSArray *titles;
@property (nonatomic, strong) JXCategoryTitleView *categoryView;
@property (nonatomic, strong) JXCategoryListContainerView *listContainerView;
@property (nonatomic, strong) SPGonghuiSearchView *searchView;
@property (nonatomic, copy) NSString *keywords;
@end
@implementation SPGonghuiVC
- (void)viewDidLoad {
[super viewDidLoad];
self.titles = @[@"昨日", @"今日", @"本周", @"上周", @"月榜"];
[self showNaviBarWithTitle:@"公会"];
[self createUI];
}
-(void)createUI {
self.view.backgroundColor = kWhiteColor;
UIImageView *bgImgV = [[UIImageView alloc] initWithImage:ImageNamed(@"gonghui_bg")];
[self.view insertSubview:bgImgV atIndex:0];
[bgImgV mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.left.right.equalTo(self.view);
make.height.mas_equalTo(ScreenWidth/375*812);
}];
[ControlCreator createButton:self.view rect:CGRectMake(ScreenWidth-60-12, yb_StatusBar_H+7, 60, 30) text:@"我的公会" font:YBMediumFont(13) color:HEXCOLOR(0x111111) backguoundColor:nil imageName:nil target:self action:@selector(onMineGonghui)];
[self.view addSubview:self.searchView];
[self.view addSubview:self.categoryView];
[self.view addSubview:self.listContainerView];
[self.view addSubview:self.searchView];
[self.searchView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.view).offset(yb_NavigationBar_H);
make.left.right.equalTo(self.view);
make.height.mas_equalTo(44);
}];
[self.categoryView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.searchView.mas_bottom).offset(10);
// make.top.equalTo(self.view).offset(yb_NavigationBar_H);
make.left.right.equalTo(self.view);
make.height.mas_equalTo(40);
}];
[self.listContainerView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.categoryView.mas_bottom).offset(0);
make.left.right.bottom.equalTo(self.view);
}];
}
- (void)onMineGonghui {
if ([BJUserManager.userInfo.guild_id integerValue] <= 0) {
[HelpPageDefine showMessage:@"您当前还没有公会哦"];
return;
}
LMGonghuiDetailsViewController *vc = [[LMGonghuiDetailsViewController alloc] init];
vc.guild_id = BJUserManager.userInfo.guild_id;
[self.navigationController pushViewController:vc animated:YES];
}
//
- (JXCategoryTitleView *)categoryView {
if (!_categoryView) {
_categoryView = [[JXCategoryTitleView alloc] init];
_categoryView.titleFont = YBMediumFont(14);
_categoryView.titleSelectedFont = YBBoldFont(16);
_categoryView.titleColor = HEXCOLOR(0x999999);
_categoryView.titleSelectedColor = HEXCOLOR(0x333333);
_categoryView.contentEdgeInsetLeft = 20;
_categoryView.contentEdgeInsetRight = 20;
_categoryView.listContainer = self.listContainerView;
_categoryView.titles = self.titles;
// JXCategoryIndicatorImageView *lineView = [[JXCategoryIndicatorImageView alloc] init];
// lineView.indicatorImageViewSize = CGSizeMake(15, 15);
// lineView.indicatorImageView.image = ImageNamed(@"common_zhishi");
// lineView.verticalMargin = 17;
// lineView.horizontalMargin = 12;
// _categoryView.indicators = @[lineView];
// JXCategoryIndicatorBackgroundView *backgroundView = [[JXCategoryIndicatorBackgroundView alloc] init];
// backgroundView.indicatorWidth = 69;
// backgroundView.indicatorHeight = 27;
// backgroundView.indicatorCornerRadius = 13.5;
// backgroundView.indicatorColor = HEXCOLOR(0xFFE95E);
// _categoryView.indicators = @[backgroundView];
}
return _categoryView;
}
//
- (JXCategoryListContainerView *)listContainerView {
if (!_listContainerView) {
_listContainerView = [[JXCategoryListContainerView alloc] initWithType:JXCategoryListContainerType_ScrollView delegate:self];
}
return _listContainerView;
}
#pragma mark - JXCategoryListContainerViewDelegate
//
- (NSInteger)numberOfListsInlistContainerView:(JXCategoryListContainerView *)listContainerView {
return self.titles.count;
}
// <JXCategoryListContentViewDelegate>
- (id<JXCategoryListContentViewDelegate>)listContainerView:(JXCategoryListContainerView *)listContainerView initListForIndex:(NSInteger)index {
SPGonghuiListVC *list = [[SPGonghuiListVC alloc] init];
list.dateType = index+1;
list.keywords = self.keywords;
return list;
}
- (SPGonghuiSearchView *)searchView {
if (!_searchView) {
_searchView = LoadNib(@"SPGonghuiSearchView");
WEAK_SELF
_searchView.onSearchBlock = ^(NSString * _Nonnull str) {
[weakSelf.view endEditing:YES];
weakSelf.keywords = str;
[weakSelf.listContainerView reloadData];
};
}
return _searchView;
}
@end