159 lines
5.4 KiB
Mathematica
159 lines
5.4 KiB
Mathematica
|
|
//
|
|||
|
|
// DLJueweiContainerVC.m
|
|||
|
|
// SweetParty
|
|||
|
|
//
|
|||
|
|
// Created by bj_szd on 2023/8/25.
|
|||
|
|
//
|
|||
|
|
|
|||
|
|
#import "DLJueweiContainerVC.h"
|
|||
|
|
#import "DLJueweiVC.h"
|
|||
|
|
|
|||
|
|
@interface DLJueweiContainerVC ()<JXCategoryListContainerViewDelegate>
|
|||
|
|
|
|||
|
|
@property (nonatomic, strong) NSArray *titles;
|
|||
|
|
@property (nonatomic, strong) JXCategoryTitleView *categoryView;
|
|||
|
|
@property (nonatomic, strong) JXCategoryListContainerView *listContainerView;
|
|||
|
|
|
|||
|
|
@property (nonatomic, strong) NSArray *cateArr;
|
|||
|
|
|
|||
|
|
@end
|
|||
|
|
|
|||
|
|
@implementation DLJueweiContainerVC
|
|||
|
|
|
|||
|
|
- (void)viewWillAppear:(BOOL)animated {
|
|||
|
|
[super viewWillAppear:animated];
|
|||
|
|
|
|||
|
|
//默认都是黑色的,只有需要浅色的才需要额外写
|
|||
|
|
LightContentStatusBar;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)viewWillDisappear:(BOOL)animated
|
|||
|
|
{
|
|||
|
|
[super viewWillDisappear:animated];
|
|||
|
|
//默认都是黑色的,只有需要浅色的才需要额外写
|
|||
|
|
BlackContentStatusBar;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
- (void)viewDidLoad {
|
|||
|
|
[super viewDidLoad];
|
|||
|
|
|
|||
|
|
[self showNaviBarWithTitle:@"爵位"];
|
|||
|
|
self.naviView.titleLab.textColor = kBlackColor;
|
|||
|
|
// [self onChangeNaviWhiteStyle];
|
|||
|
|
[self.naviView.backBtn setImage:ImageNamed(@"blackBack") forState:UIControlStateNormal];
|
|||
|
|
|
|||
|
|
[self createUI];
|
|||
|
|
|
|||
|
|
[self fetchData];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)fetchData {
|
|||
|
|
NSDictionary *params = @{};
|
|||
|
|
[AFNetworkRequset.shared postRequestWithParams:params Path:@"/api/nobility/get_nobility_list" Loading:NO Hud:NO Success:^(id _Nonnull responseDic) {
|
|||
|
|
self.cateArr = [responseDic safeArrayForKey:@"data"];
|
|||
|
|
NSMutableArray *titleMArr = [[NSMutableArray alloc] init];
|
|||
|
|
for (NSDictionary *dict in self.cateArr) {
|
|||
|
|
[titleMArr addObject:[dict safeStringForKey:@"name"]];
|
|||
|
|
}
|
|||
|
|
self.titles = [titleMArr copy];
|
|||
|
|
[self createCategoryUI];
|
|||
|
|
} Failure:^(id _Nonnull errorData) {
|
|||
|
|
|
|||
|
|
}];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)createUI {
|
|||
|
|
UIImageView *bgImgV = [[UIImageView alloc] initWithImage:ImageNamed(@"jw_bg")];
|
|||
|
|
[self.view addSubview:bgImgV];
|
|||
|
|
[self.view sendSubviewToBack:bgImgV];
|
|||
|
|
[bgImgV mas_makeConstraints:^(MASConstraintMaker *make) {
|
|||
|
|
make.top.left.right.equalTo(self.view);
|
|||
|
|
make.height.mas_equalTo(ScreenWidth/375*812);
|
|||
|
|
}];
|
|||
|
|
|
|||
|
|
UIButton *rightBtn = [ControlCreator createButton:self.view rect:CGRectMake(ScreenWidth-30-10, yb_StatusBar_H+7, 30, 30) text:@"" font:YBMediumFont(12) color:HEXCOLOR(0x57DDE1) backguoundColor:nil imageName:@"jw_help" target:self action:@selector(onRightClick)];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)onRightClick {
|
|||
|
|
[UIViewController goWebWithUrl:[VERSION_HTTPS_SERVER stringByAppendingString:@"index.php/index/index/page_show?id=11"]];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)createCategoryUI {
|
|||
|
|
[self.view addSubview:self.categoryView];
|
|||
|
|
[self.view addSubview:self.listContainerView];
|
|||
|
|
|
|||
|
|
[self.categoryView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|||
|
|
make.top.mas_equalTo(yb_NavigationBar_H);
|
|||
|
|
make.left.right.mas_equalTo(0);
|
|||
|
|
make.height.mas_equalTo(44);
|
|||
|
|
}];
|
|||
|
|
[self.listContainerView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|||
|
|
make.top.equalTo(self.categoryView.mas_bottom);
|
|||
|
|
make.left.right.bottom.equalTo(self.view);
|
|||
|
|
}];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 分页菜单视图
|
|||
|
|
- (JXCategoryTitleView *)categoryView {
|
|||
|
|
if (!_categoryView) {
|
|||
|
|
_categoryView = [[JXCategoryTitleView alloc] init];
|
|||
|
|
_categoryView.titleFont = YBMediumFont(14);
|
|||
|
|
_categoryView.titleSelectedFont = YBBoldFont(16);
|
|||
|
|
_categoryView.titleColor = HEXCOLORA(0x333333, 0.5);
|
|||
|
|
_categoryView.titleSelectedColor = HEXCOLOR(0x333333);
|
|||
|
|
_categoryView.contentEdgeInsetLeft = 15;
|
|||
|
|
_categoryView.contentEdgeInsetRight = 15;
|
|||
|
|
|
|||
|
|
if (self.nobility_id > 0) {
|
|||
|
|
_categoryView.defaultSelectedIndex = self.nobility_id-1;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
_categoryView.listContainer = self.listContainerView;
|
|||
|
|
_categoryView.titles = self.titles;
|
|||
|
|
|
|||
|
|
// JXCategoryIndicatorImageView *lineView = [[JXCategoryIndicatorImageView alloc] init];
|
|||
|
|
// lineView.indicatorImageViewSize = CGSizeMake(16, 16);
|
|||
|
|
// lineView.indicatorImageView.image = ImageNamed(@"jw_zhishi");
|
|||
|
|
// lineView.verticalMargin = 20;
|
|||
|
|
// lineView.horizontalMargin = 20;
|
|||
|
|
// _categoryView.indicators = @[lineView];
|
|||
|
|
|
|||
|
|
JXCategoryIndicatorLineView *lineView = [[JXCategoryIndicatorLineView alloc] init];
|
|||
|
|
lineView.indicatorColor = HEXCOLOR(0x333333);
|
|||
|
|
lineView.indicatorWidth = 12;
|
|||
|
|
lineView.indicatorHeight = 3;
|
|||
|
|
lineView.indicatorCornerRadius = 1.5;
|
|||
|
|
lineView.verticalMargin = 5;
|
|||
|
|
_categoryView.indicators = @[lineView];
|
|||
|
|
}
|
|||
|
|
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 {
|
|||
|
|
DLJueweiVC *list = [[DLJueweiVC alloc] init];
|
|||
|
|
NSDictionary *dict = self.cateArr[index];
|
|||
|
|
list.lid = [dict safeStringForKey:@"lid"];
|
|||
|
|
list.index = index+1;
|
|||
|
|
|
|||
|
|
return list;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
@end
|