结构调整

This commit is contained in:
启星
2025-10-20 10:29:42 +08:00
parent 2c66709436
commit fdeed970d4
145 changed files with 4 additions and 4 deletions

View File

@@ -0,0 +1,20 @@
//
// QXRedBagRecordViewController.h
// QXLive
//
// Created by 启星 on 2025/10/11.
//
#import "QXBaseViewController.h"
NS_ASSUME_NONNULL_BEGIN
@interface QXRedBagRecordViewController : QXBaseViewController
@property (nonatomic,strong)NSString *redbagId;
@end
@interface QXRedBagRecordCell : UITableViewCell
@property (nonatomic,strong)QXDrawRedpacketRecordModel *recordModel;
+(instancetype)cellWithTabelView:(UITableView*)tableView;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,262 @@
//
// QXRedBagRecordViewController.m
// QXLive
//
// Created by on 2025/10/11.
//
#import "QXRedBagRecordViewController.h"
#import "QXMineNetwork.h"
@class QXRedBagRecordCell;
@interface QXRedBagRecordViewController ()<UITableViewDataSource,UITableViewDelegate>
@property (nonatomic,strong)UIView *topView;
@property (nonatomic,strong)UIImageView *topImageView;
@property (nonatomic,strong)UIImageView *senderHeaderImageView;
@property (nonatomic,strong)UILabel *senderNameLabel;
@property (nonatomic,strong)UILabel *remarkLabel;
@property (nonatomic,strong)UILabel *moneyLabel;
@property (nonatomic,strong)UILabel *bottomLabel;
@property (nonatomic,strong)UILabel *countLabel;
@property (nonatomic,strong)UITableView *tableView;
@property (nonatomic,strong)QXDrawRedPacketModel *model;
@end
@implementation QXRedBagRecordViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
}
- (void)initSubViews{
self.topView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, ScaleWidth(308))];
self.topImageView = [[UIImageView alloc] init];
self.topImageView.image = [UIImage imageNamed:@"red_bag_record_top_bg"];
[self.topView addSubview:self.topImageView];
[self.topImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.bottom.left.right.equalTo(self.topView);
}];
self.senderNameLabel = [[UILabel alloc] init];
self.senderNameLabel.textColor = RGB16(0xffffff);
self.senderNameLabel.font = [UIFont systemFontOfSize:18];
self.senderNameLabel.text = @"-";
[self.topView addSubview:self.senderNameLabel];
[self.senderNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self.topView).offset(41-13);;
make.top.equalTo(self.topView).offset(92);
}];
self.senderHeaderImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"user_header_placehoulder"]];
self.senderHeaderImageView.contentMode = UIViewContentModeScaleAspectFill;
[self.senderHeaderImageView addRoundedCornersWithRadius:20.5];
[self.topView addSubview:self.senderHeaderImageView];
[self.senderHeaderImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.senderNameLabel.mas_left).offset(-13);
make.centerY.equalTo(self.senderNameLabel);
make.width.height.mas_equalTo(41);
}];
self.remarkLabel = [[UILabel alloc] init];
self.remarkLabel.text = @"-";
self.remarkLabel.textColor = RGB16(0xffffff);
self.remarkLabel.font = [UIFont systemFontOfSize:13];
[self.topView addSubview:self.remarkLabel];
[self.remarkLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.senderHeaderImageView.mas_bottom).offset(5);
make.height.mas_equalTo(26);
make.centerX.equalTo(self.topView);
}];
self.moneyLabel = [[UILabel alloc] init];
self.moneyLabel.font = [UIFont boldSystemFontOfSize:19];
self.moneyLabel.textColor = RGB16(0xffffff);
self.moneyLabel.text = @"0金币";
[self.topView addSubview:self.moneyLabel];
[self.moneyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self.topView);
make.top.equalTo(self.remarkLabel.mas_bottom);
}];
self.bottomLabel = [[UILabel alloc] init];
self.bottomLabel.textColor = RGB16(0xffffff);
self.bottomLabel.text = @"已存入钱包";
self.bottomLabel.font = [UIFont systemFontOfSize:13];
[self.topView addSubview:self.bottomLabel];
[self.bottomLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self.topView);
make.top.equalTo(self.moneyLabel.mas_bottom);
}];
self.countLabel = [[UILabel alloc] init];
self.countLabel.textColor = RGB16(0x999999);
self.countLabel.font = [UIFont systemFontOfSize:13];
self.countLabel.text = @"已领取0/0";
[self.topView addSubview:self.countLabel];
[self.countLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo (15);
make.bottom.mas_equalTo(-10);
}];
[self.view addSubview:self.topView];
[self.dataArray addObject:@""];
[self.dataArray addObject:@""];
[self.dataArray addObject:@""];
[self.dataArray addObject:@""];
[self.dataArray addObject:@""];
self.tableView = [[UITableView alloc] initWithFrame:CGRectZero style:(UITableViewStylePlain)];
self.tableView.dataSource = self;
self.tableView.delegate = self;
self.tableView.backgroundColor = RGB16(0xffffff);
self.tableView.rowHeight = 67;
// self.tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
[self.view addSubview:self.tableView];
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.bottom.equalTo(self.view);
make.top.equalTo(self.topView.mas_bottom);
}];
UIButton*backBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, kSafeAreaTop, 44, 44)];
[backBtn setImage:[[UIImage imageNamed:@"back"] imageByTintColor:UIColor.whiteColor] forState:(UIControlStateNormal)];
// backBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeading;
[backBtn addTarget:self action:@selector(backAction) forControlEvents:(UIControlEventTouchUpInside)];
[self.view addSubview:backBtn];
}
-(void)setRedbagId:(NSString *)redbagId{
_redbagId = redbagId;
MJWeakSelf
[QXMineNetwork getRedpacketRecordWithRedpacketId:redbagId successBlock:^(QXDrawRedPacketModel* model) {
weakSelf.model = model;
weakSelf.remarkLabel.text = model.redpacket_info.remark;
[weakSelf.senderHeaderImageView sd_setImageWithURL:[NSURL URLWithString:model.redpacket_info.avatar]];
weakSelf.senderNameLabel.text = [NSString stringWithFormat:@"%@的红包",model.redpacket_info.nickname];
NSString *coinStr = @"";
if (weakSelf.model.redpacket_info.coin_type.intValue == 1) {
weakSelf.bottomLabel.text = @"已存入金币";
coinStr = [NSString stringWithFormat:@"%@%@",model.my_record.amount?model.my_record.amount:@"0",@"金币"];
}else{
weakSelf.bottomLabel.text = @"已存入钻石";
coinStr = [NSString stringWithFormat:@"%@%@",model.my_record.amount?model.my_record.amount:@"0",@"钻石"];
}
NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:coinStr];
[attr yy_setFont:[UIFont boldSystemFontOfSize:46] range:[coinStr rangeOfString:[NSString stringWithFormat:@"%@",model.my_record.amount?model.my_record.amount:@"0"]]];
weakSelf.moneyLabel.attributedText = attr;
weakSelf.countLabel.text = [NSString stringWithFormat:@"已领取%ld/%@",model.redpacket_info.total_count.integerValue-model.redpacket_info.left_count.integerValue,model.redpacket_info.total_count];
[weakSelf.tableView reloadData];
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
}];
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
return 1;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return self.model.records.count;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
QXRedBagRecordCell *cell = [QXRedBagRecordCell cellWithTabelView:tableView];
cell.recordModel = self.model.records[indexPath.row];
return cell;
}
-(void)backAction{
[self.navigationController popViewControllerAnimated:YES];
}
@end
@interface QXRedBagRecordCell()
@property (nonatomic,strong)UIView *bgView;
@property (nonatomic,strong)UIImageView *userHeaderImageView;
@property (nonatomic,strong)UILabel *nameLabel;
@property (nonatomic,strong)UILabel *timeLabel;
@property (nonatomic,strong)UILabel *moneyLabel;
@end
@implementation QXRedBagRecordCell
+(instancetype)cellWithTabelView:(UITableView *)tableView{
static NSString *cellId = @"QXRedBagRecordCell";
QXRedBagRecordCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
if (!cell) {
cell = [[QXRedBagRecordCell alloc] initWithStyle:(UITableViewCellStyleDefault) reuseIdentifier:cellId];
}
return cell;
}
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
self.selectionStyle = UITableViewCellSelectionStyleNone;
self.backgroundColor = [UIColor clearColor];
[self initSubviews];
}
return self;
}
-(void)setRecordModel:(QXDrawRedpacketRecordModel *)recordModel{
_recordModel = recordModel;
self.nameLabel.text = recordModel.nickname;
[self.userHeaderImageView sd_setImageWithURL:[NSURL URLWithString:recordModel.avatar]];
self.timeLabel.text = recordModel.createtime;
self.moneyLabel.text = recordModel.amount;
}
-(void)initSubviews{
self.bgView = [[UIView alloc] init];
[self.contentView addSubview:self.bgView];
[self.bgView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(15);
make.right.mas_equalTo(-15);
make.height.mas_equalTo(52);
make.centerY.equalTo(self.contentView);
}];
self.userHeaderImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"user_header_placehoulder"]];
self.userHeaderImageView.contentMode = UIViewContentModeScaleAspectFill;
[self.userHeaderImageView addRoundedCornersWithRadius:24.5];
[self.bgView addSubview:self.userHeaderImageView];
[self.userHeaderImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.centerY.equalTo(self.bgView);
make.width.height.mas_equalTo(49);
}];
self.nameLabel = [[UILabel alloc] init];
self.nameLabel.textColor = RGB16(0x666666);
self.nameLabel.text = @"大家好,我是傻狗涛";
self.nameLabel.font = [UIFont systemFontOfSize:14];
[self.bgView addSubview:self.nameLabel];
[self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.userHeaderImageView.mas_right).offset(13);
make.top.equalTo(self.userHeaderImageView);
make.height.mas_equalTo(26);
}];
self.timeLabel = [[UILabel alloc] init];
self.timeLabel.textColor = RGB16(0x999999);
self.timeLabel.font = [UIFont systemFontOfSize:14];
self.timeLabel.text = @"00:61";
[self.bgView addSubview:self.timeLabel];
[self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.userHeaderImageView.mas_right).offset(13);
make.bottom.equalTo(self.userHeaderImageView);
make.height.mas_equalTo(26);
}];
self.moneyLabel = [[UILabel alloc] init];
self.moneyLabel.textColor = RGB16(0x333333);
self.moneyLabel.text = @"0 金币";
self.moneyLabel.font = [UIFont systemFontOfSize:14];
[self.bgView addSubview:self.moneyLabel];
[self.moneyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.bgView);
make.centerY.equalTo(self.bgView);
}];
}
@end

View File

@@ -0,0 +1,16 @@
//
// QXRoomViewController+Activity.h
// QXLive
//
// Created by 启星 on 2025/10/15.
//
#import "QXRoomViewController.h"
NS_ASSUME_NONNULL_BEGIN
@interface QXRoomViewController (Activity)
-(void)initActivityObeserver;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,36 @@
//
// QXRoomViewController+Activity.m
// QXLive
//
// Created by on 2025/10/15.
//
#import "QXRoomViewController+Activity.h"
#import "QXMeetActivityDriftView.h"
@implementation QXRoomViewController (Activity)
-(void)initActivityObeserver{
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateProgress:) name:noticeXLHNotice object:nil];
}
-(void)updateProgress:(NSNotification *)notice{
QXMeetActivityDriftModel *model = notice.object;
if (model.from_type == QXMeetActivityTypeAcLock) {
[self.meetView updateUserAndGiftInfoWithModel:model];
self.acTagView.end_time = model.end_time.longLongValue;
return;
}
if (model.from_type == QXMeetActivityTypeAcProgress) {
[self.skyView updateProgress:model.xlh_data];
[self.ageView updateProgress:model.xlh_data];
[self.timeView updateProgress:model.xlh_data];
}
if (model.xlh_data.status.intValue == 1) {
self.acTagView.end_time = model.xlh_data.end_time;
[self.view addSubview:self.acTagView];
}else{
[self.acTagView stopTimer];
[self.acTagView removeFromSuperview];
}
}
@end

View File

@@ -0,0 +1,22 @@
//
// QXRoomViewController+Friend.h
// QXLive
//
// Created by 启星 on 2025/8/20.
//
#import "QXRoomViewController.h"
NS_ASSUME_NONNULL_BEGIN
@interface QXRoomViewController (Friend)
/// 重置麦位视图
-(void)resetFriendViews;
/// 交友房阶段发生变化 step 阶段 1等待 2心动 3牵手 friend_id 场次id
//-(void)friendPartDidChangedWithType:(NSString*)step friend_id:(NSString*)friend_id;
///// 交友房时间发生延时 end_time 截止时间
//-(void)friendTimeDelayWithTime:(NSString*)end_time;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,121 @@
//
// QXRoomViewController+Friend.m
// QXLive
//
// Created by on 2025/8/20.
//
#import "QXRoomViewController+Friend.h"
#import "QXAgoraEngine.h"
@implementation QXRoomViewController (Friend)
-(void)resetFriendViews{
[self.seatContentView setType:QXRoomSeatViewTypeFriend];
[self.seatContentView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(self.view);
make.top.mas_equalTo(self.titleView.bottom);
make.height.mas_equalTo(ScaleWidth(377));
}];
[self.chatListView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.bottom.equalTo(self.bottomView.mas_top);
make.left.equalTo(self.view);
make.top.equalTo(self.seatContentView.mas_bottom);
// make.right.equalTo(self.soundBtn.mas_left).offset(-16);
make.width.mas_equalTo(ScaleWidth(280));
}];
}
-(void)friendPartDidChangedWithType:(NSString*)step friend_id:(NSString*)friend_id end_time:(NSString*)end_time relationModel:(nonnull QXRoomFriendRelationModel *)relationModel{
[self.seatContentView friendPartDidChangedWithType:step friend_id:friend_id end_time:end_time relationModel:relationModel];
}
-(void)friendTimeDelayWithTime:(NSString *)end_time{
[self.seatContentView friendTimeDelayWithTime:end_time];
}
-(void)friendSeatDidChanged:(NSArray<QXRoomPitModel *> *)pitArray{
BOOL haveMe = NO;
if (self.seatContentView.myPitNumber == 9 || self.seatContentView.myPitNumber == 10) {
haveMe = YES;
}
for (QXRoomPitModel*md in pitArray) {
if ([md.user_id isEqualToString:QXGlobal.shareGlobal.loginModel.user_id]) {
self.seatContentView.myPitNumber = md.pit_number.integerValue;
haveMe = YES;
break;
}
}
if (haveMe == NO) {
self.bottomView.status = 1;
[[QXAgoraEngine sharedEngine] setClientRoleBroadcaster:NO];
}else{
self.bottomView.status = 2;
if ([QXAgoraEngine sharedEngine].isOpenMic) {
[self.bottomView setMuteAudioStatus:1];
}else{
[self.bottomView setMuteAudioStatus:0];
}
}
[self.seatContentView friendSeatDidChanged:pitArray];
}
-(void)friendPowerSendGiftWithUser:(QXRoomPitModel *)user heartId:(NSString *)heartId{
self.sendGiftView.type = QXSendGiftViewTypeFriend;
QXRoomPitModel *model = [[QXRoomPitModel alloc] init];
model.pit_number = user.pit_number;
model.user_id = user.user_id;
model.nickname = user.nickname;
model.avatar = user.avatar;
self.sendGiftView.userModel = model;
self.sendGiftView.heartId = heartId;
self.sendGiftView.roomId = self.roomId;
[self.sendGiftView showInView:self.view];
}
-(void)friendHeartNumberDidChanged:(NSArray<QXRoomFriendHeartListModel *> *)heartArray{
[self.seatContentView friendHeartNumberDidChanged:heartArray];
}
///
-(void)friendRelationIsCreatedWithrelationModel:(QXRoomFriendRelationModel*)relationModel{
[self.seatContentView friendRelationIsCreatedWithrelationModel:relationModel];
}
/// 退
-(void)friendCabinRoomIsQuit{
[[QXGlobal shareGlobal] quitRoomWithRoomId:self.roomId];
NSMutableArray *viewControllers = [NSMutableArray arrayWithArray:self.navigationController.viewControllers];
for (int i = 0; i < viewControllers.count; i++) {
UIViewController *vc = [viewControllers objectAtIndex:i];
if ([vc isEqual:self]) {
QXRoomViewController *roomVc = [[QXRoomViewController alloc] init];
roomVc.roomId = QXGlobal.shareGlobal.superRoomId;
[viewControllers insertObject:roomVc atIndex:i];
break;
}
}
self.navigationController.viewControllers = viewControllers;
[self.navigationController popViewControllerAnimated:YES];
QXGlobal.shareGlobal.superRoomId = @"";
// [self.navigationController popViewControllerAnimated:YES];
}
///
-(void)friendCabinRoomTimeDelayWithTime:(NSString*)end_time{
[self.seatContentView friendCabinRoomTimeDelayWithTime:end_time];
}
-(void)meetActivityProgressIsUpdate:(NSDictionary *)updateDict{
QXXLHModel *model = [QXXLHModel yy_modelWithJSON:updateDict[@"xlh_data"]];
[self.skyView updateProgress:model];
[self.ageView updateProgress:model];
[self.timeView updateProgress:model];
if (model.status.intValue == 1) {
self.acTagView.end_time = model.end_time;
[self.view addSubview:self.acTagView];
}else{
[self.acTagView stopTimer];
[self.acTagView removeFromSuperview];
}
}
-(void)meetActivityGiftInfoIsUpdate:(QXRoomChatListModel *)giftInfo{
// [self.meetView updateUserAndGiftInfoWithModel:giftInfo];
// self.acTagView.end_time = giftInfo.end_time.longLongValue;
}
@end

View File

@@ -0,0 +1,16 @@
//
// QXRoomViewController+RedPacket.h
// QXLive
//
// Created by 启星 on 2025/10/13.
//
#import "QXRoomViewController.h"
#import "QXRedPacketManager.h"
NS_ASSUME_NONNULL_BEGIN
@interface QXRoomViewController (RedPacket)<QXRedPacketManagerDelegate>
-(void)initRedpacketManager;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,119 @@
//
// QXRoomViewController+RedPacket.m
// QXLive
//
// Created by on 2025/10/13.
//
#import "QXRoomViewController+RedPacket.h"
#import "QXMineNetwork.h"
@implementation QXRoomViewController (RedPacket)
-(void)recievedRedPacket:(QXRedPacketModel *)model{
self.redBagTagView.hidden = NO;
[[QXRedPacketManager sharedManager] addRedPacket:model];
}
-(void)redPacketDidFinished:(NSString *)redpacket_id{
[[QXRedPacketManager sharedManager] removeRedPacket:redpacket_id];
NSArray *arr = [QXRedPacketManager sharedManager].allRedPackets;
if (self.redbagListView) {
self.redbagListView.dataArray = arr;
}
self.redBagTagView.count = [NSString stringWithFormat:@"%ld",arr.count];
}
-(void)initRedpacketManager{
[QXRedPacketManager sharedManager].delegate = self;
[[QXRedPacketManager sharedManager] startCheckTimer];
//
[self getRedBagList];
}
-(void)getRedBagList{
MJWeakSelf
[QXMineNetwork getRedpacketListWithRoomId:self.roomId successBlock:^(NSArray<QXRedPacketModel *> * _Nonnull list) {
if (list.count > 0) {
weakSelf.redBagTagView.count = [NSString stringWithFormat:@"%ld",list.count];
weakSelf.redBagTagView.hidden = NO;
[[QXRedPacketManager sharedManager] addRedPackets:list];
}else{
[[QXRedPacketManager sharedManager] removeAllRedpackets];
}
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
}];
}
#pragma mark - QXRedPacketManagerDelegate
///
-(void)QXRedPacketManager:(QXRedPacketManager *)manager didAddRedPacket:(QXRedPacketModel *)redPacket remainingCount:(NSInteger)remainingCount{
self.redBagTagView.count = [NSString stringWithFormat:@"%ld",remainingCount];
}
///
- (void)QXRedPacketManager:(QXRedPacketManager *)manager didRemoveRedPacket:(NSString *)packetId remainingCount:(NSInteger)remainingCount{
self.redBagTagView.count = [NSString stringWithFormat:@"%ld",remainingCount];
}
///
- (void)QXRedPacketManager:(QXRedPacketManager *)manager didUpdateRedPacket:(QXRedPacketModel *)redPacket remainingCount:(NSInteger)remainingCount{
if (self.redbagDrawView.redpacketModel != nil && self.redbagDrawView.redpacketModel.countdown > 0) {
if (self.redbagDrawView.redpacketModel.type.intValue == 1) {
[self.redbagDrawView changeViewType:(QXRedBagDrawTypeOpen)];
}else{
if (self.redbagDrawView.isFromToComment) {
[self.redbagDrawView changeViewType:(QXRedBagDrawTypeOpen)];
}
}
}
}
- (void)QXRedPacketManager:(QXRedPacketManager *)manager didAddRedPackets:(NSArray<QXRedPacketModel *> *)redPackets remainingCount:(NSInteger)remainingCount{
self.redBagTagView.count = [NSString stringWithFormat:@"%ld",remainingCount];
}
- (void)QXRedPacketManager:(QXRedPacketManager *)manager didUpdateRedPacketTime:(long)time redPacket:(QXRedPacketModel *)redPacket {
///
if (self.redbagDrawView.redpacketModel != nil && self.redbagDrawView.redpacketModel.countdown > 0 && time>=0) {
if (self.redbagDrawView.redpacketModel.type.intValue == 1) {
//
if ([self.redbagDrawView.redpacketModel.conditions containsString:@"1"]) {
//
if (self.roomModel.user_info.is_collect.intValue == 1) {
///
if (redPacket == self.redbagDrawView.redpacketModel) {
self.redbagDrawView.needTime = time;
}
}
}else{
if (redPacket == self.redbagDrawView.redpacketModel) {
self.redbagDrawView.needTime = time;
}
}
}else{
if (self.redbagDrawView.isFromToComment) {
//
if ([self.redbagDrawView.redpacketModel.conditions containsString:@"1"]) {
//
if (self.roomModel.user_info.is_collect.intValue == 1) {
///
if (redPacket == self.redbagDrawView.redpacketModel) {
self.redbagDrawView.needTime = time;
}
}
}else{
if (redPacket == self.redbagDrawView.redpacketModel) {
self.redbagDrawView.needTime = time;
}
}
}
}
}
///
if (self.redbagListView.dataArray.count > 0) {
NSInteger index = [self.redbagListView.dataArray indexOfObject:redPacket];
[self.redbagListView updateRedpacketTimeWithIndex:index time:time];
}
}
@end

View File

@@ -0,0 +1,65 @@
//
// QXRoomViewController.h
// QXLive
//
// Created by 启星 on 2025/6/7.
//
#import "QXBaseViewController.h"
#import "QXGlobal.h"
#import "QXRoomSeatView.h"
#import "QXRoomChatListView.h"
#import "QXRoomTitleView.h"
#import "QXRoomBottomView.h"
#import "QXRoomMessageManager.h"
#import "QXSendGiftView.h"
/// 活动
#import "QXSkyPraizeView.h"/// 天空之境
#import "QXAgePraizeView.h"/// 岁月之城
#import "QXTimePraizeView.h"/// 时空之巅
#import "QXMeetActivityView.h"
#import "QXActivityTagView.h"
/// 红包
#import "QXRedBagTagView.h"
#import "QXRedBagDrawView.h"
#import "QXRedBagListView.h"
NS_ASSUME_NONNULL_BEGIN
@interface QXRoomViewController : QXBaseViewController<QXRoomMessageManagerDelegate,QXRoomSeatDelegate>
@property (nonatomic,strong)NSString *roomId;
/// 是否为最小化房间进来
@property (nonatomic,assign)BOOL isReJoin;
@property (nonatomic,strong)QXRoomModel* roomModel;
/// 麦位视图
@property (nonatomic,strong)QXRoomSeatView *seatContentView;
/// 聊天列表
@property (nonatomic,strong)QXRoomChatListView *chatListView;
/// 顶部房间信息
@property (nonatomic,strong)QXRoomTitleView *titleView;
/// 底部工具栏
@property (nonatomic,strong)QXRoomBottomView *bottomView;
/// 发送礼物
@property (nonatomic,strong)QXSendGiftView *sendGiftView;
/// 红包入口
@property (nonatomic,strong)QXRedBagTagView *redBagTagView;
@property (nonatomic,strong)QXRedBagDrawView *redbagDrawView;
@property (nonatomic,strong)QXRedBagListView *redbagListView;
@property (nonatomic,strong)QXActivityTagView *acTagView;
@property (nonatomic,strong)QXSkyPraizeView *skyView;
@property (nonatomic,strong)QXAgePraizeView *ageView;
@property (nonatomic,strong)QXTimePraizeView *timeView;
/// 巡乐会
@property (nonatomic,strong)QXMeetActivityView *meetView;
-(void)configBottomTools;
-(void)stopHWDMP4;
-(void)playHWDMP4;
-(void)destroyViews;
@end
NS_ASSUME_NONNULL_END

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,34 @@
//
// QXRoomPKResultView.h
// QXLive
//
// Created by 启星 on 2025/7/3.
//
#import <UIKit/UIKit.h>
typedef NS_ENUM(NSInteger) {
/// pk胜利
QXRoomPKResulttTypeVictory = 0,
/// pk失败
QXRoomPKResulttTypeDefeated,
/// 平局
QXRoomPKResulttTypeTie,
}QXRoomPKResulttType;
NS_ASSUME_NONNULL_BEGIN
@interface QXRoomPKResultView : UIView
-(instancetype)initWithType:(QXRoomPKResulttType)type;
@property (nonatomic,assign)QXRoomPKResulttType type;
-(void)setResultWithVictory_name:(NSString*)victory_name
victory_cover:(NSString*)victory_cover
defeated_name:(NSString*)defeated_name
defeated_cover:(NSString*)defeated_cover;
-(void)showInView:(UIView *)view;
-(void)hide;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,176 @@
//
// QXRoomPKResultView.m
// QXLive
//
// Created by on 2025/7/3.
//
#import "QXRoomPKResultView.h"
#import "QXTimer.h"
@interface QXRoomPKResultView()
@property (nonatomic,strong)UIView *bgView;
@property (nonatomic,strong)UIImageView *bgImageView;
@property (nonatomic,strong)UIImageView *victoryHeader;
@property (nonatomic,strong)UILabel *victoryNameLabel;
@property (nonatomic,strong)UIImageView *victoryImageView;
@property (nonatomic,strong)UIImageView *defeatedHeader;
@property (nonatomic,strong)UILabel *defeatedNameLabel;
@property (nonatomic,strong)UIImageView *defeatedImageView;
@property (nonatomic,strong)QXTimer *timer;
@end
@implementation QXRoomPKResultView
- (instancetype)initWithType:(QXRoomPKResulttType)type
{
self = [super init];
if (self) {
_type = type;
[self initSubviews];
}
return self;
}
-(void)initSubviews{
self.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.3];
self.bgView = [[UIView alloc] initWithFrame:CGRectMake(0, (SCREEN_HEIGHT-SCREEN_WIDTH)/2, SCREEN_WIDTH, SCREEN_WIDTH)];
[self addSubview:self.bgView];
self.bgImageView = [[UIImageView alloc] init];
self.bgImageView.frame = CGRectMake(0, 0, self.bgView.width, ScaleWidth(248));
[self.bgView addSubview:self.bgImageView];
self.victoryHeader = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"user_header_placehoulder"]];
self.victoryHeader.contentMode = UIViewContentModeScaleAspectFill;
self.victoryHeader.frame = CGRectMake(ScaleWidth(34), ScaleWidth(85), ScaleWidth(50), ScaleWidth(50));
[self.victoryHeader addRoundedCornersWithRadius:ScaleWidth(25)];
[self.bgView addSubview:self.victoryHeader];
// room_pk_victory
self.victoryNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.victoryHeader.left-ScaleWidth(18), self.victoryHeader.bottom+5, ScaleWidth(50+36), 20)];
self.victoryNameLabel.font = [UIFont systemFontOfSize:12];
self.victoryNameLabel.textColor = [UIColor whiteColor];
self.victoryNameLabel.textAlignment = NSTextAlignmentCenter;
self.victoryNameLabel.text = @"张三";
[self.bgView addSubview:self.victoryNameLabel];
self.victoryImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, self.victoryHeader.bottom-ScaleWidth(17)+5, ScaleWidth(15), ScaleWidth(17))];
self.victoryImageView.image = [UIImage imageNamed:@"room_pk_victory"];
[self.bgView addSubview:self.victoryImageView];
self.victoryImageView.centerX = self.victoryHeader.centerX;
self.defeatedHeader = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"user_header_placehoulder"]];
self.defeatedHeader.contentMode = UIViewContentModeScaleAspectFill;
self.defeatedHeader.frame = CGRectMake(self.bgView.width-ScaleWidth(34+50), self.bgImageView.bottom-ScaleWidth(50+55), ScaleWidth(50), ScaleWidth(50));
[self.defeatedHeader addRoundedCornersWithRadius:ScaleWidth(25)];
[self.bgView addSubview:self.defeatedHeader];
self.defeatedNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.defeatedHeader.left-ScaleWidth(18), self.defeatedHeader.bottom+5, ScaleWidth(50+36), 20)];
self.defeatedNameLabel.font = [UIFont systemFontOfSize:12];
self.defeatedNameLabel.textColor = [UIColor whiteColor];
self.defeatedNameLabel.textAlignment = NSTextAlignmentCenter;
self.defeatedNameLabel.text = @"李四";
[self.bgView addSubview:self.defeatedNameLabel];
self.defeatedImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, self.defeatedHeader.bottom-ScaleWidth(17)+5, ScaleWidth(15), ScaleWidth(17))];
self.defeatedImageView.image = [UIImage imageNamed:@"room_pk_defeated"];
self.defeatedImageView.centerX = self.defeatedHeader.centerX;
[self.bgView addSubview:self.defeatedImageView];
[self setType:_type];
}
-(void)setType:(QXRoomPKResulttType)type{
_type = type;
NSString *imageName = @"";
switch (_type) {
case QXRoomPKResulttTypeVictory:
imageName = @"room_pk_result_victory";
break;
case QXRoomPKResulttTypeDefeated:
imageName = @"room_pk_result_defeated";
break;
case QXRoomPKResulttTypeTie:
imageName = @"room_pk_result_tie";
break;
default:
break;
}
self.bgImageView.image = [UIImage imageNamed:imageName];
}
-(void)setResultWithVictory_name:(NSString *)victory_name
victory_cover:(NSString *)victory_cover
defeated_name:(NSString *)defeated_name
defeated_cover:(NSString *)defeated_cover{
switch (self.type) {
case QXRoomPKResulttTypeVictory:{
[self.victoryHeader sd_setImageWithURL:[NSURL URLWithString:victory_cover]];
self.victoryNameLabel.text = victory_name;
self.victoryImageView.hidden = NO;
self.victoryImageView.image = [UIImage imageNamed:@"room_pk_victory"];
[self.defeatedHeader sd_setImageWithURL:[NSURL URLWithString:defeated_cover]];
self.defeatedNameLabel.text = defeated_name;
self.defeatedImageView.hidden = NO;
self.defeatedImageView.image = [UIImage imageNamed:@"room_pk_defeated"];
}
break;
case QXRoomPKResulttTypeDefeated:{
[self.victoryHeader sd_setImageWithURL:[NSURL URLWithString:defeated_cover]];
self.victoryNameLabel.text = defeated_name;
self.victoryImageView.hidden = NO;
self.victoryImageView.image = [UIImage imageNamed:@"room_pk_defeated"];
[self.defeatedHeader sd_setImageWithURL:[NSURL URLWithString:victory_cover]];
self.defeatedNameLabel.text = victory_name;
self.defeatedImageView.hidden = NO;
self.defeatedImageView.image = [UIImage imageNamed:@"room_pk_victory"];
}
break;
case QXRoomPKResulttTypeTie:{
[self.victoryHeader sd_setImageWithURL:[NSURL URLWithString:victory_cover]];
self.victoryNameLabel.text = victory_name;
self.victoryImageView.hidden = YES;
[self.defeatedHeader sd_setImageWithURL:[NSURL URLWithString:defeated_cover]];
self.defeatedNameLabel.text = defeated_name;
self.defeatedImageView.hidden = YES;
}
break;
default:
break;
}
}
-(void)showInView:(UIView *)view{
MJWeakSelf
__block int timeCount = 3;
_timer = [QXTimer scheduledTimerWithTimeInterval:1 repeats:YES queue:dispatch_get_main_queue() block:^{
timeCount--;
if (timeCount<=0) {
[weakSelf hide];
}
}];
self.bgView.alpha = 0;
[view addSubview:self];
[UIView animateWithDuration:0.2 animations:^{
self.bgView.alpha = 1;
}];
}
-(void)hide{
if (_timer) {
[self->_timer invalidate];
_timer = nil;
}
[UIView animateWithDuration:0.3 animations:^{
self.bgView.alpha = 0;
} completion:^(BOOL finished) {
[self removeFromSuperview];
}];
}
@end

View File

@@ -0,0 +1,19 @@
//
// QXRoomPKSearchView.h
// QXLive
//
// Created by 启星 on 2025/7/2.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface QXRoomPKSearchView : UIView
@property (nonatomic,strong)NSString *roomId;
-(void)showInView:(UIView *)view;
-(void)hide;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,227 @@
//
// QXRoomPKSearchView.m
// QXLive
//
// Created by on 2025/7/2.
//
#import "QXRoomPKSearchView.h"
#import "QXMineNetwork.h"
#import "QXAddDirectCell.h"
#import "UIButton+QX.h"
#import "QXRoomPKSetView.h"
@interface QXRoomPKSearchView()<UIGestureRecognizerDelegate,UITextFieldDelegate,UITableViewDelegate,UITableViewDataSource,QXDirectDelegate>
@property (nonatomic,strong)UIView *bgView;
@property (nonatomic,strong)UILabel *titleLabel;
@property (nonatomic,strong)UIButton *setBtn;
@property (nonatomic,strong)UIButton *pkBtn;
@property (nonatomic,strong)UIView *seachBgView;
@property (nonatomic,strong)UIImageView *searchImageView;
@property (nonatomic,strong)UITextField *textField;
@property (nonatomic,strong)UILabel*sectionLabel;
@property (nonatomic,strong)UITableView*tableView;
@property (nonatomic,strong)NSMutableArray*dataArray;
@property (nonatomic,assign)NSInteger page;
@property (nonatomic,strong)QXRoomPKSetView *pkSetView;
@end
@implementation QXRoomPKSearchView
- (instancetype)init
{
self = [super init];
if (self) {
self.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
[self initSubviews];
}
return self;
}
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{
return touch.view == self;
}
-(void)initSubviews{
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hide)];
tap.delegate = self;
[self addGestureRecognizer:tap];
self.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.3];
self.bgView = [[UIView alloc] initWithFrame:CGRectMake(0, ScaleWidth(144), SCREEN_WIDTH, ScaleWidth(429)+kSafeAreaBottom)];
self.bgView.backgroundColor = UIColor.whiteColor;
[self.bgView addRoundedCornersWithRadius:16 byRoundingCorners:(UIRectCornerTopLeft|UIRectCornerTopRight)];
[self addSubview:self.bgView];
self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, 16, 300, 24)];
self.titleLabel.text = @"发起直播对战";
self.titleLabel.font = [UIFont boldSystemFontOfSize:16];
self.titleLabel.textColor = [UIColor colorWithHexString:@"#333333"];
[self.bgView addSubview:self.titleLabel];
self.setBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.bgView.width-50-6, 7, 50, 44)];
[self.setBtn setTitle:@"设置" forState:(UIControlStateNormal)];
self.setBtn.titleLabel.font = [UIFont systemFontOfSize:12];
[self.setBtn setTitleColor:RGB16(0x999999) forState:(UIControlStateNormal)];
[self.setBtn setImage:[[UIImage imageNamed:@"arrowRight"] imageByTintColor:RGB16(0x999999)] forState:(UIControlStateNormal)];
[self.setBtn qx_layoutButtonNOSizeToFitWithEdgeInsetsStyle:(QXButtonEdgeInsetsStyleRight) imageTitleSpace:2];
[self.setBtn addTarget:self action:@selector(setAction) forControlEvents:(UIControlEventTouchUpInside)];
[self.bgView addSubview:self.setBtn];
self.pkBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.bgView.width-50-16, self.titleLabel.bottom+12, 50, 35)];
[self.pkBtn setBackgroundImage:[UIImage imageNamed:@"room_pk_random_icon"] forState:(UIControlStateNormal)];
[self.pkBtn addTarget:self action:@selector(pkAction) forControlEvents:(UIControlEventTouchUpInside)];
[self.bgView addSubview:self.pkBtn];
self.seachBgView = [[UIView alloc] initWithFrame:CGRectMake(16, self.titleLabel.bottom+12, SCREEN_WIDTH-16-74, 35)];
self.seachBgView.backgroundColor = [UIColor colorWithHexString:@"#EFF2F8"];
self.seachBgView.layer.masksToBounds = YES;
self.seachBgView.layer.cornerRadius = 17.5;
[self.bgView addSubview:self.seachBgView];
self.searchImageView = [[UIImageView alloc] initWithFrame:CGRectMake(8, 5.5, 24, 24)];
self.searchImageView.image = [UIImage imageNamed:@"room_song_search"];
[self.seachBgView addSubview:self.searchImageView];
self.textField = [[UITextField alloc] initWithFrame:CGRectMake(self.searchImageView.right+6, 0, self.seachBgView.width-self.searchImageView.right-6-8, 35)];
self.textField.placeholder = @"请根据房间ID搜索";
self.textField.font = [UIFont systemFontOfSize:14];
[self.textField addTarget:self action:@selector(textDidChange:) forControlEvents:(UIControlEventEditingChanged)];
self.textField.returnKeyType = UIReturnKeyDone;
self.textField.delegate = self;
self.textField.textColor = [UIColor colorWithHexString:@"#333333"];
[self.seachBgView addSubview:self.textField];
self.sectionLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, self.seachBgView.bottom+5, 300, 20)];
self.sectionLabel.text = @"为你推荐";
self.sectionLabel.font = [UIFont boldSystemFontOfSize:16];
self.sectionLabel.textColor = [UIColor colorWithHexString:@"#333333"];
[self.bgView addSubview:self.sectionLabel];
self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, self.sectionLabel.bottom+5, self.width, self.bgView.height-5-self.sectionLabel.bottom) style:(UITableViewStylePlain)];
if (@available(iOS 15.0, *)) {
self.tableView.sectionHeaderTopPadding = 0;
} else {
// Fallback on earlier versions
}
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
self.tableView.tableFooterView = [UIView new];
self.tableView.delegate = self;
self.tableView.dataSource = self;
[self.bgView addSubview:self.tableView];
MJWeakSelf
[QXMineNetwork roomPkSearchWithRoomId:@"" page:1 successBlock:^(NSArray<QXRoomListModel *> * _Nonnull list) {
[weakSelf.dataArray removeAllObjects];
[weakSelf.dataArray addObjectsFromArray:list];
[weakSelf.tableView reloadData];
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
}];
}
-(void)setAction{
[self hide];
[self.pkSetView showInView:self.viewController.view];
}
-(void)pkAction{
[self hide];
[self sendPKWithRoomId:@""];;
}
-(void)textDidChange:(UITextField*)textField{
MJWeakSelf
self.sectionLabel.hidden = YES;
self.page = 1;
[QXMineNetwork roomPkSearchWithRoomId:textField.text page:self.page successBlock:^(NSArray<QXRoomListModel *> * _Nonnull list) {
[weakSelf.dataArray removeAllObjects];
[weakSelf.dataArray addObjectsFromArray:list];
[weakSelf.tableView reloadData];
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
}];
}
#pragma mark - UITextFieldDelegate
-(BOOL)textFieldShouldReturn:(UITextField *)textField{
[textField resignFirstResponder];
return YES;
}
-(void)textFieldDidBeginEditing:(UITextField *)textField{
[UIView animateWithDuration:0.3 animations:^{
self.bgView.y = kSafeAreaTop+90;
} completion:^(BOOL finished) {
}];
}
-(void)textFieldDidEndEditing:(UITextField *)textField{
[UIView animateWithDuration:0.3 animations:^{
self.bgView.y = SCREEN_HEIGHT-ScaleWidth(429);
} completion:^(BOOL finished) {
}];
}
-(BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string{
return YES;
}
#pragma mark - UITableViewDelegate,UITableViewDataSource
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return self.dataArray.count;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
QXAddDirectCell *cell = [QXAddDirectCell cellWithTableView:tableView];
QXRoomListModel *model = self.dataArray[indexPath.row];
cell.roomModel = model;
cell.delegate = self;
return cell;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
return 52;
}
- (void)sendPKWithRoomId:(NSString *)roomId{
MJWeakSelf
[QXMineNetwork roomSendPkRoomId:self.roomId create_user_id:[QXGlobal shareGlobal].loginModel.user_id room_id_b:roomId successBlock:^(NSDictionary * _Nonnull dict) {
[weakSelf hide];
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
showToast(msg);
}];
}
-(void)showInView:(UIView *)view{
MJWeakSelf
[QXMineNetwork roomPkSearchWithRoomId:@"" page:1 successBlock:^(NSArray<QXRoomListModel *> * _Nonnull list) {
[weakSelf.dataArray removeAllObjects];
[weakSelf.dataArray addObjectsFromArray:list];
[weakSelf.tableView reloadData];
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
}];
self.bgView.y = SCREEN_HEIGHT;
[view addSubview:self];
[UIView animateWithDuration:0.3 animations:^{
self.bgView.y = SCREEN_HEIGHT-ScaleWidth(429)-kSafeAreaBottom;
}];
}
-(void)hide{
[UIView animateWithDuration:0.3 animations:^{
self.bgView.y = SCREEN_HEIGHT;
} completion:^(BOOL finished) {
[self removeFromSuperview];
}];
}
-(NSMutableArray *)dataArray{
if (!_dataArray) {
_dataArray = [NSMutableArray array];
}
return _dataArray;
}
-(QXRoomPKSetView *)pkSetView{
if (!_pkSetView) {
_pkSetView = [[QXRoomPKSetView alloc] init];
}
return _pkSetView;
}
@end

View File

@@ -0,0 +1,19 @@
//
// QXRoomPKSetView.h
// QXLive
//
// Created by 启星 on 2025/7/3.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface QXRoomPKSetView : UIView
@property (nonatomic,strong)NSString *roomId;
@property (nonatomic,strong)NSString *is_pk;
-(void)showInView:(UIView *)view;
-(void)hide;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,149 @@
//
// QXRoomPKSetView.m
// QXLive
//
// Created by on 2025/7/3.
//
#import "QXRoomPKSetView.h"
#import "QXMineNetwork.h"
@interface QXRoomPKSetView()
@property (nonatomic,strong)UIView *bgView;
@property (nonatomic,strong)UILabel *titleLabel;
@property (nonatomic,strong)UIButton *closeBtn;
@property (nonatomic,strong)UILabel *firstLabel;
@property (nonatomic,strong)UISwitch *firstSwitch;
@property (nonatomic,strong)UILabel *secondLabel;
@property (nonatomic,strong)UISwitch *secondSwitch;
@end
@implementation QXRoomPKSetView
- (instancetype)init
{
self = [super init];
if (self) {
self.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
[self initSubviews];
}
return self;
}
-(void)initSubviews{
self.bgView = [[UIView alloc] initWithFrame:CGRectMake((SCREEN_WIDTH-ScaleWidth(300))/2, -self.height, ScaleWidth(300), ScaleWidth(200))];
self.bgView.backgroundColor = UIColor.whiteColor;
[self.bgView addRoundedCornersWithRadius:16];
[self addSubview:self.bgView];
self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, 16, self.bgView.width-32, 24)];
self.titleLabel.text = @"发起直播对战";
self.titleLabel.textAlignment = NSTextAlignmentCenter;
self.titleLabel.font = [UIFont boldSystemFontOfSize:16];
self.titleLabel.textColor = [UIColor colorWithHexString:@"#333333"];
[self.bgView addSubview:self.titleLabel];
self.closeBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.bgView.width-50, 0, 50, 50)];
[self.closeBtn setImage:[UIImage imageNamed:@"wallet_close"] forState:(UIControlStateNormal)];
[self.closeBtn addTarget:self action:@selector(hide) forControlEvents:UIControlEventTouchUpInside];
[self.bgView addSubview:self.closeBtn];
self.firstSwitch = [[UISwitch alloc] initWithFrame:CGRectMake(self.bgView.width-50-16, self.titleLabel.bottom+27, 50, 31)];
self.firstSwitch.backgroundColor = RGB16A(0xffffff, 0.2);
[self.firstSwitch addRoundedCornersWithRadius:15.5];
self.firstSwitch.onTintColor = QXConfig.themeColor;
self.firstSwitch.thumbTintColor = [UIColor whiteColor];
[self.firstSwitch addTarget:self action:@selector(eventSwitch:) forControlEvents:(UIControlEventValueChanged)];
[self.bgView addSubview:self.firstSwitch];
self.firstLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, self.titleLabel.bottom+27, self.firstSwitch.left-16, 31)];
self.firstLabel.text = @"不再接收好友邀请";
self.firstLabel.textAlignment = NSTextAlignmentLeft;
self.firstLabel.font = [UIFont boldSystemFontOfSize:14];
self.firstLabel.textColor = [UIColor colorWithHexString:@"#333333"];
[self.bgView addSubview:self.firstLabel];
// self.secondSwitch = [[UISwitch alloc] initWithFrame:CGRectMake(self.bgView.width-50-16, self.firstSwitch.bottom+20, 50, 31)];
// self.secondSwitch.backgroundColor = RGB16A(0xffffff, 0.2);
// [self.secondSwitch addRoundedCornersWithRadius:15.5];
// self.secondSwitch.onTintColor = QXConfig.themeColor;
// self.secondSwitch.thumbTintColor = [UIColor whiteColor];
// [self.secondSwitch addTarget:self action:@selector(eventSwitch:) forControlEvents:(UIControlEventValueChanged)];
// [self.bgView addSubview:self.secondSwitch];
//
// self.secondLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, self.firstSwitch.bottom+20, self.secondSwitch.left-16, 31)];
// self.secondLabel.text = @"不再接收推荐邀请";
// self.secondLabel.textAlignment = NSTextAlignmentLeft;
// self.secondLabel.font = [UIFont boldSystemFontOfSize:14];
// self.secondLabel.textColor = [UIColor colorWithHexString:@"#333333"];
// [self.bgView addSubview:self.secondLabel];
}
-(void)setIs_pk:(NSString *)is_pk{
_is_pk = is_pk;
if (is_pk.intValue == 1) {
[self.firstSwitch setOn:YES animated:YES];
}else{
[self.firstSwitch setOn:NO animated:YES];
}
}
-(void)eventSwitch:(UISwitch*)sender{
// BOOL isLock = NO;
// if (self.settingType == QXRoomSeatSettingMuteMic || self.settingType == QXRoomSeatSettingHugMic) {
// isLock = NO;
// }else{
// isLock = YES;
// }
// MJWeakSelf
BOOL isOn = sender.isOn;
// [QXMineNetwork roomPitLockOrMuteIsLock:isLock roomId:self.roomId pit_number:self.pitModel.pit_number.integerValue is_mute:isOn successBlock:^(NSDictionary * _Nonnull dict) {
// if (isOn) {
// [sender setOn:YES animated:YES];
// }else{
// [sender setOn:NO animated:YES];
// }
// if (isLock) {
// weakSelf.pitModel.is_lock = isOn?@"1":@"0";
// }else{
// weakSelf.pitModel.is_mute = isOn?@"1":@"0";
// }
// if (weakSelf.setSuccessBlock) {
// weakSelf.setSuccessBlock(weakSelf.pitModel);
// }
// } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
// [self.eventSwitch setOn:self.isOn animated:YES];
// }];
//
[QXMineNetwork noAgreePKInvite:isOn?@"1":@"2" room_id:self.roomId successBlock:^(NSString * _Nonnull token) {
if (isOn) {
[sender setOn:YES animated:YES];
}else{
[sender setOn:NO animated:YES];
}
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
}];
}
-(void)showInView:(UIView *)view{
[view addSubview:self];
[UIView animateWithDuration:0.3 delay:0 usingSpringWithDamping:0.5 initialSpringVelocity:1.0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
self.bgView.y = (SCREEN_HEIGHT-ScaleWidth(200))/2.0;
} completion:^(BOOL finished) {
}];
}
-(void)hide{
[UIView animateWithDuration:0.3 delay:0 usingSpringWithDamping:0.5 initialSpringVelocity:1.0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
self.bgView.y = SCREEN_HEIGHT;
} completion:^(BOOL finished) {
[self removeFromSuperview];
}];
}
@end

View File

@@ -0,0 +1,18 @@
//
// QXRoomPKTimeSetView.h
// QXLive
//
// Created by 启星 on 2025/7/3.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface QXRoomPKTimeSetView : UIView
@property (nonatomic,strong)NSString *pkId;
-(void)showInView:(UIView *)view;
-(void)hide;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,229 @@
//
// QXRoomPKTimeSetView.m
// QXLive
//
// Created by on 2025/7/3.
//
#import "QXRoomPKTimeSetView.h"
#import "QXSelectAuctionInfoView.h"
#import "QXMineNetwork.h"
@interface QXRoomPKTimeSetView()<UIGestureRecognizerDelegate,UICollectionViewDataSource,UICollectionViewDelegate,UICollectionViewDelegateFlowLayout,UITextFieldDelegate>
@property (nonatomic,strong)UIView *bgView;
@property (nonatomic,strong)UILabel *titleLabel;
@property (nonatomic,strong)UICollectionView *collectionView;
@property (nonatomic,strong)NSMutableArray *dataArray;
@property (nonatomic,strong)QXRoomRelationModel *timeModel;
@property (nonatomic,strong)UITextField *textField;
@property (nonatomic,strong)UIView *line;
@property (nonatomic,strong)UIButton *commitBtn;
@property (nonatomic,strong)UIButton *cancelBtn;
@end
@implementation QXRoomPKTimeSetView
- (instancetype)init
{
self = [super init];
if (self) {
self.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
[self initSubviews];
}
return self;
}
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{
return touch.view == self;
}
-(void)initSubviews{
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hide)];
tap.delegate = self;
[self addGestureRecognizer:tap];
self.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.3];
self.bgView = [[UIView alloc] initWithFrame:CGRectMake(0, ScaleWidth(144), SCREEN_WIDTH, ScaleWidth(429)+kSafeAreaBottom)];
self.bgView.backgroundColor = UIColor.whiteColor;
[self.bgView addRoundedCornersWithRadius:16 byRoundingCorners:(UIRectCornerTopLeft|UIRectCornerTopRight)];
[self addSubview:self.bgView];
self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, 16, 300, 24)];
self.titleLabel.text = @"请选择PK时长";
self.titleLabel.font = [UIFont boldSystemFontOfSize:16];
self.titleLabel.textColor = [UIColor colorWithHexString:@"#333333"];
[self.bgView addSubview:self.titleLabel];
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
layout.minimumLineSpacing = 12;
layout.minimumInteritemSpacing = 12;
layout.sectionInset = UIEdgeInsetsMake(0, 16, 0, 16);
// layout.scrollDirection = UICollectionViewScrollDirectionVertical;
self.collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, self.titleLabel.bottom+12, self.bgView.width,self.bgView.height-12-42-self.titleLabel.bottom ) collectionViewLayout:layout];
[self.collectionView registerClass:[QXSelectAuctionInfoCell class] forCellWithReuseIdentifier:@"QXSelectAuctionInfoCell"];
self.collectionView.delegate = self;
self.collectionView.dataSource = self;
self.collectionView.showsHorizontalScrollIndicator = NO;
self.collectionView.showsVerticalScrollIndicator = NO;
self.collectionView.bounces = NO;
self.collectionView.backgroundColor = [UIColor clearColor];
[self.bgView addSubview:self.collectionView];
QXRoomRelationModel *time1 = [[QXRoomRelationModel alloc] init];
time1.name = @"5分钟";
time1.relation_id = @"5";
[self.dataArray addObject:time1];
QXRoomRelationModel *time2 = [[QXRoomRelationModel alloc] init];
time2.name = @"10分钟";
time2.relation_id = @"10";
[self.dataArray addObject:time2];
QXRoomRelationModel *time3 = [[QXRoomRelationModel alloc] init];
time3.name = @"15分钟";
time3.relation_id = @"15";
[self.dataArray addObject:time3];
QXRoomRelationModel *time4 = [[QXRoomRelationModel alloc] init];
time4.name = @"20分钟";
time4.relation_id = @"20";
[self.dataArray addObject:time4];
QXRoomRelationModel *time5 = [[QXRoomRelationModel alloc] init];
time5.name = @"25分钟";
time5.relation_id = @"25";
[self.dataArray addObject:time5];
QXRoomRelationModel *time6 = [[QXRoomRelationModel alloc] init];
time6.name = @"30分钟";
time6.relation_id = @"30";
[self.dataArray addObject:time6];
QXRoomRelationModel *time7 = [[QXRoomRelationModel alloc] init];
time7.name = @"35分钟";
time7.relation_id = @"35";
[self.dataArray addObject:time7];
QXRoomRelationModel *time8 = [[QXRoomRelationModel alloc] init];
time8.name = @"40分钟";
time8.relation_id = @"40";
[self.dataArray addObject:time8];
// self.textField = [[UITextField alloc] initWithFrame:CGRectMake(16, self.collectionView.bottom+10, self.bgView.width-32, 30)];
// self.textField.font = [UIFont systemFontOfSize:14];
// self.textField.textColor = RGB16(0x333333);
// self.textField.placeholder = @"请输入自定义时间最少5分钟";
// self.textField.delegate = self;
// self.textField.returnKeyType = UIReturnKeyDone;
// [self.bgView addSubview:self.textField];
//
// self.line = [[UIView alloc] initWithFrame:CGRectMake(16, self.textField.bottom, self.bgView.width-32, 1)];
// self.line.backgroundColor = RGB16(0x999999);
// [self.bgView addSubview:self.line];
self.cancelBtn = [[UIButton alloc] initWithFrame:CGRectMake(38, self.bgView.height-kSafeAreaBottom-42, 95 , 42)];
[self.cancelBtn setTitle:QXText(@"取消") forState:(UIControlStateNormal)];
[self.cancelBtn setTitleColor:UIColor.whiteColor forState:(UIControlStateNormal)];
[self.cancelBtn addTarget:self action:@selector(cancelAction) forControlEvents:(UIControlEventTouchUpInside)];
[self.cancelBtn addRoundedCornersWithRadius:21];
self.cancelBtn.titleLabel.font = [UIFont systemFontOfSize:14];
self.cancelBtn.backgroundColor = RGB16(0x333333);
[self.bgView addSubview:self.cancelBtn];
self.commitBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.cancelBtn.right+16, self.bgView.height-kSafeAreaBottom-42, self.bgView.width-38-self.cancelBtn.right-16, 42)];
[self.commitBtn setTitle:QXText(@"确认") forState:(UIControlStateNormal)];
[self.commitBtn setTitleColor:QXConfig.btnTextColor forState:(UIControlStateNormal)];
[self.commitBtn addTarget:self action:@selector(commitAction) forControlEvents:(UIControlEventTouchUpInside)];
[self.commitBtn addRoundedCornersWithRadius:21];
self.commitBtn.titleLabel.font = [UIFont systemFontOfSize:14];
self.commitBtn.backgroundColor = QXConfig.themeColor;
[self.bgView addSubview:self.commitBtn];
}
-(void)commitAction{
if (self.timeModel == nil) {
showToast(@"请选择PK时长");
return;
}
MJWeakSelf
[QXMineNetwork roomPkStartWithPk_id:self.pkId pk_times:self.timeModel.relation_id successBlock:^(NSDictionary * _Nonnull dict) {
[weakSelf hide];
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
showToast(msg);
}];
}
-(void)cancelAction{
[self hide];
}
#pragma mark - UITextFieldDelegate
//-(BOOL)textFieldShouldReturn:(UITextField *)textField{
// [textField resignFirstResponder];
// return YES;
//}
//-(void)textFieldDidBeginEditing:(UITextField *)textField{
// [UIView animateWithDuration:0.3 animations:^{
// self.bgView.y = kSafeAreaTop+90;
// } completion:^(BOOL finished) {
//
// }];
//}
//-(void)textFieldDidEndEditing:(UITextField *)textField{
// [UIView animateWithDuration:0.3 animations:^{
// self.bgView.y = SCREEN_HEIGHT-ScaleWidth(429);
// } completion:^(BOOL finished) {
//
// }];
//}
-(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView{
return 1;
}
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
return self.dataArray.count;
}
-(__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
QXSelectAuctionInfoCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"QXSelectAuctionInfoCell" forIndexPath:indexPath];
cell.timeModel = self.dataArray[indexPath.row];
return cell;
}
-(CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath{
CGFloat width = (SCREEN_WIDTH-16*2-12*3)/4;
return CGSizeMake(width, 44);
}
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
QXRoomRelationModel *model = self.dataArray[indexPath.row];
if (model.isSelected) {
return;
}
self.timeModel.isSelected = NO;
model.isSelected = YES;
self.timeModel = model;
[collectionView reloadData];
}
-(NSMutableArray *)dataArray{
if (!_dataArray) {
_dataArray = [NSMutableArray array];
}
return _dataArray;
}
-(void)showInView:(UIView *)view{
self.bgView.y = SCREEN_HEIGHT;
[view addSubview:self];
[UIView animateWithDuration:0.3 animations:^{
self.bgView.y = SCREEN_HEIGHT-ScaleWidth(429)-kSafeAreaBottom;
}];
}
-(void)hide{
[UIView animateWithDuration:0.3 animations:^{
self.bgView.y = SCREEN_HEIGHT;
} completion:^(BOOL finished) {
[self removeFromSuperview];
}];
}
@end

View File

@@ -0,0 +1,50 @@
//
// QXAllRoomHourRankView.h
// QXLive
//
// Created by 启星 on 2025/9/29.
//
#import <UIKit/UIKit.h>
#import "QXRoomHourRankModel.h"
NS_ASSUME_NONNULL_BEGIN
@interface QXAllRoomHourRankView : UIView
-(void)showInView:(UIView *)view;
-(void)hide;
@end
@interface QXAllRoomHourRankCell : UICollectionViewCell
@property (nonatomic,strong)UIImageView *rankNumberImageView;
@property (nonatomic,strong)UILabel *rankNumberLabel;
@property (nonatomic,strong)UIImageView *roomCoverImageView;
@property (nonatomic,strong)UILabel *nameLabel;
@property (nonatomic,strong)UIImageView *animationView;
@property (nonatomic,strong)UIImageView *labelImageView;
@property (nonatomic,strong)UIImageView *hotImageView;
@property (nonatomic,strong)UILabel *hotLabel;
@property (nonatomic,strong)UIView *activityBgView;
@property (nonatomic,strong)UIImageView *activityImageView;
@property (nonatomic,strong)UIImageView *activityStatusBgImageView;
@property (nonatomic,strong)UILabel *statusLabel;
@property (nonatomic,strong)UIImageView *redpacketImageView;
@property (nonatomic,assign)NSInteger rankNumber;
@property (nonatomic,strong)QXRoomHourRankSubModel *model;
@end
@interface QXAllRoomHourRankTagView : UIView
@property (nonatomic,strong)UIImageView *bgImageView;
@property (nonatomic,strong)UILabel *titleLabel;
@property (nonatomic,strong)UIButton *button;
@property (nonatomic,copy)void(^startBlock)(void);
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,450 @@
//
// QXAllRoomHourRankView.m
// QXLive
//
// Created by on 2025/9/29.
//
#import "QXAllRoomHourRankView.h"
#import "QXMineNetwork.h"
#import "NSString+QX.h"
@interface QXAllRoomHourRankView()<UICollectionViewDelegate,UICollectionViewDataSource,UIGestureRecognizerDelegate>
@property (nonatomic,strong)UIView *bgView;
///
///
@property (nonatomic,strong)UIView *topView;
///
@property (nonatomic,strong)UIImageView *topImageView;
///
@property (nonatomic,strong)UIButton *helpBtn;
///
@property (nonatomic,strong)UIImageView *timeBgImageView;
///
@property (nonatomic,strong)UILabel *timeLabel;
///
@property (nonatomic,strong)UICollectionView *collectionView;
@property (nonatomic,strong)NSMutableArray *dataArray;
@property (nonatomic,assign)NSInteger page;
@end
@implementation QXAllRoomHourRankView
- (instancetype)init
{
self = [super init];
if (self) {
self.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
self.page = 1;
[self initSubviews];
}
return self;
}
-(void)initSubviews{
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hide)];
tap.delegate = self;
[self addGestureRecognizer:tap];
self.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.3];
self.bgView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, ScaleWidth(256), self.height)];
self.bgView.backgroundColor = RGB16(0x32057F);
[self addSubview:self.bgView];
self.topView = [[UIView alloc] init];
[self.bgView addSubview:self.topView];
[self.topView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.left.right.equalTo(self.bgView);
make.height.mas_equalTo(ScaleWidth(ScaleWidth(281)));
}];
self.topImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"room_hour_rank_top_bg"]];
[self.topView addSubview:self.topImageView];
[self.topImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self.topView);
}];
self.timeBgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"room_hour_rank_top_time_bg"]];
[self.topView addSubview:self.timeBgImageView];
[self.timeBgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self.topView);
make.top.mas_equalTo(ScaleWidth(119));
make.height.mas_equalTo(ScaleWidth(23));
make.width.mas_equalTo(ScaleWidth(150));
}];
self.timeLabel = [[UILabel alloc] init];
self.timeLabel.text = @"榜单时间";
self.timeLabel.font = [UIFont systemFontOfSize:12];
self.timeLabel.textAlignment = NSTextAlignmentCenter;
self.timeLabel.textColor = RGB16(0xffffff);
[self.bgView addSubview:self.timeLabel];
[self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self.timeBgImageView);
}];
self.helpBtn = [[UIButton alloc] init];
[self.helpBtn setImage:[UIImage imageNamed:@"room_hour_rank_help"] forState:(UIControlStateNormal)];
[self.helpBtn addTarget:self action:@selector(helpAction) forControlEvents:(UIControlEventTouchUpInside)];
[self.bgView addSubview:self.helpBtn];
[self.helpBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.bgView);
make.top.mas_equalTo(ScaleWidth(50));
make.height.mas_equalTo(ScaleWidth(40));
make.width.mas_equalTo(ScaleWidth(40));
}];
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
layout.minimumLineSpacing = 4;
layout.minimumInteritemSpacing = 4;
layout.itemSize = CGSizeMake(self.bgView.width, 88);
self.collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
self.collectionView.delegate = self;
self.collectionView.dataSource = self;
self.collectionView.bounces = YES;
self.collectionView.backgroundColor = [UIColor clearColor];
MJWeakSelf
self.collectionView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
weakSelf.page = 1;
[weakSelf getRankList];
}];
self.collectionView.mj_footer = [MJRefreshBackStateFooter footerWithRefreshingBlock:^{
weakSelf.page++;
[weakSelf getRankList];
}];
[self.collectionView registerClass:[QXAllRoomHourRankCell class] forCellWithReuseIdentifier:@"QXAllRoomHourRankCell"];
[self.bgView addSubview:self.collectionView];
[self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(self.bgView);
make.top.equalTo(self.topView.mas_bottom).offset(10);
make.bottom.equalTo(self.bgView);
}];
}
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{
return touch.view == self;
}
-(void)getRankList{
MJWeakSelf
[QXMineNetwork roomHourRankWithPage:self.page successBlock:^(QXRoomHourRankModel * _Nonnull model) {
if (weakSelf.page == 1) {
[weakSelf.dataArray removeAllObjects];
}
weakSelf.timeLabel.text = [NSString stringWithFormat:@"榜单时间 %@",model.time_range];
[weakSelf.dataArray addObjectsFromArray:model.lists];
[weakSelf.collectionView reloadData];
if (model.lists.count == 0) {
weakSelf.collectionView.mj_footer.state = MJRefreshStateNoMoreData;
}else{
[weakSelf.collectionView.mj_footer endRefreshing];
}
[weakSelf.collectionView.mj_header endRefreshing];
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
[weakSelf.collectionView.mj_header endRefreshing];
[weakSelf.collectionView.mj_footer endRefreshing];
}];
}
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
return self.dataArray.count;
}
-(__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
QXAllRoomHourRankCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"QXAllRoomHourRankCell" forIndexPath:indexPath];
cell.rankNumber = indexPath.row;
cell.model = self.dataArray[indexPath.row];
return cell;
}
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
QXRoomHourRankSubModel *model = self.dataArray[indexPath.row];
[[QXGlobal shareGlobal] joinRoomWithRoomId:model.room_id isRejoin:NO navagationController:self.navigationController];
}
-(void)showInView:(UIView *)view{
self.page = 1;
[self getRankList];
self.bgView.x = SCREEN_WIDTH;
[view addSubview:self];
[UIView animateWithDuration:0.3 animations:^{
self.bgView.x = SCREEN_WIDTH-ScaleWidth(256);
}];
}
-(void)hide{
[UIView animateWithDuration:0.3 animations:^{
self.bgView.x = SCREEN_WIDTH;
} completion:^(BOOL finished) {
[self removeFromSuperview];
}];
}
-(void)helpAction{
QXBaseWebViewController *vc = [[QXBaseWebViewController alloc] init];
NSString *urlString = [NSString stringWithFormat:@"%@api/Page/page_show?id=%@",ServerUrl,@"24"];
vc.urlStr = urlString;
[self.viewController.navigationController pushViewController:vc animated:YES];
}
-(NSMutableArray *)dataArray{
if (!_dataArray) {
_dataArray = [NSMutableArray array];
}
return _dataArray;
}
@end
@implementation QXAllRoomHourRankCell
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self initSubviews];
}
return self;
}
-(void)initSubviews{
self.contentView.backgroundColor = RGB16(0x420B93);
self.rankNumberImageView = [[UIImageView alloc] init];
[self.contentView addSubview:self.rankNumberImageView];
[self.rankNumberImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(5);
make.top.equalTo(self.contentView);
make.width.mas_equalTo(32);
make.height.mas_equalTo(32);
}];
self.rankNumberLabel = [[UILabel alloc] init];
self.rankNumberLabel.textAlignment = NSTextAlignmentCenter;
self.rankNumberLabel.textColor = RGB16(0xA6A77E);
self.rankNumberLabel.font = [UIFont systemFontOfSize:12];
[self.contentView addSubview:self.rankNumberLabel];
[self.rankNumberLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self.rankNumberImageView);
}];
self.roomCoverImageView = [[UIImageView alloc] init];
self.roomCoverImageView.contentMode = UIViewContentModeScaleAspectFill;
self.roomCoverImageView.layer.borderWidth = 1;
self.roomCoverImageView.layer.borderColor = RGB16(0xD000FF).CGColor;
[self.contentView addSubview:self.roomCoverImageView];
[self.roomCoverImageView addRoundedCornersWithRadius:6];
[self.roomCoverImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(21);
make.centerY.equalTo(self.contentView);
make.width.height.mas_equalTo(64);
}];
self.animationView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"activity_room_animate"]];
[self.contentView addSubview:self.animationView];
[self.animationView mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.roomCoverImageView.mas_right).offset(-3);
make.top.equalTo(self.roomCoverImageView.mas_top).offset(3);
make.width.height.mas_equalTo(12);
}];
self.redpacketImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"redbag_tag_icon"]];
[self.contentView addSubview:self.redpacketImageView];
[self.redpacketImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.right.mas_equalTo(-5);
make.centerY.equalTo(self.contentView);
make.width.mas_equalTo(60);
make.height.mas_equalTo(60);
}];
self.activityBgView = [[UIView alloc] init];
self.activityBgView.hidden = YES;
[self.contentView addSubview:self.activityBgView];
[self.activityBgView mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.right.mas_equalTo(-5);
make.centerY.equalTo(self.contentView);
// make.top.mas_equalTo(8);
make.width.mas_equalTo(63);
make.height.mas_equalTo(67);
}];
self.activityStatusBgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"activity_status_ing"]];
// self.activityStatusBgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"activity_status_will"]];
[self.activityBgView addSubview:self.activityStatusBgImageView];
[self.activityStatusBgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.bottom.equalTo(self.activityBgView);
make.height.mas_equalTo(14);
}];
self.statusLabel = [[UILabel alloc] init];
self.statusLabel.font = [UIFont systemFontOfSize:12];
self.statusLabel.textColor = RGB16(0xffffff);
self.statusLabel.textAlignment = NSTextAlignmentCenter;
[self.activityBgView addSubview:self.statusLabel];
[self.statusLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self.activityStatusBgImageView);
}];
self.activityImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"ac_tag_icon"]];
[self.activityBgView addSubview:self.activityImageView];
[self.activityImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.activityBgView);
make.centerX.equalTo(self.activityBgView);
make.width.height.mas_equalTo(55);
}];
self.nameLabel = [[UILabel alloc] init];
self.nameLabel.textColor = RGB16(0xffffff);
self.nameLabel.font = [UIFont boldSystemFontOfSize:12];
[self.contentView addSubview:self.nameLabel];
[self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.roomCoverImageView.mas_right).offset(8);
make.right.equalTo(self.activityBgView.mas_left).offset(-8);
make.top.equalTo(self.roomCoverImageView);
make.height.mas_equalTo(15);
}];
self.labelImageView = [[UIImageView alloc] init];
[self.contentView addSubview:self.labelImageView];
[self.labelImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(44);
make.height.mas_equalTo(24);
make.centerY.equalTo(self.contentView);
make.left.equalTo(self.nameLabel);
}];
self.hotImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"room_hot_icon"]];
[self.contentView addSubview:self.hotImageView];
[self.hotImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.height.mas_equalTo(15);
make.bottom.equalTo(self.roomCoverImageView.mas_bottom).offset(2);
make.left.equalTo(self.nameLabel);
}];
self.hotLabel = [[UILabel alloc] init];
self.hotLabel.font = [UIFont systemFontOfSize:12];
self.hotLabel.textColor = RGB16(0xffffff);
[self.contentView addSubview:self.hotLabel];
[self.hotLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.equalTo(self.hotImageView);
make.left.equalTo(self.hotImageView.mas_right);
}];
[self.contentView bringSubviewToFront:self.rankNumberImageView];
[self.contentView bringSubviewToFront:self.rankNumberLabel];
[self.contentView bringSubviewToFront:self.activityStatusBgImageView];
[self.contentView bringSubviewToFront:self.statusLabel];
}
-(void)setRankNumber:(NSInteger)rankNumber{
_rankNumber = rankNumber;
if (rankNumber == 0) {
self.rankNumberLabel.hidden = YES;
self.rankNumberImageView.image = [UIImage imageNamed:@"activity_room_rank_first"];
return;
}
if (rankNumber == 1) {
self.rankNumberLabel.hidden = YES;
self.rankNumberImageView.image = [UIImage imageNamed:@"activity_room_rank_second"];
return;
}
if (rankNumber == 2) {
self.rankNumberLabel.hidden = YES;
self.rankNumberImageView.image = [UIImage imageNamed:@"activity_room_rank_third"];
return;
}
self.rankNumberLabel.hidden = NO;
self.rankNumberLabel.text = [NSString stringWithFormat:@"%ld",rankNumber+1];
self.rankNumberImageView.image = [UIImage imageNamed:@"activity_room_rank_other"];
}
-(void)setModel:(QXRoomHourRankSubModel *)model{
_model = model;
[self.roomCoverImageView sd_setImageWithURL:[NSURL URLWithString:model.room_cover]];
self.nameLabel.text = model.room_name;
[self.labelImageView sd_setImageWithURL:[NSURL URLWithString:model.label_icon]];
self.hotLabel.text = [NSString qx_showHotCountNum:model.total_price.longLongValue];
if (model.redpacket_status > 0) {
self.redpacketImageView.hidden = NO;
}else{
self.redpacketImageView.hidden = YES;
}
// if (model.xlh_status == 0) {
// self.activityBgView.hidden = YES;
// }else if (model.xlh_status == 2){
// self.activityBgView.hidden = NO;
// self.activityStatusBgImageView.image = [UIImage imageNamed:@"activity_status_will"];
// self.statusLabel.text = @"即将开始";
// }else{
// self.activityBgView.hidden = NO;
// self.activityStatusBgImageView.image = [UIImage imageNamed:@"activity_status_ing"];
// self.statusLabel.text = @"进行中";
// }
}
@end
@implementation QXAllRoomHourRankTagView
- (instancetype)init
{
self = [super init];
if (self) {
self.frame = CGRectMake(SCREEN_WIDTH-60, NavContentHeight, 60, 25);
[self initSubviews];
}
return self;
}
-(void)initSubviews{
UIPanGestureRecognizer *panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePan:)];
[self addGestureRecognizer:panRecognizer];
self.bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"room_hour_rank_icon"]];
[self addSubview:self.bgImageView];
[self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self);
}];
self.titleLabel = [[UILabel alloc] init];
self.titleLabel.font = [UIFont systemFontOfSize:11];
self.titleLabel.text = @"小时榜";
self.titleLabel.textColor = RGB16(0xffffff);
self.titleLabel.textAlignment = NSTextAlignmentRight;
[self addSubview:self.titleLabel];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self);
}];
self.button = [[UIButton alloc] init];
[self.button addTarget:self action:@selector(buttonAction) forControlEvents:(UIControlEventTouchUpInside)];
[self addSubview:self.button];
[self.button mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self);
}];
}
-(void)buttonAction{
if (self.startBlock) {
self.startBlock();
}
}
-(void)handlePan:(UIPanGestureRecognizer*)recognizer{
if (recognizer.state == UIGestureRecognizerStateEnded) {
NSLog(@"拖动结束");
}
CGPoint translation = [recognizer translationInView:self.viewController.view];
CGPoint panCenter = CGPointMake(recognizer.view.center.x + translation.x,
recognizer.view.center.y + translation.y);
if (panCenter.y < kSafeAreaTop || panCenter.y> SCREEN_HEIGHT-kSafeAreaBottom) {
return;
}
recognizer.view.center = CGPointMake(SCREEN_WIDTH-60/2,
recognizer.view.center.y + translation.y);
[recognizer setTranslation:CGPointZero inView:self.viewController.view];
}
@end

View File

@@ -0,0 +1,30 @@
//
// QXAppstoreHomeView.h
// QXLive
//
// Created by 启星 on 2025/8/4.
//
#import <UIKit/UIKit.h>
#import "QXRoomListModel.h"
NS_ASSUME_NONNULL_BEGIN
@interface QXAppstoreHomeView : UIView
//@property (nonatomic,strong)NSArray *dataArray;
@property (nonatomic,strong)NSArray *bannerArray;
@end
@interface QXAppstoreRoomView : UIView
@property (nonatomic,strong)UIImageView *tagImageView;
@property (nonatomic,strong)UIImageView *roomCoverImageView;
@property (nonatomic,strong)UILabel *roomNameLabel;
@property (nonatomic,strong)UIView *displayMaskView;
@property (nonatomic,strong)UIView *hotBgView;
@property (nonatomic,strong)UIImageView *hotImageView;
@property (nonatomic,strong)UILabel *hotLabel;
@property (nonatomic,strong)QXRoomListModel *roomModel;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,334 @@
//
// QXAppstoreHomeView.m
// QXLive
//
// Created by on 2025/8/4.
//
#import "QXAppstoreHomeView.h"
#import "QXHomeRoomCell.h"
#import <SDCycleScrollView.h>
#import "QXBanner.h"
#import "QXTimer.h"
#import "QXHomePageNetwork.h"
@interface QXAppstoreHomeView()<UICollectionViewDelegate,UICollectionViewDataSource,SDCycleScrollViewDelegate>
@property (nonatomic,strong)UIScrollView *scrollView;
@property (nonatomic,strong)UICollectionView *collectionView;
@property (nonatomic,strong)SDCycleScrollView *bannerScrollView;
@property (nonatomic,strong)UIImageView *topImageView;
@property (nonatomic,strong)QXAppstoreRoomView *rommView;
@property (nonatomic,strong)UIImageView *bottomImageView;
//@property (nonatomic,strong)QXAppstoreRoomView *rommView2;
@property (nonatomic,strong)QXRoomListModel *roomModel;
@property (nonatomic,assign)NSInteger currentIndex;
@property (nonatomic,strong)NSMutableArray *dataArray;
@property (nonatomic,strong)NSMutableArray *topArray;
@property (nonatomic,strong)QXTimer *timer;
@end
@implementation QXAppstoreHomeView
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self initSubviews];
}
return self;
}
-(void)initSubviews{
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(loginSuccess) name:noticeUserLogin object:nil];
self.backgroundColor = [UIColor whiteColor];
self.scrollView = [[UIScrollView alloc] initWithFrame:self.bounds];
[self addSubview:self.scrollView];
[self.scrollView addSubview:self.bannerScrollView];
[self.scrollView addSubview:self.collectionView];
MJWeakSelf
self.scrollView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
[weakSelf getTopRoomList];
[weakSelf getAllRoomList];
}];
CGFloat roomWidth = SCREEN_WIDTH-self.collectionView.right-40;
CGFloat roomHeight = roomWidth + 25;
self.topImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"app_star"]];
self.topImageView.frame = CGRectMake(self.collectionView.right+20, self.bannerScrollView.bottom+30, roomWidth, 70);
[self.scrollView addSubview:self.topImageView];
self.rommView = [[QXAppstoreRoomView alloc] initWithFrame:CGRectMake(self.collectionView.right+20, self.topImageView.bottom+10, roomWidth, roomHeight)];
[self.rommView addTapBlock:^(id _Nonnull obj) {
[[QXGlobal shareGlobal] joinRoomWithRoomId:weakSelf.rommView.roomModel.room_id isRejoin:NO navagationController:weakSelf.viewController.navigationController];
}];
[self.scrollView addSubview:self.rommView];
self.bottomImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"app_star"]];
self.bottomImageView.frame = CGRectMake(self.collectionView.right+20, self.rommView.bottom+10, roomWidth, 70);
self.bottomImageView.transform = CGAffineTransformMakeRotation(M_PI);
[self.scrollView addSubview:self.bottomImageView];
[self getTopRoomList];
[self getAllRoomList];
}
-(void)loginSuccess{
[self getTopRoomList];
[self getAllRoomList];
}
//-(void)startAnimate{
// [self performSelector:@selector(startOptimizedInfiniteFlip) afterDelay:3];
//}
//-(void)setDataArray:(NSArray *)dataArray{
// _dataArray = dataArray;
// [self.collectionView reloadData];
// self.currentIndex = 0;
// self.roomModel = self.dataArray.firstObject;
// self.rommView.roomModel = self.roomModel;
//}
-(void)setBannerArray:(NSArray *)bannerArray{
_bannerArray = bannerArray;
NSMutableArray *arr = [NSMutableArray array];
for (QXBanner *banner in bannerArray) {
[arr addObject:banner.image];
}
self.bannerScrollView.imageURLStringsGroup = arr;
}
- (void)getTopRoomList {
__weak typeof(self)weakSelf = self;
[QXHomePageNetwork homeRoomListWithPage:0 is_top:YES label_id:@"" successBlock:^(NSArray<QXRoomListModel *> * _Nonnull list, BOOL isAppStore) {
if (isAppStore == NO) {
return;
}
[weakSelf.topArray removeAllObjects];
[self.rommView.layer removeAllAnimations];
if (list.count > 0) {
weakSelf.currentIndex = 0;
weakSelf.roomModel = list.firstObject;
weakSelf.rommView.roomModel = weakSelf.roomModel;
[weakSelf.topArray addObjectsFromArray:list];
[weakSelf startTimer];
}
[self.scrollView.mj_header endRefreshing];
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
[self.scrollView.mj_header endRefreshing];
}];
}
- (void)getAllRoomList {
__weak typeof(self)weakSelf = self;
[QXHomePageNetwork homeRoomListWithPage:0 is_top:NO label_id:@"" successBlock:^(NSArray<QXRoomListModel *> * _Nonnull list, BOOL isAppStore) {
if (isAppStore == NO) {
return;
}
[weakSelf.dataArray removeAllObjects];
[weakSelf.dataArray addObjectsFromArray:list];
[weakSelf.collectionView reloadData];
[self.scrollView.mj_header endRefreshing];
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
[self.scrollView.mj_header endRefreshing];
}];
}
-(void)startTimer{
MJWeakSelf
[self stopTimer];
_timer = [QXTimer scheduledTimerWithTimeInterval:5 repeats:YES queue:dispatch_get_main_queue() block:^{
QXLOG(@"动画3s执行");
[weakSelf startOptimizedInfiniteFlip];
}];
// CABasicAnimation *scaleAnim = [CABasicAnimation animationWithKeyPath:@"transform.scale"];
// scaleAnim.duration = 1.5/2;
// scaleAnim.autoreverses = YES;
// scaleAnim.fromValue = @1.0;
// scaleAnim.toValue = @1.1;
// [self.rommView.layer addAnimation:scaleAnim forKey:@"scaleAnimation"];
}
- (void)startOptimizedInfiniteFlip {
self.currentIndex++;
if (self.currentIndex > self.topArray.count-1) {
self.currentIndex = 0;
}
self.roomModel = self.topArray[self.currentIndex];
//
CGFloat flipDuration = 1.5;
UIViewAnimationOptions flipDirection = UIViewAnimationOptionTransitionFlipFromRight;
// UIViewAnimationOptionTransitionFlipFromLeft;
//
[UIView transitionWithView:self.rommView
duration:flipDuration
options:flipDirection | UIViewAnimationOptionAllowAnimatedContent
animations:^{
self.rommView.roomModel = self.roomModel;
}
completion:^(BOOL finished) {
//
// self.isFront = !self.isFront;
//
// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
// [self startOptimizedInfiniteFlip];
// });
}];
//
}
-(void)stopTimer{
if (_timer) {
[_timer invalidate];
_timer = nil;
}
}
#pragma mark - UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout
-(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView{
return 1;
}
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
return self.dataArray.count;
}
-(__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
QXHomeRoomCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"QXHomeRoomCell" forIndexPath:indexPath];
cell.isAppStore = YES;
cell.model = self.dataArray[indexPath.row];
return cell;
}
-(CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath{
return CGSizeMake(ScaleWidth(90), ScaleWidth(90));
}
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
QXRoomListModel *model = self.dataArray[indexPath.row];
[[QXGlobal shareGlobal] joinRoomWithRoomId:model.room_id isRejoin:NO navagationController:self.viewController.navigationController];
}
-(UICollectionView *)collectionView{
if (!_collectionView) {
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
layout.minimumLineSpacing = 15;
layout.minimumInteritemSpacing = 15;
layout.sectionInset = UIEdgeInsetsMake(0, 15, 0, 15);
_collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(10, self.bannerScrollView.bottom+10, ScaleWidth(90), SCREEN_HEIGHT-TabbarContentHeight-NavContentHeight-10-ScaleWidth(95)) collectionViewLayout:layout];
_collectionView.delegate = self;
_collectionView.dataSource = self;
_collectionView.showsHorizontalScrollIndicator = NO;
_collectionView.showsVerticalScrollIndicator = NO;
_collectionView.backgroundColor = [UIColor clearColor];
[_collectionView registerNib:[UINib nibWithNibName:@"QXHomeRoomCell" bundle:[NSBundle mainBundle]] forCellWithReuseIdentifier:@"QXHomeRoomCell"];
MJWeakSelf
// _collectionView.mj_footer = [MJRefreshBackStateFooter footerWithRefreshingBlock:^{
// weakSelf.page++;
// [weakSelf getRoomList];
// }];
}
return _collectionView;
}
-(SDCycleScrollView *)bannerScrollView{
if (!_bannerScrollView) {
_bannerScrollView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectMake(16, 0, SCREEN_WIDTH-32, ScaleWidth(95)) delegate:self placeholderImage:nil];
// _bannerScrollView.backgroundColor = [UIColor redColor];
_bannerScrollView.bannerImageViewContentMode = UIViewContentModeScaleAspectFill;
[_bannerScrollView addRoundedCornersWithRadius:8] ;
_bannerScrollView.delegate = self;
}
return _bannerScrollView;
}
-(NSMutableArray *)dataArray{
if (!_dataArray) {
_dataArray = [NSMutableArray array];
}
return _dataArray;
}
-(NSMutableArray *)topArray{
if (!_topArray) {
_topArray = [NSMutableArray array];
}
return _topArray;
}
@end
@implementation QXAppstoreRoomView
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self initSubviews];
}
return self;
}
-(void)setRoomModel:(QXRoomListModel *)roomModel{
_roomModel = roomModel;
[self.roomCoverImageView sd_setImageWithURL:[NSURL URLWithString:roomModel.room_cover]];
self.roomNameLabel.text = roomModel.room_name;
[self.tagImageView sd_setImageWithURL:[NSURL URLWithString:roomModel.label_icon]];
self.hotLabel.text = roomModel.hot_value;
}
-(void)initSubviews{
// self.starImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"app_star"]];
// [self addSubview:self.starImageView];
// [self.starImageView mas_makeConstraints:^(MASConstraintMaker *make) {
// make.centerX.equalTo(self);
// make.top.equalTo(self);
// make.width.height.mas_equalTo(ScaleWidth(70));
// }];
self.roomCoverImageView = [[UIImageView alloc] init];
self.roomCoverImageView.contentMode = UIViewContentModeScaleAspectFill;
[self.roomCoverImageView addRoundedCornersWithRadius:8];
self.roomCoverImageView.image = [UIImage imageNamed:@"user_header_placehoulder"];
[self addSubview:self.roomCoverImageView];
[self.roomCoverImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self);
make.top.equalTo(self);
make.width.height.mas_equalTo(self.width);
}];
self.roomNameLabel = [[UILabel alloc] init];
[self addSubview:self.roomNameLabel];
[self.roomNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.roomCoverImageView.mas_bottom).offset(5);
make.height.mas_equalTo(20);
make.centerX.equalTo(self);
}];
self.tagImageView = [[UIImageView alloc] init];
[self addSubview:self.tagImageView];
[self.tagImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.top.equalTo(self.roomCoverImageView);
make.height.mas_equalTo(24);
make.width.mas_equalTo(66);
}];
self.hotBgView = [[UIView alloc] init];
self.hotBgView.backgroundColor = RGB16(0x333333);
[self.hotBgView addRoundedCornersWithRadius:12];
[self addSubview:self.hotBgView];
[self.hotBgView mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.right.equalTo(self.roomCoverImageView).offset(-10);
make.width.mas_equalTo(160);
make.height.mas_equalTo(24);
}];
self.hotImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"room_hot_icon"]];
[self.hotBgView addSubview:self.hotImageView];
[self.hotImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(8);
make.centerY.equalTo(self.hotBgView);
make.width.height.mas_equalTo(15);
}];
self.hotLabel = [[UILabel alloc] init];
self.hotLabel.textAlignment = NSTextAlignmentCenter;
self.hotLabel.font = [UIFont systemFontOfSize:13];
self.hotLabel.textColor = [UIColor whiteColor];
[self.hotBgView addSubview:self.hotLabel];
[self.hotLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.hotImageView.mas_right).offset(2);
make.right.mas_equalTo(-10);
make.centerY.equalTo(self.hotBgView);
}];
}
@end

View File

@@ -0,0 +1,27 @@
//
// QXCabinMovieView.h
// QXLive
//
// Created by 启星 on 2025/7/7.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface QXCabinMovieView : UIView
@property (nonatomic,strong)UIView *videoView;
@property (nonatomic,assign)BOOL isFullScreen;
-(void)resetView;
@end
@interface QXCabinMovieControlView : UIView
@property (nonatomic,strong)UIView *topView;
@property (nonatomic,strong)UIButton *returnBtn;
@property (nonatomic,strong)UILabel *nameLabel;
@property (nonatomic,strong)UIView *bottomView;
@property (nonatomic,copy)void(^returnBlock)(void);
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,131 @@
//
// QXCabinMovieView.m
// QXLive
//
// Created by on 2025/7/7.
//
#import "QXCabinMovieView.h"
#import "AppDelegate.h"
@interface QXCabinMovieView()
@property (nonatomic,strong)UIButton *fullScreenBtn;
@property (nonatomic,strong)UIPanGestureRecognizer *panRecognizer;
@property (nonatomic,strong)QXCabinMovieControlView *controlView;
@end
@implementation QXCabinMovieView
- (instancetype)init
{
self = [super init];
if (self) {
self.frame = CGRectMake(12, NavContentHeight, 280, 160);
self.backgroundColor = RGB16(0x333333);
[self initSubviews];
self.isFullScreen = NO;
}
return self;
}
-(void)initSubviews{
self.panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePan:)];
[self addGestureRecognizer:self.panRecognizer];
self.videoView = [[UIView alloc] initWithFrame:self.bounds];
[self addSubview:self.videoView];
self.fullScreenBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.width-40, self.height-40, 40, 40)];
[self.fullScreenBtn setImage:[UIImage imageNamed:@"room_full_screen"] forState:(UIControlStateNormal)];
[self.fullScreenBtn addTarget:self action:@selector(fullAction) forControlEvents:(UIControlEventTouchUpInside)];
[self addSubview:self.fullScreenBtn];
// [self.fullScreenBtn mas_makeConstraints:^(MASConstraintMaker *make) {
// make.bottom.right.equalTo(self);
// make.size.mas_equalTo(CGSizeMake(40, 40));
// }];
self.controlView.hidden = YES;
[self addSubview:self.controlView];
}
-(void)handlePan:(UIPanGestureRecognizer*)recognizer{
if (recognizer.state == UIGestureRecognizerStateEnded) {
NSLog(@"拖动结束");
}
CGPoint translation = [recognizer translationInView:self.viewController.view];
CGPoint panCenter = CGPointMake(recognizer.view.center.x + translation.x,
recognizer.view.center.y + translation.y);
if (panCenter.x-214/2 <= 0 || panCenter.x+214/2 >= SCREEN_WIDTH || panCenter.y < kSafeAreaTop || panCenter.y> SCREEN_HEIGHT-kSafeAreaBottom) {
return;
}
recognizer.view.center = CGPointMake(recognizer.view.center.x + translation.x,
recognizer.view.center.y + translation.y);
[recognizer setTranslation:CGPointZero inView:self.viewController.view];
}
-(void)fullAction{
AppDelegate *delegate = (AppDelegate*)[UIApplication sharedApplication].delegate;
delegate.allowRotate = 1;
[[UIDevice currentDevice] setValue:@(UIInterfaceOrientationLandscapeRight) forKey:@"orientation"];
[UIViewController attemptRotationToDeviceOrientation];
self.frame = CGRectMake(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH);
self.videoView.frame = self.bounds;
[self.viewController.view addSubview:self.controlView];
self.fullScreenBtn.hidden = YES;
self.controlView.hidden = NO;
self.isFullScreen = YES;
}
-(QXCabinMovieControlView *)controlView{
if (!_controlView) {
_controlView = [[QXCabinMovieControlView alloc] init];
MJWeakSelf
_controlView.returnBlock = ^{
[weakSelf resetView];
};
}
return _controlView;
}
-(void)resetView{
AppDelegate *delegate = (AppDelegate*)[UIApplication sharedApplication].delegate;
delegate.allowRotate = 0;
[[UIDevice currentDevice] setValue:@(UIInterfaceOrientationPortrait) forKey:@"orientation"];
//
[UIViewController attemptRotationToDeviceOrientation];
self.frame = CGRectMake(12, NavContentHeight, 280, 160);
self.videoView.frame = self.bounds;
self.fullScreenBtn.frame = CGRectMake(self.width-40, self.height-40, 40, 40);
self.controlView.hidden = YES;
self.fullScreenBtn.hidden = NO;
self.isFullScreen = NO;
}
@end
@implementation QXCabinMovieControlView
- (instancetype)init
{
self = [super init];
if (self) {
self.frame = CGRectMake(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH);;
[self initSubviews];
}
return self;
}
-(void)initSubviews{
self.topView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.width, 95)];
self.returnBtn = [UIButton buttonWithType:0];
[self.returnBtn setImage:[[UIImage imageNamed:@"back"] imageByTintColor:UIColor.whiteColor] forState:0];
// self.returnBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
[self.returnBtn addTarget:self action:@selector(returnBtnClick) forControlEvents:UIControlEventTouchUpInside];
self.returnBtn.frame = CGRectMake(30, 10, 45, 45);
[self.topView addSubview:self.returnBtn];
[self addSubview:self.topView];
}
-(void)returnBtnClick{
if (self.returnBlock) {
self.returnBlock();
}
}
@end

View File

@@ -0,0 +1,19 @@
//
// QXMiniRoomView.h
// QXLive
//
// Created by 启星 on 2025/6/25.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface QXMiniRoomView : UIView
@property (nonatomic,strong)NSString *roomId;
@property (nonatomic,strong)NSString *roomCoverImage;
-(void)show;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,124 @@
//
// QXMiniRoomView.m
// QXLive
//
// Created by on 2025/6/25.
//
#import "QXMiniRoomView.h"
@interface QXMiniRoomView()
@property (nonatomic,strong)UIImageView *bgImageView;
@property (nonatomic,strong)UIImageView *roomCoverImageView;
@property (nonatomic,strong)UIImageView *bgRoomCoverImageView;
@property (nonatomic,strong)UIButton *closeBtn;
@property (nonatomic,strong)UIVisualEffectView *blurView;
@end
@implementation QXMiniRoomView
- (instancetype)init
{
self = [super init];
if (self) {
self.frame = CGRectMake(SCREEN_WIDTH-ScaleWidth(80), SCREEN_HEIGHT-200, ScaleWidth(80), ScaleWidth(44));
[self initSubviews];
}
return self;
}
-(void)initSubviews{
self.bgRoomCoverImageView = [[UIImageView alloc] initWithFrame:self.bounds];
self.bgRoomCoverImageView.contentMode = UIViewContentModeScaleAspectFill;
self.bgRoomCoverImageView.clipsToBounds = YES;
[self addSubview:self.bgRoomCoverImageView];
UIBlurEffect *effect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];
UIVisualEffectView *blurView = [[UIVisualEffectView alloc] initWithEffect:effect];
UIVibrancyEffect *vibrancyEffect = [UIVibrancyEffect effectForBlurEffect:effect];
UIVisualEffectView *vibrancyView = [[UIVisualEffectView alloc] initWithEffect:vibrancyEffect];
[blurView.contentView addSubview:vibrancyView];
self.blurView = blurView;
[self.bgRoomCoverImageView addSubview:blurView];
blurView.frame = self.bgRoomCoverImageView.bounds;
vibrancyView.frame = self.bgRoomCoverImageView.bounds;
self.bgImageView = [[UIImageView alloc] initWithFrame:self.bounds];
self.bgImageView.image = [UIImage imageNamed:@"mini_room_bg"];
[self addSubview:self.bgImageView];
[self addRoundedCornersWithRadius:ScaleWidth(44) byRoundingCorners:(UIRectCornerTopLeft|UIRectCornerBottomLeft)];
UIPanGestureRecognizer *panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePan:)];
[self addGestureRecognizer:panRecognizer];
self.roomCoverImageView = [[UIImageView alloc] initWithFrame:CGRectMake(9, (ScaleWidth(44)-ScaleWidth(26))/2, ScaleWidth(26), ScaleWidth(26))];
self.roomCoverImageView.contentMode = UIViewContentModeScaleAspectFill;
self.roomCoverImageView.clipsToBounds = YES;
[self.roomCoverImageView addRoundedCornersWithRadius:ScaleWidth(13)];
// [blurView mas_makeConstraints:^(MASConstraintMaker *make) {
// make.left.right.top.bottom.equalTo(self.photoImageView);
// }];
// [vibrancyView mas_makeConstraints:^(MASConstraintMaker *make) {
// make.left.right.top.bottom.equalTo(blurView);
// }];
CABasicAnimation *rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
//
rotationAnimation.toValue = [NSNumber numberWithFloat: M_PI];
//
rotationAnimation.duration = 4;
rotationAnimation.cumulative = YES;
rotationAnimation.removedOnCompletion = NO;
//MAXFLOAT
rotationAnimation.repeatCount = MAXFLOAT;
[self.roomCoverImageView.layer addAnimation:rotationAnimation forKey:@"rotationAnimation"];
MJWeakSelf
[self.roomCoverImageView addTapBlock:^(id _Nonnull obj) {
[weakSelf.layer removeAnimationForKey:@"rotationAnimation"];
[weakSelf removeFromSuperview];
[[QXGlobal shareGlobal] joinRoomWithRoomId:weakSelf.roomId isRejoin:YES navagationController:(UINavigationController*)KEYWINDOW.rootViewController];
}];
[self addSubview:self.roomCoverImageView];
self.closeBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.width-ScaleWidth(30)-12, 0, ScaleWidth(30), ScaleWidth(44))];
UIImage *close = [[UIImage imageNamed:@"room_close"] imageByTintColor:RGB16(0x333333)];
[self.closeBtn setImage:close forState:(UIControlStateNormal)];
[self.closeBtn addTarget:self action:@selector(closeAction) forControlEvents:(UIControlEventTouchUpInside)];
[self addSubview:self.closeBtn];
}
-(void)show{
[UIApplication.sharedApplication.keyWindow.rootViewController.view addSubview:self];
}
-(void)setRoomCoverImage:(NSString *)roomCoverImage{
_roomCoverImage = roomCoverImage;
[self.roomCoverImageView sd_setImageWithURL:[NSURL URLWithString:roomCoverImage]];
[self.bgRoomCoverImageView sd_setImageWithURL:[NSURL URLWithString:roomCoverImage]];
}
-(void)closeAction{
[self.layer removeAnimationForKey:@"rotationAnimation"];
[self removeFromSuperview];
[[QXGlobal shareGlobal] quitRoomWithRoomId:self.roomId];
}
-(void)handlePan:(UIPanGestureRecognizer*)recognizer{
if (recognizer.state == UIGestureRecognizerStateEnded) {
NSLog(@"拖动结束");
}
CGPoint translation = [recognizer translationInView:self.viewController.view];
CGPoint panCenter = CGPointMake(recognizer.view.center.x + translation.x,
recognizer.view.center.y + translation.y);
if (panCenter.y < kSafeAreaTop || panCenter.y> SCREEN_HEIGHT-kSafeAreaBottom) {
return;
}
recognizer.view.center = CGPointMake(SCREEN_WIDTH-ScaleWidth(80)/2,
recognizer.view.center.y + translation.y);
[recognizer setTranslation:CGPointZero inView:self.viewController.view];
}
@end

View File

@@ -0,0 +1,61 @@
//
// QXRoomBottomView.h
// QXLive
//
// Created by 启星 on 2025/6/7.
//
#import <UIKit/UIKit.h>
#import "QXRoomModel.h"
#import "NoitceAndKey.h"
#import "QXRedPacketModel.h"
typedef NS_ENUM(NSInteger) {
/// 静音
QXRoomBottomViewEventTypePlayAudio = 20,
/// 闭麦
QXRoomBottomViewEventTypeMuteAudio,
/// 消息
QXRoomBottomViewEventTypeMessage,
/// PK
QXRoomBottomViewEventTypePK,
/// 点歌曲
QXRoomBottomViewEventTypeMusic,
/// 礼物
QXRoomBottomViewEventTypeGift,
/// 设置
QXRoomBottomViewEventTypeSetting,
}QXRoomBottomViewEventType;
NS_ASSUME_NONNULL_BEGIN
@protocol QXRoomBottomViewDelegate <NSObject>
@optional
-(void)didClickEventType:(QXRoomBottomViewEventType)type isSelected:(BOOL)isSelected;
-(void)didSendMessage:(NSString*)message redpacketModel:(QXRedPacketModel*)redpacketModel;
@end
@interface QXRoomBottomView : UIView
/// 1 麦下 2 麦上
@property (nonatomic,assign)NSInteger status;
@property (nonatomic,weak)id<QXRoomBottomViewDelegate>delegate;
@property (nonatomic,strong)UIViewController *vc;
@property (nonatomic,strong)QXRoomModel *roomModel;
-(void)setRoleType:(QXRoomRoleType)roleType hasPK:(BOOL)hasPK hasSong:(BOOL)hasSong;
/// 是否是小黑屋
@property (nonatomic,assign)BOOL isCabinRoom;
-(void)atUserWithName:(NSString*)nickname;
-(void)inputMessageWithName:(NSString*)message redpacketModel:(QXRedPacketModel*)redpacketModel;
/// 是否静音 1 不静音 0 静音
-(void)setPlayAudioStatus:(BOOL)status;
/// 是否闭麦 0 未闭麦 1 已闭麦
-(void)setMuteAudioStatus:(BOOL)status;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,412 @@
//
// QXRoomBottomView.m
// QXLive
//
// Created by on 2025/6/7.
//
#import "QXRoomBottomView.h"
#import "QXDynamicCommentInputView.h"
#import "QXRoomMessageManager.h"
#import "QXBadgeButton.h"
#import "AppDelegate.h"
@interface QXRoomBottomView()<QXDynamicCommentInputViewDelegate>
@property (nonatomic,strong)UIView *sayBg;
@property (nonatomic,strong)UIImageView *sayImageView;
@property (nonatomic,strong)UILabel *sayLabel;
/// voice
@property (nonatomic,strong)QXBadgeButton *playAudioBtn;
@property (nonatomic,strong)QXBadgeButton *audioBtn;
@property (nonatomic,strong)QXBadgeButton *messageBtn;
@property (nonatomic,strong)QXBadgeButton *pkBtn;
@property (nonatomic,strong)QXBadgeButton *musicBtn;
@property (nonatomic,strong)QXBadgeButton *giftBtn;
@property (nonatomic,strong)QXBadgeButton *setBtn;
@property (nonatomic,strong)NSMutableArray *eventArray;
@property (nonatomic,assign)QXRoomRoleType roleType;
@property (nonatomic,strong)QXDynamicCommentInputView *commentView;
@property (nonatomic,assign)QXRedPacketModel* redpacketModel;
@end
@implementation QXRoomBottomView
- (instancetype)init
{
self = [super init];
if (self) {
[self initSubviews];
}
return self;
}
-(void)initSubviews{
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(noticeUnreadNumberDidChanged:) name:noticeUnreadNumberDidChanged object:nil];
MJWeakSelf
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillChangeFrame:) name:UIKeyboardWillChangeFrameNotification object:nil];
self.sayBg = [[UIView alloc] init];
self.sayBg.backgroundColor = RGB16A(0xffffff, 0.2);
[self.sayBg addRoundedCornersWithRadius:18];
[self.sayBg addTapBlock:^(id _Nonnull obj) {
if (weakSelf.roomModel.user_info.is_mute.intValue == 1) {
showToast(@"您已被禁言");
return;
}
[weakSelf.vc.view addSubview:weakSelf.commentView];
[weakSelf.commentView.textField becomeFirstResponder];
}];
[self addSubview:self.sayBg];
[self.sayBg mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(16);
make.top.equalTo(self);
make.height.mas_equalTo(36);
make.width.mas_equalTo(106);
}];
self.sayImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"room_say_icon"]];
[self.sayBg addSubview:self.sayImageView];
[self.sayImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(10);
make.centerY.equalTo(self.sayBg);
make.width.height.mas_equalTo(24);
}];
self.sayLabel = [[UILabel alloc] init];
self.sayLabel.textColor = [UIColor whiteColor];
self.sayLabel.font = [UIFont systemFontOfSize:14];
self.sayLabel.text = QXText(@"说点什么");
self.sayLabel.textAlignment = NSTextAlignmentCenter;
[self.sayBg addSubview:self.sayLabel];
[self.sayLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.sayImageView.mas_right);
make.centerY.equalTo(self.sayBg);
make.right.equalTo(self.sayBg);
}];
self.playAudioBtn = [[QXBadgeButton alloc] init];
self.playAudioBtn.tag = 20;
[self.playAudioBtn setImage:[UIImage imageNamed:@"room_event_play_audio_nor"] forState:(UIControlStateNormal)];
[self.playAudioBtn setImage:[UIImage imageNamed:@"room_event_play_audio_sel"] forState:(UIControlStateSelected)];
[self.playAudioBtn addTarget:self action:@selector(eventAction:) forControlEvents:(UIControlEventTouchUpInside)];
self.playAudioBtn.hidden = YES;
[self addSubview:self.playAudioBtn];
self.audioBtn = [[QXBadgeButton alloc] init];
self.audioBtn.tag = 21;
[self.audioBtn setImage:[UIImage imageNamed:@"room_event_mute_audio_nor"] forState:(UIControlStateNormal)];
[self.audioBtn setImage:[UIImage imageNamed:@"room_event_mute_audio_sel"] forState:(UIControlStateSelected)];
[self.audioBtn addTarget:self action:@selector(eventAction:) forControlEvents:(UIControlEventTouchUpInside)];;
self.audioBtn.hidden = YES;
[self addSubview:self.audioBtn];
self.messageBtn = [[QXBadgeButton alloc] init];
self.messageBtn.tag = 22;
AppDelegate *appDelegate = (AppDelegate*)[UIApplication sharedApplication].delegate;
NSInteger unread = appDelegate.tabbarVC.messageUnReadNumber;
[self.messageBtn.unreadView setNum:unread];
[self.messageBtn setImage:[UIImage imageNamed:@"room_event_message"] forState:(UIControlStateNormal)];
[self.messageBtn addTarget:self action:@selector(eventAction:) forControlEvents:(UIControlEventTouchUpInside)];;
self.messageBtn.hidden = YES;
[self addSubview:self.messageBtn];
self.pkBtn = [[QXBadgeButton alloc] init];
self.pkBtn.tag = 23;
[self.pkBtn setImage:[UIImage imageNamed:@"room_event_pk"] forState:(UIControlStateNormal)];
[self.pkBtn addTarget:self action:@selector(eventAction:) forControlEvents:(UIControlEventTouchUpInside)];;
self.pkBtn.hidden = YES;
[self addSubview:self.pkBtn];
self.musicBtn = [[QXBadgeButton alloc] init];
self.musicBtn.tag = 24;
[self.musicBtn setImage:[UIImage imageNamed:@"room_event_music"] forState:(UIControlStateNormal)];
[self.musicBtn addTarget:self action:@selector(eventAction:) forControlEvents:(UIControlEventTouchUpInside)];;
self.musicBtn.hidden = YES;
[self addSubview:self.musicBtn];
self.giftBtn = [[QXBadgeButton alloc] init];
self.giftBtn.tag = 25;
[self.giftBtn setImage:[UIImage imageNamed:@"room_event_gift"] forState:(UIControlStateNormal)];
[self.giftBtn addTarget:self action:@selector(eventAction:) forControlEvents:(UIControlEventTouchUpInside)];;
self.giftBtn.hidden = YES;
[self addSubview:self.giftBtn];
self.setBtn = [[QXBadgeButton alloc] init];
self.setBtn.tag = 26;
[self.setBtn setImage:[UIImage imageNamed:@"room_event_set"] forState:(UIControlStateNormal)];
[self.setBtn addTarget:self action:@selector(eventAction:) forControlEvents:(UIControlEventTouchUpInside)];;
self.setBtn.hidden = YES;
[self addSubview:self.setBtn];
}
-(void)setRoomModel:(QXRoomModel *)roomModel{
_roomModel = roomModel;
}
-(void)setIsCabinRoom:(BOOL)isCabinRoom{
_isCabinRoom = isCabinRoom;
[self.sayBg mas_remakeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(16);
make.top.equalTo(self);
make.height.mas_equalTo(36);
make.right.mas_equalTo(-16);
}];
for (UIButton*btn in self.eventArray) {
btn.hidden = YES;
}
}
-(void)noticeUnreadNumberDidChanged:(NSNotification*)notice{
NSNumber *number = notice.object;
[self.messageBtn.unreadView setNum:number.longValue];
}
-(void)setRoleType:(QXRoomRoleType)roleType hasPK:(BOOL)hasPK hasSong:(BOOL)hasSong{
_roleType = roleType;
///
self.playAudioBtn.hidden = YES;
///
self.messageBtn.hidden = YES;
/// pk
self.pkBtn.hidden = YES;
///
self.musicBtn.hidden = YES;
//
self.giftBtn.hidden = YES;
///
self.setBtn.hidden = YES;
self.audioBtn.selected = NO;
self.playAudioBtn.selected = NO;
switch (roleType) {
///
case QXRoomRoleTypeCompere:
{
self.eventArray = [NSMutableArray arrayWithArray:@[
self.playAudioBtn,
self.messageBtn,
// self.musicBtn,
self.giftBtn,
self.setBtn,
]];
if (hasSong) {
if (![self.eventArray containsObject:self.musicBtn]) {
[self.eventArray insertObject:self.musicBtn atIndex:2];
}
}else{
if ([self.eventArray containsObject:self.musicBtn]) {
[self.eventArray removeObject:self.musicBtn];
}
}
if (hasPK) {
if (![self.eventArray containsObject:self.pkBtn]) {
[self.eventArray insertObject:self.pkBtn atIndex:2];
}
}else{
if ([self.eventArray containsObject:self.pkBtn]) {
[self.eventArray removeObject:self.pkBtn];
}
}
}
break;
///
case QXRoomRoleTypeOwner:
{
self.eventArray = [NSMutableArray arrayWithArray:@[
self.playAudioBtn,
self.messageBtn,
// self.musicBtn,
self.giftBtn,
self.setBtn,
]];
if (hasSong) {
if (![self.eventArray containsObject:self.musicBtn]) {
[self.eventArray insertObject:self.musicBtn atIndex:2];
}
}else{
if ([self.eventArray containsObject:self.musicBtn]) {
[self.eventArray removeObject:self.musicBtn];
}
}
if (hasPK) {
if (![self.eventArray containsObject:self.pkBtn]) {
[self.eventArray insertObject:self.pkBtn atIndex:2];
}
}else{
if ([self.eventArray containsObject:self.pkBtn]) {
[self.eventArray removeObject:self.pkBtn];
}
}
}
break;
//
case QXRoomRoleTypeAudience:
{
self.eventArray = [NSMutableArray arrayWithArray:@[
self.playAudioBtn,
self.messageBtn,
// self.musicBtn,
self.giftBtn,
self.setBtn,
]];
if (hasSong) {
if (![self.eventArray containsObject:self.musicBtn]) {
[self.eventArray insertObject:self.musicBtn atIndex:2];
}
}else{
if ([self.eventArray containsObject:self.musicBtn]) {
[self.eventArray removeObject:self.musicBtn];
}
}
}
break;
default:
break;
}
CGFloat btnWidth = 35;
for ( int i = 0 ;i < self.eventArray.count;i++ ) {
QXBadgeButton*btn = self.eventArray[i];
btn.hidden = NO;
[btn mas_remakeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(-(16+btnWidth*(self.eventArray.count-(i+1))));
make.width.mas_equalTo(btnWidth);
make.centerY.equalTo(self.sayBg);
make.height.mas_equalTo(self.sayBg);
}];
}
}
/// 1 2
-(void)setStatus:(NSInteger)status{
_status = status;
//
self.playAudioBtn.selected = NO;
//
self.audioBtn.selected = NO;
if (_status == 1) {
//
self.audioBtn.hidden = YES;
///
if ([self.eventArray containsObject:self.audioBtn]) {
///
[self.eventArray removeObject:self.audioBtn];
}
}else if(_status == 2){
//
self.audioBtn.hidden = NO;
if (![self.eventArray containsObject:self.audioBtn]) {
/// 1
[self.eventArray insertObject:self.audioBtn atIndex:1];
}
}
CGFloat btnWidth = 35;
for ( int i = 0 ;i < self.eventArray.count;i++ ) {
QXBadgeButton*btn = self.eventArray[i];
btn.hidden = NO;
[btn mas_remakeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(-(16+btnWidth*(self.eventArray.count-(i+1))));
make.width.mas_equalTo(btnWidth);
make.centerY.equalTo(self.sayBg);
make.height.mas_equalTo(self.sayBg);
}];
}
}
-(void)setMuteAudioStatus:(BOOL)status{
self.audioBtn.selected = status;
}
-(void)setPlayAudioStatus:(BOOL)status{
self.playAudioBtn.selected = status;
}
-(void)eventAction:(UIButton*)sender{
if (sender == self.audioBtn) {
if (self.roomModel.user_info.is_mute_pit.intValue == 1) {
showToast(@"您已被禁麦");
return;
}
sender.selected = !sender.selected;
}
if (sender == self.playAudioBtn) {
sender.selected = !sender.selected;
}
if (self.delegate && [self.delegate respondsToSelector:@selector(didClickEventType:isSelected:)]) {
[self.delegate didClickEventType:sender.tag isSelected:sender.selected];
}
}
-(void)atUserWithName:(NSString *)nickname{
if (self.roomModel.user_info.is_mute.intValue == 1) {
showToast(@"您已被禁言");
return;
}
self.commentView.textField.text = [NSString stringWithFormat:@"@%@ ",nickname];
[self.vc.view addSubview:self.commentView];
[self.commentView.textField becomeFirstResponder];
}
-(void)inputMessageWithName:(NSString *)message redpacketModel:(QXRedPacketModel*)redpacketModel{
self.redpacketModel = redpacketModel;
self.commentView.textField.text = [NSString stringWithFormat:@"#口令红包 %@",message];
[self.vc.view addSubview:self.commentView];
[self.commentView.textField becomeFirstResponder];
}
#pragma mark -
-(void)didClickSendWithText:(NSString*)text model:(nonnull QXDynamicCommentListModel *)model{
if (self.roomModel.user_info.is_mute.intValue == 1) {
showToast(@"您已被禁言");
[self.vc.view endEditing:YES];
return;
}
[[QXGlobal shareGlobal] finishTask];
[[QXRoomMessageManager shared] sendChatMessage:text messageType:(QXRoomMessageTypeText) needInsertMessage:YES];
self.commentView.textField.text = @"";
if (self.redpacketModel == nil) {
[self.vc.view endEditing:YES];
return;
}
NSString*password = [NSString stringWithFormat:@"#口令红包 %@",self.redpacketModel.password];
if ([text isEqualToString:password]) {
if (self.delegate && [self.delegate respondsToSelector:@selector(didSendMessage:redpacketModel:)]) {
[self.delegate didSendMessage:text redpacketModel:self.redpacketModel];
}
}
[self.vc.view endEditing:YES];
}
- (void)keyboardWillHide:(NSNotification *)notification {
[UIView animateWithDuration:0.3 animations:^{
self.commentView.y = SCREEN_HEIGHT;
}completion:^(BOOL finished) {
[self.commentView removeFromSuperview];
}];
}
- (void)keyboardWillShow:(NSNotification *)notification {
// CGRect keyboardFrame = [notification.userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue];
// [UIView animateWithDuration:0.3 animations:^{
// self.commentView.y = keyboardFrame.origin.y+TabbarContentHeight;
// }];
}
- (void)keyboardWillChangeFrame:(NSNotification *)notification {
CGRect keyboardFrame = [notification.userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue];
[UIView animateWithDuration:0.15 animations:^{
self.commentView.y = keyboardFrame.origin.y-TabbarContentHeight;
}];
}
-(void)didResignFirstResponder{
self.redpacketModel = nil;
}
-(QXDynamicCommentInputView *)commentView{
if (!_commentView) {
_commentView = [[QXDynamicCommentInputView alloc] initWithFrame:CGRectMake(0, SCREEN_HEIGHT, SCREEN_WIDTH, TabbarContentHeight)];
_commentView.delegate = self;
}
return _commentView;
}
@end

View File

@@ -0,0 +1,98 @@
//
// QXRoomChatListView.h
// QXLive
//
// Created by 启星 on 2025/6/7.
//
#import <UIKit/UIKit.h>
#import "QXUserModel.h"
#import "QXGiftModel.h"
#import "QXSongListModel.h"
#import "QXRoomSeatDelegate.h"
#import "QXRoomFriendRelationModel.h"
NS_ASSUME_NONNULL_BEGIN
typedef NS_ENUM(NSInteger) {
/// 系统消息
QXRoomChatMessageTypeSystem = 0,
/// 聊天消息
QXRoomChatMessageTypeChat = 1,
/// 礼物消息
QXRoomChatMessageTypeGift = 2,
}QXRoomChatMessageType;
@class QXRoomChatListModel;
@interface QXRoomChatListView : UIView
@property (nonatomic,weak)id<QXRoomSeatDelegate>delegate;
-(void)insertNoitce;
-(void)insertMessage:(QXRoomChatListModel*)model;
-(void)clearMessage;
@end
@interface QXRoomChatListCell : UITableViewCell
@property(nonatomic,strong)UIImageView *headerImageView;
@property(nonatomic,strong)UIView *iconBgView;
@property(nonatomic,strong)NSMutableArray *iconViewArray;
@property(nonatomic,strong)UILabel *nameLabel;
@property(nonatomic,strong)UILabel *titleLabel;
@property(nonatomic,strong)UIImageView *bubbleImageView;
@property (nonatomic,strong)QXRoomChatListModel *message;
@property (nonatomic,weak)id<QXRoomSeatDelegate>delegate;
-(void)loadBubble;
+(instancetype)cellWithTableView:(UITableView *)tableView;
@end
@interface QXRoomGiftListCell : UITableViewCell
@property(nonatomic,strong)UIImageView *headerImageView;
@property(nonatomic,strong)UIView *iconBgView;
/// 礼物图片
@property(nonatomic,strong)UIImageView *giftImageView;
/// 礼物数量
@property(nonatomic,strong)UILabel *giftCountLabel;
@property(nonatomic,strong)NSMutableArray *iconViewArray;
@property(nonatomic,strong)UILabel *nameLabel;
@property(nonatomic,strong)UILabel *titleLabel;
@property(nonatomic,strong)UIImageView *bubbleImageView;
@property (nonatomic,strong)QXRoomChatListModel *message;
@property (nonatomic,weak)id<QXRoomSeatDelegate>delegate;
-(void)loadBubble;
+(instancetype)cellWithTableView:(UITableView *)tableView;
@end
@interface QXRoomChatListSystemCell : UITableViewCell
@property(nonatomic,strong)UIView *bgView;
@property(nonatomic,strong)UILabel *titleLabel;
@property (nonatomic,strong)QXRoomChatListModel *message;
+(instancetype)cellWithTableView:(UITableView *)tableView;
@end
@interface QXRoomChatListModel : NSObject
@property (nonatomic,assign)QXRoomChatMessageType messageType;
@property (nonatomic,strong)NSString* text;
@property (nonatomic,strong)QXGiftModel* GiftInfo;
@property (nonatomic,strong)NSArray<QXGiftModel*>* GiftInfos;
@property (nonatomic,strong)QXUserHomeModel* FromUserInfo;
@property (nonatomic,strong)QXUserHomeModel* ToUserInfo;
@property (nonatomic,strong)NSArray<QXUserHomeModel* >* ToUserInfos;
/// 当前音乐
@property (nonatomic,strong)QXSongListModel* songInfo;
/// 下一首音乐
@property (nonatomic,strong)QXSongListModel* nextInfo;
@property (nonatomic,assign)BOOL havBubble;
@property (nonatomic,strong)NSString* total;
/// 交友房新增
@property (nonatomic,strong)NSString* step;
@property (nonatomic,strong)NSString* friend_id;
@property (nonatomic,strong)NSString* end_time;
@property (nonatomic,strong)QXRoomFriendRelationModel* friend_user;
/// 礼物数量 巡乐会
@property (nonatomic,strong)NSString *gift_num;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,923 @@
//
// QXRoomChatListView.m
// QXLive
//
// Created by on 2025/6/7.
//
#import "QXRoomChatListView.h"
#import "UIImage+WebP.h"
#define messageNameColor RGB16(0x00C8FF)
#define messageGiftColor RGB16(0xFFE309)
NSArray<NSValue *> *findAllOccurrencesOfString(NSString *fullString, NSString *substring) {
NSMutableArray<NSValue *> *occurrences = [NSMutableArray array];
NSRange searchRange = NSMakeRange(0, fullString.length);
NSRange foundRange;
while (searchRange.location < fullString.length) {
searchRange.length = fullString.length - searchRange.location;
foundRange = [fullString rangeOfString:substring
options:0
range:searchRange];
if (foundRange.location != NSNotFound) {
//
[occurrences addObject:[NSValue valueWithRange:foundRange]];
//
searchRange.location = foundRange.location + foundRange.length;
} else {
// 退
break;
}
}
return [occurrences copy];
}
NSInteger maxMessageCount = 20;
@interface QXRoomChatListView() <UITableViewDelegate,UITableViewDataSource,QXRoomSeatDelegate>
@property (nonatomic,strong)UITableView *tableView;
@property (nonatomic,strong)NSMutableArray *dataArray;
@property (nonatomic,strong)NSMutableArray *giftArray;
@property (nonatomic,strong)NSMutableArray *chatArray;
@property (nonatomic,assign)NSInteger messageCount;
@property (nonatomic,strong)UIButton *allBtn;
@property (nonatomic,strong)UIButton *chatBtn;
@property (nonatomic,strong)UIButton *giftBtn;
@property (nonatomic,strong)UIButton *selectedBtn;
@property (nonatomic,assign)BOOL isDragging;
@property (nonatomic,strong)UILabel *messageLabel;
@property (nonatomic,strong)UIButton *messageCountBtn;
@end
@implementation QXRoomChatListView
- (instancetype)init
{
self = [super init];
if (self) {
[self initSubviews];
}
return self;
}
-(void)initSubviews{
[self addSubview:self.tableView];
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(self);
make.top.equalTo(self).offset(40);
make.bottom.equalTo(self).offset(-10);
}];
self.allBtn = [[UIButton alloc] init];
NSAttributedString *allAttrNor = [[NSAttributedString alloc] initWithString:QXText(@"全部") attributes:@{NSFontAttributeName:[UIFont boldSystemFontOfSize:14],NSForegroundColorAttributeName:[UIColor whiteColor]}];
NSAttributedString *allAttrSel = [[NSAttributedString alloc] initWithString:QXText(@"全部") attributes:@{NSFontAttributeName:[UIFont boldSystemFontOfSize:16],NSForegroundColorAttributeName:[UIColor whiteColor]}];
[self.allBtn setAttributedTitle:allAttrNor forState:UIControlStateNormal];
[self.allBtn setAttributedTitle:allAttrSel forState:UIControlStateSelected];
self.allBtn.selected = YES;
self.selectedBtn = self.allBtn;
[self.allBtn addTarget:self action:@selector(typeAction:) forControlEvents:(UIControlEventTouchUpInside)];
[self addSubview:self.allBtn];
[self.allBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(16);
make.top.equalTo(self);
make.height.mas_equalTo(40);
make.width.mas_equalTo(50);
}];
self.chatBtn = [[UIButton alloc] init];
NSAttributedString *chatAttrNor = [[NSAttributedString alloc] initWithString:QXText(@"聊天") attributes:@{NSFontAttributeName:[UIFont boldSystemFontOfSize:14],NSForegroundColorAttributeName:[UIColor whiteColor]}];
NSAttributedString *chatAttrSel = [[NSAttributedString alloc] initWithString:QXText(@"聊天") attributes:@{NSFontAttributeName:[UIFont boldSystemFontOfSize:16],NSForegroundColorAttributeName:[UIColor whiteColor]}];
[self.chatBtn setAttributedTitle:chatAttrNor forState:UIControlStateNormal];
[self.chatBtn setAttributedTitle:chatAttrSel forState:UIControlStateSelected];
[self.chatBtn addTarget:self action:@selector(typeAction:) forControlEvents:(UIControlEventTouchUpInside)];
[self addSubview:self.chatBtn];
[self.chatBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.allBtn.mas_right).offset(5);
make.top.equalTo(self);
make.height.mas_equalTo(40);
make.width.mas_equalTo(50);
}];
self.giftBtn = [[UIButton alloc] init];
NSAttributedString *giftAttrNor = [[NSAttributedString alloc] initWithString:QXText(@"礼物") attributes:@{NSFontAttributeName:[UIFont boldSystemFontOfSize:14],NSForegroundColorAttributeName:[UIColor whiteColor]}];
NSAttributedString *giftAttrSel = [[NSAttributedString alloc] initWithString:QXText(@"礼物") attributes:@{NSFontAttributeName:[UIFont boldSystemFontOfSize:16],NSForegroundColorAttributeName:[UIColor whiteColor]}];
[self.giftBtn setAttributedTitle:giftAttrNor forState:UIControlStateNormal];
[self.giftBtn setAttributedTitle:giftAttrSel forState:UIControlStateSelected];
[self.giftBtn addTarget:self action:@selector(typeAction:) forControlEvents:(UIControlEventTouchUpInside)];
[self addSubview:self.giftBtn];
[self.giftBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.chatBtn.mas_right).offset(5);
make.top.equalTo(self);
make.height.mas_equalTo(40);
make.width.mas_equalTo(50);
}];
self.messageCountBtn = [[UIButton alloc] init];;
[self.messageCountBtn setTitleColor:RGB16(0xB265FA) forState:(UIControlStateNormal)];
self.messageCountBtn.backgroundColor = [UIColor whiteColor];
[self.messageCountBtn addRoundedCornersWithRadius:10];
self.messageCountBtn.titleLabel.font = [UIFont systemFontOfSize:12];
[self.messageCountBtn addTarget:self action:@selector(scrollToBottom) forControlEvents:(UIControlEventTouchUpInside)];
[self addSubview:self.messageCountBtn];
self.messageCountBtn.hidden = YES;
[self.messageCountBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(-40);
make.bottom.equalTo(self);
make.height.mas_equalTo(20);
make.width.mas_equalTo(75);
}];
// self.messageLabel = [[UILabel alloc] init];
// self.messageLabel.textColor = [UIColor whiteColor];
// self.messageLabel.text = @"张三进入了房间";
// self.messageLabel.font = [UIFont systemFontOfSize:12];
// [self addSubview:self.messageLabel];
// [self.messageLabel mas_makeConstraints:^(MASConstraintMaker *make) {
// make.left.mas_equalTo(16);
// make.bottom.equalTo(self).offset(-5);
// make.height.mas_equalTo(20);
// make.right.equalTo(self);
// }];
}
-(void)typeAction:(UIButton*)sender{
self.selectedBtn.selected = !self.selectedBtn.selected;
sender.selected = !sender.selected;
self.selectedBtn = sender;
[self.tableView reloadData];
[self scrollToBottom];
}
-(void)scrollToBottom{
NSArray *arr;
if (self.selectedBtn == self.chatBtn) {
arr = self.chatArray;
}else if (self.selectedBtn == self.giftBtn) {
arr = self.giftArray;
}else{
arr = self.dataArray;
}
if (arr.count > 0) {
[self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:arr.count-1 inSection:0] atScrollPosition:(UITableViewScrollPositionBottom) animated:YES];
}
self.isDragging = NO;
self.messageCount = 0;
self.messageCountBtn.hidden = YES;
}
-(void)insertNoitce{
QXRoomChatListModel *model = [QXRoomChatListModel new];
model.messageType = QXRoomChatMessageTypeSystem;
model.text = @"秘地严禁未成年人进行直播或打赏官方将24小时在线巡查。我们提倡绿色直播直播间严禁出现涉政、涉恐、涉黄、涉赌等违法违规内容严禁宣传封建迷信、宗教极端思想、出现低俗色情、吸烟酗酒等内容严禁违反社会主义核心价值观、践踏社会道德底线、诱导打赏、低俗 PK 、买卖金币等行为,请大家共同遵守、监督并及时举报。请勿相信各类刷钻、购买礼包、游戏币及电商贩卖等非官方广告信息,谨防网络诈骗。";
[self.dataArray addObject:model];
[self.tableView reloadData];
[self scrollToBottom];
}
-(void)insertMessage:(QXRoomChatListModel *)model{
///
if (model.messageType != QXRoomChatMessageTypeGift) {
[self.dataArray addObject:model];
}
if (model.messageType == QXRoomChatMessageTypeChat) {
[self.chatArray addObject:model];
}
if (model.messageType == QXRoomChatMessageTypeGift) {
[self.giftArray addObject:model];
}
// if (self.dataArray.count>maxMessageCount) {
// [self.dataArray removeFirstObject];
// }
// if (self.chatArray.count>maxMessageCount) {
// [self.chatArray removeFirstObject];
// }
// if (self.giftArray.count>maxMessageCount) {
// [self.giftArray removeFirstObject];
// }
[self.tableView reloadData];
if (self.isDragging) {
self.messageCount++;
self.messageCountBtn.hidden = NO;
[self.messageCountBtn setTitle:[NSString localizedStringWithFormat:QXText(@"%@条新消息"),[NSString stringWithFormat:@"%ld",self.messageCount]] forState:(UIControlStateNormal)];
}else{
[self scrollToBottom];
}
}
-(void)clearMessage{
[self.dataArray removeAllObjects];
[self.giftArray removeAllObjects];
[self.chatArray removeAllObjects];
[self.tableView reloadData];
}
-(void)previewUserInfoWithUserId:(NSString *)userId{
if (self.delegate && [self.delegate respondsToSelector:@selector(previewUserInfoWithUserId:)]) {
[self.delegate previewUserInfoWithUserId:userId];
}
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
if (self.selectedBtn == self.chatBtn) {
return self.chatArray.count;
}
if (self.selectedBtn == self.giftBtn) {
return self.giftArray.count;
}
return self.dataArray.count;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
QXRoomChatListModel *model;
if (self.selectedBtn == self.chatBtn) {
model = self.chatArray[indexPath.row];
}else if (self.selectedBtn == self.giftBtn) {
model = self.giftArray[indexPath.row];
}else{
model = self.dataArray[indexPath.row];
}
// model.havBubble = indexPath.row%2;
if (model.messageType == QXRoomChatMessageTypeChat) {
QXRoomChatListCell *cell = [QXRoomChatListCell cellWithTableView:tableView];
cell.delegate = self;
cell.message = model;
return cell;
}else if (model.messageType == QXRoomChatMessageTypeGift) {
QXRoomGiftListCell *cell = [QXRoomGiftListCell cellWithTableView:tableView];
cell.delegate = self;
cell.message = model;
return cell;
}else{
QXRoomChatListSystemCell *cell = [QXRoomChatListSystemCell cellWithTableView:tableView];
cell.message = model;
return cell;
}
}
-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{
if ([cell isKindOfClass:[QXRoomChatListCell class]]) {
QXRoomChatListCell *Listcell = (QXRoomChatListCell *)cell;
[Listcell loadBubble];
}
}
-(void)tableView:(UITableView *)tableView didEndDisplayingCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{
if ([cell isKindOfClass:[QXRoomChatListCell class]]) {
QXRoomChatListCell *Listcell = (QXRoomChatListCell *)cell;
[Listcell.bubbleImageView sd_cancelLatestImageLoad];
}
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
QXRoomChatListModel *model;
if (self.selectedBtn == self.chatBtn) {
model = self.chatArray[indexPath.row];
}else if (self.selectedBtn == self.giftBtn) {
model = self.giftArray[indexPath.row];
}else{
model = self.dataArray[indexPath.row];
}
CGFloat height = 0;
if (model.messageType == QXRoomChatMessageTypeChat) {
height = [model.text heightForFont:[UIFont systemFontOfSize:14] width:ScaleWidth(280)-16-28-6-8-8];
if (model.havBubble) {
///
height = 30+14+6+30 + height;
}else{
//
height = 30+14+6+12 + height;
}
}else if (model.messageType == QXRoomChatMessageTypeGift) {
height = [model.text heightForFont:[UIFont systemFontOfSize:14] width:ScaleWidth(280)-16-28-6-8-8];
height = 30+14+6+12 + height;
}else{
height = [model.text heightForFont:[UIFont systemFontOfSize:14] width:ScaleWidth(280)-16-8-8*2] + 12+16+1;
}
return height;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
QXRoomChatListModel *model;
if (self.selectedBtn == self.chatBtn) {
model = self.chatArray[indexPath.row];
}else if (self.selectedBtn == self.giftBtn) {
model = self.giftArray[indexPath.row];
}else{
model = self.dataArray[indexPath.row];
}
if (model.FromUserInfo.user_id.longValue > 0 && model.messageType == QXRoomChatMessageTypeSystem) {
if (self.delegate && [self.delegate respondsToSelector:@selector(previewUserInfoWithUserId:)]) {
[self.delegate previewUserInfoWithUserId:model.FromUserInfo.user_id];
}
}
}
-(void)scrollViewDidScroll:(UIScrollView *)scrollView{
CGFloat height = scrollView.frame.size.height;
CGFloat contentYoffset = scrollView.contentOffset.y;
CGFloat distanceFromBottom = scrollView.contentSize.height - contentYoffset;
if (distanceFromBottom < height) {
self.isDragging = NO;
}
}
-(void)scrollViewWillBeginDragging:(UIScrollView *)scrollView{
self.isDragging = YES;
}
-(UITableView *)tableView{
if (!_tableView) {
_tableView = [[UITableView alloc] initWithFrame:CGRectZero style:(UITableViewStylePlain)];
_tableView.dataSource = self;
_tableView.delegate = self;
_tableView.backgroundColor = [UIColor clearColor];
_tableView.tableFooterView = [UIView new];
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
_tableView.showsHorizontalScrollIndicator = NO;
_tableView.showsVerticalScrollIndicator = NO;
if (@available(iOS 15.0, *)) {
_tableView.sectionHeaderTopPadding = 0;
} else {
// Fallback on earlier versions
}
}
return _tableView;
}
-(NSMutableArray *)dataArray{
if (!_dataArray) {
_dataArray = [NSMutableArray array];
}
return _dataArray;
}
-(NSMutableArray *)giftArray{
if (!_giftArray) {
_giftArray =[ NSMutableArray array];
}
return _giftArray;
}
-(NSMutableArray *)chatArray{
if (!_chatArray) {
_chatArray = [NSMutableArray array];
}
return _chatArray;
}
@end
@implementation QXRoomChatListCell
+(instancetype)cellWithTableView:(UITableView *)tableView{
static NSString* cellId = @"QXRoomChatListCell";
QXRoomChatListCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
if (!cell) {
cell = [[QXRoomChatListCell alloc] initWithStyle:(UITableViewCellStyleDefault) reuseIdentifier:cellId];
}
return cell;
}
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
self.contentView.backgroundColor = [UIColor clearColor];
self.backgroundColor = [UIColor clearColor];
self.selectionStyle = UITableViewCellSelectionStyleNone;
[self initSubviews];
}
return self;
}
-(void)headerAction{
if (self.delegate && [self.delegate respondsToSelector:@selector(previewUserInfoWithUserId:)]) {
[self.delegate previewUserInfoWithUserId:self.message.FromUserInfo.user_id];
}
}
-(void)setMessage:(QXRoomChatListModel *)message{
_message = message;
// self.titleLabel.text = message.text;
NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:message.text];
if ([message.FromUserInfo.nickname isExist]) {
[attr yy_setColor:messageNameColor range:[message.text rangeOfString:message.FromUserInfo.nickname]];
}
if ([message.ToUserInfo.nickname isExist]) {
[attr yy_setColor:messageNameColor range:[message.text rangeOfString:message.ToUserInfo.nickname]];
}
if ([message.GiftInfo.gift_name isExist]) {
NSArray *arr = [message.GiftInfo.gift_name componentsSeparatedByString:@","];
for (NSString*gift_name in arr) {
NSArray<NSValue *> *occurrences = findAllOccurrencesOfString(message.text, gift_name);
for (NSValue *rangeValue in occurrences) {
NSRange range = [rangeValue rangeValue];
[attr yy_setColor:messageGiftColor range:range];
}
}
}
if (message.GiftInfos.count > 0) {
for (QXGiftModel*gift in message.GiftInfos) {
if ([gift.gift_name isExist]) {
[attr yy_setColor:messageGiftColor range:[message.text rangeOfString:gift.gift_name]];
}
}
}
if (message.ToUserInfos.count > 0) {
for (int i = 0; i < message.ToUserInfos.count; i++) {
QXUserHomeModel*md = message.ToUserInfos[i];
NSArray<NSValue *> *occurrences = findAllOccurrencesOfString(message.text, md.nickname);
for (NSValue *rangeValue in occurrences) {
NSRange range = [rangeValue rangeValue];
[attr yy_setColor:messageNameColor range:range];
}
}
}
self.titleLabel.attributedText = attr;
self.nameLabel.text = message.FromUserInfo.nickname;
[self.headerImageView sd_setImageWithURL:[NSURL URLWithString:message.FromUserInfo.avatar]];
self.iconBgView.hidden = YES;
for (int i = 0;i < message.FromUserInfo.icon.count;i++) {
if (i < 3) {
self.iconBgView.hidden = NO;
UIImageView *iconImageView = self.iconViewArray[i];
iconImageView.hidden = NO;
[iconImageView sd_setImageWithURL:[NSURL URLWithString:message.FromUserInfo.icon[i]]];
}else{
self.iconBgView.hidden = YES;
}
}
}
-(void)initSubviews{
self.headerImageView = [[UIImageView alloc] init];
self.headerImageView.contentMode = UIViewContentModeScaleAspectFill;
self.headerImageView.backgroundColor = [UIColor whiteColor];
[self.headerImageView addRoundedCornersWithRadius:14];
[self.contentView addSubview:self.headerImageView];
[self.headerImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(16);
make.top.mas_equalTo(2);
make.size.mas_equalTo(CGSizeMake(28, 28));
}];
UIButton *headerBtn = [[UIButton alloc] init];
[headerBtn addTarget:self action:@selector(headerAction) forControlEvents:(UIControlEventTouchUpInside)];
[self.contentView addSubview:headerBtn];
[headerBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.top.equalTo(self.headerImageView).offset(-2);
make.bottom.right.equalTo(self.headerImageView).offset(2);
}];
self.nameLabel = [[UILabel alloc] init];
self.nameLabel.textColor = RGB16(0xCCA882);
self.nameLabel.font = [UIFont systemFontOfSize:12];
[self.contentView addSubview:self.nameLabel];
[self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.contentView);
make.left.equalTo(self.headerImageView.mas_right).offset(6);
make.right.equalTo(self.contentView).offset(-6);
make.height.mas_equalTo(14);
}];
self.titleLabel = [[UILabel alloc] init];
self.titleLabel.textColor = [UIColor whiteColor];
self.titleLabel.font = [UIFont systemFontOfSize:14];
self.titleLabel.numberOfLines = 0;
[self.contentView addSubview:self.titleLabel];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.nameLabel).offset(8);
make.top.equalTo(self.headerImageView.mas_bottom).offset(14);
make.right.mas_lessThanOrEqualTo(-8);
}];
self.nameLabel.text = @"张三站撒旦撒大萨达撒";
self.bubbleImageView = [[UIImageView alloc] init];
// UIImage * image = [UIImage imageWithColor:RGB16A(0x000000, 0.4)];
[self.bubbleImageView addRoundedCornersWithRadius:6];
// UIImage *image = [UIImage imageWithContentsOfFile:path];
// image = [image resizableImageWithCapInsets:UIEdgeInsetsMake(20, 40, 20 , 40) resizingMode:(UIImageResizingModeStretch)];
// self.bubbleImageView.image = image;
self.bubbleImageView.backgroundColor = RGB16A(0xFFFFFF, 0.2);
[self.contentView addSubview:self.bubbleImageView];
[self.bubbleImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.titleLabel).offset(-8);
make.top.equalTo(self.titleLabel).offset(-6);
make.bottom.equalTo(self.titleLabel).offset(6);
make.right.equalTo(self.titleLabel).offset(8);
// make.left.equalTo(self.titleLabel).offset(-55);
// make.top.equalTo(self.titleLabel).offset(0);
// make.bottom.equalTo(self.titleLabel).offset(0);
// make.right.equalTo(self.titleLabel).offset(55);
}];
[self.contentView bringSubviewToFront:self.titleLabel];
self.iconBgView = [[UIView alloc] init];
[self.contentView addSubview:self.iconBgView];
[self.iconBgView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.nameLabel);
make.right.equalTo(self.contentView);
make.height.mas_equalTo(16);
make.top.equalTo(self.nameLabel.mas_bottom).offset(2);
}];
CGFloat iconWidth = UserIconWidth;
CGFloat iconHeight = UserIconHeight;
CGFloat margin = 6;
for (int i = 0; i < 3; i++) {
UIImageView *iconImageView = [[UIImageView alloc] init];
iconImageView.hidden = YES;
[self.iconBgView addSubview:iconImageView];
[iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(i*(iconWidth+margin));
make.width.mas_equalTo(iconWidth);
make.height.mas_equalTo(iconHeight);
make.centerY.equalTo(self.iconBgView);
}];
[self.iconViewArray addObject:iconImageView];
}
}
-(void)loadBubble{
if (!self.message.havBubble) {
[self.bubbleImageView sd_cancelLatestImageLoad];
self.bubbleImageView.image = nil;
self.bubbleImageView.backgroundColor = RGB16A(0xFFFFFF, 0.2);
[self.bubbleImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.titleLabel).offset(-8);
make.top.equalTo(self.titleLabel).offset(-6);
make.bottom.equalTo(self.titleLabel).offset(6);
make.right.equalTo(self.titleLabel).offset(8);
// make.left.equalTo(self.titleLabel).offset(-55);
// make.top.equalTo(self.titleLabel).offset(0);
// make.bottom.equalTo(self.titleLabel).offset(0);
// make.right.equalTo(self.titleLabel).offset(55);
}];
}else{
NSString *path = [[NSBundle mainBundle] pathForResource:@"气泡" ofType:@"webp"];
[self.bubbleImageView sd_setImageWithURL:[NSURL fileURLWithPath:path] completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
image = [image resizableImageWithCapInsets:UIEdgeInsetsMake(20, 30, 20 , 30) resizingMode:(UIImageResizingModeStretch)];
self.bubbleImageView.image = image;
}];
CGFloat height = [self.message.text heightForFont:[UIFont systemFontOfSize:14] width:ScaleWidth(280)-16-28-6-8-8];
self.bubbleImageView.backgroundColor = [UIColor clearColor];
[self.bubbleImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.titleLabel).offset(-48);
// make.height.mas_equalTo(height+12);
make.height.mas_equalTo(height+60);
// make.width.mas_equalTo(ScaleWidth(280)-16-28-6-8-8);
make.centerY.equalTo(self.titleLabel);
make.right.equalTo(self.titleLabel).offset(48);
}];
}
}
-(NSMutableArray *)iconViewArray{
if (!_iconViewArray) {
_iconViewArray = [NSMutableArray array];
}
return _iconViewArray;
}
@end
@implementation QXRoomGiftListCell
+(instancetype)cellWithTableView:(UITableView *)tableView{
static NSString* cellId = @"QXRoomGiftListCell";
QXRoomGiftListCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
if (!cell) {
cell = [[QXRoomGiftListCell alloc] initWithStyle:(UITableViewCellStyleDefault) reuseIdentifier:cellId];
}
return cell;
}
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
self.contentView.backgroundColor = [UIColor clearColor];
self.backgroundColor = [UIColor clearColor];
self.selectionStyle = UITableViewCellSelectionStyleNone;
[self initSubviews];
}
return self;
}
-(void)headerAction{
if (self.delegate && [self.delegate respondsToSelector:@selector(previewUserInfoWithUserId:)]) {
[self.delegate previewUserInfoWithUserId:self.message.FromUserInfo.user_id];
}
}
-(void)setMessage:(QXRoomChatListModel *)message{
_message = message;
// self.titleLabel.text = message.text;
NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:message.text];
if ([message.FromUserInfo.nickname isExist]) {
[attr yy_setColor:messageNameColor range:[message.text rangeOfString:message.FromUserInfo.nickname]];
}
if ([message.ToUserInfo.nickname isExist]) {
[attr yy_setColor:messageNameColor range:[message.text rangeOfString:message.ToUserInfo.nickname]];
}
if ([message.GiftInfo.gift_name isExist]) {
NSArray *arr = [message.GiftInfo.gift_name componentsSeparatedByString:@","];
for (NSString*gift_name in arr) {
NSArray<NSValue *> *occurrences = findAllOccurrencesOfString(message.text, gift_name);
for (NSValue *rangeValue in occurrences) {
NSRange range = [rangeValue rangeValue];
[attr yy_setColor:messageGiftColor range:range];
}
}
}
if (message.GiftInfos.count > 0) {
for (QXGiftModel*gift in message.GiftInfos) {
if ([gift.gift_name isExist]) {
[attr yy_setColor:messageGiftColor range:[message.text rangeOfString:gift.gift_name]];
}
}
}
if (message.ToUserInfos.count > 0) {
for (int i = 0; i < message.ToUserInfos.count; i++) {
QXUserHomeModel*md = message.ToUserInfos[i];
NSArray<NSValue *> *occurrences = findAllOccurrencesOfString(message.text, md.nickname);
for (NSValue *rangeValue in occurrences) {
NSRange range = [rangeValue rangeValue];
[attr yy_setColor:messageNameColor range:range];
}
}
}
self.titleLabel.attributedText = attr;
self.nameLabel.text = message.FromUserInfo.nickname;
[self.headerImageView sd_setImageWithURL:[NSURL URLWithString:message.FromUserInfo.avatar]];
self.iconBgView.hidden = YES;
for (int i = 0;i < message.FromUserInfo.icon.count;i++) {
if (i < 3) {
self.iconBgView.hidden = NO;
UIImageView *iconImageView = self.iconViewArray[i];
iconImageView.hidden = NO;
[iconImageView sd_setImageWithURL:[NSURL URLWithString:message.FromUserInfo.icon[i]]];
}else{
self.iconBgView.hidden = YES;
}
}
}
-(void)initSubviews{
self.headerImageView = [[UIImageView alloc] init];
self.headerImageView.contentMode = UIViewContentModeScaleAspectFill;
self.headerImageView.backgroundColor = [UIColor whiteColor];
[self.headerImageView addRoundedCornersWithRadius:14];
[self.contentView addSubview:self.headerImageView];
[self.headerImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(16);
make.top.mas_equalTo(2);
make.size.mas_equalTo(CGSizeMake(28, 28));
}];
UIButton *headerBtn = [[UIButton alloc] init];
[headerBtn addTarget:self action:@selector(headerAction) forControlEvents:(UIControlEventTouchUpInside)];
[self.contentView addSubview:headerBtn];
[headerBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.top.equalTo(self.headerImageView).offset(-2);
make.bottom.right.equalTo(self.headerImageView).offset(2);
}];
self.nameLabel = [[UILabel alloc] init];
self.nameLabel.textColor = RGB16(0xCCA882);
self.nameLabel.font = [UIFont systemFontOfSize:12];
[self.contentView addSubview:self.nameLabel];
[self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.contentView);
make.left.equalTo(self.headerImageView.mas_right).offset(6);
make.right.equalTo(self.contentView).offset(-6);
make.height.mas_equalTo(14);
}];
self.titleLabel = [[UILabel alloc] init];
self.titleLabel.textColor = [UIColor whiteColor];
self.titleLabel.font = [UIFont systemFontOfSize:14];
self.titleLabel.numberOfLines = 0;
[self.contentView addSubview:self.titleLabel];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.nameLabel).offset(8);
make.top.equalTo(self.headerImageView.mas_bottom).offset(14);
make.right.mas_lessThanOrEqualTo(-8);
}];
self.nameLabel.text = @"张三站撒旦撒大萨达撒";
self.bubbleImageView = [[UIImageView alloc] init];
// UIImage * image = [UIImage imageWithColor:RGB16A(0x000000, 0.4)];
[self.bubbleImageView addRoundedCornersWithRadius:6];
// UIImage *image = [UIImage imageWithContentsOfFile:path];
// image = [image resizableImageWithCapInsets:UIEdgeInsetsMake(20, 40, 20 , 40) resizingMode:(UIImageResizingModeStretch)];
// self.bubbleImageView.image = image;
self.bubbleImageView.backgroundColor = RGB16A(0xFFFFFF, 0.2);
[self.contentView addSubview:self.bubbleImageView];
[self.bubbleImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.titleLabel).offset(-8);
make.top.equalTo(self.titleLabel).offset(-6);
make.bottom.equalTo(self.titleLabel).offset(6);
make.right.equalTo(self.titleLabel).offset(8);
// make.left.equalTo(self.titleLabel).offset(-55);
// make.top.equalTo(self.titleLabel).offset(0);
// make.bottom.equalTo(self.titleLabel).offset(0);
// make.right.equalTo(self.titleLabel).offset(55);
}];
[self.contentView bringSubviewToFront:self.titleLabel];
self.iconBgView = [[UIView alloc] init];
[self.contentView addSubview:self.iconBgView];
[self.iconBgView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.nameLabel);
make.right.equalTo(self.contentView);
make.height.mas_equalTo(16);
make.top.equalTo(self.nameLabel.mas_bottom).offset(2);
}];
CGFloat iconWidth = UserIconWidth;
CGFloat iconHeight = UserIconHeight;
CGFloat margin = 6;
for (int i = 0; i < 3; i++) {
UIImageView *iconImageView = [[UIImageView alloc] init];
iconImageView.hidden = YES;
[self.iconBgView addSubview:iconImageView];
[iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(i*(iconWidth+margin));
make.width.mas_equalTo(iconWidth);
make.height.mas_equalTo(iconHeight);
make.centerY.equalTo(self.iconBgView);
}];
[self.iconViewArray addObject:iconImageView];
}
}
-(void)loadBubble{
if (!self.message.havBubble) {
[self.bubbleImageView sd_cancelLatestImageLoad];
self.bubbleImageView.image = nil;
self.bubbleImageView.backgroundColor = RGB16A(0xFFFFFF, 0.2);
[self.bubbleImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.titleLabel).offset(-8);
make.top.equalTo(self.titleLabel).offset(-6);
make.bottom.equalTo(self.titleLabel).offset(6);
make.right.equalTo(self.titleLabel).offset(8);
// make.left.equalTo(self.titleLabel).offset(-55);
// make.top.equalTo(self.titleLabel).offset(0);
// make.bottom.equalTo(self.titleLabel).offset(0);
// make.right.equalTo(self.titleLabel).offset(55);
}];
}else{
NSString *path = [[NSBundle mainBundle] pathForResource:@"气泡" ofType:@"webp"];
[self.bubbleImageView sd_setImageWithURL:[NSURL fileURLWithPath:path] completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
image = [image resizableImageWithCapInsets:UIEdgeInsetsMake(20, 30, 20 , 30) resizingMode:(UIImageResizingModeStretch)];
self.bubbleImageView.image = image;
}];
CGFloat height = [self.message.text heightForFont:[UIFont systemFontOfSize:14] width:ScaleWidth(280)-16-28-6-8-8];
self.bubbleImageView.backgroundColor = [UIColor clearColor];
[self.bubbleImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.titleLabel).offset(-48);
// make.height.mas_equalTo(height+12);
make.height.mas_equalTo(height+60);
// make.width.mas_equalTo(ScaleWidth(280)-16-28-6-8-8);
make.centerY.equalTo(self.titleLabel);
make.right.equalTo(self.titleLabel).offset(48);
}];
}
}
-(NSMutableArray *)iconViewArray{
if (!_iconViewArray) {
_iconViewArray = [NSMutableArray array];
}
return _iconViewArray;
}
@end
@implementation QXRoomChatListSystemCell
+(instancetype)cellWithTableView:(UITableView *)tableView{
static NSString* cellId = @"QXRoomChatListSystemCell";
QXRoomChatListSystemCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
if (!cell) {
cell = [[QXRoomChatListSystemCell alloc] initWithStyle:(UITableViewCellStyleDefault) reuseIdentifier:cellId];
}
return cell;
}
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
self.contentView.backgroundColor = [UIColor clearColor];
self.backgroundColor = [UIColor clearColor];
self.selectionStyle = UITableViewCellSelectionStyleNone;
[self initSubviews];
}
return self;
}
-(void)setMessage:(QXRoomChatListModel *)message{
_message = message;
// NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:message.text];
// if ([message.FromUserInfo.nickname isExist]) {
// [attr yy_setColor:RGB16(0xFFE309) range:[message.text rangeOfString:message.FromUserInfo.nickname]];
// }
// if ([message.ToUserInfo.nickname isExist]) {
// [attr yy_setColor:RGB16(0xFFE309) range:[message.text rangeOfString:message.ToUserInfo.nickname]];
// }
//// self.titleLabel.text = message.text;
// self.titleLabel.attributedText = attr;
NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:message.text];
if ([message.FromUserInfo.nickname isExist]) {
[attr yy_setColor:messageNameColor range:[message.text rangeOfString:message.FromUserInfo.nickname]];
}
if ([message.ToUserInfo.nickname isExist]) {
[attr yy_setColor:messageNameColor range:[message.text rangeOfString:message.ToUserInfo.nickname]];
}
if ([message.GiftInfo.gift_name isExist]) {
NSArray *arr = [message.GiftInfo.gift_name componentsSeparatedByString:@","];
for (NSString*gift_name in arr) {
NSArray<NSValue *> *occurrences = findAllOccurrencesOfString(message.text, gift_name);
for (NSValue *rangeValue in occurrences) {
NSRange range = [rangeValue rangeValue];
[attr yy_setColor:messageGiftColor range:range];
}
}
}
if (message.GiftInfos.count > 0) {
for (QXGiftModel*gift in message.GiftInfos) {
if ([gift.gift_name isExist]) {
[attr yy_setColor:messageGiftColor range:[message.text rangeOfString:gift.gift_name]];
}
}
}
if (message.ToUserInfos.count > 0) {
for (int i = 0; i < message.ToUserInfos.count; i++) {
QXUserHomeModel*md = message.ToUserInfos[i];
NSArray<NSValue *> *occurrences = findAllOccurrencesOfString(message.text, md.nickname);
for (NSValue *rangeValue in occurrences) {
NSRange range = [rangeValue rangeValue];
[attr yy_setColor:messageNameColor range:range];
}
}
}
self.titleLabel.attributedText = attr;
}
-(void)initSubviews{
self.bgView = [[UIView alloc] init];
self.bgView.backgroundColor = RGB16A(0xFFFFFF, 0.2);
[self.bgView addRoundedCornersWithRadius:6];
[self.contentView addSubview:self.bgView];
[self.bgView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(16);
make.right.mas_lessThanOrEqualTo(-8);
make.top.mas_equalTo(6);
make.bottom.mas_equalTo(-6);
}];
self.titleLabel = [[UILabel alloc] init];
// self.titleLabel.textColor = RGB16(0XD1A9FE);
self.titleLabel.textColor = UIColor.whiteColor;
self.titleLabel.font = [UIFont systemFontOfSize:14];
self.titleLabel.numberOfLines = 0;
[self.bgView addSubview:self.titleLabel];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.bgView).offset(8);
make.top.mas_equalTo(8);
make.bottom.mas_equalTo(-8);
make.right.mas_equalTo(-8);
}];
}
@end
@implementation QXRoomChatListModel
+(NSDictionary<NSString *,id> *)modelContainerPropertyGenericClass{
return @{
@"GiftInfo" : @"QXGiftModel",
@"GiftInfos" : @"QXGiftModel",
@"FromUserInfo":@"QXUserHomeModel",
@"nextInfo":@"QXSongListModel",
@"songInfo":@"QXSongListModel",
@"ToUserInfo":@"QXUserHomeModel",
@"ToUserInfos":@"QXUserHomeModel",
@"friend_user":@"QXRoomFriendRelationModel"
};
}
@end

View File

@@ -0,0 +1,16 @@
//
// QXRoomNoticeView.h
// QXLive
//
// Created by 启星 on 2025/6/9.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface QXRoomNoticeView : UIView
@property (nonatomic,strong)NSString *roomNotice;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,84 @@
//
// QXRoomNoticeView.m
// QXLive
//
// Created by on 2025/6/9.
//
#import "QXRoomNoticeView.h"
@interface QXRoomNoticeView()
@property (nonatomic,strong)UILabel *titleLabel;
@property (nonatomic,strong)UILabel *messageLabel;
@property (nonatomic,strong)UIScrollView *scrollView;
@property (nonatomic,strong)UIButton *closeBtn;
@end
@implementation QXRoomNoticeView
- (instancetype)init
{
self = [super init];
if (self) {
self.frame = CGRectMake(0, 0, ScaleWidth(300), ScaleWidth(200));
[self initSubviews];
}
return self;
}
-(void)initSubviews{
self.backgroundColor = [UIColor whiteColor];
[self addRoundedCornersWithRadius:16];
self.titleLabel = [[UILabel alloc] init];
self.titleLabel.textColor = QXConfig.textColor;
self.titleLabel.font = [UIFont boldSystemFontOfSize:16];
[self addSubview:self.titleLabel];
self.titleLabel.text = QXText(@"房间公告");
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(12);
make.centerX.equalTo(self);
make.height.mas_equalTo(24);
}];
self.closeBtn = [[UIButton alloc] init];
[self.closeBtn setImage:[UIImage imageNamed:@"wallet_close"] forState:(UIControlStateNormal)];
[self.closeBtn addTarget:self action:@selector(closeAction) forControlEvents:(UIControlEventTouchUpInside)];
[self addSubview:self.closeBtn];
[self.closeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(5);
make.centerY.equalTo(self.titleLabel);;
make.width.height.mas_equalTo(45);
}];
self.scrollView = [[UIScrollView alloc] init];
[self addSubview:self.scrollView];
[self.scrollView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(16);
make.right.mas_equalTo(-16);
make.bottom.mas_equalTo(-16);
make.top.equalTo(self.titleLabel.mas_bottom).offset(16);
}];
self.messageLabel = [[UILabel alloc] init];
self.messageLabel.textColor = RGB16(0x666666);
self.messageLabel.numberOfLines = 0;
self.messageLabel.font = [UIFont boldSystemFontOfSize:14];
[self.scrollView addSubview:self.messageLabel];
[self.messageLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.bottom.equalTo(self.scrollView);
make.width.equalTo(self.scrollView);
make.centerX.equalTo(self.scrollView);
}];
}
-(void)setRoomNotice:(NSString *)roomNotice{
_roomNotice = roomNotice;
// CGFloat height = [roomNotice heightForFont:[UIFont systemFontOfSize:14] width:ScaleWidth(300)-12];
// self.scrollView.contentSize = CGSizeMake(ScaleWidth(300)-32, height);
// self.scrollView.contentOffset = CGPointMake(0, 0);
self.messageLabel.text = roomNotice;
}
-(void)closeAction{
[[QXGlobal shareGlobal] hideViewBlock:^{
}];
}
@end

View File

@@ -0,0 +1,26 @@
//
// QXRoomOnlineUserListView.h
// QXLive
//
// Created by 启星 on 2025/6/9.
//
#import <UIKit/UIKit.h>
#import "QXRoomSeatDelegate.h"
NS_ASSUME_NONNULL_BEGIN
@interface QXRoomOnlineUserListView : UIView
@property (nonatomic,weak)id<QXRoomSeatDelegate>delegate;
@property (nonatomic,strong)NSString *roomId;
/// 是否为抱麦
@property (nonatomic,assign)BOOL isHugSeat;
@property (nonatomic,strong)NSString *pitNumber;
@property (nonatomic,copy)void(^onlineListBlock)(NSArray*onlineUsers);
-(void)showInView:(UIView *)view;
-(void)hide;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,188 @@
//
// QXRoomOnlineUserListView.m
// QXLive
//
// Created by on 2025/6/9.
//
#import "QXRoomOnlineUserListView.h"
#import "QXBlackListCell.h"
#import "QXMineNetwork.h"
@interface QXRoomOnlineUserListView()<UITableViewDataSource,UITableViewDelegate,UIGestureRecognizerDelegate,QXBlackListCellDelegate>
@property (nonatomic,strong)UILabel *titleLabel;
@property (nonatomic,strong)UITableView *tableView;
@property (nonatomic,strong)UIView *bgView;
@property (nonatomic,strong)NSMutableArray *dataArray;
@property (nonatomic,strong)NSMutableArray *allUsers;;
@end
@implementation QXRoomOnlineUserListView
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self initSubviews];
}
return self;
}
-(void)initSubviews{
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hide)];
tap.delegate = self;
[self addGestureRecognizer:tap];
self.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.3];
self.bgView = [[UIView alloc] initWithFrame:CGRectMake(0, ScaleWidth(144), SCREEN_WIDTH, ScaleWidth(429)+kSafeAreaBottom)];
self.bgView.backgroundColor = UIColor.whiteColor;
[self.bgView addRoundedCornersWithRadius:16 byRoundingCorners:(UIRectCornerTopLeft|UIRectCornerTopRight)];
[self addSubview:self.bgView];
self.titleLabel = [[UILabel alloc] init];
self.titleLabel.textAlignment = NSTextAlignmentCenter;
self.titleLabel.text = [NSString localizedStringWithFormat:QXText(@"在线用户(%@人)"),@"0"];
self.titleLabel.textColor = QXConfig.textColor;
self.titleLabel.font = [UIFont boldSystemFontOfSize:16];
[self.bgView addSubview:self.titleLabel];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(27);
make.left.right.equalTo(self.bgView);
make.height.mas_equalTo(24);
}];
self.tableView = [[UITableView alloc] initWithFrame:CGRectZero style:(UITableViewStylePlain)];
self.tableView.delegate = self;
self.tableView.dataSource = self;
self.tableView.rowHeight = 60;
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
MJWeakSelf
self.tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
[weakSelf getOnlineList];
}];
[self.bgView addSubview:self.tableView];
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.titleLabel.mas_bottom).offset(12);
make.bottom.equalTo(self.bgView);
make.left.right.equalTo(self.bgView);
}];
}
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{
return touch.view == self;
}
-(void)didHugSeatWithModel:(QXRoomUserInfoModel *)model isUpSeat:(BOOL)isUpSeat{
if (isUpSeat) {
return;
}
MJWeakSelf
[QXMineNetwork roomCompereApplyPitWithRoomId:self.roomId pit_number:self.pitNumber user_id:model.user_id type:@"1" successBlock:^(NSDictionary * _Nonnull dict) {
[weakSelf hide];
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
showToast(msg);
}];
}
-(void)getOnlineList{
MJWeakSelf
[QXMineNetwork roomOnlineListWithRoomId:self.roomId page:0 successBlock:^(NSArray<QXRoomUserInfoModel *> * _Nonnull onPitList, NSArray<QXRoomUserInfoModel *> * _Nonnull offPitList) {
[weakSelf.dataArray removeAllObjects];
[weakSelf.allUsers removeAllObjects];
[weakSelf.dataArray addObject:onPitList];
[weakSelf.dataArray addObject:offPitList];
[weakSelf.allUsers addObjectsFromArray:onPitList];
[weakSelf.allUsers addObjectsFromArray:offPitList];
weakSelf.titleLabel.text = [NSString localizedStringWithFormat:QXText(@"在线用户(%@人)"),[NSString stringWithFormat:@"%ld",onPitList.count+offPitList.count]];
[weakSelf.tableView.mj_header endRefreshing];
[weakSelf.tableView reloadData];
if (weakSelf.onlineListBlock) {
weakSelf.onlineListBlock(weakSelf.allUsers);
}
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
[weakSelf.tableView.mj_header endRefreshing];
}];
}
-(void)setRoomId:(NSString *)roomId{
_roomId = roomId;
[self getOnlineList];
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
return self.dataArray.count;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
NSMutableArray *arr = self.dataArray[section];
return arr.count;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
QXBlackListCell *cell = [QXBlackListCell cellWithTableView:tableView];
if (self.isHugSeat) {
cell.cellType = QXBlackListCellTypeHugSeat;
}else{
cell.cellType = QXBlackListCellTypeOnline;
}
if (indexPath.section == 0) {
cell.isUpSeat = YES;
}else{
cell.isUpSeat = NO;
}
NSMutableArray *arr = self.dataArray[indexPath.section];
cell.onlineUser = arr[indexPath.row];
cell.delegate = self;
return cell;
}
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
UIView *header = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 30)];
header.backgroundColor = [UIColor whiteColor];
UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, 0, SCREEN_WIDTH-32, 30)];
titleLabel.font = [UIFont systemFontOfSize:14];
titleLabel.textColor = RGB16(0x666666);
[header addSubview:titleLabel];
if (section == 0) {
titleLabel.text = @"麦上用户";
}else{
titleLabel.text = @"麦下用户";
}
return header;
}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
return 30;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
[tableView deselectRowAtIndexPath:indexPath animated:YES];
NSMutableArray *arr = self.dataArray[indexPath.section];
QXRoomUserInfoModel*user = arr[indexPath.row];
if (self.delegate && [self.delegate respondsToSelector:@selector(previewUserInfoWithUserId:)]) {
[self.delegate previewUserInfoWithUserId:user.user_id];
}
}
-(void)showInView:(UIView *)view{
self.bgView.y = SCREEN_HEIGHT;
[view addSubview:self];
[UIView animateWithDuration:0.3 animations:^{
self.bgView.y = SCREEN_HEIGHT-ScaleWidth(429)-kSafeAreaBottom;
}];
}
-(void)hide{
[UIView animateWithDuration:0.3 animations:^{
self.bgView.y = SCREEN_HEIGHT;
} completion:^(BOOL finished) {
[self removeFromSuperview];
}];
}
-(NSMutableArray *)dataArray{
if (!_dataArray) {
_dataArray = [NSMutableArray array];
}
return _dataArray;
}
-(NSMutableArray *)allUsers{
if (!_allUsers) {
_allUsers = [NSMutableArray array];
}
return _allUsers;
}
@end

View File

@@ -0,0 +1,43 @@
//
// QXRoomSeatSettingView.h
// QXLive
//
// Created by 启星 on 2025/6/23.
//
#import <UIKit/UIKit.h>
#import "QXRoomModel.h"
typedef NS_ENUM(NSInteger) {
/// 闭麦
QXRoomSeatSettingMuteMic = 0,
/// 锁麦
QXRoomSeatSettingLockMic,
/// 抱麦
QXRoomSeatSettingHugMic
}QXRoomSeatSettingType;
NS_ASSUME_NONNULL_BEGIN
@interface QXRoomSeatSettingView : UIView
@property (nonatomic,assign)BOOL isNoHaveLockMic;
//@property (nonatomic,assign)BOOL isMuteMic;
@property (nonatomic,strong) QXRoomPitModel *pitModel;
@property (nonatomic,strong) NSString *roomId;
@property (nonatomic,copy)void (^setSuccessBlock)(QXRoomPitModel *pitModel);
@property (nonatomic,copy)void (^clickHugBlock)(QXRoomPitModel *pitModel);
-(void)showInView:(UIView *)view;
-(void)hide;
@end
@interface QXRoomSeatSettingCell : UITableViewCell
@property (nonatomic,strong)UILabel *titleLabel;
@property (nonatomic,strong)UISwitch *eventSwitch;
@property (nonatomic,assign)BOOL isOn;
@property (nonatomic,assign)QXRoomSeatSettingType settingType;
@property (nonatomic,strong) QXRoomPitModel *pitModel;
@property (nonatomic,strong) NSString *roomId;
@property (nonatomic,copy)void (^setSuccessBlock)(QXRoomPitModel *pitModel);
+(instancetype)cellWithTableView:(UITableView*)tableView;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,239 @@
//
// QXRoomSeatSettingView.m
// QXLive
//
// Created by on 2025/6/23.
//
#import "QXRoomSeatSettingView.h"
#import "QXMineNetwork.h"
@interface QXRoomSeatSettingView()<UIGestureRecognizerDelegate,UITableViewDelegate,UITableViewDataSource>
@property (nonatomic,strong)UITableView *tableView;
@property (nonatomic,strong)UIView *bgView;
@end
@implementation QXRoomSeatSettingView
- (instancetype)init
{
self = [super init];
if (self) {
self.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
[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.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.3];
// ScaleWidth(126)
self.bgView = [[UIView alloc] initWithFrame:CGRectMake((SCREEN_WIDTH-ScaleWidth(172))/2.0, (SCREEN_HEIGHT - ScaleWidth(126))/2.0, ScaleWidth(172), ScaleWidth(84))];
self.bgView.backgroundColor = UIColor.whiteColor;
[self.bgView addRoundedCornersWithRadius:16];
[self addSubview:self.bgView];
self.tableView = [[UITableView alloc] initWithFrame:self.bgView.bounds style:(UITableViewStyleGrouped)];
self.tableView.backgroundColor = [UIColor clearColor];
self.tableView.dataSource = self;
self.tableView.delegate = self;
self.tableView.rowHeight =ScaleWidth(84)/2;
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
[self.bgView addSubview:self.tableView];
}
-(void)setPitModel:(QXRoomPitModel *)pitModel{
_pitModel = pitModel;
[self.tableView reloadData];
}
-(void)setIsNoHaveLockMic:(BOOL)isNoHaveLockMic{
_isNoHaveLockMic = isNoHaveLockMic;
self.bgView.height = ScaleWidth(42);
self.tableView.height = ScaleWidth(42);
[self.tableView reloadData];
}
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{
return touch.view == self;
}
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
return [UIView new];;
}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
return 0.01;
}
-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
return [UIView new];;
}
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
return 0.01;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
// return 3;
if (self.isNoHaveLockMic) {
return 1;
}
return 2;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
QXRoomSeatSettingCell *cell = [QXRoomSeatSettingCell cellWithTableView:tableView];
cell.roomId = self.roomId;
cell.pitModel = self.pitModel;
if (self.isNoHaveLockMic) {
cell.settingType = QXRoomSeatSettingHugMic;
}else{
if (indexPath.row == 0) {
// cell.isOn = self.pitModel.is_mute.intValue == 1;
// cell.settingType = QXRoomSeatSettingMuteMic;
cell.isOn = self.pitModel.is_lock.intValue == 1;
cell.settingType = QXRoomSeatSettingLockMic;
}
// else if(indexPath.row == 1){
// cell.isOn = self.pitModel.is_lock.intValue == 1;
// cell.settingType = QXRoomSeatSettingLockMic;
// }
else{
cell.settingType = QXRoomSeatSettingHugMic;
}
}
MJWeakSelf
cell.setSuccessBlock = ^(QXRoomPitModel * _Nonnull pitModel) {
weakSelf.setSuccessBlock(pitModel);
};
return cell;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
if (self.isNoHaveLockMic) {
[self hide];
if (self.clickHugBlock) {
self.clickHugBlock(self.pitModel);
}
return;
}
if (indexPath.row == 1) {
[self hide];
if (self.clickHugBlock) {
self.clickHugBlock(self.pitModel);
}
}
}
-(void)showInView:(UIView *)view{
self.bgView.alpha = 0;
[view addSubview:self];
[UIView animateWithDuration:0.15 animations:^{
self.bgView.alpha = 1;
}];
}
-(void)hide{
[UIView animateWithDuration:0.15 animations:^{
self.bgView.alpha = 0;
} completion:^(BOOL finished) {
[self removeFromSuperview];
}];
}
@end
@implementation QXRoomSeatSettingCell
+ (instancetype)cellWithTableView:(UITableView *)tableView{
static NSString *cellId = @"QXRoomSeatSettingCell";
QXRoomSeatSettingCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
if (!cell) {
cell = [[QXRoomSeatSettingCell alloc] initWithStyle:(UITableViewCellStyleDefault) reuseIdentifier:cellId];
}
return cell;
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
[self initSubViews];
self.backgroundColor = UIColor.clearColor;
self.contentView.backgroundColor = UIColor.clearColor;
self.selectionStyle = UITableViewCellSelectionStyleNone;
}
return self;
}
-(void)initSubViews{
self.titleLabel = [[UILabel alloc] init];
self.titleLabel.textColor = QXConfig.textColor;
self.titleLabel.font = [UIFont systemFontOfSize:14];
[self.contentView addSubview:self.titleLabel];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(12);
make.size.mas_equalTo(CGSizeMake(60, 21));
make.centerY.equalTo(self.contentView);
}];
self.eventSwitch = [[UISwitch alloc] init];
self.eventSwitch.backgroundColor = RGB16A(0xffffff, 0.2);
[self.eventSwitch addRoundedCornersWithRadius:12.5];
self.eventSwitch.onTintColor = QXConfig.themeColor;
self.eventSwitch.thumbTintColor = [UIColor whiteColor];
[self.eventSwitch addTarget:self action:@selector(eventSwitch:) forControlEvents:(UIControlEventValueChanged)];
[self.contentView addSubview:self.eventSwitch];
[self.eventSwitch mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(-12);
make.centerY.equalTo(self.contentView);
}];
}
-(void)setIsOn:(BOOL)isOn{
_isOn = isOn;
[self.eventSwitch setOn:isOn animated:YES];
}
-(void)setSettingType:(QXRoomSeatSettingType)settingType{
_settingType = settingType;
switch (settingType) {
case QXRoomSeatSettingMuteMic:{
self.eventSwitch.hidden = NO;
self.titleLabel.text = @"禁麦";
}
break;
case QXRoomSeatSettingLockMic:{
self.eventSwitch.hidden = NO;
self.titleLabel.text = @"锁麦";
}
break;
case QXRoomSeatSettingHugMic:{
self.eventSwitch.hidden = YES;
self.titleLabel.text = @"抱麦";
}
break;
default:
break;
}
}
-(void)eventSwitch:(UISwitch*)sender{
BOOL isLock = NO;
if (self.settingType == QXRoomSeatSettingMuteMic || self.settingType == QXRoomSeatSettingHugMic) {
isLock = NO;
}else{
isLock = YES;
}
MJWeakSelf
BOOL isOn = sender.isOn;
[QXMineNetwork roomPitLockOrMuteIsLock:isLock roomId:self.roomId pit_number:self.pitModel.pit_number.integerValue is_mute:isOn successBlock:^(NSDictionary * _Nonnull dict) {
if (isOn) {
[sender setOn:YES animated:YES];
}else{
[sender setOn:NO animated:YES];
}
if (isLock) {
weakSelf.pitModel.is_lock = isOn?@"1":@"0";
}else{
weakSelf.pitModel.is_mute = isOn?@"1":@"0";
}
if (weakSelf.setSuccessBlock) {
weakSelf.setSuccessBlock(weakSelf.pitModel);
}
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
[self.eventSwitch setOn:self.isOn animated:YES];
}];
}
@end

View File

@@ -0,0 +1,26 @@
//
// QXRoomTitleView.h
// QXLive
//
// Created by 启星 on 2025/6/7.
//
#import <UIKit/UIKit.h>
#import "QXRoomModel.h"
#import "QXRoomSeatDelegate.h"
NS_ASSUME_NONNULL_BEGIN
@interface QXRoomTitleView : UIView
@property (nonatomic,strong)NSArray *onlineUsers;
@property (nonatomic,strong)NSString *roomId;
@property (nonatomic,strong)QXRoomModel* roomModel;
@property (nonatomic,assign)BOOL isCompere;
@property (nonatomic,weak)id<QXRoomSeatDelegate>delegate;
-(void)setRoomCollect:(BOOL)isCollect;
-(void)onlineNumberIsAdd:(BOOL)isAdd;
-(void)setOnlineNumber:(NSString*)onlineNumber;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,435 @@
//
// QXRoomTitleView.m
// QXLive
//
// Created by on 2025/6/7.
//
#import "QXRoomTitleView.h"
#import "QXRoomOnlineUserListView.h"
#import "QXRoomNoticeView.h"
#import "QXRoomRankView.h"
#import "QXGiftPlayerManager.h"
#import "QXAgoraEngine.h"
#import "QXRoomMessageManager.h"
#import "QXMineNetwork.h"
#import "QXDynamicNetwork.h"
@interface QXRoomTitleView()<QXRoomSeatDelegate>
///
@property (nonatomic,strong) UIView *leftBgView;
///
@property (nonatomic,strong) UIImageView *roomImageView;
///
@property (nonatomic,strong) UILabel * nameLabel;
/// id
@property (nonatomic,strong) UILabel * IdLabel;
///
@property (nonatomic,strong) UIButton *followBtn;
/// 退
@property (nonatomic,strong) UIButton *closeBtn;
@property (nonatomic,strong) UILabel *countLabel;
@property (nonatomic,strong) UIView *onLineBgView;
@property (nonatomic,strong) NSMutableArray *onlineHeaderViewArray;
///
@property (nonatomic,strong) UIButton *rankBtn;
///
@property (nonatomic,strong) UIButton *noticeBtn;
///
@property (nonatomic,strong)UIButton *clearCharmBtn;
@property (nonatomic,strong) QXRoomOnlineUserListView *onlineListView;
@property (nonatomic,strong) QXRoomNoticeView *noticeView;
@property (nonatomic,strong)QXRoomRankView *rankView;
@end
@implementation QXRoomTitleView
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self initSubviews];
}
return self;
}
-(void)initSubviews{
self.leftBgView = [[UIView alloc] init];
self.leftBgView.backgroundColor = RGB16A(0xFFFFFF,0.2);
[self.leftBgView addRoundedCornersWithRadius:ScaleWidth(20)];
[self addSubview:self.leftBgView];
[self.leftBgView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(16);
make.width.mas_equalTo(ScaleWidth(168));
make.height.mas_equalTo(ScaleWidth(40));
make.top.equalTo(self);
}];
self.roomImageView = [[UIImageView alloc] init];
self.roomImageView.contentMode = UIViewContentModeScaleAspectFill;
[self.leftBgView addSubview:self.roomImageView];
[self.roomImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.left.mas_equalTo(7);
make.bottom.mas_equalTo(-7);
make.width.equalTo(self.roomImageView.mas_height);
}];
self.followBtn = [[UIButton alloc] init];
[self.followBtn setTitle:QXText(@"收藏") forState:(UIControlStateNormal)];
[self.followBtn setTitle:QXText(@"已收藏") forState:(UIControlStateSelected)];
[self.followBtn addRoundedCornersWithRadius:ScaleWidth(12)];
[self.followBtn addTarget:self action:@selector(followAction:) forControlEvents:(UIControlEventTouchUpInside)];
[self.followBtn setTitleColor:QXConfig.btnTextColor forState:(UIControlStateNormal)];
[self.followBtn setTitleColor:RGB16(0x999999) forState:(UIControlStateSelected)];
[self.followBtn setBackgroundImage:[UIImage imageWithColor:QXConfig.themeColor] forState:UIControlStateNormal];
[self.followBtn setBackgroundImage:[UIImage imageWithColor:RGB16(0xF1F2F3)] forState:UIControlStateSelected];
self.followBtn.titleLabel.font = [UIFont systemFontOfSize:12];
[self.leftBgView addSubview:self.followBtn];
[self.followBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(-7);
make.size.mas_equalTo(CGSizeMake(ScaleWidth(46), ScaleWidth(24)));
make.centerY.equalTo(self.leftBgView);
}];
self.nameLabel = [[UILabel alloc] init];
self.nameLabel.text = @"房间名称";
self.nameLabel.font = [UIFont systemFontOfSize:12];
self.nameLabel.textColor = [UIColor whiteColor];
[self.leftBgView addSubview:self.nameLabel];
[self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(3);
make.left.equalTo(self.roomImageView.mas_right).offset(4);
make.height.mas_equalTo(ScaleWidth(15));
make.right.equalTo(self.followBtn.mas_left).offset(-10);
}];
self.IdLabel = [[UILabel alloc] init];
self.IdLabel.text = @"ID:0000001";
self.IdLabel.font = [UIFont systemFontOfSize:12];
self.IdLabel.textColor = [UIColor whiteColor];
[self.leftBgView addSubview:self.IdLabel];
[self.IdLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.mas_equalTo(-3);
make.left.equalTo(self.nameLabel);
make.height.mas_equalTo(ScaleWidth(18));
make.right.equalTo(self.nameLabel);
}];
self.closeBtn = [[UIButton alloc] init];
[self.closeBtn addTarget:self action:@selector(closeAction) forControlEvents:(UIControlEventTouchUpInside)];
[self.closeBtn setImage:[UIImage imageNamed:@"room_close"] forState:(UIControlStateNormal)];
[self addSubview:self.closeBtn];
[self.closeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.height.mas_equalTo(ScaleWidth(40));
make.right.mas_equalTo(-5);
make.centerY.equalTo(self.leftBgView);
}];
self.countLabel = [[UILabel alloc] init];
self.countLabel.textColor = [UIColor whiteColor];
self.countLabel.font = [UIFont systemFontOfSize:12];
[self addSubview:self.countLabel];
[self.countLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(ScaleWidth(40));
make.right.equalTo(self.closeBtn.mas_left).offset(-5);
make.centerY.equalTo(self.leftBgView);
}];
MJWeakSelf
self.onLineBgView = [[UIView alloc] init];
[self.onLineBgView addTapBlock:^(id _Nonnull obj) {
[weakSelf showOnlineList];
}];
[self addSubview:self.onLineBgView];
[self.onLineBgView mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.countLabel.mas_left).offset(-5);
make.left.equalTo(self.leftBgView.mas_right);
make.height.equalTo(self.leftBgView);
make.top.equalTo(self.leftBgView);
}];
self.rankBtn = [[UIButton alloc] init];
[self.rankBtn setTitle:[NSString stringWithFormat:@" %@",QXText(@"排行榜")] forState:(UIControlStateNormal)];
self.rankBtn.titleLabel.font = [UIFont systemFontOfSize:12];
[self.rankBtn setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)];
[self.rankBtn addTarget:self action:@selector(rankAction) forControlEvents:(UIControlEventTouchUpInside)];
[self.rankBtn setImage:[UIImage imageNamed:@"room_rank_icon"] forState:(UIControlStateNormal)];
self.rankBtn.backgroundColor = RGB16A(0xFFFFFF,0.2);
[self.rankBtn addRoundedCornersWithRadius:ScaleWidth(11)];
[self addSubview:self.rankBtn];
[self.rankBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(ScaleWidth(70));
make.height.mas_equalTo(ScaleWidth(22));
make.left.mas_equalTo(16);
make.top.equalTo(self.leftBgView.mas_bottom).offset(12);
}];
self.noticeBtn = [[UIButton alloc] init];
[self.noticeBtn setTitle:[NSString stringWithFormat:@" %@",QXText(@"公告")] forState:(UIControlStateNormal)];
self.noticeBtn.titleLabel.font = [UIFont systemFontOfSize:12];
[self.noticeBtn setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)];
[self.noticeBtn addTarget:self action:@selector(noticeAction) forControlEvents:(UIControlEventTouchUpInside)];
[self.noticeBtn setImage:[UIImage imageNamed:@"room_notice_icon"] forState:(UIControlStateNormal)];
self.noticeBtn.backgroundColor = RGB16A(0xFFFFFF,0.2);
[self.noticeBtn addRoundedCornersWithRadius:ScaleWidth(11)];
[self addSubview:self.noticeBtn];
[self.noticeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(ScaleWidth(58));
make.height.mas_equalTo(ScaleWidth(22));
make.left.equalTo(self.rankBtn.mas_right).offset(12);
make.top.equalTo(self.leftBgView.mas_bottom).offset(12);
}];
self.clearCharmBtn = [[UIButton alloc] init];
self.clearCharmBtn.hidden = YES;
[self.clearCharmBtn setTitle:[NSString stringWithFormat:@" %@",QXText(@"清除魅力")] forState:(UIControlStateNormal)];
self.clearCharmBtn.titleLabel.font = [UIFont systemFontOfSize:12];
[self.clearCharmBtn setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)];
[self.clearCharmBtn addTarget:self action:@selector(clearAction) forControlEvents:(UIControlEventTouchUpInside)];
[self.clearCharmBtn setImage:[UIImage imageNamed:@"room_clear_charm"] forState:(UIControlStateNormal)];
self.clearCharmBtn.backgroundColor = RGB16A(0xFFFFFF,0.2);
[self.clearCharmBtn addRoundedCornersWithRadius:ScaleWidth(11)];
[self addSubview:self.clearCharmBtn];
[self.clearCharmBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(ScaleWidth(78));
make.height.mas_equalTo(ScaleWidth(22));
make.left.equalTo(self.noticeBtn.mas_right).offset(12);
make.top.equalTo(self.leftBgView.mas_bottom).offset(12);
}];
}
-(UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event{
UIView *hitView= [super hitTest:point withEvent:event];
if (hitView== self)
{
return nil;
}
else
{
return hitView;
}
}
-(void)setIsCompere:(BOOL)isCompere{
_isCompere = isCompere;
self.clearCharmBtn.hidden = !isCompere;
}
-(void)layoutSubviews{
[super layoutSubviews];
[self.roomImageView addRoundedCornersWithRadius:ScaleWidth(40-14)/2];
}
- (void)setRoomModel:(QXRoomModel *)roomModel{
_roomModel = roomModel;
[self.roomImageView sd_setImageWithURL:[NSURL URLWithString:roomModel.room_info.room_cover]];
self.nameLabel.text = roomModel.room_info.room_name;
self.IdLabel.text = [NSString stringWithFormat:@"ID:%@",roomModel.room_info.room_number];
if (roomModel.user_info.is_collect.intValue == 1) {
self.followBtn.selected = YES;
}else{
self.followBtn.selected = NO;
}
self.countLabel.text = roomModel.room_info.online_number?roomModel.room_info.online_number:@"0";
}
-(void)setOnlineUsers:(NSArray *)onlineUsers{
_onlineUsers = onlineUsers;
[self.onLineBgView removeAllSubviews];
[self.onlineHeaderViewArray removeAllObjects];
QXRoomUserInfoModel *md;
CGFloat imageWidth = 18;
CGFloat margin = 5;
int count = 0;
for (QXRoomUserInfoModel *md in onlineUsers) {
count++;
if (count<4) {
UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"user_header_placehoulder"]];
imageView.contentMode = UIViewContentModeScaleAspectFill;
[imageView addRoundedCornersWithRadius:imageWidth/2];
[self.onLineBgView addSubview:imageView];
[imageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(-(imageWidth-margin)*count);
make.height.width.mas_equalTo(imageWidth);
make.centerY.equalTo(self.onLineBgView);
}];
if (md) {
[imageView sd_setImageWithURL:[NSURL URLWithString:md.avatar]];
}
[self.onlineHeaderViewArray addObject:imageView];
}else{
break;;
}
}
// for (int i = 0; i < 3; i++) {
// if (onlineUsers.count >= 3) {
// md = onlineUsers[i];
// }else if (onlineUsers.count == 2) {
// if (i < 2) {
// md = onlineUsers[i];
// }
// }else if (onlineUsers.count == 1) {
// if (i < 1) {
// md = onlineUsers[i];
// }
// }
//
// }
}
-(void)clearAction{
[QXMineNetwork roomClearCharmWithRoomId:self.roomModel.room_info.room_id userId:@"" successBlock:^(NSDictionary * _Nonnull dict) {
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
showToast(msg);
}];
}
-(void)previewUserInfoWithUserId:(NSString *)userId{
[self.onlineListView hide];
[self.rankView hide];
_onlineListView = nil;
_rankView = nil;
if (self.delegate && [self.delegate respondsToSelector:@selector(previewUserInfoWithUserId:)]) {
[self.delegate previewUserInfoWithUserId:userId];
}
}
-(void)showOnlineList{
self.onlineListView.roomId = self.roomModel.room_info.room_id;
[self.onlineListView showInView:self.viewController.view];
}
-(QXRoomOnlineUserListView *)onlineListView{
if (!_onlineListView) {
_onlineListView = [[QXRoomOnlineUserListView alloc] initWithFrame:[UIScreen mainScreen].bounds];
_onlineListView.delegate = self;
MJWeakSelf
_onlineListView.onlineListBlock = ^(NSArray * _Nonnull onlineUsers) {
[weakSelf setOnlineUsers:onlineUsers];
weakSelf.countLabel.text = [NSString stringWithFormat:@"%ld",onlineUsers.count];
};
}
return _onlineListView;
}
-(QXRoomNoticeView *)noticeView{
if (!_noticeView) {
_noticeView = [[QXRoomNoticeView alloc] init];
}
return _noticeView;
}
-(QXRoomRankView *)rankView{
if (!_rankView) {
_rankView = [[QXRoomRankView alloc] initWithFrame:[UIScreen mainScreen].bounds];
_rankView.delegate = self;
}
return _rankView;
}
-(void)noticeAction{
// self.noticeView.roomNotice = @"本房间严禁刷屏,禁止非法广告及宣传,禁止引战,地域黑,语言攻击等本房间严禁刷屏,禁止非法广告及宣传,禁止引战,地域黑,语言攻击等本房间严禁刷屏,禁止非法广告及宣传。本房间严禁刷屏,禁止非法广告及宣传,禁止引战,地域黑,语言攻击等本房间严禁刷屏,禁止非法广告及宣传,禁止引战,地域黑,语言攻击等本房间严禁刷屏,禁止非法广告及宣传。";
self.noticeView.roomNotice = self.roomModel.room_info.room_intro;
[[QXGlobal shareGlobal] showView:self.noticeView controller:self.viewController popType:(PopViewTypePopFromCenter) tapDismiss:NO finishBlock:^{
}];
}
-(void)rankAction{
self.rankView.roomId = self.roomId;
[self.rankView showInView:self.viewController.view];
}
-(void)setRoomCollect:(BOOL)isCollect{
self.roomModel.user_info.is_collect = isCollect?@"1":@"0";
self.followBtn.selected = isCollect?YES:NO;
}
-(void)followAction:(UIButton*)sender{
MJWeakSelf
[QXDynamicNetwork followWithUserId:self.roomId type:@"2" successBlock:^(NSDictionary * _Nonnull dict) {
weakSelf.followBtn.selected = !weakSelf.followBtn.selected;
if (weakSelf.followBtn.selected) {
weakSelf.roomModel.user_info.is_collect = @"1";
}else{
weakSelf.roomModel.user_info.is_collect = @"0";
}
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
}];
}
-(void)onlineNumberIsAdd:(BOOL)isAdd{
NSInteger number = self.roomModel.room_info.online_number.integerValue;
if (isAdd) {
number+=1;
}else{
number-=1;
}
if (number <= 0) {
number = 0;
}
self.roomModel.room_info.online_number = [NSString stringWithFormat:@"%ld",number];
self.countLabel.text = self.roomModel.room_info.online_number;
}
-(void)setOnlineNumber:(NSString *)onlineNumber{
self.roomModel.room_info.online_number = onlineNumber;
self.countLabel.text = self.roomModel.room_info.online_number;
}
-(void)closeAction{
MJWeakSelf
UIAlertController *al = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:(UIAlertControllerStyleActionSheet)];
if (![self.roomModel.room_info.type_id isEqualToString:@"6"]) {
[al addAction:[UIAlertAction actionWithTitle:@"最小化房间" style:(UIAlertActionStyleDefault) handler:^(UIAlertAction * _Nonnull action) {
[weakSelf miniRoom];
[[QXGlobal shareGlobal] miniRoomWithRoomId:weakSelf.roomId roomCover:weakSelf.roomModel.room_info.room_cover];
}]];
}
[al addAction:[UIAlertAction actionWithTitle:@"退出房间" style:(UIAlertActionStyleDefault) handler:^(UIAlertAction * _Nonnull action) {
[weakSelf leaveRoom];
}]];
[al addAction:[UIAlertAction actionWithTitle:@"取消" style:(UIAlertActionStyleCancel) handler:^(UIAlertAction * _Nonnull action) {
}]];
[self.viewController presentViewController:al animated:YES completion:nil];
}
-(void)miniRoom{
// self.navigationController.interactivePopGestureRecognizer.enabled = YES;
[self.navigationController popViewControllerAnimated:YES];
}
-(void)leaveRoom{
if ([self.roomModel.room_info.type_id isEqualToString:@"6"] && [self.roomModel.room_info.label_id isEqualToString:@"5"]) {
[[QXGlobal shareGlobal]quitRoomWithRoomId:self.roomId];
NSMutableArray *viewControllers = [NSMutableArray arrayWithArray:self.navigationController.viewControllers];
for (int i = 0; i < viewControllers.count; i++) {
UIViewController *vc = [viewControllers objectAtIndex:i];
if ([vc isEqual:self.viewController]) {
QXRoomViewController *roomVc = [[QXRoomViewController alloc] init];
roomVc.roomId = QXGlobal.shareGlobal.superRoomId;
[viewControllers insertObject:roomVc atIndex:i];
break;
}
}
self.navigationController.viewControllers = viewControllers;
[self.navigationController popViewControllerAnimated:YES];
QXGlobal.shareGlobal.superRoomId = @"";
}else{
[[QXGlobal shareGlobal]quitRoomWithRoomId:self.roomId];
[self.navigationController popViewControllerAnimated:YES];
}
}
-(NSMutableArray *)onlineHeaderViewArray{
if (!_onlineHeaderViewArray) {
_onlineHeaderViewArray = [NSMutableArray array];
}
return _onlineHeaderViewArray;
}
@end

View File

@@ -0,0 +1,34 @@
//
// QXRoomUserCharmView.h
// QXLive
//
// Created by 启星 on 2025/9/8.
//
#import <UIKit/UIKit.h>
#import "QXRoomUserCharmModel.h"
#import "QXUserHomeHeaderView.h"
#import "QXRoomSeatDelegate.h"
NS_ASSUME_NONNULL_BEGIN
@interface QXRoomUserCharmView : UIView
@property (nonatomic,weak)id<QXRoomSeatDelegate>delegate;
@property (nonatomic,strong)NSString *roomId;
@property (nonatomic,strong)NSString *userId;
-(void)showInView:(UIView *)view;
-(void)hide;
@end
@interface QXRoomUserCharmCell : UITableViewCell<UICollectionViewDelegate,UICollectionViewDataSource>
+(instancetype)cellWithTableView:(UITableView*)tableView;
@property (nonatomic,strong)UIImageView *headImageView;
@property (nonatomic,strong)UILabel *nameLabel;
@property (nonatomic,strong)UILabel *IdLabel;
@property (nonatomic,strong)UICollectionView *collectionView;
@property (nonatomic,strong)UIImageView *charmIconView;
@property (nonatomic,strong)UILabel* charmLabel;
@property (nonatomic,strong)QXRoomUserCharmModel *model;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,232 @@
//
// QXRoomUserCharmView.m
// QXLive
//
// Created by on 2025/9/8.
//
#import "QXRoomUserCharmView.h"
#import "QXMineNetwork.h"
#import "NSString+QX.h"
@interface QXRoomUserCharmView()<UIGestureRecognizerDelegate,UITableViewDelegate,UITableViewDataSource>
@property (nonatomic,strong)UILabel *titleLabel;
@property (nonatomic,strong)UITableView *tableView;
@property (nonatomic,strong)UIView *bgView;
@property (nonatomic,strong)NSMutableArray *dataArray;
@end
@implementation QXRoomUserCharmView
- (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, ScaleWidth(429)+kSafeAreaBottom)];
self.bgView.backgroundColor = [UIColor whiteColor];
[self.bgView addRoundedCornersWithRadius:16 byRoundingCorners:(UIRectCornerTopLeft|UIRectCornerTopRight)];
[self addSubview:self.bgView];
self.titleLabel = [[UILabel alloc] init];
self.titleLabel.textAlignment = NSTextAlignmentCenter;
self.titleLabel.text = @"魅力值详情";
self.titleLabel.textColor = QXConfig.textColor;
self.titleLabel.font = [UIFont boldSystemFontOfSize:16];
[self.bgView addSubview:self.titleLabel];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(27);
make.left.right.equalTo(self.bgView);
make.height.mas_equalTo(24);
}];
self.tableView = [[UITableView alloc] initWithFrame:CGRectZero style:(UITableViewStylePlain)];
self.tableView.delegate = self;
self.tableView.dataSource = self;
self.tableView.rowHeight = 55;
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
MJWeakSelf
self.tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
[weakSelf getCharmList];
}];
[self.bgView addSubview:self.tableView];
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.titleLabel.mas_bottom).offset(12);
make.bottom.equalTo(self.bgView);
make.left.right.equalTo(self.bgView);
}];
}
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{
return touch.view == self;
}
-(void)setRoomId:(NSString *)roomId{
_roomId = roomId;
}
-(void)setUserId:(NSString *)userId{
_userId = userId;
[self getCharmList];
}
-(void)getCharmList{
MJWeakSelf
[QXMineNetwork getRoomUserCharmListWithRoomId:self.roomId userId:self.userId successBlock:^(NSArray * _Nonnull list) {
[weakSelf.dataArray removeAllObjects];
[weakSelf.dataArray addObjectsFromArray:list];
[weakSelf.tableView reloadData];
[weakSelf.tableView.mj_header endRefreshing];
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
[weakSelf.tableView.mj_header endRefreshing];
}];
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return self.dataArray.count;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
QXRoomUserCharmCell *cell = [QXRoomUserCharmCell cellWithTableView:tableView];
cell.model = self.dataArray[indexPath.row];
return cell;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
QXRoomUserCharmModel *model = self.dataArray[indexPath.row];
if (self.delegate && [self.delegate respondsToSelector:@selector(previewUserInfoWithUserId:)]) {
[self.delegate previewUserInfoWithUserId:model.user_id];
}
}
-(void)showInView:(UIView *)view{
[view addSubview:self];
[UIView animateWithDuration:0.3 animations:^{
self.bgView.y = SCREEN_HEIGHT-ScaleWidth(429)-kSafeAreaBottom;
}];
}
-(void)hide{
[UIView animateWithDuration:0.3 animations:^{
self.bgView.y = SCREEN_HEIGHT;
} completion:^(BOOL finished) {
[self removeFromSuperview];
}];
}
-(NSMutableArray *)dataArray{
if (!_dataArray) {
_dataArray = [NSMutableArray array];
}
return _dataArray;
}
@end
@implementation QXRoomUserCharmCell
+(instancetype)cellWithTableView:(UITableView*)tableView{
static NSString *cellId = @"QXRoomUserCharmCell";
QXRoomUserCharmCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
if (!cell) {
cell = [[QXRoomUserCharmCell alloc] initWithStyle:(UITableViewCellStyleDefault) reuseIdentifier:cellId];
cell.backgroundColor = [UIColor clearColor];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
}
return cell;
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
[self initSubviews];
}
return self;
}
-(void)setModel:(QXRoomUserCharmModel *)model{
_model = model;
self.nameLabel.text = model.nickname;
self.IdLabel.text= [NSString stringWithFormat:@"ID:%@",model.user_code];
[self.headImageView sd_setImageWithURL:[NSURL URLWithString:model.avatar] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]];
self.charmLabel.text = [NSString qx_showHotCountNumDouble:model.charm.longLongValue];
[self.collectionView reloadData];
}
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
return self.model.icon.count;
}
-(__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
QXTagImageCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"QXTagImageCell" forIndexPath:indexPath];
cell.imageUrl = self.model.icon[indexPath.row];
return cell;
}
-(void)initSubviews{
self.headImageView = [[UIImageView alloc] init];
self.headImageView.contentMode = UIViewContentModeScaleAspectFill;
self.headImageView.clipsToBounds = YES;
[self.headImageView addRoundedCornersWithRadius:ScaleWidth(21.5)];
[self.contentView addSubview:self.headImageView];
[self.headImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(16);
make.width.height.mas_equalTo(43);
make.centerY.equalTo(self.contentView);
}];
self.nameLabel = [[UILabel alloc] init];
self.nameLabel.textColor = RGB16(0x333333);
self.nameLabel.font = [UIFont systemFontOfSize:14];
[self.contentView addSubview:self.nameLabel];
[self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.headImageView.mas_right).offset(8);
make.top.equalTo(self.headImageView);
make.height.mas_equalTo(21);
}];
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
layout.itemSize = CGSizeMake(42, 16);
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 addSubview:self.collectionView];
[self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.nameLabel.mas_right).offset(8);
make.height.mas_equalTo(21);
make.centerY.equalTo(self.nameLabel);
make.width.mas_equalTo(126);
}];
self.IdLabel = [[UILabel alloc] init];
self.IdLabel.textColor = RGB16(0x999999);
self.IdLabel.font = [UIFont systemFontOfSize:12];
[self.contentView addSubview:self.IdLabel];
[self.IdLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.headImageView.mas_right).offset(8);
make.bottom.equalTo(self.headImageView);
make.height.mas_equalTo(18);
}];
self.charmLabel = [[UILabel alloc] init];
self.charmLabel.textColor = RGB16(0x333333);
self.charmLabel.font = [UIFont systemFontOfSize:14];
[self.contentView addSubview:self.charmLabel];
[self.charmLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(-16);
make.centerY.equalTo(self.contentView);
make.height.mas_equalTo(21);
}];
self.charmIconView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"room_user_charm_icon"]];
self.charmIconView.contentMode = UIViewContentModeScaleAspectFill;
[self.contentView addSubview:self.charmIconView];
[self.charmIconView mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.charmLabel.mas_left).offset(-6);
make.width.height.mas_equalTo(18);
make.centerY.equalTo(self.contentView);
}];
}
@end

View File

@@ -0,0 +1,18 @@
//
// QXSetApplyGiftView.h
// QXLive
//
// Created by 启星 on 2025/6/16.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface QXSetApplyGiftView : UIView
@property (nonatomic,strong)NSString*roomId;
@property (nonatomic,copy)void(^setScuseesBlock)(void);
-(void)showInView:(UIView *)view;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,164 @@
//
// QXSetApplyGiftView.m
// QXLive
//
// Created by on 2025/6/16.
//
#import "QXSetApplyGiftView.h"
#import "QXMineNetwork.h"
#import "QXGiftCell.h"
@interface QXSetApplyGiftView()<UICollectionViewDelegate,UICollectionViewDataSource,UIGestureRecognizerDelegate>
@property (nonatomic,strong)UIView *bgView;
@property (nonatomic,strong)UIImageView *bgImageView;
@property (nonatomic,strong)UICollectionView *collectionView;
@property (nonatomic,assign)NSInteger selectedIndex;
@property (nonatomic,strong)NSMutableArray *dataArray;
@property (nonatomic,strong)UILabel *titleLabel;
@property (nonatomic,strong)UIButton *cancelBtn;
@property (nonatomic,strong)UIButton *commitBtn;
@end
@implementation QXSetApplyGiftView
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self initSubviews];
}
return self;
}
-(void)initSubviews{
self.selectedIndex = -1;
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, ScaleWidth(456)+kSafeAreaBottom)];
[self addSubview:self.bgView];
self.bgImageView = [[UIImageView alloc] initWithFrame:self.bgView.bounds];
self.bgImageView.image = [UIImage imageNamed:@"room_sound_bg"];
[self.bgView addSubview:self.bgImageView];
self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, 16, 150, 24)];
self.titleLabel.textColor = UIColor.whiteColor;
self.titleLabel.font = [UIFont boldSystemFontOfSize:16];
self.titleLabel.text = QXText(@"设置插队礼物");
[self.bgView addSubview:self.titleLabel];
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
layout.itemSize = CGSizeMake((SCREEN_WIDTH-16*2-12*3)/4, ScaleWidth(119));
layout.minimumLineSpacing = 12;
layout.minimumInteritemSpacing = 12;
layout.sectionInset = UIEdgeInsetsMake(0, 16, 0, 16);
layout.scrollDirection = UICollectionViewScrollDirectionVertical;
self.collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, self.titleLabel.bottom+12, self.width, self.bgView.height-kSafeAreaBottom-42-self.titleLabel.bottom-12-10) collectionViewLayout:layout];
[self.collectionView registerNib:[UINib nibWithNibName:@"QXGiftCell" bundle:[NSBundle mainBundle]] forCellWithReuseIdentifier:@"QXGiftCell"];
self.collectionView.delegate = self;
self.collectionView.dataSource = self;
self.collectionView.showsHorizontalScrollIndicator = NO;
self.collectionView.bounces = NO;
self.collectionView.backgroundColor = [UIColor clearColor];
[self.bgView addSubview:self.collectionView];
self.cancelBtn = [[UIButton alloc] initWithFrame:CGRectMake(38, self.bgView.height-kSafeAreaBottom-42, 95, 42)];
[self.cancelBtn setTitle:QXText(@"取消") forState:(UIControlStateNormal)];
[self.cancelBtn setTitleColor:UIColor.whiteColor forState:(UIControlStateNormal)];
[self.cancelBtn addTarget:self action:@selector(hide) forControlEvents:(UIControlEventTouchUpInside)];
[self.cancelBtn addRoundedCornersWithRadius:21];
self.cancelBtn.titleLabel.font = [UIFont systemFontOfSize:14];
self.cancelBtn.backgroundColor = RGB16(0x333333);
[self.bgView addSubview:self.cancelBtn];
self.commitBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.cancelBtn.right+16, self.bgView.height-kSafeAreaBottom-42, self.bgView.width-38-self.cancelBtn.right-16 , 42)];
[self.commitBtn setTitle:QXText(@"确定") forState:(UIControlStateNormal)];
[self.commitBtn setTitleColor:QXConfig.btnTextColor forState:(UIControlStateNormal)];
[self.commitBtn addTarget:self action:@selector(commitAction) forControlEvents:(UIControlEventTouchUpInside)];
[self.commitBtn addRoundedCornersWithRadius:21];
self.commitBtn.titleLabel.font = [UIFont systemFontOfSize:14];
self.commitBtn.backgroundColor = QXConfig.themeColor;
[self.bgView addSubview:self.commitBtn];
[self getGiftList];
}
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{
return touch.view == self;
}
-(void)getGiftList{
MJWeakSelf
[QXMineNetwork giftListWithLabel:@"0" roomId:self.roomId successBlock:^(NSArray<QXGiftModel *> * _Nonnull list) {
weakSelf.selectedIndex = -1;
[weakSelf.dataArray removeAllObjects];
[weakSelf.dataArray addObjectsFromArray:list];
[weakSelf.collectionView reloadData];
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
}];
}
-(void)commitAction{
if (self.selectedIndex == -1) {
showToast(@"请选择礼物");
return;
}
QXGiftModel *model = self.dataArray[self.selectedIndex];
MJWeakSelf
[QXMineNetwork setApplyPitGiftWithRoomId:self.roomId gift_id:model.gift_id successBlock:^(NSDictionary * _Nonnull dict) {
if (weakSelf.setScuseesBlock) {
weakSelf.setScuseesBlock();
}
[weakSelf hide];
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
}];
}
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
return self.dataArray.count;
}
-(__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
QXGiftCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"QXGiftCell" forIndexPath:indexPath];
cell.cellType = QXGiftCellTypeLive;
cell.roomGiftModel = self.dataArray[indexPath.row];
if (self.selectedIndex == indexPath.row) {
cell.selecteBtn.selected = YES;
}else{
cell.selecteBtn.selected = NO;
}
return cell;
}
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
if (indexPath.row == self.selectedIndex) {
return;
}
self.selectedIndex = indexPath.row;
[collectionView reloadData];
}
-(void)showInView:(UIView *)view{
[view addSubview:self];
[UIView animateWithDuration:0.3 animations:^{
self.bgView.y = SCREEN_HEIGHT-ScaleWidth(456)-kSafeAreaBottom;
}];
}
-(void)hide{
[UIView animateWithDuration:0.3 animations:^{
self.bgView.y = SCREEN_HEIGHT;
} completion:^(BOOL finished) {
[self removeFromSuperview];
}];
}
-(NSMutableArray *)dataArray{
if (!_dataArray) {
_dataArray = [NSMutableArray array] ;
}
return _dataArray;
}
@end

View File

@@ -0,0 +1,34 @@
//
// QXSoundListView.h
// QXLive
//
// Created by 启星 on 2025/6/10.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@class QXSoundListModel;
@interface QXSoundListView : UIView
-(void)showInView:(UIView *)view;
@property (nonatomic,copy)void(^playSoundBlock)(QXSoundListModel*model);
@end
@interface QXSoundListCell : UICollectionViewCell
@property (nonatomic,strong)UIButton *selectedBgBtn;
@property (nonatomic,strong)UIButton *selectedSoundBtn;
@property (nonatomic,strong)UIImageView *iconImageView;
@property (nonatomic,strong)UIButton *titleBtn;
@property (nonatomic,strong)QXSoundListModel *model;
@end
@interface QXSoundListModel : NSObject
@property (nonatomic,strong)NSString *icon;
@property (nonatomic,strong)NSString *name;
@property (nonatomic,assign)BOOL isSelected;
@property (nonatomic,strong)NSString *filePath;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,216 @@
//
// QXSoundListView.m
// QXLive
//
// Created by on 2025/6/10.
//
#import "QXSoundListView.h"
#import "QXAgoraEngine.h"
@interface QXSoundListView()<UIGestureRecognizerDelegate,UICollectionViewDelegate,UICollectionViewDataSource>
@property (nonatomic,strong)UIView *bgView;
@property (nonatomic,strong)UIImageView *bgImageView;
@property (nonatomic,strong)UILabel *titleLabel;
@property (nonatomic,strong)UICollectionView *collectionView;
@property (nonatomic,strong)UIButton *commitBtn;
@property (nonatomic,strong)NSMutableArray *dataArray;
@property (nonatomic,strong)QXSoundListModel *selectedModel;
@end
@implementation QXSoundListView
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self initSubviews];
}
return self;
}
-(void)initSubviews{
QXSoundListModel *md = [[QXSoundListModel alloc] init];
md.name = QXText(@"笑声");
md.icon = @"room_sound_icon_1";
md.filePath = [[NSBundle mainBundle] pathForResource:@"音效-笑声" ofType:@"mp3"];
QXSoundListModel *md1 = [[QXSoundListModel alloc] init];
md1.name = QXText(@"欢呼");
md1.icon = @"room_sound_icon_2";
md1.filePath = [[NSBundle mainBundle] pathForResource:@"音效-欢呼" ofType:@"mp3"];
QXSoundListModel *md2 = [[QXSoundListModel alloc] init];
md2.name = QXText(@"尴尬");
md2.icon = @"room_sound_icon_3";
md2.filePath = [[NSBundle mainBundle] pathForResource:@"音效-尴尬" ofType:@"mp3"];
QXSoundListModel *md3 = [[QXSoundListModel alloc] init];
md3.name = QXText(@"尖叫");
md3.icon = @"room_sound_icon_4";
md3.filePath = [[NSBundle mainBundle] pathForResource:@"音效-掌声" ofType:@"mp3"];
QXSoundListModel *md4 = [[QXSoundListModel alloc] init];
md4.name = QXText(@"么么哒");
md4.icon = @"room_sound_icon_5";
md4.filePath = [[NSBundle mainBundle] pathForResource:@"音效-么么哒" ofType:@"mp3"];
[self.dataArray addObject:md];
[self.dataArray addObject:md1];
[self.dataArray addObject:md2];
[self.dataArray addObject:md3];
[self.dataArray addObject:md4];
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, ScaleWidth(279)+kSafeAreaBottom)];
// self.bgView.backgroundColor = [UIColor whiteColor];
[self addSubview:self.bgView];
self.bgImageView = [[UIImageView alloc] initWithFrame:self.bgView.bounds];
self.bgImageView.image = [UIImage imageNamed:@"room_sound_bg"];
[self.bgView addSubview:self.bgImageView];
self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, 16, SCREEN_WIDTH-32, 27)];
self.titleLabel.textColor = UIColor.whiteColor;
self.titleLabel.font = [UIFont boldSystemFontOfSize:18];
self.titleLabel.textAlignment = NSTextAlignmentCenter;
self.titleLabel.text = QXText(@"选择音效");
[self.bgView addSubview:self.titleLabel];
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
CGFloat itemWidth = (SCREEN_WIDTH-16*2-10*4)/5;
layout.itemSize = CGSizeMake(itemWidth, 100);
layout.minimumLineSpacing = 10;
layout.minimumInteritemSpacing = 0;
layout.sectionInset = UIEdgeInsetsMake(0, 16, 0, 16);
self.collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, self.titleLabel.bottom+22, self.bgView.width, self.bgView.height-self.titleLabel.bottom-22-kSafeAreaBottom) collectionViewLayout:layout];
[self.collectionView registerClass:[QXSoundListCell class] forCellWithReuseIdentifier:@"QXSoundListCell"];
self.collectionView.delegate = self;
self.collectionView.dataSource = self;
self.collectionView.backgroundColor = [UIColor clearColor];
self.collectionView.showsHorizontalScrollIndicator = NO;
self.collectionView.bounces = NO;
[self.bgView addSubview:self.collectionView];
self.commitBtn = [[UIButton alloc] initWithFrame:CGRectMake(38, self.bgView.height-kSafeAreaBottom-42, SCREEN_WIDTH-38*2, 42)];
[self.commitBtn setTitle:QXText(@"确定") forState:(UIControlStateNormal)];
[self.commitBtn setTitleColor:QXConfig.btnTextColor forState:(UIControlStateNormal)];
[self.commitBtn addTarget:self action:@selector(commitAction) forControlEvents:(UIControlEventTouchUpInside)];
[self.commitBtn addRoundedCornersWithRadius:21];
self.commitBtn.titleLabel.font = [UIFont systemFontOfSize:14];
self.commitBtn.backgroundColor = QXConfig.themeColor;
[self.bgView addSubview:self.commitBtn];
}
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{
return touch.view == self;
}
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
return self.dataArray.count;
}
-(__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
QXSoundListCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"QXSoundListCell" forIndexPath:indexPath];
cell.model = self.dataArray[indexPath.row];
return cell;
}
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
if (self.selectedModel == nil) {
QXSoundListModel *model = self.dataArray[indexPath.row];
model.isSelected = YES;
self.selectedModel = model;
[collectionView reloadData];
}else{
QXSoundListModel *model = self.dataArray[indexPath.row];
if (model.isSelected) {
return;
}
self.selectedModel.isSelected = NO;
model.isSelected = YES;
self.selectedModel = model;
[collectionView reloadData];
}
}
-(void)showInView:(UIView *)view{
[view addSubview:self];
[UIView animateWithDuration:0.3 animations:^{
self.bgView.y = SCREEN_HEIGHT-ScaleWidth(279)-kSafeAreaBottom;
}];
}
-(void)hide{
[UIView animateWithDuration:0.3 animations:^{
self.bgView.y = SCREEN_HEIGHT;
} completion:^(BOOL finished) {
[self removeFromSuperview];
}];
}
-(void)commitAction{
[self hide];
[[QXAgoraEngine sharedEngine].agoraKit playEffect:1 filePath:self.selectedModel.filePath loopCount:0 pitch:1 pan:0 gain:100 publish:YES];
}
-(NSMutableArray *)dataArray{
if (!_dataArray) {
_dataArray = [NSMutableArray array];
}
return _dataArray;
}
@end
@implementation QXSoundListCell
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self initSubviews];
}
return self;
}
- (void)setModel:(QXSoundListModel *)model{
_model = model;
self.titleBtn.selected = model.isSelected;
[self.titleBtn setTitle:model.name forState:(UIControlStateNormal)];
self.selectedBgBtn.selected = model.isSelected;
self.selectedSoundBtn.selected = model.isSelected;
self.iconImageView.image = [UIImage imageNamed:model.icon];
}
-(void)initSubviews{
self.selectedBgBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, self.width, self.height)];
[self.selectedBgBtn setBackgroundImage:[UIImage imageNamed:@"room_sound_sel"] forState:(UIControlStateSelected)];
[self.selectedBgBtn setBackgroundImage:[UIImage imageWithColor:RGB16A(0xE9E9E9, 0.2)] forState:(UIControlStateNormal)];
[self.selectedBgBtn addRoundedCornersWithRadius:12];
self.selectedBgBtn.userInteractionEnabled = NO;
[self.contentView addSubview:self.selectedBgBtn];
self.selectedSoundBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.width-14-5, 5, 14, 14)];
[self.selectedSoundBtn setBackgroundImage:[UIImage imageNamed:@"room_sound_icon_sel"] forState:(UIControlStateSelected)];
[self.selectedSoundBtn setBackgroundImage:[UIImage imageNamed:@"room_sound_icon_nor"] forState:(UIControlStateNormal)];
self.selectedSoundBtn.userInteractionEnabled = NO;
[self.contentView addSubview:self.selectedSoundBtn];
self.iconImageView = [[UIImageView alloc] initWithFrame:CGRectMake((self.width-ScaleWidth(48))/2, 15, ScaleWidth(48), ScaleWidth(48))];
[self.contentView addSubview:self.iconImageView];
self.titleBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, self.iconImageView.bottom, self.width, 21)];
[self.titleBtn setTitleColor:QXConfig.textColor forState:(UIControlStateSelected)];
[self.titleBtn setTitleColor:UIColor.whiteColor forState:(UIControlStateNormal)];
self.titleBtn.titleLabel.font = [UIFont systemFontOfSize:14];
self.titleBtn.userInteractionEnabled = NO;
[self.contentView addSubview:self.titleBtn];
}
@end
@implementation QXSoundListModel
@end

View File

@@ -0,0 +1,51 @@
//
// QXUpSeatView.h
// QXLive
//
// Created by 启星 on 2025/6/10.
//
#import <UIKit/UIKit.h>
#import "QXRoomModel.h"
NS_ASSUME_NONNULL_BEGIN
@protocol QXUpSeatViewDelegate <NSObject>
@optional
-(void)didClickUpSeat;
@end
@interface QXUpSeatView : UIView
@property (nonatomic,strong)NSString* roomId;
@property (nonatomic,assign)BOOL isCompere;
@property (nonatomic,weak)id<QXUpSeatViewDelegate>delegate;
-(void)showInView:(UIView *)view;
@end
@interface QXUpSeatViewCell : UICollectionViewCell
@property (nonatomic,strong)NSString* roomId;
@property (nonatomic,strong)UIImageView *headerImageView;
@property (nonatomic,strong)UIButton *selectedBtn;
@property (nonatomic,strong)UILabel *nameLabel;
@property (nonatomic,strong)UIButton *coinBtn;
@property (nonatomic,strong)UIButton *insertBtn;
@property (nonatomic,strong) QXRoomOnlineList *model;
@property (nonatomic,copy)void(^insertScuccessBlock)(void);
@end
@interface QXUpSeatCountView : UIView
@property (nonatomic,strong)UIImageView *bgImageView;
@property (nonatomic,strong)UILabel *typeLabel;
@property (nonatomic,strong)UILabel *teamLabel;
@property (nonatomic,strong)UILabel *countLabel;
@property (nonatomic,strong)UIButton *button;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,522 @@
//
// QXUpSeatView.m
// QXLive
//
// Created by on 2025/6/10.
//
#import "QXUpSeatView.h"
#import "QXMineNetwork.h"
#import "QXSetApplyGiftView.h"
@interface QXUpSeatView()<UIGestureRecognizerDelegate,UICollectionViewDelegate,UICollectionViewDataSource>
@property (nonatomic,strong)UIView *bgView;
@property (nonatomic,strong)UIImageView *bgImageView;
@property (nonatomic,strong)UIButton *commitBtn;
///
@property (nonatomic,strong)UILabel *priorityLabel;
@property (nonatomic,strong)UICollectionView *priorityCollectionView;
///
@property (nonatomic,strong)UILabel *waitLabel;
@property (nonatomic,strong)UIButton *refuseBtn;
@property (nonatomic,strong)UICollectionView *waitCollectionView;
@property (nonatomic,strong)NSMutableArray *selectedArray;
@property (nonatomic,strong)UIButton *agreeBtn;
@property (nonatomic,strong)UIButton *applyBtn;
@property (nonatomic,strong)UIButton *noAgreeBtn;
@property (nonatomic,strong)UIImageView *compereHeader;
@property (nonatomic,strong)UILabel *giftLabel;
@property (nonatomic,strong)UIButton *setBtn;
@property (nonatomic,strong)QXRoomApplyPitModel *model;
@property (nonatomic,strong)QXSetApplyGiftView *giftView;
@end
@implementation QXUpSeatView
- (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, ScaleWidth(456)+kSafeAreaBottom)];
[self addSubview:self.bgView];
self.bgImageView = [[UIImageView alloc] initWithFrame:self.bgView.bounds];
self.bgImageView.image = [UIImage imageNamed:@"room_sound_bg"];
[self.bgView addSubview:self.bgImageView];
self.setBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.width-44-16, 16, 44, 24)];
[self.setBtn setTitle:QXText(@"赠送") forState:(UIControlStateNormal)];
[self.setBtn setTitleColor:QXConfig.btnTextColor forState:(UIControlStateNormal)];;
self.setBtn.backgroundColor = QXConfig.themeColor;
[self.setBtn addRoundedCornersWithRadius:12];
self.setBtn.titleLabel.font = [UIFont systemFontOfSize:12];
[self.setBtn addTarget:self action:@selector(setAction) forControlEvents:(UIControlEventTouchUpInside)];
[self.bgView addSubview:self.setBtn];
self.giftLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.setBtn.left-100, 16, 100, 24)];
self.giftLabel.textColor = UIColor.whiteColor;
self.giftLabel.font = [UIFont systemFontOfSize:14];
self.giftLabel.text = [NSString stringWithFormat:@"赠送**礼物插队"];
[self.bgView addSubview:self.giftLabel];
[self.giftLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(16);
make.right.mas_equalTo(-(self.setBtn.width+4+16));
make.height.mas_equalTo(24);
}];
self.compereHeader = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"user_header_placehoulder"]];
self.compereHeader.contentMode = UIViewContentModeScaleAspectFill;
[self.compereHeader addRoundedCornersWithRadius:12];
[self.bgView addSubview:self.compereHeader];
[self.compereHeader mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(16);
make.right.equalTo(self.giftLabel.mas_left).offset(-2);
make.width.height.mas_equalTo(24);
}];
self.priorityLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, 16, 150, 24)];
self.priorityLabel.textColor = UIColor.whiteColor;
self.priorityLabel.font = [UIFont systemFontOfSize:16];
self.priorityLabel.text = [NSString localizedStringWithFormat:QXText(@"优先通道(%@/20)"),@"0"];
[self.bgView addSubview:self.priorityLabel];
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
layout.itemSize = CGSizeMake(ScaleWidth(57), ScaleWidth(108));
layout.minimumLineSpacing = 16;
layout.minimumInteritemSpacing = 0;
layout.sectionInset = UIEdgeInsetsMake(0, 16, 0, 16);
layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
self.priorityCollectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, self.priorityLabel.bottom+6, self.bgView.width, ScaleWidth(108)) collectionViewLayout:layout];
[self.priorityCollectionView registerClass:[QXUpSeatViewCell class] forCellWithReuseIdentifier:@"QXUpSeatViewCell"];
self.priorityCollectionView.delegate = self;
self.priorityCollectionView.dataSource = self;
self.priorityCollectionView.backgroundColor = [UIColor clearColor];
self.priorityCollectionView.showsHorizontalScrollIndicator = NO;
self.priorityCollectionView.bounces = NO;
[self.bgView addSubview:self.priorityCollectionView];
self.waitLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, self.priorityCollectionView.bottom+30, 125, 24)];
self.waitLabel.textColor = UIColor.whiteColor;
self.waitLabel.font = [UIFont systemFontOfSize:16];
self.waitLabel.text = [NSString localizedStringWithFormat:QXText(@"等待上台(%@/20)"),@"0"];
[self.bgView addSubview:self.waitLabel];
self.refuseBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.waitLabel.right+5, self.waitLabel.top, 55, 24)];
[self.refuseBtn setTitle:QXText(@"清空") forState:(UIControlStateNormal)];
[self.refuseBtn setTitleColor:QXConfig.btnTextColor forState:(UIControlStateNormal)];
[self.refuseBtn addTarget:self action:@selector(clearAction) forControlEvents:(UIControlEventTouchUpInside)];
[self.refuseBtn addRoundedCornersWithRadius:12];
self.refuseBtn.titleLabel.font = [UIFont systemFontOfSize:12];
self.refuseBtn.backgroundColor = QXConfig.themeColor;
self.refuseBtn.hidden = YES;
[self.bgView addSubview:self.refuseBtn];
UICollectionViewFlowLayout *layout1 = [[UICollectionViewFlowLayout alloc] init];
layout1.itemSize = CGSizeMake(ScaleWidth(57), ScaleWidth(108));
layout1.minimumLineSpacing = 16;
layout1.minimumInteritemSpacing = 0;
layout1.scrollDirection = UICollectionViewScrollDirectionHorizontal;
layout1.sectionInset = UIEdgeInsetsMake(0, 16, 0, 16);
self.waitCollectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, self.waitLabel.bottom+6, self.bgView.width, ScaleWidth(108)) collectionViewLayout:layout1];
[self.waitCollectionView registerClass:[QXUpSeatViewCell class] forCellWithReuseIdentifier:@"QXUpSeatViewCell"];
self.waitCollectionView.delegate = self;
self.waitCollectionView.dataSource = self;
self.waitCollectionView.backgroundColor = [UIColor clearColor];
self.waitCollectionView.showsHorizontalScrollIndicator = NO;
self.waitCollectionView.bounces = NO;
[self.bgView addSubview:self.waitCollectionView];
self.commitBtn = [[UIButton alloc] initWithFrame:CGRectMake(38, self.bgView.height-kSafeAreaBottom-42, SCREEN_WIDTH-38*2, 42)];
[self.commitBtn setTitle:QXText(@"立即申请") forState:(UIControlStateNormal)];
[self.commitBtn setTitleColor:QXConfig.btnTextColor forState:(UIControlStateNormal)];
[self.commitBtn addTarget:self action:@selector(commitAction) forControlEvents:(UIControlEventTouchUpInside)];
[self.commitBtn addRoundedCornersWithRadius:21];
self.commitBtn.titleLabel.font = [UIFont systemFontOfSize:14];
self.commitBtn.backgroundColor = QXConfig.themeColor;
[self.bgView addSubview:self.commitBtn];
CGFloat leftMargin = 26;
CGFloat allWidth =(SCREEN_WIDTH- leftMargin*2);
CGFloat btnWidth = 95;
CGFloat btnSpace = (allWidth - btnWidth*3)/2;
self.noAgreeBtn = [[UIButton alloc] initWithFrame:CGRectMake(leftMargin, self.bgView.height-kSafeAreaBottom-42, btnWidth, 42)];
[self.noAgreeBtn setTitle:QXText(@"拒绝") forState:(UIControlStateNormal)];
[self.noAgreeBtn setTitleColor:UIColor.whiteColor forState:(UIControlStateNormal)];
[self.noAgreeBtn addTarget:self action:@selector(noAgreeAction) forControlEvents:(UIControlEventTouchUpInside)];
[self.noAgreeBtn addRoundedCornersWithRadius:21];
self.noAgreeBtn.titleLabel.font = [UIFont systemFontOfSize:14];
self.noAgreeBtn.backgroundColor = RGB16(0x333333);
self.noAgreeBtn.hidden = YES;
[self.bgView addSubview:self.noAgreeBtn];
self.agreeBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.noAgreeBtn.right+btnSpace, self.bgView.height-kSafeAreaBottom-42, btnWidth , 42)];
[self.agreeBtn setTitle:QXText(@"同意") forState:(UIControlStateNormal)];
[self.agreeBtn setTitleColor:QXConfig.btnTextColor forState:(UIControlStateNormal)];
[self.agreeBtn addTarget:self action:@selector(agreeAction) forControlEvents:(UIControlEventTouchUpInside)];
[self.agreeBtn addRoundedCornersWithRadius:21];
self.agreeBtn.titleLabel.font = [UIFont systemFontOfSize:14];
self.agreeBtn.backgroundColor = QXConfig.themeColor;
self.agreeBtn.hidden = YES;
[self.bgView addSubview:self.agreeBtn];
self.applyBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.agreeBtn.right+btnSpace, self.bgView.height-kSafeAreaBottom-42, btnWidth, 42)];
[self.applyBtn setTitle:QXText(@"申请") forState:(UIControlStateNormal)];
[self.applyBtn setTitleColor:UIColor.whiteColor forState:(UIControlStateNormal)];
[self.applyBtn addTarget:self action:@selector(commitAction) forControlEvents:(UIControlEventTouchUpInside)];
[self.applyBtn addRoundedCornersWithRadius:21];
self.applyBtn.titleLabel.font = [UIFont systemFontOfSize:14];
self.applyBtn.backgroundColor = RGB16(0x333333);
self.applyBtn.hidden = YES;
[self.bgView addSubview:self.applyBtn];
}
-(void)setRoomId:(NSString *)roomId{
_roomId = roomId;
MJWeakSelf
[QXMineNetwork roomApplyPitListWithRoomId:self.roomId successBlock:^(QXRoomApplyPitModel * _Nonnull model) {
[weakSelf.selectedArray removeAllObjects];
weakSelf.model = model;
[weakSelf.priorityCollectionView reloadData];
[weakSelf.waitCollectionView reloadData];
if (model.gift_info != nil) {
weakSelf.giftLabel.text = [NSString localizedStringWithFormat:QXText(@"赠送%@插队"),model.gift_info.gift_name?model.gift_info.gift_name:@" "];
[weakSelf.compereHeader sd_setImageWithURL:[NSURL URLWithString:model.gift_info.base_image]];
}
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
}];
}
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{
return touch.view == self;
}
-(void)setIsCompere:(BOOL)isCompere{
_isCompere = isCompere;
self.agreeBtn.hidden = !isCompere;
self.noAgreeBtn.hidden = !isCompere;
self.commitBtn.hidden = isCompere;
self.refuseBtn.hidden = !isCompere;
self.applyBtn.hidden = !isCompere;
[self.setBtn setTitle:isCompere?QXText(@"设置"):QXText(@"赠送") forState:(UIControlStateNormal)];
}
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
if (collectionView == self.priorityCollectionView) {
// return self.priorityArray.count;
if (self.model) {
return self.model.special.count;
}
return 0;
}else{
// return self.waitArray.count;
if (self.model) {
return self.model.regular.count;
}
return 0;
}
}
-(__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
QXUpSeatViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"QXUpSeatViewCell" forIndexPath:indexPath];
cell.selectedBtn.hidden = !self.isCompere;
if (collectionView == self.priorityCollectionView) {
cell.model = self.model.special[indexPath.row];
}else{
cell.model = self.model.regular[indexPath.row];
}
cell.roomId = self.roomId;
MJWeakSelf
cell.insertScuccessBlock = ^{
[weakSelf setRoomId:weakSelf.roomId];
};
return cell;
}
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
QXRoomOnlineList *model;
QXUpSeatViewCell *cell = [collectionView cellForItemAtIndexPath:indexPath];
if (collectionView == self.priorityCollectionView) {
model = self.model.special[indexPath.row];
}else{
model = self.model.regular[indexPath.row];
}
model.isSelected = !model.isSelected;
cell.model = model;
if (model.isSelected) {
[self.selectedArray addObject:model.user_id];
}else{
[self.selectedArray removeObject:model.user_id];
}
}
-(void)showInView:(UIView *)view{
[view addSubview:self];
[UIView animateWithDuration:0.3 animations:^{
self.bgView.y = SCREEN_HEIGHT-ScaleWidth(456)-kSafeAreaBottom;
}];
}
-(void)hide{
[UIView animateWithDuration:0.3 animations:^{
self.bgView.y = SCREEN_HEIGHT;
} completion:^(BOOL finished) {
[self removeFromSuperview];
}];
}
-(void)commitAction{
// if (self.delegate && [self.delegate respondsToSelector:@selector(didClickUpSeat)]) {
// [self.delegate didClickUpSeat];
// }
MJWeakSelf
[QXMineNetwork roomUpSeatWithRoomId:self.roomId pit_number:@"" isUpSeat:YES successBlock:^(NSDictionary * _Nonnull dict) {
[weakSelf setRoomId:weakSelf.roomId];
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
showToast(msg);
}];
}
-(void)clearAction{
MJWeakSelf
[QXMineNetwork clearApplyPitListRoomId:self.roomId successBlock:^(NSDictionary * _Nonnull dict) {
[weakSelf.selectedArray removeAllObjects];
self.model.special = @[];
self.model.regular = @[];
[weakSelf.priorityCollectionView reloadData];
[weakSelf.waitCollectionView reloadData];
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
}];
}
-(void)noAgreeAction{
if (self.selectedArray.count == 0) {
showToast(@"请选择观众");
return;
}
NSString *userId = [self.selectedArray componentsJoinedByString:@","];
MJWeakSelf
[QXMineNetwork agreeUpSeatIsAgree:NO roomId:self.roomId userId:userId successBlock:^(NSDictionary * _Nonnull dict) {
[weakSelf setRoomId:weakSelf.roomId];
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
}];
}
-(void)agreeAction{
if (self.selectedArray.count == 0) {
showToast(@"请选择观众");
return;
}
NSString *userId = [self.selectedArray componentsJoinedByString:@","];
MJWeakSelf
[QXMineNetwork agreeUpSeatIsAgree:YES roomId:self.roomId userId:userId successBlock:^(NSDictionary * _Nonnull dict) {
[weakSelf setRoomId:weakSelf.roomId];
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
showToast(msg);
}];
}
-(void)setAction{
if (self.isCompere) {
QXLOG(@"设置礼物");
[self.giftView showInView:self.viewController.view];
}else{
QXLOG(@"赠送");
///
}
}
-(NSMutableArray *)selectedArray{
if (!_selectedArray) {
_selectedArray = [NSMutableArray array];
}
return _selectedArray;
}
-(QXSetApplyGiftView *)giftView{
if (!_giftView) {
_giftView = [[QXSetApplyGiftView alloc] initWithFrame:[UIScreen mainScreen].bounds];
_giftView.roomId = self.roomId;
MJWeakSelf
_giftView.setScuseesBlock = ^{
[weakSelf setRoomId:weakSelf.roomId];
};
}
return _giftView;
}
@end
@implementation QXUpSeatViewCell
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self initSubviews];
}
return self;
}
-(void)initSubviews{
self.headerImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"user_header_placehoulder"]];
self.headerImageView.contentMode = UIViewContentModeScaleAspectFill;
[self.headerImageView addRoundedCornersWithRadius:ScaleWidth(25)];
[self.contentView addSubview:self.headerImageView];
[self.headerImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(ScaleWidth(50), ScaleWidth(50)));
make.top.mas_equalTo(0);
make.centerX.equalTo(self.contentView);
}];
self.nameLabel = [[UILabel alloc] init];
self.nameLabel.textColor = [UIColor whiteColor];
self.nameLabel.textAlignment = NSTextAlignmentCenter;
self.nameLabel.font = [UIFont systemFontOfSize:12];
self.nameLabel.text = @"张三";
[self.contentView addSubview:self.nameLabel];
[self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(self.contentView);
make.top.equalTo(self.headerImageView.mas_bottom);
make.height.mas_equalTo(18);
}];
self.selectedBtn = [[UIButton alloc] init];
self.selectedBtn.userInteractionEnabled = NO;
[self.selectedBtn setImage:[[UIImage imageNamed:@"login_agreement_nor"] imageByTintColor:UIColor.whiteColor] forState:(UIControlStateNormal)];
[self.selectedBtn setImage:[UIImage imageNamed:@"login_agreement_sel"] forState:(UIControlStateSelected)];
[self.contentView addSubview:self.selectedBtn];
[self.selectedBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.contentView);
make.top.equalTo(self.contentView);
make.size.mas_equalTo(CGSizeMake(16, 16));
}];
self.coinBtn = [[UIButton alloc] init];
[self.coinBtn setImage:[UIImage imageNamed:@"room_upseat_coin"] forState:(UIControlStateNormal)];
[self.coinBtn setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)];
self.coinBtn.titleLabel.font = [UIFont systemFontOfSize:12];
[self.coinBtn setTitle:@" 0" forState:(UIControlStateNormal)];
self.coinBtn.userInteractionEnabled = NO;
[self.contentView addSubview:self.coinBtn];
[self.coinBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(self.contentView);
make.top.equalTo(self.nameLabel.mas_bottom);
make.height.mas_equalTo(18);
}];
self.insertBtn = [[UIButton alloc] init];
[self.insertBtn setBackgroundImage:[UIImage imageNamed:@"room_upseat_insert"] forState:(UIControlStateNormal)];
[self.contentView addSubview:self.insertBtn];
[self.insertBtn addTarget:self action:@selector(insertAction) forControlEvents:(UIControlEventTouchUpInside)];
[self.insertBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self.contentView);
make.bottom.equalTo(self.contentView);
make.size.mas_equalTo(CGSizeMake(ScaleWidth(57), ScaleWidth(20)));
}];
}
-(void)insertAction{
MJWeakSelf
[QXMineNetwork roomApplyPitPowerWithRoomId:self.roomId userId:self.model.user_id successBlock:^(NSDictionary * _Nonnull dict) {
if (weakSelf.insertScuccessBlock) {
weakSelf.insertScuccessBlock();
}
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
}];
}
-(void)setModel:(QXRoomOnlineList *)model{
_model = model;
[self.headerImageView sd_setImageWithURL:[NSURL URLWithString:model.avatar]];
self.nameLabel.text = model.nickname;
[self.coinBtn setTitle:[NSString stringWithFormat:@" %@",model.rank_value] forState:(UIControlStateNormal)];
self.selectedBtn.selected = model.isSelected;
}
@end
@implementation QXUpSeatCountView
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self initSubviews];
}
return self;
}
-(void)initSubviews{
self.bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"room_mic_team"]];
self.bgImageView.contentMode = UIViewContentModeScaleToFill;
[self addSubview:self.bgImageView];
[self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.bottom.top.equalTo(self);
}];
self.typeLabel = [[UILabel alloc] init];
self.typeLabel.text = @"排麦模式";
self.typeLabel.font = [UIFont systemFontOfSize:12];
self.typeLabel.textColor = RGB16(0xffffff);
[self addSubview:self.typeLabel];
[self.typeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self).offset(ScaleWidth(2));
make.right.mas_equalTo(-10);
make.height.mas_equalTo(ScaleWidth(18));
}];
self.teamLabel = [[UILabel alloc] init];
self.teamLabel.text = @"人排队";
self.teamLabel.font = [UIFont systemFontOfSize:12];
self.teamLabel.textColor = RGB16(0xffffff);
[self addSubview:self.teamLabel];
[self.teamLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.equalTo(self).offset(-ScaleWidth(2));;
make.right.mas_equalTo(-10);
make.height.mas_equalTo(ScaleWidth(18));
}];
self.countLabel = [[UILabel alloc] init];
self.countLabel.text = @"0";
self.countLabel.font = [UIFont systemFontOfSize:14];
self.countLabel.textColor = RGB16(0xF4DF39);
[self addSubview:self.countLabel];
[self.countLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.equalTo(self);
make.right.equalTo(self.teamLabel.mas_left);
make.centerY.equalTo(self.teamLabel);
}];
// self.button = [[UIButton alloc] init];
// [self addSubview:self.button];
// [self.button mas_makeConstraints:^(MASConstraintMaker *make) {
// make.left.right.bottom.top.equalTo(self);
// }];
}
@end

View File

@@ -0,0 +1,25 @@
//
// QXFriendCPSuccessView.h
// IsLandVoice
//
// Created by 启星 on 2025/3/10.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@protocol QXFriendCPSuccessViewDelegate <NSObject>
@optional
-(void)animateIsFinishedWithModel:(QXRoomFriendRelationModel*)model;
@end
@interface QXFriendCPSuccessView : UIView
@property (nonatomic,weak)id<QXFriendCPSuccessViewDelegate>delegate;
-(void)setDataWithRelationModel:(QXRoomFriendRelationModel *)model cpName:(NSString*)cpName;
-(void)showInView:(UIView*)view;
-(void)hide;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,129 @@
//
// QXFriendCPSuccessView.m
// IsLandVoice
//
// Created by on 2025/3/10.
//
#import "QXFriendCPSuccessView.h"
@interface QXFriendCPSuccessView()
@property (nonatomic,strong)UIView *bgView;
@property (nonatomic,strong)UIImageView *bgImageView;
@property (nonatomic,strong)UIImageView *headerLeftImageView;
@property (nonatomic,strong)UIImageView *leftNameBgImageView;
@property (nonatomic,strong)UILabel *leftNameLabel;
@property (nonatomic,strong)UIImageView *headerRightImageView;
@property (nonatomic,strong)UIImageView *rightNameBgImageView;
@property (nonatomic,strong)UILabel *rightNameLabel;
///
@property (nonatomic,strong)UILabel *relationLabel;
@property (nonatomic,strong)QXRoomFriendRelationModel *model;
@end
@implementation QXFriendCPSuccessView
- (instancetype)init
{
self = [super init];
if (self) {
self.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
[self createViews];
}
return self;
}
-(void)createViews{
self.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.3];
self.bgView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, ScaleWidth(420))];
self.bgView.centerY = self.centerY;
self.bgView.alpha = 0;
[self addSubview:self.bgView];
self.bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"room_friend_success_bg"]];
self.bgImageView.frame = CGRectMake(0, 0, self.bgView.width, self.bgView.height);
[self.bgView addSubview:self.bgImageView];
self.headerLeftImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"user_header_placehoulder"]];
self.headerLeftImageView.frame = CGRectMake(self.bgView.width/2-ScaleWidth(75)-15, 60, ScaleWidth(75), ScaleWidth(75));
self.headerLeftImageView.layer.masksToBounds = YES;
self.headerLeftImageView.layer.cornerRadius = self.headerLeftImageView.height/2.0;
self.headerLeftImageView.layer.borderColor = RGB16(0x7781F5).CGColor;
self.headerLeftImageView.layer.borderWidth = 3;
[self.bgView addSubview:self.headerLeftImageView];
self.leftNameBgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"room_friend_success_name_bg"]];
self.leftNameBgImageView.frame = CGRectMake(0, self.headerLeftImageView.bottom+5, 104, 20);
self.leftNameBgImageView.centerX = self.headerLeftImageView.centerX;
[self.bgView addSubview:self.leftNameBgImageView];
self.leftNameLabel = [[UILabel alloc] initWithFrame:self.leftNameBgImageView.frame];
self.leftNameLabel.textColor = RGB16(0xffffff);
self.leftNameLabel.textAlignment = NSTextAlignmentCenter;
self.leftNameLabel.font = [UIFont fontWithName:@"YouSheBiaoTiHei" size:14];
[self.bgView addSubview:self.leftNameLabel];
self.headerRightImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"user_header_placehoulder"]];
self.headerRightImageView.frame = CGRectMake(self.bgView.width/2+15, self.headerLeftImageView.top, ScaleWidth(75), ScaleWidth(75));
self.headerRightImageView.layer.masksToBounds = YES;
self.headerRightImageView.layer.cornerRadius = self.headerRightImageView.height/2.0;
self.headerRightImageView.layer.borderColor = RGB16(0x7781F5).CGColor;
self.headerRightImageView.layer.borderWidth = 3;
[self.bgView addSubview:self.headerRightImageView];
self.rightNameBgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"room_friend_success_name_bg"]];
self.rightNameBgImageView.frame = CGRectMake(0, self.headerLeftImageView.bottom+5, 104, 20);
self.rightNameBgImageView.centerX = self.headerRightImageView.centerX;
[self.bgView addSubview:self.rightNameBgImageView];
self.rightNameLabel = [[UILabel alloc] initWithFrame:self.rightNameBgImageView.frame];
self.rightNameLabel.textColor = RGB16(0xffffff);
self.rightNameLabel.textAlignment = NSTextAlignmentCenter;
self.rightNameLabel.font = [UIFont fontWithName:@"YouSheBiaoTiHei" size:14];
[self.bgView addSubview:self.rightNameLabel];
[self.bgView addSubview:self.relationLabel];
self.relationLabel.text = @"兄弟牵手成功";
}
-(void)setDataWithRelationModel:(QXRoomFriendRelationModel *)model cpName:(NSString *)cpName{
_model = model;
[self.headerLeftImageView sd_setImageWithURL:[NSURL URLWithString:model.user1_avatar] placeholderImage:[UIImage imageNamed:@"room_friend_success_name_bg"]];
self.leftNameLabel.text = model.user1_nickname;
[self.headerRightImageView sd_setImageWithURL:[NSURL URLWithString:model.user2_avatar] placeholderImage:[UIImage imageNamed:@"room_friend_success_name_bg"]];
self.rightNameLabel.text = model.user2_nickname;
self.relationLabel.text = [NSString stringWithFormat:@"%@牵手成功",cpName];
}
-(void)showInView:(UIView *)view{
[view addSubview:self];
[UIView animateWithDuration:1.5 animations:^{
self.bgView.alpha = 1;
} completion:^(BOOL finished) {
[self performSelector:@selector(hide) withObject:nil afterDelay:3];
}];
}
-(void)hide{
[UIView animateWithDuration:1 animations:^{
self.bgView.alpha = 0;
} completion:^(BOOL finished) {
[self removeFromSuperview];
if (self.delegate && [self.delegate respondsToSelector:@selector(animateIsFinishedWithModel:)]) {
[self.delegate animateIsFinishedWithModel:self.model];
}
}];
}
- (UILabel *)relationLabel{
if (!_relationLabel) {
_relationLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, self.bgView.height/2, self.bgView.width, 35)];
_relationLabel.textAlignment = NSTextAlignmentCenter;
_relationLabel.font = [UIFont fontWithName:@"YouSheBiaoTiHei" size:28];
_relationLabel.textColor = [UIColor colorWithHexString:@"#FFEBC3"];
}
return _relationLabel;
}
@end

View File

@@ -0,0 +1,29 @@
//
// QXFriendCPView.h
// IsLandVoice
//
// Created by 启星 on 2025/3/10.
//
#import <UIKit/UIKit.h>
#import "QXRoomFriendRelationModel.h"
NS_ASSUME_NONNULL_BEGIN
@interface QXFriendCPView : UIView
@property (nonatomic,strong)QXRoomFriendRelationModel *model;
@property (nonatomic,strong)NSMutableArray *dataArray;
@property (nonatomic,copy)void(^commitBlock)(QXRoomFriendRelationModel*relationModel,NSString*selectedCpId,NSString*selectedCpName);
-(void)showInView:(UIView*)view;
-(void)hide;
-(void)getRelationShipList;
@end
@interface QXFriendCPTypeCell : UICollectionViewCell
/// 1 创建房间 2 礼物
@property (nonatomic,assign)NSInteger type;
@property (nonatomic,strong)UIButton *titleBtn;
@property (nonatomic,strong)NSString *title;
@property (nonatomic,assign)BOOL isSelected;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,311 @@
//
// QXFriendCPView.m
// IsLandVoice
//
// Created by on 2025/3/10.
//
#import "QXFriendCPView.h"
#import <SVGA.h>
#import "QXMineNetwork.h"
@class QXFriendCPTypeCell;
@interface QXFriendCPView()<UICollectionViewDelegate,UICollectionViewDataSource>
@property (nonatomic,strong)UIView *bgView;
@property (nonatomic,strong)UIImageView *bgImageView;
@property (nonatomic,strong)UIImageView *headerLeftImageView;
@property (nonatomic,strong)UILabel *headerLeftNameLabel;
@property (nonatomic,strong)UIImageView *lineImageView;
///
@property (nonatomic,strong)UILabel *heartValueLabel;
@property (nonatomic,strong)UIImageView *headerRightImageView;
@property (nonatomic,strong)UILabel *headerRightNameLabel;
@property (nonatomic,strong)UILabel *titleLabel;
@property (nonatomic,strong)UICollectionView *collectionView;
@property (nonatomic,strong)UIButton *cancelBtn;
@property (nonatomic,strong)UIButton *commitBtn;
@property (nonatomic,assign)NSInteger selectedIndex;
@property (nonatomic, strong) SVGAPlayer *svgaPlayer;
@property (nonatomic , strong) SVGAParser *parser;
@end
@implementation QXFriendCPView
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
self.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
[self createViews];
}
return self;
}
-(void)createViews{
self.selectedIndex = -1;
self.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.5];
self.bgView = [[UIView alloc] initWithFrame:CGRectMake((self.width-ScaleWidth(275))/2.0,-SCREEN_HEIGHT, ScaleWidth(275), ScaleWidth(466))];
[self addSubview:self.bgView];
self.bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"room_friend_create_relation_bg"]];
self.bgImageView.contentMode = UIViewContentModeScaleToFill;
self.bgImageView.frame = self.bgView.bounds;
[self.bgView addSubview:self.bgImageView];
[self.bgView addSubview:self.headerLeftImageView];
[self.bgView addSubview:self.headerLeftNameLabel];
[self.bgView addSubview:self.headerRightImageView];
[self.bgView addSubview:self.headerRightNameLabel];
[self.bgView addSubview:self.lineImageView];
[self.bgView addSubview:self.heartValueLabel];
self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, self.headerLeftNameLabel.bottom+15, 200, 24)];
self.titleLabel.text = @"关系列表";
self.titleLabel.font = [UIFont boldSystemFontOfSize:16];
self.titleLabel.textColor = [UIColor colorWithHexString:@"#333333"];
[self.bgView addSubview:self.titleLabel];
self.cancelBtn = [[UIButton alloc] initWithFrame:CGRectMake(16, ScaleWidth(466)-42-40, (self.bgView.width-16*3-18)/2.0, 42)];
self.cancelBtn.backgroundColor = [UIColor colorWithHexString:@"#333333"];
[self.cancelBtn setTitle:@"取消" forState:(UIControlStateNormal)];
self.cancelBtn.titleLabel.font = [UIFont systemFontOfSize:14];
[self.cancelBtn setTitleColor:[UIColor colorWithHexString:@"#ffffff"] forState:(UIControlStateNormal)];
[self.cancelBtn addTarget:self action:@selector(closeAction) forControlEvents:(UIControlEventTouchUpInside)];
self.cancelBtn.layer.masksToBounds = YES;
self.cancelBtn.layer.cornerRadius = 21;
[self.bgView addSubview:self.cancelBtn];
self.commitBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.cancelBtn.right+20, self.cancelBtn.top, self.cancelBtn.width, 42)];
self.commitBtn.backgroundColor = QXConfig.themeColor;
[self.commitBtn setTitle:@"确认" forState:(UIControlStateNormal)];
self.commitBtn.titleLabel.font = [UIFont systemFontOfSize:14];
[self.commitBtn setTitleColor:QXConfig.btnTextColor forState:(UIControlStateNormal)];
[self.commitBtn addTarget:self action:@selector(commitAction) forControlEvents:(UIControlEventTouchUpInside)];
self.commitBtn.layer.masksToBounds = YES;
self.commitBtn.layer.cornerRadius = 21;
[self.bgView addSubview:self.commitBtn];
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
CGFloat itemWidth = (self.bgView.width - 48 - 3*12)/3.0;
layout.itemSize = CGSizeMake(itemWidth, 34);
layout.minimumInteritemSpacing = 12;
layout.minimumLineSpacing = 12;
layout.sectionInset = UIEdgeInsetsMake(0, 18, 0, 30);
self.collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, self.titleLabel.bottom+10, self.bgView.width, self.commitBtn.top-self.titleLabel.bottom-30) collectionViewLayout:layout];
self.collectionView.delegate = self;
self.collectionView.backgroundColor = [UIColor clearColor];
self.collectionView.dataSource = self;
[self.collectionView registerClass:[QXFriendCPTypeCell class] forCellWithReuseIdentifier:@"QXFriendCPTypeCell"];
[self.bgView addSubview:self.collectionView];
[self getRelationShipList];
}
-(void)getRelationShipList{
MJWeakSelf
[QXMineNetwork roomRelationListWithType:@"2" successBlock:^(NSArray<QXRoomRelationModel *> * _Nonnull list) {
[weakSelf.dataArray removeAllObjects];
[weakSelf.dataArray addObjectsFromArray:list];
[weakSelf.collectionView reloadData];
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
}];
}
-(void)setModel:(QXRoomFriendRelationModel *)model{
_model = model;
[self.headerLeftImageView sd_setImageWithURL:[NSURL URLWithString:model.user1_avatar] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]];
[self.headerRightImageView sd_setImageWithURL:[NSURL URLWithString:model.user2_avatar] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]];
self.headerLeftNameLabel.text = model.user1_nickname;
self.headerRightNameLabel.text = model.user2_nickname;
self.heartValueLabel.text = model.heart_value;
}
-(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView{
return 1;
}
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
return self.dataArray.count;
}
-(__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
QXFriendCPTypeCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"QXFriendCPTypeCell" forIndexPath:indexPath];
QXRoomRelationModel *model = self.dataArray[indexPath.row];
cell.title = model.name;
if (indexPath.row == self.selectedIndex) {
cell.isSelected = YES;
}else{
cell.isSelected = NO;
}
return cell;
}
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
self.selectedIndex = indexPath.row;
[self.collectionView reloadData];
}
-(void)commitAction{
// QXFriendCPSuccessView *successView = [[QXFriendCPSuccessView alloc] init];
// for (UIWindow *w in [UIApplication sharedApplication].windows) {
// if ([w isKeyWindow]) {
// [successView showInView:w];
// break;
// }
// }
QXRoomRelationModel *md = self.dataArray[self.selectedIndex];
if (self.commitBlock) {
self.commitBlock(self.model,md.relation_id,md.name);
}
}
-(void)closeAction{
[self hide];
}
-(void)showInView:(UIView *)view{
[view addSubview:self];
[UIView animateWithDuration:0.3 delay:0 usingSpringWithDamping:0.5 initialSpringVelocity:1.0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
self.bgView.centerY = self.centerY;
} completion:^(BOOL finished) {
}];
}
-(void)hide{
[UIView animateWithDuration:0.3 delay:0 usingSpringWithDamping:0.5 initialSpringVelocity:1.0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
self.bgView.y = SCREEN_HEIGHT;
} completion:^(BOOL finished) {
[self removeFromSuperview];
}];
}
- (UIImageView *)headerLeftImageView{
if (!_headerLeftImageView) {
_headerLeftImageView = [[UIImageView alloc] initWithFrame:CGRectMake(18, ScaleWidth(130), ScaleWidth(50), ScaleWidth(50))];
_headerLeftImageView.image = [UIImage imageNamed:@"user_header_placehoulder"];
_headerLeftImageView.contentMode = UIViewContentModeScaleAspectFill;
_headerLeftImageView.layer.masksToBounds = YES;
_headerLeftImageView.layer.cornerRadius = ScaleWidth(50)/2.0;
}
return _headerLeftImageView;
}
-(UILabel *)headerLeftNameLabel{
if (!_headerLeftNameLabel) {
_headerLeftNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.headerLeftImageView.left, self.headerLeftImageView.bottom, 100, 20)];
_headerLeftNameLabel.textColor = [UIColor colorWithHexString:@"#333333"];
_headerLeftNameLabel.font = [UIFont systemFontOfSize:12];
_headerLeftNameLabel.textAlignment = NSTextAlignmentLeft;
}
return _headerLeftNameLabel;
}
- (UIImageView *)headerRightImageView{
if (!_headerRightImageView) {
_headerRightImageView = [[UIImageView alloc] initWithFrame:CGRectMake(self.bgView.width-30-ScaleWidth(50), self.headerLeftImageView.top, ScaleWidth(50), ScaleWidth(50))];
_headerRightImageView.image = [UIImage imageNamed:@"user_header_placehoulder"];
_headerRightImageView.contentMode = UIViewContentModeScaleAspectFill;
_headerRightImageView.layer.masksToBounds = YES;
_headerRightImageView.layer.cornerRadius = ScaleWidth(50)/2.0;
}
return _headerRightImageView;
}
-(UILabel *)headerRightNameLabel{
if (!_headerRightNameLabel) {
_headerRightNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.headerRightImageView.right-100, self.headerLeftImageView.bottom, 100, 20)];
_headerRightNameLabel.textColor = [UIColor colorWithHexString:@"#333333"];
_headerRightNameLabel.font = [UIFont systemFontOfSize:12];
_headerRightNameLabel.textAlignment = NSTextAlignmentRight;
}
return _headerRightNameLabel;
}
-(UIImageView *)lineImageView{
if (!_lineImageView) {
_lineImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"room_friend_relation_heart"]];
_lineImageView.frame = CGRectMake(self.headerLeftImageView.right, 0, self.headerRightImageView.left-self.headerLeftImageView.right, ScaleWidth(50));
_lineImageView.centerY = self.headerLeftImageView.centerY;
}
return _lineImageView;
}
- (UILabel *)heartValueLabel{
if (!_heartValueLabel) {
_heartValueLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 80, 18)];
_heartValueLabel.centerY = self.lineImageView.centerY;
_heartValueLabel.centerX = self.lineImageView.centerX;
_heartValueLabel.backgroundColor = [UIColor colorWithHexString:@"#FE8EC8"];
_heartValueLabel.layer.masksToBounds = YES;
_heartValueLabel.layer.cornerRadius = 9;
_heartValueLabel.layer.borderColor = [UIColor whiteColor].CGColor;
_heartValueLabel.layer.borderWidth = 1;
_heartValueLabel.textColor = [UIColor whiteColor];
_heartValueLabel.textAlignment = NSTextAlignmentCenter;
_heartValueLabel.font = [UIFont boldSystemFontOfSize:12];
}
return _heartValueLabel;
}
-(NSMutableArray *)dataArray{
if (!_dataArray) {
_dataArray = [NSMutableArray array];
}
return _dataArray;
}
@end
@implementation QXFriendCPTypeCell
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self createViews];
}
return self;
}
-(void)setIsSelected:(BOOL)isSelected{
_isSelected = isSelected;
self.titleBtn.selected = isSelected;
if (self.isSelected) {
self.titleBtn.titleLabel.font = [UIFont systemFontOfSize:16];
}else{
self.titleBtn.titleLabel.font = [UIFont systemFontOfSize:14];
}
}
-(void)setType:(NSInteger)type{
_type = type;
if (type == 1) {
self.titleBtn.layer.cornerRadius = 17;
UIImage *normalImage = [UIImage imageWithColor:[UIColor colorWithHexString:@"#F6F6F6"]];
[self.titleBtn setBackgroundImage:normalImage forState:(UIControlStateNormal)];
}if (type == 2){
self.titleBtn.layer.cornerRadius = 0;
[self.titleBtn setBackgroundImage:nil forState:(UIControlStateNormal)];
[self.titleBtn setTitleColor:[UIColor colorWithHexString:@"#999999"] forState:(UIControlStateNormal)];
[self.titleBtn setTitleColor:[UIColor colorWithHexString:@"#ffffff"] forState:(UIControlStateSelected)];
[self.titleBtn setBackgroundImage:nil forState:(UIControlStateNormal)];
[self.titleBtn setBackgroundImage:nil forState:(UIControlStateSelected)];
self.titleBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
}
}
-(void)setTitle:(NSString *)title{
_title = title;
[self.titleBtn setTitle:title forState:(UIControlStateNormal)];
}
-(void)createViews{
self.titleBtn = [[UIButton alloc] init];
UIImage *selectedImage = [UIImage imageWithColor:QXConfig.themeColor];
UIImage *normalImage = [UIImage imageWithColor:[UIColor colorWithHexString:@"#FFFFFF"]];
[self.titleBtn setBackgroundImage:selectedImage forState:(UIControlStateSelected)];
[self.titleBtn setBackgroundImage:normalImage forState:(UIControlStateNormal)];
[self.titleBtn setTitleColor:[UIColor colorWithHexString:@"#333333"] forState:(UIControlStateNormal)];
[self.titleBtn setTitleColor:QXConfig.btnTextColor forState:(UIControlStateSelected)];
self.titleBtn.titleLabel.font = [UIFont systemFontOfSize:14];
self.titleBtn.layer.masksToBounds = YES;
self.titleBtn.layer.cornerRadius = 4;
[self.contentView addSubview:self.titleBtn];
self.titleBtn.userInteractionEnabled = NO;
[self.titleBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.top.bottom.equalTo(self.contentView);
}];
}
@end

View File

@@ -0,0 +1,17 @@
//
// QXRoomAuctionRankView.h
// QXLive
//
// Created by 启星 on 2025/7/1.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface QXRoomAuctionRankView : UIView
@property (nonatomic,strong)NSString *auctionId;
-(void)showInView:(UIView *)view;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,177 @@
//
// QXRoomAuctionRankView.m
// QXLive
//
// Created by on 2025/7/1.
//
#import "QXRoomAuctionRankView.h"
#import "QXMineNetwork.h"
#import "QXRoomRankSubView.h"
#import "QXBlackListCell.h"
@interface QXRoomAuctionRankView()<UIGestureRecognizerDelegate,UITableViewDataSource,UITableViewDelegate>
@property (nonatomic,strong)UILabel *titleLabel;
@property (nonatomic,strong)UIImageView *bgImageView;
@property (nonatomic,strong)UIView *bgView;
@property (nonatomic,strong)UIView *tableHeaderView;
@property (nonatomic,strong)QXRoomRankTopThreeView *firstView;
@property (nonatomic,strong)QXRoomRankTopThreeView *secondView;
@property (nonatomic,strong)QXRoomRankTopThreeView *thirdView;
@property (nonatomic,strong)UITableView *tableView;
@property (nonatomic,strong)NSMutableArray *dataArray;
@property (nonatomic,assign)NSInteger page;
@end
@implementation QXRoomAuctionRankView
- (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, ScaleWidth(144), SCREEN_WIDTH, SCREEN_HEIGHT-ScaleWidth(144))];
[self.bgView addRoundedCornersWithRadius:16 byRoundingCorners:(UIRectCornerTopLeft|UIRectCornerTopRight)];
[self addSubview:self.bgView];
self.bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"room_rank_bg"]];
self.bgImageView.contentMode = UIViewContentModeScaleToFill;
self.bgImageView.frame = self.bgView.bounds;
[self.bgView addSubview:self.bgImageView];
self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 12, self.bgView.width, 30)];
self.titleLabel.font = [UIFont boldSystemFontOfSize:18];
self.titleLabel.textColor = [UIColor whiteColor];
self.titleLabel.text = @"出价榜单";
self.titleLabel.textAlignment = NSTextAlignmentCenter;
[self.bgView addSubview:self.titleLabel];
self.tableHeaderView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.width, 220+44+38+40+8)];
CGFloat itemWidth = (self.width-36)/3;
self.secondView = [[QXRoomRankTopThreeView alloc] initWithFrame:CGRectMake(18, 44+38+40+8+50, itemWidth, 135)];
self.secondView.number = 2;
[self.tableHeaderView addSubview:self.secondView];
self.firstView = [[QXRoomRankTopThreeView alloc] initWithFrame:CGRectMake(self.secondView.right, 44+38+40+8, itemWidth, 161)];
self.firstView.number = 1;
[self.tableHeaderView addSubview:self.firstView];
self.thirdView = [[QXRoomRankTopThreeView alloc] initWithFrame:CGRectMake(self.firstView.right, 44+38+40+8+50, itemWidth, 135)];
self.thirdView.number = 3;
[self.tableHeaderView addSubview:self.thirdView];
self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, self.width, self.bgView.height) style:(UITableViewStylePlain)];
self.tableView.delegate = self;
self.tableView.dataSource = self;
self.tableView.backgroundColor = [UIColor clearColor];
self.tableView.rowHeight = 60;
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
self.tableView.tableHeaderView = self.tableHeaderView;
MJWeakSelf
self.tableView.mj_footer = [MJRefreshBackStateFooter footerWithRefreshingBlock:^{
weakSelf.page++;
[weakSelf getAuctionUserList];
}];
self.tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
weakSelf.page = 1;
[weakSelf getAuctionUserList];
}];
[self.bgView addSubview:self.tableView];
}
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{
return touch.view == self;
}
-(void)setAuctionId:(NSString *)auctionId{
_auctionId = auctionId;
self.page = 1;
[self getAuctionUserList];
}
-(void)getAuctionUserList{
MJWeakSelf
[QXMineNetwork roomAuctionUserListWithAuctionId:self.auctionId successBlock:^(NSArray<QXRoomOnlineList *> * _Nonnull list) {
if (weakSelf.page == 1) {
weakSelf.firstView.md = nil;
weakSelf.secondView.md = nil;
weakSelf.thirdView.md = nil;
[weakSelf.dataArray removeAllObjects];
for (int i = 0 ; i < list.count; i++) {
QXRoomOnlineList*md = list[i];
if (i == 0) {
// [weakSelf.topArray addObject:md];
weakSelf.firstView.md = md;
}else if (i == 1) {
weakSelf.secondView.md = md;
}else if (i == 2) {
weakSelf.thirdView.md = md;
}else{
[weakSelf.dataArray addObject:md];
}
}
}else{
[weakSelf.dataArray addObjectsFromArray:list];
}
[self.tableView reloadData];
if (list.count == 0) {
self.tableView.mj_footer.state = MJRefreshStateNoMoreData;
}else{
[self.tableView.mj_footer endRefreshing];
}
[self.tableView.mj_header endRefreshing];
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
[self.tableView.mj_header endRefreshing];
[self.tableView.mj_footer endRefreshing];
}];
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return self.dataArray.count;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
QXBlackListCell *cell = [QXBlackListCell cellWithTableView:tableView];
cell.cellType = QXBlackListCellTypeRank;
cell.backgroundColor = [UIColor clearColor];
cell.titleLabel.text = [NSString stringWithFormat:@"%ld",indexPath.row+4];
cell.rankModel = self.dataArray[indexPath.row];
return cell;
}
-(void)showInView:(UIView *)view{
self.bgView.y = SCREEN_HEIGHT;
[view addSubview:self];
[UIView animateWithDuration:0.3 animations:^{
self.bgView.y = ScaleWidth(144);
}];
}
-(void)hide{
[UIView animateWithDuration:0.3 animations:^{
self.bgView.y = SCREEN_HEIGHT;
} completion:^(BOOL finished) {
[self removeFromSuperview];
}];
}
-(NSMutableArray *)dataArray{
if (!_dataArray) {
_dataArray = [NSMutableArray array];
}
return _dataArray;
}
@end

View File

@@ -0,0 +1,55 @@
//
// QXRoomAuctionResultView.h
// QXLive
//
// Created by 启星 on 2025/6/30.
//
#import <UIKit/UIKit.h>
#import "QXTimer.h"
#import "QXRoomModel.h"
NS_ASSUME_NONNULL_BEGIN
@interface QXRoomAuctionResultView : UIView
@property (nonatomic,strong)QXRoomAuctionUser *user;
@property (nonatomic,strong)QXRoomAuctionUser *getUser;
-(instancetype)initWithStyle:(BOOL)isSuccess isRealLove:(BOOL)isRealLove;
-(void)showInView:(UIView *)view;
-(void)hide;
-(void)setResultWithUser:(QXRoomAuctionUser*)user getUser:(QXRoomAuctionUser *)getUser;
@end
@interface QXRoomAuctionFailView : UIView
@property (nonatomic,strong)UIImageView *bgImageView;
@property (nonatomic,strong)UILabel *titleLabel;
@property (nonatomic,strong)UILabel *messageLabel;
@property (nonatomic,strong)UIButton *closeBtn;
@property (nonatomic,strong)QXTimer *timer;
@property (nonatomic,copy)void(^closeActionBlock)(void);
-(void)startTimer;
@end
@interface QXRoomAuctionSuccessView : UIView
-(instancetype)initWithIsRealLove:(BOOL)isRealLove;
@property (nonatomic,strong)UIImageView *bgImageView;
@property (nonatomic,strong)UIImageView *leftHeaderView;
@property (nonatomic,strong)UILabel *leftNameLabel;
@property (nonatomic,strong)UIImageView *rightHeaderView;
@property (nonatomic,strong)UILabel *rightNameLabel;
@property (nonatomic,strong)UILabel *resultLabel;
@property (nonatomic,assign)BOOL isRealLove;
@property (nonatomic,strong)QXTimer *timer;
@property (nonatomic,copy)void(^closeActionBlock)(void);
-(void)startTimer;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,274 @@
//
// QXRoomAuctionResultView.m
// QXLive
//
// Created by on 2025/6/30.
//
#import "QXRoomAuctionResultView.h"
@interface QXRoomAuctionResultView()
@property (nonatomic,assign)BOOL isSuccess;
@property (nonatomic,assign)BOOL isRealLove;
@property (nonatomic,strong)QXRoomAuctionFailView *failView;
@property (nonatomic,strong)QXRoomAuctionSuccessView *successView;
@end
@implementation QXRoomAuctionResultView
-(instancetype)initWithStyle:(BOOL)isSuccess isRealLove:(BOOL)isRealLove{
self = [super init];
if (self) {
self.isSuccess = isSuccess;
self.isRealLove = isRealLove;
self.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
[self initSubviews];
}
return self;
}
-(void)initSubviews{
self.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.4];
MJWeakSelf
if (self.isSuccess) {
self.successView = [[QXRoomAuctionSuccessView alloc] initWithIsRealLove:self.isRealLove];
self.successView.alpha = 0;
self.successView.closeActionBlock = ^{
[weakSelf hide];
};
[self addSubview:self.successView];
}else{
self.failView = [[QXRoomAuctionFailView alloc] init];
self.failView.closeActionBlock = ^{
[weakSelf hide];
};
[self addSubview:self.failView];
}
}
-(void)setResultWithUser:(QXRoomAuctionUser *)user getUser:(QXRoomAuctionUser *)getUser{
[self.successView.leftHeaderView sd_setImageWithURL:[NSURL URLWithString:user.avatar]];
self.successView.leftNameLabel.text = user.nickname;
[self.successView.rightHeaderView sd_setImageWithURL:[NSURL URLWithString:getUser.avatar]];
self.successView.rightNameLabel.text = getUser.nickname;
self.successView.resultLabel.text = [NSString stringWithFormat:@"%@签约成功",user.relation_name];
}
-(void)showInView:(UIView *)view{
[view addSubview:self];
if (self.isSuccess) {
// self.successView.resultLabel.text = @"";
[UIView animateWithDuration:0.3 animations:^{
self.successView.alpha = 1;
} completion:^(BOOL finished) {
[self.successView startTimer];
}];
}else{
[UIView animateWithDuration:0.3 delay:0 usingSpringWithDamping:0.5 initialSpringVelocity:1.0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
self.failView.y = (SCREEN_HEIGHT-ScaleWidth(238))/2.0;
} completion:^(BOOL finished) {
[self.failView startTimer];
}];
}
}
-(void)hide{
if (self.isSuccess) {
[UIView animateWithDuration:0.3 animations:^{
self.successView.alpha = 0;
} completion:^(BOOL finished) {
[self removeFromSuperview];
}];
}else{
[UIView animateWithDuration:0.3 delay:0 usingSpringWithDamping:0.5 initialSpringVelocity:1.0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
self.failView.y = SCREEN_HEIGHT;
} completion:^(BOOL finished) {
[self removeFromSuperview];
}];
}
}
@end
@implementation QXRoomAuctionFailView
- (instancetype)init
{
self = [super init];
if (self) {
CGFloat height = ScaleWidth(238);
self.frame = CGRectMake(15, -height, SCREEN_WIDTH-30, height);
[self initSubviews];
}
return self;
}
-(void)initSubviews{
self.bgImageView = [[UIImageView alloc] initWithFrame:self.bounds];
self.bgImageView.image = [UIImage imageNamed:@"room_auction_result_bg"];
self.bgImageView.contentMode = UIViewContentModeScaleToFill;
[self addSubview:self.bgImageView];
self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, 12, self.width-32, 24)];
self.titleLabel.font = [UIFont boldSystemFontOfSize:14];
self.titleLabel.textColor = RGB16(0x333333);
self.titleLabel.text = @"竞拍结束";
self.titleLabel.textAlignment = NSTextAlignmentCenter;
[self addSubview:self.titleLabel];
self.messageLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, self.titleLabel.bottom+32, self.width-32, 24)];
self.messageLabel.font = [UIFont boldSystemFontOfSize:14];
self.messageLabel.textColor = RGB16(0x333333);
self.messageLabel.text = @"本次竞拍已结束,期待您的下次参与";
self.messageLabel.textAlignment = NSTextAlignmentCenter;
[self addSubview:self.messageLabel];
self.closeBtn = [[UIButton alloc] initWithFrame:CGRectMake(80, self.height-24-42, self.width-160, 42)];
[self.closeBtn addRoundedCornersWithRadius:21];
self.closeBtn.backgroundColor = QXConfig.themeColor;
[self.closeBtn setTitle:QXText(@"知道了") forState:(UIControlStateNormal)];
[self.closeBtn setTitleColor:QXConfig.btnTextColor forState:(UIControlStateNormal)];
self.closeBtn.titleLabel.font = [UIFont systemFontOfSize:14];
[self.closeBtn addTarget:self action:@selector(closeAction) forControlEvents:(UIControlEventTouchUpInside)];
[self addSubview:self.closeBtn];
}
-(void)startTimer{
__block int timeCount = 3;
MJWeakSelf
_timer = [QXTimer scheduledTimerWithTimeInterval:1 repeats:YES queue:dispatch_get_main_queue() block:^{
timeCount--;
if (timeCount<=0) {
[weakSelf closeAction];
}else{
[self->_closeBtn setTitle:[NSString stringWithFormat:@"%@(%d)",QXText(@"知道了"),timeCount] forState:(UIControlStateNormal)];
}
}];
}
-(void)closeAction{
[self->_timer invalidate];
self->_timer = nil;
if (self.closeActionBlock) {
self.closeActionBlock();
}
}
@end
@implementation QXRoomAuctionSuccessView
//- (instancetype)init
//{
// self = [super init];
// if (self) {
// self.frame = CGRectMake(0, ScaleWidth(219), 372, 306);
// [self initSubviews];
// }
// return self;
//}
- (instancetype)initWithIsRealLove:(BOOL)isRealLove
{
self = [super init];
if (self) {
_isRealLove = isRealLove;
if (isRealLove) {
self.frame = CGRectMake(0, ScaleWidth(219), 372, 306);
}else{
self.frame = CGRectMake(0, ScaleWidth(219), SCREEN_WIDTH, 402);
}
[self initSubviews];
}
return self;
}
-(void)initSubviews{
self.bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"room_auction_result_suc"]];
self.bgImageView.frame = self.bounds;
[self addSubview:self.bgImageView];
self.leftHeaderView = [[UIImageView alloc] initWithFrame:CGRectMake(100, 90, 57, 57)];
self.leftHeaderView.contentMode = UIViewContentModeScaleAspectFill;
self.leftHeaderView.clipsToBounds = YES;
[self.leftHeaderView addRoundedCornersWithRadius:23.5];
[self addSubview:self.leftHeaderView];
self.leftNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.leftHeaderView.left, self.leftHeaderView.bottom+1, self.leftHeaderView.width, 16)];
self.leftNameLabel.font = [UIFont fontWithName:@"YouSheBiaoTiHei" size:12];
self.leftNameLabel.textColor = RGB16(0xFFE8B0);
self.leftNameLabel.textAlignment = NSTextAlignmentCenter;
[self addSubview:self.leftNameLabel];
self.rightHeaderView = [[UIImageView alloc] initWithFrame:CGRectMake(self.width-100-57, self.leftHeaderView.top, 57, 57)];
self.rightHeaderView.contentMode = UIViewContentModeScaleAspectFill;
self.rightHeaderView.clipsToBounds = YES;
[self.rightHeaderView addRoundedCornersWithRadius:23.5];
[self addSubview:self.rightHeaderView];
self.rightNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.rightHeaderView.left, self.rightHeaderView.bottom+1, self.rightHeaderView.width, 16)];
self.rightNameLabel.font = [UIFont fontWithName:@"YouSheBiaoTiHei" size:12];
self.rightNameLabel.textColor = RGB16(0xFFE8B0);
self.rightNameLabel.textAlignment = NSTextAlignmentCenter;
[self addSubview:self.rightNameLabel];
self.resultLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, self.rightNameLabel.bottom+18, self.width, 17)];
self.resultLabel.font = [UIFont fontWithName:@"YouSheBiaoTiHei" size:14];
self.resultLabel.textColor = UIColor.whiteColor;
// self.resultLabel.transform = CGAffineTransformMakeRotation(-6 * M_PI/180.0);
self.resultLabel.textAlignment = NSTextAlignmentCenter;
[self addSubview:self.resultLabel];
if (self.isRealLove) {
self.bgImageView.frame = self.bounds;
self.bgImageView.image = [UIImage imageNamed:@"room_auction_result_suc_real"];
self.leftHeaderView.frame = CGRectMake(100, 90, 57, 57);
self.rightHeaderView.frame = CGRectMake(self.width-100-57, self.leftHeaderView.top, 57, 57);
self.rightNameLabel.frame = CGRectMake(self.rightHeaderView.left, self.rightHeaderView.bottom+1, self.rightHeaderView.width, 16);
self.leftNameLabel.frame = CGRectMake(self.leftHeaderView.left, self.leftHeaderView.bottom+1, self.leftHeaderView.width, 16);
self.rightNameLabel.textColor = RGB16(0xFFE8B0);
self.leftNameLabel.textColor = RGB16(0xFFE8B0);
self.rightNameLabel.font = [UIFont fontWithName:@"YouSheBiaoTiHei" size:12];
self.leftNameLabel.font = [UIFont fontWithName:@"YouSheBiaoTiHei" size:12];
self.rightNameLabel.textColor = RGB16(0xFFE8B0);
self.resultLabel.frame = CGRectMake(0, self.rightNameLabel.bottom+18, self.width, 17);
self.resultLabel.font = [UIFont fontWithName:@"YouSheBiaoTiHei" size:14];
self.resultLabel.textColor = UIColor.whiteColor;
[self.rightHeaderView addRoundedCornersWithRadius:23.5];
[self.leftHeaderView addRoundedCornersWithRadius:23.5];
}else{
self.bgImageView.image = [UIImage imageNamed:@"room_auction_result_suc"];
self.bgImageView.frame = CGRectMake((self.width-302)/2, 0, 302, self.height);
self.leftHeaderView.frame = CGRectMake(self.width/2-68, self.height-73-68, 68, 68);
self.rightHeaderView.frame = CGRectMake(self.leftHeaderView.right, self.leftHeaderView.top, 68,68);
self.rightNameLabel.frame = CGRectMake(self.rightHeaderView.left, self.rightHeaderView.bottom+1, self.rightHeaderView.width, 21);
self.leftNameLabel.frame = CGRectMake(self.leftHeaderView.left, self.leftHeaderView.bottom+1, self.leftHeaderView.width, 21);
self.rightNameLabel.textColor = RGB16(0xFE435B);
self.leftNameLabel.textColor = RGB16(0xFE435B);
self.rightNameLabel.font = [UIFont systemFontOfSize:14];
self.leftNameLabel.font = [UIFont systemFontOfSize:14];
self.resultLabel.frame = CGRectMake(0, 19, self.width, 42);
self.resultLabel.font = [UIFont fontWithName:@"YouSheBiaoTiHei" size:32];
self.resultLabel.textColor = RGB16(0xFFA4C8);
[self.rightHeaderView addRoundedCornersWithRadius:34];
[self.leftHeaderView addRoundedCornersWithRadius:34];
}
}
-(void)startTimer{
__block int timeCount = 3;
MJWeakSelf
_timer = [QXTimer scheduledTimerWithTimeInterval:1 repeats:YES queue:dispatch_get_main_queue() block:^{
timeCount--;
if (timeCount<=0) {
[weakSelf closeAction];
}
}];
}
-(void)closeAction{
[self->_timer invalidate];
self->_timer = nil;
if (self.closeActionBlock) {
self.closeActionBlock();
}
}
@end

View File

@@ -0,0 +1,31 @@
//
// QXSelectAuctionInfoView.h
// QXLive
//
// Created by 启星 on 2025/6/27.
//
#import <UIKit/UIKit.h>
#import "QXRoomRelationModel.h"
NS_ASSUME_NONNULL_BEGIN
@interface QXSelectAuctionInfoView : UIView
/// 是否是真爱拍
@property (nonatomic,assign)BOOL isRealLove;
@property (nonatomic,strong)NSString *roomId;
@property (nonatomic,strong)NSString *userId;
-(void)showInView:(UIView *)view;
-(void)hide;
@end
@interface QXSelectAuctionInfoHeaderView : UICollectionReusableView
@property (nonatomic,strong) UILabel *titleLabel;
@end
@interface QXSelectAuctionInfoCell : UICollectionViewCell
@property (nonatomic,strong) QXRoomRelationModel *model;
@property (nonatomic,strong) QXRoomRelationModel *timeModel;
@property (nonatomic,strong) UIButton *selectedBtn;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,428 @@
//
// QXSelectAuctionInfoView.m
// QXLive
//
// Created by on 2025/6/27.
//
#import "QXSelectAuctionInfoView.h"
#import "QXGiftCell.h"
#import "QXMineNetwork.h"
@interface QXSelectAuctionInfoView()<UICollectionViewDataSource,UICollectionViewDelegate,UICollectionViewDelegateFlowLayout,UIGestureRecognizerDelegate>
@property (nonatomic,strong)UIView *bgView;
@property (nonatomic,strong)UIImageView *bgImageView;
@property (nonatomic,strong)UILabel *titleLabel;
//@property (nonatomic,strong)UILabel *contenLabel;
@property (nonatomic,strong)UICollectionView *collectionView;
@property (nonatomic,strong)UIButton *commitBtn;
@property (nonatomic,strong)NSMutableArray *relationshipArray;
@property (nonatomic,strong)NSMutableArray *timeArray;
@property (nonatomic,strong)NSMutableArray *giftArray;
@property (nonatomic,strong)QXRoomRelationModel *relationModel;
@property (nonatomic,strong)QXRoomRelationModel *timeModel;
@property (nonatomic,assign)QXGiftModel *giftModel;
@property (nonatomic,assign)NSInteger giftSelctedIndex;
@end
@implementation QXSelectAuctionInfoView
- (instancetype)init
{
self = [super init];
if (self) {
self.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
[self initSubviews];
}
return self;
}
-(void)initSubviews{
// UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hide)];
// tap.delegate = self;
// [self addGestureRecognizer:tap];
self.bgView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, ScaleWidth(429)+kSafeAreaBottom)];
[self addSubview:self.bgView];
self.bgImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.bgView.width, self.bgView.height)];
self.bgImageView.image = [UIImage imageNamed:@"room_sound_bg"];
[self.bgView addSubview:self.bgImageView];
self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, 16, self.bgView.width-32, 24)];
self.titleLabel.font = [UIFont systemFontOfSize:16];
self.titleLabel.textColor = UIColor.whiteColor;
self.titleLabel.textAlignment = NSTextAlignmentCenter;
self.titleLabel.text = @"选择内容";
[self.bgView addSubview:self.titleLabel];
// self.contenLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, self.titleLabel.bottom, self.bgView.width-32, 24)];
// self.contenLabel.font = [UIFont systemFontOfSize:14];
// self.contenLabel.textColor = UIColor.whiteColor;
// [self.bgView addSubview:self.contenLabel];
self.commitBtn = [[UIButton alloc] initWithFrame:CGRectMake(38, self.bgView.height-kSafeAreaBottom-12-42, self.bgView.width-76, 42)];
[self.commitBtn setTitle:@"确定" forState:(UIControlStateNormal)];
self.commitBtn.titleLabel.font = [UIFont systemFontOfSize:14];
[self.commitBtn setTitleColor:QXConfig.btnTextColor forState:(UIControlStateNormal)];
self.commitBtn.backgroundColor = QXConfig.themeColor;
[self.commitBtn addRoundedCornersWithRadius:21];
[self.commitBtn addTarget:self action:@selector(commitAction) forControlEvents:(UIControlEventTouchUpInside)];
[self.bgView addSubview:self.commitBtn];
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
layout.minimumLineSpacing = 12;
layout.minimumInteritemSpacing = 12;
layout.sectionInset = UIEdgeInsetsMake(0, 16, 0, 16);
layout.scrollDirection = UICollectionViewScrollDirectionVertical;
self.collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, self.titleLabel.bottom, self.bgView.width, self.commitBtn.top-self.titleLabel.bottom-10) collectionViewLayout:layout];
[self.collectionView registerNib:[UINib nibWithNibName:@"QXGiftCell" bundle:[NSBundle mainBundle]] forCellWithReuseIdentifier:@"QXGiftCell"];
[self.collectionView registerClass:[QXSelectAuctionInfoCell class] forCellWithReuseIdentifier:@"QXSelectAuctionInfoCell"];
[self.collectionView registerClass:[QXSelectAuctionInfoHeaderView class] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"QXSelectAuctionInfoHeaderView"];
self.collectionView.delegate = self;
self.collectionView.dataSource = self;
self.collectionView.showsHorizontalScrollIndicator = NO;
self.collectionView.showsVerticalScrollIndicator = NO;
self.collectionView.bounces = NO;
self.collectionView.backgroundColor = [UIColor clearColor];
[self.bgView addSubview:self.collectionView];
}
-(void)commitAction{
if (self.relationModel == nil) {
showToast(@"请选择关系");
return;
}
if (!self.isRealLove) {
if (self.timeModel == nil) {
showToast(@"请选择时间");
return;
}
}
if (self.giftModel == nil) {
showToast(@"请选择礼物");
return;
}
MJWeakSelf
[QXMineNetwork roomAuctionStartWithRoomId:self.roomId user_id:self.userId gift_id:self.giftModel.gift_id relation_id:self.relationModel.relation_id auction_type:self.isRealLove?@"1":@"2" time_day:self.timeModel.relation_id successBlock:^(NSDictionary * _Nonnull dict) {
[weakSelf hide];
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
showToast(msg);
}];
}
-(void)getRelationShipList{
MJWeakSelf
[QXMineNetwork roomRelationListWithType:self.isRealLove?@"1":@"2" successBlock:^(NSArray<QXRoomRelationModel *> * _Nonnull list) {
[weakSelf.relationshipArray removeAllObjects];
[weakSelf.relationshipArray addObjectsFromArray:list];
[weakSelf.collectionView reloadSections:[NSIndexSet indexSetWithIndex:0]];
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
}];
}
-(void)getGiftList{
MJWeakSelf
[QXMineNetwork giftListWithLabel:@"99" roomId:self.roomId successBlock:^(NSArray<QXGiftModel *> * _Nonnull list) {
[weakSelf.giftArray removeAllObjects];
[weakSelf.giftArray addObjectsFromArray:list];
[weakSelf.collectionView reloadData];
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
}];
}
//-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{
// return touch.view == self;
//}
-(void)setIsRealLove:(BOOL)isRealLove{
self.giftModel = nil;
self.relationModel = nil;
self.timeModel = nil;
_timeArray = nil;
self.giftSelctedIndex = -1;
_isRealLove = isRealLove;
[self getRelationShipList];
[self getGiftList];
[self.collectionView reloadData];
}
-(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView{
if (self.isRealLove) {
return 2;
}else{
return 3;
}
}
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
if (section == 0) {
return self.relationshipArray.count;
}else if(section == 1){
if (self.isRealLove) {
return self.giftArray.count;
}else{
return self.timeArray.count;
}
}else{
return self.giftArray.count;
}
}
-(__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
if (indexPath.section == 0) {
QXSelectAuctionInfoCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"QXSelectAuctionInfoCell" forIndexPath:indexPath];
cell.model = self.relationshipArray[indexPath.row];
return cell;
}else if(indexPath.section == 1){
if (self.isRealLove) {
QXGiftCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"QXGiftCell" forIndexPath:indexPath];
cell.cellType = QXGiftCellTypeLive;
cell.roomGiftModel = self.giftArray[indexPath.row];
if (self.giftSelctedIndex == indexPath.row) {
cell.selecteBtn.selected = YES;
}else{
cell.selecteBtn.selected = NO;
}
return cell;
}else{
QXSelectAuctionInfoCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"QXSelectAuctionInfoCell" forIndexPath:indexPath];
cell.model = self.timeArray[indexPath.row];
return cell;
}
}else{
QXGiftCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"QXGiftCell" forIndexPath:indexPath];
cell.cellType = QXGiftCellTypeLive;
cell.roomGiftModel = self.giftArray[indexPath.row];
if (self.giftSelctedIndex == indexPath.row) {
cell.selecteBtn.selected = YES;
}else{
cell.selecteBtn.selected = NO;
}
return cell;
}
}
-(UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath{
if ([kind isEqualToString:UICollectionElementKindSectionHeader]) {
QXSelectAuctionInfoHeaderView *header = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"QXSelectAuctionInfoHeaderView" forIndexPath:indexPath];
if (indexPath.section == 0) {
header.titleLabel.text = @"关系";
}else if(indexPath.section == 1){
if (self.isRealLove) {
header.titleLabel.text = @"礼物";
}else{
header.titleLabel.text = @"时间";
}
}else{
header.titleLabel.text = @"礼物";
}
return header;
}
return nil;
}
-(CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section{
return CGSizeMake(SCREEN_WIDTH, 30);
}
-(CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath{
if (indexPath.section == 0) {
CGFloat width = (SCREEN_WIDTH-16*2-12*3)/4;
return CGSizeMake(width, 44);
}else if(indexPath.section == 1){
if (self.isRealLove) {
CGFloat width = (SCREEN_WIDTH-16*2-12*3)/4;
return CGSizeMake(width, ScaleWidth(119));
}else{
CGFloat width = (SCREEN_WIDTH-16*2-12*3)/4;
return CGSizeMake(width, 44);
}
}else{
CGFloat width = (SCREEN_WIDTH-16*2-12*3)/4;
return CGSizeMake(width, ScaleWidth(119));
}
}
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
if (indexPath.section == 0) {
QXRoomRelationModel *model = self.relationshipArray[indexPath.row];
if (model.isSelected) {
return;
}
self.relationModel.isSelected = NO;
model.isSelected = YES;
self.relationModel = model;
[collectionView reloadData];
}else if(indexPath.section == 1){
if (self.isRealLove) {
QXGiftModel *model = self.giftArray[indexPath.row];
self.giftSelctedIndex = indexPath.row;
self.giftModel = model;
[collectionView reloadData];
}else{
QXRoomRelationModel *model = self.timeArray[indexPath.row];
if (model.isSelected) {
return;
}
self.timeModel.isSelected = NO;
model.isSelected = YES;
self.timeModel = model;
[collectionView reloadData];
}
}else{
QXGiftModel *model = self.giftArray[indexPath.row];
self.giftSelctedIndex = indexPath.row;
self.giftModel = model;
[collectionView reloadData];
}
}
-(void)showInView:(UIView *)view{
self.bgView.y = SCREEN_HEIGHT;
[view addSubview:self];
[UIView animateWithDuration:0.3 animations:^{
self.bgView.y = SCREEN_HEIGHT-ScaleWidth(429)-kSafeAreaBottom;
}];
}
-(void)hide{
[UIView animateWithDuration:0.3 animations:^{
self.bgView.y = SCREEN_HEIGHT;
} completion:^(BOOL finished) {
[self removeFromSuperview];
}];
}
-(NSMutableArray *)relationshipArray{
if (!_relationshipArray) {
_relationshipArray = [NSMutableArray array];
}
return _relationshipArray;
}
-(NSMutableArray *)timeArray{
if (!_timeArray) {
QXRoomRelationModel *md = [[QXRoomRelationModel alloc] init];
md.name = @"1天";
md.relation_id = @"24";
QXRoomRelationModel *md1 = [[QXRoomRelationModel alloc] init];
md1.name = @"3天";
md1.relation_id = @"72";
QXRoomRelationModel *md2 = [[QXRoomRelationModel alloc] init];
md2.name = @"5天";
md2.relation_id = @"120";
QXRoomRelationModel *md3 = [[QXRoomRelationModel alloc] init];
md3.name = @"10天";
md3.relation_id = @"240";
QXRoomRelationModel *md4 = [[QXRoomRelationModel alloc] init];
md4.name = @"15天";
md4.relation_id = @"360";
QXRoomRelationModel *md5 = [[QXRoomRelationModel alloc] init];
md5.name = @"20天";
md5.relation_id = @"480";
QXRoomRelationModel *md6 = [[QXRoomRelationModel alloc] init];
md6.name = @"25天";
md6.relation_id = @"600";
QXRoomRelationModel *md7 = [[QXRoomRelationModel alloc] init];
md7.name = @"30天";
md7.relation_id = @"720";
_timeArray = [NSMutableArray arrayWithArray:@[
md,md1,md2,md3,md4,md5,md6,md7
]];
}
return _timeArray;
}
-(NSMutableArray *)giftArray{
if (!_giftArray) {
_giftArray = [NSMutableArray array];
}
return _giftArray;
}
@end
@implementation QXSelectAuctionInfoHeaderView
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self initSubviews];
}
return self;
}
-(void)initSubviews{
UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, 0, SCREEN_WIDTH-32, 30)];
titleLabel.textColor = UIColor.whiteColor;
titleLabel.font = [UIFont systemFontOfSize:13];
// if (indexPath.section == 0) {
// titleLabel.text = @"关系";
// }else if(indexPath.section == 1){
// if (self.isRealLove) {
// titleLabel.text = @"礼物";
// }else{
// titleLabel.text = @"时间";
// }
// }else{
// titleLabel.text = @"礼物";
// }
[self addSubview:titleLabel];
self.titleLabel = titleLabel;
}
@end
@implementation QXSelectAuctionInfoCell
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self initSubviews];
}
return self;
}
-(void)setModel:(QXRoomRelationModel *)model{
_model = model;
[self.selectedBtn setTitle:model.name forState:(UIControlStateNormal)];
self.selectedBtn.selected = model.isSelected;
}
-(void)setTimeModel:(QXRoomRelationModel *)timeModel{
_timeModel = timeModel;
[self.selectedBtn setTitleColor:QXConfig.themeColor forState:(UIControlStateSelected)];
[self.selectedBtn setTitleColor:RGB16(0x333333) forState:(UIControlStateNormal)];
[self.selectedBtn setTitle:timeModel.name forState:(UIControlStateNormal)];
self.selectedBtn.layer.borderColor = RGB16(0xF1F2F3).CGColor;
self.selectedBtn.layer.borderWidth = 1;
self.selectedBtn.selected = timeModel.isSelected;
}
-(void)initSubviews{
self.selectedBtn = [[UIButton alloc] init];
[self.selectedBtn setBackgroundImage:[UIImage imageNamed:@"room_sound_sel"] forState:(UIControlStateSelected)];
[self.selectedBtn setBackgroundImage:[UIImage imageWithColor:RGB16A(0xE9E9E9, 0.2)] forState:(UIControlStateNormal)];
[self.selectedBtn setTitleColor:UIColor.whiteColor forState:(UIControlStateNormal)];
[self.selectedBtn setTitleColor:RGB16(0x333333) forState:(UIControlStateSelected)];
self.selectedBtn.titleLabel.font = [UIFont systemFontOfSize:14];
[self.selectedBtn addRoundedCornersWithRadius:12];
self.selectedBtn.userInteractionEnabled = NO;
[self.contentView addSubview:self.selectedBtn];
[self.selectedBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.bottom.right.left.equalTo(self.contentView);
}];
// self.titleLabel = [[UILabel alloc] init];
// self.titleLabel
}
@end

View File

@@ -0,0 +1,36 @@
//
// QXRoomRankSubView.h
// QXLive
//
// Created by 启星 on 2025/6/9.
//
#import <UIKit/UIKit.h>
#import "JXCategoryView.h"
#import "QXRoomModel.h"
#import "QXRoomSeatDelegate.h"
NS_ASSUME_NONNULL_BEGIN
@interface QXRoomRankSubView : UIView<JXCategoryListContentViewDelegate>
@property (nonatomic,strong)NSString*roomId;
@property (nonatomic,strong)NSString*type;
@property (nonatomic,weak)id<QXRoomSeatDelegate>delegate;
@end
@interface QXRoomRankTopThreeView :UIView
@property (nonatomic,strong)UIImageView *headerImageView;
@property (nonatomic,strong)UIImageView *borderImageView;
@property (nonatomic,strong)UILabel *onlineLabel;
@property (nonatomic,strong)UILabel *nameLabel;
@property (nonatomic,strong)UIView *iconBgView;
@property (nonatomic,strong)UIButton *rankBtn;
@property (nonatomic,assign)NSInteger number;
@property (nonatomic,strong)QXRoomOnlineList*md;
@property (nonatomic,weak)id<QXRoomSeatDelegate>delegate;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,418 @@
//
// QXRoomRankSubView.m
// QXLive
//
// Created by on 2025/6/9.
//
#import "QXRoomRankSubView.h"
#import "QXBlackListCell.h"
#import "QXMineNetwork.h"
@interface QXRoomRankSubView()<UITableViewDataSource,UITableViewDelegate,QXRoomSeatDelegate>
@property (nonatomic,strong)UIView *topBgView;
@property (nonatomic,strong)UIButton *hourBtn;
@property (nonatomic,strong)UIButton *dayBtn;
@property (nonatomic,strong)UIButton *weekBtn;
@property (nonatomic,strong)UIButton *selectedBtn;
@property (nonatomic,strong)UIView *tableHeaderView;
@property (nonatomic,strong)QXRoomRankTopThreeView *firstView;
@property (nonatomic,strong)QXRoomRankTopThreeView *secondView;
@property (nonatomic,strong)QXRoomRankTopThreeView *thirdView;
@property (nonatomic,strong)UITableView *tableView;
@property (nonatomic,strong)NSMutableArray *dataArray;
@property (nonatomic,strong)NSMutableArray *topArray;
@property (nonatomic,assign)NSInteger page;
@end
@implementation QXRoomRankSubView
-(UIView *)listView{
return self;
}
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self initSubviews];
}
return self;
}
-(void)initSubviews{
self.page = 1;
self.topBgView = [[UIView alloc] initWithFrame:CGRectMake(16, 8, self.width-32, 40)];
self.topBgView.backgroundColor = RGB16(0x2B2482);
[self.topBgView addRoundedCornersWithRadius:20];
[self addSubview:self.topBgView];
self.hourBtn = [[UIButton alloc] init];
[self.hourBtn setTitle:QXText(@"小时榜") forState:(UIControlStateNormal)];
[self.hourBtn setBackgroundImage:[UIImage imageWithColor:[UIColor clearColor]] forState:(UIControlStateNormal)];
[self.hourBtn setBackgroundImage:[UIImage imageWithColor:[UIColor whiteColor]] forState:(UIControlStateSelected)];
[self.hourBtn setTitleColor:RGB16(0xACA3ED) forState:(UIControlStateNormal)];
[self.hourBtn setTitleColor:QXConfig.textColor forState:(UIControlStateSelected)];
[self.hourBtn addRoundedCornersWithRadius:15];
self.hourBtn.titleLabel.font = [UIFont boldSystemFontOfSize:14];
[self.hourBtn addTarget:self action:@selector(typeAction:) forControlEvents:(UIControlEventTouchUpInside)];
[self.topBgView addSubview:self.hourBtn];
self.dayBtn = [[UIButton alloc] init];
[self.dayBtn setTitle:QXText(@"日榜") forState:(UIControlStateNormal)];
[self.dayBtn setBackgroundImage:[UIImage imageWithColor:[UIColor clearColor]] forState:(UIControlStateNormal)];
[self.dayBtn setBackgroundImage:[UIImage imageWithColor:[UIColor whiteColor]] forState:(UIControlStateSelected)];
[self.dayBtn setTitleColor:RGB16(0xACA3ED) forState:(UIControlStateNormal)];
[self.dayBtn setTitleColor:QXConfig.textColor forState:(UIControlStateSelected)];
[self.dayBtn addRoundedCornersWithRadius:15];
self.dayBtn.titleLabel.font = [UIFont boldSystemFontOfSize:14];
[self.dayBtn addTarget:self action:@selector(typeAction:) forControlEvents:(UIControlEventTouchUpInside)];
[self.topBgView addSubview:self.dayBtn];
self.weekBtn = [[UIButton alloc] init];
[self.weekBtn setTitle:QXText(@"周榜") forState:(UIControlStateNormal)];
[self.weekBtn setBackgroundImage:[UIImage imageWithColor:[UIColor clearColor]] forState:(UIControlStateNormal)];
[self.weekBtn setBackgroundImage:[UIImage imageWithColor:[UIColor whiteColor]] forState:(UIControlStateSelected)];
[self.weekBtn setTitleColor:RGB16(0xACA3ED) forState:(UIControlStateNormal)];
[self.weekBtn setTitleColor:QXConfig.textColor forState:(UIControlStateSelected)];
[self.weekBtn addRoundedCornersWithRadius:15];
self.weekBtn.titleLabel.font = [UIFont boldSystemFontOfSize:14];
[self.weekBtn addTarget:self action:@selector(typeAction:) forControlEvents:(UIControlEventTouchUpInside)];
[self.topBgView addSubview:self.weekBtn];
CGFloat btnWidth = ScaleWidth(72);
[self.dayBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self.topBgView);
make.height.mas_equalTo(30);
make.width.mas_equalTo(btnWidth);
make.centerY.equalTo(self.topBgView);
}];
[self.hourBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.dayBtn.mas_left).offset(-16);
make.height.mas_equalTo(30);
make.width.mas_equalTo(btnWidth);
make.centerY.equalTo(self.topBgView);
}];
[self.weekBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.dayBtn.mas_right).offset(16);
make.height.mas_equalTo(30);
make.width.mas_equalTo(btnWidth);
make.centerY.equalTo(self.topBgView);
}];
self.tableHeaderView = [[UIView alloc] initWithFrame:CGRectMake(0, self.topBgView.bottom+38, self.width, 220)];
CGFloat itemWidth = (self.width-36)/3;
self.secondView = [[QXRoomRankTopThreeView alloc] initWithFrame:CGRectMake(18, 50, itemWidth, 135)];
self.secondView.number = 2;
self.secondView.delegate = self;
[self.tableHeaderView addSubview:self.secondView];
self.firstView = [[QXRoomRankTopThreeView alloc] initWithFrame:CGRectMake(self.secondView.right, 0, itemWidth, 161)];
self.firstView.number = 1;
self.firstView.delegate = self;
[self.tableHeaderView addSubview:self.firstView];
self.thirdView = [[QXRoomRankTopThreeView alloc] initWithFrame:CGRectMake(self.firstView.right, 50, itemWidth, 135)];
self.thirdView.number = 3;
self.thirdView.delegate = self;
[self.tableHeaderView addSubview:self.thirdView];
[self addSubview:self.tableHeaderView];
self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, self.tableHeaderView.bottom, self.width, self.height-self.tableHeaderView.bottom) style:(UITableViewStylePlain)];
self.tableView.delegate = self;
self.tableView.dataSource = self;
self.tableView.backgroundColor = [UIColor clearColor];
self.tableView.rowHeight = 60;
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
MJWeakSelf
self.tableView.mj_footer = [MJRefreshBackStateFooter footerWithRefreshingBlock:^{
weakSelf.page++;
[weakSelf getRankList];
}];
self.tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
weakSelf.page = 1;
[weakSelf getRankList];
}];
[self addSubview:self.tableView];
// self.tableView.tableHeaderView = self.tableHeaderView;
self.hourBtn.selected = YES;
self.selectedBtn = self.hourBtn;
}
-(void)setRoomId:(NSString *)roomId{
_roomId = roomId;
self.page = 1;
[self getRankList];
}
-(void)getRankList{
NSString *time_type = @"1";
if (self.selectedBtn == self.hourBtn) {
time_type = @"1";
}else if(self.selectedBtn == self.dayBtn){
time_type = @"2";
}else if(self.selectedBtn == self.weekBtn){
time_type = @"3";
}
MJWeakSelf
[QXMineNetwork roomRankListWithRoomId:self.roomId type:self.type time_type:time_type page:self.page successBlock:^(NSArray<QXRoomOnlineList *> * _Nonnull list) {
if (weakSelf.page == 1) {
weakSelf.firstView.md = nil;
weakSelf.secondView.md = nil;
weakSelf.thirdView.md = nil;
[weakSelf.dataArray removeAllObjects];
[weakSelf.topArray removeAllObjects];
for (int i = 0 ; i < list.count; i++) {
QXRoomOnlineList*md = list[i];
if (i == 0) {
// [weakSelf.topArray addObject:md];
weakSelf.firstView.md = md;
}else if (i == 1) {
weakSelf.secondView.md = md;
}else if (i == 2) {
weakSelf.thirdView.md = md;
}else{
[weakSelf.dataArray addObject:md];
}
}
}else{
[weakSelf.dataArray addObjectsFromArray:list];
}
[self.tableView reloadData];
if (list.count == 0) {
self.tableView.mj_footer.state = MJRefreshStateNoMoreData;
}else{
[self.tableView.mj_footer endRefreshing];
}
[self.tableView.mj_header endRefreshing];
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
[self.tableView.mj_header endRefreshing];
[self.tableView.mj_footer endRefreshing];
}];
}
-(void)previewUserInfoWithUserId:(NSString *)userId{
if (self.delegate && [self.delegate respondsToSelector:@selector(previewUserInfoWithUserId:)]) {
[self.delegate previewUserInfoWithUserId:userId];
}
}
-(void)typeAction:(UIButton*)sender{
self.selectedBtn.selected = !self.selectedBtn.selected;
sender.selected = !sender.selected;
self.selectedBtn = sender;
[self getRankList];
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return self.dataArray.count;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
QXBlackListCell *cell = [QXBlackListCell cellWithTableView:tableView];
cell.cellType = QXBlackListCellTypeRank;
cell.backgroundColor = [UIColor clearColor];
cell.titleLabel.text = [NSString stringWithFormat:@"%ld",indexPath.row+4];
cell.rankModel = self.dataArray[indexPath.row];
return cell;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
QXRoomOnlineList *model = self.dataArray[indexPath.row];
if (self.delegate && [self.delegate respondsToSelector:@selector(previewUserInfoWithUserId:)]) {
[self.delegate previewUserInfoWithUserId:model.user_id];
}
}
-(NSMutableArray *)dataArray{
if (!_dataArray) {
_dataArray = [NSMutableArray array];
}
return _dataArray;
}
-(NSMutableArray *)topArray{
if (!_topArray) {
_topArray = [NSMutableArray array];
}
return _topArray;
}
@end
@implementation QXRoomRankTopThreeView
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self initSubviews];
}
return self;
}
-(void)setNumber:(NSInteger)number{
_number = number;
if (number == 1) {
self.borderImageView.image = [UIImage imageNamed:@"room_rank_first"];
}else if(number == 2){
self.borderImageView.image = [UIImage imageNamed:@"room_rank_second"];
[self.headerImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self);
make.top.equalTo(self).offset(10);
make.size.mas_equalTo(CGSizeMake(50, 50));
}];
[self.borderImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.centerX.centerY.equalTo(self.headerImageView);
make.size.mas_equalTo(CGSizeMake(64, 64));
}];
[self.nameLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.borderImageView.mas_bottom).offset(12);
make.left.right.equalTo(self);
make.height.mas_equalTo(21);
}];
}else{
self.borderImageView.image = [UIImage imageNamed:@"room_rank_third"];
[self.headerImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self);
make.top.equalTo(self).offset(10);
make.size.mas_equalTo(CGSizeMake(50, 50));
}];
[self.borderImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.centerX.centerY.equalTo(self.headerImageView);
make.size.mas_equalTo(CGSizeMake(64, 64));
}];
[self.nameLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.borderImageView.mas_bottom).offset(12);
make.left.right.equalTo(self);
make.height.mas_equalTo(21);
}];
}
}
-(void)setMd:(QXRoomOnlineList *)md{
_md = md;
if (md == nil) {
self.headerImageView.image = [UIImage imageNamed:@"user_header_placehoulder"];
self.nameLabel.text = @"虚位以待";
[self.rankBtn setTitle:@"0" forState:(UIControlStateNormal)];
[self.iconBgView removeAllSubviews];
return;
}
[self.headerImageView sd_setImageWithURL:[NSURL URLWithString:md.avatar] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]];
self.nameLabel.text = md.nickname?md.nickname:@"";
[self.iconBgView removeAllSubviews];
[self.rankBtn setTitle:[NSString stringWithFormat:@" %@",md.total?md.total:md.gift_prices] forState:(UIControlStateNormal)];
CGFloat iconWidth = UserIconWidth;
CGFloat iconHeight = UserIconHeight;
CGFloat margin = 6;
for (int i = 0 ; i < md.icon.count; i++) {
UIImageView *iconImageView = [[UIImageView alloc] init];
[iconImageView sd_setImageWithURL:[NSURL URLWithString:md.icon[i]]];
[self.iconBgView addSubview:iconImageView];
if (md.icon.count == 1) {
[iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(iconWidth);
make.height.mas_equalTo(iconHeight);
make.centerY.centerX.equalTo(self.iconBgView);
}];
}else if(md.icon.count == 2){
[iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(iconWidth);
make.height.mas_equalTo(iconHeight);
make.centerY.equalTo(self.iconBgView);
make.centerX.equalTo(self.iconBgView).offset(-UserIconWidth/2+(margin+iconWidth)*i);
}];
}else{
[iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(i*(iconWidth+margin));
make.width.mas_equalTo(iconWidth);
make.height.mas_equalTo(iconHeight);
make.centerY.equalTo(self.iconBgView);
}];
}
}
}
-(void)initSubviews{
self.headerImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"user_header_placehoulder"]];
[self.headerImageView addRoundedCornersWithRadius:32];
self.headerImageView.contentMode = UIViewContentModeScaleAspectFill;
[self addSubview:self.headerImageView];
MJWeakSelf
[self.headerImageView addTapBlock:^(id _Nonnull obj) {
if ([weakSelf.md.user_id isExist]) {
if (weakSelf.delegate && [weakSelf.delegate respondsToSelector:@selector(previewUserInfoWithUserId:)]) {
[weakSelf.delegate previewUserInfoWithUserId:weakSelf.md.user_id];
}
}
}];
[self.headerImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self);
make.top.equalTo(self).offset(10);
make.size.mas_equalTo(CGSizeMake(64, 64));
}];
self.borderImageView = [[UIImageView alloc] init];
self.borderImageView.contentMode = UIViewContentModeScaleToFill;
[self addSubview:self.borderImageView];
[self.borderImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.centerY.equalTo(self.headerImageView);
make.size.mas_equalTo(CGSizeMake(80, 80));
}];
self.onlineLabel = [[UILabel alloc] init];
self.onlineLabel.textColor = UIColor.whiteColor;
self.onlineLabel.font = [UIFont systemFontOfSize:10];
self.onlineLabel.textAlignment = NSTextAlignmentCenter;
self.onlineLabel.backgroundColor = RGB16(0x472ABF);
[self.onlineLabel addRoundedCornersWithRadius:7];
self.onlineLabel.text = QXText(@"在线");
[self addSubview:self.onlineLabel];
[self.onlineLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self);
make.bottom.equalTo(self.borderImageView);
make.height.mas_equalTo(14);
make.width.mas_equalTo(32);
}];
self.nameLabel = [[UILabel alloc] init];
self.nameLabel.textColor = [UIColor whiteColor];
self.nameLabel.font = [UIFont systemFontOfSize:14];
self.nameLabel.text = QXText(@"虚位以待");
self.nameLabel.textAlignment = NSTextAlignmentCenter;
[self addSubview:self.nameLabel];
[self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.borderImageView.mas_bottom).offset(25);
make.left.right.equalTo(self);
make.height.mas_equalTo(21);
}];
self.iconBgView = [[UIView alloc] init];
[self addSubview:self.iconBgView];
[self.iconBgView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(self);
make.top.equalTo(self.nameLabel.mas_bottom);
make.height.mas_equalTo(16);
}];
self.rankBtn = [[UIButton alloc] init];
[self.rankBtn setImage:[UIImage imageNamed:@"room_rank_value_icon"] forState:(UIControlStateNormal)];
[self.rankBtn setTitle:@" 0" forState:(UIControlStateNormal)];
self.rankBtn.titleLabel.font = [UIFont systemFontOfSize:14];
[self.rankBtn setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)];
[self addSubview:self.rankBtn];
[self.rankBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(self);
make.top.equalTo(self.iconBgView.mas_bottom);
make.height.mas_equalTo(16);
}];
}
@end

View File

@@ -0,0 +1,19 @@
//
// QXRoomRankView.h
// QXLive
//
// Created by 启星 on 2025/6/9.
//
#import <UIKit/UIKit.h>
#import "QXRoomSeatDelegate.h"
NS_ASSUME_NONNULL_BEGIN
@interface QXRoomRankView : UIView
@property (nonatomic,strong)NSString*roomId;
@property (nonatomic,weak)id<QXRoomSeatDelegate>delegate;
-(void)showInView:(UIView *)view;
-(void)hide;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,118 @@
//
// QXRoomRankView.m
// QXLive
//
// Created by on 2025/6/9.
//
#import "QXRoomRankView.h"
#import "JXCategoryView.h"
#import "QXRoomRankSubView.h"
@interface QXRoomRankView()<JXCategoryViewDelegate,JXCategoryListContainerViewDelegate,UIGestureRecognizerDelegate,QXRoomSeatDelegate>
@property (nonatomic,strong)UIImageView *bgImageView;
@property (nonatomic,strong)UIView *bgView;
@property (nonatomic,strong)JXCategoryTitleView *categoryView;
@property (nonatomic,strong)JXCategoryListContainerView *containerView;
@property (nonatomic,strong)QXRoomRankSubView *moneyView;
@property (nonatomic,strong)QXRoomRankSubView *charmView;
@end
@implementation QXRoomRankView
- (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, ScaleWidth(144), SCREEN_WIDTH, SCREEN_HEIGHT-ScaleWidth(144))];
[self.bgView addRoundedCornersWithRadius:16 byRoundingCorners:(UIRectCornerTopLeft|UIRectCornerTopRight)];
[self addSubview:self.bgView];
self.bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"room_rank_bg"]];
self.bgImageView.contentMode = UIViewContentModeScaleToFill;
self.bgImageView.frame = self.bgView.bounds;
[self.bgView addSubview:self.bgImageView];
self.categoryView = [[JXCategoryTitleView alloc] init];
self.categoryView.frame = CGRectMake((self.width-140)/2,0,140, 44);
self.categoryView.delegate = self;
self.categoryView.titles = @[QXText(@"财富榜"),QXText(@"魅力榜")];
self.categoryView.titleSelectedColor = [UIColor colorWithHexString:@"#ffffff"];
self.categoryView.titleColor = [UIColor colorWithHexString:@"#DADADA"];
self.categoryView.cellWidth = 66;
self.categoryView.cellSpacing = 0;
self.categoryView.contentEdgeInsetLeft = 8;
// self.categoryView.titleLabelZoomScale = 1.1;
self.categoryView.titleLabelZoomEnabled = YES;
self.categoryView.titleFont = [UIFont boldSystemFontOfSize:14];
self.categoryView.titleSelectedFont = [UIFont boldSystemFontOfSize:16];
// self.categoryView.averageCellSpacingEnabled = YES;
// JXCategoryIndicatorImageView *indicatorView = [[JXCategoryIndicatorImageView alloc] init];
// indicatorView.indicatorImageView.image = [[UIImage imageNamed:@"home_slider"] imageByTintColor:[UIColor whiteColor]];
// indicatorView.indicatorImageViewSize = CGSizeMake(40, 8);
// indicatorView.verticalMargin = 11;
// self.categoryView.indicators = @[indicatorView];
self.containerView = [[JXCategoryListContainerView alloc] initWithType:(JXCategoryListContainerType_ScrollView) delegate:self];
self.containerView.frame = CGRectMake(0, 44, self.width, self.height-ScaleWidth(144)-44);
[self.bgView addSubview:self.categoryView];
[self.bgView addSubview:self.containerView];
self.categoryView.listContainer = self.containerView;
}
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{
return touch.view == self;
}
-(void)setRoomId:(NSString *)roomId{
_roomId = roomId;
self.charmView.roomId = roomId;
self.moneyView.roomId = roomId;
}
-(void)showInView:(UIView *)view{
self.bgView.y = SCREEN_HEIGHT;
[view addSubview:self];
[UIView animateWithDuration:0.3 animations:^{
self.bgView.y = ScaleWidth(144);
}];
}
-(void)hide{
[UIView animateWithDuration:0.3 animations:^{
self.bgView.y = SCREEN_HEIGHT;
} completion:^(BOOL finished) {
[self removeFromSuperview];
}];
}
-(void)previewUserInfoWithUserId:(NSString *)userId{
if (self.delegate && [self.delegate respondsToSelector:@selector(previewUserInfoWithUserId:)]) {
[self.delegate previewUserInfoWithUserId:userId];
}
}
- (NSInteger)numberOfListsInlistContainerView:(JXCategoryListContainerView *)listContainerView{
return 2;
}
- (id<JXCategoryListContentViewDelegate>)listContainerView:(JXCategoryListContainerView *)listContainerView initListForIndex:(NSInteger)index{
QXRoomRankSubView *vc = [[QXRoomRankSubView alloc] initWithFrame:CGRectMake(0, 0, self.width, self.height-ScaleWidth(144)-44)];
vc.delegate = self;
if (index == 0) {
vc.type = @"1";
self.moneyView = vc;
}else{
vc.type = @"2";
self.charmView = vc;
}
vc.roomId = self.roomId;
return vc;
}
@end

View File

@@ -0,0 +1,29 @@
//
// QXRoomSongListCell.h
// QXLive
//
// Created by 启星 on 2025/6/9.
//
#import <UIKit/UIKit.h>
#import "QXSongListModel.h"
NS_ASSUME_NONNULL_BEGIN
@interface QXRoomSongListCell : UITableViewCell
@property (nonatomic,assign)BOOL isSearch;
@property (nonatomic,assign)BOOL isBgMusic;
@property (nonatomic,assign)BOOL isCompere;
@property (nonatomic,strong) QXSongListModel *model;
@property (nonatomic,strong) NSString *roomId;
@property (weak, nonatomic) IBOutlet UIImageView *coverImageView;
@property (weak, nonatomic) IBOutlet UILabel *songNameLabel;
@property (weak, nonatomic) IBOutlet UILabel *posterLabel;
@property (weak, nonatomic) IBOutlet UIButton *endBtn;
@property (weak, nonatomic) IBOutlet UIButton *upBtn;
@property (weak, nonatomic) IBOutlet UILabel *userNameLabel;
@property (nonatomic,copy)void(^moveSuccessBlock)(void);
+(instancetype)cellWithTableView:(UITableView *)tableView;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,112 @@
//
// QXRoomSongListCell.m
// QXLive
//
// Created by on 2025/6/9.
//
#import "QXRoomSongListCell.h"
#import "QXMineNetwork.h"
#import "QXAgoraEngine.h"
@implementation QXRoomSongListCell
+(instancetype)cellWithTableView:(UITableView *)tableView{
static NSString *cellId = @"QXRoomSongListCell";
QXRoomSongListCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
if (!cell) {
cell = [[NSBundle mainBundle] loadNibNamed:cellId owner:nil options:nil].lastObject;
cell.backgroundColor = [UIColor clearColor];
}
return cell;
}
-(void)setIsSearch:(BOOL)isSearch{
_isSearch = isSearch;
if (self.isBgMusic) {
self.upBtn.hidden = YES;
}else{
self.upBtn.hidden = isSearch;
}
if (isSearch) {
[self.endBtn setTitle:isSearch?QXText(@"点歌"):QXText(@"置顶") forState:(UIControlStateNormal)];
}else{
if (self.isBgMusic) {
self.endBtn.hidden = YES;
}else{
if (self.isCompere) {
self.endBtn.hidden = NO;
[self.endBtn setTitle:isSearch?QXText(@"点歌"):QXText(@"置顶") forState:(UIControlStateNormal)];
}else{
self.endBtn.hidden = YES;
self.upBtn.hidden = YES;
}
}
}
}
-(void)setIsBgMusic:(BOOL)isBgMusic{
_isBgMusic = isBgMusic;
}
- (IBAction)endAction:(id)sender {
if (self.isSearch) {
if (self.isBgMusic) {
showToast(@"点歌成功");
[[QXAgoraEngine sharedEngine] addBgMusic:self.model];
}else{
[QXMineNetwork selectedSongWithRoomId:self.roomId
user_id:[QXGlobal shareGlobal].loginModel.user_id
song_code:[NSString stringWithFormat:@"%ld",self.model.song_code]
song_name:self.model.song_name
singer:self.model.singer
poster:self.model.poster
duration:[NSString stringWithFormat:@"%ld",self.model.duration]
successBlock:^(NSDictionary * _Nonnull dict) {
showToast(@"点歌成功");
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
showToast(msg);
}];
}
}else{
[self moveSongIsTop:YES];
}
}
- (IBAction)upAction:(id)sender {
[self moveSongIsTop:NO];
}
-(void)setIsCompere:(BOOL)isCompere{
_isCompere = isCompere;
// self.upBtn.hidden = !isCompere;
// self.endBtn.hidden = !isCompere;
}
-(void)moveSongIsTop:(BOOL)isTop{
MJWeakSelf
[QXMineNetwork moveSongWithRoomSongId:self.model.did type:isTop?@"2":@"1" successBlock:^(NSDictionary * _Nonnull dict) {
if (weakSelf.moveSuccessBlock) {
weakSelf.moveSuccessBlock();
}
showToast(@"移动成功");
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
showToast(msg);
}];
}
-(void)setModel:(QXSongListModel *)model{
_model = model;
[self.coverImageView sd_setImageWithURL:[NSURL URLWithString:model.poster]];
NSString *time = [NSString stringWithFormat:@"%02ld:%02ld",model.duration/60,model.duration%60];
self.posterLabel.text = [NSString stringWithFormat:@"%@ %@",time,model.singer];
self.songNameLabel.text = model.song_name;
self.userNameLabel.text = model.nickname;
}
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end

View File

@@ -0,0 +1,126 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="23504" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_12" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23506"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" rowHeight="163" id="KGk-i7-Jjw" customClass="QXRoomSongListCell">
<rect key="frame" x="0.0" y="0.0" width="466" height="163"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
<rect key="frame" x="0.0" y="0.0" width="466" height="163"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="dAY-R1-1Xw">
<rect key="frame" x="16" y="55.666666666666657" width="52" height="52"/>
<constraints>
<constraint firstAttribute="height" constant="52" id="Fmc-qu-edY"/>
<constraint firstAttribute="width" constant="52" id="xh7-0d-x9a"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="3"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="cEo-4m-Uk0">
<rect key="frame" x="74" y="59.666666666666657" width="35.333333333333343" height="18"/>
<constraints>
<constraint firstAttribute="height" constant="18" id="b1c-op-Skx"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="王富贵" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="SNA-M2-7Y8">
<rect key="frame" x="74" y="85.666666666666671" width="90" height="18"/>
<constraints>
<constraint firstAttribute="height" constant="18" id="XKi-Bc-Kyd"/>
<constraint firstAttribute="width" constant="90" id="cZF-LW-Eez"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<color key="textColor" red="0.59999999999999998" green="0.59999999999999998" blue="0.59999999999999998" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="prN-Cg-NVp">
<rect key="frame" x="398" y="66.666666666666671" width="52" height="30"/>
<color key="backgroundColor" red="0.050980392156862744" green="1" blue="0.72549019607843135" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="width" constant="52" id="ErL-3b-xUl"/>
<constraint firstAttribute="height" constant="30" id="M8O-GG-Lcl"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
<state key="normal" title="结束">
<color key="titleColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
</state>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="15"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
<connections>
<action selector="endAction:" destination="KGk-i7-Jjw" eventType="touchUpInside" id="Ryq-am-gZg"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="nCl-nA-G1H">
<rect key="frame" x="353" y="64" width="35" height="35"/>
<constraints>
<constraint firstAttribute="height" constant="35" id="bWm-9A-ja7"/>
<constraint firstAttribute="width" constant="35" id="l70-bk-etp"/>
</constraints>
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
<state key="normal" image="room_song_up"/>
<connections>
<action selector="upAction:" destination="KGk-i7-Jjw" eventType="touchUpInside" id="lXk-rU-fQZ"/>
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="wAY-Bl-81T">
<rect key="frame" x="174" y="94.666666666666671" width="169" height="0.0"/>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<color key="textColor" red="0.59999999999999998" green="0.59999999999999998" blue="0.59999999999999998" alpha="1" colorSpace="custom" customColorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstItem="SNA-M2-7Y8" firstAttribute="leading" secondItem="cEo-4m-Uk0" secondAttribute="leading" id="1ia-Qn-gkV"/>
<constraint firstItem="wAY-Bl-81T" firstAttribute="centerY" secondItem="SNA-M2-7Y8" secondAttribute="centerY" id="5fU-Uw-Sf8"/>
<constraint firstAttribute="trailing" secondItem="prN-Cg-NVp" secondAttribute="trailing" constant="16" id="DSL-WP-A3K"/>
<constraint firstItem="cEo-4m-Uk0" firstAttribute="top" secondItem="dAY-R1-1Xw" secondAttribute="top" constant="4" id="Kno-Zg-rp2"/>
<constraint firstItem="SNA-M2-7Y8" firstAttribute="bottom" secondItem="dAY-R1-1Xw" secondAttribute="bottom" constant="-4" id="SXZ-zo-2j2"/>
<constraint firstItem="wAY-Bl-81T" firstAttribute="leading" secondItem="SNA-M2-7Y8" secondAttribute="trailing" constant="10" id="VB3-n2-Huh"/>
<constraint firstItem="cEo-4m-Uk0" firstAttribute="leading" secondItem="dAY-R1-1Xw" secondAttribute="trailing" constant="6" id="YcA-Ji-ToE"/>
<constraint firstItem="nCl-nA-G1H" firstAttribute="leading" secondItem="wAY-Bl-81T" secondAttribute="trailing" constant="10" id="cVf-2A-n8b"/>
<constraint firstItem="nCl-nA-G1H" firstAttribute="centerY" secondItem="prN-Cg-NVp" secondAttribute="centerY" id="fbA-GF-fge"/>
<constraint firstItem="dAY-R1-1Xw" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="16" id="vH3-3z-2SL"/>
<constraint firstItem="prN-Cg-NVp" firstAttribute="leading" secondItem="nCl-nA-G1H" secondAttribute="trailing" constant="10" id="ze3-qs-gsC"/>
</constraints>
</tableViewCellContentView>
<viewLayoutGuide key="safeArea" id="aW0-zy-SZf"/>
<constraints>
<constraint firstItem="prN-Cg-NVp" firstAttribute="centerY" secondItem="aW0-zy-SZf" secondAttribute="centerY" id="XhU-js-NUE"/>
<constraint firstItem="dAY-R1-1Xw" firstAttribute="centerY" secondItem="aW0-zy-SZf" secondAttribute="centerY" id="liM-Yh-tyy"/>
</constraints>
<connections>
<outlet property="coverImageView" destination="dAY-R1-1Xw" id="13P-C0-xc8"/>
<outlet property="endBtn" destination="prN-Cg-NVp" id="fEr-hy-Kvr"/>
<outlet property="posterLabel" destination="SNA-M2-7Y8" id="c1y-Cd-Ze0"/>
<outlet property="songNameLabel" destination="cEo-4m-Uk0" id="EIf-pB-ruW"/>
<outlet property="upBtn" destination="nCl-nA-G1H" id="e7A-2b-WE7"/>
<outlet property="userNameLabel" destination="wAY-Bl-81T" id="jHd-10-kev"/>
</connections>
<point key="canvasLocation" x="250.38167938931298" y="40.492957746478872"/>
</tableViewCell>
</objects>
<resources>
<image name="room_song_up" width="16" height="16"/>
</resources>
</document>

View File

@@ -0,0 +1,22 @@
//
// QXRoomSongListSubView.h
// QXLive
//
// Created by 启星 on 2025/6/9.
//
#import <UIKit/UIKit.h>
#import "JXCategoryView.h"
NS_ASSUME_NONNULL_BEGIN
@interface QXRoomSongListSubView : UIView<JXCategoryListContentViewDelegate>
@property (nonatomic,assign)BOOL isSearch;
@property (nonatomic,assign)BOOL isBgMusic;
@property (nonatomic,assign)BOOL isCompere;
@property (nonatomic,strong)NSString* roomId;
@property (nonatomic,copy)void(^beiginEditBlock)(void);
@property (nonatomic,copy)void(^endEditBlock)(void);
@property (nonatomic,strong)UITableView *tableView;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,196 @@
//
// QXRoomSongListSubView.m
// QXLive
//
// Created by on 2025/6/9.
//
#import "QXRoomSongListSubView.h"
#import "QXRoomSongListCell.h"
#import "QXAgoraEngine.h"
#import "QXMineNetwork.h"
@interface QXRoomSongListSubView()<UITableViewDataSource,UITableViewDelegate,UITextFieldDelegate>
@property (nonatomic,strong)UIView *searchBgView;
@property (nonatomic,strong)UIImageView *searchIcon;
@property (nonatomic,strong)UITextField *textField;
@property (nonatomic,strong)NSMutableArray *dataArray;
@property (nonatomic,assign)NSInteger page;
@end
@implementation QXRoomSongListSubView
-(UIView *)listView{
return self;
}
-(void)listWillAppear{
if (!self.isSearch) {
[self getSongList];
}
}
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self initSubviews];
}
return self;
}
-(void)initSubviews{
self.page = 1;
self.searchBgView = [[UIView alloc] initWithFrame:CGRectMake(16, 6, self.width-32, 35)];
self.searchBgView.backgroundColor = RGB16(0xEFF2F8);
[self.searchBgView addRoundedCornersWithRadius:17.5];
[self addSubview:self.searchBgView];
self.searchIcon = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"room_song_search"]];
self.searchIcon.frame = CGRectMake(10, 10, 15, 15);
[self.searchBgView addSubview:self.searchIcon];
self.textField = [[UITextField alloc] initWithFrame:CGRectMake(self.searchIcon.right+2, 0, self.width-self.searchIcon.right-2-10, 35)];
self.textField.textColor = RGB16(0x333333);
self.textField.placeholder = QXText(@"请输入歌名搜索");
self.textField.font = [UIFont systemFontOfSize:13];
self.textField.returnKeyType = UIReturnKeyDone;
[self.textField addTarget:self action:@selector(textDidChange:) forControlEvents:UIControlEventEditingChanged];
self.textField.delegate = self;
[self.searchBgView addSubview:self.textField];
self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, self.searchBgView.bottom+10, self.width, self.height-self.searchBgView.bottom-10) style:(UITableViewStylePlain)];
self.tableView.delegate = self;
self.tableView.dataSource = self;
self.tableView.backgroundColor = [UIColor clearColor];
self.tableView.rowHeight = 72;
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
MJWeakSelf
self.tableView.mj_footer = [MJRefreshBackStateFooter footerWithRefreshingBlock:^{
weakSelf.page++;
[weakSelf getSongList];
}];
self.tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
weakSelf.page = 1;
[weakSelf getSongList];
}];
[self addSubview:self.tableView];
// [self getSongList];
}
-(void)setIsBgMusic:(BOOL)isBgMusic{
_isBgMusic = isBgMusic;
[self.tableView reloadData];
}
#pragma mark - UITextFieldDelegate
-(BOOL)textFieldShouldReturn:(UITextField *)textField{
[textField resignFirstResponder];
return YES;
}
-(void)textFieldDidBeginEditing:(UITextField *)textField{
if (self.beiginEditBlock) {
self.beiginEditBlock();
}
}
-(void)textFieldDidEndEditing:(UITextField *)textField{
if (self.endEditBlock) {
self.endEditBlock();
}
}
-(void)setIsSearch:(BOOL)isSearch{
_isSearch = isSearch;
self.searchBgView.hidden = !isSearch;
self.tableView.frame = CGRectMake(0, isSearch?self.searchBgView.bottom+10:6, self.width, isSearch?(self.height-self.searchBgView.bottom-10):self.height - 6);
}
-(void)setRoomId:(NSString *)roomId{
_roomId = roomId;
[self getSongList];
}
-(void)getSongList{
MJWeakSelf
if (self.isSearch) {
if (self.textField.text.length == 0) {
return;
}
[[QXAgoraEngine sharedEngine] searchSongWithKeyword:self.textField.text page:self.page resultBlock:^(NSArray<AgoraMusic *> * _Nonnull songList, BOOL isReload) {
dispatch_async(dispatch_get_main_queue(), ^{
if (isReload) {
[weakSelf.dataArray removeAllObjects];
}
for (AgoraMusic*music in songList) {
if ([music.singer isEqualToString:@"彭丽媛"]) {
continue;
}
QXSongListModel *model = [[QXSongListModel alloc] init];
model.song_code = music.songCode;
model.song_name = music.name;
model.poster = music.poster;
model.singer = music.singer;
model.duration = music.durationS;
[weakSelf.dataArray addObject:model];
}
[weakSelf.tableView reloadData];
if (songList.count == 0) {
weakSelf.tableView.mj_footer.state = MJRefreshStateNoMoreData;
}else{
[weakSelf.tableView.mj_footer endRefreshing];
}
[weakSelf.tableView.mj_header endRefreshing];
});
}];
}else{
if (self.isBgMusic) {
self.dataArray = [NSMutableArray arrayWithArray:[QXAgoraEngine sharedEngine].bgMusicArray];
[self.tableView reloadData];
[self.tableView.mj_header endRefreshing];
self.tableView.mj_footer.state = MJRefreshStateNoMoreData;
}else{
[QXMineNetwork roomSongListWithRoomId:self.roomId successBlock:^(NSArray<QXSongListModel *> * _Nonnull list) {
[weakSelf.dataArray removeAllObjects];
[weakSelf.dataArray addObjectsFromArray:list];
[weakSelf.tableView reloadData];
weakSelf.tableView.mj_footer.state = MJRefreshStateNoMoreData;
[weakSelf.tableView.mj_header endRefreshing];
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
[weakSelf.tableView.mj_header endRefreshing];
}];
}
}
}
-(void)textDidChange:(UITextField*)textField{
[self getSongList];
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return self.dataArray.count;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
MJWeakSelf
QXRoomSongListCell *cell = [QXRoomSongListCell cellWithTableView:tableView];
cell.isBgMusic = self.isBgMusic;
cell.isCompere = self.isCompere;
cell.roomId = self.roomId;
cell.isSearch = self.isSearch;
cell.model = [self.dataArray objectAtIndex:indexPath.row];
cell.moveSuccessBlock = ^{
[weakSelf getSongList];
};
return cell;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
// QXSongListModel *model = self.dataArray[indexPath.row];
// [[QXAgoraEngine sharedEngine] ktv_EndSing];
// [[QXAgoraEngine sharedEngine] ktv_StartSing:YES withSong:model];
}
-(NSMutableArray *)dataArray{
if (!_dataArray) {
_dataArray = [NSMutableArray array];
}
return _dataArray;
}
@end

View File

@@ -0,0 +1,19 @@
//
// QXRoomSongListView.h
// QXLive
//
// Created by 启星 on 2025/6/9.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface QXRoomSongListView : UIView
@property (nonatomic,assign)BOOL isBgMusic;
@property (nonatomic,assign)BOOL isCompere;
@property (nonatomic,strong)NSString *roomId;
-(void)showInView:(UIView *)view;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,117 @@
//
// QXRoomSongListView.m
// QXLive
//
// Created by on 2025/6/9.
//
#import "QXRoomSongListView.h"
#import "JXCategoryView.h"
#import "QXRoomSongListSubView.h"
@interface QXRoomSongListView()<UIGestureRecognizerDelegate,JXCategoryViewDelegate,JXCategoryListContainerViewDelegate>
@property (nonatomic,strong)UIView *bgView;
@property (nonatomic,strong)JXCategoryTitleView *categoryView;
@property (nonatomic,strong)JXCategoryListContainerView *containerView;
@end
@implementation QXRoomSongListView
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self initSubviews];
}
return self;
}
-(void)initSubviews{
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hide)];
tap.delegate = self;
[self addGestureRecognizer:tap];
self.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.3];
self.bgView = [[UIView alloc] initWithFrame:CGRectMake(0, ScaleWidth(144), SCREEN_WIDTH, kSafeAreaBottom+ScaleWidth(429))];
self.bgView.backgroundColor = UIColor.whiteColor;
[self.bgView addRoundedCornersWithRadius:16 byRoundingCorners:(UIRectCornerTopLeft|UIRectCornerTopRight)];
[self addSubview:self.bgView];
self.categoryView = [[JXCategoryTitleView alloc] init];
self.categoryView.frame = CGRectMake((self.width-150)/2,0,150, 44);
self.categoryView.delegate = self;
self.categoryView.titles = @[QXText(@"点歌"),QXText(@"已点")];
self.categoryView.titleSelectedColor = [UIColor colorWithHexString:@"#33333"];
self.categoryView.titleColor = [UIColor colorWithHexString:@"#999999"];
self.categoryView.cellWidth = 51;
self.categoryView.cellSpacing = 20;
self.categoryView.contentEdgeInsetLeft = 8;
// self.categoryView.contentEdgeInsetRight = 8;
// self.categoryView.titleLabelZoomScale = 1.1;
self.categoryView.titleLabelZoomEnabled = YES;
self.categoryView.titleFont = [UIFont boldSystemFontOfSize:14];
self.categoryView.titleSelectedFont = [UIFont boldSystemFontOfSize:16];
self.categoryView.averageCellSpacingEnabled = YES;
// JXCategoryIndicatorImageView *indicatorView = [[JXCategoryIndicatorImageView alloc] init];
// indicatorView.indicatorImageView.image = [[UIImage imageNamed:@"home_slider"] imageByTintColor:[UIColor whiteColor]];
// indicatorView.indicatorImageViewSize = CGSizeMake(40, 8);
// indicatorView.verticalMargin = 11;
// self.categoryView.indicators = @[indicatorView];
self.containerView = [[JXCategoryListContainerView alloc] initWithType:(JXCategoryListContainerType_ScrollView) delegate:self];
self.containerView.frame = CGRectMake(0, 44, self.width, self.bgView.height-44);
[self.bgView addSubview:self.categoryView];
[self.bgView addSubview:self.containerView];
self.categoryView.listContainer = self.containerView;
}
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{
return touch.view == self;
}
- (NSInteger)numberOfListsInlistContainerView:(JXCategoryListContainerView *)listContainerView{
return 2;
}
-(void)setIsBgMusic:(BOOL)isBgMusic{
_isBgMusic = isBgMusic;
}
- (id<JXCategoryListContentViewDelegate>)listContainerView:(JXCategoryListContainerView *)listContainerView initListForIndex:(NSInteger)index{
QXRoomSongListSubView *vc = [[QXRoomSongListSubView alloc] initWithFrame:CGRectMake(0, 0, self.width, self.bgView.height-44)];
vc.isBgMusic = self.isBgMusic;
vc.isCompere = self.isCompere;
if (index == 0) {
vc.isSearch = YES;
}else{
vc.isSearch = NO;
}
vc.roomId = self.roomId;
vc.beiginEditBlock = ^{
[UIView animateWithDuration:0.3 animations:^{
self.bgView.y = kSafeAreaTop+90;
} completion:^(BOOL finished) {
}];
};
vc.endEditBlock = ^{
[UIView animateWithDuration:0.3 animations:^{
self.bgView.y = SCREEN_HEIGHT-ScaleWidth(429)-kSafeAreaBottom;
} completion:^(BOOL finished) {
}];
};
return vc;
}
-(void)showInView:(UIView *)view{
[self.categoryView reloadData];
self.bgView.y = SCREEN_HEIGHT;
[view addSubview:self];
[UIView animateWithDuration:0.3 animations:^{
self.bgView.y = SCREEN_HEIGHT- ScaleWidth(429)-kSafeAreaBottom;
}];
}
-(void)hide{
[UIView animateWithDuration:0.3 animations:^{
self.bgView.y = SCREEN_HEIGHT;
} completion:^(BOOL finished) {
[self removeFromSuperview];
}];
}
@end

View File

@@ -0,0 +1,65 @@
//
// QXRoomUserInfoView.h
// QXLive
//
// Created by 启星 on 2025/6/10.
//
#import <UIKit/UIKit.h>
#import "QXUserModel.h"
typedef NS_ENUM(NSInteger) {
/// 上麦
QXRoomUserInfoViewEventTypeUpSeat = 0,
/// 下麦
QXRoomUserInfoViewEventTypeDownSeat = 1,
/// 拉黑
QXRoomUserInfoViewEventTypeBlack = 2,
/// 举报
QXRoomUserInfoViewEventTypeReport = 3,
/// 清除魅力
QXRoomUserInfoViewEventTypeClearCharm = 4 ,
/// @TA
QXRoomUserInfoViewEventTypeAtTA = 301,
/// 聊天
QXRoomUserInfoViewEventTypeChat ,
/// 关注
QXRoomUserInfoViewEventTypeAttention ,
/// 送礼物
QXRoomUserInfoViewEventTypeGift ,
///
// QXRoomUserInfoViewEventTypeReport ,
}QXRoomUserInfoViewEventType;
NS_ASSUME_NONNULL_BEGIN
@protocol QXRoomUserInfoViewDelegate <NSObject>
@optional
/// 麦位号可能为空
-(void)didClickEventType:(QXRoomUserInfoViewEventType)evntType userModel:(QXRoomUserInfoModel *)userModel pitNumber:(NSString*)pitNumber;
@end
@interface QXRoomUserInfoView : UIView
@property (nonatomic,strong)NSString *userId;
/// 是否为主持 查看
@property (nonatomic,assign)BOOL isCompere;
/// 是否为房主 查看
@property (nonatomic,assign)BOOL isOwner;
/// 是否为管理 查看
@property (nonatomic,assign)BOOL isManager;
/// 是否是在麦位上而非列表中
@property (nonatomic,assign)BOOL isNoTakeOff;
/// 是否在麦上
//@property (nonatomic,assign)BOOL isUpSeat;
/// isPK
@property (nonatomic,assign)BOOL isPK;
@property (nonatomic,strong)NSString *roomId;
@property (nonatomic,strong)NSString *pitNumber;
@property (nonatomic,weak)id<QXRoomUserInfoViewDelegate>delegate;
-(void)showInView:(UIView *)view;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,913 @@
//
// QXRoomUserInfoView.m
// QXLive
//
// Created by on 2025/6/10.
//
#import "QXRoomUserInfoView.h"
#import "UIButton+QX.h"
#import <SDCycleScrollView/SDCycleScrollView.h>
#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()<UIGestureRecognizerDelegate,SDCycleScrollViewDelegate,QXMenuPopViewDelegate,UITableViewDelegate,UITableViewDataSource>
@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+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.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);
}];
}
}
-(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+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

View File

@@ -0,0 +1,29 @@
//
// QXUserInfoGiftWallView.h
// QXLive
//
// Created by 启星 on 2025/7/7.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface QXUserInfoGiftWallView : UIView
-(void)showInView:(UIView *)view;
-(void)hide;
@end
@interface QXUserInfoGiftWallCell : UICollectionViewCell
@property (nonatomic,strong)UIImageView *bgImageView;
@property (nonatomic,strong)UIImageView *giftImageView;
@property (nonatomic,strong)UILabel *giftCountLabel;
@property (nonatomic,strong)UILabel *giftNameLabel;
@property (nonatomic,strong)UIImageView *userImageView1;
@property (nonatomic,strong)UIImageView *userImageView2;
@property (nonatomic,strong)UIImageView *userImageView3;
@property (nonatomic,strong)UILabel *userCountLabel;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,213 @@
//
// QXUserInfoGiftWallView.m
// QXLive
//
// Created by on 2025/7/7.
//
#import "QXUserInfoGiftWallView.h"
@interface QXUserInfoGiftWallView()<UIGestureRecognizerDelegate,UICollectionViewDelegate,UICollectionViewDataSource>
@property (nonatomic,strong)UIView *bgView;
@property (nonatomic,strong)UIImageView *bgImageView;
@property (nonatomic,strong)UIButton *alreadyBtn;
@property (nonatomic,strong)UIButton *noBtn;
@property (nonatomic,strong)UICollectionView *collectionView;
@property (nonatomic,strong)NSMutableArray *dataArray;
@end
@implementation QXUserInfoGiftWallView
- (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+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.alreadyBtn = [[UIButton alloc] init];
[self.alreadyBtn setTitle:@"已点亮" forState:(UIControlStateNormal)];
[self.alreadyBtn setTitleColor:UIColor.whiteColor forState:(UIControlStateSelected)];
[self.alreadyBtn setTitleColor:RGB16A(0xffffff, 0.4) forState:(UIControlStateNormal)];
self.alreadyBtn.titleLabel.font = [UIFont systemFontOfSize:12];
[self.alreadyBtn setBackgroundImage:[UIImage imageWithColor:RGB16(0x8A72BE)] forState:(UIControlStateSelected)];
[self.alreadyBtn setBackgroundImage:[UIImage imageWithColor:RGB16(0x3C276A)] forState:(UIControlStateNormal)];
[self addSubview:self.alreadyBtn];
self.alreadyBtn.selected = YES;
[self.alreadyBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(16);
make.top.equalTo(self).offset(20);
make.height.mas_equalTo(ScaleWidth(22));
make.width.mas_equalTo(ScaleWidth(28));
}];
self.noBtn = [[UIButton alloc] init];
[self.noBtn setTitle:@"未点亮" forState:(UIControlStateNormal)];
[self.noBtn setTitleColor:UIColor.whiteColor forState:(UIControlStateSelected)];
[self.noBtn setTitleColor:RGB16A(0xffffff, 0.4) forState:(UIControlStateNormal)];
self.noBtn.titleLabel.font = [UIFont systemFontOfSize:12];
[self.noBtn setBackgroundImage:[UIImage imageWithColor:RGB16(0x8A72BE)] forState:(UIControlStateSelected)];
[self.noBtn setBackgroundImage:[UIImage imageWithColor:RGB16(0x3C276A)] forState:(UIControlStateNormal)];
[self addSubview:self.noBtn];
[self.noBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.alreadyBtn.mas_right).offset(12);
make.top.equalTo(self).offset(20);
make.height.mas_equalTo(ScaleWidth(22));
make.width.mas_equalTo(ScaleWidth(28));
}];
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
layout.itemSize = CGSizeMake((SCREEN_WIDTH-16*2-10*2)/3, ScaleWidth(149));
layout.minimumLineSpacing = 10;
layout.minimumInteritemSpacing = 10;
layout.sectionInset = UIEdgeInsetsMake(0, 16, 0, 16);
layout.scrollDirection = UICollectionViewScrollDirectionVertical;
self.collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
[self.collectionView registerClass:[QXUserInfoGiftWallCell class] forCellWithReuseIdentifier:@"QXUserInfoGiftWallCell"];
self.collectionView.delegate = self;
self.collectionView.dataSource = self;
self.collectionView.showsHorizontalScrollIndicator = NO;
self.collectionView.bounces = NO;
self.collectionView.pagingEnabled = YES;
self.collectionView.backgroundColor = RGB16(0xf6f6f6);
[self addSubview:self.collectionView];
[self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(12);
make.top.equalTo(self.alreadyBtn.mas_bottom).offset(22);
make.height.mas_equalTo(ScaleWidth(76));
make.right.mas_equalTo(-12);
}];
}
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{
return touch.view == self;
}
#pragma mark - UITableViewDataSource, UITableViewDelegate
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
return self.dataArray.count;
}
-(__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
QXUserInfoGiftWallCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"QXUserInfoGiftWallCell" forIndexPath:indexPath];
// cell.model = self.dataArray[indexPath.row];
return cell;
}
-(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];
}];
}
-(NSMutableArray *)dataArray{
if (!_dataArray) {
_dataArray = [NSMutableArray array];
}
return _dataArray;
}
@end
@implementation QXUserInfoGiftWallCell
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self initSubviews];
}
return self;
}
-(void)initSubviews{
self.bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"user_giftwall_gray"]];
[self.contentView addSubview:self.bgImageView];
[self.contentView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.top.right.bottom.equalTo(self);
}];
self.giftImageView = [[UIImageView alloc] init];
self.giftImageView.contentMode = UIViewContentModeScaleAspectFit;
[self.contentView addSubview:self.giftImageView];
[self.giftImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(17);
make.size.mas_equalTo(CGSizeMake(ScaleWidth(60), ScaleWidth(60)));
make.centerX.equalTo(self);
}];
self.giftNameLabel = [[UILabel alloc] init];
self.giftNameLabel.textColor = UIColor.whiteColor;
self.giftNameLabel.textAlignment = NSTextAlignmentCenter;
self.giftNameLabel.font = [UIFont systemFontOfSize:12];
[self.contentView addSubview:self.giftNameLabel];
[self.giftNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.giftNameLabel.mas_bottom).offset(1);
make.height.mas_equalTo(18);
make.left.right.equalTo(self);
}];
self.giftCountLabel = [[UILabel alloc] init];
self.giftCountLabel.textColor = UIColor.whiteColor;
self.giftCountLabel.textAlignment = NSTextAlignmentCenter;
self.giftCountLabel.font = [UIFont systemFontOfSize:12];
[self.contentView addSubview:self.giftCountLabel];
[self.giftCountLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.giftNameLabel.mas_bottom).offset(1);
make.height.mas_equalTo(18);
make.left.right.equalTo(self);
}];
self.userImageView1 = [[UIImageView alloc] init];
self.userImageView1.contentMode = UIViewContentModeScaleAspectFill;
[self.contentView addSubview:self.userImageView1];
[self.userImageView1 mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.height.mas_equalTo(18);
make.bottom.equalTo(self).offset(-7);
make.centerX.equalTo(self).offset(-9);
}];
self.userImageView2 = [[UIImageView alloc] init];
self.userImageView2.contentMode = UIViewContentModeScaleAspectFill;
[self.contentView addSubview:self.userImageView2];
[self.userImageView2 mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.height.mas_equalTo(18);
make.bottom.equalTo(self).offset(-7);
make.right.equalTo(self.userImageView1.mas_left).offset(-5);
}];
self.userImageView3 = [[UIImageView alloc] init];
self.userImageView3.contentMode = UIViewContentModeScaleAspectFill;
[self.contentView addSubview:self.userImageView3];
[self.userImageView3 mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.height.mas_equalTo(18);
make.bottom.equalTo(self).offset(-7);
make.right.equalTo(self.userImageView2.mas_left).offset(-5);
}];
}
@end

View File

@@ -0,0 +1,29 @@
//
// QXUserInfoRelationCardCell.h
// QXLive
//
// Created by 启星 on 2025/8/1.
//
#import <UIKit/UIKit.h>
#import "QXUserModel.h"
NS_ASSUME_NONNULL_BEGIN
@interface QXUserInfoRelationCardCell : UITableViewCell
@property (weak, nonatomic) IBOutlet UIImageView *leftHeaderView;
@property (weak, nonatomic) IBOutlet UILabel *leftNameLabel;
@property (weak, nonatomic) IBOutlet UIImageView *rightHeaderView;
@property (weak, nonatomic) IBOutlet UILabel *rightNameLabel;
@property (weak, nonatomic) IBOutlet UILabel *dayLabel;
@property (weak, nonatomic) IBOutlet UIButton *topBtn;
@property (weak, nonatomic) IBOutlet UIButton *deleteBtn;
@property (weak, nonatomic) IBOutlet UILabel *relationLabel;
@property (nonatomic,strong) QXRelationshipListModel *model;
@property (nonatomic,copy)void(^topSuccessBlock)(QXRelationshipListModel*model);
@property (nonatomic,assign) BOOL isList;
+(instancetype)cellWithTableView:(UITableView *)tableView;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,126 @@
//
// QXUserInfoRelationCardCell.m
// QXLive
//
// Created by on 2025/8/1.
//
#import "QXUserInfoRelationCardCell.h"
#import "QXAlertView.h"
#import "QXMineNetwork.h"
@interface QXUserInfoRelationCardCell()
@property (nonatomic,strong)QXAlertView *alertView;
@end
@implementation QXUserInfoRelationCardCell
+(instancetype)cellWithTableView:(UITableView *)tableView{
static NSString *cellId = @"QXUserInfoRelationCardCell";
QXUserInfoRelationCardCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
if (!cell) {
cell = [[NSBundle mainBundle] loadNibNamed:cellId owner:nil options:nil].lastObject;
cell.backgroundColor = [UIColor clearColor];
}
return cell;
}
- (IBAction)deleteAction:(id)sender {
MJWeakSelf
self.alertView.message = [NSString stringWithFormat:@"您确定要置顶本关系吗,解除关系需要%@金币",self.model.delete_me_coin];
[[QXGlobal shareGlobal] showView:self.alertView popType:(PopViewTypeTopToCenter) tapDismiss:NO finishBlock:^{
}];
self.alertView.commitBlock = ^{
[weakSelf deleteRelation];
};
}
-(void)deleteRelation{
MJWeakSelf
[QXMineNetwork deleteRelationWithId:self.model.id successBlock:^(NSDictionary * _Nonnull dict) {
showToast(@"解除成功");
if (weakSelf.topSuccessBlock) {
weakSelf.topSuccessBlock(weakSelf.model);
}
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
showToast(msg);
}];
}
-(void)topRelation{
MJWeakSelf
[QXMineNetwork topRelationWithId:self.model.id successBlock:^(NSDictionary * _Nonnull dict) {
showToast(@"置顶成功");
if (weakSelf.topSuccessBlock) {
weakSelf.topSuccessBlock(weakSelf.model);
}
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
showToast(msg);
}];
}
- (IBAction)topAction:(id)sender {
MJWeakSelf
self.alertView.message = @"您确定要置顶本关系吗";
[[QXGlobal shareGlobal] showView:self.alertView popType:(PopViewTypeTopToCenter) tapDismiss:NO finishBlock:^{
}];
self.alertView.commitBlock = ^{
[weakSelf topRelation];
};
}
-(QXAlertView *)alertView{
if (!_alertView) {
_alertView = [[QXAlertView alloc] initWithFrame:CGRectMake(0, 0, ScaleWidth(300), ScaleWidth(175))];
}
return _alertView;
}
-(void)setModel:(QXRelationshipListModel *)model{
_model = model;
if ([model.user_id1 isEqualToString:[QXGlobal shareGlobal].loginModel.user_id]) {
[self.rightHeaderView sd_setImageWithURL:[NSURL URLWithString:model.avatar1]];
[self.leftHeaderView sd_setImageWithURL:[NSURL URLWithString:model.avatar2]];
self.rightNameLabel.text = model.nickname1;
self.leftNameLabel.text = model.nickname2;
}else{
[self.leftHeaderView sd_setImageWithURL:[NSURL URLWithString:model.avatar1]];
[self.rightHeaderView sd_setImageWithURL:[NSURL URLWithString:model.avatar2]];
self.leftNameLabel.text = model.nickname1;
self.rightNameLabel.text = model.nickname2;
}
self.relationLabel.text = model.relation_name;
// NSInteger hour = model.time_day.longLongValue/(60*60);
NSTimeInterval timeInterval = [[NSDate date] timeIntervalSince1970];
long long milliseconds = (long long)(timeInterval);
long endTime = model.end_time.longLongValue - milliseconds;
if (endTime<=0) {
self.dayLabel.text = @"-";
}else{
NSInteger day = endTime/(60*60*24);
NSInteger hour = endTime/3600%24;
// NSInteger minutes = weakSelf.startTime%3600/60;
// NSInteger second = weakSelf.startTime%60;
// weakSelf.timeLabel.text = [NSString stringWithFormat:@"倒计时 %02ld:%02ld:%02ld",hour,minutes,second];
self.dayLabel.text = [NSString stringWithFormat:@" %ld天 %ld小时 ",day,hour];
}
}
-(void)setIsList:(BOOL)isList{
_isList = isList;
self.topBtn.hidden = !isList;
self.deleteBtn.hidden = !isList;
}
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end

View File

@@ -0,0 +1,176 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="23504" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_12" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23506"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" rowHeight="347" id="yPv-01-K7X" customClass="QXUserInfoRelationCardCell">
<rect key="frame" x="0.0" y="0.0" width="387" height="141"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="yPv-01-K7X" id="fX3-HF-hoR">
<rect key="frame" x="0.0" y="0.0" width="387" height="141"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="room_relationship_card_bg" translatesAutoresizingMaskIntoConstraints="NO" id="0Zl-GZ-eLT">
<rect key="frame" x="0.0" y="0.0" width="387" height="141"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="8"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="虚位以待" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="9ik-tU-uXt">
<rect key="frame" x="287" y="118" width="40" height="15"/>
<constraints>
<constraint firstAttribute="height" constant="15" id="DQY-p5-KXN"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="10"/>
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="relation_no_real_love" translatesAutoresizingMaskIntoConstraints="NO" id="sdH-Ur-m0q">
<rect key="frame" x="137" y="54.666666666666657" width="113" height="73"/>
<constraints>
<constraint firstAttribute="height" constant="73" id="3en-ao-TqD"/>
<constraint firstAttribute="width" constant="113" id="bd1-tQ-8xs"/>
</constraints>
</imageView>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="user_header_placehoulder" translatesAutoresizingMaskIntoConstraints="NO" id="4rD-CV-21a">
<rect key="frame" x="55" y="66" width="50" height="50"/>
<constraints>
<constraint firstAttribute="width" constant="50" id="UhE-GJ-gaN"/>
<constraint firstAttribute="height" constant="50" id="eM1-Km-V8z"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="25"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="虚位以待" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="5gj-z4-YWN">
<rect key="frame" x="60" y="118" width="40" height="15"/>
<constraints>
<constraint firstAttribute="height" constant="15" id="wDg-NY-HRY"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="10"/>
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="0天" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="TRU-Cc-HD7">
<rect key="frame" x="347.66666666666669" y="46" width="19.333333333333314" height="14"/>
<color key="backgroundColor" systemColor="labelColor"/>
<fontDescription key="fontDescription" type="system" pointSize="11"/>
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="7"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="0cp-el-flS">
<rect key="frame" x="342" y="73.666666666666671" width="25" height="25"/>
<constraints>
<constraint firstAttribute="height" constant="25" id="nGj-RS-PKL"/>
<constraint firstAttribute="width" constant="25" id="vAb-Jq-YDq"/>
</constraints>
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
<state key="normal" image="relation_top"/>
<connections>
<action selector="topAction:" destination="yPv-01-K7X" eventType="touchUpInside" id="9hY-YE-Avi"/>
</connections>
</button>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="user_header_placehoulder" translatesAutoresizingMaskIntoConstraints="NO" id="lAD-Et-DFy">
<rect key="frame" x="282" y="66" width="50" height="50"/>
<constraints>
<constraint firstAttribute="width" constant="50" id="3wv-kS-OMb"/>
<constraint firstAttribute="height" constant="50" id="du5-aC-eQ1"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="25"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</imageView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="IcI-hd-X34">
<rect key="frame" x="342" y="108" width="25" height="25"/>
<constraints>
<constraint firstAttribute="height" constant="25" id="8jG-To-tUP"/>
<constraint firstAttribute="width" constant="25" id="oYA-S4-rBq"/>
</constraints>
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
<state key="normal" image="relation_delete"/>
<connections>
<action selector="deleteAction:" destination="yPv-01-K7X" eventType="touchUpInside" id="khU-de-HAy"/>
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="情人" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dSN-hL-YdB">
<rect key="frame" x="176.66666666666666" y="95" width="34" height="21"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="17"/>
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstItem="IcI-hd-X34" firstAttribute="centerX" secondItem="0cp-el-flS" secondAttribute="centerX" id="1De-82-b3K"/>
<constraint firstItem="0Zl-GZ-eLT" firstAttribute="leading" secondItem="fX3-HF-hoR" secondAttribute="leading" id="20I-xZ-dHR"/>
<constraint firstAttribute="bottom" secondItem="IcI-hd-X34" secondAttribute="bottom" constant="8" id="37Q-ce-UHh"/>
<constraint firstItem="0Zl-GZ-eLT" firstAttribute="top" secondItem="fX3-HF-hoR" secondAttribute="top" id="IJP-Kh-uDq"/>
<constraint firstItem="0cp-el-flS" firstAttribute="centerY" secondItem="lAD-Et-DFy" secondAttribute="centerY" constant="-5" id="IN6-WZ-u23"/>
<constraint firstAttribute="bottom" secondItem="dSN-hL-YdB" secondAttribute="bottom" constant="25" id="KOL-2h-zHw"/>
<constraint firstAttribute="trailing" secondItem="lAD-Et-DFy" secondAttribute="trailing" constant="55" id="Ua5-uI-sl0"/>
<constraint firstAttribute="bottom" secondItem="4rD-CV-21a" secondAttribute="bottom" constant="25" id="XQE-sj-t8k"/>
<constraint firstItem="9ik-tU-uXt" firstAttribute="top" secondItem="lAD-Et-DFy" secondAttribute="bottom" constant="2" id="b9J-Jg-zbL"/>
<constraint firstItem="TRU-Cc-HD7" firstAttribute="top" secondItem="lAD-Et-DFy" secondAttribute="top" constant="-20" id="glW-4B-Ibe"/>
<constraint firstAttribute="trailing" secondItem="0Zl-GZ-eLT" secondAttribute="trailing" id="h1f-zg-lPW"/>
<constraint firstItem="lAD-Et-DFy" firstAttribute="centerY" secondItem="4rD-CV-21a" secondAttribute="centerY" id="hMQ-jW-NDq"/>
<constraint firstItem="4rD-CV-21a" firstAttribute="leading" secondItem="fX3-HF-hoR" secondAttribute="leading" constant="55" id="k8y-KS-M49"/>
<constraint firstItem="sdH-Ur-m0q" firstAttribute="centerY" secondItem="4rD-CV-21a" secondAttribute="centerY" id="mah-PG-YQz"/>
<constraint firstAttribute="bottom" secondItem="0Zl-GZ-eLT" secondAttribute="bottom" id="pMK-fn-kAH"/>
<constraint firstItem="5gj-z4-YWN" firstAttribute="centerX" secondItem="4rD-CV-21a" secondAttribute="centerX" id="rmZ-7d-oYw"/>
<constraint firstItem="0cp-el-flS" firstAttribute="trailing" secondItem="TRU-Cc-HD7" secondAttribute="trailing" id="sjb-PA-Ayn"/>
<constraint firstAttribute="trailing" secondItem="TRU-Cc-HD7" secondAttribute="trailing" constant="20" id="v0o-r2-4Yd"/>
<constraint firstItem="9ik-tU-uXt" firstAttribute="centerX" secondItem="lAD-Et-DFy" secondAttribute="centerX" id="vSC-WY-fea"/>
<constraint firstItem="5gj-z4-YWN" firstAttribute="top" secondItem="4rD-CV-21a" secondAttribute="bottom" constant="2" id="x7p-KP-4rP"/>
</constraints>
</tableViewCellContentView>
<viewLayoutGuide key="safeArea" id="y8R-dU-mUQ"/>
<constraints>
<constraint firstItem="sdH-Ur-m0q" firstAttribute="centerX" secondItem="y8R-dU-mUQ" secondAttribute="centerX" id="cEA-1z-Fvc"/>
<constraint firstItem="dSN-hL-YdB" firstAttribute="centerX" secondItem="y8R-dU-mUQ" secondAttribute="centerX" id="rjd-Wk-mcE"/>
</constraints>
<connections>
<outlet property="dayLabel" destination="TRU-Cc-HD7" id="LcA-2L-eVP"/>
<outlet property="deleteBtn" destination="IcI-hd-X34" id="OXF-r3-yvQ"/>
<outlet property="leftHeaderView" destination="4rD-CV-21a" id="s0z-lh-sgR"/>
<outlet property="leftNameLabel" destination="5gj-z4-YWN" id="yTN-FL-lkD"/>
<outlet property="relationLabel" destination="dSN-hL-YdB" id="eKd-sn-kUT"/>
<outlet property="rightHeaderView" destination="lAD-Et-DFy" id="KrC-MJ-NgZ"/>
<outlet property="rightNameLabel" destination="9ik-tU-uXt" id="bEf-zP-skW"/>
<outlet property="topBtn" destination="0cp-el-flS" id="9Sy-gG-Rql"/>
</connections>
<point key="canvasLocation" x="551.90839694656484" y="213.73239436619718"/>
</tableViewCell>
</objects>
<resources>
<image name="relation_delete" width="22" height="22"/>
<image name="relation_no_real_love" width="113" height="73"/>
<image name="relation_top" width="22" height="22"/>
<image name="room_relationship_card_bg" width="369" height="141"/>
<image name="user_header_placehoulder" width="40" height="40"/>
<systemColor name="labelColor">
<color white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
</resources>
</document>

View File

@@ -0,0 +1,27 @@
//
// QXUserInfoRelationCell.h
// QXLive
//
// Created by 启星 on 2025/7/21.
//
#import <UIKit/UIKit.h>
#import "QXUserModel.h"
NS_ASSUME_NONNULL_BEGIN
@interface QXUserInfoRelationCell : UICollectionViewCell
@property (weak, nonatomic) IBOutlet UIImageView *bgImageView;
@property (weak, nonatomic) IBOutlet UIImageView *userHeader1;
@property (weak, nonatomic) IBOutlet UILabel *userNameLabel1;
@property (weak, nonatomic) IBOutlet UIImageView *userHeader2;
@property (weak, nonatomic) IBOutlet UILabel *userNameLabel2;
@property (weak, nonatomic) IBOutlet UILabel *relationNameLabel;
@property (weak, nonatomic) IBOutlet UILabel *timeLabel;
@property (weak, nonatomic) IBOutlet UIButton *deleteBtn;
@property (weak, nonatomic) IBOutlet UIButton *topBtn;
@property (nonatomic,strong) QXRelationshipListModel *model;
@property (nonatomic,copy)void(^topSuccessBlock)(QXRelationshipListModel*model);
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,100 @@
//
// QXUserInfoRelationCell.m
// QXLive
//
// Created by on 2025/7/21.
//
#import "QXUserInfoRelationCell.h"
#import "QXMineNetwork.h"
#import "QXAlertView.h"
@interface QXUserInfoRelationCell()
@property (nonatomic,strong)QXAlertView *alertView;
@end
@implementation QXUserInfoRelationCell
-(void)setModel:(QXRelationshipListModel *)model{
_model = model;
[self.bgImageView sd_setImageWithURL:[NSURL URLWithString:model.image]];
if ([model.user_id1 isEqualToString:[QXGlobal shareGlobal].loginModel.user_id]) {
[self.userHeader1 sd_setImageWithURL:[NSURL URLWithString:model.avatar1]];
[self.userHeader2 sd_setImageWithURL:[NSURL URLWithString:model.avatar2]];
self.userNameLabel1.text = model.nickname1;
self.userNameLabel2.text = model.nickname2;
}else{
[self.userHeader2 sd_setImageWithURL:[NSURL URLWithString:model.avatar1]];
[self.userHeader1 sd_setImageWithURL:[NSURL URLWithString:model.avatar2]];
self.userNameLabel2.text = model.nickname1;
self.userNameLabel1.text = model.nickname2;
}
self.relationNameLabel.text = model.relation_name;
NSInteger day = model.time_day.longLongValue/(60*60*24);
NSInteger hour = model.time_day.longLongValue%(60*60);
self.timeLabel.text = [NSString stringWithFormat:@" %ld天 %ld小时 ",day,hour];
}
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
// [self.bgImageView addRoundedCornersWithRadius:8];
}
- (IBAction)deleteAction:(id)sender {
MJWeakSelf
self.alertView.message = @"您确定要置顶本关系吗解除关系需要50金币";
[[QXGlobal shareGlobal] showView:self.alertView popType:(PopViewTypeTopToCenter) tapDismiss:NO finishBlock:^{
}];
self.alertView.commitBlock = ^{
[weakSelf deleteRelation];
};
}
-(void)deleteRelation{
MJWeakSelf
[QXMineNetwork deleteRelationWithId:self.model.id successBlock:^(NSDictionary * _Nonnull dict) {
showToast(@"解除成功");
if (weakSelf.topSuccessBlock) {
weakSelf.topSuccessBlock(weakSelf.model);
}
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
showToast(msg);
}];
}
-(void)topRelation{
MJWeakSelf
[QXMineNetwork topRelationWithId:self.model.id successBlock:^(NSDictionary * _Nonnull dict) {
showToast(@"置顶成功");
if (weakSelf.topSuccessBlock) {
weakSelf.topSuccessBlock(weakSelf.model);
}
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
showToast(msg);
}];
}
- (IBAction)topAction:(id)sender {
MJWeakSelf
self.alertView.message = @"您确定要置顶本关系吗";
[[QXGlobal shareGlobal] showView:self.alertView popType:(PopViewTypeTopToCenter) tapDismiss:NO finishBlock:^{
}];
self.alertView.commitBlock = ^{
[weakSelf topRelation];
};
}
-(QXAlertView *)alertView{
if (!_alertView) {
_alertView = [[QXAlertView alloc] initWithFrame:CGRectMake(0, 0, ScaleWidth(300), ScaleWidth(175))];
}
return _alertView;
}
@end

View File

@@ -0,0 +1,186 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="23504" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina6_12" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23506"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="gTV-IL-0wX" customClass="QXUserInfoRelationCell">
<rect key="frame" x="0.0" y="0.0" width="375" height="141"/>
<autoresizingMask key="autoresizingMask"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
<rect key="frame" x="0.0" y="0.0" width="375" height="141"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="room_relationship_card_bg" translatesAutoresizingMaskIntoConstraints="NO" id="hpq-sD-3Ur">
<rect key="frame" x="0.0" y="0.0" width="375" height="141"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="8"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</imageView>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="Vd7-Os-9Vc">
<rect key="frame" x="48" y="60" width="50" height="50"/>
<constraints>
<constraint firstAttribute="width" constant="50" id="3OX-ey-3xw"/>
<constraint firstAttribute="height" constant="50" id="SvL-j9-daN"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="25"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</imageView>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="Mcj-e5-lf7">
<rect key="frame" x="161" y="63" width="53" height="53"/>
<constraints>
<constraint firstAttribute="width" constant="53" id="D9w-6H-SPn"/>
<constraint firstAttribute="height" constant="53" id="dzh-6Z-zWU"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="s0t-Dn-Hkf">
<rect key="frame" x="59.666666666666657" y="115" width="27" height="15"/>
<constraints>
<constraint firstAttribute="height" constant="15" id="EVb-Fy-ERS"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="10"/>
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="CPk-xh-jBb">
<rect key="frame" x="290.66666666666669" y="115" width="27" height="15"/>
<constraints>
<constraint firstAttribute="height" constant="15" id="xQo-X0-Xhe"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="10"/>
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ApI-4k-Wxy">
<rect key="frame" x="153" y="93" width="69" height="23"/>
<color key="backgroundColor" red="0.74117647058823533" green="0.57647058823529407" blue="0.90588235294117647" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="width" constant="69" id="TMq-Vq-YpU"/>
<constraint firstAttribute="height" constant="23" id="iM0-f2-B7D"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<real key="value" value="11.5"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</label>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="vB1-at-FUD">
<rect key="frame" x="279" y="60" width="50" height="50"/>
<constraints>
<constraint firstAttribute="width" constant="50" id="LNk-m0-F0h"/>
<constraint firstAttribute="height" constant="50" id="lrc-Qu-DTs"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="25"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="0天" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Wda-vs-0Ps">
<rect key="frame" x="345.66666666666669" y="3" width="19.333333333333314" height="16"/>
<color key="backgroundColor" systemColor="labelColor"/>
<constraints>
<constraint firstAttribute="height" constant="16" id="4uk-WQ-FGK"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="11"/>
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="8"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Uuy-XJ-Oz6">
<rect key="frame" x="340" y="58" width="25" height="25"/>
<constraints>
<constraint firstAttribute="width" constant="25" id="GgS-tC-J2y"/>
<constraint firstAttribute="height" constant="25" id="qJC-cX-d3E"/>
</constraints>
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
<state key="normal" image="relation_top"/>
<connections>
<action selector="topAction:" destination="gTV-IL-0wX" eventType="touchUpInside" id="NWp-HU-crS"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="rrI-Rj-SKq">
<rect key="frame" x="340" y="106" width="25" height="25"/>
<constraints>
<constraint firstAttribute="height" constant="25" id="NFz-yH-gOh"/>
<constraint firstAttribute="width" constant="25" id="eJE-8v-aTY"/>
</constraints>
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
<state key="normal" image="relation_delete"/>
<connections>
<action selector="deleteAction:" destination="gTV-IL-0wX" eventType="touchUpInside" id="mBw-ws-zgL"/>
</connections>
</button>
</subviews>
</view>
<constraints>
<constraint firstAttribute="trailing" secondItem="Wda-vs-0Ps" secondAttribute="trailing" constant="10" id="2y7-aI-PrA"/>
<constraint firstAttribute="bottom" secondItem="hpq-sD-3Ur" secondAttribute="bottom" id="8hj-we-AFH"/>
<constraint firstAttribute="trailing" secondItem="hpq-sD-3Ur" secondAttribute="trailing" id="ACE-0A-M7x"/>
<constraint firstItem="rrI-Rj-SKq" firstAttribute="centerX" secondItem="Uuy-XJ-Oz6" secondAttribute="centerX" id="HjS-ba-Rf0"/>
<constraint firstItem="s0t-Dn-Hkf" firstAttribute="centerX" secondItem="Vd7-Os-9Vc" secondAttribute="centerX" id="Iv6-zm-BYV"/>
<constraint firstItem="CPk-xh-jBb" firstAttribute="centerY" secondItem="s0t-Dn-Hkf" secondAttribute="centerY" id="QSa-ri-fZX"/>
<constraint firstItem="Uuy-XJ-Oz6" firstAttribute="centerY" secondItem="hpq-sD-3Ur" secondAttribute="centerY" id="RJ8-tm-CjS"/>
<constraint firstItem="CPk-xh-jBb" firstAttribute="centerX" secondItem="vB1-at-FUD" secondAttribute="centerX" id="RZg-MZ-Gic"/>
<constraint firstItem="ApI-4k-Wxy" firstAttribute="centerX" secondItem="gTV-IL-0wX" secondAttribute="centerX" id="ZBw-NG-4VC"/>
<constraint firstAttribute="bottom" secondItem="rrI-Rj-SKq" secondAttribute="bottom" constant="10" id="afl-YG-eYt"/>
<constraint firstItem="Mcj-e5-lf7" firstAttribute="centerX" secondItem="gTV-IL-0wX" secondAttribute="centerX" id="dzY-ib-uwm"/>
<constraint firstItem="hpq-sD-3Ur" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" id="fOB-fb-ctX"/>
<constraint firstItem="vB1-at-FUD" firstAttribute="centerY" secondItem="Vd7-Os-9Vc" secondAttribute="centerY" id="gbp-N4-J2N"/>
<constraint firstItem="Vd7-Os-9Vc" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" constant="48" id="jU0-ni-hd7"/>
<constraint firstAttribute="trailing" secondItem="vB1-at-FUD" secondAttribute="trailing" constant="46" id="oid-XS-IFL"/>
<constraint firstItem="Mcj-e5-lf7" firstAttribute="bottom" secondItem="ApI-4k-Wxy" secondAttribute="bottom" id="osn-lq-rUu"/>
<constraint firstAttribute="bottom" secondItem="ApI-4k-Wxy" secondAttribute="bottom" constant="25" id="q0w-xD-hrK"/>
<constraint firstAttribute="bottom" secondItem="s0t-Dn-Hkf" secondAttribute="bottom" constant="11" id="sKr-dc-EdJ"/>
<constraint firstAttribute="trailing" secondItem="Uuy-XJ-Oz6" secondAttribute="trailing" constant="10" id="ucJ-8r-nDT"/>
<constraint firstItem="hpq-sD-3Ur" firstAttribute="top" secondItem="gTV-IL-0wX" secondAttribute="top" id="w1d-Go-Nt8"/>
<constraint firstItem="s0t-Dn-Hkf" firstAttribute="top" secondItem="Vd7-Os-9Vc" secondAttribute="bottom" constant="5" id="z8x-Mo-EkR"/>
<constraint firstItem="Wda-vs-0Ps" firstAttribute="top" secondItem="gTV-IL-0wX" secondAttribute="top" constant="3" id="zIc-fO-dCy"/>
</constraints>
<size key="customSize" width="711" height="231"/>
<connections>
<outlet property="bgImageView" destination="hpq-sD-3Ur" id="JMT-qq-06A"/>
<outlet property="deleteBtn" destination="rrI-Rj-SKq" id="xuE-uz-NXc"/>
<outlet property="relationNameLabel" destination="ApI-4k-Wxy" id="ZB2-pv-V3D"/>
<outlet property="timeLabel" destination="Wda-vs-0Ps" id="p6e-gC-3wg"/>
<outlet property="topBtn" destination="Uuy-XJ-Oz6" id="Rb5-UU-aaG"/>
<outlet property="userHeader1" destination="Vd7-Os-9Vc" id="Uh0-Ko-wd5"/>
<outlet property="userHeader2" destination="vB1-at-FUD" id="Ylz-er-FyL"/>
<outlet property="userNameLabel1" destination="s0t-Dn-Hkf" id="3s9-OW-07M"/>
<outlet property="userNameLabel2" destination="CPk-xh-jBb" id="Pq8-tS-eQc"/>
</connections>
<point key="canvasLocation" x="332.06106870229007" y="-20.422535211267608"/>
</collectionViewCell>
</objects>
<resources>
<image name="relation_delete" width="22" height="22"/>
<image name="relation_top" width="22" height="22"/>
<image name="room_relationship_card_bg" width="369" height="141"/>
<systemColor name="labelColor">
<color white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
</resources>
</document>

View File

@@ -0,0 +1,30 @@
//
// QXUserInfoRelationTableCell.h
// QXLive
//
// Created by 启星 on 2025/8/1.
//
#import <UIKit/UIKit.h>
#import "QXUserModel.h"
NS_ASSUME_NONNULL_BEGIN
@interface QXUserInfoRelationTableCell : UITableViewCell
@property (weak, nonatomic) IBOutlet UIImageView *leftHeaderView;
@property (weak, nonatomic) IBOutlet UILabel *leftNameLabel;
@property (weak, nonatomic) IBOutlet UIImageView *rightHeaderView;
@property (weak, nonatomic) IBOutlet UILabel *rightNameLabel;
@property (weak, nonatomic) IBOutlet UILabel *dayLabel;
@property (weak, nonatomic) IBOutlet UIButton *topBtn;
@property (weak, nonatomic) IBOutlet UIButton *deleteBtn;
@property (weak, nonatomic) IBOutlet UILabel *relationLabel;
@property (weak, nonatomic) IBOutlet UILabel *numberLabel;
@property (nonatomic,strong) QXRelationshipListModel *model;
@property (nonatomic,copy)void(^topSuccessBlock)(QXRelationshipListModel*model);
@property (nonatomic,assign) BOOL isList;
+(instancetype)cellWithTableView:(UITableView *)tableView;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,121 @@
//
// QXUserInfoRelationTableCell.m
// QXLive
//
// Created by on 2025/8/1.
//
#import "QXUserInfoRelationTableCell.h"
#import "QXAlertView.h"
#import "QXMineNetwork.h"
@interface QXUserInfoRelationTableCell()
@property (nonatomic,strong)QXAlertView *alertView;
@end
@implementation QXUserInfoRelationTableCell
+(instancetype)cellWithTableView:(UITableView *)tableView{
static NSString *cellId = @"QXUserInfoRelationTableCell";
QXUserInfoRelationTableCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
if (!cell) {
cell = [[NSBundle mainBundle] loadNibNamed:cellId owner:nil options:nil].lastObject;
cell.backgroundColor = [UIColor clearColor];
}
return cell;
}
-(void)setModel:(QXRelationshipListModel *)model{
_model = model;
if ([model.user_id1 isEqualToString:[QXGlobal shareGlobal].loginModel.user_id]) {
[self.rightHeaderView sd_setImageWithURL:[NSURL URLWithString:model.avatar1]];
[self.leftHeaderView sd_setImageWithURL:[NSURL URLWithString:model.avatar2]];
self.rightNameLabel.text = model.nickname1;
self.leftNameLabel.text = model.nickname2;
}else{
[self.leftHeaderView sd_setImageWithURL:[NSURL URLWithString:model.avatar1]];
[self.rightHeaderView sd_setImageWithURL:[NSURL URLWithString:model.avatar2]];
self.leftNameLabel.text = model.nickname1;
self.rightNameLabel.text = model.nickname2;
}
self.relationLabel.text = model.relation_name;
NSTimeInterval timeInterval = [[NSDate date] timeIntervalSince1970];
long long milliseconds = (long long)(timeInterval);
long endTime = model.end_time.longLongValue - milliseconds;
if (endTime<=0) {
self.dayLabel.text = @"-";
}else{
NSInteger day = endTime/(60*60*24);
NSInteger hour = endTime/3600%24;
self.dayLabel.text = [NSString stringWithFormat:@" %ld天 %ld小时 ",day,hour];
}
}
-(void)setIsList:(BOOL)isList{
_isList = isList;
self.topBtn.hidden = !isList;
self.deleteBtn.hidden = !isList;
}
- (IBAction)deleteAction:(id)sender {
MJWeakSelf
self.alertView.message = [NSString stringWithFormat:@"您确定要置顶本关系吗,解除关系需要%@金币",self.model.delete_me_coin];
[[QXGlobal shareGlobal] showView:self.alertView popType:(PopViewTypeTopToCenter) tapDismiss:NO finishBlock:^{
}];
self.alertView.commitBlock = ^{
[weakSelf deleteRelation];
};
}
-(void)deleteRelation{
MJWeakSelf
[QXMineNetwork deleteRelationWithId:self.model.id successBlock:^(NSDictionary * _Nonnull dict) {
showToast(@"解除成功");
if (weakSelf.topSuccessBlock) {
weakSelf.topSuccessBlock(weakSelf.model);
}
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
showToast(msg);
}];
}
-(void)topRelation{
MJWeakSelf
[QXMineNetwork topRelationWithId:self.model.id successBlock:^(NSDictionary * _Nonnull dict) {
showToast(@"置顶成功");
if (weakSelf.topSuccessBlock) {
weakSelf.topSuccessBlock(weakSelf.model);
}
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
showToast(msg);
}];
}
- (IBAction)topAction:(id)sender {
MJWeakSelf
self.alertView.message = @"您确定要置顶本关系吗";
[[QXGlobal shareGlobal] showView:self.alertView popType:(PopViewTypeTopToCenter) tapDismiss:NO finishBlock:^{
}];
self.alertView.commitBlock = ^{
[weakSelf topRelation];
};
}
-(QXAlertView *)alertView{
if (!_alertView) {
_alertView = [[QXAlertView alloc] initWithFrame:CGRectMake(0, 0, ScaleWidth(300), ScaleWidth(175))];
}
return _alertView;
}
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end

View File

@@ -0,0 +1,189 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="23504" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_12" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23506"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" rowHeight="347" id="KGk-i7-Jjw" customClass="QXUserInfoRelationTableCell">
<rect key="frame" x="0.0" y="0.0" width="387" height="141"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
<rect key="frame" x="0.0" y="0.0" width="387" height="141"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="room_relationship_seat_bg" translatesAutoresizingMaskIntoConstraints="NO" id="iqT-zY-bdo">
<rect key="frame" x="0.0" y="0.0" width="387" height="141"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="8"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="虚位以待" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="VWE-MA-oDy">
<rect key="frame" x="287" y="118" width="40" height="15"/>
<constraints>
<constraint firstAttribute="height" constant="15" id="piG-cg-xSu"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="10"/>
<color key="textColor" red="0.99607843139999996" green="0.2901960784" blue="0.5450980392" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="relation_real_love" translatesAutoresizingMaskIntoConstraints="NO" id="v3p-JC-cJG">
<rect key="frame" x="100" y="60" width="187" height="62"/>
<constraints>
<constraint firstAttribute="height" constant="62" id="5e7-n8-EE2"/>
<constraint firstAttribute="width" constant="187" id="cXS-sb-Pka"/>
</constraints>
</imageView>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="user_header_placehoulder" translatesAutoresizingMaskIntoConstraints="NO" id="0GE-LI-Kkc">
<rect key="frame" x="55" y="66" width="50" height="50"/>
<constraints>
<constraint firstAttribute="height" constant="50" id="eGz-7d-jPm"/>
<constraint firstAttribute="width" constant="50" id="g1M-f0-f2U"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="25"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="虚位以待" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="9DZ-CN-bNk">
<rect key="frame" x="60" y="118" width="40" height="15"/>
<constraints>
<constraint firstAttribute="height" constant="15" id="vRa-Vq-qKZ"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="10"/>
<color key="textColor" red="0.99607843137254903" green="0.29019607843137252" blue="0.54509803921568623" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="0天" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="9Ua-h1-hNx">
<rect key="frame" x="347.66666666666669" y="46" width="19.333333333333314" height="14"/>
<color key="backgroundColor" systemColor="labelColor"/>
<fontDescription key="fontDescription" type="system" pointSize="11"/>
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="7"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="AZA-Wf-NUm">
<rect key="frame" x="342" y="73.666666666666671" width="25" height="25"/>
<constraints>
<constraint firstAttribute="width" constant="25" id="81D-lp-SAY"/>
<constraint firstAttribute="height" constant="25" id="rog-6m-K2m"/>
</constraints>
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
<state key="normal" image="relation_top"/>
<connections>
<action selector="topAction:" destination="KGk-i7-Jjw" eventType="touchUpInside" id="Ue8-fe-uZt"/>
</connections>
</button>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="user_header_placehoulder" translatesAutoresizingMaskIntoConstraints="NO" id="yOX-0y-T2P">
<rect key="frame" x="282" y="66" width="50" height="50"/>
<constraints>
<constraint firstAttribute="width" constant="50" id="2M1-VJ-bhf"/>
<constraint firstAttribute="height" constant="50" id="xkP-v6-Q11"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="25"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="0" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="TBG-4p-dIy">
<rect key="frame" x="153.66666666666666" y="83.666666666666671" width="80" height="15"/>
<constraints>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="80" id="BOJ-jU-bmy"/>
<constraint firstAttribute="height" constant="15" id="XKQ-P2-BAI"/>
</constraints>
<fontDescription key="fontDescription" type="boldSystem" pointSize="12"/>
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="情人" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="XTi-f5-nlg">
<rect key="frame" x="176.66666666666666" y="54.666666666666657" width="34" height="21"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="17"/>
<color key="textColor" red="0.99607843139999996" green="0.2901960784" blue="0.5450980392" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="EXC-vM-Tip">
<rect key="frame" x="342" y="108" width="25" height="25"/>
<constraints>
<constraint firstAttribute="height" constant="25" id="Kkb-fR-XK0"/>
<constraint firstAttribute="width" constant="25" id="xMd-n2-qer"/>
</constraints>
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
<state key="normal" image="relation_delete"/>
<connections>
<action selector="deleteAction:" destination="KGk-i7-Jjw" eventType="touchUpInside" id="igE-Q8-E8x"/>
</connections>
</button>
</subviews>
<constraints>
<constraint firstItem="iqT-zY-bdo" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" id="72T-4O-5wD"/>
<constraint firstItem="TBG-4p-dIy" firstAttribute="top" secondItem="XTi-f5-nlg" secondAttribute="bottom" constant="8" id="7Ph-Gs-fxg"/>
<constraint firstItem="AZA-Wf-NUm" firstAttribute="trailing" secondItem="9Ua-h1-hNx" secondAttribute="trailing" id="8VF-YC-vFQ"/>
<constraint firstAttribute="trailing" secondItem="iqT-zY-bdo" secondAttribute="trailing" id="B6I-fu-ww0"/>
<constraint firstAttribute="bottom" secondItem="iqT-zY-bdo" secondAttribute="bottom" id="EPt-0g-2Us"/>
<constraint firstItem="v3p-JC-cJG" firstAttribute="centerY" secondItem="0GE-LI-Kkc" secondAttribute="centerY" id="EpJ-zh-6eW"/>
<constraint firstItem="yOX-0y-T2P" firstAttribute="centerY" secondItem="0GE-LI-Kkc" secondAttribute="centerY" id="Fo4-13-xMp"/>
<constraint firstItem="iqT-zY-bdo" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" id="GLa-Ta-mii"/>
<constraint firstItem="TBG-4p-dIy" firstAttribute="centerY" secondItem="0GE-LI-Kkc" secondAttribute="centerY" id="Ipj-RA-4El"/>
<constraint firstAttribute="bottom" secondItem="0GE-LI-Kkc" secondAttribute="bottom" constant="25" id="Mau-eJ-bfF"/>
<constraint firstAttribute="bottom" secondItem="EXC-vM-Tip" secondAttribute="bottom" constant="8" id="Mqq-zh-IER"/>
<constraint firstItem="0GE-LI-Kkc" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="55" id="Pnr-C2-F83"/>
<constraint firstAttribute="trailing" secondItem="9Ua-h1-hNx" secondAttribute="trailing" constant="20" id="RHB-I4-lSx"/>
<constraint firstItem="VWE-MA-oDy" firstAttribute="centerX" secondItem="yOX-0y-T2P" secondAttribute="centerX" id="RTH-61-Afw"/>
<constraint firstItem="9DZ-CN-bNk" firstAttribute="centerX" secondItem="0GE-LI-Kkc" secondAttribute="centerX" id="U0D-f7-la0"/>
<constraint firstItem="VWE-MA-oDy" firstAttribute="top" secondItem="yOX-0y-T2P" secondAttribute="bottom" constant="2" id="WQ7-9H-ytN"/>
<constraint firstItem="9Ua-h1-hNx" firstAttribute="top" secondItem="yOX-0y-T2P" secondAttribute="top" constant="-20" id="XGT-4P-kyO"/>
<constraint firstItem="EXC-vM-Tip" firstAttribute="centerX" secondItem="AZA-Wf-NUm" secondAttribute="centerX" id="Xnq-gW-b8x"/>
<constraint firstItem="AZA-Wf-NUm" firstAttribute="centerY" secondItem="yOX-0y-T2P" secondAttribute="centerY" constant="-5" id="YUT-bS-ddI"/>
<constraint firstItem="TBG-4p-dIy" firstAttribute="centerX" secondItem="H2p-sc-9uM" secondAttribute="centerX" id="bRy-bN-3Ff"/>
<constraint firstAttribute="trailing" secondItem="yOX-0y-T2P" secondAttribute="trailing" constant="55" id="hrP-OT-aoH"/>
<constraint firstItem="9DZ-CN-bNk" firstAttribute="top" secondItem="0GE-LI-Kkc" secondAttribute="bottom" constant="2" id="itR-PG-T5i"/>
</constraints>
</tableViewCellContentView>
<viewLayoutGuide key="safeArea" id="aW0-zy-SZf"/>
<constraints>
<constraint firstItem="v3p-JC-cJG" firstAttribute="centerX" secondItem="aW0-zy-SZf" secondAttribute="centerX" id="3h8-di-ALZ"/>
<constraint firstItem="XTi-f5-nlg" firstAttribute="centerX" secondItem="aW0-zy-SZf" secondAttribute="centerX" id="IgF-8c-ThM"/>
</constraints>
<connections>
<outlet property="dayLabel" destination="9Ua-h1-hNx" id="muv-y9-BNM"/>
<outlet property="deleteBtn" destination="EXC-vM-Tip" id="FRu-rb-0gZ"/>
<outlet property="leftHeaderView" destination="0GE-LI-Kkc" id="cNB-HP-fCp"/>
<outlet property="leftNameLabel" destination="9DZ-CN-bNk" id="vR1-ez-91H"/>
<outlet property="numberLabel" destination="TBG-4p-dIy" id="dck-Jd-exs"/>
<outlet property="relationLabel" destination="XTi-f5-nlg" id="3ir-h5-lWY"/>
<outlet property="rightHeaderView" destination="yOX-0y-T2P" id="icV-bE-fI6"/>
<outlet property="rightNameLabel" destination="VWE-MA-oDy" id="QVT-uB-20j"/>
<outlet property="topBtn" destination="AZA-Wf-NUm" id="YdJ-6e-ocy"/>
</connections>
<point key="canvasLocation" x="551.90839694656484" y="213.73239436619718"/>
</tableViewCell>
</objects>
<resources>
<image name="relation_delete" width="22" height="22"/>
<image name="relation_real_love" width="187" height="62"/>
<image name="relation_top" width="22" height="22"/>
<image name="room_relationship_seat_bg" width="369" height="141"/>
<image name="user_header_placehoulder" width="40" height="40"/>
<systemColor name="labelColor">
<color white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
</resources>
</document>

View File

@@ -0,0 +1,22 @@
//
// QXUserRelationListView.h
// QXLive
//
// Created by 启星 on 2025/7/21.
//
#import <UIKit/UIKit.h>
#import "QXUserModel.h"
NS_ASSUME_NONNULL_BEGIN
@interface QXUserRelationListView : UIView
@property (nonatomic,strong)NSString *userId;
@property (nonatomic,strong)QXRelationshipList *list;
/// 是否为关系卡
@property (nonatomic,assign)BOOL isRealLove;
-(void)showInView:(UIView *)view;
-(void)hide;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,196 @@
//
// QXUserRelationListView.m
// QXLive
//
// Created by on 2025/7/21.
//
#import "QXUserRelationListView.h"
#import "QXUserInfoRelationCell.h"
#import "QXMineNetwork.h"
#import "QXUserInfoRelationCardCell.h"
#import "QXUserInfoRelationTableCell.h"
@interface QXUserRelationListView()<UIGestureRecognizerDelegate,UITableViewDelegate,UITableViewDataSource>
@property (nonatomic,strong)UIView *bgView;
@property (nonatomic,strong)UILabel *titleLabel;
@property (nonatomic,strong)UIImageView *bgImageView;
@property (nonatomic,strong)UITableView *tableView;
@property (nonatomic,strong)NSMutableArray *dataArray;
@property (nonatomic,assign)NSInteger page;
@end
@implementation QXUserRelationListView
- (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+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.left.right.bottom.equalTo(self.bgView);
}];
self.titleLabel = [[UILabel alloc] init];
self.titleLabel.text = @"关系列表";
self.titleLabel.textColor = RGB16(0xffffff);
self.titleLabel.font = [UIFont boldSystemFontOfSize:16];
[self.bgView addSubview:self.titleLabel];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(20);
make.centerX.equalTo(self.bgView);
make.height.mas_equalTo(24);
}];
// UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
// layout.itemSize = CGSizeMake(self.width-32, ScaleWidth(100));
// layout.minimumLineSpacing = 10;
// layout.minimumInteritemSpacing = 10;
// layout.sectionInset = UIEdgeInsetsMake(0, 16, 0, 16);
// layout.scrollDirection = UICollectionViewScrollDirectionVertical;
// self.collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
// [self.collectionView registerNib:[UINib nibWithNibName:@"QXUserInfoRelationCell" bundle:[NSBundle mainBundle]] forCellWithReuseIdentifier:@"QXUserInfoRelationCell"];
//
// self.collectionView.delegate = self;
// self.collectionView.dataSource = self;
// self.collectionView.showsHorizontalScrollIndicator = NO;
// self.collectionView.bounces = NO;
// self.collectionView.pagingEnabled = YES;
// self.collectionView.backgroundColor = [UIColor clearColor];
// [self.bgView addSubview:self.collectionView];
// [self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
// make.left.mas_equalTo(12);
// make.top.equalTo(self.titleLabel.mas_bottom).offset(22);
// make.bottom.equalTo(self.bgView);
// make.right.mas_equalTo(-12);
// }];
self.tableView = [[UITableView alloc] initWithFrame:CGRectZero style:(UITableViewStylePlain)];
self.tableView.delegate = self;
self.tableView.dataSource = self;
// self.tableView.scrollEnabled = NO;
self.tableView.backgroundColor = [UIColor clearColor];
self.tableView.rowHeight = ScaleWidth(141);
[self.bgView addSubview:self.tableView];
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(12);
make.top.equalTo(self.titleLabel.mas_bottom).offset(22);
make.bottom.equalTo(self.bgView);
make.right.mas_equalTo(-12);
}];
MJWeakSelf
self.tableView.mj_footer = [MJRefreshBackStateFooter footerWithRefreshingBlock:^{
weakSelf.page++;
[weakSelf getRelationList];
}];
self.tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
weakSelf.page = 1;
[weakSelf getRelationList];
}];
}
-(void)getRelationList{
MJWeakSelf
[QXMineNetwork roomUserRelationWithUserId:self.userId page:self.page successBlock:^(QXRelationshipList * _Nonnull list) {
weakSelf.list = list;
[weakSelf.tableView.mj_header endRefreshing];
[weakSelf.tableView.mj_footer endRefreshing];
[weakSelf.tableView reloadData];
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
[weakSelf.tableView.mj_header endRefreshing];
[weakSelf.tableView.mj_footer endRefreshing];
}];
}
-(void)setUserId:(NSString *)userId{
self.page = 1;
_userId = userId;
[self getRelationList];
}
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{
return touch.view == self;
}
//-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
// if (self.isRealLove) {
// return self.list.zhenai.count;
// }else{
// return self.list.qinmi.count;
// }
//}
//- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
// QXUserInfoRelationCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"QXUserInfoRelationCell" forIndexPath:indexPath];
// QXRelationshipListModel *model;
// if (self.isRealLove) {
// model = self.list.zhenai[indexPath.row];
// }else{
// model = self.list.qinmi[indexPath.row];
// }
// cell.model = model;
// return cell;
//}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
if (self.isRealLove) {
return self.list.zhenai.count;
}else{
return self.list.qinmi.count;
}
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
MJWeakSelf
if (!self.isRealLove) {
QXUserInfoRelationCardCell *cell = [QXUserInfoRelationCardCell cellWithTableView:tableView];
cell.isList = [self.userId isEqualToString:QXGlobal.shareGlobal.loginModel.user_id];
cell.model = self.list.qinmi[indexPath.row];;
cell.topSuccessBlock = ^(QXRelationshipListModel * _Nonnull model) {
weakSelf.page = 1;
[weakSelf getRelationList];
};
return cell;
}else{
QXUserInfoRelationTableCell *cell = [QXUserInfoRelationTableCell cellWithTableView:tableView];
cell.isList = [self.userId isEqualToString:QXGlobal.shareGlobal.loginModel.user_id];
cell.model = self.list.zhenai[indexPath.row];;
cell.topSuccessBlock = ^(QXRelationshipListModel * _Nonnull model) {
weakSelf.page = 1;
[weakSelf getRelationList];
};
return cell;
}
}
-(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];
}];
}
-(NSMutableArray *)dataArray{
if (!_dataArray) {
_dataArray = [NSMutableArray array];
}
return _dataArray;
}
@end

View File

@@ -0,0 +1,16 @@
//
// QXInviteToMicView.h
// QXLive
//
// Created by 启星 on 2025/5/8.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface QXInviteToMicView : UIView
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,14 @@
//
// QXInviteToMicView.m
// QXLive
//
// Created by on 2025/5/8.
//
#import "QXInviteToMicView.h"
@implementation QXInviteToMicView
@end

View File

@@ -0,0 +1,28 @@
//
// QXSeatHeaderView.h
// QXLive
//
// Created by 启星 on 2025/5/6.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface QXSeatHeaderView : UIView
/// 头像装饰
@property (nonatomic,strong)UIImageView *dressImageView;
/// 头像
@property (nonatomic,strong)UIImageView *headImageView;
/// 昵称
//@property (nonatomic,strong)UILabel *nameLabel;
/// 按钮
@property (nonatomic,strong)UIButton *headBtn;
-(void)setHeadIcon:(NSString*)headerIcon
dress:(NSString*)dress;
-(void)stopHWDMP4;
-(void)playHWDMP4;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,137 @@
//
// QXSeatHeaderView.m
// QXLive
//
// Created by on 2025/5/6.
//
#import "QXSeatHeaderView.h"
#import "QXEffectSvgaView.h"
#import "UIView+VAP.h"
#import "QXFileManager.h"
@interface QXSeatHeaderView()<HWDMP4PlayDelegate>
@property (nonatomic,strong) QXEffectSvgaView *svgaView;
@property (nonatomic,strong) VAPView *mp4View;
@property (nonatomic,strong) NSString *dress;
@property (nonatomic,strong) NSString *videoPath;
@end
@implementation QXSeatHeaderView
- (instancetype)initWithCoder:(NSCoder *)coder
{
self = [super initWithCoder:coder];
if (self) {
[self initSubViews];
}
return self;
}
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self initSubViews];
}
return self;
}
-(void)layoutSubviews{
[super layoutSubviews];
[self.headImageView addRoundedCornersWithRadius:self.headImageView.height/2];
// [self.svgaView addRoundedCornersWithRadius:self.headImageView.height/2-2];
}
-(void)initSubViews{
self.headImageView = [[UIImageView alloc] init];
self.headImageView.image = [UIImage imageNamed:@"user_header_placehoulder"];
self.headImageView.contentMode = UIViewContentModeScaleAspectFill;
self.headImageView.clipsToBounds = YES;
[self addSubview:self.headImageView];
[self.headImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.bottom.top.equalTo(self);
}];
[self addSubview:self.svgaView];
[self.svgaView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.top.equalTo(self).offset(-6);
make.right.bottom.equalTo(self).offset(6);
}];
[self addSubview:self.mp4View];
[self.mp4View mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.top.equalTo(self).offset(-6);
make.right.bottom.equalTo(self).offset(6);
}];
}
-(void)setHeadIcon:(NSString *)headerIcon
dress:(nonnull NSString *)dress{
_dress = dress;
NSString *dressUrl = [dress stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
[self.headImageView sd_setImageWithURL:[NSURL URLWithString:headerIcon] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]];
if (dressUrl.length > 0 && ([dressUrl hasPrefix:@"http"] || [dressUrl hasPrefix:@"https"])) {
if ([dressUrl isExist]) {
if ([dressUrl hasSuffix:@"svga"]) {
[self.svgaView setHidden:NO];
[self.mp4View stopHWDMP4];
[self.mp4View setHidden:YES];
[self.svgaView destroySvga];
[self.svgaView loadSVGAPlayerWith:dressUrl inBundle:NO loop:INTMAX_MAX];
}else if ([dressUrl hasSuffix:@"mp4"]){
[self.svgaView setHidden:YES];
[self.mp4View setHidden:NO];
[self.mp4View stopHWDMP4];
MJWeakSelf
[[QXRequset shareInstance] downloadVideoPlayerWithUrl:dressUrl completion:^(BOOL result, NSString * _Nonnull fileName) {
NSString *videoPath = [QXFileManager getGiftVideoPath:dressUrl.lastPathComponent];
weakSelf.videoPath = videoPath;
[weakSelf.mp4View playHWDMP4:videoPath repeatCount:INTMAX_MAX delegate:self];
}];
}else{
[self.mp4View stopHWDMP4];
[self.svgaView destroySvga];
[self.svgaView setHidden:YES];
[self.mp4View setHidden:YES];
}
} else {
[self.mp4View stopHWDMP4];
[self.svgaView destroySvga];
[self.svgaView setHidden:YES];
[self.mp4View setHidden:YES];
}
}else{
[self.mp4View stopHWDMP4];
[self.svgaView destroySvga];
[self.svgaView setHidden:YES];
[self.mp4View setHidden:YES];
}
}
-(void)stopHWDMP4{
if (![_dress isExist]) {
return;
}
[self.mp4View stopHWDMP4];
}
-(void)playHWDMP4{
if (![_dress isExist]) {
return;
}
[self.mp4View playHWDMP4:self.videoPath repeatCount:INTMAX_MAX delegate:self];
}
- (QXEffectSvgaView *)svgaView {
if (!_svgaView) {
_svgaView = [[QXEffectSvgaView alloc] initWithFrame:CGRectZero isAutoPlay:YES];
_svgaView.hidden = YES;
}
return _svgaView;
}
- (VAPView *)mp4View {
if (!_mp4View) {
_mp4View = [[VAPView alloc] initWithFrame:CGRectZero];
_mp4View.hwd_enterBackgroundOP = HWDMP4EBOperationTypeDoNothing;
_mp4View.contentMode = UIViewContentModeScaleAspectFit;
_mp4View.userInteractionEnabled = NO;
_mp4View.backgroundColor = [UIColor clearColor];
_mp4View.hidden = YES;
}
return _mp4View;
}
@end

View File

@@ -0,0 +1,39 @@
//
// SREffectSvgaView.h
// SoundRiver
//
// Created by 段智博 on 2020/10/26.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface QXEffectSvgaView : UIView
/// isAutoPlay加载完成是否自动播放 【默认为YES】
- (instancetype)initWithFrame:(CGRect)frame isAutoPlay:(BOOL)isAutoPlay;
@property (nonatomic,copy) void(^didFinishedDisplay)(QXEffectSvgaView *svgaView);
@property (nonatomic,copy) void(^didStartAnimation)(void);
/// 加载资源
- (void)loadSVGAPlayerWith:(NSString *)loadPath;
/// 加载资源
- (void)loadSVGAPlayerWith:(NSString *)loadPath inBundle:(BOOL)inBundle;
/// 加载资源
- (void)loadSVGAPlayerWith:(NSString *)loadPath inBundle:(BOOL)inBundle loop:(int)loop;
/// 开始动画【不回调didStartAnimation开始block】
- (void)startEffectSvgaPlay;
/// 暂停动画
- (void)pauseEffectSvgaPlay;
/// 停止动画
- (void)stopEffectSvgaPlay;
/// 销毁
- (void)destroySvga;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,183 @@
//
// QXEffectSvgaView.m
// SoundRiver
//
// Created by on 2020/10/26.
//
#import "QXEffectSvgaView.h"
#import <SVGA.h>
@interface QXEffectSvgaView ()<SVGAPlayerDelegate>
//
@property (nonatomic,strong) SVGAPlayer *player;
@property (nonatomic,strong) SVGAParser *parser;
@property (nonatomic,assign) BOOL isAutoPlay;
@end
@implementation QXEffectSvgaView
- (instancetype)initWithFrame:(CGRect)frame isAutoPlay:(BOOL)isAutoPlay {
self = [super initWithFrame:frame];
if (self) {
[self initalizeData];
self.isAutoPlay = isAutoPlay;
}
return self;
}
- (instancetype)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
[self initalizeData];
}
return self;
}
- (void)initalizeData {
self.backgroundColor = [UIColor clearColor];
self.userInteractionEnabled = NO;
self.isAutoPlay = YES;
[self initPlayer];
}
- (void)initPlayer {
[self addSubview:self.player];
[self.player mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self);
}];
}
- (void)loadSVGAPlayerWith:(NSString *)loadPath {
[self loadSVGAPlayerWith:loadPath inBundle:NO];
}
- (void)loadSVGAPlayerWith:(NSString *)loadPath inBundle:(BOOL)inBundle {
[self loadSVGAPlayerWith:loadPath inBundle:inBundle loop:1];
}
- (void)loadSVGAPlayerWith:(NSString *)loadPath inBundle:(BOOL)inBundle loop:(int)loop {
if (![loadPath isExist]) {
return;
}
if (!_player) {
[self initPlayer];
}
[self stopEffectSvgaPlay];
self.player.loops = loop;
__weak typeof(self)weakSelf = self;
if ([loadPath hasPrefix:@"https:"] || [loadPath hasPrefix:@"http:"]) {
/// URL
[self.parser parseWithURL:[NSURL URLWithString:loadPath] completionBlock:^(SVGAVideoEntity * _Nullable videoItem) {
if (videoItem != nil) {
weakSelf.player.videoItem = videoItem;
if (weakSelf.isAutoPlay) {
[weakSelf.player startAnimation];
if (weakSelf.didStartAnimation) {
weakSelf.didStartAnimation();
}
}
}
} failureBlock:^(NSError * _Nullable error) {
if (weakSelf.didFinishedDisplay) {
weakSelf.didFinishedDisplay(weakSelf);
}
}];
}else if (inBundle) {
[self.parser parseWithNamed:loadPath inBundle:[NSBundle mainBundle] completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) {
if (videoItem != nil) {
weakSelf.player.videoItem = videoItem;
if (weakSelf.isAutoPlay) {
[weakSelf.player startAnimation];
if (weakSelf.didStartAnimation) {
weakSelf.didStartAnimation();
}
}
}
} failureBlock:^(NSError * _Nonnull error) {
if (weakSelf.didFinishedDisplay) {
weakSelf.didFinishedDisplay(weakSelf);
}
}];
} else {
NSData *data = [NSData dataWithContentsOfFile:loadPath];
if (!data || data.length < 4) {
if (weakSelf.didFinishedDisplay) {
weakSelf.didFinishedDisplay(weakSelf);
}
return;
}
[self.parser parseWithData:data cacheKey:loadPath completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) {
if (videoItem != nil) {
weakSelf.player.videoItem = videoItem;
if (weakSelf.isAutoPlay) {
[weakSelf.player startAnimation];
if (weakSelf.didStartAnimation) {
weakSelf.didStartAnimation();
}
}
}
} failureBlock:^(NSError * _Nonnull error) {
if (weakSelf.didFinishedDisplay) {
weakSelf.didFinishedDisplay(weakSelf);
}
}];
}
}
#pragma mark - Public
- (void)startEffectSvgaPlay {
if (self.player.videoItem) {
[self.player startAnimation];
}
}
- (void)pauseEffectSvgaPlay {
[self.player pauseAnimation];
}
- (void)stopEffectSvgaPlay {
[self.player stopAnimation];
}
- (void)destroySvga {
[self.player stopAnimation];
[self.player removeFromSuperview];
_player = nil;
_parser = nil;
}
#pragma mark - SVGAPlayerDelegate
- (void)svgaPlayerDidFinishedAnimation:(SVGAPlayer *)player {
[self.player stopAnimation];
if (self.didFinishedDisplay) {
self.didFinishedDisplay(self);
}
}
#pragma mark - Getter
//
- (SVGAPlayer *)player {
if (!_player) {
_player = [[SVGAPlayer alloc] initWithFrame:CGRectZero];
_player.backgroundColor = [UIColor clearColor];
_player.contentMode = UIViewContentModeScaleAspectFill;
// _player.contentMode = UIViewContentModeScaleAspectFit;
_player.clipsToBounds = YES;
_player.delegate = self;
_player.clearsAfterStop = YES;
}
return _player;
}
- (SVGAParser *)parser {
if (!_parser) {
_parser = [[SVGAParser alloc] init];
}
return _parser;
}
@end

View File

@@ -0,0 +1,55 @@
//
// QXGiftPlayer.h
// QXLive
//
// Created by 启星 on 2025/5/8.
//
#import <Foundation/Foundation.h>
#import "UIView+VAP.h"
#import "QXGiftModel.h"
NS_ASSUME_NONNULL_BEGIN
@class QXEffectContentView;
@interface QXGiftPlayerManager : NSObject
+ (instancetype)shareManager;
- (UIView *)defaultBgEffectView;
/// 礼物、坐骑【全屏位置】特效
- (QXEffectContentView *)defaultFullEffectView;
/// 坐骑【公屏信息流位置】特效
- (QXEffectContentView *)defaultChatEffectView;
/// 礼物、坐骑【全屏位置】特效 加载
- (void)displayFullEffectView:(NSString *)gift;
/// 礼物数组
- (void)displayFullEffectViewWithMorePlayImages:(NSArray *)playImages;
/// 坐骑【公屏信息流位置】特效 加载
- (void)displayChatEffectView:(NSString *)gift;
/// 关闭打开动效
- (void)openOrCloseEffectViewWith:(BOOL)isShow;
/// 销毁
- (void)destroyEffectSvga;
-(void)stopPlay;
-(void)startPlay;
@end
@interface QXEffectContentView : UIView
@property (nonatomic,assign) BOOL isShow;
@property (nonatomic,assign) BOOL isOnece;
@property (nonatomic,strong) VAPView *playerMp4View;
@property (nonatomic, strong) dispatch_queue_t queue;
-(void)previewEffectWith:(NSString *)play_image;
- (void)displayEffectView:(NSString *)play_image;
- (void)displayEffectViewWithMorePlayImages:(NSArray *)playImages;
- (void)openOrCloseEffectViewWith:(BOOL)isShow;
- (void)destroyEffectView;
-(void)stopPlay;
-(void)startPlay;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,475 @@
//
// QXGiftPlayer.m
// QXLive
//
// Created by on 2025/5/8.
//
#import "QXGiftPlayerManager.h"
#import "QXEffectSvgaView.h"
#import "QXFileManager.h"
#import "FMDB.h"
static NSString *TABLENAME = @"qxGitfPlayTable";
static NSString *ID = @"id";
static NSString *PLAY_IMAGE = @"play_image";
@interface QXGiftPlayerManager()
@property (nonatomic,strong) FMDatabase *fmdb;
@property (nonatomic,strong) UIView *bgEffectView;
//
@property (nonatomic,strong) QXEffectContentView *fullEffectView;
//
@property (nonatomic,strong) QXEffectContentView *chatEffectView;
@end
@implementation QXGiftPlayerManager
+ (instancetype)shareManager{
static QXGiftPlayerManager *manager;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
manager = [[QXGiftPlayerManager alloc] init];
// [manager creatDatabase];
});
return manager;
}
//
//- (NSString *)databaseFilePath
//{
// NSArray *filePath = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
// NSString *documentPath = [filePath objectAtIndex:0];
// NSString *dbFilePath = [documentPath stringByAppendingPathComponent:@"qx_gift.db"];
// return dbFilePath;
//}
//
////
//- (void)creatDatabase
//{
// _fmdb = [FMDatabase databaseWithPath:[self databaseFilePath]];
// //,
// [_fmdb setShouldCacheStatements:YES];
// [_fmdb open];
// NSString *sqlCreateTable = [NSString stringWithFormat:@"CREATE TABLE IF NOT EXISTS '%@' ('%@' INTEGER PRIMARY KEY AUTOINCREMENT, '%@' TEXT)",TABLENAME,ID,PLAY_IMAGE];
// BOOL res = [_fmdb executeUpdate:sqlCreateTable];
// NSLog(@"%@",res?@"数据库创建成功":@"数据库创建失败");
// [_fmdb close];
//}
//
//-(void)insertGiftWithPlayImage:(NSString*)giftImage{
// if ([_fmdb open]) {
// NSString *insertSql1= [NSString stringWithFormat:
// @"INSERT INTO '%@' ('%@') VALUES ('%@');",
// TABLENAME, PLAY_IMAGE, giftImage];
// BOOL res = [_fmdb executeUpdate:insertSql1];
// NSLog(@"%@",res?@"礼物添加成功":@"礼物添加失败");
// [_fmdb close];
// }
//}
//- (BOOL)deleteRecordWithId:(NSInteger)recordId {
// if ([_fmdb open]) {
// NSString *deleteSQL = [NSString stringWithFormat:
// @"DELETE FROM %@ WHERE id = ('%ld');",
// TABLENAME, recordId];
// BOOL success = [_fmdb executeUpdate:deleteSQL];
// if (!success) {
// NSLog(@"删除失败: %@", [_fmdb lastErrorMessage]);
// }else{
// NSLog(@"删除成功");
// }
// [_fmdb close];
// return success;
// }
// return NO;
//}
//
//-(BOOL)deleFirstImage{
// if ([_fmdb open]) {
// NSString *querySQL= [NSString stringWithFormat:
// @"SELECT id FROM '%@' ORDER BY id ASC LIMIT 1",
// TABLENAME];
// FMResultSet *resultSet = [_fmdb executeQuery:querySQL];
// [_fmdb close];
// if ([resultSet next]) {
// NSInteger recordId = [resultSet intForColumn:@"id"];
// return [self deleteRecordWithId:recordId];
// }
// }
// return NO;
//}
//
//-(NSString*)readFirstImage{
// if ([_fmdb open]) {
// NSString *querySQL= [NSString stringWithFormat:
// @"SELECT id FROM '%@' ORDER BY id ASC LIMIT 1",
// TABLENAME];
// FMResultSet *resultSet = [_fmdb executeQuery:querySQL];
// [_fmdb close];
// if ([resultSet next]) {
// NSString *playImage = [resultSet stringForColumn:PLAY_IMAGE];
// return playImage;
// }
// }
// return nil;
//}
- (UIView *)defaultBgEffectView {
return self.bgEffectView;
}
///
- (QXEffectContentView *)defaultFullEffectView {
return self.fullEffectView;
}
///
- (QXEffectContentView *)defaultChatEffectView {
return self.chatEffectView;
}
- (void)displayFullEffectView:(NSString *)gift {
// [self insertGiftWithPlayImage:gift];
[self.fullEffectView displayEffectView:gift];
}
- (void)displayFullEffectViewWithMorePlayImages:(NSArray *)playImages{
[self.fullEffectView displayEffectViewWithMorePlayImages:playImages];
}
- (void)displayChatEffectView:(NSString *)gift {
[self.chatEffectView displayEffectView:gift];
}
///
- (void)openOrCloseEffectViewWith:(BOOL)isShow {
[self.fullEffectView openOrCloseEffectViewWith:isShow];
[self.chatEffectView openOrCloseEffectViewWith:isShow];
}
///
- (void)destroyEffectSvga {
[self.fullEffectView destroyEffectView];
[self.chatEffectView destroyEffectView];
[self.fullEffectView removeFromSuperview];
[self.chatEffectView removeFromSuperview];
[self.bgEffectView removeFromSuperview];
_fullEffectView = nil;
_chatEffectView = nil;
_bgEffectView = nil;
}
-(void)stopPlay{
[self.fullEffectView stopPlay];
[self.chatEffectView stopPlay];
}
-(void)startPlay{
[self.fullEffectView startPlay];
[self.chatEffectView startPlay];
}
- (UIView *)bgEffectView {
if (!_bgEffectView) {
_bgEffectView = [[UIView alloc] init];
_bgEffectView.userInteractionEnabled = NO;
[_bgEffectView addSubview:self.fullEffectView];
[_bgEffectView addSubview:self.chatEffectView];
}
return _bgEffectView;
}
- (QXEffectContentView *)fullEffectView {
if (!_fullEffectView) {
_fullEffectView = [[QXEffectContentView alloc] initWithFrame:CGRectZero];
_fullEffectView.queue = dispatch_queue_create("qx_room_full_svga_message.com", NULL);
}
return _fullEffectView;
}
- (QXEffectContentView *)chatEffectView {
if (!_chatEffectView) {
_chatEffectView = [[QXEffectContentView alloc] initWithFrame:CGRectZero];
[_chatEffectView.playerMp4View mas_remakeConstraints:^(MASConstraintMaker *make) {
// make.centerX.centerY.equalTo(_chatEffectView);
// make.width.mas_equalTo(ScaleWidth(375));
// make.height.mas_equalTo(ScaleWidth(375));
make.edges.equalTo(_chatEffectView);
}];
_chatEffectView.queue = dispatch_queue_create("qx_room_chat_svga_message.com", NULL);
}
return _chatEffectView;
}
@end
@interface QXEffectContentView ()<HWDMP4PlayDelegate>
@property (nonatomic,strong) QXEffectSvgaView *svagView;
@property (nonatomic,strong) QXGiftModel *playModel;
@property (nonatomic, assign) BOOL isLoadEffect; ///<
@property (nonatomic, strong) NSRecursiveLock *lock;
@property (nonatomic, strong) NSMutableArray *giftArray;
@end
@implementation QXEffectContentView
- (instancetype)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
self.userInteractionEnabled = NO;
self.isLoadEffect = NO;
[self addSubview:self.svagView];
[self addSubview:self.playerMp4View];
[self.svagView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self);
}];
[self.playerMp4View mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self);
}];
}
return self;
}
/// gift
- (void)displayEffectView:(NSString *)play_image {
dispatch_async(self.queue, ^{
/// play_imagereturn
if (![play_image isExist]) {
return;
}
/// play_image
NSString *pathExtension = [play_image pathExtension].lowercaseString;
/// svgamp4 return
if (!([pathExtension isEqualToString:@"svga"] || [pathExtension isEqualToString:@"mp4"])) {
return;
}
/// list
[self.lock lock];
/// list
[self.giftArray addObject:play_image];
NSLog(@"当前礼物有---%ld个",self.giftArray.count);
///
[self.lock unlock];
///
if (self.isLoadEffect == NO) {
///
self.isLoadEffect = YES;
[self loadStartSVGAPlayer];
}
});
}
/// gift
- (void)displayEffectViewWithMorePlayImages:(NSArray *)playImages {
dispatch_async(self.queue, ^{
/// play_imagereturn
if (playImages.count == 0) {
return;
}
/// list
[self.lock lock];
/// list
[self.giftArray addObjectsFromArray:playImages];
NSLog(@"当前礼物有---%ld个",self.giftArray.count);
///
[self.lock unlock];
///
if (self.isLoadEffect == NO) {
///
self.isLoadEffect = YES;
[self loadStartSVGAPlayer];
}
});
}
-(void)previewEffectWith:(NSString *)play_image{
self.isOnece = YES;
dispatch_async(dispatch_get_main_queue(), ^{
if ([play_image hasSuffix:@"mp4"]) {
__weak typeof(self)weakSelf = self;
/// mp4
[[QXRequset shareInstance] downloadVideoPlayerWithUrl:play_image completion:^(BOOL result, NSString * _Nonnull fileName) {
NSString *videoPath = [QXFileManager getGiftVideoPath:fileName];
dispatch_async(dispatch_get_main_queue(), ^{
weakSelf.playerMp4View.hidden = NO;
weakSelf.svagView.hidden = YES;
});
[weakSelf.playerMp4View stopHWDMP4];
[weakSelf.playerMp4View playHWDMP4:videoPath delegate:self];
}];
}else if ([play_image hasSuffix:@"svg"] || [play_image hasSuffix:@"svga"]) {
__weak typeof(self)weakSelf = self;
/// svga
[[QXRequset shareInstance] downloadVideoPlayerWithUrl:play_image completion:^(BOOL result, NSString * _Nonnull fileName) {
dispatch_async(dispatch_get_main_queue(), ^{
weakSelf.playerMp4View.hidden = YES;
weakSelf.svagView.hidden = NO;
});
NSString *filePath = [QXFileManager getGiftVideoPath:fileName];
[weakSelf.svagView loadSVGAPlayerWith:filePath];
}];
}
});
}
- (void)openOrCloseEffectViewWith:(BOOL)isShow {
_isShow = isShow;
[self removeSvgaQueueData];
[self.svagView stopEffectSvgaPlay];
// [self.playerView stop];
[self.playerMp4View stopHWDMP4];
// [self.alphaVideoView stop];
self.playerMp4View.hidden = YES;
[self setHidden:!isShow];
}
-(void)stopPlay{
// [self removeSvgaQueueData];
self.isLoadEffect = NO;
[self.svagView stopEffectSvgaPlay];
// [self.playerView stop];
[self.playerMp4View stopHWDMP4];
// [self.alphaVideoView stop];
self.playerMp4View.hidden = YES;
self.svagView.hidden = YES;
}
-(void)startPlay{
[self loadStartSVGAPlayer];
}
-(void)viewDidFinishPlayMP4:(NSInteger)totalFrameCount view:(VAPView *)container{
dispatch_async(dispatch_get_main_queue(), ^{
self.playerMp4View.hidden = YES;
});
if (self.isOnece) {
return;
}
dispatch_async(dispatch_get_main_queue(), ^{
[self loadStartSVGAPlayer];
});
}
-(void)viewDidFailPlayMP4:(NSError *)error{
dispatch_async(dispatch_get_main_queue(), ^{
self.playerMp4View.hidden = YES;
});
if (self.isOnece) {
return;
}
dispatch_async(dispatch_get_main_queue(), ^{
[self loadStartSVGAPlayer];
});
}
- (void)loadStartSVGAPlayer {
if (!_isShow) {
/// isshow return
return;
}
NSString *play_image = nil;
/// list
[self.lock lock];
/// list0
if (self.giftArray.count > 0) {
/// giftlist
play_image = self.giftArray.firstObject;
/// list
[self.giftArray removeObjectAtIndex:0];
self.isLoadEffect = YES;
}else {
self.isLoadEffect = NO;
}
///
[self.lock unlock];
if (self.isLoadEffect && [play_image isExist]) {
dispatch_async(dispatch_get_main_queue(), ^{
if ([play_image hasSuffix:@"mp4"]) {
__weak typeof(self)weakSelf = self;
/// mp4
[[QXRequset shareInstance] downloadVideoPlayerWithUrl:play_image completion:^(BOOL result, NSString * _Nonnull fileName) {
NSString *videoPath = [QXFileManager getGiftVideoPath:fileName];
dispatch_async(dispatch_get_main_queue(), ^{
weakSelf.playerMp4View.hidden = NO;
weakSelf.svagView.hidden = YES;
});
[weakSelf.playerMp4View stopHWDMP4];
[weakSelf.playerMp4View playHWDMP4:videoPath delegate:self];
}];
}else if ([play_image hasSuffix:@"svg"] || [play_image hasSuffix:@"svga"]) {
__weak typeof(self)weakSelf = self;
/// svga
[[QXRequset shareInstance] downloadVideoPlayerWithUrl:play_image completion:^(BOOL result, NSString * _Nonnull fileName) {
dispatch_async(dispatch_get_main_queue(), ^{
weakSelf.playerMp4View.hidden = YES;
weakSelf.svagView.hidden = NO;
});
NSString *filePath = [QXFileManager getGiftVideoPath:fileName];
[weakSelf.svagView loadSVGAPlayerWith:filePath];
}];
}else {
[self.lock lock];
self.isLoadEffect = NO;
[self.lock unlock];
[self loadStartSVGAPlayer];
}
});
}
}
- (void)loadEndSvgaPlayer {
dispatch_async(self.queue, ^{
[self loadStartSVGAPlayer];
});
}
- (void)destroyEffectView {
[self removeSvgaQueueData];
[self.svagView destroySvga];
// [self.playerView destroyPlayer];
[self.playerMp4View stopHWDMP4];
[self.svagView removeFromSuperview];
[self.playerMp4View removeFromSuperview];
_svagView = nil;
// _playerView = nil;
_playModel = nil;
_playerMp4View = nil;
// _alphaVideoView = nil;
}
- (void)removeSvgaQueueData {
[self.lock lock];
[self.giftArray removeAllObjects];
self.isLoadEffect = NO;
[self.lock unlock];
}
-(NSMutableArray *)giftArray{
if (!_giftArray) {
_giftArray = [NSMutableArray array];
}
return _giftArray;
}
- (QXEffectSvgaView *)svagView {
if (!_svagView) {
_svagView = [[QXEffectSvgaView alloc] initWithFrame:CGRectZero isAutoPlay:YES];
__weak typeof(self)weakSelf = self;
_svagView.didFinishedDisplay = ^(QXEffectSvgaView * _Nonnull svgaView) {
[svgaView destroySvga];
if (weakSelf.isOnece) {
return;
}
[weakSelf loadEndSvgaPlayer];
};
}
return _svagView;
}
-(VAPView *)playerMp4View{
if (!_playerMp4View) {
_playerMp4View = [[VAPView alloc] initWithFrame:CGRectZero];
_playerMp4View.hwd_enterBackgroundOP = HWDMP4EBOperationTypeStop;
_playerMp4View.contentMode = UIViewContentModeScaleAspectFit;
_playerMp4View.userInteractionEnabled = NO;
_playerMp4View.backgroundColor = [UIColor clearColor];
// _playerMp4View.hwd_Delegate = self;
}
return _playerMp4View;
}
@end

View File

@@ -0,0 +1,52 @@
//
// QXRedBagDrawView.h
// QXLive
//
// Created by 启星 on 2025/10/11.
//
#import <UIKit/UIKit.h>
#import "QXRedPacketModel.h"
typedef NS_ENUM(NSInteger) {
/// 打开红包
QXRedBagDrawTypeOpen = 0,
/// 仅倒计时
QXRedBagDrawTypeTimeDown,
/// 仅收藏房间
QXRedBagDrawTypeCollect,
/// 手慢了被领完了
QXRedBagDrawTypeFinished,
/// 发送评论领红包
QXRedBagDrawTypePwdSend,
/// 需要完成两个收藏房间和倒计时
QXRedBagDrawTypePwdAllTask,
}QXRedBagDrawType;
NS_ASSUME_NONNULL_BEGIN
@interface QXRedBagDrawView : UIView
@property (nonatomic,strong)QXRedPacketModel *redpacketModel;
@property (nonatomic,strong)NSString *room_id;
/// 是否已经收藏过房间
@property (nonatomic,assign)BOOL isCollectedRoom;
/// 倒计时
@property (nonatomic,assign)long needTime;
/// 是否是发送评论地方过来
@property (nonatomic,assign)BOOL isFromToComment;
@property (nonatomic,copy)void(^toInputPwdBlock)(NSString *password,QXRedPacketModel*redpacketModel);
@property (nonatomic,copy)void(^collectRoomBlock)(void);
-(void)changeViewType:(QXRedBagDrawType)type;
-(void)showInView:(UIView*)view;
-(void)hide;
@end
@interface QXRedBagTimeDownView : UIView
@property (nonatomic,strong)UIImageView *bgImageView;
@property (nonatomic,strong)UILabel *timeLabel;
@property (nonatomic,strong)UIButton *btn;
@property (nonatomic,assign)QXRedBagDrawType type;
@property (nonatomic,assign)int time;
@property (nonatomic,copy)void(^btnBlcok)(QXRedBagDrawType type);
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,552 @@
//
// QXRedBagDrawView.m
// QXLive
//
// Created by on 2025/10/11.
//
#import "QXRedBagDrawView.h"
#import "QXRedBagRecordViewController.h"
#import "QXMineNetwork.h"
@class QXRedBagTimeDownView;
@interface QXRedBagDrawView()
@property (nonatomic,strong)UIView *bgView;
@property (nonatomic,strong)UIImageView *bgImageView;
@property (nonatomic,strong)UIImageView *pwdImageView;
@property (nonatomic,strong)UIImageView *userHeaderImageView;
@property (nonatomic,strong)UILabel *userNameLabel;
@property (nonatomic,strong)UILabel *remarkLabel;
@property (nonatomic,strong)UIButton *closeBtn;
///
@property (nonatomic,strong)UIButton *openBtn;
///
@property (nonatomic,strong)UIButton *recordBtn;
///
@property (nonatomic,strong)QXRedBagTimeDownView *timeDownView;
///
@property (nonatomic,strong)UIView *pwdBgView;
@property (nonatomic,strong)UILabel *drawTitleLabel;
@property (nonatomic,strong)UILabel *commentTitleLabel;
@property (nonatomic,strong)UILabel *pwdTitleLable;
///
@property (nonatomic,strong)UILabel *bottomLabel;
@property (nonatomic,assign)QXRedBagDrawType drawType;
@property (nonatomic,assign)BOOL isDrawNet;
@end
@implementation QXRedBagDrawView
- (instancetype)init
{
self = [super init];
if (self) {
self.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
[self initSubviews];
}
return self;
}
-(void)initSubviews{
self.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.3];
self.bgView = [[UIView alloc] initWithFrame:CGRectMake((SCREEN_WIDTH-345)/2, (SCREEN_HEIGHT-454)/2, 345, 454)];
[self addSubview:self.bgView];
self.bgImageView = [[UIImageView alloc] initWithFrame:self.bgView.bounds];
self.bgImageView.image = [UIImage imageNamed:@"room_draw_redbag_bg"];
[self.bgView addSubview:self.bgImageView];
self.pwdImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"red_packet_pwd_icon"]];
self.pwdImageView.frame = CGRectMake(0, 0, 119, 41);
self.pwdImageView.hidden = YES;
[self.bgView addSubview:self.pwdImageView];
self.closeBtn = [[UIButton alloc] init];
[self.closeBtn setImage:[UIImage imageNamed:@"room_redbag_close"] forState:(UIControlStateNormal)];
[self.closeBtn addTarget:self action:@selector(closeAction) forControlEvents:(UIControlEventTouchUpInside)];
[self.bgView addSubview:self.closeBtn];
[self.closeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.height.mas_equalTo(40);
make.right.mas_equalTo(-5);
make.top.mas_equalTo(15);
}];
self.userHeaderImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"user_header_placehoulder"]];
self.userHeaderImageView.contentMode = UIViewContentModeScaleAspectFill;
[self.userHeaderImageView addRoundedCornersWithRadius:39.5];
[self.bgView addSubview:self.userHeaderImageView];
[self.userHeaderImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self.bgView);
make.top.mas_equalTo(73);
make.width.height.mas_equalTo(79);
}];
self.userNameLabel = [[UILabel alloc] init];
self.userNameLabel.text = @"傻狗涛";
self.userNameLabel.textColor = RGB16(0xffffff);
self.userNameLabel.font = [UIFont boldSystemFontOfSize:18];
self.userNameLabel.textAlignment = NSTextAlignmentCenter;
[self.bgView addSubview:self.userNameLabel];
[self.userNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(15);
make.right.mas_equalTo(-15);
make.height.mas_equalTo(26);
make.top.equalTo(self.userHeaderImageView.mas_bottom).offset(27);
}];
self.remarkLabel = [[UILabel alloc] init];
self.remarkLabel.textColor = RGB16(0xffffff);
self.remarkLabel.text = @"恭喜发财,大吉大利";
self.remarkLabel.font = [UIFont boldSystemFontOfSize:24];
self.remarkLabel.textAlignment = NSTextAlignmentCenter;
[self.bgView addSubview:self.remarkLabel];
[self.remarkLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(15);
make.right.mas_equalTo(-15);
make.height.mas_equalTo(26);
make.top.equalTo(self.userNameLabel.mas_bottom).offset(2);
}];
self.openBtn = [[UIButton alloc] init];
[self.openBtn setImage:[UIImage imageNamed:@"draw_redbag_btn"] forState:(UIControlStateNormal)];
[self.openBtn addTarget:self action:@selector(openAction) forControlEvents:(UIControlEventTouchUpInside)];
[self.bgView addSubview:self.openBtn];
[self.openBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.remarkLabel.mas_bottom).offset(19);
make.width.height.mas_equalTo(126);
make.centerX.equalTo(self.bgView);
}];
self.recordBtn = [[UIButton alloc] init];
[self.recordBtn setTitle:@"查看大家手气 >" forState:(UIControlStateNormal)];
[self.recordBtn setTitleColor:RGB16(0xffffff) forState:(UIControlStateNormal)];
self.recordBtn.titleLabel.font = [UIFont systemFontOfSize:16];
[self.recordBtn addTarget:self action:@selector(recordAction) forControlEvents:(UIControlEventTouchUpInside)];
[self.bgView addSubview:self.recordBtn];
[self.recordBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self.bgView);
make.bottom.mas_equalTo(-63);
make.height.mas_equalTo(26);
}];
self.timeDownView = [[QXRedBagTimeDownView alloc] init];
self.timeDownView.hidden = YES;
@weakify(self)
self.timeDownView.btnBlcok = ^(QXRedBagDrawType type) {
@strongify(self);
if (type == QXRedBagDrawTypeCollect) {
///
[self collectRoom];
return;
}
if (self.toInputPwdBlock) {
self.toInputPwdBlock(self.redpacketModel.password,self.redpacketModel);
}
[self hide];
};
[self.bgView addSubview:self.timeDownView];
[self.timeDownView mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(220);
make.height.mas_equalTo(93);
make.centerX.equalTo(self.bgView);
make.top.equalTo(self.remarkLabel.mas_bottom).offset(30);
}];
self.bottomLabel = [[UILabel alloc] init];
self.bottomLabel.text = @"抢红包必须在本房间内";
self.bottomLabel.hidden = YES;
self.bottomLabel.textColor = RGB16(0xffffff);
self.bottomLabel.font = [UIFont systemFontOfSize:14];
[self.bgView addSubview:self.bottomLabel];
[self.bottomLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(26);
make.bottom.mas_equalTo(-15);
make.centerX.equalTo(self.bgView);
}];
self.pwdBgView = [[UIView alloc] init];
[self.bgView addSubview:self.pwdBgView];
[self.pwdBgView mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.equalTo(self.bottomLabel.mas_top);
make.left.mas_equalTo(15);
make.right.mas_equalTo(-15);
make.height.mas_equalTo(72);
}];
self.drawTitleLabel = [[UILabel alloc] init];
self.drawTitleLabel.text = @"红包参与条件";
self.drawTitleLabel.textColor = RGB16(0xffffff);
self.drawTitleLabel.textAlignment = NSTextAlignmentCenter;
self.drawTitleLabel.font = [UIFont systemFontOfSize:12];
[self.pwdBgView addSubview:self.drawTitleLabel];
[self.drawTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.pwdBgView);
make.height.mas_equalTo(20);
make.centerX.equalTo(self.bgView);
}];
self.commentTitleLabel = [[UILabel alloc] init];
self.commentTitleLabel.text = @"发送评论:这是一个口令";
self.commentTitleLabel.textColor = RGB16(0xFFCE47);
self.commentTitleLabel.textAlignment = NSTextAlignmentCenter;
self.commentTitleLabel.font = [UIFont systemFontOfSize:14];
[self.pwdBgView addSubview:self.commentTitleLabel];
[self.commentTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.drawTitleLabel.mas_bottom).offset(3);
make.height.mas_equalTo(20);
make.centerX.equalTo(self.bgView);;
}];
self.pwdTitleLable = [[UILabel alloc] init];
self.pwdTitleLable.text = @"收藏房间";
self.pwdTitleLable.textColor = RGB16(0xFFCE47);
self.pwdTitleLable.textAlignment = NSTextAlignmentCenter;
self.pwdTitleLable.font = [UIFont systemFontOfSize:14];
[self.pwdBgView addSubview:self.pwdTitleLable];
[self.pwdTitleLable mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.commentTitleLabel.mas_bottom).offset(3);
make.height.mas_equalTo(20);
make.centerX.equalTo(self.bgView);;
}];
}
-(void)collectRoom{
MJWeakSelf
[QXMineNetwork roomCollectWithType:@"1" room_id:self.room_id successBlock:^(NSDictionary * _Nonnull dict) {
if (weakSelf.collectRoomBlock) {
weakSelf.collectRoomBlock();
}
weakSelf.isCollectedRoom = YES;
if ([weakSelf.redpacketModel canOpenNow]) {
[weakSelf setType:(QXRedBagDrawTypeOpen)];
}else{
[weakSelf setType:QXRedBagDrawTypeTimeDown];
}
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
}];
}
/**
///
QXRedBagDrawTypeOpen = 0,
///
QXRedBagDrawTypeTimeDown,
///
QXRedBagDrawTypeCollect,
///
QXRedBagDrawTypeFinished,
///
QXRedBagDrawTypePwdSend,
///
QXRedBagDrawTypePwdTimeDown,
///
QXRedBagDrawTypePwdCollect,
*/
-(void)setIsCollectedRoom:(BOOL)isCollectedRoom{
_isCollectedRoom = isCollectedRoom;
}
-(void)setRedpacketModel:(QXRedPacketModel *)redpacketModel{
_redpacketModel = redpacketModel;
[self setType:[self getDrawTypeWithRedpacktModel:redpacketModel]];
self.remarkLabel.text = redpacketModel.remark;
[self.userHeaderImageView sd_setImageWithURL:[NSURL URLWithString:redpacketModel.avatar]];
self.userNameLabel.text = [NSString stringWithFormat:@"%@的红包",redpacketModel.nickname];
self.commentTitleLabel.text = [NSString stringWithFormat:@"发送评论:%@",redpacketModel.password];
if (redpacketModel.type.intValue == 2) {
self.pwdImageView.hidden = NO;
}else{
self.pwdImageView.hidden = YES;
}
if (self.drawType == QXRedBagDrawTypeOpen) {
self.pwdBgView.hidden = YES;
self.bottomLabel.hidden = YES;
}else{
self.pwdBgView.hidden = NO;
self.bottomLabel.hidden = NO;
if (redpacketModel.type.intValue == 2) {
self.commentTitleLabel.hidden = NO;
}else{
self.commentTitleLabel.hidden = YES;
}
if (redpacketModel.conditions.intValue == 0) {
self.pwdTitleLable.hidden = YES;
self.drawTitleLabel.hidden = YES;
}else{
self.pwdTitleLable.hidden = NO;
self.drawTitleLabel.hidden = NO;
if ([redpacketModel.conditions isEqualToString:@"1,2"]) {
self.pwdTitleLable.text = @"收藏房间,仅麦上用户";
}else if ([redpacketModel.conditions isEqualToString:@"1"]) {
self.pwdTitleLable.text = @"收藏房间";
}else if ([redpacketModel.conditions isEqualToString:@"1"]) {
self.pwdTitleLable.text = @"仅麦上用户";
}
}
}
}
-(void)setIsFromToComment:(BOOL)isFromToComment{
_isFromToComment = isFromToComment;
}
-(void)setNeedTime:(long)needTime{
_needTime = needTime;
NSInteger min = (needTime % 3600) / 60;
NSInteger second = needTime % 60;
self.timeDownView.timeLabel.text = [NSString stringWithFormat:@"%02ld:%02ld后开启红包",min,(long)second];
}
-(void)changeViewType:(QXRedBagDrawType)type{
[self setType:type];
}
-(void)setType:(QXRedBagDrawType)type{
_drawType = type;
switch (type) {
case QXRedBagDrawTypeOpen:{
self.openBtn.hidden = NO;
self.remarkLabel.text = self.redpacketModel.remark;
self.recordBtn.hidden = YES;
self.timeDownView.hidden = YES;
self.bottomLabel.hidden = YES;
self.pwdBgView.hidden = YES;
}
break;
case QXRedBagDrawTypeFinished:{
self.openBtn.hidden = YES;
self.remarkLabel.text = @"手慢了,红包被领完了";
self.recordBtn.hidden = NO;
self.timeDownView.hidden = YES;
self.bottomLabel.hidden = YES;
self.pwdBgView.hidden = YES;
}
break;
case QXRedBagDrawTypeCollect:{
self.openBtn.hidden = YES;
self.remarkLabel.text = self.redpacketModel.remark;
self.recordBtn.hidden = YES;
self.timeDownView.type = QXRedBagDrawTypeCollect;
self.timeDownView.hidden = NO;
self.bottomLabel.hidden = NO;
self.pwdBgView.hidden = NO;
self.commentTitleLabel.hidden = YES;
self.pwdTitleLable.text= @"收藏房间";
}
break;
case QXRedBagDrawTypeTimeDown:{
self.openBtn.hidden = YES;
self.remarkLabel.text = self.redpacketModel.remark;
self.recordBtn.hidden = YES;
self.timeDownView.type = QXRedBagDrawTypeTimeDown;
self.timeDownView.hidden = NO;
self.bottomLabel.hidden = NO;
}
break;
case QXRedBagDrawTypePwdSend:{
self.openBtn.hidden = YES;
self.remarkLabel.text = self.redpacketModel.remark;
self.recordBtn.hidden = YES;
self.timeDownView.type = QXRedBagDrawTypePwdSend;
self.timeDownView.hidden = NO;
}
break;
case QXRedBagDrawTypePwdAllTask:{
self.openBtn.hidden = YES;
self.remarkLabel.text = @"手慢了,红包被领完了";
self.recordBtn.hidden = NO;
}
break;
default:
break;
}
}
#pragma mark - action
-(void)closeAction{
[self hide];
}
-(void)openAction{
MJWeakSelf
if (self.isDrawNet) {
return;
}
self.isDrawNet = YES;
[QXMineNetwork drawRedpacketWithRedpacketId:self.redpacketModel.redpacket_id successBlock:^(NSString * _Nonnull code) {
weakSelf.isDrawNet = NO;
weakSelf.redpacketModel.is_qiang = @"1";
if (code.intValue == 1) {
QXRedBagRecordViewController *vc = [[QXRedBagRecordViewController alloc] init];
vc.redbagId = weakSelf.redpacketModel.redpacket_id;
[weakSelf.viewController.navigationController pushViewController:vc animated:YES];
[weakSelf hide];
}else if (code.intValue == 2){
showToast(@"您已抢过该红包");
QXRedBagRecordViewController *vc = [[QXRedBagRecordViewController alloc] init];
vc.redbagId = weakSelf.redpacketModel.redpacket_id;
[weakSelf.viewController.navigationController pushViewController:vc animated:YES];
[weakSelf hide];
}else{
[weakSelf setType:QXRedBagDrawTypeFinished];
}
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
weakSelf.isDrawNet = NO;
showToast(msg);
}];
// CABasicAnimation *rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
// //
// rotationAnimation.toValue = [NSNumber numberWithFloat: M_PI];
// //
// rotationAnimation.duration = 0.5;
// rotationAnimation.cumulative = YES;
// rotationAnimation.removedOnCompletion = NO;
// //MAXFLOAT
// rotationAnimation.repeatCount = MAXFLOAT;
// [self.openBtn.layer addAnimation:rotationAnimation forKey:@"openRedBagAnimate"];
//
// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
// [self.openBtn.layer removeAnimationForKey:@"openRedBagAnimate"];
//
// BOOL isDrawed = NO;
// if (isDrawed) {
// QXRedBagRecordViewController *vc = [[QXRedBagRecordViewController alloc] init];
// vc.redbagId = @"";
// [self.viewController.navigationController pushViewController:vc animated:YES];
// [self hide];
// }else{
// [self setType:QXRedBagDrawTypeFinished];
// }
//
// });
}
-(void)recordAction{
QXRedBagRecordViewController *vc = [[QXRedBagRecordViewController alloc] init];
vc.redbagId = self.redpacketModel.redpacket_id;
[self.viewController.navigationController pushViewController:vc animated:YES];
[self hide];
}
-(QXRedBagDrawType)getDrawTypeWithRedpacktModel:(QXRedPacketModel*)model{
self.drawType = QXRedBagDrawTypeOpen;
if (model.type.intValue == 1) {
//
self.drawType = QXRedBagDrawTypeOpen;
///
if (model.countdown.intValue > 0) {
if ([model remainingTime]>0) {
self.drawType = QXRedBagDrawTypeTimeDown;
}
}
///
if ([model.conditions containsString:@"1"] && !self.isCollectedRoom){
self.drawType = QXRedBagDrawTypeCollect;
}
}else{
//
self.drawType = QXRedBagDrawTypePwdSend;
if (self.isFromToComment) {
if ([model.conditions containsString:@"1"] && !self.isCollectedRoom){
self.drawType = QXRedBagDrawTypeCollect;
}else{
if ([self.redpacketModel canOpenNow]) {
[self setType:(QXRedBagDrawTypeOpen)];
}else{
[self setType:QXRedBagDrawTypeTimeDown];
}
}
}
}
return self.drawType;
}
-(void)showInView:(UIView *)view{
self.bgView.y = -SCREEN_HEIGHT;
[view addSubview:self];
[UIView animateWithDuration:0.3 delay:0 usingSpringWithDamping:0.5 initialSpringVelocity:1.0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
self.bgView.y = (SCREEN_HEIGHT-454)/2;
} completion:^(BOOL finished) {
}];
}
-(void)hide{
self.redpacketModel = nil;
[UIView animateWithDuration:0.3 delay:0 usingSpringWithDamping:0.5 initialSpringVelocity:1.0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
self.bgView.y = SCREEN_HEIGHT;
} completion:^(BOOL finished) {
[self removeFromSuperview];
}];
}
@end
@implementation QXRedBagTimeDownView
- (instancetype)init
{
self = [super init];
if (self) {
[self initSubViews];
}
return self;
}
-(void)setType:(QXRedBagDrawType)type{
_type = type;
switch (type) {
case QXRedBagDrawTypeCollect:{
self.timeLabel.text = @"收藏房间抢红包";
}
break;
case QXRedBagDrawTypeTimeDown:{
self.timeLabel.text = @"00:00后开启红包";
}
break;
case QXRedBagDrawTypePwdSend:{
self.timeLabel.text = @"发送评论抢红包";
}
break;
case QXRedBagDrawTypePwdAllTask:{
self.timeLabel.text = @"完成任务抢红包";
}
break;
default:
break;
}
}
-(void)btnClick{
if (self.type == QXRedBagDrawTypePwdSend || self.type == QXRedBagDrawTypeCollect) {
if (self.btnBlcok) {
self.btnBlcok(self.type);
}
}
}
-(void)setTime:(int)time{
_time = time;
}
-(void)initSubViews{
self.bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"red_bag_time_down_bg"]];
[self addSubview:self.bgImageView];
[self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self);
}];
self.timeLabel = [[UILabel alloc] init];
self.timeLabel.textAlignment = NSTextAlignmentCenter;
self.timeLabel.font = [UIFont boldSystemFontOfSize:22];
self.timeLabel.textColor = RGB16(0xffffff);
[self addSubview:self.timeLabel];
[self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(self);
make.height.mas_equalTo(26);
make.top.mas_equalTo(19);
}];
self.btn = [[UIButton alloc] init];
[self.btn addTarget:self action:@selector(btnClick) forControlEvents:(UIControlEventTouchUpInside)];
[self addSubview:self.btn];
[self.btn mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self);
}];
}
@end

View File

@@ -0,0 +1,29 @@
//
// QXRedBagListView.h
// QXLive
//
// Created by 启星 on 2025/10/11.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface QXRedBagListView : UIView
@property (nonatomic,strong)NSArray <QXRedPacketModel*>*dataArray;
@property (nonatomic,copy)void(^didSelectedRedBlock)(QXRedPacketModel*model);
-(void)showInView:(UIView *)view;
-(void)hide;
-(void)updateRedpacketTimeWithIndex:(NSInteger)index time:(long)time;
@end
@interface QXRedBagListCell : UICollectionViewCell
@property (nonatomic,strong)QXRedPacketModel* redpacketModel;
@property (nonatomic,strong)UIImageView *redBagImageView;
@property (nonatomic,strong)UIImageView *pwdImageView;
@property (nonatomic,strong)UILabel *timeLabel;
@property (nonatomic,strong)UILabel *nameLabel;
@property (nonatomic,assign)long endTime;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,228 @@
//
// QXRedBagListView.m
// QXLive
//
// Created by on 2025/10/11.
//
#import "QXRedBagListView.h"
@interface QXRedBagListView()<UICollectionViewDelegate,UICollectionViewDataSource>
@property (nonatomic,strong)UIView *bigBgView;
@property (nonatomic,strong)UIImageView *bigBgImageView;
@property (nonatomic,strong)UIView *bgView;
@property (nonatomic,strong)UIImageView *bgImageView;
@property (nonatomic,strong)UIImageView *bottomImageView;
@property (nonatomic,strong)UIButton *closeBtn;
@property (nonatomic,strong)UICollectionView *collectionView;
@end
@implementation QXRedBagListView
- (instancetype)init
{
self = [super init];
if (self) {
self.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
[self initSubviews];
}
return self;
}
-(void)initSubviews{
self.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.3];
self.bigBgView = [[UIView alloc] initWithFrame:CGRectMake((SCREEN_WIDTH-375)/2, (SCREEN_HEIGHT-480)/2, 375, 480)];
[self addSubview:self.bigBgView];
self.bigBgImageView = [[UIImageView alloc] initWithFrame:self.bigBgView.bounds];
self.bigBgImageView.image = [UIImage imageNamed:@"red_bag_list_big_bg"];
[self.bigBgView addSubview:self.bigBgImageView];
self.bgView = [[UIView alloc] init];
[self.bgView addRoundedCornersWithRadius:10];
[self.bigBgView addSubview:self.bgView];
[self.bgView mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(280);
make.height.mas_equalTo(272);
make.centerX.equalTo(self.bigBgView);
make.top.mas_equalTo(60);
}];
self.bgImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.bgView.width, 242)];
self.bgImageView.image = [UIImage imageNamed:@"red_bag_list_bg"];
[self.bgView addSubview:self.bgImageView];
[self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.top.equalTo(self.bgView);
make.height.mas_equalTo(242);
}];
self.bottomImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"red_bag_list_bottom_bg"]];
self.bottomImageView.contentMode = UIViewContentModeScaleToFill;
[self.bgView addSubview:self.bottomImageView];
[self.bottomImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.bottom.right.equalTo(self.bgView);
make.top.equalTo(self.bgImageView.mas_bottom).offset(-1);
}];
self.closeBtn = [[UIButton alloc] init];
[self.closeBtn setBackgroundImage:[UIImage imageNamed:@"home_white_close"] forState:(UIControlStateNormal)];
[self.closeBtn addTarget:self action:@selector(closeAction) forControlEvents:(UIControlEventTouchUpInside)];
[self.bigBgView addSubview:self.closeBtn];
[self.closeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self);
make.top.equalTo(self.bgView.mas_bottom).offset(40);
make.height.width.mas_equalTo(30);
}];
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
layout.itemSize = CGSizeMake(66,86);
layout.minimumLineSpacing =20;
layout.minimumInteritemSpacing =16;
layout.scrollDirection = UICollectionViewScrollDirectionVertical;
self.collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
[self.collectionView registerClass:[QXRedBagListCell class] forCellWithReuseIdentifier:@"QXRedBagListCell"];
self.collectionView.delegate = self;
self.collectionView.dataSource = self;
self.collectionView.showsHorizontalScrollIndicator = NO;
self.collectionView.showsVerticalScrollIndicator = NO;
self.collectionView.bounces = NO;
self.collectionView.backgroundColor = [UIColor clearColor];
[self.bgView addSubview:self.collectionView];
[self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(25);
make.right.mas_equalTo(-25);
make.bottom.mas_equalTo(-30);
make.top.mas_equalTo(156);
}];
}
-(void)updateRedpacketTimeWithIndex:(NSInteger)index time:(long)time{
QXRedBagListCell *cell = [self.collectionView cellForItemAtIndexPath:[NSIndexPath indexPathForRow:index inSection:0]];
cell.endTime = time;
}
-(void)setDataArray:(NSArray<QXRedPacketModel *> *)dataArray{
_dataArray = dataArray;
if (dataArray.count >3) {
[self.bgView mas_updateConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(358);
}];
}else{
[self.bgView mas_updateConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(272);
}];
}
[self.collectionView reloadData];
}
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
return self.dataArray.count;
}
-(__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
QXRedBagListCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"QXRedBagListCell" forIndexPath:indexPath];
cell.redpacketModel = self.dataArray[indexPath.row];
return cell;
}
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
QXRedPacketModel *model = self.dataArray[indexPath.row];
if (self.didSelectedRedBlock) {
self.didSelectedRedBlock(model);
}
[self hide];
}
-(void)closeAction{
[self hide];
}
-(void)showInView:(UIView *)view{
self.bigBgView.y = -SCREEN_HEIGHT;
[view addSubview:self];
[UIView animateWithDuration:0.3 delay:0 usingSpringWithDamping:0.5 initialSpringVelocity:1.0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
self.bigBgView.y = (SCREEN_HEIGHT-480)/2;
} completion:^(BOOL finished) {
}];
}
-(void)hide{
[UIView animateWithDuration:0.3 delay:0 usingSpringWithDamping:0.5 initialSpringVelocity:1.0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
self.bigBgView.y = SCREEN_HEIGHT;
} completion:^(BOOL finished) {
[self removeFromSuperview];
}];
}
@end
@implementation QXRedBagListCell
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
self.contentView.backgroundColor = [UIColor clearColor];
[self initSubviews];
}
return self;
}
-(void)setRedpacketModel:(QXRedPacketModel *)redpacketModel{
_redpacketModel = redpacketModel;
self.redBagImageView.image = [UIImage imageNamed:redpacketModel.is_qiang.intValue==1?@"red_bag_list_is_get_icon":@"red_bag_list_icon"];
self.pwdImageView.hidden = redpacketModel.type.intValue!=2;
self.nameLabel.text = redpacketModel.nickname;
if (self.redpacketModel.countdown.intValue==0) {
self.timeLabel.hidden = YES;
}
}
-(void)setEndTime:(long)endTime{
if (self.redpacketModel.countdown.intValue==0) {
self.timeLabel.hidden = YES;
return;
}
if (endTime<=0) {
self.timeLabel.hidden = YES;
return;
}
self.timeLabel.hidden = NO;
NSInteger min = (endTime % 3600) / 60;
NSInteger second = endTime % 60;
self.timeLabel.text = [NSString stringWithFormat:@" %02ld:%02ld ",min,second];
}
-(void)initSubviews{
self.redBagImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"red_bag_list_icon"]];
[self.contentView addSubview:self.redBagImageView];
[self.redBagImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(4);
make.height.mas_equalTo(66);
make.width.mas_equalTo(66);
make.centerX.equalTo(self.contentView);
}];
self.pwdImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"red_bag_list_pwd_icon"]];
[self.contentView addSubview:self.pwdImageView];
[self.pwdImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.top.equalTo(self.contentView);
make.width.mas_equalTo(34);
make.height.mas_equalTo(18);
}];
self.timeLabel = [[UILabel alloc] init];
self.timeLabel.textColor = RGB16(0xffffff);
[self.timeLabel addRoundedCornersWithRadius:6];
self.timeLabel.hidden = YES;
self.timeLabel.backgroundColor = RGB16A(0x000000, 0.25);
self.timeLabel.font = [UIFont systemFontOfSize:12];
[self.contentView addSubview:self.timeLabel];
[self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.equalTo(self.redBagImageView);
make.centerX.equalTo(self.contentView);
make.height.mas_equalTo(12);
}];
self.nameLabel = [[UILabel alloc] init];
self.nameLabel.textColor = RGB16(0xD04248);
self.nameLabel.font = [UIFont systemFontOfSize:12];
[self.contentView addSubview:self.nameLabel];
[self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.equalTo(self.contentView);
make.centerX.equalTo(self.contentView);
make.height.mas_equalTo(12);
}];
}
@end

View File

@@ -0,0 +1,18 @@
//
// QXRedBagSendView.h
// QXLive
//
// Created by 启星 on 2025/10/10.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface QXRedBagSendView : UIView
@property (nonatomic,strong)NSString *room_id;
-(void)showInView:(UIView*)view;
-(void)hide;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,924 @@
//
// QXRedBagSendView.m
// QXLive
//
// Created by on 2025/10/10.
//
#import "QXRedBagSendView.h"
#import <WebKit/WebKit.h>
#import "QXMineNetwork.h"
@interface QXRedBagSendView()<UITextFieldDelegate>
@property (nonatomic,strong)UIView *bgView;
@property (nonatomic,strong)UIImageView *bgImageView;
@property (nonatomic,strong)UILabel *titleLabel;
@property (nonatomic,strong)UIButton *helpBtn;
@property (nonatomic,strong)UIButton *backBtn;
@property (nonatomic,strong)UIButton *closeBtn;
@property (nonatomic,strong)UIButton *nextBtn;
@property (nonatomic,strong)UIButton *commitBtn;
@property (nonatomic,strong)UIView* firstContentView;
@property (nonatomic,strong)UIButton *normalRedBagBtn;
@property (nonatomic,strong)UIButton *pwdRedBagBtn;
@property (nonatomic,strong)UIView *firstTopView;
@property (nonatomic,strong)UIView *firstPwdView;
@property (nonatomic,strong)UITextField *pwdTextField;
@property (nonatomic,strong)UIView *firstTimeView;
@property (nonatomic,strong)UIView *scrollBgView;
@property (nonatomic,strong)UIButton *coinRedBagBtn;
@property (nonatomic,strong)UIButton *diamondRedBagBtn;
@property (nonatomic,strong)UIButton *selectedRedBagTimeBtn;
/// 1 2
@property (nonatomic,strong)NSString *redBagType;
/// 1 2
@property (nonatomic,strong)NSString *redBagContentType;
///
@property (nonatomic,strong)NSString *redBagTime;
/// 0 1 2 ,
@property (nonatomic,strong)NSString *conditions;
@property (nonatomic,strong)NSString *coin;
@property (nonatomic,strong)NSString *earnings;
@property (nonatomic,strong)UIView* nextContentView;
@property (nonatomic,strong)UILabel *moneyLabel;
@property (nonatomic,strong)UILabel *moneyUnitLabel;
@property (nonatomic,strong)UITextField *moneyTextField;
@property (nonatomic,strong)UITextField *countTextField;
@property (nonatomic,strong)UITextField *remarkTextField;
///
@property (nonatomic,strong)UIButton *noDrawAuthBtn;
///
@property (nonatomic,strong)UIButton *collectDrawAuthBtn;
///
@property (nonatomic,strong)UIButton *upSeatDrawAuthBtn;
@property (nonatomic,strong)UIView* ruleContentView;
@property (nonatomic,strong)WKWebView* webView;
@property (nonatomic,strong)NSArray* timeArray;
@property (nonatomic,strong)NSArray* drawAuthArray;
/// 0 1
@property (nonatomic,assign)NSInteger currentPage;
///
@property (nonatomic,assign)BOOL isFromRule;
@property (nonatomic,assign)BOOL isSendNet;
@end
@implementation QXRedBagSendView
- (instancetype)init
{
self = [super init];
if (self) {
self.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
[self initSubviews];
}
return self;
}
-(void)initSubviews{
///
self.redBagType = @"1";
///
self.redBagContentType = @"1";
///
self.redBagTime = @"0";
///
self.conditions = @"0";
self.timeArray = @[@0,@1,@2,@5,@10];
self.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.3];
self.bgView = [[UIView alloc] initWithFrame:CGRectMake((SCREEN_WIDTH-345)/2, (SCREEN_HEIGHT-454)/2, 345, 454)];
[self addSubview:self.bgView];
self.bgImageView = [[UIImageView alloc] initWithFrame:self.bgView.bounds];
self.bgImageView.image = [UIImage imageNamed:@"room_send_redbag_bg"];
[self.bgView addSubview:self.bgImageView];
self.titleLabel = [[UILabel alloc] init];
self.titleLabel.font = [UIFont boldSystemFontOfSize:18];
self.titleLabel.text = @"直播间红包";
self.titleLabel.textColor = RGB16(0xffffff);
[self.bgView addSubview:self.titleLabel];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self.bgView);
make.top.mas_equalTo(15);
make.height.mas_equalTo(26);
}];
self.helpBtn = [[UIButton alloc] init];
[self.helpBtn setImage:[UIImage imageNamed:@"room_redbag_help"] forState:(UIControlStateNormal)];
[self.helpBtn addTarget:self action:@selector(helpAction) forControlEvents:(UIControlEventTouchUpInside)];
[self.bgView addSubview:self.helpBtn];
[self.helpBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.height.mas_equalTo(40);
make.centerY.equalTo(self.titleLabel);
make.left.mas_equalTo(5);
}];
self.backBtn = [[UIButton alloc] init];
[self.backBtn setImage:[UIImage imageNamed:@"room_redbag_back"] forState:(UIControlStateNormal)];
[self.backBtn addTarget:self action:@selector(backAction) forControlEvents:(UIControlEventTouchUpInside)];
[self.bgView addSubview:self.backBtn];
self.backBtn.hidden = YES;
[self.backBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self.helpBtn);
}];
self.closeBtn = [[UIButton alloc] init];
[self.closeBtn setImage:[UIImage imageNamed:@"room_redbag_close"] forState:(UIControlStateNormal)];
[self.closeBtn addTarget:self action:@selector(closeAction) forControlEvents:(UIControlEventTouchUpInside)];
[self.bgView addSubview:self.closeBtn];
[self.closeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.height.mas_equalTo(40);
make.centerY.equalTo(self.titleLabel);
make.right.mas_equalTo(-5);
}];
self.nextBtn = [[UIButton alloc] init];
[self.nextBtn setTitle:@"下一步" forState:(UIControlStateNormal)];
self.nextBtn.titleLabel.font = [UIFont boldSystemFontOfSize:18];
[self.nextBtn addTarget:self action:@selector(nextAction) forControlEvents:(UIControlEventTouchUpInside)];
[self.nextBtn setTitleColor:RGB16(0xF35248) forState:UIControlStateNormal];
[self.nextBtn setBackgroundImage:[UIImage imageNamed:@"red_bag_next_btn_bg"] forState:(UIControlStateNormal)];
[self.bgView addSubview:self.nextBtn];
[self.nextBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(44);
make.left.mas_equalTo(15);
make.right.mas_equalTo(-15);
make.bottom.mas_equalTo(-15);
}];
self.commitBtn = [[UIButton alloc] init];
[self.commitBtn setTitle:@"发红包" forState:(UIControlStateNormal)];
self.commitBtn.titleLabel.font = [UIFont boldSystemFontOfSize:18];
self.commitBtn.hidden = YES;
[self.commitBtn addTarget:self action:@selector(commitAction) forControlEvents:(UIControlEventTouchUpInside)];
[self.commitBtn setBackgroundImage:[UIImage imageNamed:@"red_bag_next_btn_bg"] forState:(UIControlStateNormal)];
[self.commitBtn setTitleColor:RGB16(0xF35248) forState:UIControlStateNormal];
[self.bgView addSubview:self.commitBtn];
[self.commitBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self.nextBtn);
}];
[self initFirstContentView];
[self initNextContentView];
[self initRuleView];
[self getMyWallet];
}
-(void)getMyWallet{
MJWeakSelf
[QXMineNetwork getWalletInfoSuccessBlock:^(NSString * _Nonnull coin, NSString * _Nonnull earnings, NSString * _Nonnull title, NSString * _Nonnull url) {
weakSelf.coin = coin;
weakSelf.earnings = coin;
weakSelf.moneyLabel.text = [NSString stringWithFormat:@"%@金币可用",self.coin];
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
}];
}
-(void)initFirstContentView{
self.firstContentView = [[UIView alloc] init];
[self.bgView addSubview:self.firstContentView];
[self.firstContentView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.titleLabel.mas_bottom).offset(15);
make.left.mas_equalTo(15);
make.right.mas_equalTo(-15);
make.bottom.equalTo(self.nextBtn.mas_top).offset(-15);
}];
UIView *topView = [[UIView alloc] init];
topView.backgroundColor = RGB16(0xffffff);
topView.layer.masksToBounds = YES;
topView.layer.cornerRadius = 8;
[self.firstContentView addSubview:topView];
self.firstTopView = topView;
[topView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.left.right.equalTo(self.firstContentView);
make.height.mas_equalTo(88);
}];
UILabel *topTitleLabel = [[UILabel alloc] init];
topTitleLabel.text = @"参与领取限制";
topTitleLabel.font = [UIFont boldSystemFontOfSize:18];
topTitleLabel.textColor = RGB16(0x666666);
[topView addSubview:topTitleLabel];
[topTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(15);
make.top.mas_equalTo(11);
make.height.mas_equalTo(26);
}];
UIButton *normalRedBagBtn = [[UIButton alloc] init];
normalRedBagBtn.titleLabel.font = [UIFont boldSystemFontOfSize:15];
[normalRedBagBtn setTitle:@"普通红包" forState:(UIControlStateNormal)];
[normalRedBagBtn setTitleColor:RGB16(0xffffff) forState:(UIControlStateNormal)];
[normalRedBagBtn setBackgroundImage:[UIImage imageNamed:@"red_bag_btn_bg_nor"] forState:(UIControlStateNormal)];
[normalRedBagBtn setBackgroundImage:[UIImage imageNamed:@"red_bag_btn_bg_sel"] forState:(UIControlStateSelected)];
[normalRedBagBtn addTarget:self action:@selector(selectedRedBagTypeAction:) forControlEvents:(UIControlEventTouchUpInside)];
[topView addSubview:normalRedBagBtn];
self.normalRedBagBtn = normalRedBagBtn;
[normalRedBagBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(15);
make.bottom.mas_equalTo(-5);
make.height.mas_equalTo(36);
make.width.mas_equalTo(137);
}];
UIButton *pwdRedBagBtn = [[UIButton alloc] init];
pwdRedBagBtn.titleLabel.font = [UIFont boldSystemFontOfSize:15];
[pwdRedBagBtn setTitle:@"口令红包" forState:(UIControlStateNormal)];
[pwdRedBagBtn addTarget:self action:@selector(selectedRedBagTypeAction:) forControlEvents:(UIControlEventTouchUpInside)];
[pwdRedBagBtn setTitleColor:RGB16(0xffffff) forState:(UIControlStateNormal)];
[pwdRedBagBtn setBackgroundImage:[UIImage imageNamed:@"red_bag_btn_bg_nor"] forState:(UIControlStateNormal)];
[pwdRedBagBtn setBackgroundImage:[UIImage imageNamed:@"red_bag_btn_bg_sel"] forState:(UIControlStateSelected)];
[topView addSubview:pwdRedBagBtn];
self.pwdRedBagBtn = pwdRedBagBtn;
[pwdRedBagBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(-15);
make.bottom.mas_equalTo(-5);
make.height.mas_equalTo(36);
make.width.mas_equalTo(137);
}];
UIView *centerView1 = [[UIView alloc] init];
centerView1.backgroundColor = RGB16(0xffffff);
centerView1.layer.masksToBounds = YES;
centerView1.layer.cornerRadius = 8;
[self.firstContentView addSubview:centerView1];
self.firstPwdView = centerView1;
[centerView1 mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(topView.mas_bottom).offset(12);
make.left.right.equalTo(self.firstContentView);
make.height.mas_equalTo(48);
}];
UILabel *pwdTitleLabel = [[UILabel alloc] init];
pwdTitleLabel.font = [UIFont boldSystemFontOfSize:18];
pwdTitleLabel.text = @"口令";
pwdTitleLabel.textColor = RGB16(0x666666);
[self.firstPwdView addSubview:pwdTitleLabel];
[pwdTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(15);
make.centerY.equalTo(self.firstPwdView);
make.width.mas_equalTo(40);
}];
UITextField *pwdTextField = [[UITextField alloc] init];
pwdTextField.font = [UIFont boldSystemFontOfSize:18];
pwdTextField.delegate = self;
pwdTextField.textColor = RGB16(0x666666);
pwdTextField.textAlignment = NSTextAlignmentRight;
pwdTextField.returnKeyType = UIReturnKeyDone;
pwdTextField.placeholder = @"请输入口令";
self.pwdTextField = pwdTextField;
[self.firstPwdView addSubview:pwdTextField];
[pwdTextField mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(pwdTitleLabel.mas_right).offset(15);
make.right.mas_equalTo(-15);
make.top.bottom.equalTo(self.firstPwdView);
}];
UIView *centerView2 = [[UIView alloc] init];
centerView2.backgroundColor = RGB16(0xffffff);
centerView2.layer.masksToBounds = YES;
centerView2.layer.cornerRadius = 8;
self.firstTimeView = centerView2;
[self.firstContentView addSubview:centerView2];
[centerView2 mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(topView.mas_bottom).offset(72);
make.left.right.equalTo(self.firstContentView);
make.height.mas_equalTo(88);
}];
UILabel *timeTitleLabel = [[UILabel alloc] init];
timeTitleLabel.textColor = RGB16(0x666666);
timeTitleLabel.font = [UIFont boldSystemFontOfSize:18];
timeTitleLabel.text = @"开奖倒计时";
[self.firstTimeView addSubview:timeTitleLabel];
[timeTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(15);
make.top.mas_equalTo(11);
make.height.mas_equalTo(26);
}];
CGFloat btnWidth = 49;
CGFloat leftMargin = 15;
CGFloat btnSpace = 10;
CGFloat btnHeight = 36;
for (int i = 0; i < self.timeArray.count ; i++) {
UIButton *btn = [[UIButton alloc] init];
NSNumber *number = self.timeArray[i];
btn.tag = number.intValue+10;
NSString *title = @"立刻";
if (number.intValue>0) {
title = [NSString stringWithFormat:@"%d分钟",number.intValue];
}
[btn setTitle:title forState:(UIControlStateNormal)];
[btn setBackgroundImage:[UIImage imageNamed:@"red_bag_time_btn_bg_nor"] forState:(UIControlStateNormal)];
[btn setBackgroundImage:[UIImage imageNamed:@"red_bag_time_btn_bg_sel"] forState:(UIControlStateSelected)];
btn.titleLabel.font = [UIFont boldSystemFontOfSize:14];
[btn addTarget:self action:@selector(redBagTimeAction:) forControlEvents:(UIControlEventTouchUpInside)];
[self.firstTimeView addSubview:btn];
//
if (i == 0) {
btn.selected = YES;
self.selectedRedBagTimeBtn = btn;
}
[btn mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(leftMargin+(btnWidth+btnSpace)*i);
make.width.mas_equalTo(btnWidth);
make.height.mas_equalTo(btnHeight);
make.bottom.mas_equalTo(-5);
}];
}
UIView *bottomView = [[UIView alloc] init];
bottomView.backgroundColor = RGB16(0xffffff);
bottomView.layer.masksToBounds = YES;
bottomView.layer.cornerRadius = 8;
[self.firstContentView addSubview:bottomView];
[bottomView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(centerView2.mas_bottom).offset(12);
make.left.right.equalTo(self.firstContentView);
make.height.mas_equalTo(48);
}];
UILabel *redBagTypeLabel = [[UILabel alloc] init];
redBagTypeLabel.textColor = RGB16(0x666666);
redBagTypeLabel.font = [UIFont boldSystemFontOfSize:18];
redBagTypeLabel.text = @"红包类型";
[bottomView addSubview:redBagTypeLabel];
[redBagTypeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(15);
make.centerY.equalTo(bottomView);
}];
UIView *redBagTypeView = [[UIView alloc] init];
redBagTypeView.backgroundColor = RGB16(0xBA230A);
redBagTypeView.layer.masksToBounds = YES;
redBagTypeView.layer.cornerRadius = 13;
[bottomView addSubview:redBagTypeView];
[redBagTypeView mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(130);
make.height.mas_equalTo(26);
make.centerY.equalTo(bottomView);
make.right.mas_equalTo(-15);
}];
UIView *scrollBgView = [[UIView alloc] init];
scrollBgView.backgroundColor = RGB16(0xFDE8A3);
scrollBgView.layer.masksToBounds = YES;
scrollBgView.layer.cornerRadius = 13;
[redBagTypeView addSubview:scrollBgView];
self.scrollBgView = scrollBgView;
[scrollBgView mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(66);
make.top.bottom.equalTo(redBagTypeView);
make.left.equalTo(redBagTypeView);
}];
self.coinRedBagBtn = [[UIButton alloc] init];
[self.coinRedBagBtn setTitle:@"金币红包" forState:(UIControlStateNormal)];
self.coinRedBagBtn.titleLabel.font = [UIFont systemFontOfSize:14];
[self.coinRedBagBtn setTitleColor:RGB16(0xD01717) forState:(UIControlStateSelected)];
[self.coinRedBagBtn setTitleColor:RGB16(0xFFC9C7) forState:(UIControlStateNormal)];
self.coinRedBagBtn.selected = YES;
[self.coinRedBagBtn addTarget:self action:@selector(redBagContentTypeAction:) forControlEvents:(UIControlEventTouchUpInside)];
[redBagTypeView addSubview:self.coinRedBagBtn];
[self.coinRedBagBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(redBagTypeView);
make.width.mas_equalTo(66);
make.top.bottom.equalTo(redBagTypeView);
}];
self.diamondRedBagBtn = [[UIButton alloc] init];
[self.diamondRedBagBtn setTitle:@"钻石红包" forState:(UIControlStateNormal)];
self.diamondRedBagBtn.titleLabel.font = [UIFont systemFontOfSize:14];
[self.diamondRedBagBtn setTitleColor:RGB16(0xD01717) forState:(UIControlStateSelected)];
[self.diamondRedBagBtn setTitleColor:RGB16(0xFFC9C7) forState:(UIControlStateNormal)];
[self.diamondRedBagBtn addTarget:self action:@selector(redBagContentTypeAction:) forControlEvents:(UIControlEventTouchUpInside)];
[redBagTypeView addSubview:self.diamondRedBagBtn];
[self.diamondRedBagBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(redBagTypeView);
make.width.mas_equalTo(66);
make.top.bottom.equalTo(redBagTypeView);
}];
[self selectedRedBagTypeAction:self.normalRedBagBtn];
}
-(void)initNextContentView{
self.drawAuthArray = @[@0,@1,@2];
self.nextContentView = [[UIView alloc] init];
self.nextContentView.hidden = YES;
[self.bgView addSubview:self.nextContentView];
[self.nextContentView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.titleLabel.mas_bottom).offset(15);
make.left.mas_equalTo(15);
make.right.mas_equalTo(-15);
make.bottom.equalTo(self.nextBtn.mas_top).offset(-15);
}];
self.moneyLabel = [[UILabel alloc] init];
self.moneyLabel.font = [UIFont boldSystemFontOfSize:13];
self.moneyLabel.textColor = RGB16(0xffffff);
self.moneyLabel.text = @"-金币可用";
[self.nextContentView addSubview:self.moneyLabel];
[self.moneyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.nextContentView).offset(-8);
make.height.mas_equalTo(17);
make.top.equalTo(self.nextContentView).offset(0);
}];
UIView *moneyBgView = [[UIView alloc] init];
moneyBgView.backgroundColor = RGB16(0xC51A0C);
moneyBgView.layer.masksToBounds = YES;
moneyBgView.layer.cornerRadius = 8;
[self.nextContentView insertSubview:moneyBgView belowSubview:self.moneyLabel];
[moneyBgView mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.right.equalTo(self.moneyLabel).offset(8);
make.left.equalTo(self.moneyLabel).offset(-8);
make.top.equalTo(self.moneyLabel).offset(-3);
}];
UIView *topBgView = [[UIView alloc] init];
topBgView.backgroundColor = RGB16(0xffffff);
topBgView.layer.masksToBounds = YES;
topBgView.layer.cornerRadius = 8;
[self.nextContentView addSubview:topBgView];
[topBgView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(moneyBgView.mas_bottom).offset(-8);
make.left.right.equalTo(self.nextContentView);
make.height.mas_equalTo(48);
}];
UILabel *moneyTitleLabel = [[UILabel alloc] init];
moneyTitleLabel.font = [UIFont boldSystemFontOfSize:18];
moneyTitleLabel.text = @"金额";
moneyTitleLabel.textColor = RGB16(0x666666);
moneyTitleLabel.textAlignment = NSTextAlignmentLeft;
[topBgView addSubview:moneyTitleLabel];
[moneyTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(15);
make.centerY.equalTo(topBgView);
make.width.mas_equalTo(40);
}];
UILabel *moneyUnitLabel = [[UILabel alloc] init];
moneyUnitLabel.font = [UIFont systemFontOfSize:13];
moneyUnitLabel.textAlignment = NSTextAlignmentRight;
moneyUnitLabel.textColor = RGB16(0x666666);
self.moneyUnitLabel = moneyUnitLabel;
[topBgView addSubview:moneyUnitLabel];
[moneyUnitLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(-15);
make.centerY.equalTo(topBgView);
make.width.mas_equalTo(30);
}];
UITextField *pwdTextField = [[UITextField alloc] init];
pwdTextField.font = [UIFont boldSystemFontOfSize:18];
pwdTextField.delegate = self;
pwdTextField.textColor = RGB16(0x666666);
pwdTextField.textAlignment = NSTextAlignmentRight;
pwdTextField.returnKeyType = UIReturnKeyDone;
pwdTextField.keyboardType = UIKeyboardTypeNumberPad;
pwdTextField.placeholder = @"请输入红包金额";
self.moneyTextField = pwdTextField;
[topBgView addSubview:pwdTextField];
[pwdTextField mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(moneyTitleLabel.mas_right).offset(15);
make.right.equalTo(moneyUnitLabel.mas_left);
make.top.bottom.equalTo(topBgView);
}];
UIView *countBgView = [[UIView alloc] init];
countBgView.backgroundColor = RGB16(0xffffff);
countBgView.layer.masksToBounds = YES;
countBgView.layer.cornerRadius = 8;
[self.nextContentView addSubview:countBgView];
[countBgView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(topBgView.mas_bottom).offset(12);
make.left.right.equalTo(self.nextContentView);
make.height.mas_equalTo(48);
}];
UILabel *countTitleLabel = [[UILabel alloc] init];
countTitleLabel.font = [UIFont boldSystemFontOfSize:18];
countTitleLabel.text = @"个数";
countTitleLabel.textColor = RGB16(0x666666);
countTitleLabel.textAlignment = NSTextAlignmentLeft;
[countBgView addSubview:countTitleLabel];
[countTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(15);
make.centerY.equalTo(countBgView);
make.width.mas_equalTo(40);
}];
UILabel *countUnitLabel = [[UILabel alloc] init];
countUnitLabel.font = [UIFont systemFontOfSize:13];
countUnitLabel.text = @"个";
countUnitLabel.textAlignment = NSTextAlignmentRight;
countUnitLabel.textColor = RGB16(0x666666);
[countBgView addSubview:countUnitLabel];
[countUnitLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(-15);
make.centerY.equalTo(countBgView);
make.width.mas_equalTo(15);
}];
UITextField *countTextField = [[UITextField alloc] init];
countTextField.font = [UIFont boldSystemFontOfSize:18];
countTextField.delegate = self;
countTextField.textColor = RGB16(0x666666);
countTextField.textAlignment = NSTextAlignmentRight;
countTextField.returnKeyType = UIReturnKeyDone;
countTextField.placeholder = @"请输入红包数量";
countTextField.keyboardType = UIKeyboardTypeNumberPad;
self.countTextField = countTextField;
[countBgView addSubview:countTextField];
[countTextField mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(countTitleLabel.mas_right).offset(15);
make.right.equalTo(countUnitLabel.mas_left);
make.top.bottom.equalTo(countBgView);
}];
UIView *drawAuthBgView = [[UIView alloc] init];
drawAuthBgView.backgroundColor = RGB16(0xffffff);
drawAuthBgView.layer.masksToBounds = YES;
drawAuthBgView.layer.cornerRadius = 8;
[self.nextContentView addSubview:drawAuthBgView];
[drawAuthBgView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(countBgView.mas_bottom).offset(12);
make.left.right.equalTo(self.nextContentView);
make.height.mas_equalTo(88);
}];
UILabel *authTitleLabel = [[UILabel alloc] init];
authTitleLabel.textColor = RGB16(0x666666);
authTitleLabel.font = [UIFont boldSystemFontOfSize:18];
authTitleLabel.text = @"条件";
[drawAuthBgView addSubview:authTitleLabel];
[authTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(15);
make.top.mas_equalTo(11);
make.height.mas_equalTo(26);
}];
CGFloat btnWidth = 88.3;
CGFloat leftMargin = 15;
CGFloat btnSpace = 10;
CGFloat btnHeight = 36;
for (int i = 0; i < self.drawAuthArray.count ; i++) {
UIButton *btn = [[UIButton alloc] init];
NSNumber *number = self.drawAuthArray[i];
NSString *title = @"";
if (number.intValue == 0) {
self.noDrawAuthBtn = btn;
title = @"无";
}else if(number.intValue == 1){
self.collectDrawAuthBtn = btn;
title = @"收藏房间";
}else if(number.intValue == 2){
self.upSeatDrawAuthBtn = btn;
title = @"仅麦上用户";
}
[btn setTitle:title forState:(UIControlStateNormal)];
[btn setBackgroundImage:[UIImage imageNamed:@"red_bag_auth_btn_bg_nor"] forState:(UIControlStateNormal)];
[btn setBackgroundImage:[UIImage imageNamed:@"red_bag_auth_btn_bg_sel"] forState:(UIControlStateSelected)];
btn.titleLabel.font = [UIFont boldSystemFontOfSize:14];
[btn addTarget:self action:@selector(drawAuthAction:) forControlEvents:(UIControlEventTouchUpInside)];
[drawAuthBgView addSubview:btn];
[btn mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(leftMargin+(btnWidth+btnSpace)*i);
make.width.mas_equalTo(btnWidth);
make.height.mas_equalTo(btnHeight);
make.bottom.mas_equalTo(-5);
}];
//
if (i == 0) {
btn.selected = YES;
}
}
UIView *remarkBgView = [[UIView alloc] init];
remarkBgView.backgroundColor = RGB16(0xffffff);
remarkBgView.layer.masksToBounds = YES;
remarkBgView.layer.cornerRadius = 8;
[self.nextContentView addSubview:remarkBgView];
[remarkBgView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(drawAuthBgView.mas_bottom).offset(12);
make.left.right.equalTo(self.nextContentView);
make.height.mas_equalTo(48);
}];
UILabel *remarkTitleLabel = [[UILabel alloc] init];
remarkTitleLabel.font = [UIFont boldSystemFontOfSize:18];
remarkTitleLabel.text = @"备注";
remarkTitleLabel.textColor = RGB16(0x666666);
[remarkBgView addSubview:remarkTitleLabel];
[remarkTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(15);
make.centerY.equalTo(remarkBgView);
make.width.mas_equalTo(40);
}];
UITextField *remarkTextField = [[UITextField alloc] init];
remarkTextField.font = [UIFont boldSystemFontOfSize:18];
remarkTextField.delegate = self;
remarkTextField.textColor = RGB16(0x666666);
remarkTextField.textAlignment = NSTextAlignmentRight;
remarkTextField.returnKeyType = UIReturnKeyDone;
remarkTextField.placeholder = @"请输入备注";
self.remarkTextField = remarkTextField;
[remarkBgView addSubview:remarkTextField];
[remarkTextField mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(remarkTitleLabel.mas_right).offset(15);
make.right.mas_equalTo(-15);
make.top.bottom.equalTo(remarkBgView);
}];
}
-(void)initRuleView{
self.ruleContentView = [[UIView alloc] init];
self.ruleContentView.hidden = YES;
self.ruleContentView.backgroundColor = RGB16(0xffffff);
self.ruleContentView.layer.masksToBounds = YES;
self.ruleContentView.layer.cornerRadius = 16;
[self.bgView addSubview:self.ruleContentView];
[self.ruleContentView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.titleLabel.mas_bottom).offset(15);
make.left.mas_equalTo(15);
make.right.mas_equalTo(-15);
make.bottom.equalTo(self.bgView).offset(-15);
}];
self.webView = [[WKWebView alloc] init];
[self.ruleContentView addSubview:self.webView];
[self.webView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.top.mas_equalTo(15);
make.right.bottom.mas_equalTo(-15);
}];
}
#pragma mark - UITextFieldDelegate
-(void)textFieldDidBeginEditing:(UITextField *)textField{
[UIView animateWithDuration:0.3 animations:^{
self.bgView.y = 0;
}];
}
-(void)textFieldDidEndEditing:(UITextField *)textField{
[UIView animateWithDuration:0.3 animations:^{
self.bgView.y = (SCREEN_HEIGHT-454)/2;
}];
}
-(BOOL)textFieldShouldReturn:(UITextField *)textField{
[textField resignFirstResponder];
return YES;
}
-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
[self endEditing:YES];
}
#pragma mark - action
-(void)nextAction{
if (self.redBagType.intValue == 2) {
if (![self.pwdTextField.text isExist]) {
showToast(@"请输入口令");
return;
}
}
self.currentPage = 1;
if (self.redBagContentType.intValue == 1) {
self.moneyUnitLabel.text = @"金币";
}else{
self.moneyUnitLabel.text = @"钻石";
}
self.backBtn.hidden = YES;
self.helpBtn.hidden = NO;
self.nextBtn.hidden = YES;
self.commitBtn.hidden = NO;
self.nextContentView.alpha = 0;
self.nextContentView.hidden = NO;
[UIView animateWithDuration:0.3 animations:^{
self.firstContentView.alpha = 0;
self.nextContentView.alpha = 1;
} completion:^(BOOL finished) {
self.firstContentView.hidden = YES;
self.firstContentView.alpha = 1;
}];
}
-(void)commitAction{
if (![self.moneyTextField.text isExist]) {
showToast(@"请输入红包金额");
return;
}
if (![self.countTextField.text isExist]) {
showToast(@"请输入红包数量");
return;
}
if (self.countTextField.text.longLongValue > self.moneyTextField.text.longLongValue) {
showToast(@"红包数量不能大于红包金额");
return;
}
if (self.isSendNet) {
return;
}
self.isSendNet = YES;
[QXMineNetwork createRedpacketWithType:self.redBagType
password:self.pwdTextField.text
coin_type:self.redBagContentType
total_amount:self.moneyTextField.text
total_count:self.countTextField.text
conditions:self.conditions
countdown:self.redBagTime
room_id:self.room_id
remark:self.remarkTextField.text
successBlock:^(NSDictionary * _Nonnull dict) {
self.isSendNet = NO;
showToast(@"发送成功");
[self hide];
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
self.isSendNet = NO;
showToast(msg);
}];
}
-(void)helpAction{
self.isFromRule = YES;
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.baidu.com"]];
[self.webView loadRequest:request];
self.backBtn.hidden = NO;
self.helpBtn.hidden = YES;
self.nextBtn.hidden = YES;
self.commitBtn.hidden = YES;
self.ruleContentView.alpha = 0;
self.ruleContentView.hidden = NO;
UIView *currentView = self.currentPage==1?self.nextContentView:self.firstContentView;
[UIView animateWithDuration:0.3 animations:^{
currentView.alpha = 0;
self.ruleContentView.alpha = 1;
} completion:^(BOOL finished) {
currentView.hidden = YES;
currentView.alpha = 1;
}];
}
-(void)closeAction{
[self hide];
}
-(void)backAction{
self.backBtn.hidden = YES;
self.helpBtn.hidden = NO;
UIView *currentView = self.currentPage==1?self.nextContentView:self.firstContentView;
self.nextBtn.hidden = self.currentPage==0?NO:YES;
self.commitBtn.hidden = self.currentPage==1?NO:YES;
currentView.alpha = 0;
currentView.hidden = NO;
[UIView animateWithDuration:0.3 animations:^{
self.ruleContentView.alpha = 0;
currentView.alpha = 1;
} completion:^(BOOL finished) {
self.ruleContentView.alpha = 1;
self.ruleContentView.hidden = YES;
}];
self.isFromRule = NO;
}
-(void)selectedRedBagTypeAction:(UIButton*)sender{
if (sender.selected) {
return;
}
if (sender == self.normalRedBagBtn) {
self.pwdRedBagBtn.selected = NO;
self.normalRedBagBtn.selected = YES;
self.firstPwdView.hidden = YES;
[self.firstTimeView mas_updateConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.firstTopView.mas_bottom).offset(12);
}];
self.redBagType = @"1";
self.pwdTextField.text = @"";
}else{
self.pwdRedBagBtn.selected = YES;
self.normalRedBagBtn.selected = NO;
self.firstPwdView.hidden = NO;
[self.firstTimeView mas_updateConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.firstTopView.mas_bottom).offset(72);
}];
self.redBagType = @"2";
}
}
-(void)redBagContentTypeAction:(UIButton*)sender{
if (sender.selected) {
return;
}
if (sender == self.coinRedBagBtn) {
self.diamondRedBagBtn.selected = NO;
[self.scrollBgView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(66);
make.left.top.bottom.mas_equalTo(0);
}];
self.coinRedBagBtn.selected = YES;
self.redBagContentType = @"1";
self.moneyLabel.text = [NSString stringWithFormat:@"%@金币可用",self.coin];
}else{
self.coinRedBagBtn.selected = NO;
[self.scrollBgView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(66);
make.right.top.bottom.mas_equalTo(0);
}];
self.diamondRedBagBtn.selected = YES;
self.redBagContentType = @"2";
self.moneyLabel.text = [NSString stringWithFormat:@"%@钻石可用",self.earnings];
}
}
-(void)drawAuthAction:(UIButton*)sender{
if (sender == self.noDrawAuthBtn) {
self.noDrawAuthBtn.selected = YES;
self.collectDrawAuthBtn.selected = NO;
self.upSeatDrawAuthBtn.selected = NO;
}else if (sender == self.collectDrawAuthBtn) {
self.collectDrawAuthBtn.selected = !self.collectDrawAuthBtn.selected;
if (self.upSeatDrawAuthBtn.selected || self.collectDrawAuthBtn.selected) {
self.noDrawAuthBtn.selected = NO;
}else{
self.noDrawAuthBtn.selected = YES;
}
}else if (sender == self.upSeatDrawAuthBtn) {
self.noDrawAuthBtn.selected = NO;
self.upSeatDrawAuthBtn.selected = !self.upSeatDrawAuthBtn.selected;
if (self.upSeatDrawAuthBtn.selected || self.collectDrawAuthBtn.selected) {
self.noDrawAuthBtn.selected = NO;
}else{
self.noDrawAuthBtn.selected = YES;
}
}
if (self.collectDrawAuthBtn.selected && self.upSeatDrawAuthBtn.selected) {
self.conditions = @"1,2";
}else{
if (self.collectDrawAuthBtn.selected) {
self.conditions = @"1";
}else if (self.upSeatDrawAuthBtn.selected) {
self.conditions = @"2";
}else{
self.conditions = @"0";
}
}
}
-(void)redBagTimeAction:(UIButton*)sender{
if (sender.selected == YES) {
return;
}
self.selectedRedBagTimeBtn.selected = NO;
sender.selected = YES;
self.selectedRedBagTimeBtn = sender;
self.redBagTime = [NSString stringWithFormat:@"%ld",(sender.tag-10)*60];
}
-(void)showInView:(UIView *)view{
self.bgView.y = -SCREEN_HEIGHT;
[view addSubview:self];
[UIView animateWithDuration:0.3 delay:0 usingSpringWithDamping:0.5 initialSpringVelocity:1.0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
self.bgView.y = (SCREEN_HEIGHT-454)/2;
} completion:^(BOOL finished) {
}];
}
-(void)hide{
[UIView animateWithDuration:0.3 delay:0 usingSpringWithDamping:0.5 initialSpringVelocity:1.0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
self.bgView.y = SCREEN_HEIGHT;
} completion:^(BOOL finished) {
[self removeFromSuperview];
}];
}
@end

View File

@@ -0,0 +1,17 @@
//
// QXRedBagTagView.h
// QXLive
//
// Created by 启星 on 2025/10/11.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface QXRedBagTagView : UIView
@property (nonatomic,copy)void(^startBlock)(BOOL isList);
@property (nonatomic,strong)NSString *count;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,82 @@
//
// QXRedBagTagView.m
// QXLive
//
// Created by on 2025/10/11.
//
#import "QXRedBagTagView.h"
@interface QXRedBagTagView()
@property (nonatomic,strong)UIImageView *imageView;
@property (nonatomic,strong)UILabel *countLabel;
@property (nonatomic,strong)UIButton *btn;
@property (nonatomic,assign)CGFloat redTagHeight;
@property (nonatomic,assign)CGFloat redTagWidth;
@end
@implementation QXRedBagTagView
- (instancetype)init
{
self = [super init];
if (self) {
self.redTagHeight = ScaleWidth(80);
self.redTagWidth = ScaleWidth(80);
self.frame = CGRectMake(0, NavContentHeight+125, self.redTagHeight, self.redTagWidth);
[self initSubviews];
}
return self;
}
-(void)initSubviews{
self.imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"redbag_tag_icon"]];
self.imageView.frame = CGRectMake(0, 0, self.redTagHeight, self.redTagWidth);
[self addSubview:self.imageView];
self.countLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 10, self.width-10, 20)];
self.countLabel.textAlignment = NSTextAlignmentRight;
self.countLabel.font = [UIFont boldSystemFontOfSize:18];
self.countLabel.textColor = RGB16(0xFFFEB2);
[self addSubview:self.countLabel];
self.btn = [[UIButton alloc] initWithFrame:self.bounds];
[self.btn addTarget:self action:@selector(btnClick) forControlEvents:(UIControlEventTouchUpInside)];
[self addSubview:self.btn];
UIPanGestureRecognizer *panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePan:)];
[self addGestureRecognizer:panRecognizer];
}
-(void)btnClick{
BOOL isList = self.count.intValue>1?YES:NO;
if (self.startBlock) {
self.startBlock(isList);
}
}
-(void)setCount:(NSString *)count{
_count = count;
self.countLabel.text = [NSString stringWithFormat:@"x%@",count];
if (count.intValue == 0) {
self.hidden = YES;
}else{
self.hidden = NO;
}
}
-(void)handlePan:(UIPanGestureRecognizer*)recognizer{
if (recognizer.state == UIGestureRecognizerStateEnded) {
NSLog(@"拖动结束");
}
CGPoint translation = [recognizer translationInView:self.viewController.view];
CGPoint panCenter = CGPointMake(recognizer.view.center.x + translation.x,
recognizer.view.center.y + translation.y);
if (panCenter.y < kSafeAreaTop || panCenter.y> SCREEN_HEIGHT-kSafeAreaBottom) {
return;
}
recognizer.view.center = CGPointMake(self.redTagWidth/2,
recognizer.view.center.y + translation.y);
[recognizer setTranslation:CGPointZero inView:self.viewController.view];
}
@end

View File

@@ -0,0 +1,28 @@
//
// QXAddDirectCell.h
// IsLandVoice
//
// Created by 启星 on 2025/3/6.
//
#import <UIKit/UIKit.h>
#import "QXSearchModel.h"
#import "QXRoomListModel.h"
#import "QXDirectDelegate.h"
NS_ASSUME_NONNULL_BEGIN
@interface QXAddDirectCell : UITableViewCell
@property (weak, nonatomic) IBOutlet UILabel *IDLabel;
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
@property (weak, nonatomic) IBOutlet UIImageView *headerImageView;
@property (weak, nonatomic) IBOutlet UIButton *addBtn;
@property (weak, nonatomic) IBOutlet UIImageView *sexImageView;
@property (weak, nonatomic) IBOutlet UIImageView *levelImageView;
@property (nonatomic,strong)QXSearchModel *user;
@property (nonatomic,strong)QXRoomListModel *roomModel;
@property (nonatomic,weak)id<QXDirectDelegate>delegate;
+(instancetype)cellWithTableView:(UITableView *)tableView;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,81 @@
//
// QXAddDirectCell.m
// IsLandVoice
//
// Created by on 2025/3/6.
//
#import "QXAddDirectCell.h"
@implementation QXAddDirectCell
+(instancetype)cellWithTableView:(UITableView *)tableView{
static NSString *cellId = @"QXAddDirectCell";
QXAddDirectCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
if (!cell) {
cell = [[NSBundle mainBundle] loadNibNamed:cellId owner:nil options:nil].lastObject;
cell.addBtn.layer.borderWidth = 1;
cell.addBtn.layer.borderColor = [UIColor colorWithHexString:@"#333333"].CGColor;
}
return cell;
}
-(void)setUser:(QXSearchModel *)user{
_user = user;
[self.headerImageView sd_setImageWithURL:[NSURL URLWithString:user.picture]];
self.nameLabel.text = user.name;
self.IDLabel.text = [NSString stringWithFormat:@"ID:%@",user.code];
if (user.icon.count==0) {
self.levelImageView.hidden = YES;
self.sexImageView.hidden = YES;
return;
}
if (user.icon.count == 1) {
self.sexImageView.hidden = NO;
self.levelImageView.hidden = YES;
NSString *firstIcon = user.icon.firstObject;
[self.sexImageView sd_setImageWithURL:[NSURL URLWithString:firstIcon] placeholderImage:nil];
return;
}
if (user.icon.count >= 2) {
self.sexImageView.hidden = NO;
self.levelImageView.hidden = NO;
NSString *firstIcon = user.icon.firstObject;
[self.sexImageView sd_setImageWithURL:[NSURL URLWithString:firstIcon] placeholderImage:nil];
NSString *secondtIcon = user.icon[1];
[self.levelImageView sd_setImageWithURL:[NSURL URLWithString:secondtIcon] placeholderImage:nil];
return;
}
}
-(void)setRoomModel:(QXRoomListModel *)roomModel{
_roomModel = roomModel;
[self.headerImageView sd_setImageWithURL:[NSURL URLWithString:roomModel.room_cover]];
self.nameLabel.text = roomModel.room_name;
self.IDLabel.text = [NSString stringWithFormat:@"ID:%@",roomModel.room_number];
[self.addBtn setTitle:@"邀请PK" forState:(UIControlStateNormal)];
}
- (IBAction)addAction:(id)sender {
if (self.roomModel) {
if (self.delegate && [self.delegate respondsToSelector:@selector(sendPKWithRoomId:)]) {
[self.delegate sendPKWithRoomId:self.roomModel.room_id];
}
return;
}
if (self.delegate && [self.delegate respondsToSelector:@selector(addDirectWithUser:)]) {
[self.delegate addDirectWithUser:self.user];
}
}
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end

Some files were not shown because too many files have changed in this diff Show More