123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- //
- // YOUPAILZPersonalizedDressVC.m
- // VQU
- //
- // Created by CY on 2021/8/17.
- // Copyright © 2021 leo. All rights reserved.
- //
- #import "YOUPAILZPersonalizedDressVC.h"
- #import "JXCategoryView.h"
- #import "JXCategoryDotView.h"
- #import "YOUPAIHRDressRedModel.h"
- @interface YOUPAILZPersonalizedDressVC ()<JXCategoryViewDelegate,JXCategoryListContainerViewDelegate>
- @property (nonatomic, weak) JXCategoryListContainerView *youpaippagerView;
- //@property (nonatomic, strong) JXCategoryTitleView *categoryView;
- @property (nonatomic, strong) JXCategoryDotView *youpaipcategoryView;
- @property (nonatomic, strong) NSMutableArray *youpaipdotStates;
- @end
- @implementation YOUPAILZPersonalizedDressVC
- - (void)viewDidLoad {
- [super viewDidLoad];
- self.title = @"个性装扮";
-
- [self youpaifinitUI];
- [self youpaifrequestAvatarDressData];
- }
- - (void)youpaifinitUI{
- JXCategoryDotView *categoryView = [[JXCategoryDotView alloc] initWithFrame:CGRectMake((KScreenWidth - 284.0f)/ 2.0f, NavBarHeight, 284.0f, 44.0f)];
- categoryView.backgroundColor = LCBkgColor;
- categoryView.titles = self.titles;
- categoryView.delegate = self;
- categoryView.titleSelectedColor = [UIColor whiteColor];
- categoryView.titleColor = HexColorFromRGB(0x9F9DA5);
- categoryView.titleColorGradientEnabled = YES;
- categoryView.titleFont = LCFont(14.0f);
- categoryView.titleSelectedFont = LCBoldFont(14.0f);
- categoryView.cellSpacing = 28.0f;
- // categoryView.cellWidth = 64.0f;
- categoryView.averageCellSpacingEnabled = YES;
- // categoryView.averageCellSpacingEnabled = NO;
- [self.view addSubview:categoryView];
- self.youpaipcategoryView = categoryView;
- // _dotStates = @[@NO, @YES,@YES,@YES].mutableCopy;
- // categoryView.dotStates = _dotStates;
- categoryView.dotSize = CGSizeMake(4, 4);
- categoryView.dotColor = LCRedColor;
- JXCategoryIndicatorLineView *lineView = [[JXCategoryIndicatorLineView alloc] init];
- lineView.verticalMargin = 4.0f;
- lineView.indicatorHeight = 2.0f;
- lineView.indicatorWidth = 12.0f;
- lineView.indicatorColor = HexColorFromRGB(0xF4003F);
- lineView.indicatorCornerRadius = 1.0f;
- categoryView.indicators = @[lineView];
- JXCategoryListContainerView *pagerView = [[JXCategoryListContainerView alloc] initWithType:JXCategoryListContainerType_CollectionView delegate:self];
- pagerView.frame = CGRectMake(0.0f, NavBarHeight + 44.0f, KScreenWidth, KScreenHeight - (NavBarHeight + 44.0f));
- pagerView.listCellBackgroundColor = LCBkgColor;
- [self.view addSubview:pagerView];
- self.youpaippagerView = pagerView;
- categoryView.listContainer = pagerView;
- }
- - (NSInteger)numberOfListsInlistContainerView:(JXCategoryListContainerView *)listContainerView{
- return self.titles.count;
- }
- - (id<JXCategoryListContentViewDelegate>)listContainerView:(JXCategoryListContainerView *)listContainerView initListForIndex:(NSInteger)index{
- UIViewController *vc = [[NSClassFromString(self.vcNames[index]) alloc] init];
- return vc;
- }
- - (NSArray <NSString *> *)titles{
- return @[@"头像框",@"座驾",@"气泡",@"名片卡"];
- }
- - (NSArray <NSString *> *)vcNames{
- return @[@"YOUPAILZAvatarDressVC",@"YOUPAILZCarDressVC",@"YOUPAILZBubbleDressVC",@"YOUPAILZCardDressVC"];
- }
- #pragma mark - JXCategoryViewDelegate
- - (void)categoryView:(JXCategoryBaseView *)categoryView didSelectedItemAtIndex:(NSInteger)index {
-
- if ([self.youpaipdotStates[index] boolValue] == YES) {
- self.youpaipdotStates[index] = @(NO);
- self.youpaipcategoryView.dotStates = self.youpaipdotStates;
- [categoryView reloadCellAtIndex:index];
- }
- }
- - (void)youpaifrequestAvatarDressData{
- @weakify(self);
- [LCHttpHelper requestWithURLString:GetDressList parameters:nil needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
- @strongify(self);
- NSDictionary* dict = (NSDictionary*)responseObject;
- NSInteger code = [[dict objectForKey:@"code"] integerValue];
- if (code == 0) {//成功
- NSDictionary *data = [dict objectForKey:@"data"];
- YOUPAIHRDressRedModel *model = [YOUPAIHRDressRedModel mj_objectWithKeyValues:data[@"red_dot"]];
- self.youpaipdotStates = @[@NO,@(model.youpaipcar),@(model.youpaipbubble),@(model.youpaipcard)].mutableCopy;
- self.youpaipcategoryView.dotStates = self.youpaipdotStates;
- [self.youpaipcategoryView reloadDataWithoutListContainer];
-
- }
- } failure:^(NSError *error) {
-
- }];
- }
- @end
|