提交
This commit is contained in:
@@ -1,38 +0,0 @@
|
||||
//
|
||||
// QXDrifRoomHourRankView.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/9/29.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
typedef NS_ENUM(NSInteger) {
|
||||
/// 第一名
|
||||
QXDrifRoomHourRankTypeFirst = 1,
|
||||
/// 第二名
|
||||
QXDrifRoomHourRankTypeSecond = 2,
|
||||
/// 第三名
|
||||
QXDrifRoomHourRankTypeThird = 3,
|
||||
}QXDrifRoomHourRankType;
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
@class QXRoomHourDriftModel;
|
||||
@interface QXDrifRoomHourRankView : UIView
|
||||
@property (nonatomic,strong)UIImageView *bgImageView;
|
||||
@property (nonatomic,strong)UILabel *titleLabel;
|
||||
@property (nonatomic,strong)NSMutableArray *dataArray;
|
||||
@property (nonatomic,strong)QXRoomHourDriftModel *model;
|
||||
-(void)addActivityModel:(QXRoomHourDriftModel*)model;
|
||||
-(void)addActivityModelList:(NSArray<QXRoomHourDriftModel*>*)list;
|
||||
-(void)drifPopIsClose:(BOOL)isClose;
|
||||
+(instancetype)shareView;
|
||||
@end
|
||||
|
||||
|
||||
@interface QXRoomHourDriftModel : NSObject
|
||||
|
||||
@property (nonatomic,strong)NSString *room_id;
|
||||
@property (nonatomic,strong)NSString *room_name;
|
||||
@property (nonatomic,strong)NSString *text;
|
||||
@property (nonatomic,assign)NSInteger rank_number;
|
||||
@end
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -1,174 +0,0 @@
|
||||
//
|
||||
// QXDrifRoomHourRankView.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/8/29.
|
||||
//
|
||||
|
||||
#import "QXDrifRoomHourRankView.h"
|
||||
@interface QXDrifRoomHourRankView()
|
||||
@property (nonatomic,assign)BOOL isPlaying;
|
||||
@property (nonatomic,assign)BOOL isClose;
|
||||
@end
|
||||
|
||||
@implementation QXDrifRoomHourRankView
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
self.frame = CGRectMake(SCREEN_WIDTH, ScaleWidth(200), SCREEN_WIDTH, ScaleWidth(90));
|
||||
BOOL isClose = [[NSUserDefaults standardUserDefaults] boolForKey:kIsCloseDrifPop];
|
||||
self.isClose = isClose;
|
||||
[self initSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
+(instancetype)shareView{
|
||||
static QXDrifRoomHourRankView *manager = nil;
|
||||
static dispatch_once_t predicate;
|
||||
dispatch_once(&predicate, ^{
|
||||
manager = [[QXDrifRoomHourRankView alloc] init];
|
||||
});
|
||||
return manager;
|
||||
}
|
||||
|
||||
-(void)initSubviews{
|
||||
self.bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"ac_meet_start_pop_bg"]];
|
||||
self.bgImageView.contentMode = UIViewContentModeScaleToFill;
|
||||
[self addSubview:self.bgImageView];
|
||||
[self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(SCREEN_WIDTH);
|
||||
make.height.mas_equalTo(ScaleWidth(90));
|
||||
make.centerX.equalTo(self);
|
||||
make.top.equalTo(self);
|
||||
}];
|
||||
|
||||
self.titleLabel = [[UILabel alloc] init];
|
||||
self.titleLabel.font = [UIFont systemFontOfSize:12];
|
||||
self.titleLabel.textColor = RGB16(0xFFFFFF);
|
||||
[self addSubview:self.titleLabel];;
|
||||
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.bgImageView).offset(ScaleWidth(53));
|
||||
make.centerY.equalTo(self.bgImageView);
|
||||
}];
|
||||
self.userInteractionEnabled = YES;
|
||||
MJWeakSelf
|
||||
[self addTapBlock:^(id _Nonnull obj) {
|
||||
if ([weakSelf.model.room_id isExist]) {
|
||||
[[QXGlobal shareGlobal] joinRoomWithRoomId:weakSelf.model.room_id isRejoin:NO navagationController:weakSelf.viewController.navigationController];
|
||||
}
|
||||
}];
|
||||
}
|
||||
-(void)addActivityModel:(QXRoomHourDriftModel *)model{
|
||||
if (self.isClose) {
|
||||
return;
|
||||
}
|
||||
[self.dataArray addObject:model];
|
||||
[self giftAction];
|
||||
}
|
||||
-(void)addActivityModelList:(NSArray<QXRoomHourDriftModel *> *)list{
|
||||
if (self.isClose) {
|
||||
return;
|
||||
}
|
||||
[self.dataArray addObjectsFromArray:list];
|
||||
[self giftAction];
|
||||
}
|
||||
|
||||
-(void)giftAction{
|
||||
if (self.isPlaying) {
|
||||
return;
|
||||
}
|
||||
MJWeakSelf
|
||||
[QXDrifRoomHourRankView shareView].isPlaying = YES;
|
||||
[QXDrifRoomHourRankView shareView].model = [QXDrifRoomHourRankView shareView].dataArray.firstObject;
|
||||
[KEYWINDOW addSubview:[QXDrifRoomHourRankView shareView]];
|
||||
[UIView animateWithDuration:1.5 delay:0 options:UIViewAnimationOptionCurveEaseOut animations:^{
|
||||
[QXDrifRoomHourRankView shareView].x = 0;
|
||||
} completion:^(BOOL finished) {
|
||||
NSInteger dalayTime = 5;
|
||||
if (weakSelf.model.rank_number == 1) {
|
||||
dalayTime = 5;
|
||||
}else if (weakSelf.model.rank_number == 2){
|
||||
dalayTime = 4;
|
||||
}else if (weakSelf.model.rank_number == 2){
|
||||
dalayTime = 3;
|
||||
}
|
||||
[weakSelf performSelector:@selector(dissmissAnimate) afterDelay:dalayTime];
|
||||
}];
|
||||
}
|
||||
-(void)dissmissAnimate{
|
||||
[UIView animateWithDuration:2 delay:0 options:UIViewAnimationOptionCurveEaseIn animations:^{
|
||||
[QXDrifRoomHourRankView shareView].x = -SCREEN_WIDTH;
|
||||
} completion:^(BOOL finished) {
|
||||
[QXDrifRoomHourRankView shareView].x = SCREEN_WIDTH;
|
||||
[[QXDrifRoomHourRankView shareView] removeFromSuperview];
|
||||
[[QXDrifRoomHourRankView shareView].dataArray removeFirstObject];
|
||||
[QXDrifRoomHourRankView shareView].isPlaying = NO;
|
||||
if ([QXDrifRoomHourRankView shareView].dataArray.count>0) {
|
||||
[[QXDrifRoomHourRankView shareView] giftAction];
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
-(void)setModel:(QXRoomHourDriftModel *)model{
|
||||
_model = model;
|
||||
NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:model.text];
|
||||
switch (model.rank_number) {
|
||||
case QXDrifRoomHourRankTypeFirst:{
|
||||
self.bgImageView.image = [UIImage imageNamed:@"room_hour_rank_drif_first"];
|
||||
if ([model.room_name isExist]) {
|
||||
[attr yy_setColor:RGB16(0xFFFA63) range:[model.text rangeOfString:model.room_name]];
|
||||
}
|
||||
}
|
||||
break;
|
||||
case QXDrifRoomHourRankTypeSecond:{
|
||||
self.bgImageView.image = [UIImage imageNamed:@"room_hour_rank_drif_second"];
|
||||
if ([model.room_name isExist]) {
|
||||
[attr yy_setColor:RGB16(0xFEFE20) range:[model.text rangeOfString:model.room_name]];
|
||||
}
|
||||
}
|
||||
break;
|
||||
case QXDrifRoomHourRankTypeThird:{
|
||||
self.bgImageView.image = [UIImage imageNamed:@"room_hour_rank_drif_third"];
|
||||
if ([model.room_name isExist]) {
|
||||
[attr yy_setColor:RGB16(0x1FFFE5) range:[model.text rangeOfString:model.room_name]];
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
self.titleLabel.attributedText = attr;
|
||||
}
|
||||
-(void)drifPopIsClose:(BOOL)isClose{
|
||||
_isClose = isClose;
|
||||
self.hidden = self.isClose;
|
||||
[[NSUserDefaults standardUserDefaults] setBool:isClose forKey:kIsCloseDrifPop];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
if (isClose) {
|
||||
[QXDrifRoomHourRankView shareView].x = SCREEN_WIDTH;
|
||||
[[QXDrifRoomHourRankView shareView] removeFromSuperview];
|
||||
[[QXDrifRoomHourRankView shareView].dataArray removeAllObjects];
|
||||
[QXDrifRoomHourRankView shareView].isPlaying = NO;
|
||||
}
|
||||
}
|
||||
|
||||
-(NSMutableArray *)dataArray{
|
||||
if (!_dataArray) {
|
||||
_dataArray = [NSMutableArray array];
|
||||
}
|
||||
return _dataArray;
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
||||
|
||||
@implementation QXRoomHourDriftModel
|
||||
|
||||
|
||||
|
||||
@end
|
||||
18
QXLive/Tabbar/弹窗/QXFirstRechargeView.h
Normal file
18
QXLive/Tabbar/弹窗/QXFirstRechargeView.h
Normal file
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// QXFirstRechargeView.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/10/12.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXFirstRechargeView : UIView
|
||||
@property (nonatomic,copy)void(^closeActionBlock)(void);
|
||||
@property (nonatomic,copy)void(^getActionBlock)(void);
|
||||
@property (nonatomic,copy)void(^refreshBlcock)(void);
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
161
QXLive/Tabbar/弹窗/QXFirstRechargeView.m
Normal file
161
QXLive/Tabbar/弹窗/QXFirstRechargeView.m
Normal file
@@ -0,0 +1,161 @@
|
||||
//
|
||||
// QXFirstRechargeView.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/10/12.
|
||||
//
|
||||
|
||||
#import "QXFirstRechargeView.h"
|
||||
#import "QXHomePageNetwork.h"
|
||||
#import "QXGiftCell.h"
|
||||
|
||||
@interface QXFirstRechargeView()<UICollectionViewDelegate,UICollectionViewDataSource>
|
||||
@property (nonatomic,strong)UIImageView *lightBgImageView;
|
||||
@property (nonatomic,strong)UIImageView *bgImageView;
|
||||
@property (nonatomic,strong)UILabel *timeDownLabel;
|
||||
@property (nonatomic,strong)UIView *giftBgView;
|
||||
//@property (nonatomic,strong)UIButton *ruleBtn;
|
||||
@property (nonatomic,strong)UICollectionView *collectionView;
|
||||
@property (nonatomic,strong)UILabel *messageLabel;
|
||||
@property (nonatomic,strong)UIButton *getBtn;
|
||||
@property (nonatomic,strong)UIButton *closeBtn;
|
||||
@property (nonatomic,strong)QXFirstRechargeModel *model;
|
||||
@end
|
||||
@implementation QXFirstRechargeView
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
self.frame = CGRectMake(0, 0, SCREEN_WIDTH, ScaleWidth(582));
|
||||
[self initSubViews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
-(void)initSubViews{
|
||||
self.lightBgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"a_pop_bg"]];
|
||||
[self addSubview:self.lightBgImageView];
|
||||
[self.lightBgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.top.bottom.equalTo(self);
|
||||
}];
|
||||
|
||||
self.bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"a_first_recharge_bg"]];
|
||||
[self addSubview:self.bgImageView];
|
||||
[self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.centerY.equalTo(self);
|
||||
make.size.mas_equalTo(CGSizeMake(ScaleWidth(287), ScaleWidth(338)));
|
||||
}];
|
||||
|
||||
|
||||
self.giftBgView = [[UIView alloc] init];
|
||||
// self.giftBgView.backgroundColor = [UIColor whiteColor];
|
||||
[self.giftBgView addRoundedCornersWithRadius:13];
|
||||
[self addSubview:self.giftBgView];
|
||||
[self.giftBgView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.bgImageView).offset(ScaleWidth(135));
|
||||
make.left.equalTo(self.bgImageView).offset(ScaleWidth(18));
|
||||
make.right.equalTo(self.bgImageView).offset(-ScaleWidth(22));
|
||||
make.bottom.equalTo(self.bgImageView).offset(-ScaleWidth(51));
|
||||
}];
|
||||
|
||||
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
|
||||
layout.itemSize = CGSizeMake((ScaleWidth(287-18-22-12*2-3*8))/4, ScaleWidth(76));
|
||||
layout.minimumLineSpacing = 8;
|
||||
layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
|
||||
self.collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
|
||||
[self.collectionView registerNib:[UINib nibWithNibName:@"QXGiftCell" bundle:[NSBundle mainBundle]] forCellWithReuseIdentifier:@"QXGiftCell"];
|
||||
self.collectionView.delegate = self;
|
||||
self.collectionView.dataSource = self;
|
||||
self.collectionView.showsHorizontalScrollIndicator = NO;
|
||||
self.collectionView.bounces = NO;
|
||||
self.collectionView.pagingEnabled = YES;
|
||||
[self.giftBgView addSubview:self.collectionView];
|
||||
[self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(12);
|
||||
make.top.mas_equalTo(ScaleWidth(16));
|
||||
make.height.mas_equalTo(ScaleWidth(76));
|
||||
make.right.mas_equalTo(-12);
|
||||
}];
|
||||
|
||||
|
||||
|
||||
self.messageLabel = [[UILabel alloc] init];
|
||||
self.messageLabel.font = [UIFont systemFontOfSize:12];
|
||||
self.messageLabel.numberOfLines = 0;
|
||||
self.messageLabel.text = QXText(@"充值6元即可获得总价值888金币的道具或装扮");
|
||||
self.messageLabel.textColor = QXConfig.textColor;
|
||||
[self.giftBgView addSubview:self.messageLabel];
|
||||
[self.messageLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(12);
|
||||
make.right.mas_equalTo(-12);
|
||||
make.top.equalTo(self.collectionView.mas_bottom).offset(2);
|
||||
make.bottom.equalTo(self.giftBgView).offset(-5);
|
||||
}];
|
||||
|
||||
|
||||
self.getBtn = [[UIButton alloc] init];
|
||||
[self.getBtn addRoundedCornersWithRadius:21];
|
||||
self.getBtn.backgroundColor = QXConfig.themeColor;
|
||||
[self.getBtn setTitle:QXText(@"立即充值") forState:(UIControlStateNormal)];
|
||||
[self.getBtn setTitleColor:QXConfig.btnTextColor forState:(UIControlStateNormal)];
|
||||
self.getBtn.titleLabel.font = [UIFont systemFontOfSize:14];
|
||||
[self.getBtn addTarget:self action:@selector(getAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self addSubview:self.getBtn];
|
||||
[self.getBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.bottom.equalTo(self.bgImageView).offset(-ScaleWidth(16));
|
||||
make.height.mas_equalTo(42);
|
||||
make.right.equalTo(self.bgImageView).offset(-48);
|
||||
make.left.equalTo(self.bgImageView).offset(48);
|
||||
}];
|
||||
|
||||
self.closeBtn = [[UIButton alloc] init];
|
||||
[self.closeBtn setBackgroundImage:[UIImage imageNamed:@"home_white_close"] forState:(UIControlStateNormal)];
|
||||
[self.closeBtn addTarget:self action:@selector(closeAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self addSubview:self.closeBtn];
|
||||
[self.closeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.equalTo(self);
|
||||
make.top.equalTo(self.bgImageView.mas_bottom).offset(8);
|
||||
make.height.width.mas_equalTo(30);
|
||||
}];
|
||||
[self getFirstRechargeGiftList];
|
||||
}
|
||||
|
||||
-(void)getFirstRechargeGiftList{
|
||||
MJWeakSelf
|
||||
[QXHomePageNetwork getFirstRechargeGiftListSuccessBlock:^(NSArray<QXFirstRechargeModel *> * _Nonnull list) {
|
||||
QXFirstRechargeModel *md = list.firstObject;
|
||||
if (md) {
|
||||
weakSelf.model = md;
|
||||
[weakSelf.collectionView reloadData];
|
||||
}
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
showToast(msg);
|
||||
if (weakSelf.refreshBlcock) {
|
||||
weakSelf.refreshBlcock();
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
|
||||
return self.model.gift_list.count;
|
||||
}
|
||||
-(__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
|
||||
QXGiftCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"QXGiftCell" forIndexPath:indexPath];
|
||||
cell.cellType = QXGiftCellTypeNiceGift;
|
||||
cell.niceGiftModel = self.model.gift_list[indexPath.row];
|
||||
return cell;
|
||||
}
|
||||
|
||||
|
||||
// 立即领取
|
||||
-(void)getAction{
|
||||
if (self.getActionBlock) {
|
||||
self.getActionBlock();
|
||||
}
|
||||
}
|
||||
-(void)closeAction{
|
||||
if (self.closeActionBlock) {
|
||||
self.closeActionBlock();
|
||||
}
|
||||
}
|
||||
@end
|
||||
@@ -37,6 +37,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@property (weak, nonatomic) IBOutlet UIImageView *activityImageView;
|
||||
|
||||
@property (strong, nonatomic) QXGiftModel *roomGiftModel;
|
||||
|
||||
@property (strong, nonatomic) QXGiftModel *niceGiftModel;
|
||||
@property (strong, nonatomic) QXUserGiftWallModel *giftWall;
|
||||
@property (assign, nonatomic) QXGiftCellType cellType;
|
||||
@end
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
self.cornHeight.constant = 10;
|
||||
self.nameLabelHeight.constant = 10;
|
||||
self.giftNameLabel.font = [UIFont systemFontOfSize:8];
|
||||
self.giftNameLabel.textColor = RGB16(0xffffff);
|
||||
self.cornBtn.titleLabel.font = [UIFont systemFontOfSize:8];
|
||||
[self.cornBtn setTitleColor:RGB16(0x333333) forState:(UIControlStateNormal)];
|
||||
self.giftNameLabel.textColor = RGB16(0x333333);
|
||||
@@ -81,6 +80,20 @@
|
||||
break;
|
||||
}
|
||||
}
|
||||
-(void)setNiceGiftModel:(QXGiftModel *)niceGiftModel{
|
||||
_niceGiftModel = niceGiftModel;
|
||||
self.giftNameLabel.text = niceGiftModel.gift_name;
|
||||
NSString *encodedQuery = [niceGiftModel.base_image stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
|
||||
NSURL *imageUrl = [NSURL URLWithString:encodedQuery];
|
||||
[self.gitfImageView sd_setImageWithURL:imageUrl];
|
||||
[self.cornBtn setTitle:[NSString stringWithFormat:@" %@",niceGiftModel.gift_price] forState:(UIControlStateNormal)];
|
||||
if (niceGiftModel.num.intValue > 0) {
|
||||
self.numberBgView.hidden = NO;
|
||||
self.numberLabel.text = [NSString stringWithFormat:@"x%@",niceGiftModel.num];
|
||||
}else{
|
||||
self.numberBgView.hidden = YES;
|
||||
}
|
||||
}
|
||||
-(void)setRoomGiftModel:(QXGiftModel *)roomGiftModel{
|
||||
_roomGiftModel = roomGiftModel;
|
||||
self.giftNameLabel.text = roomGiftModel.gift_name;
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
//
|
||||
// QXGiftDriftView.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/5/21.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "QXGiftScrollView.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXGiftDriftView : UIView
|
||||
|
||||
@property (nonatomic,strong)NSMutableArray *dataArray;
|
||||
@property (nonatomic,strong)QXGiftScrollModel *model;
|
||||
-(void)addGiftModel:(QXGiftScrollModel*)model;
|
||||
-(void)addGiftModelList:(NSArray<QXGiftScrollModel*>*)list;
|
||||
-(void)drifPopIsClose:(BOOL)isClose;
|
||||
+(instancetype)shareView;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -1,136 +0,0 @@
|
||||
//
|
||||
// QXGiftDriftView.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/5/21.
|
||||
//
|
||||
|
||||
#import "QXGiftDriftView.h"
|
||||
@interface QXGiftDriftView()
|
||||
@property (nonatomic,strong)UIImageView *bgImageView;
|
||||
|
||||
@property (nonatomic,strong)UILabel *titleLabel;
|
||||
@property (nonatomic,strong)UIImageView *giftImageView;
|
||||
@property (nonatomic,strong)UILabel *countLabel;
|
||||
@property (nonatomic,assign)BOOL isPlaying;
|
||||
@property (nonatomic,assign)BOOL isClose;
|
||||
@end
|
||||
@implementation QXGiftDriftView
|
||||
+(instancetype)shareView{
|
||||
static QXGiftDriftView *manager = nil;
|
||||
static dispatch_once_t predicate;
|
||||
dispatch_once(&predicate, ^{
|
||||
manager = [[QXGiftDriftView alloc] init];
|
||||
});
|
||||
return manager;
|
||||
}
|
||||
- (instancetype)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
self.frame = CGRectMake(SCREEN_WIDTH, 150, ScaleWidth(316), ScaleWidth(50));
|
||||
[self initSubviews];
|
||||
BOOL isClose = [[NSUserDefaults standardUserDefaults] boolForKey:kIsCloseDrifPop];
|
||||
self.isClose = isClose;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
-(void)initSubviews{
|
||||
self.bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"pop_gift_bg"]];
|
||||
self.bgImageView.frame = self.bounds;
|
||||
[self addSubview:self.bgImageView];
|
||||
|
||||
self.titleLabel = [[UILabel alloc] init];
|
||||
self.titleLabel.font = [UIFont systemFontOfSize:14];
|
||||
self.titleLabel.textColor = UIColor.whiteColor;
|
||||
[self addSubview:self.titleLabel];
|
||||
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.equalTo(self).offset(-ScaleWidth(30));
|
||||
make.height.mas_equalTo(30);
|
||||
make.centerY.equalTo(self).offset(2);
|
||||
}];
|
||||
|
||||
self.giftImageView = [[UIImageView alloc] init];
|
||||
self.giftImageView.contentMode = UIViewContentModeScaleAspectFit;
|
||||
[self addSubview:self.giftImageView];
|
||||
[self.giftImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.titleLabel.mas_right).offset(5);
|
||||
make.height.width.mas_equalTo(20);
|
||||
make.centerY.equalTo(self).offset(2);
|
||||
}];
|
||||
|
||||
self.countLabel = [[UILabel alloc] init];
|
||||
self.countLabel.font = [UIFont systemFontOfSize:14];
|
||||
self.countLabel.textColor = UIColor.whiteColor;
|
||||
[self addSubview:self.countLabel];
|
||||
[self.countLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.giftImageView.mas_right);
|
||||
make.height.mas_equalTo(30);
|
||||
make.centerY.equalTo(self).offset(2);
|
||||
}];
|
||||
}
|
||||
-(void)addGiftModel:(QXGiftScrollModel *)model{
|
||||
if (self.isClose) {
|
||||
return;
|
||||
}
|
||||
[self.dataArray addObject:model];
|
||||
[self giftAction];
|
||||
}
|
||||
-(void)addGiftModelList:(NSArray<QXGiftScrollModel *> *)list{
|
||||
[self.dataArray addObjectsFromArray:list];
|
||||
[self giftAction];
|
||||
}
|
||||
|
||||
-(void)giftAction{
|
||||
if (self.isPlaying) {
|
||||
return;
|
||||
}
|
||||
[QXGiftDriftView shareView].isPlaying = YES;
|
||||
[QXGiftDriftView shareView].model = [QXGiftDriftView shareView].dataArray.firstObject;
|
||||
[KEYWINDOW addSubview:[QXGiftDriftView shareView]];
|
||||
[UIView animateWithDuration:1.5 delay:0 options:UIViewAnimationOptionCurveEaseOut animations:^{
|
||||
[QXGiftDriftView shareView].x = (SCREEN_WIDTH-ScaleWidth(316))/2;
|
||||
} completion:^(BOOL finished) {
|
||||
[UIView animateWithDuration:2 delay:1 options:UIViewAnimationOptionCurveEaseIn animations:^{
|
||||
[QXGiftDriftView shareView].x = -SCREEN_WIDTH;
|
||||
} completion:^(BOOL finished) {
|
||||
[QXGiftDriftView shareView].x = SCREEN_WIDTH;
|
||||
[[QXGiftDriftView shareView] removeFromSuperview];
|
||||
[[QXGiftDriftView shareView].dataArray removeFirstObject];
|
||||
[QXGiftDriftView shareView].isPlaying = NO;
|
||||
if ([QXGiftDriftView shareView].dataArray.count>0) {
|
||||
[[QXGiftDriftView shareView] giftAction];
|
||||
}
|
||||
}];
|
||||
}];
|
||||
}
|
||||
-(void)setModel:(QXGiftScrollModel *)model{
|
||||
_model = model;
|
||||
NSString *str = [NSString stringWithFormat:@"%@送给%@",model.fromUserName,model.toUserName];
|
||||
NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:str];
|
||||
[attr yy_setColor:RGB16(0xFFDE77) range:[str rangeOfString:model.fromUserName]];
|
||||
[attr yy_setColor:RGB16(0xFFDE77) range:[str rangeOfString:model.toUserName]];
|
||||
self.titleLabel.attributedText = attr;
|
||||
|
||||
[self.giftImageView sd_setImageWithURL:[NSURL URLWithString:model.gift_picture]];
|
||||
self.countLabel.text = [NSString stringWithFormat:@"X%@",model.number];
|
||||
}
|
||||
-(void)drifPopIsClose:(BOOL)isClose{
|
||||
_isClose = isClose;
|
||||
self.hidden = self.isClose;
|
||||
[[NSUserDefaults standardUserDefaults] setBool:isClose forKey:kIsCloseDrifPop];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
if (isClose) {
|
||||
[QXGiftDriftView shareView].x = SCREEN_WIDTH;
|
||||
[[QXGiftDriftView shareView] removeFromSuperview];
|
||||
[[QXGiftDriftView shareView].dataArray removeAllObjects];
|
||||
[QXGiftDriftView shareView].isPlaying = NO;
|
||||
}
|
||||
}
|
||||
-(NSMutableArray *)dataArray{
|
||||
if (!_dataArray) {
|
||||
_dataArray = [NSMutableArray array];
|
||||
}
|
||||
return _dataArray;
|
||||
}
|
||||
@end
|
||||
@@ -1,34 +0,0 @@
|
||||
//
|
||||
// QXMeetActivityDriftView.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/8/29.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
typedef NS_ENUM(NSInteger) {
|
||||
/// 即将开始
|
||||
QXMeetActivityDriftTypeWillStart = 1,
|
||||
/// 已经开始
|
||||
QXMeetActivityDriftTypeStart = 2,
|
||||
/// 落入背包
|
||||
QXMeetActivityDriftTypeFinished = 3,
|
||||
}QXMeetActivityDriftType;
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
@class QXMeetActivityDriftModel;
|
||||
@interface QXMeetActivityDriftView : UIView
|
||||
@property (nonatomic,strong)UIImageView *bgImageView;
|
||||
@property (nonatomic,strong)UILabel *titleLabel;
|
||||
@property (nonatomic,strong)NSMutableArray *dataArray;
|
||||
@property (nonatomic,strong)QXMeetActivityDriftModel *model;
|
||||
-(void)addActivityModel:(QXMeetActivityDriftModel*)model;
|
||||
-(void)drifPopIsClose:(BOOL)isClose;
|
||||
+(instancetype)shareView;
|
||||
@end
|
||||
|
||||
@interface QXMeetActivityDriftModel : NSObject
|
||||
@property (nonatomic,strong)NSString *room_id;
|
||||
@property (nonatomic,strong)NSString *text;
|
||||
@property (nonatomic,assign)NSInteger from_type;
|
||||
@end
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -1,150 +0,0 @@
|
||||
//
|
||||
// QXMeetActivityDriftView.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/8/29.
|
||||
//
|
||||
|
||||
#import "QXMeetActivityDriftView.h"
|
||||
@interface QXMeetActivityDriftView()
|
||||
@property (nonatomic,assign)BOOL isPlaying;
|
||||
@property (nonatomic,assign)BOOL isClose;
|
||||
@end
|
||||
|
||||
@implementation QXMeetActivityDriftView
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
self.frame = CGRectMake(SCREEN_WIDTH, 0, ScaleWidth(358), ScaleWidth(136));
|
||||
BOOL isClose = [[NSUserDefaults standardUserDefaults] boolForKey:kIsCloseDrifPop];
|
||||
self.isClose = isClose;
|
||||
[self initSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
+(instancetype)shareView{
|
||||
static QXMeetActivityDriftView *manager = nil;
|
||||
static dispatch_once_t predicate;
|
||||
dispatch_once(&predicate, ^{
|
||||
manager = [[QXMeetActivityDriftView alloc] init];
|
||||
});
|
||||
return manager;
|
||||
}
|
||||
|
||||
-(void)initSubviews{
|
||||
self.bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"ac_meet_start_pop_bg"]];
|
||||
self.bgImageView.contentMode = UIViewContentModeScaleToFill;
|
||||
[self addSubview:self.bgImageView];
|
||||
[self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(ScaleWidth(358));
|
||||
make.height.mas_equalTo(ScaleWidth(136));
|
||||
make.centerX.equalTo(self);
|
||||
make.top.equalTo(self);
|
||||
}];
|
||||
|
||||
self.titleLabel = [[UILabel alloc] init];
|
||||
self.titleLabel.font = [UIFont systemFontOfSize:12];
|
||||
self.titleLabel.textColor = RGB16(0xFFFFFF);
|
||||
[self addSubview:self.titleLabel];;
|
||||
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.bgImageView).offset(15);
|
||||
make.centerY.equalTo(self.bgImageView);
|
||||
}];
|
||||
self.userInteractionEnabled = YES;
|
||||
MJWeakSelf
|
||||
[self addTapBlock:^(id _Nonnull obj) {
|
||||
if ([weakSelf.model.room_id isExist]) {
|
||||
[[QXGlobal shareGlobal] joinRoomWithRoomId:weakSelf.model.room_id isRejoin:NO navagationController:weakSelf.viewController.navigationController];
|
||||
}
|
||||
}];
|
||||
}
|
||||
-(void)addActivityModel:(QXMeetActivityDriftModel *)model{
|
||||
if (self.isClose) {
|
||||
return;
|
||||
}
|
||||
[self.dataArray addObject:model];
|
||||
[self giftAction];
|
||||
}
|
||||
|
||||
|
||||
-(void)giftAction{
|
||||
if (self.isPlaying) {
|
||||
return;
|
||||
}
|
||||
MJWeakSelf
|
||||
[QXMeetActivityDriftView shareView].isPlaying = YES;
|
||||
[QXMeetActivityDriftView shareView].model = [QXMeetActivityDriftView shareView].dataArray.firstObject;
|
||||
[KEYWINDOW addSubview:[QXMeetActivityDriftView shareView]];
|
||||
[UIView animateWithDuration:1.5 delay:0 options:UIViewAnimationOptionCurveEaseOut animations:^{
|
||||
[QXMeetActivityDriftView shareView].x = (SCREEN_WIDTH-ScaleWidth(358))/2;
|
||||
} completion:^(BOOL finished) {
|
||||
[weakSelf performSelector:@selector(dissmissAnimate) afterDelay:5];
|
||||
}];
|
||||
}
|
||||
-(void)dissmissAnimate{
|
||||
[UIView animateWithDuration:2 delay:0 options:UIViewAnimationOptionCurveEaseIn animations:^{
|
||||
[QXMeetActivityDriftView shareView].x = -SCREEN_WIDTH;
|
||||
} completion:^(BOOL finished) {
|
||||
[QXMeetActivityDriftView shareView].x = SCREEN_WIDTH;
|
||||
[[QXMeetActivityDriftView shareView] removeFromSuperview];
|
||||
[[QXMeetActivityDriftView shareView].dataArray removeFirstObject];
|
||||
[QXMeetActivityDriftView shareView].isPlaying = NO;
|
||||
if ([QXMeetActivityDriftView shareView].dataArray.count>0) {
|
||||
[[QXMeetActivityDriftView shareView] giftAction];
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
-(void)setModel:(QXMeetActivityDriftModel *)model{
|
||||
_model = model;
|
||||
self.titleLabel.text = model.text;
|
||||
switch (model.from_type) {
|
||||
case QXMeetActivityDriftTypeWillStart:{
|
||||
self.bgImageView.image = [UIImage imageNamed:@"ac_meet_will_pop_bg"];
|
||||
}
|
||||
break;
|
||||
case QXMeetActivityDriftTypeStart:{
|
||||
self.bgImageView.image = [UIImage imageNamed:@"ac_meet_start_pop_bg"];
|
||||
}
|
||||
break;
|
||||
case QXMeetActivityDriftTypeFinished:{
|
||||
self.bgImageView.image = [UIImage imageNamed:@"ac_meet_finished_pop_bg"];
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
-(void)drifPopIsClose:(BOOL)isClose{
|
||||
_isClose = isClose;
|
||||
self.hidden = self.isClose;
|
||||
[[NSUserDefaults standardUserDefaults] setBool:isClose forKey:kIsCloseDrifPop];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
if (isClose) {
|
||||
[QXMeetActivityDriftView shareView].x = SCREEN_WIDTH;
|
||||
[[QXMeetActivityDriftView shareView] removeFromSuperview];
|
||||
[[QXMeetActivityDriftView shareView].dataArray removeAllObjects];
|
||||
[QXMeetActivityDriftView shareView].isPlaying = NO;
|
||||
}
|
||||
}
|
||||
|
||||
-(NSMutableArray *)dataArray{
|
||||
if (!_dataArray) {
|
||||
_dataArray = [NSMutableArray array];
|
||||
}
|
||||
return _dataArray;
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
||||
|
||||
@implementation QXMeetActivityDriftModel
|
||||
|
||||
|
||||
|
||||
@end
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// QXFirstRechargePopView.h
|
||||
// QXNewPeoplePopView.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/5/13.
|
||||
@@ -9,9 +9,10 @@
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXFirstRechargePopView : UIView
|
||||
@interface QXNewPeoplePopView : UIView
|
||||
@property (nonatomic,copy)void(^closeActionBlock)(void);
|
||||
@property (nonatomic,copy)void(^rechargeActionBlock)(NSString*money);
|
||||
@property (nonatomic,copy)void(^refreshBlcock)(void);
|
||||
@property (nonatomic,strong)NSArray *giftArray;
|
||||
-(void)reloadData;
|
||||
@end
|
||||
@@ -1,17 +1,17 @@
|
||||
//
|
||||
// QXFirstRechargePopView.m
|
||||
// QXNewPeoplePopView.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/5/13.
|
||||
//
|
||||
|
||||
#import "QXFirstRechargePopView.h"
|
||||
#import "QXNewPeoplePopView.h"
|
||||
#import "GKPageControl.h"
|
||||
#import <NSAttributedString+YYText.h>
|
||||
#import "QXGiftCell.h"
|
||||
#import "QXHomePageNetwork.h"
|
||||
|
||||
@interface QXFirstRechargePopView()<UICollectionViewDelegate,UICollectionViewDataSource>
|
||||
@interface QXNewPeoplePopView()<UICollectionViewDelegate,UICollectionViewDataSource>
|
||||
@property (nonatomic,strong)UIImageView *lightBgImageView;
|
||||
@property (nonatomic,strong)UIImageView *bgImageView;
|
||||
@property (nonatomic,strong)UILabel *priceLabel;
|
||||
@@ -26,13 +26,13 @@
|
||||
@property (nonatomic,strong)GKPageControl *pageControl;
|
||||
@property (nonatomic,strong)UIButton *getBtn;
|
||||
@property (nonatomic,strong)UIButton *closeBtn;
|
||||
@property (nonatomic,strong)QXFirstRechargeModel *md1;
|
||||
@property (nonatomic,strong)QXFirstRechargeModel *md2;
|
||||
@property (nonatomic,strong)QXFirstRechargeModel *md3;
|
||||
@property (nonatomic,strong)QXFirstRechargeModel *smd;
|
||||
@property (nonatomic,strong)QXNiceGiftRechargeModel *md1;
|
||||
@property (nonatomic,strong)QXNiceGiftRechargeModel *md2;
|
||||
@property (nonatomic,strong)QXNiceGiftRechargeModel *md3;
|
||||
@property (nonatomic,strong)QXNiceGiftRechargeModel *smd;
|
||||
@end
|
||||
|
||||
@implementation QXFirstRechargePopView
|
||||
@implementation QXNewPeoplePopView
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
@@ -50,11 +50,11 @@
|
||||
make.left.right.top.bottom.equalTo(self);
|
||||
}];
|
||||
|
||||
self.bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"a_pop_first_recharge"]];
|
||||
self.bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"a_pop_new_user_recharge"]];
|
||||
[self addSubview:self.bgImageView];
|
||||
[self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.centerY.equalTo(self);
|
||||
make.size.mas_equalTo(CGSizeMake(ScaleWidth(275), ScaleWidth(338)));
|
||||
make.size.mas_equalTo(CGSizeMake(ScaleWidth(287), ScaleWidth(338)));
|
||||
}];
|
||||
|
||||
self.priceLabel = [[UILabel alloc] init];
|
||||
@@ -139,7 +139,7 @@
|
||||
}];
|
||||
|
||||
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
|
||||
layout.itemSize = CGSizeMake((ScaleWidth(275)-24*2-3*8-12*2)/4, ScaleWidth(76));
|
||||
layout.itemSize = CGSizeMake((ScaleWidth(287)-24*2-3*8-12*2)/4, ScaleWidth(76));
|
||||
layout.minimumLineSpacing = 8;
|
||||
layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
|
||||
self.collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
|
||||
@@ -204,7 +204,13 @@
|
||||
}
|
||||
-(void)getFirstRechargeGiftList{
|
||||
MJWeakSelf
|
||||
[QXHomePageNetwork getFirstRechargeGiftListSuccessBlock:^(NSArray<QXFirstRechargeModel *> * _Nonnull list) {
|
||||
[QXHomePageNetwork getNewUserGiftListSuccessBlock:^(NSArray<QXFirstRechargeModel *> * _Nonnull list) {
|
||||
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
|
||||
}];
|
||||
|
||||
[QXHomePageNetwork getNewUserGiftListSuccessBlock:^(NSArray<QXNiceGiftRechargeModel *> * _Nonnull list) {
|
||||
for (int i = 0; i<list.count; i++) {
|
||||
if (i == 0) {
|
||||
weakSelf.md1 = list[i];
|
||||
@@ -228,6 +234,9 @@
|
||||
[weakSelf rechargeSelectedAction:weakSelf.firstBtn];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
showToast(msg);
|
||||
if (weakSelf.refreshBlcock) {
|
||||
weakSelf.refreshBlcock();
|
||||
}
|
||||
}];
|
||||
}
|
||||
-(void)scrollViewDidScroll:(UIScrollView *)scrollView{
|
||||
@@ -266,7 +275,7 @@
|
||||
self.selectedBtn.selected = !self.selectedBtn.selected;
|
||||
sender.selected = !sender.selected;
|
||||
self.selectedBtn = sender;
|
||||
QXFirstRechargeModel *md = nil;
|
||||
QXNiceGiftRechargeModel *md = nil;
|
||||
if (sender == self.firstBtn) {
|
||||
md = self.md1;
|
||||
self.giftArray = self.md1.gift_list;
|
||||
@@ -12,8 +12,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@interface QXNiceGiftPopView : UIView
|
||||
@property (nonatomic,copy)void(^closeActionBlock)(void);
|
||||
@property (nonatomic,copy)void(^getActionBlock)(void);
|
||||
@property (nonatomic,copy)void(^ruleActionBlock)(void);
|
||||
@property (nonatomic,strong)NSArray *giftArray;
|
||||
@property (nonatomic,copy)void(^refreshBlcock)(void);
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#import "QXNiceGiftPopView.h"
|
||||
#import "GKPageControl.h"
|
||||
#import "QXGiftCell.h"
|
||||
#import "QXHomePageNetwork.h"
|
||||
|
||||
@interface QXNiceGiftPopView()<UICollectionViewDelegate,UICollectionViewDataSource>
|
||||
@property (nonatomic,strong)UIImageView *lightBgImageView;
|
||||
@@ -15,12 +16,13 @@
|
||||
@property (nonatomic,strong)UIImageView *timeDownbgView;
|
||||
@property (nonatomic,strong)UILabel *timeDownLabel;
|
||||
@property (nonatomic,strong)UIView *giftBgView;
|
||||
@property (nonatomic,strong)UIButton *ruleBtn;
|
||||
//@property (nonatomic,strong)UIButton *ruleBtn;
|
||||
@property (nonatomic,strong)UICollectionView *collectionView;
|
||||
@property (nonatomic,strong)GKPageControl *pageControl;
|
||||
@property (nonatomic,strong)UILabel *messageLabel;
|
||||
@property (nonatomic,strong)UIButton *getBtn;
|
||||
@property (nonatomic,strong)UIButton *closeBtn;
|
||||
@property (nonatomic,strong)QXNiceGiftRechargeModel *model;
|
||||
@end
|
||||
@implementation QXNiceGiftPopView
|
||||
|
||||
@@ -57,7 +59,7 @@
|
||||
|
||||
self.timeDownLabel = [[UILabel alloc] init];
|
||||
self.timeDownLabel.textColor = RGB16(0x666666);
|
||||
self.timeDownLabel.text = QXText(@"剩余时间");
|
||||
self.timeDownLabel.text = QXText(@"截止时间");
|
||||
self.timeDownLabel.font = [UIFont systemFontOfSize:12];
|
||||
[self addSubview:self.timeDownLabel];
|
||||
[self.timeDownLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
@@ -66,19 +68,19 @@
|
||||
make.right.equalTo(self.timeDownbgView).offset(-19);
|
||||
}];
|
||||
|
||||
self.ruleBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 54, 20)];
|
||||
self.ruleBtn.backgroundColor = QXConfig.themeColor;
|
||||
[self.ruleBtn addTarget:self action:@selector(ruleAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self.ruleBtn setTitle:QXText(@"规则") forState:(UIControlStateNormal)];
|
||||
self.ruleBtn.titleLabel.font = [UIFont systemFontOfSize:12];
|
||||
[self.ruleBtn setTitleColor:QXConfig.btnTextColor forState:(UIControlStateNormal)];
|
||||
[self.ruleBtn addRoundedCornersWithRadius:10 byRoundingCorners:(UIRectCornerTopLeft|UIRectCornerBottomLeft)];
|
||||
[self addSubview:self.ruleBtn];
|
||||
[self.ruleBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.equalTo(self.bgImageView);
|
||||
make.centerY.equalTo(self.timeDownbgView);
|
||||
make.size.mas_equalTo(CGSizeMake(ScaleWidth(54), ScaleWidth(20)));
|
||||
}];
|
||||
// self.ruleBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 54, 20)];
|
||||
// self.ruleBtn.backgroundColor = QXConfig.themeColor;
|
||||
// [self.ruleBtn addTarget:self action:@selector(ruleAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
// [self.ruleBtn setTitle:QXText(@"规则") forState:(UIControlStateNormal)];
|
||||
// self.ruleBtn.titleLabel.font = [UIFont systemFontOfSize:12];
|
||||
// [self.ruleBtn setTitleColor:QXConfig.btnTextColor forState:(UIControlStateNormal)];
|
||||
// [self.ruleBtn addRoundedCornersWithRadius:10 byRoundingCorners:(UIRectCornerTopLeft|UIRectCornerBottomLeft)];
|
||||
// [self addSubview:self.ruleBtn];
|
||||
// [self.ruleBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
// make.right.equalTo(self.bgImageView);
|
||||
// make.centerY.equalTo(self.timeDownbgView);
|
||||
// make.size.mas_equalTo(CGSizeMake(ScaleWidth(54), ScaleWidth(20)));
|
||||
// }];
|
||||
|
||||
self.giftBgView = [[UIView alloc] init];
|
||||
// self.giftBgView.backgroundColor = [UIColor whiteColor];
|
||||
@@ -142,7 +144,7 @@
|
||||
self.getBtn = [[UIButton alloc] init];
|
||||
[self.getBtn addRoundedCornersWithRadius:21];
|
||||
self.getBtn.backgroundColor = QXConfig.themeColor;
|
||||
[self.getBtn setTitle:QXText(@"立即领取") forState:(UIControlStateNormal)];
|
||||
[self.getBtn setTitle:QXText(@"立即充值") forState:(UIControlStateNormal)];
|
||||
[self.getBtn setTitleColor:QXConfig.btnTextColor forState:(UIControlStateNormal)];
|
||||
self.getBtn.titleLabel.font = [UIFont systemFontOfSize:14];
|
||||
[self.getBtn addTarget:self action:@selector(getAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
@@ -163,46 +165,37 @@
|
||||
make.top.equalTo(self.bgImageView.mas_bottom).offset(8);
|
||||
make.height.width.mas_equalTo(30);
|
||||
}];
|
||||
[self getGiftList];
|
||||
}
|
||||
|
||||
-(void)scrollViewDidScroll:(UIScrollView *)scrollView{
|
||||
if ([scrollView isKindOfClass:[UICollectionView class]]) {
|
||||
long offsetX = (long)scrollView.contentOffset.x;
|
||||
int width = ScaleWidth(275-15*2-12*2-3*8);
|
||||
int remainder = offsetX % width;
|
||||
NSInteger index;
|
||||
if (remainder>(width)/2) {
|
||||
index = offsetX/width+1;
|
||||
}else{
|
||||
index = offsetX/width;
|
||||
-(void)getGiftList{
|
||||
MJWeakSelf
|
||||
[QXHomePageNetwork getSkyDropGiftListSuccessBlock:^(QXNiceGiftRechargeModel * _Nonnull model) {
|
||||
weakSelf.model = model;
|
||||
weakSelf.timeDownLabel.text = model.effective_time;
|
||||
NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:model.counter];
|
||||
[attr yy_setColor:QXConfig.themeColor range:[model.counter rangeOfString:model.money]];
|
||||
[attr yy_setColor:QXConfig.themeColor range:[model.counter rangeOfString:model.diamond]];
|
||||
weakSelf.messageLabel.attributedText = attr;
|
||||
[weakSelf.collectionView reloadData];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
if (weakSelf.refreshBlcock) {
|
||||
weakSelf.refreshBlcock();
|
||||
}
|
||||
self.pageControl.currentPage = index;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
-(void)setGiftArray:(NSArray *)giftArray{
|
||||
_giftArray = giftArray;
|
||||
self.pageControl.numberOfPages = giftArray.count/4+1;
|
||||
self.pageControl.currentPage = 0;
|
||||
[self.collectionView reloadData];
|
||||
}];
|
||||
}
|
||||
|
||||
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
|
||||
return self.giftArray.count;
|
||||
return self.model.gift_list.count;
|
||||
}
|
||||
-(__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
|
||||
QXGiftCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"QXGiftCell" forIndexPath:indexPath];
|
||||
cell.cellType = QXGiftCellTypeNiceGift;
|
||||
cell.roomGiftModel = self.model.gift_list[indexPath.row];
|
||||
return cell;
|
||||
}
|
||||
|
||||
// 规则
|
||||
-(void)ruleAction{
|
||||
if (self.ruleActionBlock) {
|
||||
self.ruleActionBlock();
|
||||
}
|
||||
}
|
||||
|
||||
// 立即领取
|
||||
-(void)getAction{
|
||||
if (self.getActionBlock) {
|
||||
|
||||
Reference in New Issue
Block a user