提交
This commit is contained in:
@@ -18,7 +18,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@property (nonatomic,assign)BOOL isCompere;
|
||||
@property (nonatomic,weak)id<QXRoomSeatDelegate>delegate;
|
||||
|
||||
|
||||
-(void)setRoomCollect:(BOOL)isCollect;
|
||||
-(void)onlineNumberIsAdd:(BOOL)isAdd;
|
||||
-(void)setOnlineNumber:(NSString*)onlineNumber;
|
||||
@end
|
||||
|
||||
@@ -344,10 +344,19 @@
|
||||
self.rankView.roomId = self.roomId;
|
||||
[self.rankView showInView:self.viewController.view];
|
||||
}
|
||||
|
||||
-(void)setRoomCollect:(BOOL)isCollect{
|
||||
self.roomModel.user_info.is_collect = isCollect?@"1":@"0";
|
||||
self.followBtn.selected = isCollect?YES:NO;
|
||||
}
|
||||
-(void)followAction:(UIButton*)sender{
|
||||
MJWeakSelf
|
||||
[QXDynamicNetwork followWithUserId:self.roomId type:@"2" successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
sender.selected = !sender.selected;
|
||||
weakSelf.followBtn.selected = !weakSelf.followBtn.selected;
|
||||
if (weakSelf.followBtn.selected) {
|
||||
weakSelf.roomModel.user_info.is_collect = @"1";
|
||||
}else{
|
||||
weakSelf.roomModel.user_info.is_collect = @"0";
|
||||
}
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
|
||||
}];
|
||||
|
||||
@@ -10,27 +10,31 @@
|
||||
typedef NS_ENUM(NSInteger) {
|
||||
/// 打开红包
|
||||
QXRedBagDrawTypeOpen = 0,
|
||||
/// 倒计时
|
||||
/// 仅倒计时
|
||||
QXRedBagDrawTypeTimeDown,
|
||||
/// 收藏房间
|
||||
/// 仅收藏房间
|
||||
QXRedBagDrawTypeCollect,
|
||||
/// 手慢了被领完了
|
||||
QXRedBagDrawTypeFinished,
|
||||
/// 口令红包发送评论
|
||||
/// 发送评论领红包
|
||||
QXRedBagDrawTypePwdSend,
|
||||
/// 口令红包倒计时
|
||||
QXRedBagDrawTypePwdTimeDown,
|
||||
/// 口令红包收藏房间
|
||||
QXRedBagDrawTypePwdCollect,
|
||||
/// 需要完成两个任务
|
||||
/// 需要完成两个收藏房间和倒计时
|
||||
QXRedBagDrawTypePwdAllTask,
|
||||
}QXRedBagDrawType;
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXRedBagDrawView : UIView
|
||||
@property (nonatomic,strong)QXRedPacketModel *redpacketModel;
|
||||
@property (nonatomic,assign)QXRedBagDrawType type;
|
||||
@property (nonatomic,strong)NSString *room_id;
|
||||
/// 是否已经收藏过房间
|
||||
@property (nonatomic,assign)BOOL isCollectedRoom;
|
||||
/// 倒计时
|
||||
@property (nonatomic,assign)long needTime;
|
||||
/// 是否是发送评论地方过来
|
||||
@property (nonatomic,assign)BOOL isFromToComment;
|
||||
@property (nonatomic,copy)void(^toInputPwdBlock)(NSString *password,QXRedPacketModel*redpacketModel);
|
||||
@property (nonatomic,copy)void(^collectRoomBlock)(void);
|
||||
-(void)changeViewType:(QXRedBagDrawType)type;
|
||||
-(void)showInView:(UIView*)view;
|
||||
-(void)hide;
|
||||
@end
|
||||
|
||||
@@ -7,10 +7,13 @@
|
||||
|
||||
#import "QXRedBagDrawView.h"
|
||||
#import "QXRedBagRecordViewController.h"
|
||||
#import "QXMineNetwork.h"
|
||||
|
||||
@class QXRedBagTimeDownView;
|
||||
@interface QXRedBagDrawView()
|
||||
@property (nonatomic,strong)UIView *bgView;
|
||||
@property (nonatomic,strong)UIImageView *bgImageView;
|
||||
@property (nonatomic,strong)UIImageView *pwdImageView;
|
||||
@property (nonatomic,strong)UIImageView *userHeaderImageView;
|
||||
@property (nonatomic,strong)UILabel *userNameLabel;
|
||||
@property (nonatomic,strong)UILabel *remarkLabel;
|
||||
@@ -29,6 +32,8 @@
|
||||
@property (nonatomic,strong)UILabel *pwdTitleLable;
|
||||
/// 抢红包必须在本房间内
|
||||
@property (nonatomic,strong)UILabel *bottomLabel;
|
||||
@property (nonatomic,assign)QXRedBagDrawType drawType;
|
||||
|
||||
@end
|
||||
@implementation QXRedBagDrawView
|
||||
- (instancetype)init
|
||||
@@ -42,6 +47,7 @@
|
||||
}
|
||||
|
||||
-(void)initSubviews{
|
||||
self.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.3];
|
||||
self.bgView = [[UIView alloc] initWithFrame:CGRectMake((SCREEN_WIDTH-345)/2, (SCREEN_HEIGHT-454)/2, 345, 454)];
|
||||
[self addSubview:self.bgView];
|
||||
|
||||
@@ -49,6 +55,12 @@
|
||||
self.bgImageView.image = [UIImage imageNamed:@"room_draw_redbag_bg"];
|
||||
[self.bgView addSubview:self.bgImageView];
|
||||
|
||||
self.pwdImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"red_packet_pwd_icon"]];
|
||||
self.pwdImageView.frame = CGRectMake(0, 0, 119, 41);
|
||||
self.pwdImageView.hidden = YES;
|
||||
[self.bgView addSubview:self.pwdImageView];
|
||||
|
||||
|
||||
self.closeBtn = [[UIButton alloc] init];
|
||||
[self.closeBtn setImage:[UIImage imageNamed:@"room_redbag_close"] forState:(UIControlStateNormal)];
|
||||
[self.closeBtn addTarget:self action:@selector(closeAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
@@ -122,13 +134,13 @@
|
||||
@weakify(self)
|
||||
self.timeDownView.btnBlcok = ^(QXRedBagDrawType type) {
|
||||
@strongify(self);
|
||||
if (type == QXRedBagDrawTypePwdCollect) {
|
||||
if (type == QXRedBagDrawTypeCollect) {
|
||||
/// 这里去收藏房间
|
||||
[self setType:(QXRedBagDrawTypeOpen)];
|
||||
[self collectRoom];
|
||||
return;
|
||||
}
|
||||
if (self.toInputPwdBlock) {
|
||||
self.toInputPwdBlock(@"傻狗涛来了,大家都让一让",self.redpacketModel);
|
||||
self.toInputPwdBlock(self.redpacketModel.password,self.redpacketModel);
|
||||
}
|
||||
[self hide];
|
||||
};
|
||||
@@ -162,7 +174,7 @@
|
||||
}];
|
||||
|
||||
self.drawTitleLabel = [[UILabel alloc] init];
|
||||
self.drawTitleLabel.text = @"口令红包参与条件";
|
||||
self.drawTitleLabel.text = @"红包参与条件";
|
||||
self.drawTitleLabel.textColor = RGB16(0xffffff);
|
||||
self.drawTitleLabel.textAlignment = NSTextAlignmentCenter;
|
||||
self.drawTitleLabel.font = [UIFont systemFontOfSize:12];
|
||||
@@ -197,6 +209,22 @@
|
||||
make.centerX.equalTo(self.bgView);;
|
||||
}];
|
||||
}
|
||||
-(void)collectRoom{
|
||||
MJWeakSelf
|
||||
[QXMineNetwork roomCollectWithType:@"1" room_id:self.room_id successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
if (weakSelf.collectRoomBlock) {
|
||||
weakSelf.collectRoomBlock();
|
||||
}
|
||||
weakSelf.isCollectedRoom = YES;
|
||||
if ([weakSelf.redpacketModel canOpenNow]) {
|
||||
[weakSelf setType:(QXRedBagDrawTypeOpen)];
|
||||
}else{
|
||||
[weakSelf setType:QXRedBagDrawTypeTimeDown];
|
||||
}
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
|
||||
}];
|
||||
}
|
||||
/**
|
||||
/// 打开红包
|
||||
QXRedBagDrawTypeOpen = 0,
|
||||
@@ -213,13 +241,68 @@
|
||||
/// 口令红包收藏房间
|
||||
QXRedBagDrawTypePwdCollect,
|
||||
*/
|
||||
-(void)setIsCollectedRoom:(BOOL)isCollectedRoom{
|
||||
_isCollectedRoom = isCollectedRoom;
|
||||
}
|
||||
-(void)setRedpacketModel:(QXRedPacketModel *)redpacketModel{
|
||||
_redpacketModel = redpacketModel;
|
||||
[self setType:[self getDrawTypeWithRedpacktModel:redpacketModel]];
|
||||
self.remarkLabel.text = redpacketModel.remark;
|
||||
[self.userHeaderImageView sd_setImageWithURL:[NSURL URLWithString:redpacketModel.avatar]];
|
||||
self.userNameLabel.text = [NSString stringWithFormat:@"%@的红包",redpacketModel.nickname];
|
||||
self.commentTitleLabel.text = [NSString stringWithFormat:@"发送评论%@",redpacketModel.password];
|
||||
if (redpacketModel.type.intValue == 2) {
|
||||
self.pwdImageView.hidden = NO;
|
||||
}else{
|
||||
self.pwdImageView.hidden = YES;
|
||||
}
|
||||
if (self.drawType == QXRedBagDrawTypeOpen) {
|
||||
self.pwdBgView.hidden = YES;
|
||||
self.bottomLabel.hidden = YES;
|
||||
}else{
|
||||
self.pwdBgView.hidden = NO;
|
||||
self.bottomLabel.hidden = NO;
|
||||
if (redpacketModel.type.intValue == 2) {
|
||||
self.commentTitleLabel.hidden = NO;
|
||||
}else{
|
||||
self.commentTitleLabel.hidden = YES;
|
||||
}
|
||||
if (redpacketModel.conditions.intValue == 0) {
|
||||
self.pwdTitleLable.hidden = YES;
|
||||
self.drawTitleLabel.hidden = YES;
|
||||
}else{
|
||||
self.pwdTitleLable.hidden = NO;
|
||||
self.drawTitleLabel.hidden = NO;
|
||||
if ([redpacketModel.conditions isEqualToString:@"1,2"]) {
|
||||
self.pwdTitleLable.text = @"收藏房间,仅麦上用户";
|
||||
}else if ([redpacketModel.conditions isEqualToString:@"1"]) {
|
||||
self.pwdTitleLable.text = @"收藏房间";
|
||||
}else if ([redpacketModel.conditions isEqualToString:@"1"]) {
|
||||
self.pwdTitleLable.text = @"仅麦上用户";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
-(void)setIsFromToComment:(BOOL)isFromToComment{
|
||||
_isFromToComment = isFromToComment;
|
||||
}
|
||||
|
||||
-(void)setNeedTime:(long)needTime{
|
||||
_needTime = needTime;
|
||||
NSInteger min = (needTime % 3600) / 60;
|
||||
NSInteger second = needTime % 60;
|
||||
self.timeDownView.timeLabel.text = [NSString stringWithFormat:@"%02ld:%02ld后开启红包",min,(long)second];
|
||||
}
|
||||
-(void)changeViewType:(QXRedBagDrawType)type{
|
||||
[self setType:type];
|
||||
}
|
||||
|
||||
-(void)setType:(QXRedBagDrawType)type{
|
||||
_type = type;
|
||||
_drawType = type;
|
||||
switch (type) {
|
||||
case QXRedBagDrawTypeOpen:{
|
||||
self.openBtn.hidden = NO;
|
||||
self.remarkLabel.text = @"恭喜发财,大吉大利";
|
||||
self.remarkLabel.text = self.redpacketModel.remark;
|
||||
self.recordBtn.hidden = YES;
|
||||
self.timeDownView.hidden = YES;
|
||||
self.bottomLabel.hidden = YES;
|
||||
@@ -237,53 +320,34 @@
|
||||
break;
|
||||
case QXRedBagDrawTypeCollect:{
|
||||
self.openBtn.hidden = YES;
|
||||
self.remarkLabel.text = @"恭喜发财,大吉大利";
|
||||
self.remarkLabel.text = self.redpacketModel.remark;
|
||||
self.recordBtn.hidden = YES;
|
||||
self.timeDownView.type = QXRedBagDrawTypeCollect;
|
||||
self.timeDownView.hidden = NO;
|
||||
self.bottomLabel.hidden = NO;
|
||||
self.pwdBgView.hidden = YES;
|
||||
[self performSelector:@selector(changeType) afterDelay:2];
|
||||
self.pwdBgView.hidden = NO;
|
||||
self.commentTitleLabel.hidden = YES;
|
||||
self.pwdTitleLable.text= @"收藏房间";
|
||||
}
|
||||
break;
|
||||
case QXRedBagDrawTypeTimeDown:{
|
||||
self.openBtn.hidden = YES;
|
||||
self.remarkLabel.text = @"恭喜发财,大吉大利";
|
||||
self.remarkLabel.text = self.redpacketModel.remark;
|
||||
self.recordBtn.hidden = YES;
|
||||
self.timeDownView.type = QXRedBagDrawTypeTimeDown;
|
||||
self.timeDownView.hidden = NO;
|
||||
self.bottomLabel.hidden = NO;
|
||||
self.pwdBgView.hidden = YES;
|
||||
[self performSelector:@selector(changeType) afterDelay:2];
|
||||
}
|
||||
break;
|
||||
case QXRedBagDrawTypePwdSend:{
|
||||
self.openBtn.hidden = YES;
|
||||
self.remarkLabel.text = @"恭喜发财,大吉大利";
|
||||
self.remarkLabel.text = self.redpacketModel.remark;
|
||||
self.recordBtn.hidden = YES;
|
||||
self.timeDownView.type = QXRedBagDrawTypePwdSend;
|
||||
self.timeDownView.hidden = NO;
|
||||
self.pwdBgView.hidden = NO;
|
||||
self.pwdTitleLable.hidden = YES;
|
||||
}
|
||||
break;
|
||||
case QXRedBagDrawTypePwdTimeDown:{
|
||||
self.openBtn.hidden = YES;
|
||||
self.remarkLabel.text = @"恭喜发财,大吉大利";
|
||||
self.recordBtn.hidden = YES;
|
||||
self.timeDownView.type = QXRedBagDrawTypePwdTimeDown;
|
||||
self.timeDownView.hidden = NO;
|
||||
self.bottomLabel.hidden = NO;
|
||||
self.pwdBgView.hidden = YES;
|
||||
[self performSelector:@selector(changeType) afterDelay:2];
|
||||
}
|
||||
break;
|
||||
case QXRedBagDrawTypePwdCollect:{
|
||||
self.openBtn.hidden = YES;
|
||||
self.remarkLabel.text = @"手慢了,红包被领完了";
|
||||
self.recordBtn.hidden = NO;
|
||||
}
|
||||
break;
|
||||
|
||||
case QXRedBagDrawTypePwdAllTask:{
|
||||
self.openBtn.hidden = YES;
|
||||
self.remarkLabel.text = @"手慢了,红包被领完了";
|
||||
@@ -294,41 +358,59 @@
|
||||
break;
|
||||
}
|
||||
}
|
||||
-(void)changeType{
|
||||
[self setType:QXRedBagDrawTypeOpen];
|
||||
}
|
||||
|
||||
#pragma mark - action
|
||||
-(void)closeAction{
|
||||
[self hide];
|
||||
}
|
||||
|
||||
-(void)openAction{
|
||||
|
||||
CABasicAnimation *rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
|
||||
//旋转角度
|
||||
rotationAnimation.toValue = [NSNumber numberWithFloat: M_PI];
|
||||
//每次旋转的时间(单位秒)
|
||||
rotationAnimation.duration = 0.5;
|
||||
rotationAnimation.cumulative = YES;
|
||||
rotationAnimation.removedOnCompletion = NO;
|
||||
//重复旋转的次数,如果你想要无数次,那么设置成MAXFLOAT
|
||||
rotationAnimation.repeatCount = MAXFLOAT;
|
||||
[self.openBtn.layer addAnimation:rotationAnimation forKey:@"openRedBagAnimate"];
|
||||
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
[self.openBtn.layer removeAnimationForKey:@"openRedBagAnimate"];
|
||||
|
||||
BOOL isDrawed = NO;
|
||||
if (isDrawed) {
|
||||
MJWeakSelf
|
||||
[QXMineNetwork drawRedpacketWithRedpacketId:self.redpacketModel.redpacket_id successBlock:^(NSString * _Nonnull code) {
|
||||
if (code.intValue == 1) {
|
||||
weakSelf.redpacketModel.is_qiang = @"1";
|
||||
QXRedBagRecordViewController *vc = [[QXRedBagRecordViewController alloc] init];
|
||||
vc.redbagId = @"";
|
||||
[self.viewController.navigationController pushViewController:vc animated:YES];
|
||||
[self hide];
|
||||
vc.redbagId = weakSelf.redpacketModel.redpacket_id;
|
||||
[weakSelf.viewController.navigationController pushViewController:vc animated:YES];
|
||||
[weakSelf hide];
|
||||
}else if (code.intValue == 2){
|
||||
showToast(@"您已抢过该红包");
|
||||
QXRedBagRecordViewController *vc = [[QXRedBagRecordViewController alloc] init];
|
||||
vc.redbagId = weakSelf.redpacketModel.redpacket_id;
|
||||
[weakSelf.viewController.navigationController pushViewController:vc animated:YES];
|
||||
[weakSelf hide];
|
||||
}else{
|
||||
[self setType:QXRedBagDrawTypeFinished];
|
||||
[weakSelf setType:QXRedBagDrawTypeFinished];
|
||||
}
|
||||
|
||||
});
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
showToast(msg);
|
||||
}];
|
||||
// CABasicAnimation *rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
|
||||
// //旋转角度
|
||||
// rotationAnimation.toValue = [NSNumber numberWithFloat: M_PI];
|
||||
// //每次旋转的时间(单位秒)
|
||||
// rotationAnimation.duration = 0.5;
|
||||
// rotationAnimation.cumulative = YES;
|
||||
// rotationAnimation.removedOnCompletion = NO;
|
||||
// //重复旋转的次数,如果你想要无数次,那么设置成MAXFLOAT
|
||||
// rotationAnimation.repeatCount = MAXFLOAT;
|
||||
// [self.openBtn.layer addAnimation:rotationAnimation forKey:@"openRedBagAnimate"];
|
||||
//
|
||||
// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
// [self.openBtn.layer removeAnimationForKey:@"openRedBagAnimate"];
|
||||
//
|
||||
// BOOL isDrawed = NO;
|
||||
// if (isDrawed) {
|
||||
// QXRedBagRecordViewController *vc = [[QXRedBagRecordViewController alloc] init];
|
||||
// vc.redbagId = @"";
|
||||
// [self.viewController.navigationController pushViewController:vc animated:YES];
|
||||
// [self hide];
|
||||
// }else{
|
||||
// [self setType:QXRedBagDrawTypeFinished];
|
||||
// }
|
||||
//
|
||||
// });
|
||||
|
||||
}
|
||||
-(void)recordAction{
|
||||
QXRedBagRecordViewController *vc = [[QXRedBagRecordViewController alloc] init];
|
||||
@@ -336,7 +418,38 @@
|
||||
[self.viewController.navigationController pushViewController:vc animated:YES];
|
||||
[self hide];
|
||||
}
|
||||
|
||||
-(QXRedBagDrawType)getDrawTypeWithRedpacktModel:(QXRedPacketModel*)model{
|
||||
self.drawType = QXRedBagDrawTypeOpen;
|
||||
if (model.type.intValue == 1) {
|
||||
// 普通红包
|
||||
self.drawType = QXRedBagDrawTypeOpen;
|
||||
/// 倒计时处理
|
||||
if (model.countdown.intValue > 0) {
|
||||
if ([model remainingTime]>0) {
|
||||
self.drawType = QXRedBagDrawTypeTimeDown;
|
||||
}
|
||||
}
|
||||
/// 收藏房间在先
|
||||
if ([model.conditions containsString:@"1"] && !self.isCollectedRoom){
|
||||
self.drawType = QXRedBagDrawTypeCollect;
|
||||
}
|
||||
}else{
|
||||
// 口令红包
|
||||
self.drawType = QXRedBagDrawTypePwdSend;
|
||||
if (self.isFromToComment) {
|
||||
if ([model.conditions containsString:@"1"] && !self.isCollectedRoom){
|
||||
self.drawType = QXRedBagDrawTypeCollect;
|
||||
}else{
|
||||
if ([self.redpacketModel canOpenNow]) {
|
||||
[self setType:(QXRedBagDrawTypeOpen)];
|
||||
}else{
|
||||
[self setType:QXRedBagDrawTypeTimeDown];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return self.drawType;
|
||||
}
|
||||
-(void)showInView:(UIView *)view{
|
||||
self.bgView.y = -SCREEN_HEIGHT;
|
||||
[view addSubview:self];
|
||||
@@ -348,6 +461,7 @@
|
||||
}
|
||||
|
||||
-(void)hide{
|
||||
self.redpacketModel = nil;
|
||||
[UIView animateWithDuration:0.3 delay:0 usingSpringWithDamping:0.5 initialSpringVelocity:1.0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
|
||||
self.bgView.y = SCREEN_HEIGHT;
|
||||
} completion:^(BOOL finished) {
|
||||
@@ -374,8 +488,7 @@
|
||||
self.timeLabel.text = @"收藏房间抢红包";
|
||||
}
|
||||
break;
|
||||
case QXRedBagDrawTypeTimeDown:
|
||||
case QXRedBagDrawTypePwdTimeDown:{
|
||||
case QXRedBagDrawTypeTimeDown:{
|
||||
self.timeLabel.text = @"00:00后开启红包";
|
||||
}
|
||||
break;
|
||||
@@ -383,11 +496,6 @@
|
||||
self.timeLabel.text = @"发送评论抢红包";
|
||||
}
|
||||
break;
|
||||
|
||||
case QXRedBagDrawTypePwdCollect:{
|
||||
self.timeLabel.text = @"收藏房间抢红包";
|
||||
}
|
||||
break;
|
||||
case QXRedBagDrawTypePwdAllTask:{
|
||||
self.timeLabel.text = @"完成任务抢红包";
|
||||
}
|
||||
@@ -398,7 +506,7 @@
|
||||
}
|
||||
|
||||
-(void)btnClick{
|
||||
if (self.type == QXRedBagDrawTypePwdSend || self.type == QXRedBagDrawTypePwdCollect) {
|
||||
if (self.type == QXRedBagDrawTypePwdSend || self.type == QXRedBagDrawTypeCollect) {
|
||||
if (self.btnBlcok) {
|
||||
self.btnBlcok(self.type);
|
||||
}
|
||||
|
||||
@@ -10,14 +10,20 @@
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXRedBagListView : UIView
|
||||
@property (nonatomic,strong)NSMutableArray *dataArray;
|
||||
@property (nonatomic,strong)NSArray <QXRedPacketModel*>*dataArray;
|
||||
@property (nonatomic,copy)void(^didSelectedRedBlock)(QXRedPacketModel*model);
|
||||
-(void)showInView:(UIView *)view;
|
||||
-(void)hide;
|
||||
@property (nonatomic,copy)void(^didSelectedRedBlock)(void);
|
||||
-(void)updateRedpacketTimeWithIndex:(NSInteger)index time:(long)time;
|
||||
@end
|
||||
|
||||
@interface QXRedBagListCell : UICollectionViewCell
|
||||
@property (nonatomic,strong)QXRedPacketModel* redpacketModel;
|
||||
@property (nonatomic,strong)UIImageView *redBagImageView;
|
||||
@property (nonatomic,strong)UIImageView *pwdImageView;
|
||||
@property (nonatomic,strong)UILabel *timeLabel;
|
||||
@property (nonatomic,strong)UILabel *nameLabel;
|
||||
@property (nonatomic,assign)long endTime;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
}
|
||||
|
||||
-(void)initSubviews{
|
||||
self.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.3];
|
||||
self.bigBgView = [[UIView alloc] initWithFrame:CGRectMake((SCREEN_WIDTH-375)/2, (SCREEN_HEIGHT-480)/2, 375, 480)];
|
||||
[self addSubview:self.bigBgView];
|
||||
|
||||
@@ -40,7 +41,7 @@
|
||||
[self.bigBgView addSubview:self.bgView];
|
||||
[self.bgView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(280);
|
||||
make.height.mas_equalTo(252);
|
||||
make.height.mas_equalTo(272);
|
||||
make.centerX.equalTo(self.bigBgView);
|
||||
make.top.mas_equalTo(60);
|
||||
}];
|
||||
@@ -72,7 +73,7 @@
|
||||
|
||||
|
||||
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
|
||||
layout.itemSize = CGSizeMake(66,66);
|
||||
layout.itemSize = CGSizeMake(66,86);
|
||||
layout.minimumLineSpacing =20;
|
||||
layout.minimumInteritemSpacing =16;
|
||||
layout.scrollDirection = UICollectionViewScrollDirectionVertical;
|
||||
@@ -92,15 +93,19 @@
|
||||
make.top.mas_equalTo(156);
|
||||
}];
|
||||
}
|
||||
-(void)setDataArray:(NSMutableArray *)dataArray{
|
||||
-(void)updateRedpacketTimeWithIndex:(NSInteger)index time:(long)time{
|
||||
QXRedBagListCell *cell = [self.collectionView cellForItemAtIndexPath:[NSIndexPath indexPathForRow:index inSection:0]];
|
||||
cell.endTime = time;
|
||||
}
|
||||
-(void)setDataArray:(NSArray<QXRedPacketModel *> *)dataArray{
|
||||
_dataArray = dataArray;
|
||||
if (dataArray.count >3) {
|
||||
[self.bgView mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(338);
|
||||
make.height.mas_equalTo(358);
|
||||
}];
|
||||
}else{
|
||||
[self.bgView mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(252);
|
||||
make.height.mas_equalTo(272);
|
||||
}];
|
||||
}
|
||||
[self.collectionView reloadData];
|
||||
@@ -110,11 +115,13 @@
|
||||
}
|
||||
-(__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
|
||||
QXRedBagListCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"QXRedBagListCell" forIndexPath:indexPath];
|
||||
cell.redpacketModel = self.dataArray[indexPath.row];
|
||||
return cell;
|
||||
}
|
||||
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
|
||||
QXRedPacketModel *model = self.dataArray[indexPath.row];
|
||||
if (self.didSelectedRedBlock) {
|
||||
self.didSelectedRedBlock();
|
||||
self.didSelectedRedBlock(model);
|
||||
}
|
||||
[self hide];
|
||||
}
|
||||
@@ -152,12 +159,69 @@
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void)setRedpacketModel:(QXRedPacketModel *)redpacketModel{
|
||||
_redpacketModel = redpacketModel;
|
||||
self.redBagImageView.image = [UIImage imageNamed:redpacketModel.is_qiang.intValue==1?@"red_bag_list_is_get_icon":@"red_bag_list_icon"];
|
||||
self.pwdImageView.hidden = redpacketModel.type.intValue!=2;
|
||||
self.nameLabel.text = redpacketModel.nickname;
|
||||
if (self.redpacketModel.countdown.intValue==0) {
|
||||
self.timeLabel.hidden = YES;
|
||||
}
|
||||
}
|
||||
-(void)setEndTime:(long)endTime{
|
||||
if (self.redpacketModel.countdown.intValue==0) {
|
||||
self.timeLabel.hidden = YES;
|
||||
return;
|
||||
}
|
||||
if (endTime<=0) {
|
||||
self.timeLabel.hidden = YES;
|
||||
return;
|
||||
}
|
||||
self.timeLabel.hidden = NO;
|
||||
NSInteger min = (endTime % 3600) / 60;
|
||||
NSInteger second = endTime % 60;
|
||||
self.timeLabel.text = [NSString stringWithFormat:@" %02ld:%02ld ",min,second];
|
||||
|
||||
}
|
||||
-(void)initSubviews{
|
||||
self.redBagImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"red_bag_list_icon"]];
|
||||
[self.contentView addSubview:self.redBagImageView];
|
||||
[self.redBagImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.equalTo(self.contentView);
|
||||
make.top.mas_equalTo(4);
|
||||
make.height.mas_equalTo(66);
|
||||
make.width.mas_equalTo(66);
|
||||
make.centerX.equalTo(self.contentView);
|
||||
}];
|
||||
|
||||
self.pwdImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"red_bag_list_pwd_icon"]];
|
||||
[self.contentView addSubview:self.pwdImageView];
|
||||
[self.pwdImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.top.equalTo(self.contentView);
|
||||
make.width.mas_equalTo(34);
|
||||
make.height.mas_equalTo(18);
|
||||
}];
|
||||
|
||||
self.timeLabel = [[UILabel alloc] init];
|
||||
self.timeLabel.textColor = RGB16(0xffffff);
|
||||
[self.timeLabel addRoundedCornersWithRadius:6];
|
||||
self.timeLabel.hidden = YES;
|
||||
self.timeLabel.backgroundColor = RGB16A(0x000000, 0.25);
|
||||
self.timeLabel.font = [UIFont systemFontOfSize:12];
|
||||
[self.contentView addSubview:self.timeLabel];
|
||||
[self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.bottom.equalTo(self.redBagImageView);
|
||||
make.centerX.equalTo(self.contentView);
|
||||
make.height.mas_equalTo(12);
|
||||
}];
|
||||
|
||||
self.nameLabel = [[UILabel alloc] init];
|
||||
self.nameLabel.textColor = RGB16(0xD04248);
|
||||
self.nameLabel.font = [UIFont systemFontOfSize:12];
|
||||
[self.contentView addSubview:self.nameLabel];
|
||||
[self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.bottom.equalTo(self.contentView);
|
||||
make.centerX.equalTo(self.contentView);
|
||||
make.height.mas_equalTo(12);
|
||||
}];
|
||||
}
|
||||
|
||||
|
||||
@@ -39,6 +39,8 @@
|
||||
@property (nonatomic,strong)NSString *redBagTime;
|
||||
/// 条件 0 无 1 收藏房间 2 仅麦上用户 多条件时用,隔开
|
||||
@property (nonatomic,strong)NSString *conditions;
|
||||
@property (nonatomic,strong)NSString *coin;
|
||||
@property (nonatomic,strong)NSString *earnings;
|
||||
|
||||
|
||||
@property (nonatomic,strong)UIView* nextContentView;
|
||||
@@ -93,7 +95,7 @@
|
||||
/// 无限制条件
|
||||
self.conditions = @"0";
|
||||
self.timeArray = @[@0,@1,@2,@5,@10];
|
||||
|
||||
self.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.3];
|
||||
self.bgView = [[UIView alloc] initWithFrame:CGRectMake((SCREEN_WIDTH-345)/2, (SCREEN_HEIGHT-454)/2, 345, 454)];
|
||||
[self addSubview:self.bgView];
|
||||
|
||||
@@ -172,8 +174,20 @@
|
||||
[self initNextContentView];
|
||||
|
||||
[self initRuleView];
|
||||
|
||||
[self getMyWallet];
|
||||
}
|
||||
|
||||
-(void)getMyWallet{
|
||||
MJWeakSelf
|
||||
[QXMineNetwork getWalletInfoSuccessBlock:^(NSString * _Nonnull coin, NSString * _Nonnull earnings, NSString * _Nonnull title, NSString * _Nonnull url) {
|
||||
weakSelf.coin = coin;
|
||||
weakSelf.earnings = coin;
|
||||
weakSelf.moneyLabel.text = [NSString stringWithFormat:@"%@金币可用",self.coin];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
|
||||
}];
|
||||
}
|
||||
|
||||
-(void)initFirstContentView{
|
||||
self.firstContentView = [[UIView alloc] init];
|
||||
@@ -484,6 +498,7 @@
|
||||
pwdTextField.textColor = RGB16(0x666666);
|
||||
pwdTextField.textAlignment = NSTextAlignmentRight;
|
||||
pwdTextField.returnKeyType = UIReturnKeyDone;
|
||||
pwdTextField.keyboardType = UIKeyboardTypeNumberPad;
|
||||
pwdTextField.placeholder = @"请输入红包金额";
|
||||
self.moneyTextField = pwdTextField;
|
||||
[topBgView addSubview:pwdTextField];
|
||||
@@ -538,6 +553,7 @@
|
||||
countTextField.textAlignment = NSTextAlignmentRight;
|
||||
countTextField.returnKeyType = UIReturnKeyDone;
|
||||
countTextField.placeholder = @"请输入红包数量";
|
||||
countTextField.keyboardType = UIKeyboardTypeNumberPad;
|
||||
self.countTextField = countTextField;
|
||||
[countBgView addSubview:countTextField];
|
||||
[countTextField mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
@@ -728,7 +744,6 @@
|
||||
showToast(@"红包数量不能大于红包金额");
|
||||
return;
|
||||
}
|
||||
self.conditions = @"1";
|
||||
[QXMineNetwork createRedpacketWithType:self.redBagType
|
||||
password:self.pwdTextField.text
|
||||
coin_type:self.redBagContentType
|
||||
@@ -737,10 +752,12 @@
|
||||
conditions:self.conditions
|
||||
countdown:self.redBagTime
|
||||
room_id:self.room_id
|
||||
remark:self.remarkTextField.text
|
||||
successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
|
||||
showToast(@"发送成功");
|
||||
[self hide];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
|
||||
showToast(msg);
|
||||
}];
|
||||
}
|
||||
|
||||
@@ -823,6 +840,7 @@
|
||||
}];
|
||||
self.coinRedBagBtn.selected = YES;
|
||||
self.redBagContentType = @"1";
|
||||
self.moneyLabel.text = [NSString stringWithFormat:@"%@金币可用",self.coin];
|
||||
}else{
|
||||
self.coinRedBagBtn.selected = NO;
|
||||
[self.scrollBgView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
@@ -831,6 +849,7 @@
|
||||
}];
|
||||
self.diamondRedBagBtn.selected = YES;
|
||||
self.redBagContentType = @"2";
|
||||
self.moneyLabel.text = [NSString stringWithFormat:@"%@钻石可用",self.earnings];
|
||||
}
|
||||
}
|
||||
-(void)drawAuthAction:(UIButton*)sender{
|
||||
@@ -838,14 +857,12 @@
|
||||
self.noDrawAuthBtn.selected = YES;
|
||||
self.collectDrawAuthBtn.selected = NO;
|
||||
self.upSeatDrawAuthBtn.selected = NO;
|
||||
self.conditions = @"0";
|
||||
}else if (sender == self.collectDrawAuthBtn) {
|
||||
self.collectDrawAuthBtn.selected = !self.collectDrawAuthBtn.selected;
|
||||
if (self.upSeatDrawAuthBtn.selected || self.collectDrawAuthBtn.selected) {
|
||||
self.noDrawAuthBtn.selected = NO;
|
||||
}else{
|
||||
self.noDrawAuthBtn.selected = YES;
|
||||
self.conditions = @"0";
|
||||
}
|
||||
}else if (sender == self.upSeatDrawAuthBtn) {
|
||||
self.noDrawAuthBtn.selected = NO;
|
||||
@@ -854,6 +871,17 @@
|
||||
self.noDrawAuthBtn.selected = NO;
|
||||
}else{
|
||||
self.noDrawAuthBtn.selected = YES;
|
||||
}
|
||||
}
|
||||
|
||||
if (self.collectDrawAuthBtn.selected && self.upSeatDrawAuthBtn.selected) {
|
||||
self.conditions = @"1,2";
|
||||
}else{
|
||||
if (self.collectDrawAuthBtn.selected) {
|
||||
self.conditions = @"1";
|
||||
}else if (self.upSeatDrawAuthBtn.selected) {
|
||||
self.conditions = @"2";
|
||||
}else{
|
||||
self.conditions = @"0";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,15 +29,13 @@
|
||||
}
|
||||
|
||||
-(void)initSubviews{
|
||||
|
||||
|
||||
self.imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"redbag_tag_icon"]];
|
||||
self.imageView.frame = CGRectMake(0, 0, self.redTagHeight, self.redTagWidth);
|
||||
[self addSubview:self.imageView];
|
||||
|
||||
self.countLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.width, 20)];
|
||||
self.countLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 10, self.width-10, 20)];
|
||||
self.countLabel.textAlignment = NSTextAlignmentRight;
|
||||
self.countLabel.font = [UIFont boldSystemFontOfSize:14];
|
||||
self.countLabel.font = [UIFont boldSystemFontOfSize:18];
|
||||
self.countLabel.textColor = RGB16(0xFFFEB2);
|
||||
[self addSubview:self.countLabel];
|
||||
|
||||
@@ -49,7 +47,7 @@
|
||||
[self addGestureRecognizer:panRecognizer];
|
||||
}
|
||||
-(void)btnClick{
|
||||
BOOL isList = self.count.intValue>0?YES:NO;
|
||||
BOOL isList = self.count.intValue>1?YES:NO;
|
||||
if (self.startBlock) {
|
||||
self.startBlock(isList);
|
||||
}
|
||||
@@ -57,6 +55,11 @@
|
||||
-(void)setCount:(NSString *)count{
|
||||
_count = count;
|
||||
self.countLabel.text = [NSString stringWithFormat:@"x%@",count];
|
||||
if (count.intValue == 0) {
|
||||
self.hidden = YES;
|
||||
}else{
|
||||
self.hidden = NO;
|
||||
}
|
||||
}
|
||||
|
||||
-(void)handlePan:(UIPanGestureRecognizer*)recognizer{
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#import "QXGiftDriftView.h"
|
||||
#import "QXMeetActivityDriftView.h"
|
||||
#import "QXDrifRoomHourRankView.h"
|
||||
#import "QXRedPacketDriftView.h"
|
||||
|
||||
@interface QXRoomSettingView()<UIGestureRecognizerDelegate,UITableViewDelegate,UITableViewDataSource,QXRoomSettingViewDelegate>
|
||||
@property (nonatomic,strong)UIView *bgView;
|
||||
@@ -680,6 +681,7 @@
|
||||
[[QXGiftDriftView shareView] drifPopIsClose:model.isSelected];
|
||||
[[QXMeetActivityDriftView shareView] drifPopIsClose:model.isSelected];
|
||||
[[QXDrifRoomHourRankView shareView] drifPopIsClose:model.isSelected];
|
||||
[[QXRedPacketDriftView shareView] drifPopIsClose:model.isSelected];
|
||||
return;
|
||||
}
|
||||
if (model.type == QXRoomSettingTypeRoomOrderMic) {
|
||||
|
||||
Reference in New Issue
Block a user