覆盖羽声
This commit is contained in:
@@ -17,6 +17,8 @@ typedef NS_ENUM(NSInteger) {
|
||||
QXAlertViewTypeAgreeSong,
|
||||
/// pk弹窗
|
||||
QXAlertViewTypeAgreePK,
|
||||
/// 没有取消
|
||||
QXAlertViewTypeNoCancel
|
||||
}QXAlertViewType;
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
|
||||
@@ -114,6 +114,17 @@
|
||||
}];
|
||||
}
|
||||
break;
|
||||
case QXAlertViewTypeNoCancel:{
|
||||
self.cancelBtn.hidden = YES;
|
||||
self.commitBtn.hidden = NO;
|
||||
[self.commitBtn mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.bottom.equalTo(self).offset(-12);
|
||||
make.height.mas_equalTo(42);
|
||||
make.width.mas_equalTo(ScaleWidth(220));
|
||||
make.centerX.equalTo(self);
|
||||
}];
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
40
QXLive/Tabbar/弹窗/QXAppVersionView.h
Normal file
40
QXLive/Tabbar/弹窗/QXAppVersionView.h
Normal file
@@ -0,0 +1,40 @@
|
||||
//
|
||||
// QXAppVersionView.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/9/27.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "QXAppVersionModel.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXAppVersionView : UIView
|
||||
@property (nonatomic,strong)QXAppVersionModel *model;
|
||||
-(void)showInView:(UIView *)view;
|
||||
|
||||
-(void)hide;
|
||||
@end
|
||||
|
||||
|
||||
@interface QXVersionComparator : NSObject
|
||||
/**
|
||||
比较两个版本号是否需要更新
|
||||
|
||||
@param newVersion 新版本号(服务器返回的版本)
|
||||
@param oldVersion 旧版本号(当前应用版本)
|
||||
@return 比较结果:-1=旧版本更大,0=版本相同,1=新版本更大(需要更新)
|
||||
*/
|
||||
+ (NSInteger)compareVersion:(NSString *)newVersion withOldVersion:(NSString *)oldVersion;
|
||||
|
||||
/**
|
||||
检查是否需要更新
|
||||
|
||||
@param newVersion 新版本号
|
||||
@param oldVersion 旧版本号
|
||||
@return YES=需要更新,NO=不需要更新
|
||||
*/
|
||||
+ (BOOL)shouldUpdateFromVersion:(NSString *)oldVersion toVersion:(NSString *)newVersion;
|
||||
@end
|
||||
NS_ASSUME_NONNULL_END
|
||||
178
QXLive/Tabbar/弹窗/QXAppVersionView.m
Normal file
178
QXLive/Tabbar/弹窗/QXAppVersionView.m
Normal file
@@ -0,0 +1,178 @@
|
||||
//
|
||||
// QXAppVersionView.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/9/27.
|
||||
//
|
||||
|
||||
#import "QXAppVersionView.h"
|
||||
#import "QXMineNetwork.h"
|
||||
|
||||
@interface QXAppVersionView()<UITextFieldDelegate>
|
||||
@property (nonatomic,strong)UIView *bgView;
|
||||
@property (nonatomic,strong)UIImageView *topImageView;
|
||||
@property (nonatomic,strong)UIView *bottomView;
|
||||
@property (nonatomic,strong)UIScrollView *scrollView;
|
||||
@property (nonatomic,strong)UILabel *messageLabel;
|
||||
@property (nonatomic,strong)UIButton *cancelBtn;
|
||||
@property (nonatomic,strong)UIButton *commitBtn;
|
||||
@end
|
||||
|
||||
@implementation QXAppVersionView
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
self.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||
[self createViews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
-(void)createViews{
|
||||
self.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.5];
|
||||
self.bgView = [[UIView alloc] initWithFrame:CGRectMake((SCREEN_WIDTH-ScaleWidth(275))/2.0, -self.height, ScaleWidth(275), ScaleWidth(362))];
|
||||
// self.bgView.backgroundColor = [UIColor whiteColor];
|
||||
[self.bgView addRoundedCornersWithRadius:16];
|
||||
[self addSubview:self.bgView];
|
||||
|
||||
self.topImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"app_update_top_bg"]];
|
||||
self.topImageView.frame = CGRectMake(0, 0, self.bgView.width, ScaleWidth(170));
|
||||
[self.bgView addSubview:self.topImageView];
|
||||
|
||||
self.bottomView = [[UIView alloc] initWithFrame:CGRectMake(0, self.topImageView.bottom-ScaleWidth(12), self.bgView.width, self.bgView.height-self.topImageView.height+ScaleWidth(12))];
|
||||
self.bottomView.backgroundColor = RGB16(0xffffff);
|
||||
[self.bottomView addRoundedCornersWithRadius:16 byRoundingCorners:(UIRectCornerBottomLeft|UIRectCornerBottomRight)];
|
||||
[self.bgView addSubview:self.bottomView];
|
||||
|
||||
self.commitBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.bgView.width-ScaleWidth(110)-20, self.bottomView.height-42-12, ScaleWidth(110), 42)];
|
||||
[self.commitBtn addRoundedCornersWithRadius:21];
|
||||
self.commitBtn.backgroundColor = QXConfig.themeColor;
|
||||
[self.commitBtn setTitle:QXText(@"立即升级") forState:(UIControlStateNormal)];
|
||||
[self.commitBtn setTitleColor:QXConfig.btnTextColor forState:(UIControlStateNormal)];
|
||||
self.commitBtn.titleLabel.font = [UIFont systemFontOfSize:14];
|
||||
[self.commitBtn addTarget:self action:@selector(commitAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self.bottomView addSubview:self.commitBtn];
|
||||
|
||||
|
||||
self.cancelBtn = [[UIButton alloc] initWithFrame:CGRectMake(20, self.bottomView.height-42-12, ScaleWidth(110), 42)];
|
||||
[self.cancelBtn addRoundedCornersWithRadius:21];
|
||||
self.cancelBtn.backgroundColor = RGB16(0xF3F3F3);
|
||||
[self.cancelBtn setTitle:QXText(@"取消") forState:(UIControlStateNormal)];
|
||||
[self.cancelBtn setTitleColor:RGB16(0x999999) forState:(UIControlStateNormal)];
|
||||
self.cancelBtn.titleLabel.font = [UIFont systemFontOfSize:14];
|
||||
[self.cancelBtn addTarget:self action:@selector(cancelAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self.bottomView addSubview:self.cancelBtn];
|
||||
|
||||
|
||||
|
||||
self.scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(13, 0, self.bgView.width-26, self.commitBtn.top-13)];
|
||||
[self.bottomView addSubview:self.scrollView];
|
||||
|
||||
|
||||
self.messageLabel = [[UILabel alloc] initWithFrame:self.scrollView.bounds];
|
||||
self.messageLabel.font = [UIFont boldSystemFontOfSize:14];
|
||||
self.messageLabel.textColor = RGB16(0x000000);
|
||||
self.messageLabel.textAlignment = NSTextAlignmentCenter;
|
||||
self.messageLabel.numberOfLines = 0;
|
||||
[self.scrollView addSubview:self.messageLabel];
|
||||
}
|
||||
-(void)setModel:(QXAppVersionModel *)model{
|
||||
_model = model;
|
||||
self.messageLabel.text = model.content;
|
||||
// self.messageLabel.text = @"动环监控撒谎大健康撒谎科技打撒好看到货时间阿克汉登记卡撒大花洒科技活动极客飒户djsakljdk电视剧啊快回家读书卡多撒u一还有第四u啊个ID撒个hi打撒低功耗设计啊开工大吉萨嘎合计打撒好多个健身卡刚回到家撒合计扩大活动时间卡号大健康撒谎登记卡到货时间啊客户端健身卡核打静待花开撒会尽快的撒回到家凯撒会尽快的撒回到家凯撒会尽快的撒大花洒客户端手机卡击凯撒籍卡打撒";
|
||||
[self.messageLabel sizeToFit];
|
||||
self.scrollView.contentSize = CGSizeMake(self.bgView.width-26, self.messageLabel.height);
|
||||
if (model.is_force.intValue == 1) {
|
||||
self.cancelBtn.hidden = YES;
|
||||
self.commitBtn.frame = CGRectMake((self.bgView.width-ScaleWidth(110))/2, self.bottomView.height-42-12, ScaleWidth(110), 42);
|
||||
}else{
|
||||
self.cancelBtn.hidden = NO;
|
||||
self.commitBtn.frame = CGRectMake(self.bgView.width-ScaleWidth(110)-20, self.bottomView.height-42-12, ScaleWidth(110), 42);
|
||||
}
|
||||
}
|
||||
-(void)cancelAction{
|
||||
[self hide];
|
||||
}
|
||||
-(void)commitAction{
|
||||
if ([self.model.url isExist]) {
|
||||
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:self.model.url] options:@{} completionHandler:nil];
|
||||
}
|
||||
}
|
||||
|
||||
-(void)showInView:(UIView *)view{
|
||||
[view addSubview:self];
|
||||
[UIView animateWithDuration:0.3 delay:0 usingSpringWithDamping:0.5 initialSpringVelocity:1.0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
|
||||
self.bgView.y = (SCREEN_HEIGHT-ScaleWidth(362))/2.0;
|
||||
} completion:^(BOOL finished) {
|
||||
|
||||
}];
|
||||
}
|
||||
|
||||
-(void)hide{
|
||||
[UIView animateWithDuration:0.3 delay:0 usingSpringWithDamping:0.5 initialSpringVelocity:1.0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
|
||||
self.bgView.y = SCREEN_HEIGHT;
|
||||
} completion:^(BOOL finished) {
|
||||
[self removeFromSuperview];
|
||||
}];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@implementation QXVersionComparator
|
||||
|
||||
+ (NSInteger)compareVersion:(NSString *)newVersion withOldVersion:(NSString *)oldVersion {
|
||||
// 处理空值情况
|
||||
if (!newVersion || !oldVersion) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 去除可能的前缀(如"v")
|
||||
newVersion = [self removeVersionPrefix:newVersion];
|
||||
oldVersion = [self removeVersionPrefix:oldVersion];
|
||||
|
||||
// 分割版本号
|
||||
NSArray *newComponents = [newVersion componentsSeparatedByString:@"."];
|
||||
NSArray *oldComponents = [oldVersion componentsSeparatedByString:@"."];
|
||||
|
||||
// 获取最大组件数
|
||||
NSInteger maxCount = MAX(newComponents.count, oldComponents.count);
|
||||
|
||||
for (NSInteger i = 0; i < maxCount; i++) {
|
||||
// 获取当前位的版本号,如果不存在则默认为0
|
||||
NSInteger newPart = (i < newComponents.count) ? [newComponents[i] integerValue] : 0;
|
||||
NSInteger oldPart = (i < oldComponents.count) ? [oldComponents[i] integerValue] : 0;
|
||||
|
||||
if (newPart > oldPart) {
|
||||
return 1; // 新版本更大
|
||||
} else if (newPart < oldPart) {
|
||||
return -1; // 旧版本更大
|
||||
}
|
||||
// 如果相等,继续比较下一位
|
||||
}
|
||||
|
||||
return 0; // 版本完全相同
|
||||
}
|
||||
|
||||
+ (BOOL)shouldUpdateFromVersion:(NSString *)oldVersion toVersion:(NSString *)newVersion {
|
||||
NSInteger result = [self compareVersion:newVersion withOldVersion:oldVersion];
|
||||
return result == 1; // 只有新版本更大时才需要更新
|
||||
}
|
||||
|
||||
// 移除版本号前缀(如"v1.0.0" -> "1.0.0")
|
||||
+ (NSString *)removeVersionPrefix:(NSString *)version {
|
||||
if (!version) return @"";
|
||||
|
||||
// 去除空格
|
||||
version = [version stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
|
||||
|
||||
// 如果以"v"或"V"开头,去除前缀
|
||||
if (version.length > 0 && [[version substringToIndex:1] caseInsensitiveCompare:@"v"] == NSOrderedSame) {
|
||||
version = [version substringFromIndex:1];
|
||||
}
|
||||
|
||||
return version;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -53,12 +53,12 @@
|
||||
self.contentLabel.text = QXText(@"为了呵护未成年人健康成长,蜜耳语音特别推出青少年模式,该模式下部分功能无法正常使用,请监护人主动选择并设置监护密码");
|
||||
[self addSubview:self.contentLabel];
|
||||
|
||||
self.goBtn = [[UIButton alloc] init];
|
||||
[self.goBtn setTitleColor:RGB16(0xF4DF39) forState:(UIControlStateNormal)];
|
||||
[self.goBtn setTitle:[NSString stringWithFormat:@"%@>",QXText(@"进入青少年模式")] forState:(UIControlStateNormal)];
|
||||
self.goBtn.titleLabel.font = [UIFont systemFontOfSize:12];
|
||||
[self.goBtn addTarget:self action:@selector(gotoChirld) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self addSubview:self.goBtn];
|
||||
// self.goBtn = [[UIButton alloc] init];
|
||||
// [self.goBtn setTitleColor:RGB16(0xF4DF39) forState:(UIControlStateNormal)];
|
||||
// [self.goBtn setTitle:[NSString stringWithFormat:@"%@>",QXText(@"进入青少年模式")] forState:(UIControlStateNormal)];
|
||||
// self.goBtn.titleLabel.font = [UIFont systemFontOfSize:12];
|
||||
// [self.goBtn addTarget:self action:@selector(gotoChirld) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
// [self addSubview:self.goBtn];
|
||||
|
||||
self.closeBtn = [[UIButton alloc] init];
|
||||
[self.closeBtn setBackgroundImage:[UIImage imageNamed:@"home_white_close"] forState:(UIControlStateNormal)];
|
||||
@@ -96,10 +96,10 @@
|
||||
self.setBtn = [[UIButton alloc] init];
|
||||
[self.setBtn addRoundedCornersWithRadius:21];
|
||||
self.setBtn.backgroundColor = QXConfig.themeColor;
|
||||
[self.setBtn setTitle:QXText(@"设置青少年模式") forState:(UIControlStateNormal)];
|
||||
[self.setBtn setTitle:QXText(@"进入青少年模式") forState:(UIControlStateNormal)];
|
||||
[self.setBtn setTitleColor:QXConfig.btnTextColor forState:(UIControlStateNormal)];
|
||||
self.setBtn.titleLabel.font = [UIFont systemFontOfSize:14];
|
||||
[self.setBtn addTarget:self action:@selector(setAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self.setBtn addTarget:self action:@selector(gotoChirld) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self addSubview:self.setBtn];
|
||||
[self.setBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.bottom.equalTo(self.bgImageView).offset(-12);
|
||||
|
||||
18
QXLive/Tabbar/弹窗/QXCustomAlertView.h
Normal file
18
QXLive/Tabbar/弹窗/QXCustomAlertView.h
Normal file
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// QXCustomAlertView.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/10/10.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXCustomAlertView : UIView
|
||||
@property (nonatomic,copy)void(^commitBlock)(void);
|
||||
@property (nonatomic,copy)void(^cancelBlock)(void);
|
||||
-(void)showInView:(UIView *)view title:(NSString*)title message:(NSString*)message cancleTitle:(NSString*)cancleTitle commitTitle:(NSString*)commitTitle;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
134
QXLive/Tabbar/弹窗/QXCustomAlertView.m
Normal file
134
QXLive/Tabbar/弹窗/QXCustomAlertView.m
Normal file
@@ -0,0 +1,134 @@
|
||||
//
|
||||
// QXCustomAlertView.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/10/10.
|
||||
//
|
||||
|
||||
#import "QXCustomAlertView.h"
|
||||
@interface QXCustomAlertView()
|
||||
@property (nonatomic,strong)UIView *bgView;
|
||||
@property (nonatomic,strong)UILabel *titleLabel;
|
||||
@property (nonatomic,strong)UILabel *messageLabel;
|
||||
@property (nonatomic,strong)UIButton *cancelBtn;
|
||||
@property (nonatomic,strong)UIButton *commitBtn;
|
||||
@end
|
||||
|
||||
@implementation QXCustomAlertView
|
||||
- (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.5];
|
||||
self.bgView = [[UIView alloc] initWithFrame:CGRectMake((SCREEN_WIDTH-ScaleWidth(275))/2.0, -self.height, ScaleWidth(275), ScaleWidth(300))];
|
||||
self.bgView.backgroundColor = [UIColor whiteColor];
|
||||
self.bgView.layer.masksToBounds = YES;
|
||||
self.bgView.layer.cornerRadius = 16;
|
||||
[self addSubview:self.bgView];
|
||||
|
||||
self.titleLabel = [[UILabel alloc] init];
|
||||
self.titleLabel.font = [UIFont boldSystemFontOfSize:16];
|
||||
self.titleLabel.text = QXText(@"温馨提示");
|
||||
self.titleLabel.textColor = RGB16(0x333333);
|
||||
[self.bgView addSubview:self.titleLabel];
|
||||
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.equalTo(self.bgView);
|
||||
make.top.equalTo(self.bgView).offset(16);
|
||||
make.height.mas_equalTo(24);
|
||||
}];
|
||||
|
||||
self.messageLabel = [[UILabel alloc] init];
|
||||
self.messageLabel.font = [UIFont boldSystemFontOfSize:16];
|
||||
// self.messageLabel.text = QXText(@"您确定要清空背包吗?");
|
||||
self.messageLabel.textColor = RGB16(0x000000);
|
||||
self.messageLabel.textAlignment = NSTextAlignmentCenter;
|
||||
self.messageLabel.numberOfLines = 0;
|
||||
[self.bgView addSubview:self.messageLabel];
|
||||
[self.messageLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.bgView).offset(16);
|
||||
make.right.equalTo(self.bgView).offset(-16);
|
||||
make.centerY.equalTo(self.bgView);
|
||||
}];
|
||||
|
||||
|
||||
self.commitBtn = [[UIButton alloc] init];
|
||||
[self.commitBtn addRoundedCornersWithRadius:21];
|
||||
self.commitBtn.backgroundColor = QXConfig.themeColor;
|
||||
[self.commitBtn setTitle:QXText(@"确认") forState:(UIControlStateNormal)];
|
||||
[self.commitBtn setTitleColor:QXConfig.btnTextColor forState:(UIControlStateNormal)];
|
||||
self.commitBtn.titleLabel.font = [UIFont systemFontOfSize:14];
|
||||
[self.commitBtn addTarget:self action:@selector(commitAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self.bgView addSubview:self.commitBtn];
|
||||
[self.commitBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.bottom.equalTo(self.bgView).offset(-12);
|
||||
make.height.mas_equalTo(42);
|
||||
make.width.mas_equalTo(ScaleWidth(110));
|
||||
make.right.mas_equalTo(-20);
|
||||
}];
|
||||
|
||||
|
||||
self.cancelBtn = [[UIButton alloc] init];
|
||||
[self.cancelBtn addRoundedCornersWithRadius:21];
|
||||
self.cancelBtn.backgroundColor = RGB16(0xF3F3F3);
|
||||
[self.cancelBtn setTitle:QXText(@"取消") forState:(UIControlStateNormal)];
|
||||
[self.cancelBtn setTitleColor:RGB16(0x999999) forState:(UIControlStateNormal)];
|
||||
self.cancelBtn.titleLabel.font = [UIFont systemFontOfSize:14];
|
||||
[self.cancelBtn addTarget:self action:@selector(cancelAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self.bgView addSubview:self.cancelBtn];
|
||||
[self.cancelBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.bottom.equalTo(self.bgView).offset(-12);
|
||||
make.height.mas_equalTo(42);
|
||||
make.width.mas_equalTo(ScaleWidth(110));
|
||||
make.left.mas_equalTo(20);
|
||||
}];
|
||||
}
|
||||
|
||||
-(void)cancelAction{
|
||||
if (self.cancelBlock) {
|
||||
self.cancelBlock();
|
||||
}
|
||||
[self hide];
|
||||
}
|
||||
-(void)commitAction{
|
||||
if (self.commitBlock) {
|
||||
self.commitBlock();
|
||||
}
|
||||
[self hide];
|
||||
}
|
||||
-(void)showInView:(UIView *)view title:(NSString *)title message:(NSString *)message cancleTitle:(NSString *)cancleTitle commitTitle:(NSString *)commitTitle{
|
||||
if ([title isExist]) {
|
||||
self.titleLabel.text = title;
|
||||
}
|
||||
if ([message isExist]) {
|
||||
self.messageLabel.text = message;
|
||||
}
|
||||
if (cancleTitle) {
|
||||
[self.cancelBtn setTitle:cancleTitle forState:(UIControlStateNormal)];
|
||||
}
|
||||
if (commitTitle) {
|
||||
[self.commitBtn setTitle:cancleTitle forState:(UIControlStateNormal)];
|
||||
}
|
||||
[view addSubview:self];
|
||||
[UIView animateWithDuration:0.3 delay:0 usingSpringWithDamping:0.5 initialSpringVelocity:1.0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
|
||||
self.bgView.y = (SCREEN_HEIGHT-ScaleWidth(362))/2.0;
|
||||
} completion:^(BOOL finished) {
|
||||
|
||||
}];
|
||||
}
|
||||
|
||||
-(void)hide{
|
||||
[UIView animateWithDuration:0.3 delay:0 usingSpringWithDamping:0.5 initialSpringVelocity:1.0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
|
||||
self.bgView.y = SCREEN_HEIGHT;
|
||||
} completion:^(BOOL finished) {
|
||||
[self removeFromSuperview];
|
||||
}];
|
||||
}
|
||||
|
||||
@end
|
||||
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(^rechargeActionBlock)(NSString*money,NSString*gift_bag_id);
|
||||
@property (nonatomic,copy)void(^refreshBlcock)(void);
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
162
QXLive/Tabbar/弹窗/QXFirstRechargeView.m
Normal file
162
QXLive/Tabbar/弹窗/QXFirstRechargeView.m
Normal file
@@ -0,0 +1,162 @@
|
||||
//
|
||||
// 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(@"");
|
||||
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.messageLabel.text = [NSString stringWithFormat:@"充值%@即可获得%@金币",md.name,md.title2];
|
||||
[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.rechargeActionBlock) {
|
||||
self.rechargeActionBlock(self.model.money,self.model.gift_bag_id);
|
||||
}
|
||||
}
|
||||
-(void)closeAction{
|
||||
if (self.closeActionBlock) {
|
||||
self.closeActionBlock();
|
||||
}
|
||||
}
|
||||
@end
|
||||
@@ -33,8 +33,12 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@property (weak, nonatomic) IBOutlet UIImageView *userHeaderView;
|
||||
@property (weak, nonatomic) IBOutlet UIView *numberBgView;
|
||||
@property (weak, nonatomic) IBOutlet UIImageView *grayCoverView;
|
||||
@property (weak, nonatomic) IBOutlet UIImageView *giftNumBgImageView;
|
||||
@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
|
||||
|
||||
@@ -13,19 +13,23 @@
|
||||
[super awakeFromNib];
|
||||
// Initialization code
|
||||
[self.selecteBtn setBackgroundImage:[UIImage imageWithColor:RGB16(0xEFF2F8)] forState:(UIControlStateNormal)];
|
||||
[self.selecteBtn setBackgroundImage:[UIImage imageNamed:@"mine_dress_bg"] forState:(UIControlStateSelected)];
|
||||
[self.selecteBtn setBackgroundImage:[UIImage imageNamed:@"room_sound_sel"] forState:(UIControlStateSelected)];
|
||||
self.giftNumBgImageView.image = [[UIImage imageNamed:@"gift_number_bg"] imageByTintColor:QXConfig.themeColor];
|
||||
}
|
||||
|
||||
-(void)setCellType:(QXGiftCellType)cellType{
|
||||
_cellType = cellType;
|
||||
switch (cellType) {
|
||||
case QXGiftCellTypeNiceGift:{
|
||||
[self.selecteBtn setBackgroundImage:[UIImage imageWithColor:RGB16(0xE9E9E9)] forState:(UIControlStateNormal)];
|
||||
self.numberWidthConstraint.constant = 23;
|
||||
self.numberHeightConstraint.constant = 9;
|
||||
self.cornHeight.constant = 10;
|
||||
self.nameLabelHeight.constant = 10;
|
||||
self.giftNameLabel.font = [UIFont systemFontOfSize:8];
|
||||
self.cornBtn.titleLabel.font = [UIFont systemFontOfSize:8];
|
||||
[self.cornBtn setTitleColor:RGB16(0x333333) forState:(UIControlStateNormal)];
|
||||
self.giftNameLabel.textColor = RGB16(0x333333);
|
||||
self.userHeaderView.hidden = YES;
|
||||
}
|
||||
break;
|
||||
@@ -38,6 +42,8 @@
|
||||
self.numberLabel.font = [UIFont systemFontOfSize:10];
|
||||
self.cornBtn.titleLabel.font = [UIFont systemFontOfSize:14];
|
||||
self.selecteBtn.selected = YES;
|
||||
[self.cornBtn setTitleColor:RGB16(0x333333) forState:(UIControlStateNormal)];
|
||||
self.giftNameLabel.textColor = RGB16(0x333333);
|
||||
[self.cornBtn setImage:[UIImage imageNamed:@"mine_live_gift_corn"] forState:(UIControlStateNormal)];
|
||||
self.userHeaderView.hidden = YES;
|
||||
}
|
||||
@@ -47,6 +53,8 @@
|
||||
self.numberHeightConstraint.constant = 13;
|
||||
self.cornHeight.constant = 18;
|
||||
self.nameLabelHeight.constant = 18;
|
||||
[self.cornBtn setTitleColor:RGB16(0xffffff) forState:(UIControlStateNormal)];
|
||||
self.giftNameLabel.textColor = RGB16(0xffffff);
|
||||
self.giftNameLabel.font = [UIFont systemFontOfSize:14];
|
||||
self.cornBtn.titleLabel.font = [UIFont systemFontOfSize:14];
|
||||
[self.cornBtn setImage:[UIImage imageNamed:@"mine_live_gift_corn"] forState:(UIControlStateNormal)];
|
||||
@@ -72,10 +80,26 @@
|
||||
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;
|
||||
[self.gitfImageView sd_setImageWithURL:[NSURL URLWithString:roomGiftModel.base_image]];
|
||||
NSString *encodedQuery = [roomGiftModel.base_image stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
|
||||
NSURL *imageUrl = [NSURL URLWithString:encodedQuery];
|
||||
[self.gitfImageView sd_setImageWithURL:imageUrl];
|
||||
[self.cornBtn setTitle:[NSString stringWithFormat:@" %@",roomGiftModel.gift_price] forState:(UIControlStateNormal)];
|
||||
if (roomGiftModel.num.intValue > 0) {
|
||||
self.numberBgView.hidden = NO;
|
||||
@@ -83,12 +107,38 @@
|
||||
}else{
|
||||
self.numberBgView.hidden = YES;
|
||||
}
|
||||
if (roomGiftModel.isSelected) {
|
||||
[self.cornBtn setTitleColor:RGB16(0x333333) forState:(UIControlStateNormal)];
|
||||
self.giftNameLabel.textColor = RGB16(0x333333);
|
||||
}else{
|
||||
[self.cornBtn setTitleColor:RGB16(0xffffff) forState:(UIControlStateNormal)];
|
||||
self.giftNameLabel.textColor = RGB16(0xffffff);
|
||||
}
|
||||
|
||||
if ([roomGiftModel.activities_id isEqualToString:@"5"]) {
|
||||
self.activityImageView.hidden = NO;
|
||||
if (roomGiftModel.gift_bag.intValue == 10) {
|
||||
self.activityImageView.image = [UIImage imageNamed:@"a_gift_sky_icon"];
|
||||
[self.selecteBtn setBackgroundImage:[UIImage imageNamed:@"a_gift_sky_bg"] forState:(UIControlStateNormal)];
|
||||
}else if (roomGiftModel.gift_bag.intValue == 11) {
|
||||
self.activityImageView.image = [UIImage imageNamed:@"a_gift_age_icon"];
|
||||
[self.selecteBtn setBackgroundImage:[UIImage imageNamed:@"a_gift_age_bg"] forState:(UIControlStateNormal)];
|
||||
}else if (roomGiftModel.gift_bag.intValue == 12) {
|
||||
self.activityImageView.image = [UIImage imageNamed:@"a_gift_time_icon"];
|
||||
[self.selecteBtn setBackgroundImage:[UIImage imageNamed:@"a_gift_time_bg"] forState:(UIControlStateNormal)];
|
||||
}
|
||||
}else{
|
||||
self.activityImageView.hidden = YES;
|
||||
[self.selecteBtn setBackgroundImage:[UIImage imageWithColor:RGB16A(0xE9E9E9, 0.2)] forState:(UIControlStateNormal)];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setGiftWall:(QXUserGiftWallModel *)giftWall{
|
||||
_giftWall = giftWall;
|
||||
self.giftNameLabel.text = giftWall.gift_name;
|
||||
[self.gitfImageView sd_setImageWithURL:[NSURL URLWithString:giftWall.base_image]];
|
||||
NSString *encodedQuery = [giftWall.base_image stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
|
||||
NSURL *imageUrl = [NSURL URLWithString:encodedQuery];
|
||||
[self.gitfImageView sd_setImageWithURL:imageUrl];
|
||||
self.numberLabel.text = [NSString stringWithFormat:@"x%@",giftWall.total_count];
|
||||
self.grayCoverView.backgroundColor = RGB16A(0xE9E9E9, 0.8);
|
||||
if (giftWall.total_count.longLongValue == 0) {
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="QMu-c3-HcP">
|
||||
<rect key="frame" x="0.0" y="0.0" width="253" height="303"/>
|
||||
<subviews>
|
||||
<button opaque="NO" userInteractionEnabled="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="YN0-v8-SAo">
|
||||
<button opaque="NO" userInteractionEnabled="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="YN0-v8-SAo">
|
||||
<rect key="frame" x="0.0" y="0.0" width="253" height="303"/>
|
||||
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
|
||||
</button>
|
||||
@@ -33,7 +33,7 @@
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="x99" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="NY9-Jo-6BD">
|
||||
<rect key="frame" x="0.0" y="0.0" width="23" height="9"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="7"/>
|
||||
<color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
@@ -89,6 +89,12 @@
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</imageView>
|
||||
<imageView hidden="YES" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="R17-3r-nZl">
|
||||
<rect key="frame" x="0.0" y="255.66666666666663" width="253" height="21"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="21" id="qst-iu-9r5"/>
|
||||
</constraints>
|
||||
</imageView>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstAttribute="bottom" secondItem="YN0-v8-SAo" secondAttribute="bottom" id="0UV-vT-lSa"/>
|
||||
@@ -97,6 +103,7 @@
|
||||
<constraint firstItem="3d1-U7-04n" firstAttribute="leading" secondItem="1oa-XB-z2H" secondAttribute="leading" id="8De-gE-33I"/>
|
||||
<constraint firstItem="rHb-Od-M4a" firstAttribute="top" secondItem="1oa-XB-z2H" secondAttribute="bottom" id="8dO-90-EcR"/>
|
||||
<constraint firstItem="fxQ-G1-4U5" firstAttribute="top" secondItem="QMu-c3-HcP" secondAttribute="top" constant="4" id="AaP-Bh-HJO"/>
|
||||
<constraint firstAttribute="trailing" secondItem="R17-3r-nZl" secondAttribute="trailing" id="CD1-15-DjJ"/>
|
||||
<constraint firstAttribute="bottom" secondItem="niZ-Xc-95T" secondAttribute="bottom" id="Hcq-Ev-Yt1"/>
|
||||
<constraint firstAttribute="trailing" secondItem="1oa-XB-z2H" secondAttribute="trailing" constant="5" id="IeP-It-gIz"/>
|
||||
<constraint firstItem="YN0-v8-SAo" firstAttribute="top" secondItem="QMu-c3-HcP" secondAttribute="top" id="MM9-lD-eb5"/>
|
||||
@@ -104,6 +111,8 @@
|
||||
<constraint firstItem="anN-iX-rGm" firstAttribute="top" secondItem="QMu-c3-HcP" secondAttribute="top" id="QVB-1T-j7f"/>
|
||||
<constraint firstAttribute="trailing" secondItem="YN0-v8-SAo" secondAttribute="trailing" id="TM5-gQ-Sjd"/>
|
||||
<constraint firstItem="niZ-Xc-95T" firstAttribute="top" secondItem="QMu-c3-HcP" secondAttribute="top" id="Vx1-do-zNx"/>
|
||||
<constraint firstItem="R17-3r-nZl" firstAttribute="centerY" secondItem="rHb-Od-M4a" secondAttribute="centerY" id="Ytt-7W-SM4"/>
|
||||
<constraint firstItem="R17-3r-nZl" firstAttribute="leading" secondItem="QMu-c3-HcP" secondAttribute="leading" id="aSk-9n-6Ln"/>
|
||||
<constraint firstAttribute="trailing" secondItem="anN-iX-rGm" secondAttribute="trailing" id="gMa-Ee-Va2"/>
|
||||
<constraint firstItem="YN0-v8-SAo" firstAttribute="leading" secondItem="QMu-c3-HcP" secondAttribute="leading" id="gwM-TL-16q"/>
|
||||
<constraint firstItem="rHb-Od-M4a" firstAttribute="trailing" secondItem="1oa-XB-z2H" secondAttribute="trailing" id="j58-9C-4jp"/>
|
||||
@@ -132,9 +141,11 @@
|
||||
</constraints>
|
||||
<size key="customSize" width="253" height="303"/>
|
||||
<connections>
|
||||
<outlet property="activityImageView" destination="R17-3r-nZl" id="bjL-Xi-hJI"/>
|
||||
<outlet property="cornBtn" destination="3d1-U7-04n" id="PLQ-JR-U9b"/>
|
||||
<outlet property="cornHeight" destination="svX-z8-2v4" id="ocG-gq-4Wo"/>
|
||||
<outlet property="giftNameLabel" destination="rHb-Od-M4a" id="nik-Bp-Ce4"/>
|
||||
<outlet property="giftNumBgImageView" destination="Yu7-xk-6PI" id="cPo-JU-rPA"/>
|
||||
<outlet property="gitfImageView" destination="1oa-XB-z2H" id="1bo-km-q0H"/>
|
||||
<outlet property="grayCoverView" destination="niZ-Xc-95T" id="vbK-Sr-GkT"/>
|
||||
<outlet property="nameLabelHeight" destination="yY1-Fd-GTO" id="ewH-OC-DXC"/>
|
||||
@@ -150,7 +161,7 @@
|
||||
</objects>
|
||||
<resources>
|
||||
<image name="gift_corn" width="6" height="6"/>
|
||||
<image name="gift_number_bg" width="22.666666030883789" height="8.6666669845581055"/>
|
||||
<image name="user_header_placehoulder" width="40" height="40"/>
|
||||
<image name="gift_number_bg" width="35" height="13"/>
|
||||
<image name="user_header_placehoulder" width="60" height="60"/>
|
||||
</resources>
|
||||
</document>
|
||||
|
||||
@@ -1,20 +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;
|
||||
+(instancetype)shareView;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -1,116 +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;
|
||||
@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];
|
||||
}
|
||||
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{
|
||||
[self.dataArray addObject:model];
|
||||
[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];
|
||||
}
|
||||
|
||||
-(NSMutableArray *)dataArray{
|
||||
if (!_dataArray) {
|
||||
_dataArray = [NSMutableArray array];
|
||||
}
|
||||
return _dataArray;
|
||||
}
|
||||
@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(^rechargeActionBlock)(NSString*money,NSString*gift_bag_id);
|
||||
@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;
|
||||
@@ -19,6 +19,7 @@
|
||||
@property (nonatomic,strong)UIButton *firstBtn;
|
||||
@property (nonatomic,strong)UIButton *secondBtn;
|
||||
@property (nonatomic,strong)UIButton *thirdBtn;
|
||||
@property (nonatomic,strong)UIButton *oneMouthBtn;
|
||||
@property (nonatomic,strong)UIButton *selectedBtn;
|
||||
|
||||
@property (nonatomic,strong)UIView *giftBgView;
|
||||
@@ -26,13 +27,15 @@
|
||||
@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 *md4;
|
||||
@property (nonatomic,strong)QXNiceGiftRechargeModel *smd;
|
||||
|
||||
@end
|
||||
|
||||
@implementation QXFirstRechargePopView
|
||||
@implementation QXNewPeoplePopView
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
@@ -50,11 +53,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];
|
||||
@@ -71,9 +74,11 @@
|
||||
self.firstBtn.hidden = YES;
|
||||
UIImage *firstNorImage = [UIImage imageWithColor:RGB16(0xFFFFFF)];
|
||||
UIImage *firstSelImage = [UIImage imageWithColor:RGB16(0xF4DF39)];
|
||||
UIImage *firstDisImage = [UIImage imageWithColor:RGB16(0xE9E9E9)];
|
||||
[self.firstBtn setBackgroundImage:firstNorImage forState:(UIControlStateNormal)];
|
||||
[self.firstBtn setBackgroundImage:firstSelImage forState:(UIControlStateSelected)];
|
||||
self.firstBtn.selected = YES;
|
||||
[self.firstBtn setBackgroundImage:firstDisImage forState:(UIControlStateDisabled)];
|
||||
// self.firstBtn.selected = YES;
|
||||
// [self.firstBtn setTitle:@"9元" forState:(UIControlStateNormal)];
|
||||
[self.firstBtn setTitleColor:RGB16(0x333333) forState:(UIControlStateNormal)];
|
||||
[self.firstBtn addRoundedCornersWithRadius:ScaleWidth(13)];
|
||||
@@ -92,8 +97,10 @@
|
||||
self.secondBtn.hidden = YES;
|
||||
UIImage *secondNorImage = [UIImage imageWithColor:RGB16(0xFFFFFF)];
|
||||
UIImage *secondSelImage = [UIImage imageWithColor:RGB16(0xF4DF39)];
|
||||
UIImage *secondDisImage = [UIImage imageWithColor:RGB16(0xE9E9E9)];
|
||||
[self.secondBtn setBackgroundImage:secondNorImage forState:(UIControlStateNormal)];
|
||||
[self.secondBtn setBackgroundImage:secondSelImage forState:(UIControlStateSelected)];
|
||||
[self.secondBtn setBackgroundImage:secondDisImage forState:(UIControlStateDisabled)];
|
||||
// [self.secondBtn setTitle:@"30元" forState:(UIControlStateNormal)];
|
||||
[self.secondBtn setTitleColor:RGB16(0x333333) forState:(UIControlStateNormal)];
|
||||
[self.secondBtn addRoundedCornersWithRadius:ScaleWidth(13)];
|
||||
@@ -104,7 +111,7 @@
|
||||
make.left.equalTo(self.firstBtn.mas_right).offset(12);
|
||||
make.top.equalTo(self.firstBtn);
|
||||
make.height.mas_equalTo(ScaleWidth(26));
|
||||
make.width.mas_equalTo(ScaleWidth(42));
|
||||
make.width.mas_equalTo(ScaleWidth(50));
|
||||
}];
|
||||
|
||||
|
||||
@@ -112,8 +119,10 @@
|
||||
self.thirdBtn.hidden = YES;
|
||||
UIImage *thirdNorImage = [UIImage imageWithColor:RGB16(0xFFFFFF)];
|
||||
UIImage *thirdSelImage = [UIImage imageWithColor:RGB16(0xF4DF39)];
|
||||
UIImage *thirdDisImage = [UIImage imageWithColor:RGB16(0xE9E9E9)];
|
||||
[self.thirdBtn setBackgroundImage:thirdNorImage forState:(UIControlStateNormal)];
|
||||
[self.thirdBtn setBackgroundImage:thirdSelImage forState:(UIControlStateSelected)];
|
||||
[self.thirdBtn setBackgroundImage:thirdDisImage forState:(UIControlStateDisabled)];
|
||||
// [self.thirdBtn setTitle:@"60元" forState:(UIControlStateNormal)];
|
||||
[self.thirdBtn setTitleColor:RGB16(0x333333) forState:(UIControlStateNormal)];
|
||||
[self.thirdBtn addRoundedCornersWithRadius:ScaleWidth(13)];
|
||||
@@ -124,9 +133,28 @@
|
||||
make.left.equalTo(self.secondBtn.mas_right).offset(12);
|
||||
make.top.equalTo(self.firstBtn);
|
||||
make.height.mas_equalTo(ScaleWidth(26));
|
||||
make.width.mas_equalTo(ScaleWidth(42));
|
||||
make.width.mas_equalTo(ScaleWidth(50));
|
||||
}];
|
||||
|
||||
self.oneMouthBtn = [[UIButton alloc] init];
|
||||
self.oneMouthBtn.hidden = YES;
|
||||
UIImage *one_mouth_norImage = [UIImage imageNamed:@"one_mouth_money"];
|
||||
UIImage *one_mouth_selImage = [UIImage imageNamed:@"one_mouth_money_sel"];
|
||||
[self.oneMouthBtn setBackgroundImage:one_mouth_norImage forState:(UIControlStateNormal)];
|
||||
[self.oneMouthBtn setBackgroundImage:one_mouth_selImage forState:(UIControlStateSelected)];
|
||||
[self.oneMouthBtn setTitleColor:RGB16(0xffffff) forState:(UIControlStateNormal)];
|
||||
[self.oneMouthBtn addRoundedCornersWithRadius:ScaleWidth(13)];
|
||||
self.oneMouthBtn.titleLabel.font = [UIFont systemFontOfSize:14];
|
||||
[self.oneMouthBtn addTarget:self action:@selector(rechargeSelectedAction:) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self addSubview:self.oneMouthBtn];
|
||||
[self.oneMouthBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.equalTo(self.bgImageView.mas_right).offset(-27);
|
||||
make.centerY.equalTo(self.firstBtn);
|
||||
make.height.mas_equalTo(ScaleWidth(24));
|
||||
make.width.mas_equalTo(ScaleWidth(66));
|
||||
}];
|
||||
|
||||
|
||||
self.giftBgView = [[UIView alloc] init];
|
||||
self.giftBgView.backgroundColor = [UIColor whiteColor];
|
||||
[self.giftBgView addRoundedCornersWithRadius:13];
|
||||
@@ -139,7 +167,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,30 +232,64 @@
|
||||
}
|
||||
-(void)getFirstRechargeGiftList{
|
||||
MJWeakSelf
|
||||
[QXHomePageNetwork getFirstRechargeGiftListSuccessBlock:^(NSArray<QXFirstRechargeModel *> * _Nonnull list) {
|
||||
[QXHomePageNetwork getNewUserGiftListSuccessBlock:^(NSArray<QXNiceGiftRechargeModel *> * _Nonnull list) {
|
||||
for (int i = 0; i<list.count; i++) {
|
||||
if (i == 0) {
|
||||
weakSelf.md1 = list[i];
|
||||
weakSelf.firstBtn.hidden = NO;
|
||||
[weakSelf.firstBtn setTitle:weakSelf.md1.name forState:(UIControlStateNormal)];
|
||||
if (weakSelf.md1.status.intValue == 1) {
|
||||
weakSelf.firstBtn.enabled = YES;
|
||||
weakSelf.firstBtn.selected = YES;
|
||||
weakSelf.selectedBtn = weakSelf.firstBtn;
|
||||
}else{
|
||||
weakSelf.firstBtn.enabled = NO;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (i == 1) {
|
||||
weakSelf.md2 = list[i];
|
||||
weakSelf.secondBtn.hidden = NO;
|
||||
[weakSelf.secondBtn setTitle:weakSelf.md2.name forState:(UIControlStateNormal)];
|
||||
if (weakSelf.md2.status.intValue == 1) {
|
||||
weakSelf.secondBtn.enabled = YES;
|
||||
if (!weakSelf.selectedBtn.selected) {
|
||||
weakSelf.secondBtn.selected = YES;
|
||||
weakSelf.selectedBtn = weakSelf.secondBtn;
|
||||
}
|
||||
}else{
|
||||
weakSelf.secondBtn.enabled = NO;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (i == 2) {
|
||||
weakSelf.md3 = list[i];
|
||||
weakSelf.thirdBtn.hidden = NO;
|
||||
[weakSelf.thirdBtn setTitle:weakSelf.md3.name forState:(UIControlStateNormal)];
|
||||
if (weakSelf.md3.status.intValue == 1) {
|
||||
weakSelf.thirdBtn.enabled = YES;
|
||||
if (!weakSelf.selectedBtn.selected) {
|
||||
weakSelf.thirdBtn.selected = YES;
|
||||
weakSelf.selectedBtn = weakSelf.thirdBtn;
|
||||
}
|
||||
}else{
|
||||
weakSelf.thirdBtn.enabled = NO;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (i == 3) {
|
||||
weakSelf.md4 = list[i];
|
||||
[weakSelf.oneMouthBtn setTitle:weakSelf.md4.name forState:(UIControlStateNormal)];
|
||||
weakSelf.oneMouthBtn.hidden = NO;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
[weakSelf rechargeSelectedAction:weakSelf.firstBtn];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
showToast(msg);
|
||||
if (weakSelf.refreshBlcock) {
|
||||
weakSelf.refreshBlcock();
|
||||
}
|
||||
}];
|
||||
}
|
||||
-(void)scrollViewDidScroll:(UIScrollView *)scrollView{
|
||||
@@ -266,7 +328,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;
|
||||
@@ -276,6 +338,9 @@
|
||||
}else if (sender == self.thirdBtn){
|
||||
self.giftArray = self.md3.gift_list;
|
||||
md = self.md3;
|
||||
}else if (sender == self.oneMouthBtn){
|
||||
self.giftArray = self.md4.gift_list;
|
||||
md = self.md4;
|
||||
}
|
||||
self.smd = md;
|
||||
if (md == nil) {
|
||||
@@ -290,16 +355,16 @@
|
||||
|
||||
-(NSAttributedString *)changePrice:(NSString*)price giftPrice:(NSString*)giftPrice{
|
||||
NSString *str = [NSString stringWithFormat:@"%@ %@",price,giftPrice];
|
||||
NSAttributedString *attr = [str deleteLineWithTextColor:RGB16(0x999999) lineColor:RGB16(0x999999) range:[str rangeOfString:giftPrice]];
|
||||
NSAttributedString *attr = [str deleteLineWithTextColor:RGB16(0x333333) lineColor:RGB16(0x333333) range:[str rangeOfString:giftPrice]];
|
||||
NSMutableAttributedString *att = [[NSMutableAttributedString alloc] initWithAttributedString:attr];
|
||||
[att yy_setFont:[UIFont systemFontOfSize:14] range:[str rangeOfString:price]];
|
||||
[att yy_setFont:[UIFont boldSystemFontOfSize:14] range:[str rangeOfString:price]];
|
||||
[att yy_setFont:[UIFont systemFontOfSize:12] range:[str rangeOfString:giftPrice]];
|
||||
[att yy_setColor:RGB16(0x333333) range:[price rangeOfString:str]];
|
||||
[att yy_setColor:RGB16(0xFFE200) range:[str rangeOfString:price]];
|
||||
return att;
|
||||
}
|
||||
-(void)rechargeAction{
|
||||
if (self.rechargeActionBlock) {
|
||||
self.rechargeActionBlock(self.smd.money);
|
||||
self.rechargeActionBlock(self.smd.money,self.smd.gift_bag_id);
|
||||
}
|
||||
}
|
||||
-(void)closeAction{
|
||||
@@ -11,9 +11,8 @@ 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(^rechargeActionBlock)(NSString*money,NSString*gift_bag_id);
|
||||
@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
|
||||
|
||||
@@ -52,12 +54,14 @@
|
||||
[self.timeDownbgView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.bgImageView).offset(ScaleWidth(117));
|
||||
make.left.equalTo(self.bgImageView).offset(9);
|
||||
make.size.mas_equalTo(CGSizeMake(ScaleWidth(179), ScaleWidth(20)));
|
||||
make.right.equalTo(self.bgImageView).offset(-9);
|
||||
make.width.mas_equalTo(ScaleWidth(20));
|
||||
|
||||
}];
|
||||
|
||||
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 +70,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];
|
||||
@@ -128,7 +132,7 @@
|
||||
self.messageLabel = [[UILabel alloc] init];
|
||||
self.messageLabel.font = [UIFont systemFontOfSize:12];
|
||||
self.messageLabel.numberOfLines = 0;
|
||||
self.messageLabel.text = QXText(@"充值6元即可获得总价值888金币的道具或装扮");
|
||||
self.messageLabel.text = @"";
|
||||
self.messageLabel.textColor = QXConfig.textColor;
|
||||
[self.giftBgView addSubview:self.messageLabel];
|
||||
[self.messageLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
@@ -142,7 +146,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,50 +167,41 @@
|
||||
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 = [NSString stringWithFormat:@"结束时间:%@",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.niceGiftModel = self.model.gift_list[indexPath.row];
|
||||
return cell;
|
||||
}
|
||||
|
||||
// 规则
|
||||
-(void)ruleAction{
|
||||
if (self.ruleActionBlock) {
|
||||
self.ruleActionBlock();
|
||||
}
|
||||
}
|
||||
|
||||
// 立即领取
|
||||
-(void)getAction{
|
||||
if (self.getActionBlock) {
|
||||
self.getActionBlock();
|
||||
if (self.rechargeActionBlock) {
|
||||
self.rechargeActionBlock(self.model.money,self.model.gift_bag_id);
|
||||
}
|
||||
}
|
||||
-(void)closeAction{
|
||||
|
||||
Reference in New Issue
Block a user