房间完成

This commit is contained in:
启星
2025-12-01 18:42:49 +08:00
parent 7eb4f8d3b8
commit 2d37ab6844
55 changed files with 653 additions and 41 deletions

View File

@@ -0,0 +1,21 @@
//
// QXSignAlertView.h
// QXLive
//
// Created by 启星 on 2025/12/1.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
typedef NS_ENUM(NSInteger) {
QXSignAlerTypeStart = 0,
QXSignAlerTypeFail = 1,
QXSignAlerTypeSuccess = 2,
}QXSignAlerType;
@interface QXSignAlertView : UIView
-(instancetype)initWithType:(QXSignAlerType)type;
-(void)showInView:(UIView*)view;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,130 @@
//
// QXSignAlertView.m
// QXLive
//
// Created by on 2025/12/1.
//
#import "QXSignAlertView.h"
@interface QXSignAlertView()
@property (nonatomic,strong)UIView *bgView;
@property (nonatomic,strong)UIImageView *imageView;
@property (nonatomic,strong)UIButton *closeBtn;
@property (assign,nonatomic)QXSignAlerType type;
@end
@implementation QXSignAlertView
-(instancetype)initWithType:(QXSignAlerType)type{
self = [super init];
if (self) {
_type = type;
self.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
[self initSubviewsWithType:type];
}
return self;
}
-(void)initSubviewsWithType:(QXSignAlerType)type{
self.bgView = [[UIView alloc] init];
[self addSubview:self.bgView];
switch (type) {
case QXSignAlerTypeStart:{
[self.bgView mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(ScaleWidth(222));
make.height.mas_equalTo(ScaleWidth(222));
make.centerX.centerY.equalTo(self);
}];
self.imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"room_sign_start"]];
self.imageView.contentMode = UIViewContentModeScaleToFill;
[self.bgView addSubview:self.imageView];
[self.imageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self.bgView);
}];
}
break;
case QXSignAlerTypeFail:
{
[self.bgView mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(ScaleWidth(272));
make.height.mas_equalTo(ScaleWidth(397));
make.centerX.centerY.equalTo(self);
}];
self.imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"room_sign_fail"]];
[self.bgView addSubview:self.imageView];
[self.imageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self.bgView);
}];
self.closeBtn = [[UIButton alloc] init];
[self.closeBtn setBackgroundImage:[UIImage imageNamed:@"room_sign_fail_btn"] forState:(UIControlStateNormal)];
[self.closeBtn addTarget:self action:@selector(hide) forControlEvents:(UIControlEventTouchUpInside)];
[self.bgView addSubview:self.closeBtn];
[self.closeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.mas_equalTo(ScaleWidth(-29));
make.width.mas_equalTo(ScaleWidth(139));
make.height.mas_equalTo(ScaleWidth(51));
make.centerX.equalTo(self.bgView);
}];
}
break;
case QXSignAlerTypeSuccess:
{
[self.bgView mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(ScaleWidth(222));
make.height.mas_equalTo(ScaleWidth(222));
make.centerX.centerY.equalTo(self);
}];
self.imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"room_sign_success"]];
[self.bgView addSubview:self.imageView];
[self.imageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self.bgView);
}];
}
break;
default:
break;
}
}
-(void)showInView:(UIView*)view{
[view addSubview:self];
self.bgView.alpha = 0;
[UIView animateWithDuration:0.3 animations:^{
self.bgView.alpha = 1;
}completion:^(BOOL finished) {
}];
[self performSelector:@selector(hide) afterDelay:1];
}
- (void)hide{
if (!self.superview) {
NSLog(@"⚠️ View already removed from superview");
return;
}
__weak typeof(self) weakSelf = self;
[UIView animateWithDuration:0.3 animations:^{
__strong typeof(weakSelf) strongSelf = weakSelf;
if (!strongSelf) {
NSLog(@"⚠️ self has been deallocated, skipping hide operation");
return;
}
self.bgView.alpha = 0;
}completion:^(BOOL finished) {
__strong typeof(weakSelf) strongSelf = weakSelf;
if (!strongSelf) {
NSLog(@"⚠️ self has been deallocated, skipping hide operation");
return;
}
if (self.superview) {
[self removeFromSuperview];
}
}];
}
@end

View File

@@ -19,7 +19,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic,strong)NSString *signId;
@property (nonatomic,weak)id<QXSignCoinListViewDelegate>delegate;
@property (nonatomic,strong)QXRoomPitModel *pitModel;
-(void)refreshCoinList;
-(void)refreshCoinListWith:(NSArray*)coinList;
-(void)showInView:(UIView *)view;
-(void)hide;
@end

View File

@@ -210,11 +210,21 @@
[weakSelf.collectionView reloadData];
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
showToast(msg);
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[weakSelf getCoinList];
});
}];
}
-(void)refreshCoinList{
[self getCoinList];
-(void)refreshCoinListWith:(NSArray *)coinList{
[self getMyWallet];
[self.dataArray removeAllObjects];
for (NSString*title in coinList) {
QXRoomRelationModel *md = [[QXRoomRelationModel alloc] init];
md.name = title;
[self.dataArray addObject:md];
}
[self.collectionView reloadData];
}
-(void)showInView:(UIView *)view{
[self getCoinList];

View File

@@ -79,7 +79,7 @@
NSInteger itemWidth = (SCREEN_WIDTH-16*2-12*3)/4;
layout.itemSize = CGSizeMake(itemWidth, 44);
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 = [[UICollectionView alloc] initWithFrame:CGRectMake(0, self.titleLabel.bottom+10, self.bgView.width, self.commitBtn.top-self.titleLabel.bottom-20) collectionViewLayout:layout];
[self.collectionView registerClass:[QXSelectAuctionInfoCell class] forCellWithReuseIdentifier:@"QXSelectAuctionInfoCell"];
self.collectionView.delegate = self;
self.collectionView.dataSource = self;
@@ -100,8 +100,8 @@
showToast(@"请选择您要展示的才艺");
return;
}
[[QXRoomMessageManager shared] sendChatMessage:[NSString stringWithFormat:@"选择的才艺是 %@",self.selectedModel.name] messageType:(QXRoomMessageTypeText) needInsertMessage:YES];
[self hide];
}
-(void)getPlayList{