// // QXRoomUserInfoView.m // QXLive // // Created by 启星 on 2025/6/10. // #import "QXRoomUserInfoView.h" #import "UIButton+QX.h" #import #import "QXMineNetwork.h" #import "QXMenuPopView.h" #import "QXDynamicNetwork.h" #import "QXUserInfoGiftWallView.h" #import "QXReportViewController.h" #import "QXUserHomePageViewController.h" #import "QXUserInfoRelationTableCell.h" #import "QXUserRelationListView.h" #import "QXUserInfoRelationCardCell.h" #import "QXDirectSetScaleView.h" @interface QXRoomUserInfoView() @property (nonatomic,strong)UIView *bgView; @property (nonatomic,strong)UIImageView *bgImageView; /// 头像 @property (nonatomic,strong)UIImageView *headerImageView; /// 昵称 @property (nonatomic,strong)UIButton *nameBtn; /// ID @property (nonatomic,strong)UILabel *idLabel; /// 所属公会 @property (nonatomic,strong)UILabel *guildLabel; /// 开播 @property (nonatomic,strong)UIButton *remindBtn; /// 上下麦 @property (nonatomic,strong)UIButton *upSeatBtn; /// 举报 @property (nonatomic,strong)UIButton *reportBtn; /// 拉黑 @property (nonatomic,strong)UIButton *blackBtn; /// 跟随 @property (nonatomic,strong)UIButton *followBtn; /// 清除魅力 @property (nonatomic,strong)UIButton *clearBtn; /// 更多 @property (nonatomic,strong)UIButton *moreBtn; /// iconbgView @property (nonatomic,strong)UIView *iconBgView; /// 简介 @property (nonatomic,strong)UILabel *introduceLabel; /// 礼物图鉴 @property (nonatomic,strong)UILabel *giftTitleLabel; /// 更多礼物 @property (nonatomic,strong)UIButton *moreGiftBtn; /// 关系列表 //@property (nonatomic,strong)SDCycleScrollView *relationshipScrollview; @property (nonatomic,strong)UITableView *relationTableView; /// 关系卡 亲密 @property (nonatomic,strong)UIButton *relationshipCardBtn; /// 关系位 真爱 @property (nonatomic,strong)UIButton *relationshipSeatBtn; @property (nonatomic,assign)BOOL isRealLove; /// 工具栏 @property (nonatomic,strong)UIView *bottomView; @property (nonatomic,strong)NSArray *toolsArray; @property (nonatomic,strong)QXMenuPopView *popView; @property (nonatomic,strong) QXRoomUserInfoModel *userModel; @property (nonatomic,strong) QXUserInfoGiftWallView *giftWallView; @property (nonatomic,strong)UIButton *relationMoreBtn; /// 关系列表 @property (nonatomic,strong) QXUserRelationListView *relationView; @property (nonatomic,strong) QXRelationshipList *listModel; @end @implementation QXRoomUserInfoView - (instancetype)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { [self initSubviews]; } return self; } -(void)initSubviews{ self.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.3]; UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hide)]; tap.delegate = self; [self addGestureRecognizer:tap]; self.bgView = [[UIView alloc] initWithFrame:CGRectMake(0, SCREEN_HEIGHT, SCREEN_WIDTH, kSafeAreaBottom+ScaleWidth(429-141-50+33))]; // self.bgView.backgroundColor = [UIColor whiteColor]; [self addSubview:self.bgView]; self.bgImageView = [[UIImageView alloc] initWithFrame:self.bgView.bounds]; self.bgImageView.image = [UIImage imageNamed:@"room_user_bg"]; [self.bgView addSubview:self.bgImageView]; [self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) { make.top.mas_equalTo(ScaleWidth(24)); make.left.right.bottom.equalTo(self.bgView); }]; self.headerImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"user_header_placehoulder"]]; self.headerImageView.contentMode = UIViewContentModeScaleAspectFill; [self.bgView addSubview:self.headerImageView]; [self.headerImageView addRoundedCornersWithRadius:ScaleWidth(33)]; [self.headerImageView mas_makeConstraints:^(MASConstraintMaker *make) { make.top.centerX.equalTo(self.bgView); make.size.mas_equalTo(CGSizeMake(ScaleWidth(66), ScaleWidth(66))); }]; UIButton *headder = [[UIButton alloc] init]; [headder addTarget:self action:@selector(toHomePage) forControlEvents:(UIControlEventTouchUpInside)]; [self.bgView addSubview:headder]; [headder mas_makeConstraints:^(MASConstraintMaker *make) { make.bottom.left.right.top.equalTo(self.headerImageView); }]; self.nameBtn = [[UIButton alloc] init]; self.nameBtn.titleLabel.font = [UIFont systemFontOfSize:14]; self.nameBtn.imageView.contentMode = UIViewContentModeScaleAspectFit; [self.nameBtn setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)]; [self.bgView addSubview:self.nameBtn]; [self.nameBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(self.headerImageView.mas_bottom).offset(2); make.height.mas_equalTo(18); make.centerX.equalTo(self.headerImageView); }]; self.idLabel = [[UILabel alloc] init]; self.idLabel.font = [UIFont systemFontOfSize:12]; self.idLabel.textColor = [UIColor whiteColor]; [self.bgView addSubview:self.idLabel]; [self.idLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(self.nameBtn.mas_bottom).offset(2); make.height.mas_equalTo(16); make.centerX.equalTo(self.headerImageView); }]; self.guildLabel = [[UILabel alloc] init]; self.guildLabel.font = [UIFont systemFontOfSize:12]; self.guildLabel.textColor = [UIColor whiteColor]; [self.bgView addSubview:self.guildLabel]; [self.guildLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(self.idLabel.mas_bottom).offset(2); make.height.mas_equalTo(16); make.centerX.equalTo(self.headerImageView); }]; self.iconBgView = [[UIView alloc] init]; [self.bgView addSubview:self.iconBgView]; [self.iconBgView mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(self.guildLabel.mas_bottom).offset(4); make.size.mas_equalTo(CGSizeMake(42, 16)); }]; self.introduceLabel = [[UILabel alloc] init]; self.introduceLabel.textAlignment = NSTextAlignmentCenter; self.introduceLabel.font = [UIFont systemFontOfSize:12]; self.introduceLabel.textColor = RGB16(0x999999); self.introduceLabel.numberOfLines = 2; [self.bgView addSubview:self.introduceLabel]; [self.introduceLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(self.iconBgView.mas_bottom).offset(8); make.left.mas_equalTo(40); make.right.mas_equalTo(-40); make.height.mas_equalTo(40); }]; self.clearBtn = [[UIButton alloc] init]; [self.clearBtn setTitle:QXText(@"清魅力") forState:(UIControlStateNormal)]; [self.clearBtn setImage:[UIImage imageNamed:@"room_clear_charm"] forState:(UIControlStateNormal)]; self.clearBtn.titleLabel.font = [UIFont systemFontOfSize:12]; self.clearBtn.backgroundColor = RGB16A(0xffffff, 0.2); self.clearBtn.hidden = YES; [self.clearBtn addRoundedCornersWithRadius:ScaleWidth(10)]; self.clearBtn.imageView.contentMode = UIViewContentModeScaleAspectFit; [self.clearBtn addTarget:self action:@selector(clearCharmAction) forControlEvents:(UIControlEventTouchUpInside)]; [self.clearBtn setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)]; [self.bgView addSubview:self.clearBtn]; [self.clearBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(22); make.top.mas_equalTo(ScaleWidth(24)+26); make.height.mas_equalTo(ScaleWidth(20)); make.width.mas_greaterThanOrEqualTo(ScaleWidth(66)); }]; self.remindBtn = [[UIButton alloc] init]; // [self.remindBtn setImage:[UIImage imageNamed:@"room_up_notice_icon"] forState:(UIControlStateNormal)]; [self.remindBtn setTitle:QXText(@"转币") forState:(UIControlStateNormal)]; self.remindBtn.titleLabel.font = [UIFont systemFontOfSize:12]; self.remindBtn.backgroundColor = RGB16A(0xffffff, 0.2); self.remindBtn.hidden = YES; [self.remindBtn addRoundedCornersWithRadius:ScaleWidth(10)]; self.remindBtn.imageView.contentMode = UIViewContentModeScaleAspectFit; [self.remindBtn addTarget:self action:@selector(eventAction:) forControlEvents:(UIControlEventTouchUpInside)]; [self.remindBtn setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)]; [self.bgView addSubview:self.remindBtn]; [self.remindBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(22); make.centerY.equalTo(self.guildLabel); make.height.mas_equalTo(ScaleWidth(20)); make.width.mas_greaterThanOrEqualTo(ScaleWidth(66)); }]; self.followBtn = [[UIButton alloc] init]; self.followBtn.hidden = YES; [self.followBtn setImage:[UIImage imageNamed:@"room_user_follow"] forState:(UIControlStateNormal)]; [self.followBtn addTarget:self action:@selector(eventAction:) forControlEvents:(UIControlEventTouchUpInside)]; [self.bgView addSubview:self.followBtn]; [self.followBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(22); make.top.equalTo(self.remindBtn.mas_bottom).offset(17); make.height.mas_equalTo(ScaleWidth(24)); make.width.mas_equalTo(ScaleWidth(70)); }]; self.upSeatBtn = [[UIButton alloc] init]; [self.upSeatBtn setTitleColor:QXConfig.btnTextColor forState:(UIControlStateNormal)]; [self.upSeatBtn setTitle:QXText(@"上麦") forState:(UIControlStateNormal)]; // [self.upSeatBtn setTitle:QXText(@"上麦") forState:(UIControlStateHighlighted)]; [self.upSeatBtn addTarget:self action:@selector(eventAction:) forControlEvents:(UIControlEventTouchUpInside)]; self.upSeatBtn.titleLabel.font = [UIFont systemFontOfSize:12]; self.upSeatBtn.backgroundColor = QXConfig.themeColor; [self.upSeatBtn addRoundedCornersWithRadius:ScaleWidth(12)]; [self.bgView addSubview:self.upSeatBtn]; [self.upSeatBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.right.mas_equalTo(-ScaleWidth(64)); make.centerY.equalTo(self.clearBtn); make.height.mas_equalTo(ScaleWidth(24)); make.width.mas_equalTo(ScaleWidth(44)); }]; self.moreBtn = [[UIButton alloc] init]; [self.moreBtn setImage:[UIImage imageNamed:@"room_user_more"] forState:(UIControlStateNormal)]; [self.moreBtn addTarget:self action:@selector(eventAction:) forControlEvents:(UIControlEventTouchUpInside)]; [self.bgView addSubview:self.moreBtn]; [self.moreBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.right.mas_equalTo(-16); make.centerY.equalTo(self.upSeatBtn); make.height.mas_equalTo(ScaleWidth(24)); make.width.mas_equalTo(ScaleWidth(44)); }]; self.reportBtn = [[UIButton alloc] init]; [self.reportBtn setTitleColor:UIColor.whiteColor forState:(UIControlStateNormal)]; [self.reportBtn setTitle:[NSString stringWithFormat:@"%@ ",QXText(@"举报")] forState:(UIControlStateNormal)]; [self.reportBtn setImage:[UIImage imageNamed:@"room_user_report"] forState:UIControlStateNormal]; self.reportBtn.titleLabel.font = [UIFont systemFontOfSize:12]; self.reportBtn.backgroundColor = RGB16A(0xffffff, 0.2); [self.reportBtn addRoundedCornersWithRadius:ScaleWidth(12)]; [self.reportBtn addTarget:self action:@selector(eventAction:) forControlEvents:(UIControlEventTouchUpInside)]; [self.bgView addSubview:self.reportBtn]; [self.reportBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.right.mas_equalTo(-ScaleWidth(64)); make.centerY.equalTo(self.upSeatBtn); make.height.mas_equalTo(ScaleWidth(24)); make.width.mas_equalTo(ScaleWidth(44)); }]; self.blackBtn = [[UIButton alloc] init]; [self.blackBtn setTitleColor:UIColor.whiteColor forState:(UIControlStateNormal)]; [self.blackBtn setTitle:[NSString stringWithFormat:@"%@ ",QXText(@"拉黑")] forState:(UIControlStateNormal)]; [self.blackBtn setImage:[UIImage imageNamed:@"room_user_black"] forState:UIControlStateNormal]; self.blackBtn.titleLabel.font = [UIFont systemFontOfSize:12]; self.blackBtn.backgroundColor = RGB16A(0xffffff, 0.2); [self.blackBtn addRoundedCornersWithRadius:ScaleWidth(12)]; [self.blackBtn addTarget:self action:@selector(eventAction:) forControlEvents:(UIControlEventTouchUpInside)]; [self.bgView addSubview:self.blackBtn]; [self.blackBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.right.mas_equalTo(-16); make.centerY.equalTo(self.upSeatBtn); make.height.mas_equalTo(ScaleWidth(24)); make.width.mas_equalTo(ScaleWidth(44)); }]; self.giftTitleLabel = [[UILabel alloc] init]; self.giftTitleLabel.textAlignment = NSTextAlignmentCenter; self.giftTitleLabel.font = [UIFont systemFontOfSize:14]; self.giftTitleLabel.textColor = RGB16(0xffffff); self.giftTitleLabel.text = QXText(@"礼物图鉴"); [self.bgView addSubview:self.giftTitleLabel]; [self.giftTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(self.introduceLabel.mas_bottom).offset(5); make.left.mas_equalTo(16); make.height.mas_equalTo(18); }]; self.moreGiftBtn = [[UIButton alloc] init]; [self.moreGiftBtn setTitleColor:RGB16(0x999999) forState:(UIControlStateNormal)]; [self.moreGiftBtn setTitle:[NSString localizedStringWithFormat:QXText(@"90天内累计收到%@个礼物"),@"0"] forState:(UIControlStateNormal)]; self.moreGiftBtn.titleLabel.font = [UIFont systemFontOfSize:12]; [self.moreGiftBtn setImage:[[UIImage imageNamed:@"arrowRight"] imageByTintColor:RGB16(0x999999)] forState:(UIControlStateNormal)]; [self.moreGiftBtn addTarget:self action:@selector(eventAction:) forControlEvents:(UIControlEventTouchUpInside)]; [self.bgView addSubview:self.moreGiftBtn]; [self.moreGiftBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.right.mas_equalTo(-16); make.height.mas_equalTo(30); make.centerY.equalTo(self.giftTitleLabel); }]; [self.moreGiftBtn qx_layoutButtonNOSizeToFitWithEdgeInsetsStyle:(QXButtonEdgeInsetsStyleRight) imageTitleSpace:2]; self.relationshipCardBtn = [[UIButton alloc] init]; self.relationshipCardBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeading; [self.relationshipCardBtn setTitle:QXText(@"关系卡") forState:(UIControlStateNormal)]; [self.relationshipCardBtn setTitleColor:RGB16(0xffffff) forState:(UIControlStateNormal)]; [self.relationshipCardBtn addTarget:self action:@selector(relationSelectedAction:) forControlEvents:(UIControlEventTouchUpInside)]; self.relationshipCardBtn.titleLabel.font = [UIFont boldSystemFontOfSize:16]; [self.bgView addSubview:self.relationshipCardBtn]; [self.relationshipCardBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(16); make.height.mas_equalTo(30); make.top.equalTo(self.giftTitleLabel.mas_bottom).offset(10); make.width.mas_equalTo(60); }]; self.relationshipSeatBtn = [[UIButton alloc] init]; [self.relationshipSeatBtn setTitle:QXText(@"关系位") forState:(UIControlStateNormal)]; [self.relationshipSeatBtn addTarget:self action:@selector(relationSelectedAction:) forControlEvents:(UIControlEventTouchUpInside)]; [self.relationshipSeatBtn setTitleColor:RGB16(0xffffff) forState:(UIControlStateNormal)]; self.relationshipSeatBtn.titleLabel.font = [UIFont boldSystemFontOfSize:14]; [self.bgView addSubview:self.relationshipSeatBtn]; [self.relationshipSeatBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.relationshipCardBtn.mas_right).offset(5); make.height.mas_equalTo(30); make.top.equalTo(self.giftTitleLabel.mas_bottom).offset(10); make.width.mas_equalTo(65); }]; self.relationMoreBtn = [[UIButton alloc] init]; [self.relationMoreBtn setTitle:QXText(@"更多") forState:(UIControlStateNormal)]; [self.relationMoreBtn setImage:[[UIImage imageNamed:@"arrowRight"] imageByTintColor:QXConfig.themeColor] forState:(UIControlStateNormal)]; [self.relationMoreBtn setTitleColor:QXConfig.themeColor forState:(UIControlStateNormal)]; self.relationMoreBtn.titleLabel.font = [UIFont boldSystemFontOfSize:12]; [self.relationMoreBtn addTarget:self action:@selector(relationAction) forControlEvents:(UIControlEventTouchUpInside)]; [self.bgView addSubview:self.relationMoreBtn]; [self.relationMoreBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.right.equalTo(self.bgView.mas_right).offset(-16); make.height.mas_equalTo(30); make.top.equalTo(self.giftTitleLabel.mas_bottom).offset(10); make.width.mas_equalTo(65); }]; [self.relationMoreBtn qx_layoutButtonNOSizeToFitWithEdgeInsetsStyle:(QXButtonEdgeInsetsStyleRight) imageTitleSpace:2]; // self.relationshipScrollview = [SDCycleScrollView cycleScrollViewWithFrame:CGRectZero delegate:self placeholderImage:[UIImage imageNamed:@"room_relationship_card_bg"]]; // self.relationshipScrollview.backgroundColor = [UIColor clearColor]; // [self.bgView insertSubview:self.relationshipScrollview belowSubview:self.relationshipCardBtn]; // [self.relationshipScrollview mas_makeConstraints:^(MASConstraintMaker *make) { // make.top.equalTo(self.relationshipSeatBtn.mas_top).offset(4); // make.left.mas_equalTo(6); // make.right.mas_equalTo(-6); // make.height.mas_equalTo(ScaleWidth(141)); // }]; self.relationTableView = [[UITableView alloc] initWithFrame:CGRectZero style:(UITableViewStylePlain)]; self.relationTableView.delegate = self; self.relationTableView.dataSource = self; self.relationTableView.scrollEnabled = NO; self.relationTableView.backgroundColor = [UIColor clearColor]; self.relationTableView.rowHeight = ScaleWidth(141); [self.bgView insertSubview:self.relationTableView belowSubview:self.relationshipCardBtn]; [self.relationTableView mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(self.relationshipSeatBtn.mas_top).offset(4); make.left.mas_equalTo(6); make.right.mas_equalTo(-6); make.height.mas_equalTo(ScaleWidth(141)); }]; self.bottomView = [[UIView alloc] init]; [self.bgView addSubview:self.bottomView]; [self.bottomView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(16); make.right.mas_equalTo(-16); // make.bottom.mas_equalTo(-(kSafeAreaBottom+10)); // make.top.equalTo(self.relationTableView.mas_bottom).offset(20); make.top.equalTo(self.giftTitleLabel.mas_bottom).offset(12); make.height.mas_equalTo(35); }]; self.toolsArray = @[QXText(@"@TA"),QXText(@"聊天"),QXText(@"关注"),QXText(@"送礼物")]; CGFloat margin = 5; CGFloat btnWidth = (SCREEN_WIDTH-16*2-margin*3)/self.toolsArray.count; for (int i = 0 ; i < self.toolsArray.count; i++) { NSString *title = self.toolsArray[i]; UIButton *btn = [[UIButton alloc] init]; btn.titleLabel.font = [UIFont systemFontOfSize:14]; btn.backgroundColor = RGB16A(0xffffff, 0.2); [btn addRoundedCornersWithRadius:4]; btn.tag = 301 + i; [btn addTarget:self action:@selector(btnEventAction:) forControlEvents:(UIControlEventTouchUpInside)]; [btn setTitle:title forState:(UIControlStateNormal)]; [btn setTitleColor:RGB16(0xffffff) forState:(UIControlStateNormal)]; [self.bottomView addSubview:btn]; [btn mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(i*(btnWidth+margin)); make.width.mas_equalTo(btnWidth); make.top.bottom.equalTo(self.bottomView); }]; } self.relationMoreBtn.hidden = YES; self.relationshipSeatBtn.hidden = YES; self.relationshipCardBtn.hidden = YES; self.relationTableView.hidden = YES; } -(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{ return touch.view == self; } -(void)relationSelectedAction:(UIButton*)sender{ if (sender == self.relationshipSeatBtn) { self.relationshipSeatBtn.titleLabel.font = [UIFont boldSystemFontOfSize:16]; self.relationshipCardBtn.titleLabel.font = [UIFont boldSystemFontOfSize:14]; self.isRealLove = YES; }else{ self.relationshipSeatBtn.titleLabel.font = [UIFont boldSystemFontOfSize:14]; self.relationshipCardBtn.titleLabel.font = [UIFont boldSystemFontOfSize:16]; self.isRealLove = NO; } [self.relationTableView reloadData]; } -(void)clearCharmAction{ [QXMineNetwork roomClearCharmWithRoomId:self.roomId userId:self.userId successBlock:^(NSDictionary * _Nonnull dict) { showToast(@"清除成功"); } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { showToast(msg); }]; } //-(void)getRelationList{ // MJWeakSelf // [QXMineNetwork roomUserRelationWithUserId:self.userId successBlock:^(QXRelationshipList * list) { // weakSelf.listModel = list; // } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { // // }]; //} -(void)relationAction{ [self hide]; self.relationView.isRealLove = self.isRealLove; self.relationView.userId = self.userId; // self.relationView.list = self.listModel; [self.relationView showInView:self.viewController.view]; } -(void)toHomePage{ [self hide]; QXUserHomePageViewController *vc = [[QXUserHomePageViewController alloc] init]; NSString *userId = self.userId; vc.user_id = userId; [self.viewController.navigationController pushViewController:vc animated:YES]; } -(void)setIsPK:(BOOL)isPK{ _isPK = isPK; self.followBtn.hidden = !isPK; } -(void)setIsCompere:(BOOL)isCompere{ _isCompere = isCompere; } -(void)setIsOwner:(BOOL)isOwner{ _isOwner = isOwner; } -(void)setIsNoTakeOff:(BOOL)isNoTakeOff{ _isNoTakeOff = isNoTakeOff; } //-(void)setIsUpSeat:(BOOL)isUpSeat{ // _isUpSeat = isUpSeat; // //} -(void)setUserId:(NSString *)userId{ _userId = userId; [self relationSelectedAction:self.relationshipCardBtn]; if (self.isCompere) { // 主持查看别人 显示更多按钮 显示底部 @TA... self.moreBtn.hidden = NO; self.bottomView.hidden = NO; self.upSeatBtn.hidden = NO; self.reportBtn.hidden = YES; self.blackBtn.hidden = YES; self.clearBtn.hidden = NO; }else if (self.isManager){ self.moreBtn.hidden = NO; self.reportBtn.hidden = YES; self.blackBtn.hidden = YES; self.clearBtn.hidden = NO; }else if (self.isOwner){ self.moreBtn.hidden = NO; self.upSeatBtn.hidden = NO; self.reportBtn.hidden = YES; self.blackBtn.hidden = YES; self.clearBtn.hidden = NO; }else{ // 其他人查看其他人 隐藏更多按钮 self.moreBtn.hidden = YES; if ([userId isEqualToString:[QXGlobal shareGlobal].loginModel.user_id]) { // 非主持麦位上的人查看自己 隐藏举报、拉黑、@Ta... 显示上麦|下麦 self.reportBtn.hidden = YES; self.blackBtn.hidden = YES; self.upSeatBtn.hidden = NO; self.bottomView.hidden = YES; }else{ // 查看的是别人 显示举报、拉黑、@ta.... self.reportBtn.hidden = NO; self.blackBtn.hidden = NO; self.upSeatBtn.hidden = YES; self.bottomView.hidden = NO; } self.clearBtn.hidden = YES; } if ([userId isEqualToString:[QXGlobal shareGlobal].loginModel.user_id]) { /// 主持自己查看自己 隐藏更多按钮 隐藏底部@TA.... self.moreBtn.hidden = YES; self.bottomView.hidden = YES; self.reportBtn.hidden = YES; self.blackBtn.hidden = YES; // self.remindBtn.hidden = YES; }else{ // self.remindBtn.hidden = NO; self.bottomView.hidden = NO; } if (self.isNoTakeOff) { self.upSeatBtn.hidden = YES; } [self getUserInfo]; // [self getRelationList]; } -(void)getUserInfo{ MJWeakSelf [QXMineNetwork roomUserInfoWithUserId:self.userId roomId:self.roomId successBlock:^(QXRoomUserInfoModel * _Nonnull model) { weakSelf.userModel = model; [weakSelf.headerImageView sd_setImageWithURL:[NSURL URLWithString:model.avatar] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]]; [weakSelf.nameBtn setTitle:model.nickname forState:(UIControlStateNormal)]; [weakSelf.nameBtn setImage:model.sex.intValue==1?[UIImage imageNamed:@"user_sex_boy"]:[UIImage imageNamed:@"user_sex_girl"] forState:(UIControlStateNormal)]; [weakSelf.nameBtn qx_layoutButtonNOSizeToFitWithEdgeInsetsStyle:(QXButtonEdgeInsetsStyleRight) imageTitleSpace:2]; weakSelf.idLabel.text = [NSString stringWithFormat:@"ID:%@",model.user_code]; weakSelf.guildLabel.text = [NSString stringWithFormat:@"%@:%@",QXText(@"所属公会"),model.guild]; [weakSelf.upSeatBtn setTitle:model.is_in_pit.intValue==1?QXText(@"下麦"):QXText(@"抱麦") forState:(UIControlStateNormal)]; [weakSelf.moreGiftBtn setTitle:[NSString localizedStringWithFormat:QXText(@"90天内累计收到%@个礼物"),model.gift_num] forState:(UIControlStateNormal)]; [weakSelf.moreGiftBtn qx_layoutButtonNOSizeToFitWithEdgeInsetsStyle:(QXButtonEdgeInsetsStyleRight) imageTitleSpace:2]; weakSelf.introduceLabel.text = model.profile; [weakSelf.relationTableView reloadData]; // if (model.red_status.intValue == 1 && ![weakSelf.userId isEqualToString:[QXGlobal shareGlobal].loginModel.user_id]) { // weakSelf.remindBtn.hidden = NO; // } UIButton *followBtn = [self viewWithTag:303]; if (model.is_follow.intValue == 1) { [followBtn setTitle:QXText(@"已关注") forState:(UIControlStateNormal)]; }else{ [followBtn setTitle:QXText(@"关注") forState:(UIControlStateNormal)]; } if ([weakSelf.userId isEqualToString:[QXGlobal shareGlobal].loginModel.user_id] && model.is_in_pit.intValue==1) { /// 主持自己查看自己 隐藏更多按钮 隐藏底部@TA.... weakSelf.upSeatBtn.hidden = NO; }else{ if (weakSelf.isCompere || weakSelf.isOwner || weakSelf.isManager) { weakSelf.upSeatBtn.hidden = NO; }else{ weakSelf.upSeatBtn.hidden = YES; } } if (weakSelf.isNoTakeOff) { weakSelf.upSeatBtn.hidden = YES; } if (weakSelf.isOwner) { if (weakSelf.isNoTakeOff) { /// 房主上主持麦来查看用户 weakSelf.popView.dataArray = @[ model.is_manager.intValue==0?QXText(@"设为管理"):QXText(@"取消管理"), model.is_host.intValue==0?QXText(@"设为主持"):QXText(@"取消主持"), model.is_mute_pit.intValue == 0?QXText(@"禁麦"):QXText(@"开麦"), model.is_mute.intValue == 0?QXText(@"禁言"):QXText(@"解除禁言"), QXText(@"举报"), QXText(@"拉黑")]; }else{ /// 房主上主持麦来查看用户 weakSelf.popView.dataArray = @[ model.is_manager.intValue==0?QXText(@"设为管理"):QXText(@"取消管理"), model.is_host.intValue==0?QXText(@"设为主持"):QXText(@"取消主持"), model.is_mute_pit.intValue == 0?QXText(@"禁麦"):QXText(@"开麦"), QXText(@"踢出房间"), model.is_mute.intValue == 0?QXText(@"禁言"):QXText(@"解除禁言"), QXText(@"举报"), QXText(@"拉黑")]; } return; } if(weakSelf.isManager){ if (model.pohoulong.intValue == 1) { /// 管理上主持麦来查看用户 weakSelf.moreBtn.hidden = YES; weakSelf.reportBtn.hidden = NO; weakSelf.blackBtn.hidden = NO; weakSelf.upSeatBtn.hidden = YES; }else if (model.is_manager.intValue == 1){ weakSelf.reportBtn.hidden = YES; weakSelf.blackBtn.hidden = YES; weakSelf.upSeatBtn.hidden = NO; weakSelf.moreBtn.hidden = NO; if (weakSelf.isNoTakeOff) { weakSelf.popView.dataArray = @[ model.is_host.intValue==0?QXText(@"设为主持"):QXText(@"取消主持"), model.is_mute_pit.intValue == 0?QXText(@"禁麦"):QXText(@"开麦"), model.is_mute.intValue == 0?QXText(@"禁言"):QXText(@"解除禁言"), QXText(@"举报"), QXText(@"拉黑")]; }else{ weakSelf.popView.dataArray = @[ model.is_host.intValue==0?QXText(@"设为主持"):QXText(@"取消主持"), model.is_mute_pit.intValue == 0?QXText(@"禁麦"):QXText(@"开麦"), QXText(@"踢出房间"), model.is_mute.intValue == 0?QXText(@"禁言"):QXText(@"解除禁言"), QXText(@"举报"), QXText(@"拉黑")]; } }else{ if (weakSelf.isNoTakeOff) { /// 管理上主持麦来查看用户 weakSelf.popView.dataArray = @[ model.is_host.intValue==0?QXText(@"设为主持"):QXText(@"取消主持"), model.is_mute_pit.intValue == 0?QXText(@"禁麦"):QXText(@"开麦"), model.is_mute.intValue == 0?QXText(@"禁言"):QXText(@"解除禁言"), QXText(@"举报"), QXText(@"拉黑")]; }else{ /// 管理上主持麦来查看用户 weakSelf.popView.dataArray = @[ model.is_host.intValue==0?QXText(@"设为主持"):QXText(@"取消主持"), model.is_mute_pit.intValue == 0?QXText(@"禁麦"):QXText(@"开麦"), QXText(@"踢出房间"), model.is_mute.intValue == 0?QXText(@"禁言"):QXText(@"解除禁言"), QXText(@"举报"), QXText(@"拉黑")]; } } if ([weakSelf.userId isEqualToString:[QXGlobal shareGlobal].loginModel.user_id]) { /// 主持自己查看自己 隐藏更多按钮 隐藏底部@TA.... weakSelf.moreBtn.hidden = YES; weakSelf.bottomView.hidden = YES; } return; } if(weakSelf.isCompere){ if (model.pohoulong.intValue == 1 || model.is_manager.intValue == 1) { /// 管理上主持麦来查看用户 weakSelf.moreBtn.hidden = YES; weakSelf.reportBtn.hidden = NO; weakSelf.blackBtn.hidden = NO; weakSelf.upSeatBtn.hidden = YES; }else{ weakSelf.moreBtn.hidden = NO; weakSelf.reportBtn.hidden = YES; weakSelf.blackBtn.hidden = YES; if (weakSelf.isNoTakeOff) { /// 主持主持麦来查看用户 weakSelf.popView.dataArray = @[ model.is_mute_pit.intValue == 0?QXText(@"禁麦"):QXText(@"开麦"), model.is_mute.intValue == 0?QXText(@"禁言"):QXText(@"解除禁言"), QXText(@"举报"), QXText(@"拉黑")]; weakSelf.upSeatBtn.hidden = YES; }else{ weakSelf.upSeatBtn.hidden = NO; /// 主持主持麦来查看用户 weakSelf.popView.dataArray = @[ model.is_mute_pit.intValue == 0?QXText(@"禁麦"):QXText(@"开麦"), QXText(@"踢出房间"), model.is_mute.intValue == 0?QXText(@"禁言"):QXText(@"解除禁言"), QXText(@"举报"), QXText(@"拉黑")]; } } if ([weakSelf.userId isEqualToString:[QXGlobal shareGlobal].loginModel.user_id]) { /// 主持自己查看自己 隐藏更多按钮 隐藏底部@TA.... weakSelf.moreBtn.hidden = YES; weakSelf.bottomView.hidden = YES; } return; } } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { }]; } -(void)didSelectedIndex:(NSInteger)index menuTitle:(NSString *)menuTitle{ MJWeakSelf if ([menuTitle isEqualToString:QXText(@"设为管理")]) { [QXMineNetwork roomAddOrDeleteManagerIsAdd:YES type:2 roomId:self.roomId user_id:self.userId successBlock:^(NSDictionary * _Nonnull dict) { [weakSelf hide]; showToast(@"操作成功"); } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { showToast(msg); }]; }else if ([menuTitle isEqualToString:QXText(@"取消管理")]) { [QXMineNetwork roomAddOrDeleteManagerIsAdd:NO type:2 roomId:self.roomId user_id:self.userId successBlock:^(NSDictionary * _Nonnull dict) { showToast(@"操作成功"); [weakSelf hide]; } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { showToast(msg); }]; }else if ([menuTitle isEqualToString:QXText(@"取消主持")]) { [QXMineNetwork roomAddOrDeleteManagerIsAdd:NO type:1 roomId:self.roomId user_id:self.userId successBlock:^(NSDictionary * _Nonnull dict) { showToast(@"操作成功"); [weakSelf hide]; } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { showToast(msg); }]; }else if ([menuTitle isEqualToString:QXText(@"设为主持")]) { [QXMineNetwork roomAddOrDeleteManagerIsAdd:YES type:1 roomId:self.roomId user_id:self.userId successBlock:^(NSDictionary * _Nonnull dict) { showToast(@"操作成功"); [weakSelf hide]; } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { showToast(msg); }]; }else if ([menuTitle isEqualToString:QXText(@"禁麦")]) { [QXMineNetwork roomMuteWithRoomId:self.roomId userId:self.userId is_mute:@"2" successBlock:^(NSDictionary * _Nonnull dict) { showToast(@"操作成功"); [weakSelf hide]; } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { showToast(msg); }]; }else if ([menuTitle isEqualToString:QXText(@"开麦")]) { [QXMineNetwork roomMuteWithRoomId:self.roomId userId:self.userId is_mute:@"4" successBlock:^(NSDictionary * _Nonnull dict) { showToast(@"操作成功"); [weakSelf hide]; } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { showToast(msg); }]; }else if ([menuTitle isEqualToString:QXText(@"禁言")]) { [QXMineNetwork roomMuteWithRoomId:self.roomId userId:self.userId is_mute:@"1" successBlock:^(NSDictionary * _Nonnull dict) { showToast(@"操作成功"); [weakSelf hide]; } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { showToast(msg); }]; }else if ([menuTitle isEqualToString:QXText(@"解除禁言")]) { [QXMineNetwork roomMuteWithRoomId:self.roomId userId:self.userId is_mute:@"3" successBlock:^(NSDictionary * _Nonnull dict) { showToast(@"操作成功"); [weakSelf hide]; } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { showToast(msg); }]; }else if ([menuTitle isEqualToString:QXText(@"拉黑")]) { [QXMineNetwork addOrRemoveBlackListIsAdd:YES userId:self.userId successBlock:^(NSDictionary * _Nonnull dict) { showToast(@"操作成功"); [weakSelf hide]; } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { showToast(msg); }]; }else if ([menuTitle isEqualToString:QXText(@"踢出房间")]) { [QXMineNetwork roomTakeOffWithRoomId:self.roomId userId:self.userId successBlock:^(NSDictionary * _Nonnull dict) { showToast(@"操作成功"); [weakSelf hide]; } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { showToast(msg); }]; }else if ([menuTitle isEqualToString:QXText(@"举报")]) { [self reprortAction]; } } -(void)reprortAction{ QXReportViewController *reportVC = [[QXReportViewController alloc] init]; reportVC.reportType = @"1"; reportVC.fromId = self.userId; [self.navigationController pushViewController:reportVC animated:YES]; } -(void)eventAction:(UIButton*)sender{ MJWeakSelf if (sender == self.upSeatBtn) { if ([self.userId isEqualToString:QXGlobal.shareGlobal.loginModel.user_id]) { [QXMineNetwork roomUpSeatWithRoomId:self.roomId pit_number:self.pitNumber isUpSeat:NO successBlock:^(NSDictionary * _Nonnull dict) { [weakSelf hide]; } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { showToast(msg); }]; }else{ [QXMineNetwork roomCompereApplyPitWithRoomId:self.roomId pit_number:self.pitNumber user_id:self.userId type:self.userModel.is_in_pit.intValue==1?@"2":@"1" successBlock:^(NSDictionary * _Nonnull dict) { [weakSelf hide]; } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { showToast(msg); }]; } }else if(sender == self.moreBtn){ [self.popView showInView:self.viewController.view]; }else if(sender == self.blackBtn){ [QXMineNetwork addOrRemoveBlackListIsAdd:YES userId:self.userId successBlock:^(NSDictionary * _Nonnull dict) { [weakSelf hide]; } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { showToast(msg); }]; }else if (sender == self.moreGiftBtn){ // [self.giftWallView showInView:self.viewController.view]; QXUserHomePageViewController *vc = [[QXUserHomePageViewController alloc] init]; NSString *userId = self.userId; vc.user_id = userId; vc.isGiftWall = YES; [self.viewController.navigationController pushViewController:vc animated:YES]; }else if(sender == self.reportBtn){ [self reprortAction]; }else if(sender == self.remindBtn){ QXDirectSetScaleView *scaleView = [[QXDirectSetScaleView alloc] init]; scaleView.userId = self.userId; scaleView.isGiveCoin = YES; for (UIWindow *w in [UIApplication sharedApplication].windows) { if ([w isKeyWindow]) { [scaleView showInView:w]; break; } } } } -(void)btnEventAction:(UIButton*)sender{ if (self.userModel == nil) { return; } // if (sender.tag == 301) { if (sender.tag == 303) { [QXDynamicNetwork followWithUserId:self.userId type:@"1" successBlock:^(NSDictionary * _Nonnull dict) { if ([sender.titleLabel.text isEqualToString:QXText(@"关注")]) { [sender setTitle:QXText(@"已关注") forState:(UIControlStateNormal)]; }else{ [sender setTitle:QXText(@"关注") forState:(UIControlStateNormal)]; } } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { showToast(msg); }]; return; } [self hide]; if (self.delegate && [self.delegate respondsToSelector:@selector(didClickEventType:userModel:pitNumber:)]) { [self.delegate didClickEventType:sender.tag userModel:self.userModel pitNumber:self.pitNumber]; } // } } //-(UINib *)customCollectionViewCellNibForCycleScrollView:(SDCycleScrollView *)view{ // UINib *nib = [UINib nibWithNibName:@"QXUserInfoRelationCell" bundle:[NSBundle mainBundle]]; // return nib; //} //-(void)setupCustomCell:(UICollectionViewCell *)cell forIndex:(NSInteger)index cycleScrollView:(SDCycleScrollView *)view{ // QXUserInfoRelationCell *relationCell = (QXUserInfoRelationCell*)cell; // //} -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ return 1; } -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ if (!self.isRealLove) { QXUserInfoRelationCardCell *cell = [QXUserInfoRelationCardCell cellWithTableView:tableView]; cell.isList = NO; cell.model = self.userModel.qinmi; return cell; }else{ QXUserInfoRelationTableCell *cell = [QXUserInfoRelationTableCell cellWithTableView:tableView]; cell.isList = NO; cell.model = self.userModel.zhenai; return cell; } } -(void)showInView:(UIView *)view{ [view addSubview:self]; [UIView animateWithDuration:0.3 animations:^{ self.bgView.y = SCREEN_HEIGHT- ScaleWidth(429-141-50+33)-kSafeAreaBottom; }]; } -(void)hide{ [UIView animateWithDuration:0.3 animations:^{ self.bgView.y = SCREEN_HEIGHT; } completion:^(BOOL finished) { [self removeFromSuperview]; }]; } -(QXMenuPopView *)popView{ if (!_popView) { _popView = [[QXMenuPopView alloc] initWithPoint:CGPointMake(self.width-22-88/2, SCREEN_HEIGHT-kSafeAreaBottom-ScaleWidth(429+33)+self.moreBtn.bottom) width:88 height:210+13]; _popView.type = QXMenuPopViewTypeArrowTop; _popView.delegate = self; } return _popView; } -(QXUserInfoGiftWallView *)giftWallView{ if (!_giftWallView) { _giftWallView = [[QXUserInfoGiftWallView alloc] initWithFrame:UIScreen.mainScreen.bounds]; } return _giftWallView; } -(QXUserRelationListView *)relationView{ if (!_relationView) { _relationView = [[QXUserRelationListView alloc] initWithFrame:UIScreen.mainScreen.bounds]; } return _relationView; } @end