YOUPAIHRChatRoomDetailVC.m 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. //
  2. // YOUPAIHRChatRoomDetailVC.m
  3. // VQU
  4. //
  5. // Created by xiaohaoran on 2021/11/2.
  6. // Copyright © 2021 MS. All rights reserved.
  7. //
  8. #import "YOUPAIHRChatRoomDetailVC.h"
  9. #import "JXCategoryView.h"
  10. #import "YOUPAIJXCategoryTitleBackgroundView.h"
  11. #import "JXCategoryListContainerView.h"
  12. #import "YOUPAIHRChatRoomSubDetailVC.h"
  13. #import "YOUPAILZLiveCategoryModel.h"
  14. @interface YOUPAIHRChatRoomDetailVC ()<JXCategoryViewDelegate,JXCategoryListContainerViewDelegate>
  15. @property(nonatomic,strong)UICollectionView *collectionView;
  16. @property (nonatomic, copy) void(^scrollCallback)(UIScrollView *scrollView);
  17. @property (nonatomic, strong) NSArray <YOUPAILZLiveCategoryModel *> *youpaipcategorys;
  18. @property (nonatomic, strong) NSMutableArray *youpaiptypeArr;
  19. @end
  20. @implementation YOUPAIHRChatRoomDetailVC
  21. - (void)viewDidLoad {
  22. [super viewDidLoad];
  23. self.youpaiptypeArr = [NSMutableArray new];
  24. [self youpaifrequestCategoryListData];
  25. }
  26. - (void)youpaifsetupUI{
  27. YOUPAIJXCategoryTitleBackgroundView *youpaipcategoryView = [[YOUPAIJXCategoryTitleBackgroundView alloc] init];//WithFrame:CGRectMake(0.0f, 14.0f, KScreenWidth, 26.0f)
  28. youpaipcategoryView.backgroundColor = [UIColor clearColor];
  29. NSMutableArray <NSString *>*titles = [NSMutableArray array];
  30. for (YOUPAILZLiveCategoryModel *model in self.youpaipcategorys) {
  31. [titles addObject:model.youpaiptitle];
  32. [self.youpaiptypeArr addObject:model.youpaipid];
  33. }
  34. youpaipcategoryView.titles = titles.copy;
  35. youpaipcategoryView.delegate = self;
  36. youpaipcategoryView.titleColor = [UIColor whiteColor];
  37. youpaipcategoryView.titleColorGradientEnabled = YES;
  38. youpaipcategoryView.titleLabelMaskEnabled = YES;
  39. youpaipcategoryView.titleFont = LCFont(14.0f);
  40. youpaipcategoryView.cellWidth = 50.0f;
  41. youpaipcategoryView.cellSpacing = 9;
  42. youpaipcategoryView.averageCellSpacingEnabled = NO;
  43. youpaipcategoryView.normalBackgroundColor = HexColorFromRGB(0x4F4B5B);
  44. youpaipcategoryView.selectedBackgroundColor = HexColorFromRGBA(0xF4003F, 0.14);
  45. youpaipcategoryView.cellWidthIncrement = 0;
  46. youpaipcategoryView.contentEdgeInsetLeft = ScaleSize(14);
  47. youpaipcategoryView.normalBorderColor = [UIColor clearColor];
  48. youpaipcategoryView.selectedBorderColor = [UIColor clearColor];
  49. youpaipcategoryView.borderLineWidth = 0;
  50. youpaipcategoryView.backgroundCornerRadius = 13.0f;
  51. youpaipcategoryView.backgroundWidth = JXCategoryViewAutomaticDimension;
  52. youpaipcategoryView.backgroundHeight = 26.0f;
  53. JXCategoryListContainerView *pagerView = [[JXCategoryListContainerView alloc] initWithType:JXCategoryListContainerType_CollectionView delegate:self];
  54. pagerView.listCellBackgroundColor = LCBkgColor;
  55. // pagerView.frame = CGRectMake(0.0f, CGRectGetMaxY(youpaipcategoryView.frame) + 14.0f, KScreenWidth, KScreenHeight - CGRectGetMaxY(youpaipcategoryView.frame) - NavBarHeight - 10.0f - TabbarHeight - 14.0f);
  56. [self.view addSubview:pagerView];
  57. youpaipcategoryView.listContainer = pagerView;
  58. [self.view addSubview:youpaipcategoryView];
  59. [youpaipcategoryView mas_makeConstraints:^(MASConstraintMaker *make) {
  60. make.left.right.offset(0.0f);
  61. make.top.offset(10);
  62. make.height.offset(28.0f);
  63. }];
  64. [pagerView mas_makeConstraints:^(MASConstraintMaker *make) {
  65. make.left.right.bottom.offset(0.0f);
  66. make.top.equalTo(youpaipcategoryView.mas_bottom).offset(14.0f);
  67. }];
  68. }
  69. - (void)youpaifrequestCategoryListData{
  70. @weakify(self);
  71. [LCHttpHelper requestWithURLString:GetLiveCateList parameters:@{@"live_type":@"2"} needToken:YES type:HttpRequestTypePost success:^(id responseObject) {
  72. NSDictionary* dict = (NSDictionary*)responseObject;
  73. NSInteger code = [[dict objectForKey:@"code"] integerValue];
  74. if (code == 0) {
  75. @strongify(self);
  76. self.youpaipcategorys = [YOUPAILZLiveCategoryModel mj_objectArrayWithKeyValuesArray:[dict objectForKey:@"data"]];
  77. [self youpaifsetupUI];
  78. }else{
  79. [ZCHUDHelper showTitle:[dict objectForKey:@"message"]];
  80. }
  81. } failure:^(NSError *error) {
  82. [ZCHUDHelper showTitle:error.localizedDescription];
  83. }];
  84. }
  85. #pragma mark - JXCategoryListContainerViewDelegate
  86. - (NSInteger)numberOfListsInlistContainerView:(JXCategoryListContainerView *)listContainerView{
  87. return self.youpaipcategorys.count;
  88. }
  89. - (id<JXCategoryListContentViewDelegate>)listContainerView:(JXCategoryListContainerView *)listContainerView initListForIndex:(NSInteger)index{
  90. YOUPAIHRChatRoomSubDetailVC *vc = [[YOUPAIHRChatRoomSubDetailVC alloc] init];
  91. vc.youpaiptype = [self.youpaiptypeArr[index] intValue];
  92. return vc;
  93. }
  94. #pragma mark - JXPagingViewListViewDelegate
  95. - (UIView *)listView{
  96. return self.view;
  97. }
  98. - (UIScrollView *)listScrollView{
  99. return self.collectionView;
  100. }
  101. - (void)listViewDidScrollCallback:(void (^)(UIScrollView *))callback {
  102. self.scrollCallback = callback;
  103. }
  104. @end