This commit is contained in:
启星
2025-09-08 08:49:04 +08:00
parent ddeec09ea5
commit 349cab1499
290 changed files with 8627 additions and 760 deletions

View File

@@ -0,0 +1,24 @@
//
// QXMeetActivityPoolView.h
// QXLive
//
// Created by 启星 on 2025/8/27.
//
#import <UIKit/UIKit.h>
#import "QXGiftActivityModel.h"
NS_ASSUME_NONNULL_BEGIN
@interface QXMeetActivityPoolView : UIView
@property (nonatomic,strong)NSString *roomId;
-(void)showInView:(UIView *)view;
@end
@interface QXMeetPoolCell : UICollectionViewCell
@property (nonatomic,strong)UIImageView *giftImageView;
@property (nonatomic,strong)UILabel *nameLabel;
@property (nonatomic,strong)UIButton *giftCoin;
@property (nonatomic,strong)QXDrawGiftModel *model;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,169 @@
//
// QXMeetActivityPoolView.m
// QXLive
//
// Created by on 2025/8/27.
//
#import "QXMeetActivityPoolView.h"
@interface QXMeetActivityPoolView()<UIGestureRecognizerDelegate,UICollectionViewDelegate,UICollectionViewDataSource>
@property(nonatomic,strong)UIView* bgView;
@property(nonatomic,strong)UIImageView* ruleImageView;
@property(nonatomic,strong)UIImageView* bgImageView;
@property(nonatomic,strong)UICollectionView* collectionView;
@property(nonatomic,strong)QXActivityXLHModel* model;
@end
@implementation QXMeetActivityPoolView
- (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, 0, SCREEN_WIDTH, ScaleWidth(663))];
[self.bgView addRoundedCornersWithRadius:16 byRoundingCorners:(UIRectCornerTopLeft|UIRectCornerTopRight)];
[self addSubview:self.bgView];
self.bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"meet_rule_bg"]];
self.bgImageView.frame = CGRectMake(0, 0, SCREEN_WIDTH, ScaleWidth(663));
self.bgImageView.contentMode = UIViewContentModeScaleToFill;
[self.bgView addSubview:self.bgImageView];
self.ruleImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"meet_pool_icon"]];
self.ruleImageView.contentMode = UIViewContentModeScaleToFill;
self.ruleImageView.frame = CGRectMake((SCREEN_WIDTH-ScaleWidth(164))/2, 0, ScaleWidth(164), ScaleWidth(90));
[self.bgView addSubview:self.ruleImageView];
[self.bgView addSubview:self.collectionView];
}
-(void)setRoomId:(NSString *)roomId{
_roomId = roomId;
[self getGiftList];
}
-(void)getGiftList{
if (![self.roomId isExist]) {
return;
}
MJWeakSelf
[[QXRequset shareInstance] postWithUrl:[NSString stringWithFormat:@"%@%@",ServerUrl,@"api/BlindBoxTurntable/xlh"] parameters:@{@"room_id":self.roomId?self.roomId:@""} needCache:NO success:^(id responseObject) {
QXActivityXLHModel *model = [QXActivityXLHModel yy_modelWithJSON:responseObject[@"data"]];
weakSelf.model = model;
[self.collectionView reloadData];
} fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) {
}];
}
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
return self.model.gift_list.count;
}
-(__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
QXMeetPoolCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"QXMeetPoolCell" forIndexPath:indexPath];
cell.model = self.model.gift_list[indexPath.row];
return cell;
}
-(void)showInView:(UIView *)view{
self.bgView.y = SCREEN_HEIGHT;
[view addSubview:self];
[UIView animateWithDuration:0.3 animations:^{
self.bgView.y = SCREEN_HEIGHT-ScaleWidth(663);
}];
}
-(void)hide{
// [self stopSlowAnimate];
[UIView animateWithDuration:0.3 animations:^{
self.bgView.y = SCREEN_HEIGHT;
} completion:^(BOOL finished) {
[self removeFromSuperview];
}];
}
-(UICollectionView *)collectionView{
if (!_collectionView) {
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
layout.minimumLineSpacing = 23;
layout.minimumInteritemSpacing = 23;
layout.sectionInset = UIEdgeInsetsMake(0, 17, 0, 17);
layout.itemSize = CGSizeMake((SCREEN_WIDTH-17*2-23*2)/3, ScaleWidth(128));
_collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, self.ruleImageView.bottom+10, SCREEN_WIDTH, self.bgView.height-self.ruleImageView.bottom) collectionViewLayout:layout];
_collectionView.delegate = self;
_collectionView.dataSource = self;
_collectionView.showsHorizontalScrollIndicator = NO;
_collectionView.showsVerticalScrollIndicator = NO;
_collectionView.backgroundColor = [UIColor clearColor];
[_collectionView registerClass:[QXMeetPoolCell class] forCellWithReuseIdentifier:@"QXMeetPoolCell"];
// MJWeakSelf
// _collectionView.mj_header = [m footerWithRefreshingBlock:^{
// [weakSelf getGiftList];
// }];
}
return _collectionView;
}
@end
@implementation QXMeetPoolCell
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self initSubviews];
}
return self;
}
-(void)setModel:(QXDrawGiftModel *)model{
_model = model;
[self.giftImageView sd_setImageWithURL:[NSURL URLWithString:model.base_image]];
self.nameLabel.text = model.gift_name;
[self.giftCoin setTitle:[NSString stringWithFormat:@" %@",model.gift_price] forState:(UIControlStateNormal)];
}
-(void)initSubviews{
self.giftImageView = [[UIImageView alloc] init];
self.giftImageView.contentMode = UIViewContentModeScaleAspectFit;
[self.contentView addSubview:self.giftImageView];
[self.giftImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.left.right.equalTo(self.contentView);
make.height.equalTo(self.giftImageView.mas_width);
}];
self.nameLabel = [[UILabel alloc] init];
self.nameLabel.textColor = RGB16(0xffffff);
self.nameLabel.font = [UIFont systemFontOfSize:12];
[self.contentView addSubview:self.nameLabel];
[self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.giftImageView.mas_bottom);
make.centerX.equalTo(self.contentView);
}];
self.giftCoin = [[UIButton alloc] init];
[self.giftCoin setTitleColor:RGB16(0xC7BF62) forState:(UIControlStateNormal)];
self.giftCoin.titleLabel.font = [UIFont systemFontOfSize:10];
[self.giftCoin setImage:[UIImage imageNamed:@"sky_item_coin"] forState:(UIControlStateNormal)];
[self.contentView addSubview:self.giftCoin];
[self.giftCoin mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.nameLabel.mas_bottom);
make.centerX.equalTo(self.contentView);
}];
}
@end

View File

@@ -0,0 +1,26 @@
//
// QXMeetActivityRankView.h
// QXLive
//
// Created by 启星 on 2025/8/30.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface QXMeetActivityRankView : UIView
-(void)showInView:(UIView *)view;
@property (nonatomic,strong)NSString *roomId;
@end
@interface QXMeetRankCell : UITableViewCell
@property (nonatomic,strong)UIImageView *giftImageView;
@property (nonatomic,strong)UILabel *giftInfoLabel;
@property (nonatomic,strong)UILabel *recieveInfoLabel;
@property (nonatomic,strong)UILabel *timeLabel;
@property (nonatomic,strong)UIView *bottomLine;
@property (nonatomic,strong)QXActivityRecordModel *model;
+(instancetype)cellWithTableView:(UITableView*)tableView;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,231 @@
//
// QXMeetActivityRankView.m
// QXLive
//
// Created by on 2025/8/30.
//
#import "QXMeetActivityRankView.h"
@interface QXMeetActivityRankView()<UITableViewDelegate,UITableViewDataSource,UIGestureRecognizerDelegate>
@property(nonatomic,strong)UIView* bgView;
@property(nonatomic,strong)UIImageView* ruleImageView;
@property(nonatomic,strong)UIImageView* bgImageView;
@property(nonatomic,strong)UIView* bgCoverView;
@property(nonatomic,strong)UITableView* tableView;
@property(nonatomic,strong)NSMutableArray* allRecordArray;
@property(nonatomic,assign)NSInteger page;
@end
@implementation QXMeetActivityRankView
- (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.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.3];
self.bgView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, ScaleWidth(663))];
[self.bgView addRoundedCornersWithRadius:16 byRoundingCorners:(UIRectCornerTopLeft|UIRectCornerTopRight)];
[self addSubview:self.bgView];
self.bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"meet_rule_bg"]];
self.bgImageView.frame = CGRectMake(0, 0, SCREEN_WIDTH, ScaleWidth(663));
self.bgImageView.contentMode = UIViewContentModeScaleToFill;
[self.bgView addSubview:self.bgImageView];
self.ruleImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"ac_meet_rank_icon"]];
self.ruleImageView.contentMode = UIViewContentModeScaleToFill;
self.ruleImageView.frame = CGRectMake((SCREEN_WIDTH-ScaleWidth(188))/2, 0, ScaleWidth(188), ScaleWidth(90));
[self.bgView addSubview:self.ruleImageView];
self.bgCoverView = [[UIView alloc] initWithFrame:CGRectMake(16, self.ruleImageView.bottom+12, self.bgView.width-32, self.bgView.height-self.ruleImageView.bottom-24)];
self.bgCoverView.backgroundColor = RGB16A(0x000000, 0.5);
[self.bgView addSubview:self.bgCoverView];
[self.bgCoverView addSubview:self.tableView];
}
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{
return touch.view == self;
}
-(void)setRoomId:(NSString *)roomId{
_roomId = roomId;
self.page = 1;
[self getRecordList];
}
-(void)getRecordList{
if (![self.roomId isExist]) {
return;
}
MJWeakSelf
NSDictionary *parameters = @{
@"room_id":self.roomId?self.roomId:@"",
@"page":[NSNumber numberWithInteger:self.page]
};
NSString *url = [NSString stringWithFormat:@"%@%@",ServerUrl,@"api/BlindBoxTurntable/get_xlh_all_record"];
[[QXRequset shareInstance] postWithUrl:url parameters:parameters needCache:NO success:^(id responseObject) {
if (weakSelf.page == 1) {
[weakSelf.allRecordArray removeAllObjects];
}
NSArray *arr = [NSArray yy_modelArrayWithClass:[QXActivityRecordModel class] json:responseObject[@"data"]];
[weakSelf.allRecordArray addObjectsFromArray:arr];
[weakSelf.tableView reloadData];
if (arr.count == 0) {
weakSelf.tableView.mj_footer.state = MJRefreshStateNoMoreData;
}else{
[weakSelf.tableView.mj_footer endRefreshing];
}
[weakSelf.tableView.mj_header endRefreshing];
} fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) {
[weakSelf.tableView.mj_footer endRefreshing];
[weakSelf.tableView.mj_header endRefreshing];
}];
}
-(UITableView *)tableView{
if (!_tableView) {
_tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 10, self.bgCoverView.width, self.bgCoverView.height-10) style:(UITableViewStylePlain)];
_tableView.delegate = self;
_tableView.dataSource = self;
_tableView.rowHeight = 70;
_tableView.backgroundColor = [UIColor clearColor];
MJWeakSelf
_tableView.mj_footer = [MJRefreshBackStateFooter footerWithRefreshingBlock:^{
weakSelf.page++;
[weakSelf getRecordList];
}];
_tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
weakSelf.page = 1;
[weakSelf getRecordList];
}];
}
return _tableView;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return self.allRecordArray.count;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
QXMeetRankCell *cell = [QXMeetRankCell cellWithTableView:tableView];
cell.model = self.allRecordArray[indexPath.row];
return cell;
}
-(void)showInView:(UIView *)view{
self.bgView.y = SCREEN_HEIGHT;
[view addSubview:self];
[UIView animateWithDuration:0.3 animations:^{
self.bgView.y = SCREEN_HEIGHT-ScaleWidth(663);
}];
}
-(void)hide{
// [self stopSlowAnimate];
[UIView animateWithDuration:0.3 animations:^{
self.bgView.y = SCREEN_HEIGHT;
} completion:^(BOOL finished) {
[self removeFromSuperview];
}];
}
-(NSMutableArray *)allRecordArray{
if (!_allRecordArray) {
_allRecordArray = [NSMutableArray array];
}
return _allRecordArray;
}
@end
@implementation QXMeetRankCell
+(instancetype)cellWithTableView:(UITableView*)tableView{
static NSString *cellId = @"QXMeetRankCell";
QXMeetRankCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
if (!cell) {
cell = [[QXMeetRankCell 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:(QXActivityRecordModel *)model{
_model = model;
self.giftInfoLabel.text = [NSString stringWithFormat:@"%@x%@",model.gift_name,model.count];
self.recieveInfoLabel.text = [NSString stringWithFormat:@"%@",model.nickname];
[self.giftImageView sd_setImageWithURL:[NSURL URLWithString:model.base_image]];
self.timeLabel.text = model.createtime;
}
-(void)initSubviews{
self.contentView.backgroundColor = [UIColor clearColor];
self.recieveInfoLabel = [[UILabel alloc] init];
self.recieveInfoLabel.textColor = RGB16(0xffffff);
self.recieveInfoLabel.font = [UIFont systemFontOfSize:14];
[self.contentView addSubview:self.recieveInfoLabel];
[self.recieveInfoLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(12);
make.left.mas_equalTo(12);
make.height.mas_equalTo(24);
}];
self.timeLabel = [[UILabel alloc] init];
self.timeLabel.textColor = RGB16(0x5B5B5B);
self.timeLabel.font = [UIFont systemFontOfSize:10];
[self.contentView addSubview:self.timeLabel];
[self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.equalTo(self.contentView).offset(-12);
make.left.mas_equalTo(12);
make.height.mas_equalTo(17);
}];
self.giftImageView = [[UIImageView alloc] init];
self.giftImageView.contentMode = UIViewContentModeScaleAspectFit;
[self.contentView addSubview:self.giftImageView];
[self.giftImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.contentView).offset(-12);
make.height.width.mas_equalTo(21);
make.centerY.equalTo(self.recieveInfoLabel);
}];
self.giftInfoLabel = [[UILabel alloc] init];
self.giftInfoLabel.textColor = RGB16(0xffffff);
self.giftInfoLabel.font = [UIFont systemFontOfSize:16];
[self.contentView addSubview:self.giftInfoLabel];
[self.giftInfoLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.giftImageView.mas_left);
make.centerY.equalTo(self.recieveInfoLabel);
}];
self.bottomLine = [[UIView alloc] init];
self.bottomLine.backgroundColor = RGB16(0xffffff);
[self.contentView addSubview:self.bottomLine];
[self.bottomLine mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.equalTo(self.contentView);
make.left.mas_equalTo(12);
make.right.mas_equalTo(-12);
make.height.mas_equalTo(1);
}];
}
@end

View File

@@ -0,0 +1,28 @@
//
// QXMeetActivityRecordView.h
// QXLive
//
// Created by 启星 on 2025/8/30.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface QXMeetActivityRecordView : UIView
@property (nonatomic,strong)NSString *roomId;
-(void)showInView:(UIView *)view;
@end
@interface QXMeetRecordCell : UICollectionViewCell
@property (nonatomic,strong)UIImageView *giftImageView;
@property (nonatomic,strong)UILabel *giftInfoLabel;
@property (nonatomic,strong)UILabel *recieveInfoLabel;
@property (nonatomic,strong)UILabel *timeLabel;
@property (nonatomic,strong)QXActivityRecordModel *model;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,242 @@
//
// QXMeetActivityRecordView.m
// QXLive
//
// Created by on 2025/8/26.
//
#import "QXMeetActivityRecordView.h"
@interface QXMeetActivityRecordView()<UIGestureRecognizerDelegate,UICollectionViewDelegate,UICollectionViewDataSource>
@property(nonatomic,strong)UIView* bgView;
@property(nonatomic,strong)UIImageView* ruleImageView;
@property(nonatomic,strong)UIImageView* bgImageView;
@property(nonatomic,strong)UIView* bgCoverView;
@property(nonatomic,strong)UICollectionView* collectionView;
@property(nonatomic,strong)NSMutableArray* myRecordArray;
@property(nonatomic,strong)NSMutableArray* allRecordArray;
@property(nonatomic,assign)NSInteger page;
@end
@implementation QXMeetActivityRecordView
- (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, 0, SCREEN_WIDTH, ScaleWidth(663))];
[self.bgView addRoundedCornersWithRadius:16 byRoundingCorners:(UIRectCornerTopLeft|UIRectCornerTopRight)];
[self addSubview:self.bgView];
self.bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"meet_rule_bg"]];
self.bgImageView.frame = CGRectMake(0, 0, SCREEN_WIDTH, ScaleWidth(663));
self.bgImageView.contentMode = UIViewContentModeScaleToFill;
[self.bgView addSubview:self.bgImageView];
self.ruleImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"meet_record_icon"]];
self.ruleImageView.contentMode = UIViewContentModeScaleToFill;
self.ruleImageView.frame = CGRectMake((SCREEN_WIDTH-ScaleWidth(164))/2, 0, ScaleWidth(164), ScaleWidth(90));
[self.bgView addSubview:self.ruleImageView];
self.bgCoverView = [[UIView alloc] initWithFrame:CGRectMake(16, self.ruleImageView.bottom+12, self.bgView.width-32, self.bgView.height-self.ruleImageView.bottom-24)];
self.bgCoverView.backgroundColor = RGB16A(0x000000, 0.5);
[self.bgView addSubview:self.bgCoverView];
[self.bgCoverView addSubview:self.collectionView];
}
-(void)setRoomId:(NSString *)roomId{
_roomId = roomId;
self.page = 1;
[self getRecordList];
}
-(void)getRecordList{
if (![self.roomId isExist]) {
return;
}
MJWeakSelf
NSDictionary *parameters = @{
@"room_id":self.roomId?self.roomId:@"",
@"page":[NSNumber numberWithInteger:self.page]
};
NSString *url = [NSString stringWithFormat:@"%@%@",ServerUrl,@"api/BlindBoxTurntable/get_xlh_my_record"];
[[QXRequset shareInstance] postWithUrl:url parameters:parameters needCache:NO success:^(id responseObject) {
if (weakSelf.page == 1) {
[weakSelf.myRecordArray removeAllObjects];
}
NSArray *arr = [NSArray yy_modelArrayWithClass:[QXActivityRecordModel class] json:responseObject[@"data"]];
[weakSelf.myRecordArray addObjectsFromArray:arr];
[weakSelf.collectionView reloadData];
if (arr.count == 0) {
weakSelf.collectionView.mj_footer.state = MJRefreshStateNoMoreData;
}else{
[weakSelf.collectionView.mj_footer endRefreshing];
}
[weakSelf.collectionView.mj_header endRefreshing];
} fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) {
[weakSelf.collectionView.mj_footer endRefreshing];
[weakSelf.collectionView.mj_header endRefreshing];
}];
}
-(void)showInView:(UIView *)view{
self.bgView.y = SCREEN_HEIGHT;
[view addSubview:self];
[UIView animateWithDuration:0.3 animations:^{
self.bgView.y = SCREEN_HEIGHT-ScaleWidth(663);
}];
}
-(void)hide{
// [self stopSlowAnimate];
[UIView animateWithDuration:0.3 animations:^{
self.bgView.y = SCREEN_HEIGHT;
} completion:^(BOOL finished) {
[self removeFromSuperview];
}];
}
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
// if (self.myRecordBtn.selected) {
return self.myRecordArray.count;
// }else{
// return self.allRecordArray.count;
// }
}
- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
QXMeetRecordCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"QXMeetRecordCell" forIndexPath:indexPath];
// if (self.myRecordBtn.selected) {
cell.model = self.myRecordArray[indexPath.row];
// }else{
// cell.model = self.allRecordArray[indexPath.row];
// }
return cell;
}
-(UICollectionView *)collectionView{
if (!_collectionView) {
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
layout.minimumLineSpacing = 16;
layout.minimumInteritemSpacing = 16;
layout.sectionInset = UIEdgeInsetsMake(0, 12, 0, 12);
layout.itemSize = CGSizeMake((self.bgCoverView.width-12*2-16*2)/3, ScaleWidth(123));
_collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, 10, self.bgCoverView.width, self.bgCoverView.height-10) collectionViewLayout:layout];
_collectionView.delegate = self;
_collectionView.dataSource = self;
_collectionView.showsHorizontalScrollIndicator = NO;
_collectionView.showsVerticalScrollIndicator = NO;
_collectionView.backgroundColor = [UIColor clearColor];
[_collectionView registerClass:[QXMeetRecordCell class] forCellWithReuseIdentifier:@"QXMeetRecordCell"];
MJWeakSelf
_collectionView.mj_footer = [MJRefreshBackStateFooter footerWithRefreshingBlock:^{
weakSelf.page++;
[weakSelf getRecordList];
}];
_collectionView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
weakSelf.page = 1;
[weakSelf getRecordList];
}];
}
return _collectionView;
}
-(NSMutableArray *)myRecordArray{
if (!_myRecordArray) {
_myRecordArray =[NSMutableArray array];
}
return _myRecordArray;
}
- (NSMutableArray *)allRecordArray{
if (!_allRecordArray) {
_allRecordArray = [NSMutableArray array];
}
return _allRecordArray;
}
@end
@implementation QXMeetRecordCell
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self initSubviews];
}
return self;
}
-(void)setModel:(QXActivityRecordModel *)model{
_model = model;
// self.giftInfoLabel.text = [NSString stringWithFormat:@"%@x%@",model.gift_name,model.count];
self.recieveInfoLabel.text = [NSString stringWithFormat:@"%@X%@",model.gift_name,model.count];
[self.giftImageView sd_setImageWithURL:[NSURL URLWithString:model.base_image]];
self.timeLabel.text = model.createtime;
}
-(void)initSubviews{
self.giftImageView = [[UIImageView alloc] init];
self.giftImageView.contentMode = UIViewContentModeScaleAspectFit;
[self.contentView addSubview:self.giftImageView];
[self.giftImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.contentView);
make.left.equalTo(self.contentView).offset(8);
make.right.equalTo(self.contentView).offset(-8);
make.height.equalTo(self.giftImageView.mas_width);
}];
self.giftInfoLabel = [[UILabel alloc] init];
self.giftInfoLabel.textColor = RGB16(0xffffff);
self.giftInfoLabel.font = [UIFont systemFontOfSize:12];
[self.contentView addSubview:self.giftInfoLabel];
[self.giftInfoLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.right.equalTo(self.contentView);
}];
self.recieveInfoLabel = [[UILabel alloc] init];
self.recieveInfoLabel.textColor = RGB16(0xffffff);
self.recieveInfoLabel.font = [UIFont systemFontOfSize:14];
self.recieveInfoLabel.textAlignment = NSTextAlignmentCenter;
[self.contentView addSubview:self.recieveInfoLabel];
[self.recieveInfoLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.giftImageView.mas_bottom).offset(4);
make.left.right.equalTo(self.contentView);
make.height.mas_equalTo(21);
}];
self.giftInfoLabel.hidden = YES;
self.timeLabel = [[UILabel alloc] init];
self.timeLabel.textColor = RGB16(0x5B5B5B);
self.timeLabel.font = [UIFont systemFontOfSize:10];
[self.contentView addSubview:self.timeLabel];
[self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.equalTo(self.contentView);
make.left.right.equalTo(self.contentView);
}];
}
@end

View File

@@ -0,0 +1,26 @@
//
// QXMeetActivityResultView.h
// QXLive
//
// Created by 启星 on 2025/8/30.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface QXMeetActivityResultView : UIView
@property (nonatomic,strong)NSArray *resultArray;
@property (nonatomic,strong)NSString *times;
@property (nonatomic,copy)void(^againBlock)(NSString*times);
-(void)showInView:(UIView *)view;
@end
@interface QXMeetActivityResultCell : UICollectionViewCell
@property (nonatomic,strong)UIImageView *giftBgImageView;
@property (nonatomic,strong)UIImageView *giftImageView;
@property (nonatomic,strong)UILabel *giftNameLabel;
@property (nonatomic,strong)QXDrawGiftModel *model;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,179 @@
//
// QXMeetActivityResultView.m
// QXLive
//
// Created by on 2025/8/30.
//
#import "QXMeetActivityResultView.h"
@interface QXMeetActivityResultView()<UICollectionViewDelegate,UICollectionViewDataSource>
@property (nonatomic,strong)UIView *bgView;
@property (nonatomic,strong)UIImageView *bgImageView;
@property (nonatomic,strong)UICollectionView *collectionView;
@property (nonatomic,strong)UIButton *againBtn;
@property (nonatomic,strong)UIButton *closeBtn;
@end
@implementation QXMeetActivityResultView
- (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] init];
[self addSubview:self.bgView];
[self.bgView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(self);
make.height.mas_equalTo(430);
make.centerY.equalTo(self);
}];
self.bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"ac_meet_draw_result_bg"]];
[self.bgView addSubview:self.bgImageView];
[self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(331);
make.height.mas_equalTo(364);
make.top.equalTo(self.bgView);
make.centerX.equalTo(self.bgView);
}];
[self.bgView addSubview:self.collectionView];
[self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(self.bgImageView);
make.top.mas_equalTo(115);
make.bottom.equalTo(self.bgImageView);
}];
self.againBtn = [[UIButton alloc] init];
[self.againBtn setBackgroundImage:[UIImage imageNamed:@"ac_meet_again_btn"] forState:(UIControlStateNormal)];
[self.againBtn addTarget:self action:@selector(againAction) forControlEvents:(UIControlEventTouchUpInside)];
[self.bgView addSubview:self.againBtn];
[self.againBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.equalTo(self.bgView);
make.width.mas_equalTo(140);
make.height.mas_equalTo(46);
make.centerX.equalTo(self.bgView);
}];
self.closeBtn = [[UIButton alloc] init];
[self.closeBtn setImage:[UIImage imageNamed:@"ac_meet_result_close"] forState:(UIControlStateNormal)];
[self.closeBtn addTarget:self action:@selector(closeAction) forControlEvents:(UIControlEventTouchUpInside)];
[self.bgView addSubview:self.closeBtn];
[self.closeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.top.equalTo(self.bgView);
make.height.mas_equalTo(40);
make.width.mas_equalTo(40);
}];
}
-(void)setTimes:(NSString *)times{
_times = times;
}
-(void)setResultArray:(NSArray *)resultArray{
_resultArray = resultArray;
[self.collectionView reloadData];
}
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
return self.resultArray.count;
}
-(__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
QXMeetActivityResultCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"QXMeetActivityResultCell" forIndexPath:indexPath];
cell.model = self.resultArray[indexPath.row];
return cell;
}
-(UICollectionView *)collectionView{
if (!_collectionView) {
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
layout.minimumLineSpacing = 20;
layout.minimumInteritemSpacing = 20;
layout.sectionInset = UIEdgeInsetsMake(0, 12, 0, 12);
layout.itemSize = CGSizeMake((331-12*2-20*2)/3,100);
_collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
_collectionView.delegate = self;
_collectionView.dataSource = self;
_collectionView.showsHorizontalScrollIndicator = NO;
_collectionView.showsVerticalScrollIndicator = NO;
_collectionView.backgroundColor = [UIColor clearColor];
[_collectionView registerClass:[QXMeetActivityResultCell class] forCellWithReuseIdentifier:@"QXMeetActivityResultCell"];
}
return _collectionView;
}
-(void)againAction{
[self hide];
if (self.againBlock) {
self.againBlock(self.times);
}
}
-(void)closeAction{
[self hide];
}
-(void)showInView:(UIView *)view{
// self.bgView.y = SCREEN_HEIGHT;
[view addSubview:self];
// [UIView animateWithDuration:0.3 animations:^{
// self.bgView.y = SCREEN_HEIGHT-ScaleWidth(663);
// }];
}
-(void)hide{
// [self stopSlowAnimate];
// [UIView animateWithDuration:0.3 animations:^{
// self.bgView.y = SCREEN_HEIGHT;
// } completion:^(BOOL finished) {
[self removeFromSuperview];
// }];
}
@end
@implementation QXMeetActivityResultCell
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self initSubviews];
}
return self;
}
-(void)setModel:(QXDrawGiftModel *)model{
_model = model;
[self.giftImageView sd_setImageWithURL:[NSURL URLWithString:model.base_image]];
self.giftNameLabel.text = [NSString stringWithFormat:@"%@x%@",model.gift_name,model.count];
}
-(void)initSubviews{
self.giftBgImageView = [[UIImageView alloc] init];
[self.contentView addSubview:self.giftBgImageView];
[self.giftBgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.top.equalTo(self.contentView);
make.height.equalTo(self.giftBgImageView.mas_width);
}];
self.giftImageView =[[UIImageView alloc] init];
self.giftImageView.contentMode = UIViewContentModeScaleAspectFit;
[self.contentView addSubview:self.giftImageView];
[self.giftImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self.giftBgImageView);
}];
self.giftNameLabel = [[UILabel alloc] init];
self.giftNameLabel.textColor = RGB16(0xffffff);
self.giftNameLabel.font = [UIFont systemFontOfSize:12];
self.giftNameLabel.textAlignment = NSTextAlignmentCenter;
self.giftNameLabel.lineBreakMode = NSLineBreakByTruncatingMiddle;
[self.contentView addSubview:self.giftNameLabel];
[self.giftNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.equalTo(self.contentView);
make.left.right.equalTo(self.contentView);
}];
}
@end

View File

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

View File

@@ -0,0 +1,134 @@
//
// QXMeetActivityRuleView.m
// QXLive
//
// Created by on 2025/8/26.
//
#import "QXMeetActivityRuleView.h"
#import <WebKit/WebKit.h>
static void *WKWebBrowserContext = &WKWebBrowserContext;
@interface QXMeetActivityRuleView()<WKNavigationDelegate,WKUIDelegate,UIGestureRecognizerDelegate>
@property(nonatomic,strong)WKWebView *contentWebView;
@property(nonatomic,strong)UIView* bgView;
@property(nonatomic,strong)UIImageView* ruleImageView;
@property(nonatomic,strong)UIImageView* bgImageView;
@end
@implementation QXMeetActivityRuleView
- (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.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.3];
self.bgView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, ScaleWidth(663))];
[self.bgView addRoundedCornersWithRadius:16 byRoundingCorners:(UIRectCornerTopLeft|UIRectCornerTopRight)];
[self addSubview:self.bgView];
self.bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"sky_rule_bg"]];
self.bgImageView.frame = CGRectMake(0, 0, SCREEN_WIDTH, ScaleWidth(663));
self.bgImageView.contentMode = UIViewContentModeScaleToFill;
[self.bgView addSubview:self.bgImageView];
self.ruleImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"sky_rule_icon"]];
self.ruleImageView.contentMode = UIViewContentModeScaleToFill;
self.ruleImageView.frame = CGRectMake((SCREEN_WIDTH-ScaleWidth(164))/2, 0, ScaleWidth(164), ScaleWidth(90));
[self.bgView addSubview:self.ruleImageView];
[self.bgView addSubview:self.contentWebView];
}
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{
return touch.view == self;
}
-(void)setRule:(NSString *)rule{
_rule = rule;
[self loadData];
}
- (void)loadData {
NSURL* url=[NSURL URLWithString:self.rule];
NSURLRequest *request =[NSURLRequest requestWithURL:url];
[self.contentWebView loadRequest:request];
}
//
- (void)webViewWebContentProcessDidTerminate:(WKWebView *)webView {
}
#pragma mark - getters and setters
- (WKWebView *)contentWebView {
if (!_contentWebView) {
//
WKWebViewConfiguration * configuration = [[WKWebViewConfiguration alloc]init];
//
configuration.selectionGranularity = YES;
// webpr
configuration.processPool = [[WKProcessPool alloc] init];
//, jsoc(OCURL)
WKUserContentController * UserContentController = [[WKUserContentController alloc]init];
//
configuration.suppressesIncrementalRendering = NO;
//
configuration.preferences.javaScriptEnabled = YES;
configuration.preferences.javaScriptCanOpenWindowsAutomatically = YES;
configuration.userContentController = UserContentController;
// iOS9iOS8
if ([[UIDevice currentDevice].systemVersion floatValue] >= 9.0) {
//
configuration.allowsAirPlayForMediaPlayback = YES;
// 线
configuration.allowsInlineMediaPlayback = YES;
// NOios8
_contentWebView.allowsBackForwardNavigationGestures = YES;
}
_contentWebView = [[WKWebView alloc] initWithFrame:CGRectMake(25, self.ruleImageView.bottom, self.width-16*2, self.bgView.height-self.ruleImageView.bottom) configuration:configuration];
_contentWebView.backgroundColor = [UIColor clearColor];
[_contentWebView addRoundedCornersWithRadius:16];
_contentWebView.opaque = NO;
//
[_contentWebView sizeToFit];
_contentWebView.scrollView.showsVerticalScrollIndicator = NO;
_contentWebView.scrollView.backgroundColor = [UIColor clearColor];
_contentWebView.scrollView.bounces = NO;
//
_contentWebView.navigationDelegate = self;
}
return _contentWebView;
}
-(void)showInView:(UIView *)view{
self.bgView.y = SCREEN_HEIGHT;
[view addSubview:self];
[UIView animateWithDuration:0.3 animations:^{
self.bgView.y = SCREEN_HEIGHT-ScaleWidth(663);
}];
}
-(void)hide{
// [self stopSlowAnimate];
[UIView animateWithDuration:0.3 animations:^{
self.bgView.y = SCREEN_HEIGHT;
} completion:^(BOOL finished) {
[self removeFromSuperview];
}];
}
@end

View File

@@ -0,0 +1,57 @@
//
// QXMeetActivityView.h
// QXLive
//
// Created by 启星 on 2025/8/29.
//
#import <UIKit/UIKit.h>
#import "QXTimer.h"
#import "GKCycleScrollView.h"
NS_ASSUME_NONNULL_BEGIN
@interface QXMeetActivityView : UIView
-(void)showInView:(UIView *)view;
@property (nonatomic,strong)NSString *roomId;
@property (nonatomic,strong)QXGiftModel *giftModel;
-(void)updateUserAndGiftInfoWithModel:(QXRoomChatListModel*)model;
@end
@interface QXMeetTimeDownView :UIView
@property (nonatomic,strong)UIImageView *timeBgView1;
@property (nonatomic,strong)UIImageView *timeBgView2;
@property (nonatomic,strong)UIImageView *timeBgView3;
@property (nonatomic,strong)UIImageView *timeBgView4;
@property (nonatomic,strong)UILabel *centerLabel;
@property (nonatomic,strong)UILabel *timeLabel1;
@property (nonatomic,strong)UILabel *timeLabel2;
@property (nonatomic,strong)UILabel *timeLabel3;
@property (nonatomic,strong)UILabel *timeLabel4;
@property (nonatomic,assign)long long endTime;
@property (nonatomic,assign)long long startTime;
@property (nonatomic,strong)QXTimer *timer;
@end
@interface QXMeetDrawBtn : UIControl
@property (nonatomic,strong)UIImageView *bgImageView;
@property (nonatomic,strong)UILabel *titleLabel;
@property (nonatomic,strong)UIButton *giftCoin;
@property (nonatomic,assign)QXSkyDrawBtnType btnType;
@end
//@interface QXMeetGiftCell : GKCycleScrollViewCell
//@property (nonatomic,strong)UIImageView *giftBgImageView;
//@property (nonatomic,strong)UIImageView *giftImageView;
//@property (nonatomic,strong)UIImageView *giftNameBgImageView;
//@property (nonatomic,strong)UILabel *giftNameLabel;
//@property (nonatomic,strong)UIButton *giftCoinBtn;
//@property (nonatomic,strong)QXDrawGiftModel *model;
//@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,794 @@
//
// QXMeetActivityView.m
// QXLive
//
// Created by on 2025/8/29.
//
#import "QXMeetActivityView.h"
#import "QXMeetActivityRuleView.h"
#import "QXMeetActivityRecordView.h"
#import "QXMeetActivityRankView.h"
#import "QXMeetActivityPoolView.h"
#import "QXMeetActivityResultView.h"
#import "QXMeetLotteryView.h"
@interface QXMeetActivityView()<UIGestureRecognizerDelegate,QXMeetLotteryViewDelegate>
@property (nonatomic,strong)UIView *bgView;
@property (nonatomic,strong)UIImageView *bgImageView;
///
@property (nonatomic,strong)UIButton *poolBtn;
///
@property (nonatomic,strong)UIButton *ruleBtn;
///
@property (nonatomic,strong)UIButton *recordBtn;
///
@property (nonatomic,strong)UIButton *rankBtn;
@property (nonatomic,strong)QXMeetTimeDownView *timeDownView;
///
@property (nonatomic,strong)UIImageView *centerGiftBgImageView;
@property (nonatomic,strong)UIImageView *giftImageView;
@property (nonatomic,strong)UIImageView *giftNameBgImageView;
@property (nonatomic,strong)UILabel *giftNameLabel;
@property (nonatomic,strong)UIButton *giftCoinBtn;
@property (nonatomic,strong)UIImageView *giftHeartImageView;
@property (nonatomic,strong)UILabel *heartLabel;
///
@property (nonatomic,strong)UIImageView *userBgImageView;
@property (nonatomic,strong)UIImageView *userHeader;
@property (nonatomic,strong)UIImageView *userHeaderDress;
@property (nonatomic,strong)UILabel *userNameLabel;
///
@property (nonatomic,strong)UIImageView *leftGiftBgImageView;
@property (nonatomic,strong)UIImageView *leftGiftImageView;
@property (nonatomic,strong)QXMeetDrawBtn *oneBtn;
@property (nonatomic,strong)QXMeetDrawBtn *tenBtn;
@property (nonatomic,strong)QXMeetDrawBtn *hundredBtn;
///
@property (nonatomic,strong)UIView* coinView;
@property (nonatomic,strong)UIButton* coinBtn;
@property (nonatomic,strong)UIButton* exchangeBtn;
///
@property (nonatomic,strong)UIButton* jumpAnimateBtn;
@property (nonatomic,strong)QXMeetActivityRuleView* ruleView;
@property (nonatomic,strong)QXMeetActivityRecordView* recordView;
@property (nonatomic,strong)QXMeetActivityRankView* rankView;
@property (nonatomic,strong)QXMeetActivityPoolView* poolView;
@property (nonatomic,strong)QXActivityXLHModel* model;
@property (nonatomic,strong)QXMeetLotteryView *cycleScrollView;
@property (nonatomic,strong)UIImageView *drawGiftCenterBgImageView;
@property (nonatomic,assign)BOOL isDrawing;
@property (nonatomic,strong)NSArray *resultArray;
@property (nonatomic,assign)NSInteger cycleCount;
@property (nonatomic,strong)QXMeetActivityResultView *resultView;
@end
@implementation QXMeetActivityView
- (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.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.3];
self.bgView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, ScaleWidth(663))];
[self.bgView addRoundedCornersWithRadius:16 byRoundingCorners:(UIRectCornerTopLeft|UIRectCornerTopRight)];
[self addSubview:self.bgView];
// NSString *path = [[NSBundle mainBundle] pathForResource:@"ac_meet_big_bg@2x" ofType:@"png"];
// UIImage *bgImage = [UIImage imageWithContentsOfFile:path];
self.bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"ac_meet_big_bg"]];
self.bgImageView.frame = CGRectMake(0, 0, SCREEN_WIDTH, ScaleWidth(663));
self.bgImageView.contentMode = UIViewContentModeScaleToFill;
[self.bgView addSubview:self.bgImageView];
self.poolBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, ScaleWidth(61), ScaleWidth(48), ScaleWidth(24))];
[self.poolBtn setBackgroundImage:[UIImage imageNamed:@"sky_right_bg"] forState:(UIControlStateNormal)];
[self.poolBtn setTitle:@"奖池" forState:(UIControlStateNormal)];
[self.poolBtn setTitleColor:RGB16(0xffffff) forState:(UIControlStateNormal)];
self.poolBtn.titleLabel.font = [UIFont systemFontOfSize:14];
[self.poolBtn addTarget:self action:@selector(poolAction) forControlEvents:(UIControlEventTouchUpInside)];
[self.bgView addSubview:self.poolBtn];
self.rankBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, self.poolBtn.bottom+12, ScaleWidth(48), ScaleWidth(24))];
[self.rankBtn setBackgroundImage:[UIImage imageNamed:@"sky_right_bg"] forState:(UIControlStateNormal)];
[self.rankBtn setTitle:@"榜单" forState:(UIControlStateNormal)];
[self.rankBtn setTitleColor:RGB16(0xffffff) forState:(UIControlStateNormal)];
self.rankBtn.titleLabel.font = [UIFont systemFontOfSize:14];
[self.rankBtn addTarget:self action:@selector(rankAction) forControlEvents:(UIControlEventTouchUpInside)];
[self.bgView addSubview:self.rankBtn];
self.ruleBtn = [[UIButton alloc] initWithFrame:CGRectMake(SCREEN_WIDTH-ScaleWidth(48), self.poolBtn.top, ScaleWidth(48), ScaleWidth(24))];
[self.ruleBtn setBackgroundImage:[UIImage imageNamed:@"sky_left_bg"] forState:(UIControlStateNormal)];
[self.ruleBtn setTitle:@"规则" forState:(UIControlStateNormal)];
[self.ruleBtn setTitleColor:RGB16(0xffffff) forState:(UIControlStateNormal)];
self.ruleBtn.titleLabel.font = [UIFont systemFontOfSize:14];
[self.ruleBtn addTarget:self action:@selector(ruleAction) forControlEvents:(UIControlEventTouchUpInside)];
[self.bgView addSubview:self.ruleBtn];
self.recordBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.ruleBtn.left, self.ruleBtn.bottom+12, ScaleWidth(48), ScaleWidth(24))];
[self.recordBtn setBackgroundImage:[UIImage imageNamed:@"sky_left_bg"] forState:(UIControlStateNormal)];
[self.recordBtn setTitle:@"记录" forState:(UIControlStateNormal)];
[self.recordBtn setTitleColor:RGB16(0xffffff) forState:(UIControlStateNormal)];
self.recordBtn.titleLabel.font = [UIFont systemFontOfSize:14];
[self.recordBtn addTarget:self action:@selector(recordAction) forControlEvents:(UIControlEventTouchUpInside)];
[self.bgView addSubview:self.recordBtn];
self.timeDownView = [[QXMeetTimeDownView alloc] initWithFrame:CGRectMake((self.bgView.width-ScaleWidth(122))/2, self.rankBtn.top-4, ScaleWidth(122), ScaleWidth(29))];
[self.bgView addSubview:self.timeDownView];
self.giftImageView = [[UIImageView alloc] initWithFrame:CGRectMake((self.bgView.width-ScaleWidth(118))/2, self.timeDownView.bottom+11, ScaleWidth(118), ScaleWidth(118))];
[self.bgView addSubview:self.giftImageView];
self.giftNameBgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"ac_meet_gift_name_bg"]];
self.giftNameBgImageView.contentMode = UIViewContentModeScaleToFill;
self.giftNameBgImageView.frame = CGRectMake(self.giftImageView.left, self.giftImageView.bottom-30, self.giftImageView.width, 30);
[self.bgView addSubview:self.giftNameBgImageView];
self.giftNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.giftImageView.left, self.giftImageView.bottom-30, self.giftImageView.width, 15)];
self.giftNameLabel.textColor = RGB16(0xffffff);
self.giftNameLabel.font = [UIFont systemFontOfSize:12];
self.giftNameLabel.textAlignment = NSTextAlignmentCenter;
[self.bgView addSubview:self.giftNameLabel];
self.giftCoinBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.giftImageView.left, self.giftNameLabel.bottom, self.giftImageView.width, 15)];
[self.giftCoinBtn setTitleColor:RGB16(0xC7BF62) forState:(UIControlStateNormal)];
[self.giftCoinBtn setImage:[UIImage imageNamed:@"sky_item_coin"] forState:(UIControlStateNormal)];
self.giftCoinBtn.titleLabel.font = [UIFont systemFontOfSize:10];
[self.bgView addSubview:self.giftCoinBtn];
self.giftHeartImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"ac_gift_heart"]];
self.giftHeartImageView.frame = CGRectMake((self.bgView.width-ScaleWidth(46))/2, self.giftCoinBtn.bottom, ScaleWidth(46), ScaleWidth(46));
[self.bgView addSubview:self.giftHeartImageView];
self.heartLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.bgView.width, 14)];
self.heartLabel.textAlignment = NSTextAlignmentCenter;
self.heartLabel.font = [UIFont boldSystemFontOfSize:14];
self.heartLabel.text = @"-";
self.heartLabel.centerY = self.giftHeartImageView.centerY;
[self.bgView addSubview:self.heartLabel];
self.centerGiftBgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"ac_meet_center_gift_bg"]];
self.centerGiftBgImageView.frame = CGRectMake((self.bgView.width-ScaleWidth(320))/2, self.giftImageView.top, ScaleWidth(320), ScaleWidth(195));
[self.bgView insertSubview:self.centerGiftBgImageView belowSubview:self.giftImageView];
self.userBgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"ac_user_bg"]];
self.userBgImageView.contentMode = UIViewContentModeScaleToFill;
self.userBgImageView.frame = CGRectMake(self.bgView.width-25-ScaleWidth(56), 0, ScaleWidth(56), ScaleWidth(73));
self.userBgImageView.centerY = self.centerGiftBgImageView.centerY;
[self.bgView addSubview:self.userBgImageView];
self.userHeader = [[UIImageView alloc] initWithFrame:CGRectMake(0, self.userBgImageView.top, ScaleWidth(36), ScaleWidth(36))];
self.userHeader.contentMode = UIViewContentModeScaleAspectFill;
self.userHeader.centerX = self.userBgImageView.centerX;
[self.userHeader addRoundedCornersWithRadius:ScaleWidth(18)];
[self.bgView addSubview:self.userHeader];
self.userHeaderDress = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, ScaleWidth(52), ScaleWidth(52))];
UIImage *dressImage = [UIImage imageNamed:@"ac_user_dress"];
self.userHeaderDress.image = dressImage;
self.userHeaderDress.hidden = YES;
self.userHeaderDress.contentMode = UIViewContentModeScaleAspectFill;
self.userHeaderDress.centerX = self.userHeader.centerX;
self.userHeaderDress.centerY = self.userHeader.centerY;
[self.bgView addSubview:self.userHeaderDress];
// @2x
self.userNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.userBgImageView.left, self.userBgImageView.bottom-7-14, self.userBgImageView.width, 14)];
self.userNameLabel.textColor = RGB16(0xffffff);
self.userNameLabel.font = [UIFont systemFontOfSize:12];
self.userNameLabel.text = @"虚位以待";
self.userNameLabel.textAlignment = NSTextAlignmentCenter;
[self.bgView addSubview:self.userNameLabel];
self.leftGiftBgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"ac_left_gift_bg"]];
self.leftGiftBgImageView.frame = CGRectMake(25, 0, ScaleWidth(94), ScaleWidth(105));
self.leftGiftBgImageView.centerY = self.centerGiftBgImageView.centerY;
[self.bgView addSubview:self.leftGiftBgImageView];
self.leftGiftImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, self.leftGiftBgImageView.top+ScaleWidth(13), ScaleWidth(54), ScaleWidth(52))];
self.leftGiftImageView.centerX = self.leftGiftBgImageView.centerX;
// self.leftGiftImageView.backgroundColor = UIColor.redColor;
[self.bgView addSubview:self.leftGiftImageView];
CGFloat btnWidth = ScaleWidth(109);
CGFloat btnMargin = (SCREEN_WIDTH- ScaleWidth(109)*3)/4;
QXMeetDrawBtn *oneBtn = [[QXMeetDrawBtn alloc] initWithFrame:CGRectMake(btnMargin, self.bgView.height-ScaleWidth(34)-20, btnWidth, ScaleWidth(34))];
oneBtn.btnType = QXSkyDrawBtnTypeOne;
self.oneBtn = oneBtn;
self.oneBtn.hidden = YES;
[oneBtn addTarget:self action:@selector(startAction:) forControlEvents:(UIControlEventTouchUpInside)];
[self.bgView addSubview:oneBtn];
QXMeetDrawBtn *tenBtn = [[QXMeetDrawBtn alloc] initWithFrame:CGRectMake(self.oneBtn.right+btnMargin, self.oneBtn.top, btnWidth, ScaleWidth(34))];
tenBtn.btnType = QXSkyDrawBtnTypeTen;
self.tenBtn = tenBtn;
self.tenBtn.hidden = YES;
[tenBtn addTarget:self action:@selector(startAction:) forControlEvents:(UIControlEventTouchUpInside)];
[self.bgView addSubview:tenBtn];
QXMeetDrawBtn *hundredBtn = [[QXMeetDrawBtn alloc] initWithFrame:CGRectMake(tenBtn.right+btnMargin, self.oneBtn.top, btnWidth, ScaleWidth(34))];
hundredBtn.btnType = QXSkyDrawBtnTypeHundred;
self.hundredBtn = hundredBtn;
self.hundredBtn.hidden = YES;
[hundredBtn addTarget:self action:@selector(startAction:) forControlEvents:(UIControlEventTouchUpInside)];
[self.bgView addSubview:hundredBtn];
self.coinView = [[UIView alloc] initWithFrame:CGRectMake((self.bgView.width-100)/2,self.oneBtn.top-20-ScaleWidth(28), 100,ScaleWidth(28))];
[self.coinView addRoundedCornersWithRadius:ScaleWidth(14)];
self.coinView.backgroundColor = RGB16A(0x2d449f,0.5);
[self.bgView addSubview:self.coinView];
self.coinBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 50, self.coinView.height)];
[self.coinBtn setTitleColor:RGB16(0xF8E837) forState:(UIControlStateNormal)];
[self.coinBtn setTitle:@"-" forState:(UIControlStateNormal)];
[self.coinBtn setImage:[UIImage imageNamed:@"sky_item_coin"] forState:(UIControlStateNormal)];
self.coinBtn.titleLabel.font = [UIFont systemFontOfSize:10];
self.coinBtn.userInteractionEnabled = NO;
[self.coinView addSubview:self.coinBtn];
self.exchangeBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.coinView.width-50, 0, 50, self.coinView.height)];
[self.exchangeBtn setTitle:@"去兑换" forState:(UIControlStateNormal)];
[self.exchangeBtn setTitleColor:RGB16(0xF8E837) forState:(UIControlStateNormal)];
self.exchangeBtn.titleLabel.font = [UIFont systemFontOfSize:10];
self.exchangeBtn.userInteractionEnabled = NO;
[self.coinView addSubview:self.exchangeBtn];
self.jumpAnimateBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.bgView.width-109, 0, 109, ScaleWidth(28))];
[self.jumpAnimateBtn setImage:[UIImage imageNamed:@"login_agreement_nor"] forState:(UIControlStateNormal)];
[self.jumpAnimateBtn setImage:[UIImage imageNamed:@"login_agreement_sel"] forState:(UIControlStateSelected)];
[self.jumpAnimateBtn addTarget:self action:@selector(jumpAnimateAction:) forControlEvents:(UIControlEventTouchUpInside)];
[self.jumpAnimateBtn setTitle:@"跳过动画" forState:(UIControlStateNormal)];
self.jumpAnimateBtn.titleLabel.font = [UIFont systemFontOfSize:12];
[self.jumpAnimateBtn setTitleColor:RGB16(0xffffff) forState:(UIControlStateNormal)];
self.jumpAnimateBtn.centerY = self.coinView.centerY;
[self.bgView addSubview:self.jumpAnimateBtn];
[self.bgView addSubview:self.cycleScrollView];
self.drawGiftCenterBgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"ac_draw_gift_center_bg"]];
self.drawGiftCenterBgImageView.contentMode = UIViewContentModeScaleToFill;
self.drawGiftCenterBgImageView.hidden = YES;
self.drawGiftCenterBgImageView.frame = CGRectMake((self.bgView.width-ScaleWidth(105))/2, self.cycleScrollView.top+25, ScaleWidth(105), ScaleWidth(105));
[self.bgView addSubview:self.drawGiftCenterBgImageView];
}
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{
return touch.view == self;
}
-(void)getMyWallet{
MJWeakSelf
[[QXRequset shareInstance] getWithUrl:QXWallet parameters:@{@"token":[QXGlobal shareGlobal].loginModel.token?[QXGlobal shareGlobal].loginModel.token:@""} needCache:NO success:^(id responseObject) {
double coin = [responseObject[@"data"][@"coin"] doubleValue];
NSString *coinStr = [NSString stringWithFormat:@"%.2f",coin];
[weakSelf.coinBtn setTitle:[NSString stringWithFormat:@" %@",coinStr] forState:(UIControlStateNormal)];
[weakSelf.coinBtn sizeToFit];
CGFloat allWidth = weakSelf.coinBtn.width + self.exchangeBtn.width+15;
weakSelf.coinView.width = allWidth;
weakSelf.coinView.x = (self.bgView.width-allWidth)/2;
weakSelf.coinBtn.frame = CGRectMake(10, 0, weakSelf.coinBtn.width, weakSelf.coinView.height);
weakSelf.exchangeBtn.frame = CGRectMake(allWidth-weakSelf.exchangeBtn.width, 0, weakSelf.exchangeBtn.width, weakSelf.coinView.height);
} fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) {
}];
}
-(void)getGiftList{
// if (self.model) {
// return;
// }
MJWeakSelf
[[QXRequset shareInstance] postWithUrl:[NSString stringWithFormat:@"%@%@",ServerUrl,@"api/BlindBoxTurntable/xlh"] parameters:@{@"room_id":self.roomId?self.roomId:@""} needCache:NO success:^(id responseObject) {
QXActivityXLHModel *model = [QXActivityXLHModel yy_modelWithJSON:responseObject[@"data"]];
weakSelf.model = model;
[weakSelf configData];
} fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) {
}];
}
-(void)drawGiftWithNum:(NSString*)num{
if (self.isDrawing) {
showToast(@"正在抽奖中");
return;
}
NSDictionary *parameters = @{
@"room_id":self.roomId,
@"num":num
};
self.drawGiftCenterBgImageView.hidden = YES;
self.drawGiftCenterBgImageView.alpha = 0;
self.isDrawing = YES;
self.resultView.times = num;
MJWeakSelf
[[QXRequset shareInstance] postWithUrl:[NSString stringWithFormat:@"%@%@",ServerUrl,@"api/BlindBoxTurntable/xlh_draw_gift"] parameters:parameters needCache:NO success:^(id responseObject) {
weakSelf.resultArray = [NSArray yy_modelArrayWithClass:[QXDrawGiftModel class] json:responseObject[@"data"]];
if (weakSelf.jumpAnimateBtn.selected) {
weakSelf.resultView.resultArray = weakSelf.resultArray;
[weakSelf.resultView showInView:weakSelf];
weakSelf.isDrawing = NO;
}else{
NSInteger index = 0;
for (int i = 0; i < weakSelf.resultArray.count; i++) {
QXDrawGiftModel *md1 = weakSelf.resultArray[i];
for (int j = 0; j < weakSelf.model.gift_list.count; j++) {
QXDrawGiftModel *md2 = weakSelf.model.gift_list[j];
if ([md1.gift_id isEqualToString:md2.gift_id]) {
index = j;
break;
}
}
}
weakSelf.cycleScrollView.finalPrizeIndex = index;
[weakSelf.cycleScrollView startLotteryAnimation];
}
} fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) {
weakSelf.isDrawing = NO;
showToast(msg);
}];
}
#pragma mark - LotteryWheelViewDelegate
- (void)lotteryWheelDidStopAtIndex:(NSInteger)index {
// NSString *prizeName = self.lotteryWheel.prizes[index];
// self.resultLabel.text = [NSString stringWithFormat:@"恭喜获得:%@", prizeName];
//
// //
// [UIView animateWithDuration:0.3 animations:^{
// self.resultLabel.transform = CGAffineTransformMakeScale(1.2, 1.2);
// } completion:^(BOOL finished) {
// [UIView animateWithDuration:0.3 animations:^{
// self.resultLabel.transform = CGAffineTransformIdentity;
// }];
// }];
self.drawGiftCenterBgImageView.hidden = NO;
MJWeakSelf
[UIView animateWithDuration:0.2 animations:^{
weakSelf.drawGiftCenterBgImageView.alpha = 1;
} completion:^(BOOL finished) {
weakSelf.resultView.resultArray = weakSelf.resultArray;
[weakSelf.resultView showInView:weakSelf];
weakSelf.isDrawing = NO;
}];
}
-(void)updateUserAndGiftInfoWithModel:(QXRoomChatListModel *)model{
if (self.model.xlh_user == nil) {
QXUserModel *xlh_user = [[QXUserModel alloc] init];
self.model.xlh_user = xlh_user;
}
self.model.xlh_user.nickname = model.FromUserInfo.nickname;
self.model.xlh_user.avatar = model.FromUserInfo.avatar;
self.model.locking_gift.gift_num = model.gift_num;
self.model.xlh_end_time = model.end_time;
[self configData];
}
-(void)configData{
[self.oneBtn.giftCoin setTitle:[NSString stringWithFormat:@"%@币一次",self.model.box_price] forState:(UIControlStateNormal)];
[self.tenBtn.giftCoin setTitle:[NSString stringWithFormat:@"%ld币一次",self.model.box_price.integerValue*10] forState:(UIControlStateNormal)];
[self.hundredBtn.giftCoin setTitle:[NSString stringWithFormat:@"%ld币一次",self.model.box_price.integerValue*100] forState:(UIControlStateNormal)];
self.oneBtn.hidden = NO;
self.tenBtn.hidden = NO;
self.hundredBtn.hidden = NO;
if (self.model.xlh_user) {
[self.userHeader sd_setImageWithURL:[NSURL URLWithString:self.model.xlh_user.avatar]];
self.userHeader.hidden = NO;
self.userNameLabel.text = self.model.xlh_user.nickname?self.model.xlh_user.nickname:@"虚位以待";
self.userHeaderDress.hidden = NO;
}else{
self.userHeaderDress.hidden = YES;
self.userHeader.hidden = YES;
self.userNameLabel.text = self.model.xlh_user.nickname?self.model.xlh_user.nickname:@"虚位以待";
}
if (self.model.locking_gift) {
NSString *encodedQuery = [self.model.locking_gift.base_image stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
NSURL *imageUrl = [NSURL URLWithString:encodedQuery];
[self.giftImageView sd_setImageWithURL:imageUrl];
self.giftNameLabel.text = self.model.locking_gift.gift_name;
[self.giftCoinBtn setTitle:[NSString stringWithFormat:@" %@",self.model.locking_gift.gift_price] forState:(UIControlStateNormal)];
self.heartLabel.text = self.model.locking_gift.gift_num?self.model.locking_gift.gift_num:@"0";
}
if (self.model.give_homeowner_gift) {
[self.leftGiftImageView sd_setImageWithURL:[NSURL URLWithString:self.model.give_homeowner_gift.base_image]];
}
self.cycleScrollView.prizes = self.model.gift_list;
self.timeDownView.endTime = self.model.xlh_end_time.longLongValue;
}
-(void)startAction:(QXMeetDrawBtn*)sender{
[self drawGiftWithNum:[NSString stringWithFormat:@"%ld",sender.btnType]];
}
-(void)jumpAnimateAction:(UIButton*)sender{
sender.selected = !sender.selected;
}
-(void)showInView:(UIView *)view{
[self getGiftList];
[self getMyWallet];
self.bgView.y = SCREEN_HEIGHT;
[view addSubview:self];
[UIView animateWithDuration:0.3 animations:^{
self.bgView.y = SCREEN_HEIGHT-ScaleWidth(663);
}];
}
-(void)hide{
[UIView animateWithDuration:0.3 animations:^{
self.bgView.y = SCREEN_HEIGHT;
} completion:^(BOOL finished) {
[self removeFromSuperview];
}];
}
-(void)poolAction{
self.poolView.roomId = self.roomId;
[self.poolView showInView:self];
}
-(void)ruleAction{
self.ruleView.rule = self.model.rule_url;
[self.ruleView showInView:self];
}
-(void)recordAction{
self.recordView.roomId = self.roomId;
[self.recordView showInView:self];
}
-(void)rankAction{
self.rankView.roomId = self.roomId;
[self.rankView showInView:self];
}
-(QXMeetActivityRuleView *)ruleView{
if (!_ruleView) {
_ruleView = [[QXMeetActivityRuleView alloc] init];
}
return _ruleView;
}
-(QXMeetActivityRankView *)rankView{
if (!_rankView) {
_rankView = [[QXMeetActivityRankView alloc] init];
}
return _rankView;
}
-(QXMeetActivityPoolView *)poolView{
if (!_poolView) {
_poolView = [[QXMeetActivityPoolView alloc] init];
}
return _poolView;
}
-(QXMeetActivityRecordView *)recordView{
if (!_recordView) {
_recordView = [[QXMeetActivityRecordView alloc] init];
}
return _recordView;
}
-(QXMeetActivityResultView *)resultView{
if (!_resultView) {
_resultView = [[QXMeetActivityResultView alloc] init];
MJWeakSelf
_resultView.againBlock = ^(NSString * _Nonnull times) {
[weakSelf drawGiftWithNum:times];
};
}
return _resultView;
}
-(QXMeetLotteryView *)cycleScrollView{
if (!_cycleScrollView) {
_cycleScrollView = [[QXMeetLotteryView alloc] initWithFrame:CGRectMake(0, self.giftHeartImageView.bottom+20, self.bgView.width, 220)];
_cycleScrollView.delegate = self;
}
return _cycleScrollView;
}
@end
@implementation QXMeetTimeDownView
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self initSubviews];
}
return self;
}
-(void)setEndTime:(long long)endTime{
_endTime = endTime;
NSTimeInterval timeInterval = [[NSDate date] timeIntervalSince1970];
//
long long milliseconds = (long long)(timeInterval);
self.startTime = endTime - milliseconds;
if (self.startTime <= 0) {
//
self.timeLabel1.text = @"0";
self.timeLabel2.text = @"0";
self.timeLabel3.text = @"0";
self.timeLabel4.text = @"0";
return;
}
MJWeakSelf
[self stopTimer];
_timer = [QXTimer scheduledTimerWithTimeInterval:1 repeats:YES queue:dispatch_get_main_queue() block:^{
dispatch_async(dispatch_get_main_queue(), ^{
weakSelf.startTime--;
// NSInteger hour = self.startTime/60/60;
NSInteger min = (self.startTime % 3600) / 60;
NSInteger second = self.startTime % 60;
NSString *time = [NSString stringWithFormat:@"%02ld%02ld",min,second];
if (time.length == 4) {
self.timeLabel1.text = [time substringWithRange:NSMakeRange(0, 1)];
self.timeLabel2.text = [time substringWithRange:NSMakeRange(1, 1)];
self.timeLabel3.text = [time substringWithRange:NSMakeRange(2, 1)];
self.timeLabel4.text = [time substringWithRange:NSMakeRange(3, 1)];
}
if (weakSelf.startTime<=0) {
[weakSelf stopTimer];
weakSelf.timeLabel1.text = @"0";
weakSelf.timeLabel2.text = @"0";
weakSelf.timeLabel3.text = @"0";
weakSelf.timeLabel4.text = @"0";
}
});
}];
}
-(void)stopTimer{
if (_timer) {
[self->_timer invalidate];
self->_timer= nil;
}
}
-(void)initSubviews{
self.timeBgView1 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"ac_meet_time_down_bg"]];
[self addSubview:self.timeBgView1];
[self.timeBgView1 mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(ScaleWidth(19));
make.height.mas_equalTo(ScaleWidth(29));
make.left.equalTo(self);
make.centerY.equalTo(self);
}];
self.timeLabel1 = [[UILabel alloc] init];
self.timeLabel1.font = [UIFont fontWithName:@"Didot" size:16];
self.timeLabel1.textColor = RGB16(0x00F3D3);
self.timeLabel1.textAlignment = NSTextAlignmentCenter;
[self addSubview:self.timeLabel1];
[self.timeLabel1 mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self.timeBgView1);
}];
self.timeBgView2 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"ac_meet_time_down_bg"]];
[self addSubview:self.timeBgView2];
[self.timeBgView2 mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(ScaleWidth(19));
make.height.mas_equalTo(ScaleWidth(29));
make.left.equalTo(self.timeBgView1.mas_right).offset(6);
make.centerY.equalTo(self);
}];
self.timeLabel2 = [[UILabel alloc] init];
self.timeLabel2.font = [UIFont fontWithName:@"Didot" size:16];
self.timeLabel2.textColor = RGB16(0x00F3D3);
self.timeLabel2.textAlignment = NSTextAlignmentCenter;
[self addSubview:self.timeLabel2];
[self.timeLabel2 mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self.timeBgView2);
}];
self.centerLabel = [[UILabel alloc] init];
self.centerLabel.font = [UIFont fontWithName:@"Didot" size:16];
self.centerLabel.text = @":";
self.centerLabel.textAlignment = NSTextAlignmentCenter;
self.centerLabel.textColor = RGB16(0x00F3D3);
[self addSubview:self.centerLabel];
[self.centerLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self);
make.centerY.equalTo(self);
}];
self.timeBgView4 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"ac_meet_time_down_bg"]];
[self addSubview:self.timeBgView4];
[self.timeBgView4 mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(ScaleWidth(19));
make.height.mas_equalTo(ScaleWidth(29));
make.right.equalTo(self);
make.centerY.equalTo(self);
}];
self.timeLabel4 = [[UILabel alloc] init];
self.timeLabel4.font = [UIFont fontWithName:@"Didot" size:16];
self.timeLabel4.textColor = RGB16(0x00F3D3);
self.timeLabel4.textAlignment = NSTextAlignmentCenter;
[self addSubview:self.timeLabel4];
[self.timeLabel4 mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self.timeBgView4);
}];
self.timeBgView3 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"ac_meet_time_down_bg"]];
[self addSubview:self.timeBgView3];
[self.timeBgView3 mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(ScaleWidth(19));
make.height.mas_equalTo(ScaleWidth(29));
make.right.equalTo(self.timeBgView4.mas_left).offset(-6);
make.centerY.equalTo(self);
}];
self.timeLabel3 = [[UILabel alloc] init];
self.timeLabel3.textColor = RGB16(0x00F3D3);
self.timeLabel3.textAlignment = NSTextAlignmentCenter;
self.timeLabel3.font = [UIFont fontWithName:@"Didot" size:16];
[self addSubview:self.timeLabel3];
[self.timeLabel3 mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self.timeBgView3);
}];
self.timeLabel1.text = @"0";
self.timeLabel2.text = @"0";
self.timeLabel3.text = @"0";
self.timeLabel4.text = @"0";
}
@end
@implementation QXMeetDrawBtn
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self initSubviews];
}
return self;
}
-(void)initSubviews{
self.bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"meet_touch_bg"]];
self.bgImageView.frame = self.bounds;
[self addSubview:self.bgImageView];
self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.width, 16)];
self.titleLabel.font = [UIFont systemFontOfSize:12];
self.titleLabel.textAlignment = NSTextAlignmentCenter;
self.titleLabel.textColor = RGB16(0xA18710);
[self addSubview:self.titleLabel];
self.giftCoin = [[UIButton alloc] initWithFrame:CGRectMake(0, self.titleLabel.bottom, self.width, 16)];
[self.giftCoin setTitleColor:RGB16(0xA18710) forState:(UIControlStateNormal)];
[self.giftCoin setImage:[UIImage imageNamed:@"sky_item_coin"] forState:(UIControlStateNormal)];
self.giftCoin.titleLabel.font = [UIFont systemFontOfSize:10];
self.giftCoin.userInteractionEnabled = NO;
[self addSubview:self.giftCoin];
}
-(void)setBtnType:(QXSkyDrawBtnType)btnType{
// ///
// QXSkyDrawBtnTypeOne = 0,
// /// 10
// QXSkyDrawBtnTypeTen ,
// /// 100
// QXSkyDrawBtnTypeHundred ,
_btnType = btnType;
switch (btnType) {
case QXSkyDrawBtnTypeOne:
{
self.titleLabel.text = @"抽一次";
[self.giftCoin setTitle:@"10币一次" forState:(UIControlStateNormal)];
}
break;
case QXSkyDrawBtnTypeTen:
{
self.titleLabel.text = @"抽十次";
[self.giftCoin setTitle:@"100币一次" forState:(UIControlStateNormal)];
}
break;
case QXSkyDrawBtnTypeHundred:
{
self.titleLabel.text = @"抽百次";
[self.giftCoin setTitle:@"1000币一次" forState:(UIControlStateNormal)];
}
break;
default:
break;
}
}
@end
//@implementation QXMeetGiftCell
//
//- (instancetype)initWithFrame:(CGRect)frame {
// if (self = [super initWithFrame:frame]) {
// [self initSubViews];
// }
// return self;
//}
//-(void)setModel:(QXDrawGiftModel *)model{
// _model = model;
// [self.giftImageView sd_setImageWithURL:[NSURL URLWithString:model.base_image]];
// self.giftNameLabel.text = model.gift_name;
// [self.giftCoinBtn setTitle:[NSString stringWithFormat:@" %@",model.gift_price] forState:(UIControlStateNormal)];
//}
//-(void)initSubViews{
// self.giftBgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"ac_cycle_gift_bg"]];
// [self addSubview:self.giftBgImageView];
// [self.giftBgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
// make.edges.equalTo(self);
// }];
//
// self.giftImageView = [[UIImageView alloc] init];
// self.giftImageView.contentMode = UIViewContentModeScaleAspectFit;
// [self addSubview:self.giftImageView];
// [self.giftImageView mas_makeConstraints:^(MASConstraintMaker *make) {
// make.top.mas_equalTo(35);
// make.width.mas_equalTo(ScaleWidth(80));
// make.height.mas_equalTo(ScaleWidth(80));
// make.centerX.equalTo(self);
// }];
//
//
// self.giftNameBgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"ac_meet_gift_name_bg"]];
// self.giftNameBgImageView.contentMode = UIViewContentModeScaleToFill;
// [self addSubview:self.giftNameBgImageView];
// [self.giftNameBgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
// make.left.right.equalTo(self);
// make.bottom.mas_equalTo(-32);
// make.height.mas_equalTo(30);
// }];
//
// self.giftNameLabel = [[UILabel alloc] init];
// self.giftNameLabel.textColor = RGB16(0xffffff);
// self.giftNameLabel.font = [UIFont systemFontOfSize:12];
// self.giftNameLabel.textAlignment = NSTextAlignmentCenter;
// [self addSubview:self.giftNameLabel];
// [self.giftNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
// make.top.left.right.equalTo(self.giftNameBgImageView);
// make.height.mas_equalTo(15);
// }];
//
// self.giftCoinBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.giftImageView.left, self.giftNameLabel.bottom, self.giftImageView.width, 15)];
// [self.giftCoinBtn setTitleColor:RGB16(0xC7BF62) forState:(UIControlStateNormal)];
// [self.giftCoinBtn setImage:[UIImage imageNamed:@"sky_item_coin"] forState:(UIControlStateNormal)];
// self.giftCoinBtn.titleLabel.font = [UIFont systemFontOfSize:10];
// [self addSubview:self.giftCoinBtn];
// [self.giftCoinBtn mas_makeConstraints:^(MASConstraintMaker *make) {
// make.bottom.left.right.equalTo(self.giftNameBgImageView);
// make.height.mas_equalTo(15);
// }];
//}
//
//@end

View File

@@ -0,0 +1,38 @@
//
// QXMeetLotteryView.h
// QXLive
//
// Created by 启星 on 2025/9/2.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@protocol QXMeetLotteryViewDelegate <NSObject>
- (void)lotteryWheelDidStopAtIndex:(NSInteger)index;
@end
@interface QXMeetLotteryView : UIView
@property (nonatomic, weak) id<QXMeetLotteryViewDelegate> delegate;
@property (nonatomic, strong) NSArray *prizes; // 奖品数据源
@property (nonatomic, assign) NSInteger finalPrizeIndex; // 最终奖品索引
- (void)startLotteryAnimation;
- (void)stopLotteryAnimation;
@end
@interface QXMeetLotterySubView : UIView
@property (nonatomic,strong)UIImageView *giftBgImageView;
@property (nonatomic,strong)UIImageView *giftImageView;
@property (nonatomic,strong)UIImageView *giftNameBgImageView;
@property (nonatomic,strong)UILabel *giftNameLabel;
@property (nonatomic,strong)UIButton *giftCoinBtn;
@property (nonatomic,strong)QXDrawGiftModel *model;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,171 @@
//
// QXMeetLotteryView.m
// QXLive
//
// Created by on 2025/9/2.
//
#import "QXMeetLotteryView.h"
#import <objc/runtime.h>
@interface QXMeetLotteryView ()<UIScrollViewDelegate>
@property (nonatomic, strong) UIScrollView *scrollView;
@property (nonatomic, assign) CGFloat itemWidth;
@property (nonatomic, assign) CGFloat itemSpace;
@property (nonatomic, assign) CGFloat targetOffset;
@property (nonatomic, assign) CGFloat maxWidth;
@end
@implementation QXMeetLotteryView
- (instancetype)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
[self setup];
}
return self;
}
- (void)setup {
// scrollView
self.scrollView = [[UIScrollView alloc] initWithFrame:self.bounds];
self.scrollView.delegate = self;
self.scrollView.showsHorizontalScrollIndicator = NO;
self.scrollView.showsVerticalScrollIndicator = NO;
self.scrollView.scrollEnabled = NO;
self.scrollView.decelerationRate = UIScrollViewDecelerationRateFast;
[self addSubview:self.scrollView];
_itemSpace = 25;
_itemWidth = (self.scrollView.bounds.size.width - _itemSpace*2)/3;
}
-(void)resetToFirstItem{
// [UIView animateWithDuration:6 animations:^{
[self.scrollView setContentOffset:CGPointZero animated:NO];
// }];
}
-(void)setPrizes:(NSArray *)prizes{
_prizes = prizes;
for (UIView *v in self.scrollView.subviews) {
[v removeFromSuperview];
}
NSInteger itemMultiple = 1;
if (_prizes.count == 0) {
return;
}
itemMultiple = 70/prizes.count;
CGFloat maxWidth = 0;
for (int i = 0; i < _prizes.count*itemMultiple+1; i++) {
QXMeetLotterySubView *giftView = [[QXMeetLotterySubView alloc] initWithFrame:CGRectMake((_itemWidth+_itemSpace)*i, 20, _itemWidth, self.scrollView.bounds.size.height-40)];
giftView.model = self.prizes[i%self.prizes.count];
[self.scrollView addSubview:giftView];
maxWidth = (_itemWidth+_itemSpace)*i+_itemWidth;
_maxWidth = maxWidth;
}
self.scrollView.contentSize = CGSizeMake(maxWidth, self.scrollView.bounds.size.height);
}
-(void)setFinalPrizeIndex:(NSInteger)finalPrizeIndex{
_finalPrizeIndex = finalPrizeIndex;
_targetOffset = [self getTargetIndexOffset];
}
-(void)startLotteryAnimation{
[self.scrollView setContentOffset:CGPointZero animated:NO];
MJWeakSelf
[UIView animateWithDuration:6 delay:0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
// [weakSelf.scrollView setContentOffset:CGPointMake(self.targetOffset-self.scrollView.bounds.size.width, 0) animated:NO];
[weakSelf.scrollView setContentOffset:CGPointMake(self.targetOffset, 0) animated:NO];
} completion:^(BOOL finished) {
// [UIView animateWithDuration:3 delay:0 options:UIViewAnimationOptionCurveLinear animations:^{
// [weakSelf.scrollView setContentOffset:CGPointMake(self.targetOffset, 0) animated:NO];
// } completion:^(BOOL finished) {
if (weakSelf.delegate && [weakSelf.delegate respondsToSelector:@selector(lotteryWheelDidStopAtIndex:)]) {
[weakSelf.delegate lotteryWheelDidStopAtIndex:weakSelf.finalPrizeIndex];
}
// }];
}];
}
-(void)scrollViewDidScroll:(UIScrollView *)scrollView{
}
-(CGFloat)getTargetIndexOffset{
CGFloat targetOffset = 0;
targetOffset = self.maxWidth-(self.itemSpace+self.itemWidth)*(3+(self.prizes.count-(self.finalPrizeIndex+1)))+self.itemSpace;
return targetOffset;
}
- (void)stopAnimation {
}
@end
@implementation QXMeetLotterySubView
- (instancetype)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
[self initSubViews];
}
return self;
}
-(void)setModel:(QXDrawGiftModel *)model{
_model = model;
[self.giftImageView sd_setImageWithURL:[NSURL URLWithString:model.base_image]];
self.giftNameLabel.text = model.gift_name;
[self.giftCoinBtn setTitle:[NSString stringWithFormat:@" %@",model.gift_price] forState:(UIControlStateNormal)];
}
-(void)initSubViews{
self.giftBgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"ac_cycle_gift_bg"]];
[self addSubview:self.giftBgImageView];
[self.giftBgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self);
}];
self.giftImageView = [[UIImageView alloc] init];
self.giftImageView.contentMode = UIViewContentModeScaleAspectFit;
[self addSubview:self.giftImageView];
[self.giftImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(25);
make.width.mas_equalTo(ScaleWidth(80));
make.height.mas_equalTo(ScaleWidth(80));
make.centerX.equalTo(self);
}];
self.giftNameBgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"ac_meet_gift_name_bg"]];
self.giftNameBgImageView.contentMode = UIViewContentModeScaleToFill;
[self addSubview:self.giftNameBgImageView];
[self.giftNameBgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(self);
make.bottom.mas_equalTo(-32);
make.height.mas_equalTo(30);
}];
self.giftNameLabel = [[UILabel alloc] init];
self.giftNameLabel.textColor = RGB16(0xffffff);
self.giftNameLabel.font = [UIFont systemFontOfSize:12];
self.giftNameLabel.textAlignment = NSTextAlignmentCenter;
[self addSubview:self.giftNameLabel];
[self.giftNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.left.right.equalTo(self.giftNameBgImageView);
make.height.mas_equalTo(15);
}];
self.giftCoinBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.giftImageView.left, self.giftNameLabel.bottom, self.giftImageView.width, 15)];
[self.giftCoinBtn setTitleColor:RGB16(0xC7BF62) forState:(UIControlStateNormal)];
[self.giftCoinBtn setImage:[UIImage imageNamed:@"sky_item_coin"] forState:(UIControlStateNormal)];
self.giftCoinBtn.titleLabel.font = [UIFont systemFontOfSize:10];
[self addSubview:self.giftCoinBtn];
[self.giftCoinBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.left.right.equalTo(self.giftNameBgImageView);
make.height.mas_equalTo(15);
}];
}
@end

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 243 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 184 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 340 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 663 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 550 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 162 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 345 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 210 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 219 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 448 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 436 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 174 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 194 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 758 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB