Files
yinmeng-ios/xplan-ios/Main/Mine/View/MineInfo/XPMineUserInfoViewController.m
2023-08-31 17:50:20 +08:00

698 lines
27 KiB
Objective-C

//
// MineInfoViewController.m
// xplan-ios
//
// Created by 冯硕 on 2021/9/22.
//
#import "XPMineUserInfoViewController.h"
///Third
#import <NIMSDK/NIMSDK.h>
#import <Masonry/Masonry.h>
#import <SDCycleScrollView/SDCycleScrollView.h>
#import <JXPagingView/JXPagerView.h>
#import <JXPagingView/JXPagerListRefreshView.h>
#import <JXCategoryView/JXCategoryView.h>
///Tool
#import "ThemeColor.h"
#import "XPMacro.h"
#import "AccountInfoStorage.h"
#import "TTPopup.h"
#import "XPHtmlUrl.h"
#import "XPSkillCardPlayerManager.h"
#import "UIImage+Utils.h"
#import "XPConstant.h"
#import "XPButton.h"
#import "Api.h"
#import "WalletInfoModel.h"
///Model
#import "MineSkillCardListInfoModel.h"
#import "UserInfoModel.h"
#import "ClanDetailInfoModel.h"
///View
#import "XPMineUserInfoTableViewCell.h"
#import "XPMineUserInfoHeaderView.h"
#import "XPMineUserInfoCustomNavView.h"
#import "XPMineUserInfoVoiceCardView.h"
///P
#import "XPMineUserInfoPresenter.h"
#import "XPMineUserInfoProtocol.h"
#import "RoomHostDelegate.h"
///VC
#import "XPMineUserInfoEditViewController.h"
#import "XPWebViewController.h"
#import "SessionViewController.h"
#import "XPRoomViewController.h"
#import "XPMineUserDataViewController.h"
#import "XPMonentsMineViewController.h"
#import "XPMineClanViewController.h"
#import "XPMineUserGameVC.h"
#import "XPMinePlaceOrderView.h"
#import "XPMineNewRechargeViewController.h"
@interface XPMineUserInfoViewController ()<XPMineCustomNavViewDelegate, XPMineUserInfoProtocol, XPMineUserInfoHeaderViewDelegate, JXCategoryViewDelegate,JXPagerViewDelegate, XPMineUserDataViewControllerDelegate, JXPagerMainTableViewGestureDelegate,XPMinePlaceOrderViewDelegate,XPMineUserGameVCDelegate>
@property (nonatomic, strong) JXCategoryTitleView *titleView;
@property (nonatomic, strong) JXCategoryIndicatorImageView *lineView;
@property (nonatomic, strong) JXPagerView *pagingView;
@property (nonatomic, strong) NSArray<NSString *> *titles;
///头部视图
@property (nonatomic,strong) XPMineUserInfoHeaderView *headView;
///自定义的导航栏
@property (nonatomic,strong) XPMineUserInfoCustomNavView *navView;
///用户信息
@property (nonatomic,strong) UserInfoModel *userInfo;
///底部的容器
@property (nonatomic,strong) UIStackView *bottomStackView;
///私聊
@property (nonatomic,strong) XPButton *chatButton;
///开黑
@property (nonatomic,strong) XPButton *banButton;
///关注
@property (nonatomic,strong) XPButton *attentionButton;
///资料
@property (nonatomic,strong) XPMineUserDataViewController *userDataVC;
///动态
@property (nonatomic,strong) XPMonentsMineViewController *monentsVC;
///游戏开黑
@property(nonatomic,strong) XPMineUserGameVC *gameVC;
///声音秀
@property (nonatomic,strong) XPMineUserInfoVoiceCardView *voiceView;
///余额
@property(nonatomic, copy)NSString *diamonds;
@property(nonatomic,assign) int index;
@end
@implementation XPMineUserInfoViewController
-(instancetype)initWithChooseGame{
self = [super init];
if(self){
self.index = 1;
}
return self;
}
- (XPMineUserInfoPresenter *)createPresenter {
return [[XPMineUserInfoPresenter alloc] init];
}
- (BOOL)isHiddenNavBar {
return YES;
}
- (void)viewDidLoad {
[super viewDidLoad];
[self initSubViews];
[self initSubViewConstraints];
}
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
if (self.uid > 0) {
[self initHttpRequest];
}
}
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
if (self.voiceView.isPlaying) {
[[XPSkillCardPlayerManager shareInstance] stopMusic];
}
}
- (void)viewDidLayoutSubviews {
[super viewDidLayoutSubviews];
self.pagingView.frame = self.view.bounds;
}
#pragma mark - Private Method
- (void)initSubViews {
[self.view addSubview:self.pagingView];
[self.view addSubview:self.navView];
[self.view addSubview:self.voiceView];
if (self.uid != [AccountInfoStorage instance].getUid.integerValue) {
[self.view addSubview:self.bottomStackView];
[self.bottomStackView addArrangedSubview:self.chatButton];
[self.bottomStackView addArrangedSubview:self.banButton];
[self.bottomStackView addArrangedSubview:self.attentionButton];
self.titles = @[@"资料", @"动态"];
[self.bottomStackView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.mas_equalTo(self.view).inset(15);
make.height.mas_equalTo(45);
make.bottom.mas_equalTo(self.view).offset(-kSafeAreaBottomHeight - 8);
}];
}
}
- (void)initSubViewConstraints {
[self.navView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.top.mas_equalTo(self.view);
make.height.mas_equalTo(kNavigationHeight);
}];
[self.voiceView mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(self.view);
make.top.mas_equalTo(self.view.mas_safeAreaLayoutGuideTop).offset(176);
make.size.mas_equalTo(CGSizeMake(65, 25));
}];
}
- (void)initHttpRequest {
NSString *uid = [NSString stringWithFormat:@"%ld", self.uid];
///请求目标用户的个人信息
[self.presenter getUserInfoWithUid:uid];
[self.presenter getUserAttentionState:uid];
//获取用户详细信息 跟随进房目前使用的这个接口
[self.presenter getUserDetailInfoWithUid:uid];
//获取公会信息
[self.presenter getClanDetailInfo:uid];
///获取余额
[self getUserWallet];
NSString * myUid = [AccountInfoStorage instance].getUid;
///上传访问记录
if (![uid isEqualToString:myUid]) {
///请求我自己的个人信息
[self.presenter getUserInfoWithUid:myUid];
}
}
-(void)getUserWallet{
[Api getUserWalletInfo:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
if(code == 200){
WalletInfoModel * model = [WalletInfoModel modelWithDictionary:data.data];
self.diamonds = model.diamonds;
}
} uid:[AccountInfoStorage instance].getUid ticket:[AccountInfoStorage instance].getTicket];
}
#pragma mark - 拉黑 移除黑名单
- (BOOL)isSystemAccount {
return [KeyWithType(KeyType_SecretaryUidKey) isEqualToString:[NSString stringWithFormat:@"%ld", self.uid]] || [KeyWithType(KeyType_SystemNotifiUidKey) isEqualToString:[NSString stringWithFormat:@"%ld", self.uid]] || [KeyWithType(KeyType_GuildUidKey) isEqualToString:[NSString stringWithFormat:@"%ld", self.uid]];
}
- (void)showRightNavHandle {
NSMutableArray<TTActionSheetConfig *> *array = [NSMutableArray array];
NSString *uid = [NSString stringWithFormat:@"%ld",self.uid];
TTActionSheetConfig *report = [TTActionSheetConfig normalTitle:@"举报" clickAction:^{
XPWebViewController *vc = [[XPWebViewController alloc]init];
NSString *urlstr = [NSString stringWithFormat:@"%@?reportUid=%@&source=PERSONAL",URLWithType(kReportRoomURL),uid];
vc.url = urlstr;
[self.navigationController pushViewController:vc animated:YES];
}];
TTActionSheetConfig *black = [TTActionSheetConfig normalTitle:@"拉黑" clickAction:^{
[self addOrRemoveBlack:NO uid:uid];
}];
[array addObjectsFromArray:@[report, black]];
BOOL isInBlackList = [[NIMSDK sharedSDK].userManager isUserInBlackList:uid] || [self isSystemAccount];
if (isInBlackList) {
[array removeObject:black];
}
[TTPopup actionSheetWithItems:array];
}
//加入黑名单
- (void)addOrRemoveBlack:(BOOL)isRemove uid:(NSString *)uid {
NSString *title;
NSString *message;
if (isRemove) {
title = @"移除黑名单";
message = @"移除黑名单,你将正常收到对方的消息";
}else{
title = @"加入黑名单";
message = @"加入黑名单,你将不再收到对方的消息";
}
TTAlertConfig *config = [[TTAlertConfig alloc] init];
config.title = title;
config.message = message;
[TTPopup alertWithConfig:config confirmHandler:^{
if (isRemove) {
[[NIMSDK sharedSDK].userManager removeFromBlackBlackList:uid completion:^(NSError * _Nullable error) {
if (error == nil) {
[self showSuccessToast:@"移出黑名单成功"];
}
}];
} else {
[[NIMSDK sharedSDK].userManager addToBlackList:uid completion:^(NSError * _Nullable error) {
if (error == nil) {
[self showSuccessToast:@"加入黑名单成功"];
}
}];
}
} cancelHandler:^{
}];
}
#pragma mark - XPMineUserGameVCDelegate
- (void)userConsultingOrderActionWithGameInfo:(UserGameInfoVo *)gameInfo{
[self.presenter consultingOrder:gameInfo.gameId gameUid:gameInfo.uid];
}
#pragma mark - JXCategoryViewDelegate
- (NSUInteger)tableHeaderViewHeightInPagerView:(JXPagerView *)pagerView {
return [self.headView getHeaderHeight:self.userInfo];
}
- (UIView *)tableHeaderViewInPagerView:(JXPagerView *)pagerView {
return self.headView;
}
- (NSUInteger)heightForPinSectionHeaderInPagerView:(JXPagerView *)pagerView {
return 40;
}
- (UIView *)viewForPinSectionHeaderInPagerView:(JXPagerView *)pagerView {
return self.titleView;
}
- (NSInteger)numberOfListsInPagerView:(JXPagerView *)pagerView {
return self.titles.count;
}
- (id<JXPagerViewListViewDelegate>)pagerView:(JXPagerView *)pagerView initListAtIndex:(NSInteger)index {
UIViewController *viewController;
if (index == 0) {
viewController = self.userDataVC;
} else if (index == 1) {
if(self.titles.count == 2){
viewController = self.monentsVC;
}else{
viewController = self.gameVC;
}
}else if(index == 2){
viewController = self.monentsVC;
}
return (id <JXPagerViewListViewDelegate>)viewController;
}
#pragma mark - JXPagerMainTableViewGestureDelegate
- (BOOL)mainTableViewGestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
///1000是外部的scrollView 1001是人气主播中的collectionView
if (otherGestureRecognizer.view.tag == 1005 || otherGestureRecognizer.view.tag == 1009) {
return NO;
}
return [gestureRecognizer isKindOfClass:[UIPanGestureRecognizer class]] && [otherGestureRecognizer isKindOfClass:[UIPanGestureRecognizer class]];
}
#pragma mark - XPMineCustomNavViewDelegate
- (void)xPMineCustomNavView:(XPMineUserInfoCustomNavView *)view didClickEditButton:(UIButton *)sender {
if (sender.isSelected) {///自己看自己的 去修改资料
XPMineUserInfoEditViewController * editVC = [[XPMineUserInfoEditViewController alloc] init];
[self.navigationController pushViewController:editVC animated:YES];
} else {
[self showRightNavHandle];
}
}
- (void)xPMineCustomNavView:(XPMineUserInfoCustomNavView *)view didClickBackButton:(UIButton *)sender {
[self.navigationController popViewControllerAnimated:YES];
}
#pragma mark - XPMineUserInfoHeaderViewDelegate
- (void)xPMineUserInfoHeaderView:(XPMineUserInfoHeaderView *)view didClickGoToRoom:(NSString *)roomUid {
if (roomUid.length > 0 ) {
//退出原来的房间 如果有的话 TODO 总感觉这种处理不太优雅 进房入口多了 怎么办 进房需要整合
[self.navigationController.viewControllers enumerateObjectsUsingBlock:^(__kindof UIViewController * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
if ([obj isKindOfClass:[XPRoomViewController class]]) {
[self.navigationController popToRootViewControllerAnimated:NO];
XPRoomViewController<RoomHostDelegate> * rooomVC = obj;
[rooomVC exitRoom];
*stop = YES;
}
}];
[XPRoomViewController openRoom:roomUid viewController:self];
}
}
- (void)xPMineUserInfoHeaderViewDidClickClan:(ClanDetailInfoModel *)clanInfo {
XPMineClanViewController * clanVC = [[XPMineClanViewController alloc] init];
clanVC.uid = clanInfo.clan.elderUid;
[self.navigationController pushViewController:clanVC animated:YES];
}
- (void)attentionUserHandleWithBtn:(XPButton *)sender{
NSString *uid = [NSString stringWithFormat:@"%ld", self.uid];
[self.presenter attentionUser:uid state:!sender.selected];
}
#pragma mark - XPMineUserDataViewControllerDelegate
- (void)xPMineUserDataViewController:(XPMineUserDataViewController *)viewController didGetVoiceSuccess:(MineSkillCardListInfoModel *)voiceCard {
if (voiceCard && [voiceCard.cardId isEqualToString:@"8"]) {
self.voiceView.hidden = NO;
self.voiceView.voiceInfo = voiceCard;
} else {
self.voiceView.hidden = YES;
}
}
#pragma mark - XPMineUserInfoProtocol
- (void)onGetUserInfoSuccess:(UserInfoModel *)userInfo {
if (userInfo.uid == self.uid) {
self.userInfo = userInfo;
self.headView.userInfo = userInfo;
[self.pagingView resizeTableHeaderViewHeightWithAnimatable:NO duration:0 curve:0];
} else {
if (!userInfo.userVipInfoVO.lookHomepageHide) {
NSString * uid = [NSString stringWithFormat:@"%ld", self.uid];
[self.presenter visitUser:uid];
}
}
}
- (void)ongetDetailInfoSuccess:(UserInfoModel *)userInfo {
self.userDataVC.userInfo = userInfo;
self.monentsVC.dynamicInfo = userInfo.dynamicInfo;
self.headView.roomUid = userInfo.roomUid;
if(userInfo.userGamePartner.count > 0){
self.banButton.hidden = NO;
self.gameVC.gameList = userInfo.userGamePartner;
self.attentionButton.hidden = YES;
self.headView.attentionButton.hidden = NO;
self.titles = @[@"资料",@"游戏开黑", @"动态"];
}else{
self.banButton.hidden = YES;
self.attentionButton.hidden = NO;
self.headView.attentionButton.hidden = YES;
self.titles = @[@"资料", @"动态"];
}
if(self.uid == [AccountInfoStorage instance].getUid.integerValue){
self.banButton.hidden = YES;
self.headView.attentionButton.hidden = YES;
self.attentionButton.hidden = YES;
}
self.titleView.titles = self.titles;
[self.titleView reloadData];
}
- (void)getAttentionStateSuccess:(BOOL)status {
self.attentionButton.selected = status;
if (self.attentionButton.selected) {
self.attentionButton.backgroundColor = [ThemeColor colorWithHexString:@"#FFFACF"];
self.attentionButton.layer.borderColor = [ThemeColor appMainColor].CGColor;
}else{
self.attentionButton.backgroundColor = [ThemeColor appMainColor];
self.attentionButton.layer.borderColor = UIColor.clearColor.CGColor;
}
self.headView.attentionButton.selected = status;
if (!self.headView.attentionButton.selected) {
self.headView.attentionButton.backgroundColor = [ThemeColor colorWithHexString:@"#FFDA24"];
}else{
self.headView.attentionButton.backgroundColor = UIColorRGBAlpha(0xFFDA24, 0.4);
}
}
- (void)attentionUserSuccess:(BOOL)status {
self.attentionButton.selected = status;
if (self.attentionButton.selected) {
self.attentionButton.backgroundColor = [ThemeColor colorWithHexString:@"#FFFACF"];
self.attentionButton.layer.borderColor = [ThemeColor appMainColor].CGColor;
}else{
self.attentionButton.backgroundColor = [ThemeColor appMainColor];
self.attentionButton.layer.borderColor = UIColor.clearColor.CGColor;
}
self.headView.attentionButton.selected = status;
if (self.headView.attentionButton.selected) {
self.headView.attentionButton.backgroundColor = [ThemeColor colorWithHexString:@"#FFFACF"];
self.headView.attentionButton.layer.borderColor = [ThemeColor appMainColor].CGColor;
}else{
self.headView.attentionButton.backgroundColor = [ThemeColor appMainColor];
self.headView.attentionButton.layer.borderColor = UIColor.clearColor.CGColor;
}
}
- (void)getClanDetailInfoSuccess:(ClanDetailInfoModel *)clanDetailInfo {
self.headView.clanDetailInfo = clanDetailInfo;
}
#pragma mark - Event Response
- (void)chatButtonAction:(UIButton *)sender {
NSString * sessionId = [NSString stringWithFormat:@"%ld",self.uid];
NIMSession * session = [NIMSession session:sessionId type:NIMSessionTypeP2P];
SessionViewController * sessionVC = [[SessionViewController alloc] initWithSession:session];
[self.navigationController pushViewController:sessionVC animated:YES];
}
- (void)banButtonAction:(UIButton *)sender {
XPMinePlaceOrderView *orderVeiw = [[XPMinePlaceOrderView alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
orderVeiw.diamonds = self.diamonds;
orderVeiw.gameList = self.userDataVC.userInfo.userGamePartner;
orderVeiw.delegate = self;
[self.view addSubview:orderVeiw];
}
- (void)attentionButtonAction:(UIButton *)sender {
NSString *uid = [NSString stringWithFormat:@"%ld", self.uid];
[self.presenter attentionUser:uid state:!sender.selected];
}
#pragma mark - XPMinePlaceOrderViewDelegate
///发起邀请
-(void)initiateInvitationWithGameInfo:(UserGameInfoVo *)gameInfo count:(NSString *)count{
[self.presenter initiateInvitationGameWithGameId:gameInfo.gameId gameUid:gameInfo.uid inning:count uid:[AccountInfoStorage instance].getUid];
}
///充值
-(void)payHandleWithShowView:(BOOL)isShow{
if(isShow == YES){
TTAlertConfig *config = [[TTAlertConfig alloc] init];
config.title = @"提示";
config.actionStyle = TTAlertActionConfirmStyle;
config.message = [NSString stringWithFormat:@"余额不足,请充值"];
TTAlertButtonConfig *confirmButtonConfig = [[TTAlertButtonConfig alloc]init];
confirmButtonConfig.title = @"去充值";
config.confirmButtonConfig = confirmButtonConfig;
confirmButtonConfig.titleColor = UIColorFromRGB(0x2B2D33);
confirmButtonConfig.backgroundColor = UIColorFromRGB(0xFFDA24);
confirmButtonConfig.font = [UIFont systemFontOfSize:14 weight:UIFontWeightMedium];
confirmButtonConfig.cornerRadius = 38/2;
[TTPopup alertWithConfig:config confirmHandler:^{
XPMineNewRechargeViewController *payVC = [[XPMineNewRechargeViewController alloc]init];
[self.navigationController pushViewController:payVC animated:YES];
} cancelHandler:^{
}];
return;
}
XPMineNewRechargeViewController *payVC = [[XPMineNewRechargeViewController alloc]init];
[self.navigationController pushViewController:payVC animated:YES];
}
-(void)sendInitiateInvitationGameSuccess{
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
NSString * sessionId = [NSString stringWithFormat:@"%ld",self.uid];
NIMSession * session = [NIMSession session:sessionId type:NIMSessionTypeP2P];
SessionViewController * sessionVC = [[SessionViewController alloc] initWithSession:session];
[self.navigationController pushViewController:sessionVC animated:YES];
});
}
- (void)consultingOrderSuccess{
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
NSString * sessionId = [NSString stringWithFormat:@"%ld",self.uid];
NIMSession * session = [NIMSession session:sessionId type:NIMSessionTypeP2P];
SessionViewController * sessionVC = [[SessionViewController alloc] initWithSession:session];
[self.navigationController pushViewController:sessionVC animated:YES];
});
}
#pragma mark - Getters And Setters
- (void)setUid:(NSInteger)uid {
_uid = uid;
if (_uid > 0) {
if (_uid == [AccountInfoStorage instance].getUid.integerValue) {
[self.navView.editButton setImage:[UIImage imageNamed:@"user_mine_profile_edit"] forState:UIControlStateNormal];
} else {
[self.navView.editButton setImage:[UIImage imageNamed:@"mine_user_info_edit"] forState:UIControlStateNormal];
}
self.navView.editButton.selected = _uid == [AccountInfoStorage instance].getUid.integerValue;
NSString * uidStr = [NSString stringWithFormat:@"%ld", uid];
self.userDataVC.userUid = uidStr;
[self.presenter getUserInfoWithUid:uidStr];
}
}
- (XPMineUserInfoHeaderView *)headView {
if (!_headView) {
_headView = [[XPMineUserInfoHeaderView alloc] init];
_headView.delegate = self;
}
return _headView;
}
- (XPMineUserInfoCustomNavView *)navView {
if (!_navView) {
_navView = [[XPMineUserInfoCustomNavView alloc] init];
_navView.delegate = self;
}
return _navView;
}
- (UIStackView *)bottomStackView {
if (!_bottomStackView) {
_bottomStackView = [[UIStackView alloc] init];
_bottomStackView.axis = UILayoutConstraintAxisHorizontal;
_bottomStackView.distribution = UIStackViewDistributionFillEqually;
_bottomStackView.alignment = UIStackViewAlignmentFill;
_bottomStackView.spacing = 18;
}
return _bottomStackView;
}
- (XPButton *)chatButton {
if (!_chatButton) {
_chatButton = [XPButton buttonWithType:UIButtonTypeCustom];
[_chatButton setTitle:@"私信" forState:UIControlStateNormal];
[_chatButton setTitleColor:[ThemeColor confirmButtonTextColor] forState:UIControlStateNormal];
[_chatButton setImage:[UIImage imageNamed:@"mine_user_info_bottom_chat"] forState:UIControlStateNormal];
_chatButton.titleLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightMedium];
_chatButton.backgroundColor = [ThemeColor appMainColor];
_chatButton.layer.masksToBounds = YES;
_chatButton.layer.cornerRadius = 45.0/2;
[_chatButton addTarget:self action:@selector(chatButtonAction:) forControlEvents:UIControlEventTouchUpInside];
_chatButton.imageTitleSpace = 4;
}
return _chatButton;
}
- (XPButton *)banButton {
if (!_banButton) {
_banButton = [XPButton buttonWithType:UIButtonTypeCustom];
[_banButton setTitle:@"找ta开黑" forState:UIControlStateNormal];
[_banButton setTitleColor:[ThemeColor confirmButtonTextColor] forState:UIControlStateNormal];
[_banButton setImage:[UIImage imageNamed:@"mine_user_info_bottom_ban_normal"] forState:UIControlStateNormal];
_banButton.titleLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightMedium];
_banButton.backgroundColor = [UIColor whiteColor];
_banButton.layer.masksToBounds = YES;
_banButton.layer.cornerRadius = 45.0/2;
[_banButton addTarget:self action:@selector(banButtonAction:) forControlEvents:UIControlEventTouchUpInside];
_banButton.imageTitleSpace = 4;
_banButton.layer.borderWidth = 1;
_banButton.layer.borderColor = UIColorFromRGB(0xFFDA24).CGColor;
}
return _banButton;
}
- (JXCategoryTitleView *)titleView {
if (!_titleView) {
_titleView = [[JXCategoryTitleView alloc] init];
_titleView.delegate = self;
_titleView.backgroundColor = [UIColor whiteColor];
_titleView.titleColor = [ThemeColor textThirdColor];
_titleView.titleSelectedColor = [ThemeColor mainTextColor];
_titleView.titleFont = [UIFont systemFontOfSize:14 weight:UIFontWeightMedium];
_titleView.titleSelectedFont = [UIFont systemFontOfSize:18 weight:UIFontWeightMedium];
_titleView.titleLabelAnchorPointStyle = JXCategoryTitleLabelAnchorPointStyleCenter;
_titleView.contentScrollViewClickTransitionAnimationEnabled = NO;
_titleView.defaultSelectedIndex = self.index > 0 ? self.index : 0;
_titleView.averageCellSpacingEnabled = NO;
_titleView.contentEdgeInsetLeft = 20;
_titleView.titles = self.titles;
_titleView.cellSpacing = 20;
_titleView.titles = self.titles;
_titleView.listContainer = (id<JXCategoryViewListContainer>)self.pagingView.listContainerView;
JXCategoryIndicatorImageView *lineView = [[JXCategoryIndicatorImageView alloc] init];
lineView.indicatorImageViewSize = CGSizeMake(13, 4);
lineView.verticalMargin = 0;
lineView.indicatorImageView.image = [UIImage imageNamed:@"home_segment_indicator"];
_titleView.indicators = @[lineView];
}
return _titleView;
}
- (JXPagerView *)pagingView {
if (!_pagingView) {
_pagingView = [[JXPagerView alloc] initWithDelegate:self listContainerType:JXPagerListContainerType_ScrollView];
_pagingView.backgroundColor = [UIColor clearColor];
_pagingView.listContainerView.backgroundColor = [UIColor clearColor];
_pagingView.mainTableView.backgroundColor = [UIColor clearColor];
_pagingView.listContainerView.listCellBackgroundColor = UIColor.clearColor;
_pagingView.mainTableView.gestureDelegate = self;
}
return _pagingView;
}
- (NSArray<NSString *> *)titles {
if (!_titles) {
_titles = @[@"资料", @"动态"];
}
return _titles;
}
- (XPMineUserDataViewController *)userDataVC {
if (!_userDataVC) {
_userDataVC = [[XPMineUserDataViewController alloc] init];
_userDataVC.delegate = self;
}
return _userDataVC;
}
- (XPMineUserInfoVoiceCardView *)voiceView {
if (!_voiceView) {
_voiceView = [[XPMineUserInfoVoiceCardView alloc] init];
_voiceView.hidden = YES;
}
return _voiceView;
}
- (XPMonentsMineViewController *)monentsVC {
if (!_monentsVC) {
_monentsVC = [[XPMonentsMineViewController alloc] init];
}
return _monentsVC;
}
- (XPMineUserGameVC *)gameVC{
if(!_gameVC){
_gameVC = [[XPMineUserGameVC alloc]init];
_gameVC.delegate = self;
}
return _gameVC;
}
- (XPButton *)attentionButton {
if (!_attentionButton) {
_attentionButton = [XPButton buttonWithType:UIButtonTypeCustom];
[_attentionButton setTitle:@"关注" forState:UIControlStateNormal];
[_attentionButton setTitle:@"已关注" forState:UIControlStateSelected];
[_attentionButton setTitleColor:[ThemeColor confirmButtonTextColor] forState:UIControlStateNormal];
[_attentionButton setTitleColor:[ThemeColor cancelButtonTextColor] forState:UIControlStateSelected];
[_attentionButton setImage:[UIImage imageNamed:@"mine_user_info_bottom_attention_normal"] forState:UIControlStateNormal];
[_attentionButton setImage:[UIImage imageNamed:@"mine_user_info_bottom_attention_select"] forState:UIControlStateSelected];
_attentionButton.titleLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightMedium];
_attentionButton.backgroundColor = [ThemeColor appMainColor];
_attentionButton.layer.masksToBounds = YES;
_attentionButton.layer.cornerRadius = 45.0/2;
[_attentionButton addTarget:self action:@selector(attentionButtonAction:) forControlEvents:UIControlEventTouchUpInside];
_attentionButton.imageTitleSpace = 4;
_attentionButton.layer.borderWidth = 1;
_attentionButton.layer.borderColor = UIColor.clearColor.CGColor;
_attentionButton.hidden = YES;
}
return _attentionButton;
}
@end