房间内打开红包结果

This commit is contained in:
chenguilong
2022-09-02 18:59:36 +08:00
parent aff335cf1b
commit 7a62e30277
46 changed files with 1244 additions and 92 deletions

View File

@@ -163,6 +163,11 @@
9B3A1DF4280571000058E2DD /* XPAnchorPKInviteView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B3A1DF3280571000058E2DD /* XPAnchorPKInviteView.m */; };
9B41D36E282649230048C588 /* XPWeekStarRankUserModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B41D36D282649230048C588 /* XPWeekStarRankUserModel.m */; };
9B41D37128264E320048C588 /* XPWeekStarInfoView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B41D37028264E320048C588 /* XPWeekStarInfoView.m */; };
9B42868E28C1AE2D009034D2 /* XPReceiveRedPacketView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B42868D28C1AE2D009034D2 /* XPReceiveRedPacketView.m */; };
9B42869228C1AED4009034D2 /* XPReceiveRedPacketModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B42869128C1AED4009034D2 /* XPReceiveRedPacketModel.m */; };
9B42869528C1E00A009034D2 /* XPRedPacketResultModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B42869428C1E00A009034D2 /* XPRedPacketResultModel.m */; };
9B42869828C1E06B009034D2 /* XPRedPacketModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B42869728C1E06B009034D2 /* XPRedPacketModel.m */; };
9B42869C28C1FD3D009034D2 /* XPOpenRedPacketCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B42869B28C1FD3D009034D2 /* XPOpenRedPacketCell.m */; };
9B4D148127E485EB000AA0C1 /* XPRoomTrumpetView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B4D148027E485EB000AA0C1 /* XPRoomTrumpetView.m */; };
9B5BF8A827E1BED1005DD346 /* Api+RoomTrumpet.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B5BF8A727E1BED1005DD346 /* Api+RoomTrumpet.m */; };
9B5F1503280FF02600C3C2B1 /* anchorPk_crossPking.svga in Resources */ = {isa = PBXBuildFile; fileRef = 9B5F1502280FF02600C3C2B1 /* anchorPk_crossPking.svga */; };
@@ -1478,6 +1483,16 @@
9B41D36D282649230048C588 /* XPWeekStarRankUserModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPWeekStarRankUserModel.m; sourceTree = "<group>"; };
9B41D36F28264E320048C588 /* XPWeekStarInfoView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPWeekStarInfoView.h; sourceTree = "<group>"; };
9B41D37028264E320048C588 /* XPWeekStarInfoView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPWeekStarInfoView.m; sourceTree = "<group>"; };
9B42868C28C1AE2D009034D2 /* XPReceiveRedPacketView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPReceiveRedPacketView.h; sourceTree = "<group>"; };
9B42868D28C1AE2D009034D2 /* XPReceiveRedPacketView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPReceiveRedPacketView.m; sourceTree = "<group>"; };
9B42869028C1AED4009034D2 /* XPReceiveRedPacketModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPReceiveRedPacketModel.h; sourceTree = "<group>"; };
9B42869128C1AED4009034D2 /* XPReceiveRedPacketModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPReceiveRedPacketModel.m; sourceTree = "<group>"; };
9B42869328C1E00A009034D2 /* XPRedPacketResultModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRedPacketResultModel.h; sourceTree = "<group>"; };
9B42869428C1E00A009034D2 /* XPRedPacketResultModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRedPacketResultModel.m; sourceTree = "<group>"; };
9B42869628C1E06B009034D2 /* XPRedPacketModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRedPacketModel.h; sourceTree = "<group>"; };
9B42869728C1E06B009034D2 /* XPRedPacketModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRedPacketModel.m; sourceTree = "<group>"; };
9B42869A28C1FD3D009034D2 /* XPOpenRedPacketCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPOpenRedPacketCell.h; sourceTree = "<group>"; };
9B42869B28C1FD3D009034D2 /* XPOpenRedPacketCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPOpenRedPacketCell.m; sourceTree = "<group>"; };
9B4D147F27E485EB000AA0C1 /* XPRoomTrumpetView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomTrumpetView.h; sourceTree = "<group>"; };
9B4D148027E485EB000AA0C1 /* XPRoomTrumpetView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomTrumpetView.m; sourceTree = "<group>"; };
9B5BF8A627E1BED1005DD346 /* Api+RoomTrumpet.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Api+RoomTrumpet.h"; sourceTree = "<group>"; };
@@ -4205,6 +4220,28 @@
path = File;
sourceTree = "<group>";
};
9B42868F28C1AEBE009034D2 /* Model */ = {
isa = PBXGroup;
children = (
9B42869028C1AED4009034D2 /* XPReceiveRedPacketModel.h */,
9B42869128C1AED4009034D2 /* XPReceiveRedPacketModel.m */,
9B42869328C1E00A009034D2 /* XPRedPacketResultModel.h */,
9B42869428C1E00A009034D2 /* XPRedPacketResultModel.m */,
9B42869628C1E06B009034D2 /* XPRedPacketModel.h */,
9B42869728C1E06B009034D2 /* XPRedPacketModel.m */,
);
path = Model;
sourceTree = "<group>";
};
9B42869928C1FD22009034D2 /* Cell */ = {
isa = PBXGroup;
children = (
9B42869A28C1FD3D009034D2 /* XPOpenRedPacketCell.h */,
9B42869B28C1FD3D009034D2 /* XPOpenRedPacketCell.m */,
);
path = Cell;
sourceTree = "<group>";
};
9B6E856B281AAB8B0041A321 /* Model */ = {
isa = PBXGroup;
children = (
@@ -4551,6 +4588,8 @@
9BA812D328BF52A500783EA7 /* SendRedPacket */ = {
isa = PBXGroup;
children = (
9B42869928C1FD22009034D2 /* Cell */,
9B42868F28C1AEBE009034D2 /* Model */,
9BA812D928BF53DD00783EA7 /* Api */,
9BA812D828BF539300783EA7 /* Protocol */,
9BA812D728BF538E00783EA7 /* Presenter */,
@@ -4558,6 +4597,8 @@
9BA812D528BF52E100783EA7 /* XPRoomSendRedPacketViewController.m */,
9BA812E228BF70A600783EA7 /* XPRoomRedPacketPwdView.h */,
9BA812E328BF70A600783EA7 /* XPRoomRedPacketPwdView.m */,
9B42868C28C1AE2D009034D2 /* XPReceiveRedPacketView.h */,
9B42868D28C1AE2D009034D2 /* XPReceiveRedPacketView.m */,
);
path = SendRedPacket;
sourceTree = "<group>";
@@ -8982,6 +9023,7 @@
E8A86E0727BA38DB001C21F9 /* NSData+RW.m in Sources */,
E80DE40A277568D300BE5BCB /* ThemeColor+FirstRecharge.m in Sources */,
9BC5C8ED277AFF63007C8719 /* XPNobleCenterViewController.m in Sources */,
9B42869828C1E06B009034D2 /* XPRedPacketModel.m in Sources */,
9B92A34A2797F35E00AD168F /* XPMatchManageTableViewCell.m in Sources */,
E82E74FD2828B23D00C25EF7 /* xplan-ios.xcdatamodeld in Sources */,
18EE3FE22750C29D00A452BF /* NIMBadgeView.m in Sources */,
@@ -9009,6 +9051,7 @@
E8E70D7A26F2F16600F03460 /* XPMinePresent.m in Sources */,
E81A653C2834E9AE00F55894 /* MonentsListInfoModel.m in Sources */,
E855516128059228005F293F /* XPMineGuildIncomeDetailViewController.m in Sources */,
9B42869C28C1FD3D009034D2 /* XPOpenRedPacketCell.m in Sources */,
E8A1E45B27620F4900B294CA /* XPRoomHalfWebView.m in Sources */,
9BFE992E288142FD009DA429 /* RoomClassifyModel.m in Sources */,
E8A88D3027E85EEA00CA8837 /* RoomPKInfoModel.m in Sources */,
@@ -9216,6 +9259,7 @@
E8A03DE9276301CC0098D9EA /* XPCandyRankContainerView.m in Sources */,
9BD2ECD5288F838200F5CD9A /* XPMineFootPrintPresenter.m in Sources */,
9B1B72BF2800422E003FACE9 /* XPAnchorPKRuleView.m in Sources */,
9B42869528C1E00A009034D2 /* XPRedPacketResultModel.m in Sources */,
9BE01AE428937EDE00B50299 /* XPDressUpShopCollectionViewCell.m in Sources */,
186A534B26FC6ED900D67B2C /* TTPopupManagerService.m in Sources */,
E8BD0F8B28A9EB0A00DE050D /* RoomSailingPrizeListModel.m in Sources */,
@@ -9478,6 +9522,7 @@
E8998D852859B4FA00C68558 /* XPMineUserInfoGiftView.m in Sources */,
9BB5495C2782E79E0090CD26 /* NobleCenterModel.m in Sources */,
186A536B26FC6F2E00D67B2C /* XPShareItemCell.m in Sources */,
9B42869228C1AED4009034D2 /* XPReceiveRedPacketModel.m in Sources */,
E8B846C526FDB41A00A777FE /* XPMineUserInfolbumPresenter.m in Sources */,
9BFB101F2897CC4300B3985E /* XPAnchorCardView.m in Sources */,
E8D34D532808037E009C4835 /* XPMineDataSkillDataCollectionViewCell.m in Sources */,
@@ -9628,6 +9673,7 @@
E86E79D328A4E94E006DAF48 /* SessionRiskView.m in Sources */,
E8133916273E532D00708B66 /* XPGiftItemCollectionViewCell.m in Sources */,
E833ED0D274FAD1C00A2463B /* XPKickUserModel.m in Sources */,
9B42868E28C1AE2D009034D2 /* XPReceiveRedPacketView.m in Sources */,
E8788934273A53D700BF1D57 /* XPSendGiftView.m in Sources */,
E896EF9C2771AE6B00AD2CC1 /* XPMineFansViewController.m in Sources */,
E8D34D5D280826AD009C4835 /* MineSkillCardListInfoModel.m in Sources */,

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "redPacket_open@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "redPacket_open@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "redPacket_openRoom@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "redPacket_openRoom@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "redPacket_receive_bg@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "redPacket_receive_bg@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 153 KiB

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "redPacket_result_bg@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "redPacket_result_bg@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "send_redPacket_button@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "send_redPacket_button@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "send_redPacket_cancel@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "send_redPacket_cancel@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 285 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 429 B

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "send_redPacket_help@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "send_redPacket_help@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 792 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1008 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 396 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 715 KiB

After

Width:  |  Height:  |  Size: 44 KiB

View File

@@ -80,6 +80,8 @@ typedef NS_ENUM(NSUInteger, URLType) {
kNetworkRenovateURL,
///动态分享
kMonentsShareURL,
///红包规则
kRedPacketRuleURL,
};
NSString * const URLWithType(URLType type);

View File

@@ -52,6 +52,7 @@ NSString * const URLWithType(URLType type) {
@(kSailingRecordURL) : @"activity/act-sail/win_record.html", ///
@(kNetworkRenovateURL) : @"activity/activemodel/index.html?code=ZBGG",///
@(kMonentsShareURL) : @"modules/world/share-page/index.html",///
@(kRedPacketRuleURL) : @"modules/rule/red-packet-rule.html",///
};
NSString * url = [dic objectForKey:@(type)];

View File

@@ -56,8 +56,8 @@ typedef NS_ENUM(NSUInteger, CustomMessageType) {
CustomMessageType_Monents = 52,
///收藏房间
CustomMessageType_Collection_Room = 59,
///收藏房间
CustomMessageType_Collection_RedPacket = 60,
///房间红包
CustomMessageType_RedPacket = 60,
///福袋消息
CustomMessageType_LuckyBag = 61,
///发现萌新
@@ -316,12 +316,14 @@ typedef NS_ENUM(NSUInteger, Custom_Noti_Sub_Dynamic) {
/// app内分享动态
Custom_Message_Sub_Monents_Share = 524,
};
///first = CustomMessageType_Collection_RedPacket
///first = CustomMessageType_RedPacket
typedef NS_ENUM(NSUInteger, CustomMessageSubRedPacket) {
/// 福袋礼物房间飘屏通知
Custom_Message_Sub_SingleRoom_RedPacket = 601,
/// 福袋礼物全服飘屏通知
Custom_Message_Sub_AllRoom_RedPacket = 602,
Custom_Message_Sub_RoomGiftRedPacket = 601, //房间礼物红包
Custom_Message_Sub_RoomDiamandRedPacket = 602, //房间钻石红包
Custom_Message_Sub_AllDiamandRedPacket = 603, //全服礼物红包
Custom_Message_Sub_AllGiftRedPacket = 604, //全服钻石红包
Custom_Message_Sub_OpenRedPacketSuccess = 605,//抢红包成功
};
///first = CustomMessageType_Collection_Room

View File

@@ -11,7 +11,21 @@ NS_ASSUME_NONNULL_BEGIN
@interface Api (RedPacket)
+ (void)sendRedPacket:(HttpRequestHelperCompletion)completion num:(NSString *)num goldNum:(NSString *)goldNum roomUid:(NSString *)roomUid type:(NSNumber *)type password:(NSString *)password message:(NSString *)message;
/// 发送红包
/// @param completion 完成
/// @param num 红包数量
/// @param goldNum 钻石数量
/// @param roomUId 房间uid,不知道谁写接口参数的i要大写不然房间红包不生效无语
/// @param type 类型 1房间 2全服
/// @param password 密码
/// @param message 消息
+ (void)sendRedPacket:(HttpRequestHelperCompletion)completion num:(NSString *)num goldNum:(NSString *)goldNum roomUId:(NSString *)roomUId type:(NSNumber *)type password:(NSString *)password message:(NSString *)message;
/// 抢红包
/// @param completion 完成
/// @param redEnvelopeId 红包id
+ (void)openRedPacket:(HttpRequestHelperCompletion)completion redEnvelopeId:(NSString *)redEnvelopeId;
@end

View File

@@ -9,8 +9,12 @@
@implementation Api (RedPacket)
+ (void)sendRedPacket:(HttpRequestHelperCompletion)completion num:(NSString *)num goldNum:(NSString *)goldNum roomUid:(NSString *)roomUid type:(NSNumber *)type password:(NSString *)password message:(NSString *)message {
[self makeRequest:@"red-envelope" method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__, num, goldNum, roomUid, type, password, message, nil];
+ (void)sendRedPacket:(HttpRequestHelperCompletion)completion num:(NSString *)num goldNum:(NSString *)goldNum roomUId:(NSString *)roomUId type:(NSNumber *)type password:(NSString *)password message:(NSString *)message {
[self makeRequest:@"red-envelope" method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__, num, goldNum, roomUId, type, password, message, nil];
}
+ (void)openRedPacket:(HttpRequestHelperCompletion)completion redEnvelopeId:(NSString *)redEnvelopeId {
[self makeRequest:@"red-envelope/open" method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__, redEnvelopeId, nil];
}
@end

View File

@@ -0,0 +1,19 @@
//
// XPOpenRedPacketCell.h
// xplan-ios
//
// Created by GreenLand on 2022/9/2.
//
#import <UIKit/UIKit.h>
#import "XPRedPacketResultModel.h"
NS_ASSUME_NONNULL_BEGIN
@interface XPOpenRedPacketCell : UITableViewCell
@property (nonatomic, strong) XPRedPacketPersonReceiveModel *model;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,180 @@
//
// XPOpenRedPacketCell.m
// xplan-ios
//
// Created by GreenLand on 2022/9/2.
//
#import "XPOpenRedPacketCell.h"
#import "ThemeColor.h"
#import <Masonry/Masonry.h>
#import "AccountInfoStorage.h"
#import "NetImageView.h"
@interface XPOpenRedPacketCell()
///
@property (nonatomic, strong) NetImageView *avatarView;
///
@property (nonatomic, strong) UILabel *userNameLabel;
///
@property(nonatomic, strong) UILabel *timeLabel;
///
@property (nonatomic, strong) UILabel *amountLabel;
///
//@property (nonatomic, strong) XYRedPacketResultGiftView *giftView;
///
@property (nonatomic, strong) UIImageView *coinImageView;
///线
@property (nonatomic, strong) UIView *lineView;
@end
@implementation XPOpenRedPacketCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
[self initViews];
}
return self;
}
- (void)setModel:(XPRedPacketPersonReceiveModel *)model {
_model = model;
NSString *uid = [AccountInfoStorage instance].getUid;
BOOL isMe = model.userVO.uid == uid.integerValue;
if (isMe) {
self.userNameLabel.text = @"我";
self.userNameLabel.textColor = UIColorFromRGB(0xFDCD00);
} else {
NSString *name = model.userVO.nick;
if (model.userVO.nick.length > 6) {
name = [name substringToIndex:6];
name = [name stringByAppendingString:@"..."];
}
self.userNameLabel.text = name;
self.userNameLabel.textColor = UIColorFromRGB(0xFFFFFF);
}
self.avatarView.imageUrl = model.userVO.avatar;
NSDate *date = [NSDate dateWithTimeIntervalSince1970:model.createTime/1000];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"yyyy/MM/dd HH:mm"];
self.timeLabel.text = [dateFormatter stringFromDate:date];
self.amountLabel.hidden = NO;
if (model.amount.doubleValue> 0) {
NSString *doubleString = [NSString stringWithFormat:@"%lf", model.amount.doubleValue];
NSDecimalNumber *decNumber = [NSDecimalNumber decimalNumberWithString:doubleString];
self.amountLabel.text = [NSString stringWithFormat:@"%@",decNumber.stringValue];
}else {
self.amountLabel.text = @"0";
}
}
#pragma mark - UI
- (void)initViews {
[self.contentView addSubview:self.avatarView];
[self.contentView addSubview:self.userNameLabel];
[self.contentView addSubview:self.timeLabel];
[self.contentView addSubview:self.amountLabel];
[self.contentView addSubview:self.coinImageView];
[self.contentView addSubview:self.lineView];
[self.avatarView mas_makeConstraints:^(MASConstraintMaker *make){
make.height.width.mas_equalTo(30);
make.centerY.mas_equalTo(self.mas_centerY);
make.left.mas_equalTo(self.contentView.mas_left).offset(22);
}];
[self.userNameLabel mas_makeConstraints:^(MASConstraintMaker *make){
make.left.mas_equalTo(self.avatarView.mas_right).offset(6.5);
make.top.mas_equalTo(self.avatarView.mas_top).offset(2.5);
make.height.mas_equalTo(14);
}];
[self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make){
make.left.mas_equalTo(self.avatarView.mas_right).offset(6.5);
make.bottom.mas_equalTo(self.avatarView.mas_bottom);
}];
[self.coinImageView mas_makeConstraints:^(MASConstraintMaker *make){
make.width.mas_equalTo(22);
make.height.mas_equalTo(22);
make.centerY.mas_equalTo(self.mas_centerY);
make.right.mas_equalTo(self.contentView.mas_right).offset(-22);
}];
[self.amountLabel mas_makeConstraints:^(MASConstraintMaker *make){
make.centerY.mas_equalTo(self.mas_centerY);
make.right.mas_equalTo(self.coinImageView.mas_left).offset(-5);
}];
[self.lineView mas_makeConstraints:^(MASConstraintMaker *make){
make.left.mas_equalTo(self.avatarView.mas_left);
make.right.mas_equalTo(self.coinImageView.mas_right);
make.height.mas_equalTo(0.5);
}];
}
#pragma mark - Lazy Load
- (NetImageView *)avatarView {
if (!_avatarView) {
_avatarView = [[NetImageView alloc] init];
_avatarView.layer.masksToBounds = YES;
_avatarView.layer.cornerRadius = 15;
_avatarView.layer.borderWidth = 1;
_avatarView.layer.borderColor = UIColorFromRGB(0xFFFFFF).CGColor;
}
return _avatarView;
}
- (UILabel *)userNameLabel {
if (!_userNameLabel) {
_userNameLabel = [[UILabel alloc] init];
_userNameLabel.text = @"获取红包用户";
_userNameLabel.numberOfLines = 1;
_userNameLabel.font = [UIFont systemFontOfSize:15];
}
return _userNameLabel;
}
- (UILabel *)timeLabel {
if (!_timeLabel) {
_timeLabel = [[UILabel alloc] init];
_timeLabel.text = @"00/00/00 00:00";
_timeLabel.font = [UIFont systemFontOfSize:10];
_timeLabel.textColor = UIColorRGBAlpha(0xffffff, 0.5);
_timeLabel.alpha = 0.5;
}
return _timeLabel;
}
- (UILabel *)amountLabel {
if (!_amountLabel) {
_amountLabel = [[UILabel alloc] init];
_amountLabel.text = @"0钻石";
_amountLabel.textAlignment = NSTextAlignmentRight;
_amountLabel.font = [UIFont systemFontOfSize:20 weight:UIFontWeightMedium];
_amountLabel.textColor = [UIColor whiteColor];
}
return _amountLabel;
}
- (UIImageView *)coinImageView {
if (!_coinImageView) {
_coinImageView = [[UIImageView alloc] init];
[_coinImageView setImage:[UIImage imageNamed:@"common_diamond"]];
}
return _coinImageView;
}
- (UIView *)lineView{
if (!_lineView) {
_lineView = [[UIView alloc] init];
_lineView.backgroundColor = UIColorFromRGB(0xE2314D);
}
return _lineView;
}
@end

View File

@@ -0,0 +1,31 @@
//
// XPReceiveRedPacketModel.h
// xplan-ios
//
// Created by GreenLand on 2022/9/2.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface XPReceiveRedPacketModel : NSObject
///发送者头像
@property (nonatomic, copy) NSString *sendUserAvatar;
///发送者昵称
@property (nonatomic, copy) NSString *sendUserNick;
///房间UID
@property (nonatomic, copy) NSString *roomUid;
///红包类型
@property (nonatomic, assign) NSInteger redEnvelopeType;
///房间标题
@property (nonatomic, copy) NSString *roomTitle;
///红包ID
@property (nonatomic, copy) NSString *redEnvelopeId;
///红包祝福语
@property (nonatomic, copy) NSString *redEnvelopeMessage;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,12 @@
//
// XPReceiveRedPacketModel.m
// xplan-ios
//
// Created by GreenLand on 2022/9/2.
//
#import "XPReceiveRedPacketModel.h"
@implementation XPReceiveRedPacketModel
@end

View File

@@ -0,0 +1,43 @@
//
// XPRedPacketModel.h
// xplan-ios
//
// Created by GreenLand on 2022/9/2.
//
#import <Foundation/Foundation.h>
#import "UserInfoModel.h"
NS_ASSUME_NONNULL_BEGIN
// 红包类型 1:房间钻石红包 2:全服钻石红包 3房间礼物红包 4:全服礼物红包
typedef enum : NSUInteger {
RedPacketType_RoomDiamond = 1,
RedPacketType_AllDiamond = 2,
RedPacketType_RoomGift = 3,
RedPacketType_AllGift = 4
} RedPacketType;
@interface XPRedPacketModel : NSObject
@property (nonatomic, assign) RedPacketType type;
@property (nonatomic, copy) NSString *redEnvelopeId;
@property (nonatomic, copy) NSString *message;
///红包厅主id
@property (nonatomic, copy) NSString *roomUId;
///发红包用户id
@property (nonatomic, copy) NSString *userId;
@property (nonatomic, strong) UserInfoModel *userVO;
/// 红包总数
@property (nonatomic, copy) NSString *totalNum;
/// 红包总额
@property (nonatomic, copy) NSString *redEnvelopeAmount;
/// 已领取数量
@property (nonatomic, copy) NSString *pickNum;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,16 @@
//
// XPRedPacketModel.m
// xplan-ios
//
// Created by GreenLand on 2022/9/2.
//
#import "XPRedPacketModel.h"
@implementation XPRedPacketModel
+ (NSDictionary *)replacedKeyFromPropertyName {
return @{@"redEnvelopeId":@"id"};
}
@end

View File

@@ -0,0 +1,54 @@
//
// XPRedPacketResultModel.h
// xplan-ios
//
// Created by GreenLand on 2022/9/2.
//
#import <Foundation/Foundation.h>
#import "XPRedPacketModel.h"
NS_ASSUME_NONNULL_BEGIN
/*
当前用户的红包状态
ING(1, “开抢中”),
TIME_OUT(2, “过时”),
REMAIN_ZERO(3, “抢光了”),
SUCCESS(4, “抢到了”),
WILL(5, “将要开始”),
TIME_OUT_BACK(6, “超时已退还”),
*/
typedef enum : NSUInteger {
RedPacketState_Ing = 1,
RedPacketState_Time_Out = 2,
RedPacketState_Remain_Zero = 3,
RedPacketState_Success = 4,
RedPacketState_will = 5,
RedPacketState_Time_Out_Back = 6,
} RedPacketState;
@class UserInfoModel, XPRedPacketPersonReceiveModel;
@interface XPRedPacketResultModel : NSObject
@property (nonatomic, copy) NSString *currentUserAmount;
@property (nonatomic, assign) RedPacketState redEnvelopeState;
@property (nonatomic, strong) XPRedPacketModel *redEnvelopeVO;
///钻石红包领取详情
@property (nonatomic, strong) NSArray<XPRedPacketPersonReceiveModel *> *redEnvelopeItemVOs;
@end
@interface XPRedPacketPersonReceiveModel : NSObject
@property (nonatomic, strong) NSNumber *amount;
@property (nonatomic, strong) UserInfoModel *userVO;
@property (nonatomic, assign) NSTimeInterval createTime;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,22 @@
//
// XPRedPacketResultModel.m
// xplan-ios
//
// Created by GreenLand on 2022/9/2.
//
#import "XPRedPacketResultModel.h"
@implementation XPRedPacketResultModel
+ (NSDictionary *)objectClassInArray {
return @{
@"redEnvelopeItemVOs": XPRedPacketPersonReceiveModel.class
};
}
@end
@implementation XPRedPacketPersonReceiveModel
@end

View File

@@ -17,6 +17,13 @@ NS_ASSUME_NONNULL_BEGIN
///获取当前用户信息
- (void)getUserModel;
/// 发送红包
/// @param num 红包数量
/// @param goldNum 钻石数量
/// @param roomUid 房间uid
/// @param type 类型 1房间 2全服
/// @param pwd 密码
/// @param message 消息
- (void)sendRedPacketWithNum:(NSString *)num goldNum:(NSString *)goldNum roomUid:(NSString *)roomUid type:(NSNumber *)type password:(NSString *)pwd message:(NSString *)message;
@end

View File

@@ -42,7 +42,7 @@
NSString *password = [DESEncrypt encryptUseDES:pwd key:KeyWithType(KeyType_PasswordEncode)];
[Api sendRedPacket:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
[[self getView] sendRedPacketSuccess];
}] num:num goldNum:goldNum roomUid:roomUid type:type password:password message:message];
}] num:num goldNum:goldNum roomUId:roomUid type:type password:password message:message];
}
@end

View File

@@ -0,0 +1,18 @@
//
// XPReceiveRedPacketView.h
// xplan-ios
//
// Created by GreenLand on 2022/9/2.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface XPReceiveRedPacketView : UIView
@property (nonatomic, strong) NSDictionary *dict;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,393 @@
//
// XPReceiveRedPacketView.m
// xplan-ios
//
// Created by GreenLand on 2022/9/2.
//
#import "XPReceiveRedPacketView.h"
#import "XPReceiveRedPacketModel.h"
#import "NSObject+MJExtension.h"
#import "ThemeColor.h"
#import <Masonry/Masonry.h>
#import "NetImageView.h"
#import "TTPopUp.h"
#import "Api+RedPacket.h"
#import "XCHUDTool.h"
#import "XPRedPacketResultModel.h"
#import "XPOpenRedPacketCell.h"
@interface XPReceiveRedPacketView()<UITableViewDelegate, UITableViewDataSource>
@property (nonatomic, strong) XPReceiveRedPacketModel *redPacketModel;
@property (nonatomic, strong) XPRedPacketResultModel *resultData;
@property (nonatomic, strong) UIView *alphaView;
///
@property (nonatomic, strong) UIImageView *bgImageView;
///
@property (nonatomic, strong) NetImageView *sendAvatar;
///
@property (nonatomic, strong) UILabel *sendNickLabel;
///
@property (nonatomic, strong) UILabel *sendWishLabel;
///
@property (nonatomic, strong) UIButton *openButton;
///
@property (nonatomic, strong) UIButton *closeBtn;
///
@property (nonatomic, strong) UIView *diamondContentView;
@property (nonatomic, strong) UIImageView *diamondImage;
@property (nonatomic, strong) UILabel *diamondLabel;
///
@property (nonatomic, strong) UILabel *getLabel;
///
@property (nonatomic, strong) UILabel *openSituationLabel;
///
@property (nonatomic, strong) UITableView *tableView;
@end
@implementation XPReceiveRedPacketView
- (instancetype)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
[self initSubViews];
[self initSubViewConstraints];
}
return self;
}
#pragma mark - Private Method
- (void)initSubViews {
[self addSubview:self.alphaView];
[self addSubview:self.bgImageView];
[self addSubview:self.sendAvatar];
[self addSubview:self.sendNickLabel];
[self addSubview:self.sendWishLabel];
[self addSubview:self.openButton];
[self addSubview:self.closeBtn];
}
- (void)initSubViewConstraints {
[self.alphaView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(0);
}];
[self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(310);
make.height.mas_equalTo(450);
make.centerX.centerY.mas_equalTo(self);
}];
[self.closeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.bgImageView.mas_bottom).mas_offset(25);
make.height.width.mas_equalTo(35);
make.centerX.mas_equalTo(self.bgImageView);
}];
[self.sendAvatar mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self.bgImageView);
make.top.mas_equalTo(self.bgImageView).mas_offset(71);
make.width.height.mas_equalTo(88);
}];
[self.sendNickLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self.bgImageView);
make.top.mas_equalTo(self.sendAvatar.mas_bottom).mas_offset(9);
make.height.mas_equalTo(18);
make.left.mas_equalTo(30);
}];
[self.sendWishLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self.bgImageView);
make.left.mas_equalTo(30);
make.top.mas_equalTo(self.sendNickLabel.mas_bottom).mas_offset(30);
}];
[self.openButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self.bgImageView);
make.width.height.mas_equalTo(107);
make.bottom.mas_equalTo(self.bgImageView).mas_offset(-75);
}];
}
- (void)setDict:(NSDictionary *)dict {
XPReceiveRedPacketModel *data = [XPReceiveRedPacketModel modelWithDictionary:dict];
self.redPacketModel = data;
self.sendAvatar.imageUrl = data.sendUserAvatar;
self.sendWishLabel.text = data.redEnvelopeMessage;
if (data.redEnvelopeType == 1) {
self.sendNickLabel.text = data.sendUserNick;
} else {
NSString *nick = data.sendUserNick;
if (data.sendUserNick.length > 6) {
nick = [NSString stringWithFormat:@"%@...", [data.sendUserNick substringToIndex:6]];
}
self.sendNickLabel.text = [NSString stringWithFormat:@"%@厅内的%@", data.roomTitle, nick];
[self.openButton setImage:[UIImage imageNamed:@"redPacket_openRoom"] forState:UIControlStateNormal];
}
}
#pragma mark - action
- (void)onOpenButtonClick:(UIButton *)sender {
//
//1
//1.1
CABasicAnimation *transformAnima = [CABasicAnimation animationWithKeyPath:@"transform.rotation.y"];
transformAnima.toValue = [NSNumber numberWithFloat:M_PI];
transformAnima.duration = 0.3;
transformAnima.cumulative = NO;
transformAnima.autoreverses = YES;
transformAnima.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
sender.layer.zPosition = 5;
sender.layer.zPosition = sender.layer.frame.size.width / 2.f;
transformAnima.repeatCount = 1;
[sender.layer addAnimation:transformAnima forKey:@"rotationAnimationY"];
//1.2
[Api openRedPacket:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
if (code != 200) {
[XCHUDTool showErrorWithMessage:msg];
return;;
}
XPRedPacketResultModel *model = [XPRedPacketResultModel modelWithJSON:data.data];
self.resultData = model;
[self showRedPacketResultViewWithResultData:model];
} redEnvelopeId:self.redPacketModel.redEnvelopeId];
}
///
- (void)showRedPacketResultViewWithResultData:(XPRedPacketResultModel *)resultData {
self.openButton.hidden = YES;
[self addSubview:self.getLabel];
[self addSubview:self.openSituationLabel];
[self addSubview:self.tableView];
if (resultData.redEnvelopeState == RedPacketState_Success) {//
[self addSubview:self.diamondContentView];
[self.diamondContentView addSubview:self.diamondImage];
[self.diamondContentView addSubview:self.diamondLabel];
[self.diamondContentView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.bgImageView).mas_offset(30);
make.centerX.mas_equalTo(self);
make.height.mas_equalTo(27);
}];
[self.diamondImage mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.diamondContentView);
make.centerY.mas_equalTo(self.diamondContentView);
make.width.height.mas_equalTo(24);
}];
[self.diamondLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.diamondImage.mas_right).mas_offset(6);
make.centerY.mas_equalTo(self.diamondContentView);
make.right.top.mas_equalTo(self.diamondContentView);
}];
[self.getLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self);
make.top.mas_equalTo(self.diamondContentView.mas_bottom).mas_offset(10);
make.height.mas_equalTo(12);
}];
self.diamondLabel.text = resultData.currentUserAmount;
self.getLabel.text = @"已存入钱包,请到我的收益确认";
} else if (resultData.redEnvelopeState == RedPacketState_Remain_Zero) {//
self.getLabel.text = @"抢完了,下次早点来哦~";
[self.getLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self);
make.top.mas_equalTo(self.bgImageView).mas_offset(59);
make.height.mas_equalTo(12);
}];
}
[self.sendAvatar mas_remakeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.bgImageView).mas_offset(65);
make.top.mas_equalTo(self.bgImageView).mas_offset(128);
make.width.height.mas_equalTo(30);
}];
self.sendAvatar.layer.borderWidth = 1;
self.sendAvatar.layer.cornerRadius = 15;
[self.sendNickLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(self.sendAvatar);
make.height.mas_equalTo(18);
make.left.mas_equalTo(self.sendAvatar.mas_right).mas_offset(7);
}];
[self.sendWishLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self.bgImageView);
make.left.mas_equalTo(30);
make.top.mas_equalTo(self.sendNickLabel.mas_bottom).mas_offset(15);
}];
[self.openSituationLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.sendWishLabel.mas_bottom).mas_offset(19);
make.height.mas_equalTo(10);
make.right.mas_equalTo(self.bgImageView).mas_offset(-38);
}];
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.openSituationLabel.mas_bottom).mas_offset(5);
make.left.right.mas_equalTo(self.bgImageView).inset(20);
make.height.mas_equalTo(205);
}];
self.bgImageView.image = [UIImage imageNamed:@"redPacket_result_bg"];
self.sendAvatar.imageUrl = resultData.redEnvelopeVO.userVO.avatar;
NSString *nick = resultData.redEnvelopeVO.userVO.nick;
if (resultData.redEnvelopeVO.userVO.nick.length > 6) {
nick = [NSString stringWithFormat:@"%@...", [resultData.redEnvelopeVO.userVO.nick substringToIndex:6]];
}
NSMutableAttributedString *attribute = [[NSMutableAttributedString alloc] init];
NSMutableAttributedString *nickAttr = [[NSMutableAttributedString alloc] initWithString:nick attributes:@{NSForegroundColorAttributeName : UIColorFromRGB(0xFDCD00)}];
NSMutableAttributedString *redPacketStr = [[NSMutableAttributedString alloc] initWithString:@"的红包" attributes:@{NSForegroundColorAttributeName : [UIColor whiteColor]}];
[attribute appendAttributedString:nickAttr];
[attribute appendAttributedString:redPacketStr];
self.sendNickLabel.attributedText = attribute;
self.sendWishLabel.text = resultData.redEnvelopeVO.message;
self.openSituationLabel.text = [NSString stringWithFormat:@"领取%@/%@个", resultData.redEnvelopeVO.pickNum, resultData.redEnvelopeVO.totalNum];
[self.tableView reloadData];
}
#pragma mark - tableviewDatasource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return self.resultData.redEnvelopeItemVOs.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
XPOpenRedPacketCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPOpenRedPacketCell class]) forIndexPath:indexPath];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
XPRedPacketPersonReceiveModel *model = [self.resultData.redEnvelopeItemVOs objectAtIndex:indexPath.row];
cell.model = model;
cell.backgroundColor = [UIColor clearColor];
return cell;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
return 50;
}
#pragma mark - action
- (void)onCloseButtonClick:(UIButton *)sender {
[self removeFromSuperview];
}
#pragma mark - getter
- (UIView *)alphaView {
if (!_alphaView) {
_alphaView = [[UIView alloc] init];
_alphaView.backgroundColor = UIColorRGBAlpha(0x171213, 0.5);
}
return _alphaView;
}
- (UIImageView *)bgImageView {
if (!_bgImageView) {
_bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"redPacket_receive_bg"]];
}
return _bgImageView;
}
- (NetImageView *)sendAvatar {
if (!_sendAvatar) {
_sendAvatar = [[NetImageView alloc] init];
_sendAvatar.layer.masksToBounds = YES;
_sendAvatar.layer.cornerRadius = 44;
_sendAvatar.layer.borderWidth = 2;
_sendAvatar.layer.borderColor = [UIColor whiteColor].CGColor;
}
return _sendAvatar;
}
- (UIView *)sendNickLabel {
if (!_sendNickLabel) {
UILabel *label = [[UILabel alloc] init];
label.font = [UIFont systemFontOfSize:18];
label.textColor = UIColorFromRGB(0xF6E36F);
label.textAlignment = NSTextAlignmentCenter;
_sendNickLabel = label;
}
return _sendNickLabel;
}
- (UILabel *)sendWishLabel {
if (!_sendWishLabel) {
UILabel *label = [[UILabel alloc] init];
label.font = [UIFont systemFontOfSize:16 weight:UIFontWeightMedium];
label.textColor = [UIColor whiteColor];
label.numberOfLines = 0;
label.textAlignment = NSTextAlignmentCenter;
_sendWishLabel = label;
}
return _sendWishLabel;
}
- (UIButton *)openButton {
if (!_openButton) {
_openButton = [[UIButton alloc] init];
[_openButton setImage:[UIImage imageNamed:@"redPacket_open"] forState:UIControlStateNormal];
[_openButton addTarget:self action:@selector(onOpenButtonClick:) forControlEvents:UIControlEventTouchUpInside];
}
return _openButton;
}
- (UIButton *)closeBtn {
if (!_closeBtn) {
_closeBtn = [[UIButton alloc] init];
[_closeBtn setImage:[UIImage imageNamed:@"common_close_white"] forState:UIControlStateNormal];
[_closeBtn addTarget:self action:@selector(onCloseButtonClick:) forControlEvents:UIControlEventTouchUpInside];
}
return _closeBtn;
}
- (UIView *)diamondContentView {
if (!_diamondContentView) {
_diamondContentView = [[UIView alloc] init];
}
return _diamondContentView;
}
- (UIImageView *)diamondImage {
if (!_diamondImage) {
_diamondImage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"common_diamond"]];
}
return _diamondImage;
}
- (UILabel *)diamondLabel {
if (!_diamondLabel) {
UILabel *label = [[UILabel alloc] init];
label.font = [UIFont systemFontOfSize:36 weight:UIFontWeightMedium];
label.textColor = UIColorFromRGB(0xE12D31);
_diamondLabel = label;
}
return _diamondLabel;
}
- (UILabel *)getLabel {
if (!_getLabel) {
UILabel *label = [[UILabel alloc] init];
label.font = [UIFont systemFontOfSize:12];
label.textColor = UIColorFromRGB(0xCF9380);
label.textAlignment = NSTextAlignmentCenter;
label.text = @"抢完了,下次早点来哦~";
_getLabel = label;
}
return _getLabel;
}
- (UILabel *)openSituationLabel {
if (!_openSituationLabel) {
UILabel *label = [[UILabel alloc] init];
label.font = [UIFont systemFontOfSize:10 weight:UIFontWeightMedium];
label.textColor = UIColorRGBAlpha(0xffffff, 0.5);
_openSituationLabel = label;
}
return _openSituationLabel;
}
- (UITableView *)tableView {
if (!_tableView) {
_tableView = [[UITableView alloc] init];
[_tableView registerClass:[XPOpenRedPacketCell class] forCellReuseIdentifier:NSStringFromClass([XPOpenRedPacketCell class])];
_tableView.delegate = self;
_tableView.dataSource = self;
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
_tableView.layer.cornerRadius = 20;
_tableView.layer.masksToBounds = YES;
_tableView.backgroundColor = UIColorFromRGB(0xCC2247);
}
return _tableView;
}
@end

View File

@@ -11,8 +11,12 @@ NS_ASSUME_NONNULL_BEGIN
@protocol XPRoomRedPacketPwdViewDelegate <NSObject>
///完成输入密码
- (void)xPRoomRedPacketPwdViewPwdComplete:(NSString *)pwd;
//忘记密码
- (void)xPRoomRedPacketPwdViewPwdForgetBtnClick;
@end
@interface XPRoomRedPacketPwdView : UIView
@@ -21,6 +25,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, weak) id<XPRoomRedPacketPwdViewDelegate> delegate;
@end
NS_ASSUME_NONNULL_END

View File

@@ -10,6 +10,7 @@
#import "ThemeColor.h"
#import <Masonry/Masonry.h>
#import <ReactiveObjC/ReactiveObjC.h>
#import "TTPopUp.h"
@interface XPRoomRedPacketPwdView()
@@ -19,6 +20,7 @@
@property (nonatomic, strong) UIImageView *diamondImage;
@property (nonatomic, strong) UILabel *diamondLabel;
@property (nonatomic, strong) LoginVerifCodeView *codeView;
@property (nonatomic, strong) UIButton *forgetBtn;
@end
@@ -44,6 +46,7 @@
[self.diamondContentView addSubview:self.diamondImage];
[self.diamondContentView addSubview:self.diamondLabel];
[self addSubview:self.codeView];
[self addSubview:self.forgetBtn];
}
- (void)initSubViewConstraints {
@@ -52,15 +55,15 @@
make.height.mas_equalTo(200);
}];
[self.closeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(10);
make.top.mas_equalTo(10);
make.height.width.mas_equalTo(44);
make.left.mas_equalTo(16);
make.top.mas_equalTo(16);
make.height.width.mas_equalTo(30);
}];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self);
make.top.mas_equalTo(10);
make.height.mas_equalTo(21);
make.top.mas_equalTo(20);
make.height.mas_equalTo(16);
}];
[self.diamondContentView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self);
@@ -70,10 +73,10 @@
[self.diamondImage mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(0);
make.centerY.mas_equalTo(self.diamondContentView);
make.width.height.mas_equalTo(20);
make.width.height.mas_equalTo(24);
}];
[self.diamondLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.diamondImage.mas_right).mas_offset(4);
make.left.mas_equalTo(self.diamondImage.mas_right).mas_offset(7.5);
make.centerY.mas_equalTo(self.diamondContentView);
make.right.mas_equalTo(0);
}];
@@ -81,6 +84,10 @@
make.centerX.mas_equalTo(self);
make.top.mas_equalTo(self.diamondContentView.mas_bottom).mas_offset(16);
}];
[self.forgetBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(-12);
make.top.mas_equalTo(self.codeView.mas_bottom).mas_offset(8);
}];
}
@@ -93,17 +100,20 @@
[self.delegate xPRoomRedPacketPwdViewPwdComplete:code];
}
}
// if (self.phone.length > 0 && code.length == 5) {
// if (self.type == VerifCodeType_Regist) {
// [self.presenter loginWithPhone:self.phone code:code];
// } else if(self.type == VerifCodeType_BindPhone) {
// [self.presenter bindWithPhone:self.phone code:code];
// }
// }
};
}
- (void)onCloseButtonClick:(UIButton *)sender {
[TTPopup dismiss];
}
- (void)onFogetButtonClick:(UIButton *)sender {
[TTPopup dismiss];
if (self.delegate && [self.delegate respondsToSelector:@selector(xPRoomRedPacketPwdViewPwdForgetBtnClick)]) {
[self.delegate xPRoomRedPacketPwdViewPwdForgetBtnClick];
}
}
- (void)setDiamonCount:(NSString *)diamonCount {
self.diamondLabel.text = diamonCount;
}
@@ -119,7 +129,7 @@
if (!_titleLabel) {
UILabel *label = [[UILabel alloc] init];
label.text = @"请输入支付密码";
label.font = [UIFont systemFontOfSize:10];
label.font = [UIFont systemFontOfSize:16 weight:UIFontWeightMedium];
label.textColor = [ThemeColor mainTextColor];
_titleLabel = label;
}
@@ -137,7 +147,7 @@
if (!_diamondLabel) {
UILabel *label = [[UILabel alloc] init];
label.text = @"";
label.font = [UIFont systemFontOfSize:10];
label.font = [UIFont systemFontOfSize:28 weight:UIFontWeightMedium];
label.textColor = [ThemeColor mainTextColor];
_diamondLabel = label;
}
@@ -147,6 +157,8 @@
- (UIButton *)closeBtn {
if (!_closeBtn) {
_closeBtn = [[UIButton alloc] init];
[_closeBtn setImage:[UIImage imageNamed:@"send_redPacket_cancel"] forState:UIControlStateNormal];
[_closeBtn addTarget:self action:@selector(onCloseButtonClick:) forControlEvents:UIControlEventTouchUpInside];
}
return _closeBtn;
}
@@ -159,4 +171,15 @@
return _codeView;
}
- (UIButton *)forgetBtn {
if (!_forgetBtn) {
_forgetBtn = [[UIButton alloc] init];
[_forgetBtn addTarget:self action:@selector(onFogetButtonClick:) forControlEvents:UIControlEventTouchUpInside];
[_forgetBtn setTitle:@"忘记密码?" forState:UIControlStateNormal];
[_forgetBtn setTitleColor:UIColorFromRGB(0xEA3B36) forState:UIControlStateNormal];
_forgetBtn.font = [UIFont systemFontOfSize:13];
}
return _forgetBtn;
}
@end

View File

@@ -13,6 +13,7 @@
#import "XPMacro.h"
#import "XCHUDTool.h"
#import "TTPopUp.h"
#import "XPHtmlUrl.h"
///Third
#import <Masonry/Masonry.h>
#import "UIImage+Utils.h"
@@ -21,6 +22,8 @@
#import "XPMinePayPwdViewController.h"
#import "BaseNavigationController.h"
#import "XPMineRechargeViewController.h"
#import "XPRoomHalfWebView.h"
#import "XPMineVerifIdentityViewController.h"
///P
#import "XPRoomRedPacketPresenter.h"
#import "XPRoomRedPacketProtocol.h"
@@ -82,6 +85,10 @@
@property (nonatomic,strong) UILabel *walletDiamondLabel;
///
@property (nonatomic, strong) UIButton *rechargeButton;
///
@property (nonatomic, strong) UIButton *ruleButton;
///
@property (nonatomic, strong) UIButton *closeButton;
@end
@@ -148,6 +155,8 @@
[self.backView addSubview:self.diamondImage];
[self.backView addSubview:self.walletDiamondLabel];
[self.backView addSubview:self.rechargeButton];
[self.backView addSubview:self.ruleButton];
[self.view addSubview:self.closeButton];
}
- (void)initSubViewConstraints {
@@ -169,117 +178,127 @@
}];
[self.roomButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(self.backView.mas_centerX).mas_offset(-8);
make.top.mas_equalTo(self.backView).offset(60);
make.height.mas_equalTo(24);
make.width.mas_equalTo(90);
make.right.mas_equalTo(self.backView.mas_centerX).mas_offset(-17);
make.top.mas_equalTo(self.backView).offset(65);
make.height.mas_equalTo(18);
make.width.mas_equalTo(80);
}];
[self.allServerButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.roomButton);
make.height.mas_equalTo(24);
make.width.mas_equalTo(90);
make.left.mas_equalTo(self.backView.mas_centerX).mas_offset(8);
make.height.mas_equalTo(18);
make.width.mas_equalTo(80);
make.left.mas_equalTo(self.backView.mas_centerX).mas_offset(17);
}];
[self.typeView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self.roomButton);
make.top.mas_equalTo(self.roomButton.mas_bottom).mas_offset(4);
make.top.mas_equalTo(self.roomButton.mas_bottom).mas_offset(5);
make.width.mas_equalTo(8);
make.height.mas_equalTo(2);
}];
[self.packetContentView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.roomButton.mas_bottom).mas_offset(25);
make.top.mas_equalTo(self.roomButton.mas_bottom).mas_offset(32);
make.centerX.mas_equalTo(self.backView);
make.left.mas_equalTo(self.backView).mas_offset(40);
make.left.mas_equalTo(self.backView).mas_offset(30);
make.height.mas_equalTo(30);
}];
[self.packetTitle mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.centerY.mas_equalTo(self.packetContentView);
make.left.mas_equalTo(12);
make.left.mas_equalTo(15);
}];
[self.packetTitle setContentHuggingPriority:UILayoutPriorityDefaultHigh forAxis:UILayoutConstraintAxisHorizontal];
[self.packetTextField mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.centerY.mas_equalTo(self.packetContentView);
make.left.mas_equalTo(self.packetTitle.mas_right).mas_offset(4);
make.right.mas_equalTo(self.packetUnit.mas_left).mas_offset(-8);
make.right.mas_equalTo(self.packetUnit.mas_left).mas_offset(-5);
}];
[self.packetUnit mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.centerY.mas_equalTo(self.packetContentView);
make.right.mas_equalTo(self.packetContentView).mas_offset(-12);
make.right.mas_equalTo(self.packetContentView).mas_offset(-15);
make.width.mas_equalTo(12);
}];
[self.packetUnit setContentHuggingPriority:UILayoutPriorityDefaultHigh forAxis:UILayoutConstraintAxisHorizontal];
[self.diamondContentView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.packetContentView.mas_bottom).mas_offset(16);
make.top.mas_equalTo(self.packetContentView.mas_bottom).mas_offset(20);
make.centerX.mas_equalTo(self.backView);
make.left.mas_equalTo(self.packetContentView);
make.height.mas_equalTo(30);
}];
[self.diamondTitle mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.centerY.mas_equalTo(self.diamondContentView);
make.left.mas_equalTo(12);
make.left.mas_equalTo(15);
}];
[self.diamondTitle setContentHuggingPriority:UILayoutPriorityDefaultHigh forAxis:UILayoutConstraintAxisHorizontal];
[self.diamondTextField mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.centerY.mas_equalTo(self.diamondContentView);
make.left.mas_equalTo(self.diamondTitle.mas_right).mas_offset(4);
make.right.mas_equalTo(self.diamondUnit.mas_left).mas_offset(-8);
make.right.mas_equalTo(self.diamondUnit.mas_left).mas_offset(-5);
}];
[self.diamondUnit mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.centerY.mas_equalTo(self.diamondContentView);
make.right.mas_equalTo(self.diamondContentView).mas_offset(-12);
make.width.mas_equalTo(26);
}];
[self.diamondUnit setContentHuggingPriority:UILayoutPriorityDefaultHigh forAxis:UILayoutConstraintAxisHorizontal];
[self.countDesc mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self.backView);
make.top.mas_equalTo(self.diamondContentView.mas_bottom).mas_offset(8);
make.top.mas_equalTo(self.diamondContentView.mas_bottom).mas_offset(5);
make.height.mas_equalTo(11);
}];
[self.descContentView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.mas_equalTo(self.backView).inset(40);
make.top.mas_equalTo(self.countDesc.mas_bottom).mas_offset(20);
make.height.mas_equalTo(80);
make.top.mas_equalTo(self.countDesc.mas_bottom).mas_offset(27);
make.height.mas_equalTo(70);
}];
[self.wishTextView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.mas_equalTo(self.backView).inset(60);
make.centerY.mas_equalTo(self.descContentView);
make.height.mas_equalTo(30);
make.height.mas_equalTo(17);
}];
[self.wishPlaceHolderLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.centerY.mas_equalTo(self.descContentView);
}];
[self.wishCountLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.bottom.mas_equalTo(self.descContentView).inset(3);
make.height.mas_equalTo(12);
make.right.bottom.mas_equalTo(self.descContentView).inset(5);
make.height.mas_equalTo(10);
}];
[self.wishDesc mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self.backView);
make.top.mas_equalTo(self.descContentView.mas_bottom).mas_offset(4);
make.height.mas_equalTo(11);
make.top.mas_equalTo(self.descContentView.mas_bottom).mas_offset(7);
make.height.mas_equalTo(10);
}];
[self.releaseButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.wishDesc.mas_bottom).mas_offset(16);
make.top.mas_equalTo(self.wishDesc.mas_bottom).mas_offset(28);
make.centerX.mas_equalTo(self.backView);
make.width.mas_equalTo(160);
make.height.mas_equalTo(44);
make.width.mas_equalTo(150);
make.height.mas_equalTo(34);
}];
[self.diamondImage mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.releaseButton.mas_bottom).mas_offset(16);
make.left.mas_equalTo(self.descContentView);
make.left.mas_equalTo(self.backView).mas_offset(42);;
make.width.height.mas_equalTo(20);
}];
[self.walletDiamondLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.diamondImage.mas_right).mas_offset(2);
make.left.mas_equalTo(self.diamondImage.mas_right).mas_offset(5);
make.centerY.mas_equalTo(self.diamondImage);
}];
[self.rechargeButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(self.descContentView).mas_offset(-4);
make.right.mas_equalTo(self.backView).mas_offset(-42);
make.centerY.mas_equalTo(self.diamondImage);
}];
[self.ruleButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(self.backView).mas_offset(-23);
make.top.mas_equalTo(13);
make.width.height.mas_equalTo(30);
}];
[self.closeButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self.view);
make.top.mas_equalTo(self.backView.mas_bottom).mas_offset(20);
make.width.height.mas_equalTo(35);
}];
}
@@ -342,6 +361,12 @@
[self.presenter sendRedPacketWithNum:self.packetTextField.text goldNum:self.diamondTextField.text roomUid:roomUid type:type password:pwd message:message];
}
- (void)xPRoomRedPacketPwdViewPwdForgetBtnClick {
XPMineVerifIdentityViewController * VC = [[XPMineVerifIdentityViewController alloc] init];
VC.userInfo = self.hostDelegate.getUserInfo;
[self.navigationController pushViewController:VC animated:YES];
}
#pragma mark - Event Response
- (void)dismissTapRecognizer:(UITapGestureRecognizer *)tap {
[self dismissViewControllerAnimated:YES completion:nil];
@@ -382,6 +407,18 @@
[self.navigationController pushViewController:rechargeVC animated:YES];
}
- (void)onRuleButtonClick:(UIButton *)sender {
XPRoomHalfWebView * webView = [[XPRoomHalfWebView alloc] init];
webView.url = URLWithType(kRedPacketRuleURL);
TTPopupService * config = [[TTPopupService alloc] init];
config.contentView = webView;
[TTPopup popupWithConfig:config];
}
- (void)onCloseButtonClick:(UIButton *)sender {
[self dismissViewControllerAnimated:YES completion:nil];
}
#pragma mark - YYTextViewDelegate
- (void)textViewDidChange:(YYTextView *)textView {
NSInteger maxLength = 20;
@@ -408,7 +445,7 @@
[self.wishTextView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.left.right.mas_equalTo(self.backView).inset(60);
make.centerY.mas_equalTo(self.descContentView);
make.height.mas_equalTo(30);
make.height.mas_equalTo(17);
}];
}
self.wishCountLabel.text = [NSString stringWithFormat:@"%zd/%ld", self.wishTextView.text.length, maxLength];
@@ -446,10 +483,11 @@
if (!_roomButton) {
_roomButton = [[UIButton alloc] init];
[_roomButton setTitle:@"厅内红包" forState:UIControlStateNormal];
[_roomButton setTitleColor:UIColorRGBAlpha(0xffffff, 0.6) forState:UIControlStateNormal];
[_roomButton setTitleColor:UIColorRGBAlpha(0xffffff, 0.5) forState:UIControlStateNormal];
[_roomButton setTitleColor:UIColorRGBAlpha(0xffffff, 1) forState:UIControlStateSelected];
[_roomButton addTarget:self action:@selector(onRoomButtonClick:) forControlEvents:UIControlEventTouchUpInside];
_roomButton.selected = YES;
_roomButton.titleLabel.font = [UIFont systemFontOfSize:18 weight:UIFontWeightMedium];
}
return _roomButton;
}
@@ -458,9 +496,10 @@
if (!_allServerButton) {
_allServerButton = [[UIButton alloc] init];
[_allServerButton setTitle:@"全服红包" forState:UIControlStateNormal];
[_allServerButton setTitleColor:UIColorRGBAlpha(0xffffff, 0.6) forState:UIControlStateNormal];
[_allServerButton setTitleColor:UIColorRGBAlpha(0xffffff, 0.5) forState:UIControlStateNormal];
[_allServerButton setTitleColor:UIColorRGBAlpha(0xffffff, 1) forState:UIControlStateSelected];
[_allServerButton addTarget:self action:@selector(onAllServerButtonClick:) forControlEvents:UIControlEventTouchUpInside];
_allServerButton.titleLabel.font = [UIFont systemFontOfSize:18 weight:UIFontWeightMedium];
}
return _allServerButton;
}
@@ -478,7 +517,7 @@
- (UIView *)packetContentView {
if (!_packetContentView) {
_packetContentView = [[UIView alloc] init];
_packetContentView.backgroundColor = UIColorRGBAlpha(0xffffff, 0.3);
_packetContentView.backgroundColor = UIColorFromRGB(0xCC2247);
_packetContentView.layer.cornerRadius = 15;
_packetContentView.layer.masksToBounds = YES;
}
@@ -489,8 +528,8 @@
if (!_packetTitle) {
UILabel *label = [[UILabel alloc] init];
label.text = @"红包个数";
label.font = [UIFont systemFontOfSize:13];
label.textColor = [UIColor whiteColor];
label.font = [UIFont systemFontOfSize:12];
label.textColor = UIColorRGBAlpha(0xffffff, 0.5);
_packetTitle = label;
}
return _packetTitle;
@@ -501,9 +540,10 @@
UITextField *label = [[UITextField alloc] init];
label.keyboardType = UIKeyboardTypeNumberPad;
label.textAlignment = NSTextAlignmentRight;
NSMutableAttributedString *attrString = [[NSMutableAttributedString alloc]initWithString:@"1-100" attributes:@{NSForegroundColorAttributeName: UIColorRGBAlpha(0xffffff, 0.3)}];
NSMutableAttributedString *attrString = [[NSMutableAttributedString alloc]initWithString:@"1-100" attributes:@{NSForegroundColorAttributeName: UIColorRGBAlpha(0xffffff, 0.5)}];
label.attributedPlaceholder = attrString;
label.textColor = [UIColor whiteColor];
label.font = [UIFont systemFontOfSize:15 weight:UIFontWeightMedium];
_packetTextField = label;
}
return _packetTextField;
@@ -513,8 +553,8 @@
if (!_packetUnit) {
UILabel *label = [[UILabel alloc] init];
label.text = @"个";
label.font = [UIFont systemFontOfSize:13];
label.textColor = [UIColor whiteColor];
label.font = [UIFont systemFontOfSize:12];
label.textColor = UIColorRGBAlpha(0xffffff, 0.5);
_packetUnit = label;
}
return _packetUnit;
@@ -523,7 +563,7 @@
- (UIView *)diamondContentView {
if (!_diamondContentView) {
_diamondContentView = [[UIView alloc] init];
_diamondContentView.backgroundColor = UIColorRGBAlpha(0xffffff, 0.3);
_diamondContentView.backgroundColor = UIColorFromRGB(0xCC2247);
_diamondContentView.layer.cornerRadius = 15;
_diamondContentView.layer.masksToBounds = YES;
}
@@ -533,8 +573,8 @@
if (!_diamondTitle) {
UILabel *label = [[UILabel alloc] init];
label.text = @"总钻石数";
label.font = [UIFont systemFontOfSize:13];
label.textColor = [UIColor whiteColor];
label.font = [UIFont systemFontOfSize:12];
label.textColor = UIColorRGBAlpha(0xffffff, 0.5);
_diamondTitle = label;
}
return _diamondTitle;
@@ -545,9 +585,10 @@
UITextField *label = [[UITextField alloc] init];
label.keyboardType = UIKeyboardTypeNumberPad;
label.textAlignment = NSTextAlignmentRight;
NSMutableAttributedString *attrString = [[NSMutableAttributedString alloc]initWithString:@"0" attributes:@{NSForegroundColorAttributeName: UIColorRGBAlpha(0xffffff, 0.3)}];
NSMutableAttributedString *attrString = [[NSMutableAttributedString alloc]initWithString:@"0" attributes:@{NSForegroundColorAttributeName: UIColorRGBAlpha(0xffffff, 0.5)}];
label.attributedPlaceholder = attrString;
label.textColor = [UIColor whiteColor];
label.font = [UIFont systemFontOfSize:15 weight:UIFontWeightMedium];
_diamondTextField = label;
}
return _diamondTextField;
@@ -557,8 +598,8 @@
if (!_diamondUnit) {
UILabel *label = [[UILabel alloc] init];
label.text = @"钻石";
label.font = [UIFont systemFontOfSize:13];
label.textColor = [UIColor whiteColor];
label.font = [UIFont systemFontOfSize:12];
label.textColor = UIColorRGBAlpha(0xffffff, 0.5);
_diamondUnit = label;
}
return _diamondUnit;
@@ -568,8 +609,8 @@
if (!_countDesc) {
UILabel *label = [[UILabel alloc] init];
label.text = @"红包总金额不低于100钻石且必须为10的倍数";
label.font = [UIFont systemFontOfSize:12];
label.textColor = UIColorRGBAlpha(0xffffff, 0.6);
label.font = [UIFont systemFontOfSize:11];
label.textColor = [UIColor whiteColor];
_countDesc = label;
}
return _countDesc;
@@ -578,7 +619,7 @@
- (UIView *)descContentView {
if (!_descContentView) {
_descContentView = [[UIView alloc] init];
_descContentView.backgroundColor = UIColorRGBAlpha(0x000000, 0.3);
_descContentView.backgroundColor = UIColorRGBAlpha(0xCC2247, 0.6);
_descContentView.layer.cornerRadius = 8;
_descContentView.layer.masksToBounds = YES;
}
@@ -592,14 +633,9 @@
_wishTextView.layer.masksToBounds = YES;
_wishTextView.backgroundColor = [UIColor clearColor];
_wishTextView.showsVerticalScrollIndicator = NO;
// _wishTextView.placeholderText = @"恭喜发财,大吉大利!";
// _wishTextView.placeholderTextColor = [ThemeColor noContainDescTextColor];
// _wishTextView.placeholderFont = [UIFont systemFontOfSize:12];
_wishTextView.font = [UIFont systemFontOfSize:16];
_wishTextView.font = [UIFont systemFontOfSize:16 weight:UIFontWeightMedium];
_wishTextView.textColor = [UIColor whiteColor];
// _wishTextView.delegate = self;
_wishTextView.textAlignment = NSTextAlignmentCenter;
// _wishTextView.textVerticalAlignment = YYTextVerticalAlignmentCenter;
}
return _wishTextView;
}
@@ -608,7 +644,7 @@
if (!_releaseButton) {
_releaseButton = [[UIButton alloc] init];
[_releaseButton setTitleColor:[ThemeColor confirmButtonTextColor] forState:UIControlStateNormal];
[_releaseButton setBackgroundImage:[UIImage imageNamed:@"rooom_trumpet_send"] forState:UIControlStateNormal];
[_releaseButton setBackgroundImage:[UIImage imageNamed:@"send_redPacket_button"] forState:UIControlStateNormal];
[_releaseButton addTarget:self action:@selector(onReleaseButtonClick:) forControlEvents:UIControlEventTouchUpInside];
}
return _releaseButton;
@@ -618,7 +654,7 @@
_wishDesc = [[UILabel alloc] init];
_wishDesc.text = @"未抢完的红包将在30分钟后返还你的钱包";
_wishDesc.font = [UIFont systemFontOfSize:10];
_wishDesc.textColor = UIColorRGBAlpha(0xffffff, 0.6);
_wishDesc.textColor = UIColorRGBAlpha(0xffffff, 0.5);
}
return _wishDesc;
}
@@ -628,8 +664,8 @@
if (!_wishCountLabel) {
UILabel *label = [[UILabel alloc] init];
label.text = @"0/20";
label.font = [UIFont systemFontOfSize:12];
label.textColor = UIColorRGBAlpha(0xffffff, 0.6);
label.font = [UIFont systemFontOfSize:10];
label.textColor = UIColorFromRGB(0xFF8C9D);
_wishCountLabel = label;
}
return _wishCountLabel;
@@ -646,7 +682,7 @@
if (!_walletDiamondLabel) {
_walletDiamondLabel = [[UILabel alloc] init];
_walletDiamondLabel.textColor = [UIColor whiteColor];
_walletDiamondLabel.font = [UIFont systemFontOfSize:13];
_walletDiamondLabel.font = [UIFont systemFontOfSize:15 weight:UIFontWeightMedium];
}
return _walletDiamondLabel;
}
@@ -656,7 +692,7 @@
UILabel *label = [[UILabel alloc] init];
label.text = @"恭喜发财,大吉大利!";
label.font = [UIFont systemFontOfSize:16];
label.textColor = UIColorRGBAlpha(0xffffff, 0.3);
label.textColor = UIColorRGBAlpha(0xffffff, 0.5);
_wishPlaceHolderLabel = label;
}
return _wishPlaceHolderLabel;
@@ -676,4 +712,22 @@
return _rechargeButton;
}
- (UIButton *)ruleButton {
if (!_ruleButton) {
_ruleButton = [[UIButton alloc] init];
[_ruleButton addTarget:self action:@selector(onRuleButtonClick:) forControlEvents:UIControlEventTouchUpInside];
[_ruleButton setImage:[UIImage imageNamed:@"send_redPacket_help"] forState:UIControlStateNormal];
}
return _ruleButton;
}
- (UIButton *)closeButton {
if (!_closeButton) {
_closeButton = [[UIButton alloc] init];
[_closeButton addTarget:self action:@selector(onCloseButtonClick:) forControlEvents:UIControlEventTouchUpInside];
[_closeButton setImage:[UIImage imageNamed:@"common_close_white"] forState:UIControlStateNormal];
}
return _closeButton;
}
@end

View File

@@ -49,6 +49,7 @@
#import "XPRoomLittleGameContainerView.h"
#import "AnchorRoomScrollView.h"
#import "AnchorRoomSrollTipView.h"
#import "XPReceiveRedPacketView.h"
///P
#import "XPRoomPresenter.h"
#import "XPRoomProtocol.h"
@@ -1155,7 +1156,14 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
[self.littleGameView destroyMG];
[self dismissViewControllerAnimated:YES completion:nil];
}
}
} else if (attachment.first == CustomMessageType_RedPacket) {
if (attachment.second == Custom_Message_Sub_RoomDiamandRedPacket) {
XPReceiveRedPacketView *view = [[XPReceiveRedPacketView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
view.dict = attachment.data;
[self.view addSubview:view];
[self.view bringSubviewToFront:view];
}
}
[self.messageContainerView handleNIMCustomMessage:message];
}
} else if(message.messageType == NIMMessageTypeText) {

View File

@@ -66,6 +66,7 @@
#import "XPMineUserInfoViewController.h"
#import "XPMonentsRecommendViewController.h"
#import "XPMonentsViewController.h"
#import "XPReceiveRedPacketView.h"
///Present
#import "MainPresenter.h"
#import "MainProtocol.h"
@@ -360,7 +361,50 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
service.style = TTPopupStyleAlert;
[TTPopup popupWithConfig:service];
}
}
} else if (attachment.first == CustomMessageType_RedPacket && attachment.second == Custom_Message_Sub_AllGiftRedPacket) {
//
if ([XPRoomMiniManager shareManager].getRoomInfo) {
} else {
// if ([rootViewController presentedViewController]) { //present dismiss
// [[rootViewController presentedViewController] dismissViewControllerAnimated:YES completion:^{
// if ([[XCCurrentVCStackManager shareManager] getCurrentVC].navigationController.viewControllers.count > 1) {
// [[[XCCurrentVCStackManager shareManager] getCurrentVC].navigationController popToRootViewControllerAnimated:YES];
// }
// if ([[UIApplication sharedApplication].delegate.window.rootViewController isKindOfClass:[UITabBarController class]]) {
// UITabBarController *tabVC = (UITabBarController *)[UIApplication sharedApplication].delegate.window.rootViewController;
// if (tabVC.selectedViewController.navigationController) {
// [tabVC.selectedViewController.navigationController popToRootViewControllerAnimated:YES];
// }
// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
// [tabVC setSelectedIndex:0];
// });
// }
// }];
// }else { //present rootvcpush navvc pop
// if ([[XCCurrentVCStackManager shareManager] getCurrentVC].navigationController.viewControllers.count > 1) {
// [[[XCCurrentVCStackManager shareManager] getCurrentVC].navigationController popToRootViewControllerAnimated:YES];
// }
// if ([[UIApplication sharedApplication].delegate.window.rootViewController isKindOfClass:[UITabBarController class]]) {
// UITabBarController *tabVC = (UITabBarController *)[UIApplication sharedApplication].delegate.window.rootViewController;
// if (tabVC.selectedViewController) {
// if ([tabVC.selectedViewController isKindOfClass:[UINavigationController class]]) {
// [tabVC.selectedViewController popToRootViewControllerAnimated:YES];
// } else {
// [tabVC.selectedViewController.navigationController popToRootViewControllerAnimated:YES];
// }
// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
// [tabVC setSelectedIndex:0];
// });
// }
// }
// }
}
XPReceiveRedPacketView *view = [[XPReceiveRedPacketView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
view.dict = attachment.data;
[self.view addSubview:view];
[self.view bringSubviewToFront:view];
}
}
}
}