This commit is contained in:
启星
2025-10-15 17:21:09 +08:00
parent 3ba569dfa3
commit 2b477e8912
51 changed files with 1306 additions and 249 deletions

View File

@@ -14,6 +14,7 @@ NS_ASSUME_NONNULL_BEGIN
@end
@interface QXRedBagRecordCell : UITableViewCell
@property (nonatomic,strong)QXDrawRedpacketRecordModel *recordModel;
+(instancetype)cellWithTabelView:(UITableView*)tableView;
@end
NS_ASSUME_NONNULL_END

View File

@@ -6,6 +6,7 @@
//
#import "QXRedBagRecordViewController.h"
#import "QXMineNetwork.h"
@class QXRedBagRecordCell;
@interface QXRedBagRecordViewController ()<UITableViewDataSource,UITableViewDelegate>
@property (nonatomic,strong)UIView *topView;
@@ -18,6 +19,7 @@
@property (nonatomic,strong)UILabel *countLabel;
@property (nonatomic,strong)UITableView *tableView;
@property (nonatomic,strong)QXDrawRedPacketModel *model;
@end
@implementation QXRedBagRecordViewController
@@ -40,10 +42,10 @@
self.senderNameLabel = [[UILabel alloc] init];
self.senderNameLabel.textColor = RGB16(0xffffff);
self.senderNameLabel.font = [UIFont systemFontOfSize:18];
self.senderNameLabel.text = @"傻狗涛的红包";
self.senderNameLabel.text = @"-";
[self.topView addSubview:self.senderNameLabel];
[self.senderNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self.topView).offset(41);;
make.centerX.equalTo(self.topView).offset(41-13);;
make.top.equalTo(self.topView).offset(92);
}];
@@ -58,7 +60,7 @@
}];
self.remarkLabel = [[UILabel alloc] init];
self.remarkLabel.text = @"恭喜发财大吉大利";
self.remarkLabel.text = @"-";
self.remarkLabel.textColor = RGB16(0xffffff);
self.remarkLabel.font = [UIFont systemFontOfSize:13];
[self.topView addSubview:self.remarkLabel];
@@ -71,7 +73,7 @@
self.moneyLabel = [[UILabel alloc] init];
self.moneyLabel.font = [UIFont boldSystemFontOfSize:19];
self.moneyLabel.textColor = RGB16(0xffffff);
self.moneyLabel.text = @"5000金币";
self.moneyLabel.text = @"0金币";
[self.topView addSubview:self.moneyLabel];
[self.moneyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self.topView);
@@ -80,7 +82,7 @@
self.bottomLabel = [[UILabel alloc] init];
self.bottomLabel.textColor = RGB16(0xffffff);
self.bottomLabel.text = @"已存入金币";
self.bottomLabel.text = @"已存入钱包";
self.bottomLabel.font = [UIFont systemFontOfSize:13];
[self.topView addSubview:self.bottomLabel];
[self.bottomLabel mas_makeConstraints:^(MASConstraintMaker *make) {
@@ -126,14 +128,41 @@
[backBtn addTarget:self action:@selector(backAction) forControlEvents:(UIControlEventTouchUpInside)];
[self.view addSubview:backBtn];
}
-(void)setRedbagId:(NSString *)redbagId{
_redbagId = redbagId;
MJWeakSelf
[QXMineNetwork getRedpacketRecordWithRedpacketId:redbagId successBlock:^(QXDrawRedPacketModel* model) {
weakSelf.model = model;
weakSelf.remarkLabel.text = model.redpacket_info.remark;
[weakSelf.senderHeaderImageView sd_setImageWithURL:[NSURL URLWithString:model.redpacket_info.avatar]];
weakSelf.senderNameLabel.text = [NSString stringWithFormat:@"%@的红包",model.redpacket_info.nickname];
NSString *coinStr = @"";
if (weakSelf.model.redpacket_info.coin_type.intValue == 1) {
weakSelf.bottomLabel.text = @"已存入金币";
coinStr = [NSString stringWithFormat:@"%@%@",model.my_record.amount,@"金币"];
}else{
weakSelf.bottomLabel.text = @"已存入钻石";
coinStr = [NSString stringWithFormat:@"%@%@",model.my_record.amount,@"钻石"];
}
NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:coinStr];
[attr yy_setFont:[UIFont boldSystemFontOfSize:46] range:[coinStr rangeOfString:[NSString stringWithFormat:@"%@",model.my_record.amount]]];
weakSelf.moneyLabel.attributedText = attr;
weakSelf.countLabel.text = [NSString stringWithFormat:@"已领取%ld/%@",model.redpacket_info.total_count.integerValue-model.redpacket_info.left_count.integerValue,model.redpacket_info.total_count];
[weakSelf.tableView reloadData];
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
}];
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
return 1;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return self.dataArray.count;
return self.model.records.count;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
QXRedBagRecordCell *cell = [QXRedBagRecordCell cellWithTabelView:tableView];
cell.recordModel = self.model.records[indexPath.row];
return cell;
}
-(void)backAction{
@@ -172,6 +201,13 @@
}
return self;
}
-(void)setRecordModel:(QXDrawRedpacketRecordModel *)recordModel{
_recordModel = recordModel;
self.nameLabel.text = recordModel.nickname;
[self.userHeaderImageView sd_setImageWithURL:[NSURL URLWithString:recordModel.avatar]];
self.timeLabel.text = recordModel.createtime;
self.moneyLabel.text = recordModel.amount;
}
-(void)initSubviews{
self.bgView = [[UIView alloc] init];
[self.contentView addSubview:self.bgView];

View File

@@ -0,0 +1,16 @@
//
// QXRoomViewController+Activity.h
// QXLive
//
// Created by 启星 on 2025/10/15.
//
#import "QXRoomViewController.h"
NS_ASSUME_NONNULL_BEGIN
@interface QXRoomViewController (Activity)
-(void)initActivityObeserver;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,36 @@
//
// QXRoomViewController+Activity.m
// QXLive
//
// Created by on 2025/10/15.
//
#import "QXRoomViewController+Activity.h"
#import "QXMeetActivityDriftView.h"
@implementation QXRoomViewController (Activity)
-(void)initActivityObeserver{
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateProgress:) name:noticeXLHNotice object:nil];
}
-(void)updateProgress:(NSNotification *)notice{
QXMeetActivityDriftModel *model = notice.object;
if (model.from_type == QXMeetActivityTypeAcLock) {
[self.meetView updateUserAndGiftInfoWithModel:model];
self.acTagView.end_time = model.end_time.longLongValue;
return;
}
if (model.from_type == QXMeetActivityTypeAcProgress) {
[self.skyView updateProgress:model.xlh_data];
[self.ageView updateProgress:model.xlh_data];
[self.timeView updateProgress:model.xlh_data];
}
if (model.xlh_data.status.intValue == 1) {
self.acTagView.end_time = model.xlh_data.end_time;
[self.view addSubview:self.acTagView];
}else{
[self.acTagView stopTimer];
[self.acTagView removeFromSuperview];
}
}
@end

View File

@@ -115,7 +115,7 @@
}
-(void)meetActivityGiftInfoIsUpdate:(QXRoomChatListModel *)giftInfo{
[self.meetView updateUserAndGiftInfoWithModel:giftInfo];
self.acTagView.end_time = giftInfo.end_time.longLongValue;
// [self.meetView updateUserAndGiftInfoWithModel:giftInfo];
// self.acTagView.end_time = giftInfo.end_time.longLongValue;
}
@end

View File

@@ -9,27 +9,95 @@
#import "QXMineNetwork.h"
@implementation QXRoomViewController (RedPacket)
-(void)recievedRedPacket:(QXRedPacketModel *)model{
self.redBagTagView.hidden = NO;
[[QXRedPacketManager sharedManager] addRedPacket:model];
}
-(void)initRedpacketManager{
[QXRedPacketManager sharedManager].delegate = self;
[[QXRedPacketManager sharedManager] startCheckTimer];
//
[self getRedBagList];
}
-(void)getRedBagList{
// [QXMineNetwork ];
MJWeakSelf
[QXMineNetwork getRedpacketListWithRoomId:self.roomId successBlock:^(NSArray<QXRedPacketModel *> * _Nonnull list) {
if (list.count > 0) {
weakSelf.redBagTagView.count = [NSString stringWithFormat:@"%ld",list.count];
weakSelf.redBagTagView.hidden = NO;
[[QXRedPacketManager sharedManager] addRedPackets:list];
}else{
[[QXRedPacketManager sharedManager] removeAllRedpackets];
}
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
}];
}
#pragma mark - QXRedPacketManagerDelegate
///
-(void)QXRedPacketManager:(QXRedPacketManager *)manager didAddRedPacket:(QXRedPacketModel *)redPacket{
}
///
- (void)QXRedPacketManager:(QXRedPacketManager *)manager didRemoveRedPacket:(NSString *)packetId {
-(void)QXRedPacketManager:(QXRedPacketManager *)manager didAddRedPacket:(QXRedPacketModel *)redPacket remainingCount:(NSInteger)remainingCount{
self.redBagTagView.count = [NSString stringWithFormat:@"%ld",remainingCount];
}
///
- (void)QXRedPacketManager:(QXRedPacketManager *)manager didUpdateRedPacket:(QXRedPacketModel *)redPacket {
- (void)QXRedPacketManager:(QXRedPacketManager *)manager didRemoveRedPacket:(NSString *)packetId remainingCount:(NSInteger)remainingCount{
self.redBagTagView.count = [NSString stringWithFormat:@"%ld",remainingCount];
}
///
- (void)QXRedPacketManager:(QXRedPacketManager *)manager didUpdateRedPacket:(QXRedPacketModel *)redPacket remainingCount:(NSInteger)remainingCount{
if (self.redbagDrawView.redpacketModel != nil && self.redbagDrawView.redpacketModel.countdown > 0) {
if (self.redbagDrawView.redpacketModel.type.intValue == 1) {
[self.redbagDrawView changeViewType:(QXRedBagDrawTypeOpen)];
}else{
if (self.redbagDrawView.isFromToComment) {
[self.redbagDrawView changeViewType:(QXRedBagDrawTypeOpen)];
}
}
}
}
- (void)QXRedPacketManager:(QXRedPacketManager *)manager didAddRedPackets:(NSArray<QXRedPacketModel *> *)redPackets remainingCount:(NSInteger)remainingCount{
self.redBagTagView.count = [NSString stringWithFormat:@"%ld",remainingCount];
}
- (void)QXRedPacketManager:(QXRedPacketManager *)manager didUpdateRedPacketTime:(long)time redPacket:(QXRedPacketModel *)redPacket {
///
if (self.redbagDrawView.redpacketModel != nil && self.redbagDrawView.redpacketModel.countdown > 0 && time>=0) {
if (self.redbagDrawView.redpacketModel.type.intValue == 1) {
//
if ([self.redbagDrawView.redpacketModel.conditions containsString:@"1"]) {
//
if (self.roomModel.user_info.is_collect.intValue == 1) {
///
self.redbagDrawView.needTime = time;
}
}else{
self.redbagDrawView.needTime = time;
}
}else{
if (self.redbagDrawView.isFromToComment) {
//
if ([self.redbagDrawView.redpacketModel.conditions containsString:@"1"]) {
//
if (self.roomModel.user_info.is_collect.intValue == 1) {
///
self.redbagDrawView.needTime = time;
}
}else{
self.redbagDrawView.needTime = time;
}
}
}
}
///
if (self.redbagListView.dataArray.count > 0) {
NSInteger index = [self.redbagListView.dataArray indexOfObject:redPacket];
[self.redbagListView updateRedpacketTimeWithIndex:index time:time];
}
}
@end

View File

@@ -20,6 +20,11 @@
#import "QXTimePraizeView.h"/// 时空之巅
#import "QXMeetActivityView.h"
#import "QXActivityTagView.h"
/// 红包
#import "QXRedBagTagView.h"
#import "QXRedBagDrawView.h"
#import "QXRedBagListView.h"
NS_ASSUME_NONNULL_BEGIN
@interface QXRoomViewController : QXBaseViewController<QXRoomMessageManagerDelegate,QXRoomSeatDelegate>
@@ -39,6 +44,11 @@ NS_ASSUME_NONNULL_BEGIN
/// 发送礼物
@property (nonatomic,strong)QXSendGiftView *sendGiftView;
/// 红包入口
@property (nonatomic,strong)QXRedBagTagView *redBagTagView;
@property (nonatomic,strong)QXRedBagDrawView *redbagDrawView;
@property (nonatomic,strong)QXRedBagListView *redbagListView;
@property (nonatomic,strong)QXActivityTagView *acTagView;
@property (nonatomic,strong)QXSkyPraizeView *skyView;

View File

@@ -31,10 +31,9 @@
#import "QXRoomViewController+Friend.h"
#import "QXAllRoomHourRankView.h"
#import "QXRedBagSendView.h"
#import "QXRedBagTagView.h"
#import "QXRedBagDrawView.h"
#import "QXRedBagListView.h"
#import "QXRoomViewController+RedPacket.h"
#import "QXRoomViewController+Activity.h"
#import "QXRedBagRecordViewController.h"
@interface QXRoomViewController ()<
QXRoomBottomViewDelegate,
@@ -82,10 +81,7 @@ QXRoomUserInfoViewDelegate
@property (nonatomic,strong)QXAllRoomHourRankView *hourRankView;
@property (nonatomic,strong)QXAllRoomHourRankTagView *hourRankIconView;
///
@property (nonatomic,strong)QXRedBagTagView *redBagTagView;
@property (nonatomic,strong)QXRedBagDrawView *redbagDrawView;
@property (nonatomic,strong)QXRedBagListView *redbagListView;
@end
@implementation QXRoomViewController
@@ -137,6 +133,7 @@ QXRoomUserInfoViewDelegate
-(void)initSubViews{
// [self updateBgImage:@"room_background"];
[self initActivityObeserver];
self.bgImageHidden = YES;
self.roomBgImageView = [[UIImageView alloc] initWithFrame:self.view.bounds];
// self.roomBgImageView.image = [UIImage imageNamed:@"room_background"];
@@ -1376,7 +1373,9 @@ QXRoomUserInfoViewDelegate
}
-(void)didSendMessage:(NSString *)message redpacketModel:(nonnull QXRedPacketModel *)redpacketModel{
if (redpacketModel) {
self.redbagDrawView.type = QXRedBagDrawTypeOpen;
// self.redbagDrawView.type = QXRedBagDrawTypeOpen;
self.redbagDrawView.isFromToComment = YES;
self.redbagDrawView.redpacketModel = redpacketModel;
[self.redbagDrawView showInView:self.view];
}
}
@@ -1496,6 +1495,7 @@ QXRoomUserInfoViewDelegate
break;
case QXRoomSettingTypeSendRedBag:{
QXRedBagSendView *redbagView = [[QXRedBagSendView alloc] init];
redbagView.room_id = self.roomId;
[redbagView showInView:self.view];
}
break;
@@ -1929,15 +1929,24 @@ QXRoomUserInfoViewDelegate
-(QXRedBagTagView *)redBagTagView{
if (!_redBagTagView) {
_redBagTagView = [[QXRedBagTagView alloc] init];
_redBagTagView.hidden = YES;
MJWeakSelf
_redBagTagView.startBlock = ^(BOOL isList) {
weakSelf.redbagListView.dataArray = @[@"",@"",@"",@"",@""];
[weakSelf.redbagListView showInView:weakSelf.view];
return;
if (isList) {
weakSelf.redbagListView.dataArray = [QXRedPacketManager sharedManager].allRedPackets;
[weakSelf.redbagListView showInView:weakSelf.view];
}else{
[weakSelf.redbagDrawView showInView:weakSelf.view];
QXRedPacketModel *model = [QXRedPacketManager sharedManager].allRedPackets.firstObject;
if (model.is_qiang.intValue == 1) {
QXRedBagRecordViewController *vc = [[QXRedBagRecordViewController alloc] init];
vc.redbagId = model.redpacket_id;
[weakSelf.navigationController pushViewController:vc animated:YES];
}else{
weakSelf.redbagDrawView.isFromToComment = NO;
weakSelf.redbagDrawView.isCollectedRoom = weakSelf.roomModel.user_info.is_collect.intValue==1;
weakSelf.redbagDrawView.redpacketModel = model;
[weakSelf.redbagDrawView showInView:weakSelf.view];
}
}
};
}
@@ -1946,10 +1955,14 @@ QXRoomUserInfoViewDelegate
-(QXRedBagDrawView *)redbagDrawView{
if (!_redbagDrawView) {
_redbagDrawView = [[QXRedBagDrawView alloc] init];
_redbagDrawView.room_id = self.roomId;
MJWeakSelf
_redbagDrawView.toInputPwdBlock = ^(NSString * _Nonnull password, QXRedPacketModel * _Nonnull redpacketModel) {
[weakSelf.bottomView inputMessageWithName:password redpacketModel:redpacketModel];
};
_redbagDrawView.collectRoomBlock = ^{
[weakSelf.titleView setRoomCollect:YES];
};
}
return _redbagDrawView;
}
@@ -1957,10 +1970,17 @@ QXRoomUserInfoViewDelegate
if (!_redbagListView) {
_redbagListView = [[QXRedBagListView alloc] init];
MJWeakSelf
_redbagListView.didSelectedRedBlock = ^{
weakSelf.redbagDrawView.redpacketModel = [QXRedPacketModel new];
weakSelf.redbagDrawView.type = QXRedBagDrawTypePwdSend;
[weakSelf.redbagDrawView showInView:weakSelf.view];
_redbagListView.didSelectedRedBlock = ^(QXRedPacketModel * _Nonnull model) {
if (model.is_qiang.intValue == 1) {
QXRedBagRecordViewController *vc = [[QXRedBagRecordViewController alloc] init];
vc.redbagId = model.redpacket_id;
[weakSelf.navigationController pushViewController:vc animated:YES];
}else{
weakSelf.redbagDrawView.isFromToComment = NO;
weakSelf.redbagDrawView.isCollectedRoom = weakSelf.roomModel.user_info.is_collect.intValue==1;
weakSelf.redbagDrawView.redpacketModel = model;
[weakSelf.redbagDrawView showInView:weakSelf.view];
}
};
}

View File

@@ -8,22 +8,77 @@
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@class QXDrawRedpacketRecordModel,QXRedpacketStatisticsModel;
@interface QXRedPacketModel : NSObject
@property (nonatomic, strong) NSString *redpacket_id; // 红包唯一ID
/// 红包唯一ID
@property (nonatomic, strong) NSString *redpacket_id;
/// 口令
@property (nonatomic, strong) NSString *password;
/// 倒计时 截止时间 为0时是立刻
@property (nonatomic, strong) NSString *countdown;
/// 红包总金额
@property (nonatomic, strong) NSString* total_amount;
@property (nonatomic, assign) NSInteger type; // 红包类型
@property (nonatomic, assign) long long end_time; // 倒计时时间(秒)
@property (nonatomic, assign) CGFloat amount; // 红包金额
@property (nonatomic, strong) NSDate *createTime; // 创建时间
@property (nonatomic, assign) BOOL isAvailable; // 是否可领取
@property (nonatomic, assign) NSInteger position; // 在房间中的位置标识
/// 房间id
@property (nonatomic, strong) NSString* room_id;
/// 红包类型 1 普通红包 2 口令红包
@property (nonatomic, strong) NSString* type;
/// 红包总数
@property (nonatomic, strong) NSString *total_count;
/// 1 金币红包 2 钻石红包
@property (nonatomic, strong) NSString *coin_type;
/// 用户id
@property (nonatomic, strong) NSString *user_id;
/// 用户昵称
@property (nonatomic, strong) NSString *nickname;
/// 用户头像
@property (nonatomic, strong) NSString *avatar;
/// 红包多久后消失
@property (nonatomic, strong) NSString *redpacket_time;
/// 条件
@property (nonatomic, strong) NSString *conditions;
/// 红包备注
@property (nonatomic, strong) NSString *remark;
/// 红包可以开抢的时间 为时间戳
@property (nonatomic, assign) long start_time; // 倒计时时间(秒)
/// 剩余金额
@property (nonatomic, strong) NSString *left_amount;
/// 剩余数量
@property (nonatomic, strong) NSString *left_count;
/// 是否已经抢过该红包 1- 是 0-没有抢过
@property (nonatomic, strong) NSString *is_qiang;
// 计算剩余时间
/// 是否可领取
@property (nonatomic, assign) BOOL isAvailable;
/// 计算剩余时间
- (long)remainingTime;
// 检查是否可领取
/// 检查是否可领取
- (BOOL)canOpenNow;
@end
@interface QXDrawRedPacketModel : NSObject
@property (nonatomic,strong)QXRedPacketModel* redpacket_info;
@property (nonatomic,strong)QXDrawRedpacketRecordModel* my_record;
@property (nonatomic,strong)NSArray<QXDrawRedpacketRecordModel*>* records;
@end
@interface QXDrawRedpacketRecordModel : NSObject
/// 房间id
@property (nonatomic, strong) NSString* record_id;
/// 红包id
@property (nonatomic, strong) NSString* redpacket_id;
/// 用户id
@property (nonatomic, strong) NSString* user_id;
/// 头像
@property (nonatomic, strong) NSString* avatar;
/// 昵称
@property (nonatomic, strong) NSString* nickname;
/// 抢红包时间
@property (nonatomic, strong) NSString* createtime;
/// 金额
@property (nonatomic, strong) NSString* amount;
@end
NS_ASSUME_NONNULL_END

View File

@@ -13,7 +13,7 @@
NSTimeInterval timeInterval = [[NSDate date] timeIntervalSince1970];
//
long long milliseconds = (long long)(timeInterval);
needTime = self.end_time - milliseconds;
needTime = self.start_time - milliseconds;
return needTime;
}
@@ -21,3 +21,20 @@
return [self remainingTime] <= 0;
}
@end
@implementation QXDrawRedPacketModel
+(NSDictionary<NSString *,id> *)modelContainerPropertyGenericClass{
return @{
@"redpacket_info": @"QXRedPacketModel",
@"my_record": @"QXDrawRedpacketRecordModel",
@"records": @"QXDrawRedpacketRecordModel",
};
}
@end
@implementation QXDrawRedpacketRecordModel
@end

View File

@@ -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

View File

@@ -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) {
}];

View File

@@ -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

View File

@@ -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);
}

View File

@@ -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

View File

@@ -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);
}];
}

View File

@@ -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";
}
}

View File

@@ -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{

View File

@@ -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) {