// // QXNobilityViewController.m // QXLive // // Created by 启星 on 2025/11/7. // #import "QXNobilityViewController.h" #import "QXNobilityHeaderView.h" #import "QXNobilityContentView.h" #import "QXMineNetwork.h" #import "QXSeatHeaderView.h" #import "QXNobilityDetailViewController.h" #import "QXNobilityBuyViewController.h" @interface QXNobilityViewController () @property (nonatomic,strong)QXNobilityHeaderView *topView; @property (nonatomic,strong)UIView *nobilityBgView; @property (nonatomic,strong)UIView *nobilityContentView; @property (nonatomic,strong)UILabel *nobilityTitleLabel; //@property (nonatomic,strong)JXCategoryTitleView *categoryView; //@property (nonatomic,strong)JXCategoryListContainerView *containerView; @property (nonatomic,strong)UIView *bottomView; @property (nonatomic,strong)QXSeatHeaderView *userAvatarView; @property (nonatomic,strong)UILabel *bottomNickNameLabel; @property (nonatomic,strong)UIButton *bottomBuyBtn; @property (nonatomic,strong)NSMutableArray *titles; @property (nonatomic,strong)QXNobilityContentView *contentView;; @property (nonatomic,strong)QXNobilityModel* model; @end @implementation QXNobilityViewController - (void)viewDidLoad { self.isNoChangeBgImage = YES; [super viewDidLoad]; // Do any additional setup after loading the view. } -(void)viewWillAppear:(BOOL)animated{ [super viewWillAppear:animated]; [self.navigationController setNavigationBarHidden:NO animated:YES]; self.navigationController.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName:RGB16(0xffffff)}; } -(void)viewWillDisappear:(BOOL)animated{ [super viewWillDisappear:animated]; self.navigationController.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName:RGB16(0x000000)}; } -(void)setNavgationItems{ [super setNavgationItems]; self.navigationTintColor = RGB16(0xffffff); UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"nobility_nav_icon"]]; imageView.frame = CGRectMake(0, 0, 71, 18); self.navigationItem.titleView = imageView; UIButton*createBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 44, 44)]; [createBtn setImage:[UIImage imageNamed:@"nobility_help_icon"] forState:(UIControlStateNormal)]; createBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentTrailing; [createBtn addTarget:self action:@selector(helpAction) forControlEvents:(UIControlEventTouchUpInside)]; self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:createBtn]; } - (void)initSubViews{ [self updateBgImage:@"home_rank_vc_bg"]; self.topView = [[QXNobilityHeaderView alloc] initWithFrame:CGRectMake(0, NavContentHeight, SCREEN_WIDTH,0)]; self.topView.delegate = self; [self.view addSubview:self.topView]; self.nobilityBgView = [[UIView alloc] initWithFrame:CGRectMake(16, self.topView.bottom, SCREEN_WIDTH-32, SCREEN_HEIGHT-self.topView.bottom-80)]; self.nobilityBgView.backgroundColor = RGB16(0x1E2127); self.nobilityBgView.layer.borderWidth = 1; self.nobilityBgView.layer.borderColor = RGB16A(0xF5E9D1, 0.2).CGColor; [self.nobilityBgView addRoundedCornersWithRadius:12]; [self.view addSubview:self.nobilityBgView]; self.nobilityContentView = [[UIView alloc] initWithFrame:CGRectMake(12, 12, self.nobilityBgView.width-24, self.nobilityBgView.height-24)]; [self.nobilityContentView addRoundedCornersWithRadius:6]; [self.nobilityBgView addSubview:self.nobilityContentView]; [self.view addSubview:self.bottomView]; self.contentView = [[QXNobilityContentView alloc] initWithFrame:self.nobilityContentView.bounds]; [self.nobilityContentView addSubview:self.contentView]; } -(void)getData{ MJWeakSelf [QXMineNetwork getUserNobilitSuccessBlock:^(QXNobilityModel * _Nonnull model) { weakSelf.model = model; weakSelf.topView.model = model; weakSelf.contentView.model = model; [weakSelf.contentView reloadData]; if (weakSelf.model.nobility_info.status.intValue == 0) { weakSelf.bottomView.hidden = YES;; }else{ [weakSelf.userAvatarView setHeadIcon:model.user_info.avatar dress:@""]; weakSelf.bottomNickNameLabel.text = [NSString stringWithFormat:@"%@的当前爵位状态是%@",model.user_info.nickname,model.nobility_info.name]; weakSelf.bottomView.hidden = NO;; } } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { }]; } -(void)helpAction{ NSString *urlString = [NSString stringWithFormat:@"%@api/Page/page_show?id=%@",ServerUrl,@"29"]; QXBaseWebViewController *vc = [[QXBaseWebViewController alloc] init]; vc.urlStr = urlString; [self.navigationController pushViewController:vc animated:YES]; } -(void)buyAction{ QXNobilityDetailViewController *vc = [[QXNobilityDetailViewController alloc] init]; vc.cruuent_nobility_id = self.model.nobility_info.lid; [self.navigationController pushViewController:vc animated:YES]; } /// 去开通 -(void)didOpenNobility{ QXNobilityDetailViewController *vc = [[QXNobilityDetailViewController alloc] init]; [self.navigationController pushViewController:vc animated:YES]; } /// 去续费 -(void)didRenewNobility{ QXNobilityBuyViewController *vc = [[QXNobilityBuyViewController alloc] init]; vc.nobility_id = self.model.nobility_info.lid; [self.navigationController pushViewController:vc animated:YES]; } -(NSMutableArray *)titles{ if (!_titles) { _titles = [NSMutableArray array]; } return _titles; } -(UIView *)bottomView{ if (!_bottomView) { _bottomView = [[UIView alloc] initWithFrame:CGRectMake(0, SCREEN_HEIGHT-57, SCREEN_WIDTH, 57)]; [_bottomView addRoundedCornersWithRadius:20 byRoundingCorners:(UIRectCornerTopLeft|UIRectCornerTopRight)]; UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"nobility_my_info_bg"]]; imageView.frame = _bottomView.bounds; [_bottomView addSubview:imageView]; [_bottomView addSubview:self.userAvatarView]; [_bottomView addSubview:self.bottomNickNameLabel]; [_bottomView addSubview:self.bottomBuyBtn]; } return _bottomView; } -(QXSeatHeaderView *)userAvatarView{ if (!_userAvatarView) { _userAvatarView = [[QXSeatHeaderView alloc] initWithFrame:CGRectMake(12, 12, 30, 30)]; // [_userAvatarView setHeadIcon:QXGlobal.shareGlobal.loginModel.avatar dress:@""]; } return _userAvatarView; } -(UIButton *)bottomBuyBtn{ if (!_bottomBuyBtn) { _bottomBuyBtn = [[UIButton alloc] initWithFrame:CGRectMake(SCREEN_WIDTH-14-118, (57-36)/2, 118, 36)]; [_bottomBuyBtn setBackgroundImage:[UIImage imageNamed:@"nobility_update_btn"] forState:(UIControlStateNormal)]; [_bottomBuyBtn addTarget:self action:@selector(buyAction) forControlEvents:(UIControlEventTouchUpInside)]; } return _bottomBuyBtn; } -(UILabel *)bottomNickNameLabel{ if (!_bottomNickNameLabel) { _bottomNickNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.userAvatarView.right+6, 0, self.bottomBuyBtn.left-self.userAvatarView.right-20, 57)]; // _bottomNickNameLabel.text = QXGlobal.shareGlobal.loginModel.nickname; _bottomNickNameLabel.textColor = RGB16(0xF5E9D1); _bottomNickNameLabel.font = [UIFont systemFontOfSize:12]; } return _bottomNickNameLabel; } @end