523 lines
21 KiB
Mathematica
523 lines
21 KiB
Mathematica
|
|
//
|
||
|
|
// 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
|