// // 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 "QXUserInfoRelationCardCell.h" #import "QXDirectSetScaleView.h" #import "QXSeatHeaderView.h" #import "CKShimmerLabel.h" #import "QXUserHomeHeaderView.h" #import "QXGiftWallViewController.h" #import "QXUserCpCardView.h" #import "QXUserCpDressView.h" #import "QXHeartBeatSpaceViewController.h" @interface QXRoomUserInfoView() @property (nonatomic,strong)UIView *bgView; @property (nonatomic,strong)UIImageView *bgImageView; /// 头像 @property (nonatomic,strong)QXSeatHeaderView *headerImageView; /// 昵称 @property (nonatomic,strong)CKShimmerLabel *nameLabel; @property (nonatomic,strong)UIImageView *sexImageView; /// ID @property (nonatomic,strong)UILabel *idLabel; /// 公会 @property (nonatomic,strong)UILabel *guildLabel; /// 加入公会 @property (nonatomic,strong)UIButton *joinGuildBtn; /// 关注 @property (nonatomic,strong)UIButton *focusBtn; /// 上下麦 @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)UICollectionView *collectionView; /// 简介 @property (nonatomic,strong)UILabel *introduceLabel; /// 礼物图鉴 @property (nonatomic,strong)UILabel *giftTitleLabel; /// 更多礼物 @property (nonatomic,strong)UIButton *moreGiftBtn; /// 关系列表 @property (nonatomic,strong)QXUserCpCardView *cpContentView; /// 工具栏 @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) QXUserCpDressView *cpDressView; @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(462))]; // self.bgView.backgroundColor = [UIColor whiteColor]; [self addSubview:self.bgView]; self.bgImageView = [[UIImageView alloc] initWithFrame:self.bgView.bounds]; self.bgImageView.image = [UIImage imageNamed:@"room_user_n_bg"]; [self.bgView addSubview:self.bgImageView]; [self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) { make.top.mas_equalTo(0); make.left.right.bottom.equalTo(self.bgView); }]; self.cpDressView = [[QXUserCpDressView alloc] initWithFrame:CGRectMake(self.width-ScaleWidth(20)-ScaleWidth(145), ScaleWidth(20), ScaleWidth(145), ScaleWidth(240))]; self.cpDressView.hidden = YES; [self.bgView addSubview:self.cpDressView]; self.headerImageView = [[QXSeatHeaderView alloc] init]; self.headerImageView.contentMode = UIViewContentModeScaleAspectFill; [self.bgView addSubview:self.headerImageView]; // [self.headerImageView addRoundedCornersWithRadius:ScaleWidth(33)]; [self.headerImageView mas_makeConstraints:^(MASConstraintMaker *make) { make.top.mas_equalTo(38); make.left.mas_equalTo(21); make.size.mas_equalTo(CGSizeMake(ScaleWidth(66), ScaleWidth(79))); }]; 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.nameLabel = [[CKShimmerLabel alloc] initWithFrame:CGRectMake(32, ScaleWidth(79)+2, 100, 18)]; self.nameLabel.shimmerWidth = 20; self.nameLabel.shimmerRadius = 20; self.nameLabel.durationTime = 1; self.nameLabel.repeat = YES; self.nameLabel.textColor = QXConfig.themeColor; self.nameLabel.font = [UIFont boldSystemFontOfSize:18]; self.nameLabel.text = @"羽声语音"; self.nameLabel.contentLabel.textAlignment = NSTextAlignmentCenter; [self.bgView addSubview:self.nameLabel]; [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(self.headerImageView.mas_bottom).offset(2); make.height.mas_equalTo(18); make.left.equalTo(self.headerImageView); make.width.mas_equalTo(100); }]; self.focusBtn = [[UIButton alloc] init]; self.focusBtn.titleLabel.font = [UIFont systemFontOfSize:14]; // self.focusBtn.backgroundColor = RGB16A(0xffffff, 0.2); [self.focusBtn addRoundedCornersWithRadius:12]; self.focusBtn.tag = 400; [self.focusBtn addTarget:self action:@selector(btnEventAction:) forControlEvents:(UIControlEventTouchUpInside)]; [self.focusBtn setTitle:@"+ 关注" forState:(UIControlStateNormal)]; [self.focusBtn setTitle:@"已关注" forState:(UIControlStateSelected)]; [self.focusBtn setBackgroundImage:[UIImage imageWithColor:QXConfig.themeColor] forState:(UIControlStateNormal)]; [self.focusBtn setBackgroundImage:[UIImage imageWithColor:RGB16(0x999999)] forState:(UIControlStateSelected)]; [self.focusBtn setTitleColor:RGB16(0xffffff) forState:(UIControlStateNormal)]; [self.focusBtn setTitleColor:RGB16(0xe3e3e3) forState:(UIControlStateSelected)]; [self.bgView addSubview:self.focusBtn]; [self.focusBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.bottom.equalTo(self.headerImageView).offset(-15); make.height.mas_equalTo(24); make.left.equalTo(self.headerImageView.mas_right).offset(10); make.width.mas_equalTo(50); }]; // self.sexImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 17, 17)]; // [self.bgView addSubview:self.sexImageView]; 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.nameLabel.mas_bottom).offset(5); make.height.mas_equalTo(16); make.left.equalTo(self.headerImageView); make.width.mas_lessThanOrEqualTo(ScaleWidth(180)); }]; 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(5); make.height.mas_equalTo(16); make.left.equalTo(self.headerImageView); make.width.mas_lessThanOrEqualTo(ScaleWidth(180)); }]; self.joinGuildBtn = [[UIButton alloc] init]; [self.joinGuildBtn setTitle:@"立即加入" forState:(UIControlStateNormal)]; self.joinGuildBtn.titleLabel.font = [UIFont systemFontOfSize:14]; [self.joinGuildBtn setTitleColor:QXConfig.themeColor forState:(UIControlStateNormal)]; [self.joinGuildBtn addTarget:self action:@selector(btnEventAction:) forControlEvents:(UIControlEventTouchUpInside)]; [self.bgView addSubview:self.joinGuildBtn]; [self.joinGuildBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.guildLabel.mas_right); make.centerY.equalTo(self.guildLabel); make.height.mas_equalTo(35); }]; // self.iconBgView = [[UIView alloc] init]; // [self.bgView addSubview:self.iconBgView]; // [self.iconBgView mas_makeConstraints:^(MASConstraintMaker *make) { // make.top.equalTo(self.idLabel.mas_bottom).offset(10); // make.size.mas_equalTo(CGSizeMake(42, 16)); // }]; // self.iconView = [[UICollectionView alloc] initWithFrame:<#(CGRect)#> collectionViewLayout:<#(nonnull UICollectionViewLayout *)#>]; // [self.bgView addSubview:self.iconView]; UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; layout.itemSize = CGSizeMake(UserIconWidth, UserIconHeight); layout.minimumLineSpacing = 7; layout.scrollDirection = UICollectionViewScrollDirectionHorizontal; self.collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout]; self.collectionView.delegate = self; self.collectionView.dataSource = self; self.collectionView.backgroundColor = UIColor.clearColor; [self.collectionView registerClass:[QXTagImageCell class] forCellWithReuseIdentifier:@"QXTagImageCell"]; [self.bgView addSubview:self.collectionView]; [self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.headerImageView); make.height.mas_equalTo(UserIconHeight); make.top.equalTo(self.guildLabel.mas_bottom).offset(14); make.width.mas_equalTo(300); }]; self.introduceLabel = [[UILabel alloc] init]; self.introduceLabel.textAlignment = NSTextAlignmentLeft; 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.collectionView.mas_bottom).offset(10); make.left.equalTo(self.headerImageView); make.right.mas_equalTo(-40); make.height.mas_equalTo(40); }]; // 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.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.top.mas_equalTo(13); make.height.mas_equalTo(ScaleWidth(24)); make.width.mas_equalTo(ScaleWidth(44)); }]; 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(12)]; 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.right.equalTo(self.upSeatBtn.mas_left).offset(-10); make.centerY.equalTo(self.upSeatBtn); make.height.mas_equalTo(ScaleWidth(24)); 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(followAction) forControlEvents:(UIControlEventTouchUpInside)]; [self.bgView addSubview:self.followBtn]; [self.followBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.right.equalTo(self.clearBtn.mas_left).offset(-10); make.centerY.equalTo(self.upSeatBtn.mas_bottom); make.height.mas_equalTo(ScaleWidth(24)); make.width.mas_equalTo(ScaleWidth(70)); }]; 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.cpContentView = [[QXUserCpCardView alloc] init]; self.cpContentView.userId = self.userId; self.cpContentView.delegate = self; MJWeakSelf [self.cpContentView addTapBlock:^(id _Nonnull obj) { QXHeartBeatSpaceViewController*vc = [[QXHeartBeatSpaceViewController alloc] init]; vc.userId = weakSelf.userId; [weakSelf.viewController.navigationController pushViewController:vc animated:YES]; }]; [self.bgView addSubview:self.cpContentView]; [self.cpContentView mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(self.moreGiftBtn.mas_bottom).offset(5); make.height.mas_equalTo(ScaleWidth(100)); make.left.mas_equalTo(16); make.right.mas_equalTo(-16); }]; 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.cpContentView.mas_bottom).offset(25); make.height.mas_equalTo(35); }]; self.toolsArray = @[QXText(@"@TA"),QXText(@"发消息"),QXText(@"送礼物")]; CGFloat margin = 5; CGFloat btnWidth = (SCREEN_WIDTH-16*2-margin*2)/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); }]; } } -(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{ return self.userModel.icon.count; } -(__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{ QXTagImageCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"QXTagImageCell" forIndexPath:indexPath]; cell.imageUrl = self.userModel.icon[indexPath.row]; return cell; } -(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{ return touch.view == self; } -(void)didClickHeaderViewUserId:(NSString*)userId{ [self hide]; QXUserHomePageViewController *vc = [[QXUserHomePageViewController alloc] init]; vc.user_id = userId; [self.viewController.navigationController pushViewController:vc animated:YES]; } -(void)didClickHeaderCardViewWithUserId:(NSString*)userId{ if (self.userModel.cp_info != nil) { [self hide]; QXHeartBeatSpaceViewController *vc = [[QXHeartBeatSpaceViewController alloc] init]; vc.userId = self.userId; [self.viewController.navigationController pushViewController:vc animated:YES]; } } -(void)clearCharmAction{ [QXMineNetwork roomClearCharmWithRoomId:self.roomId userId:self.userId successBlock:^(NSDictionary * _Nonnull dict) { showToast(@"清除成功"); } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { showToast(msg); }]; } -(void)followAction{ [[QXGlobal shareGlobal] joinRoomWithRoomId:self.roomId isRejoin:NO navagationController:self.viewController.navigationController]; } -(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.cpContentView.userId = self.userId; 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.focusBtn.hidden = YES; }else{ self.focusBtn.hidden = NO; // self.remindBtn.hidden = NO; self.bottomView.hidden = NO; } if (self.isNoTakeOff) { self.upSeatBtn.hidden = YES; } [self getUserInfo]; // 补充隐藏底部工具栏 if (self.isPK) { self.bottomView.hidden = YES; } // [self getRelationList]; } -(void)getUserInfo{ MJWeakSelf [QXMineNetwork roomUserInfoWithUserId:self.userId roomId:self.roomId successBlock:^(QXRoomUserInfoModel * _Nonnull model) { weakSelf.userModel = model; [weakSelf.headerImageView setHeadIcon:model.avatar dress:@""]; if ([model.nobility_image isExist]) { [weakSelf.headerImageView.nobilityImageView sd_setImageWithURL:[NSURL URLWithString:model.nobility_image]]; }else{ [weakSelf.headerImageView.nobilityImageView sd_cancelLatestImageLoad]; weakSelf.headerImageView.nobilityImageView.image = nil; } if ([model.nickname_color isExist]) { weakSelf.nameLabel.shimmerColor = [UIColor colorWithHexString:model.nickname_color] ; [weakSelf.nameLabel startShimmer]; }else{ [weakSelf.nameLabel stopShimmer]; } weakSelf.nameLabel.text = model.nickname; [weakSelf.nameLabel.contentLabel sizeToFit]; [weakSelf.nameLabel mas_remakeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(weakSelf.headerImageView.mas_bottom).offset(2); make.height.mas_equalTo(18); make.left.equalTo(weakSelf.headerImageView); make.width.mas_equalTo(weakSelf.nameLabel.contentLabel.width); }]; [weakSelf.focusBtn mas_remakeConstraints:^(MASConstraintMaker *make) { make.centerY.equalTo(weakSelf.nameLabel); make.height.mas_equalTo(24); make.left.equalTo(self.nameLabel.mas_right).offset(10); make.width.mas_equalTo(55); }]; if (model.cp_info) { weakSelf.cpDressView.hidden = NO; weakSelf.cpDressView.model = model.cp_info; weakSelf.cpContentView.model = model.cp_info; }else{ [weakSelf.cpContentView resetView]; } // weakSelf.sexImageView.image = model.sex.intValue==1?[UIImage imageNamed:@"user_sex_boy"]:[UIImage imageNamed:@"user_sex_girl"]; // [weakSelf.sexImageView mas_remakeConstraints:^(MASConstraintMaker *make) { // make.width.height.mas_equalTo(17); // make.left.equalTo(weakSelf.nameLabel.mas_right).offset(2); // make.centerY.equalTo(weakSelf.nameLabel); // }]; [weakSelf.collectionView reloadData]; weakSelf.idLabel.text = [NSString stringWithFormat:@"%@ ID:%@",model.sex.intValue==1?@"男":@"女",model.user_code]; weakSelf.guildLabel.text = [NSString stringWithFormat:@"所属公会:%@",[model.guild isExist]?model.guild:@"无"]; if (![model.guild isExist] && ![weakSelf.userId isEqualToString:QXGlobal.shareGlobal.loginModel.user_id]) { weakSelf.joinGuildBtn.hidden = NO; }else{ weakSelf.joinGuildBtn.hidden = YES; } [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; // if (model.red_status.intValue == 1 && ![weakSelf.userId isEqualToString:[QXGlobal shareGlobal].loginModel.user_id]) { // weakSelf.remindBtn.hidden = NO; // } if (model.is_follow.intValue == 1) { // [self.focusBtn setTitle:QXText(@"已关注") forState:(UIControlStateNormal)]; weakSelf.focusBtn.selected = YES; }else{ // [self.focusBtn setTitle:QXText(@"+ 关注") forState:(UIControlStateNormal)]; weakSelf.focusBtn.selected = NO; } 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]; [self hide]; QXGiftWallViewController *vc = [[QXGiftWallViewController alloc] init]; NSString *userId = self.userId; vc.userId = 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 == self.joinGuildBtn) { QXLOG(@"加入公会"); return; } if (sender == self.focusBtn) { [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)]; // } sender.selected = !sender.selected; } 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]; } // } } -(void)showInView:(UIView *)view{ [view addSubview:self]; [UIView animateWithDuration:0.3 animations:^{ self.bgView.y = SCREEN_HEIGHT- ScaleWidth(429+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; } @end