礼物面板增加周星礼物tab

This commit is contained in:
chenguilong
2022-05-07 17:58:15 +08:00
parent cc5a0a31d6
commit c4c9b1871f
21 changed files with 419 additions and 19 deletions

View File

@@ -151,6 +151,8 @@
9B33E3CE27D8540C003B0E62 /* XPVoiceCardViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B33E3CD27D8540C003B0E62 /* XPVoiceCardViewController.m */; };
9B33E3D427D8A1A4003B0E62 /* XPSkillCardPlayerManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B33E3D327D8A1A4003B0E62 /* XPSkillCardPlayerManager.m */; };
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 */; };
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 */; };
@@ -1016,6 +1018,10 @@
9B33E3D327D8A1A4003B0E62 /* XPSkillCardPlayerManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPSkillCardPlayerManager.m; sourceTree = "<group>"; };
9B3A1DF2280571000058E2DD /* XPAnchorPKInviteView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPAnchorPKInviteView.h; sourceTree = "<group>"; };
9B3A1DF3280571000058E2DD /* XPAnchorPKInviteView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPAnchorPKInviteView.m; sourceTree = "<group>"; };
9B41D36C282649230048C588 /* XPWeekStarRankUserModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPWeekStarRankUserModel.h; sourceTree = "<group>"; };
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>"; };
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>"; };
@@ -4511,6 +4517,8 @@
E8DACCFD27673F870052092C /* GiftValueInfoModel.m */,
9B208A342779B50100F9E54A /* GiftNobleInfoModel.h */,
9B208A352779B50100F9E54A /* GiftNobleInfoModel.m */,
9B41D36C282649230048C588 /* XPWeekStarRankUserModel.h */,
9B41D36D282649230048C588 /* XPWeekStarRankUserModel.m */,
);
path = Model;
sourceTree = "<group>";
@@ -4538,6 +4546,8 @@
E8788947273A55D000BF1D57 /* XPGiftBarView.m */,
E890BC0B273D09A50007C46B /* XPGiftCountView.h */,
E890BC0C273D09A50007C46B /* XPGiftCountView.m */,
9B41D36F28264E320048C588 /* XPWeekStarInfoView.h */,
9B41D37028264E320048C588 /* XPWeekStarInfoView.m */,
);
path = View;
sourceTree = "<group>";
@@ -6646,6 +6656,7 @@
E824546426F5FF1C00BE8163 /* XPMineResetPayPasswordPresenter.m in Sources */,
E877A7EE278428FB00EFACED /* MicroDatingProgressView.m in Sources */,
E8C6FFE32754F349004DC9F0 /* XPSearchListTableViewCell.m in Sources */,
9B41D37128264E320048C588 /* XPWeekStarInfoView.m in Sources */,
E87A27032758BC81002DDC7A /* XPRoomSearchContainerViewController.m in Sources */,
E884C3722743AEDE00E1EBED /* CustomAttachmentDecoder.m in Sources */,
18EE3FEE2750CE6D00A452BF /* NIMMessageUtils.m in Sources */,
@@ -6673,6 +6684,7 @@
E8C1CD7627D8AE3D00376F83 /* XPRoomFacePresenter.m in Sources */,
18F4043A275E20D900A6C548 /* TRTCRtcImpl.m in Sources */,
E8899C7F27853B6A007944BE /* DatingMicroView.m in Sources */,
9B41D36E282649230048C588 /* XPWeekStarRankUserModel.m in Sources */,
E8E5E19A27C36C0B00F457D8 /* XPHomeHotRoomTableViewCell.m in Sources */,
E824545926F5E65900BE8163 /* XPMineVerifIdentityView.m in Sources */,
9BCE6147277D665600CC0358 /* XPReleaseRadioCellModel.m in Sources */,

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 366 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 466 B

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

View File

@@ -64,6 +64,8 @@ typedef NS_ENUM(NSUInteger, URLType) {
kAnchorFansRankURL,
///主播粉丝团-粉丝团规则
kAnchorFansRuleURL,
///周星礼物-周星榜
kNewWeekStarURL,
};
NSString * const URLWithType(URLType type);

View File

@@ -43,7 +43,8 @@ NSString * const URLWithType(URLType type) {
@(kAnchorFansOpenURL) : @"modules/fans_club/nameplate.html", ///-
@(kAnchorFansListURL) : @"modules/fans_club/myfans.html", ///-
@(kAnchorFansRankURL) : @"modules/fans_club/fans_rank.html", ///-
@(kAnchorFansRuleURL) : @"modules/fans_club/rule.html" ///-
@(kAnchorFansRuleURL) : @"modules/fans_club/rule.html", ///-
@(kNewWeekStarURL) : @"modules/weekStar/newWeekStar.html" ///-
};
NSString * url = [dic objectForKey:@(type)];

View File

@@ -7,6 +7,7 @@
#import <Foundation/Foundation.h>
#import "GiftNobleInfoModel.h"
#import "XPWeekStarRankUserModel.h"
NS_ASSUME_NONNULL_BEGIN
//礼物类型
@@ -15,6 +16,7 @@ typedef NS_ENUM(NSUInteger, GiftType) {
GiftType_Lucky = 3, // 福袋礼物
GiftType_LuckyPool = 5, //福袋奖池礼物
GiftType_Noble = 7, // 贵族礼物
GiftType_WeekStar = 8, //周星礼物
};
//礼物类型
@@ -102,6 +104,14 @@ typedef NS_ENUM(NSUInteger, RoomSendGiftType) {
///贵族礼物专属信息
@property (nonatomic, strong) GiftNobleInfoModel *giftVipInfo;
/*----------周星礼物--------*/
///上周周星礼物ID
@property (nonatomic, assign) NSInteger lastGiftId;
///上周对应礼物的魅力榜第一
@property (nonatomic, strong) XPWeekStarRankUserModel *firstCharmRankUser;
///上周对应礼物豪气榜第一
@property (nonatomic, strong) XPWeekStarRankUserModel *firstLevelRankUser;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,29 @@
//
// XPCharmRankUserModel.h
// xplan-ios
//
// Created by GreenLand on 2022/5/7.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface XPWeekStarRankUserModel : NSObject
///头像
@property (nonatomic, copy) NSString *avatar;
///榜单值
@property (nonatomic, assign) NSInteger amount;
///uid
@property (nonatomic, assign) NSInteger uid;
///二般号
@property (nonatomic, assign) NSInteger erbanNo;
///昵称
@property (nonatomic, copy) NSString *nick;
///礼物id
@property (nonatomic, assign) NSInteger giftId;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,12 @@
//
// XPCharmRankUserModel.m
// xplan-ios
//
// Created by GreenLand on 2022/5/7.
//
#import "XPWeekStarRankUserModel.h"
@implementation XPWeekStarRankUserModel
@end

View File

@@ -48,11 +48,13 @@
NSArray *vipGift = [GiftInfoModel modelsWithArray:data.data[@"vipGift"]]; //
NSArray *luckyPoolGift = [GiftInfoModel modelsWithArray:data.data[@"luckyPoolGift"]];//
NSArray *normalGift = [GiftInfoModel modelsWithArray:data.data[@"normalGift"]]; //
NSArray *weekStarGift = [GiftInfoModel modelsWithArray:data.data[@"weekStarGift"]]; //
NSMutableArray *info = [NSMutableArray array];
NSMutableArray *totalInfo = [NSMutableArray array];
[info addObjectsFromArray:luckyBagGift];
[info addObjectsFromArray:vipGift];
[info addObjectsFromArray:normalGift];
[info addObjectsFromArray:weekStarGift];
[totalInfo addObjectsFromArray:info];
[totalInfo addObjectsFromArray:luckyPoolGift];
///

View File

@@ -20,9 +20,9 @@ NS_ASSUME_NONNULL_BEGIN
+ (UIColor *)giftBalanceColor;
/// 送礼物 分页指示器的颜色
+ (UIColor *)giftPageIndicatorColor;
/// 分段控制器文字默认的颜色 #0C0B0C
/// 分段控制器文字默认的颜色 #999999
+ (UIColor *)giftSegmentNormalTitleColor;
/// 分段控制器文字选中的颜色 #FFFFFF
/// 分段控制器文字选中的颜色 #FFBC51
+ (UIColor *)giftSegmentSelectTitleColor;
/// 礼物选中的时候的颜色 0xFF903E
+ (UIColor *)giftNameSelectColor;

View File

@@ -32,13 +32,13 @@
+ (UIColor *)giftPageIndicatorColor {
return [UIColor whiteColor];
}
/// #0C0B0C
/// #999999
+ (UIColor *)giftSegmentNormalTitleColor {
return UIColorRGBAlpha(0xFFFFFF, 0.3);
return UIColorRGBAlpha(0x999999, 1);
}
/// #FFFFFF
/// #FFBC51
+ (UIColor *)giftSegmentSelectTitleColor {
return UIColorRGBAlpha(0xFFFFFF, 1);
return UIColorRGBAlpha(0xFFBC51, 1);
}
/// 0xFF903E
+ (UIColor *)giftNameSelectColor {

View File

@@ -13,6 +13,7 @@ typedef NS_ENUM(NSInteger, GiftSegmentType) {
GiftSegmentType_Normal = 1, ///普通的礼物
GiftSegmentType_Lucky,///幸运礼物
GiftSegmentType_Noble,///贵族礼物
GiftSegmentType_WeekStar, ///周星礼物
GiftSegmentType_Pack,///背包礼物
};
@@ -30,6 +31,9 @@ typedef NS_ENUM(NSInteger, GiftSegmentType) {
///点击了贵族特权
- (void)xPGiftInfoViewDidClickNobleEntrance:(XPGiftInfoView *)view;
///点击了周星榜
- (void)xpGiftInfoViewDidClickWeekStarRank:(XPGiftInfoView *)view;
@end
@interface XPGiftInfoView : UIView

View File

@@ -18,7 +18,9 @@
#import "XPGiftItemCollectionViewCell.h"
#import "XPGiftEmptyCollectionViewCell.h"
#import "XPGiftCollectionViewFlowLayout.h"
@interface XPGiftInfoView ()<UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout>
#import "XPWeekStarInfoView.h"
@interface XPGiftInfoView ()<UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout, XPWeekStarInfoViewDelegate>
///
@property (nonatomic,strong) UIStackView *segmentStackView;
///
@@ -29,6 +31,8 @@
@property (nonatomic,strong) UIButton *luckyGiftButton;
///
@property (nonatomic,strong) UIButton *nobleGiftButton;
///
@property (nonatomic, strong) UIButton *weekStarButton;
///
@property (nonatomic,strong) UIView * segmentPlaceView;
///
@@ -39,6 +43,8 @@
@property (nonatomic, strong) UIButton *nobleButton;
///
@property (nonatomic,strong) UIStackView *giftStackView;
///
@property (nonatomic, strong) XPWeekStarInfoView *weekStarView;
///l
@property (nonatomic,strong) UICollectionView *giftcollectionView;
///
@@ -51,6 +57,8 @@
@property (nonatomic,strong) NSArray<GiftInfoModel *> *giftLuckyArray;
///
@property (nonatomic, strong) NSArray<GiftInfoModel *> *giftNobleArray;
///
@property (nonatomic, strong) NSArray<GiftInfoModel *> *giftWeekStarArray;
/////
@property (nonatomic,strong) NSArray<GiftInfoModel *> *giftPackArray;
///
@@ -79,6 +87,7 @@
self.luckyGiftButton.selected = NO;
self.nobleGiftButton.selected = NO;
self.packGiftButton.selected = NO;
self.weekStarButton.selected = NO;
sender.selected = !sender.selected;
self.segmentType = sender.tag;
}
@@ -113,11 +122,14 @@
[self.segmentStackView addArrangedSubview:self.normalGiftButton];
[self.segmentStackView addArrangedSubview:self.luckyGiftButton];
[self.segmentStackView addArrangedSubview:self.nobleGiftButton];
[self.segmentStackView addArrangedSubview:self.weekStarButton];
[self.segmentStackView addArrangedSubview:self.packGiftButton];
[self.segmentStackView addArrangedSubview:self.segmentPlaceView];
[self.segmentStackView addArrangedSubview:self.playRuleButton];
[self.segmentStackView addArrangedSubview:self.totalValueLabel];
[self.segmentStackView addArrangedSubview:self.nobleButton];
///
[self addSubview:self.weekStarView];
///
[self.giftStackView addArrangedSubview:self.giftcollectionView];
[self.giftStackView addArrangedSubview:self.pageController];
@@ -125,18 +137,24 @@
- (void)initSubViewConstraints {
[self mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(40 + 108 * 2 + 10 + 10);
make.height.mas_equalTo(30 + 108 * 2 + 10 + 10 + 25);
}];
[self.segmentStackView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.mas_equalTo(self).inset(15);
make.top.mas_equalTo(self);
make.height.mas_equalTo(40);
}];
[self.segmentStackView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.mas_equalTo(self).inset(15);
make.top.mas_equalTo(self);
make.height.mas_equalTo(30);
}];
[self.weekStarView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.mas_equalTo(self).inset(15);
make.top.mas_equalTo(self.segmentStackView.mas_bottom);
make.height.mas_equalTo(25);
}];
[self.giftStackView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.segmentStackView.mas_bottom);
make.top.mas_equalTo(self.weekStarView.mas_bottom);
make.left.right.mas_equalTo(self);
make.height.mas_equalTo(108 * 2 + 20);
}];
@@ -191,6 +209,10 @@
}
self.playRuleButton.hidden = giftInfo.giftExplainUrl.length <= 0;
giftInfo.isSelected = YES;
if (self.segmentType == GiftSegmentType_WeekStar) {
self.weekStarView.firstCharmRankUser = giftInfo.firstCharmRankUser;
self.weekStarView.firstLevelRankUser = giftInfo.firstLevelRankUser;
}
}
// id
@@ -252,6 +274,13 @@
}
}
#pragma mark - XPWeekStarInfoViewDelegate
- (void)xPWeekStarInfoViewRankButtonClick {
if (self.delegate && [self.delegate respondsToSelector:@selector(xpGiftInfoViewDidClickWeekStarRank:)]) {
[self.delegate xpGiftInfoViewDidClickWeekStarRank:self];
}
}
#pragma mark - Getters And Setters
- (void)setSegmentType:(GiftSegmentType)segmentType {
if (segmentType == _segmentType) {
@@ -263,8 +292,10 @@
[self resetSelectGift:self.packOriginArray];
[self resetSelectGift:self.giftLuckyArray];
[self resetSelectGift:self.giftNobleArray];
[self resetSelectGift:self.giftWeekStarArray];
self.totalValueLabel.hidden = YES;
self.nobleButton.hidden = YES;
self.weekStarView.hidden = YES;
switch (_segmentType) {
case GiftSegmentType_Normal:
[self.datasource addObjectsFromArray:self.giftArray];
@@ -272,9 +303,15 @@
case GiftSegmentType_Lucky:
[self.datasource addObjectsFromArray:self.giftLuckyArray];
break;
case GiftSegmentType_Noble:
case GiftSegmentType_Noble: {
[self.datasource addObjectsFromArray:self.giftNobleArray];
self.nobleButton.hidden = NO;
}
break;
case GiftSegmentType_WeekStar: {
[self.datasource addObjectsFromArray:self.giftWeekStarArray];
self.weekStarView.hidden = NO;
}
break;
case GiftSegmentType_Pack:
{
@@ -314,6 +351,7 @@
NSMutableArray * luckyArray = [NSMutableArray array];
NSMutableArray * normaleArray = [NSMutableArray array];
NSMutableArray * nobleArray = [NSMutableArray array];
NSMutableArray * weekStarArray = [NSMutableArray array];
[_normalOriginArray enumerateObjectsUsingBlock:^(GiftInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
if (obj.giftType == GiftType_Lucky) {
[luckyArray addObject:obj];
@@ -321,11 +359,14 @@
[normaleArray addObject:obj];
} else if (obj.giftType == GiftType_Noble) {
[nobleArray addObject:obj];
} else if (obj.giftType == GiftType_WeekStar) {
[weekStarArray addObject:obj];
}
}];
self.giftArray = normaleArray;
self.giftLuckyArray = luckyArray;
self.giftNobleArray = nobleArray;
self.giftWeekStarArray = weekStarArray;
self.segmentType = GiftSegmentType_Normal;
}
@@ -362,6 +403,14 @@
return _giftStackView;
}
- (XPWeekStarInfoView *)weekStarView {
if (!_weekStarView) {
_weekStarView = [[XPWeekStarInfoView alloc] init];
_weekStarView.delegate = self;
}
return _weekStarView;
}
- (UIButton *)normalGiftButton {
if (!_normalGiftButton) {
_normalGiftButton = [UIButton buttonWithType:UIButtonTypeCustom];
@@ -379,7 +428,7 @@
- (UIButton *)luckyGiftButton {
if (!_luckyGiftButton) {
_luckyGiftButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_luckyGiftButton setTitle:@"幸运礼物" forState:UIControlStateNormal];
[_luckyGiftButton setTitle:@"幸运" forState:UIControlStateNormal];
[_luckyGiftButton setTitleColor:[ThemeColor giftSegmentSelectTitleColor] forState:UIControlStateSelected];
[_luckyGiftButton setTitleColor:[ThemeColor giftSegmentNormalTitleColor] forState:UIControlStateNormal];
_luckyGiftButton.titleLabel.font = [UIFont systemFontOfSize:14];
@@ -393,7 +442,7 @@
- (UIButton *)nobleGiftButton {
if (!_nobleGiftButton) {
_nobleGiftButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_nobleGiftButton setTitle:@"贵族礼物" forState:UIControlStateNormal];
[_nobleGiftButton setTitle:@"贵族" forState:UIControlStateNormal];
[_nobleGiftButton setTitleColor:[ThemeColor giftSegmentSelectTitleColor] forState:UIControlStateSelected];
[_nobleGiftButton setTitleColor:[ThemeColor giftSegmentNormalTitleColor] forState:UIControlStateNormal];
_nobleGiftButton.titleLabel.font = [UIFont systemFontOfSize:14];
@@ -404,6 +453,20 @@
return _nobleGiftButton;
}
- (UIButton *)weekStarButton {
if (!_weekStarButton) {
_weekStarButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_weekStarButton setTitle:@"周星" forState:UIControlStateNormal];
[_weekStarButton setTitleColor:[ThemeColor giftSegmentSelectTitleColor] forState:UIControlStateSelected];
[_weekStarButton setTitleColor:[ThemeColor giftSegmentNormalTitleColor] forState:UIControlStateNormal];
_weekStarButton.titleLabel.font = [UIFont systemFontOfSize:14];
_weekStarButton.tag = GiftSegmentType_WeekStar;
_weekStarButton.selected = NO;
[_weekStarButton addTarget:self action:@selector(didClickGiftSegmentAction:) forControlEvents:UIControlEventTouchUpInside];
}
return _weekStarButton;
}
- (UIButton *)packGiftButton {
if (!_packGiftButton) {
_packGiftButton = [UIButton buttonWithType:UIButtonTypeCustom];

View File

@@ -15,6 +15,7 @@
#import "TTPopup.h"
#import "ThemeColor+SendGift.h"
#import "StatisticsServiceHelper.h"
#import "XPHtmlUrl.h"
///Model
#import "GiftInfoModel.h"
#import "XPGiftCountModel.h"
@@ -358,6 +359,14 @@
[self.delegate.getCurrentNav pushViewController:nobleVC animated:YES];
}
- (void)xpGiftInfoViewDidClickWeekStarRank:(XPGiftInfoView *)view {
[self dismissViewControllerAnimated:YES completion:nil];
XPWebViewController * webVC = [[XPWebViewController alloc] init];
webVC.roomUid = self.roomUid;
webVC.url = URLWithType(kNewWeekStarURL);
[self.delegate.getCurrentNav pushViewController:webVC animated:YES];
}
#pragma mark - XPGiftProtocol
- (void)getUserWalletInfo:(WalletInfoModel *)balanceInfo {
self.giftBarView.walletInfoModel = balanceInfo;

View File

@@ -0,0 +1,32 @@
//
// XPWeekStarInfoView.h
// xplan-ios
//
// Created by GreenLand on 2022/5/7.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@class XPWeekStarRankUserModel;
@protocol XPWeekStarInfoViewDelegate <NSObject>
///周星榜点击
- (void)xPWeekStarInfoViewRankButtonClick;
@end
@interface XPWeekStarInfoView : UIView
///上周对应礼物的魅力榜第一
@property (nonatomic, strong) XPWeekStarRankUserModel *firstCharmRankUser;
///上周对应礼物豪气榜第一
@property (nonatomic, strong) XPWeekStarRankUserModel *firstLevelRankUser;
@property (nonatomic, weak) id<XPWeekStarInfoViewDelegate> delegate;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,178 @@
//
// XPWeekStarInfoView.m
// xplan-ios
//
// Created by GreenLand on 2022/5/7.
//
#import "XPWeekStarInfoView.h"
///Third
#import <Masonry/Masonry.h>
///Tool
#import "XPMacro.h"
#import "ThemeColor+SendGift.h"
///Model
#import "XPWeekStarRankUserModel.h"
@interface XPWeekStarInfoView()
///
@property (nonatomic, strong) UILabel *charmTitleLabel;
///
@property (nonatomic, strong) UILabel *contributeTitleLabel;
///
@property (nonatomic, strong) UILabel *charmLabel;
///
@property (nonatomic, strong) UILabel *contributeLabel;
///
@property (nonatomic, strong) UIButton *entranceButton;
///
@property (nonatomic, strong) UIImageView *arrowImageView;
@end
@implementation XPWeekStarInfoView
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self initSubViews];
[self initSubViewConstraints];
}
return self;
}
#pragma mark - Private Method
- (void)initSubViews {
[self addSubview:self.charmTitleLabel];
[self addSubview:self.contributeTitleLabel];
[self addSubview:self.charmLabel];
[self addSubview:self.contributeLabel];
[self addSubview:self.entranceButton];
[self addSubview:self.arrowImageView];
}
- (void)initSubViewConstraints {
[self.charmTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.top.mas_equalTo(0);
make.height.mas_equalTo(14);
}];
[self.charmLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.charmTitleLabel.mas_right);
make.centerY.mas_equalTo(self.charmTitleLabel);
}];
[self.contributeTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.charmLabel.mas_right).mas_offset(16);
make.centerY.mas_equalTo(self.charmTitleLabel);
}];
[self.contributeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.contributeTitleLabel.mas_right);
make.centerY.mas_equalTo(self.charmTitleLabel);
}];
[self.entranceButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(self.arrowImageView.mas_left).mas_offset(-4);
make.width.mas_equalTo(48);
make.height.mas_equalTo(14);
make.centerY.mas_equalTo(self.charmTitleLabel);
}];
[self.arrowImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(0);
make.width.mas_equalTo(7);
make.height.mas_equalTo(10);
make.centerY.mas_equalTo(self.charmTitleLabel);
}];
}
#pragma mark - events
- (void)didClickWeekStarRank:(UIButton *)sender {
if (self.delegate && [self.delegate respondsToSelector:@selector(xPWeekStarInfoViewRankButtonClick)]) {
[self.delegate xPWeekStarInfoViewRankButtonClick];
}
}
#pragma mark - getter and setter
- (void)setFirstCharmRankUser:(XPWeekStarRankUserModel *)firstCharmRankUser {
NSString *nickStr = firstCharmRankUser.nick;
if (firstCharmRankUser.nick.length > 5) {
nickStr = [NSString stringWithFormat:@"%@…", [firstCharmRankUser.nick substringToIndex:5]];
} else if(!firstCharmRankUser.nick.length) {
nickStr = @"";
}
self.charmLabel.text = nickStr;
}
- (void)setFirstLevelRankUser:(XPWeekStarRankUserModel *)firstLevelRankUser {
NSString *nickStr = firstLevelRankUser.nick;
if (firstLevelRankUser.nick.length > 5) {
nickStr = [NSString stringWithFormat:@"%@…", [firstLevelRankUser.nick substringToIndex:5]];
} else if(!firstLevelRankUser.nick.length) {
nickStr = @"";
}
self.contributeLabel.text = nickStr;
}
- (UILabel *)charmTitleLabel {
if (!_charmTitleLabel) {
UILabel *label = [[UILabel alloc] init];
label.font = [UIFont systemFontOfSize:10];
label.textColor = [ThemeColor giftSegmentNormalTitleColor];
label.text = @"本周冠名者:";
_charmTitleLabel = label;
}
return _charmTitleLabel;
}
- (UILabel *)contributeTitleLabel {
if (!_contributeTitleLabel) {
UILabel *label = [[UILabel alloc] init];
label.font = [UIFont systemFontOfSize:10];
label.textColor = [ThemeColor giftSegmentNormalTitleColor];
label.text = @"周星神豪:";
_contributeTitleLabel = label;
}
return _contributeTitleLabel;
}
- (UILabel *)charmLabel {
if (!_charmLabel) {
UILabel *label = [[UILabel alloc] init];
label.font = [UIFont systemFontOfSize:10];
label.textColor = [ThemeColor giftSegmentSelectTitleColor];
_charmLabel = label;
}
return _charmLabel;
}
- (UILabel *)contributeLabel {
if (!_contributeLabel) {
UILabel *label = [[UILabel alloc] init];
label.font = [UIFont systemFontOfSize:10];
label.textColor = [ThemeColor giftSegmentSelectTitleColor];
_contributeLabel = label;
}
return _contributeLabel;
}
- (UIButton *)entranceButton {
if (!_entranceButton) {
_entranceButton = [UIButton buttonWithType:UIButtonTypeCustom];
_entranceButton.adjustsImageWhenHighlighted = NO;
[_entranceButton setBackgroundImage:[UIImage imageNamed:@"gift_bar_weekStar_button"] forState:UIControlStateNormal];
[_entranceButton addTarget:self action:@selector(didClickWeekStarRank:) forControlEvents:UIControlEventTouchUpInside];
}
return _entranceButton;
}
- (UIImageView *)arrowImageView {
if (!_arrowImageView) {
_arrowImageView = [[UIImageView alloc] init];
_arrowImageView.image = [UIImage imageNamed:@"gift_bar_weekStar_arrow"];
}
return _arrowImageView;
}
@end

View File

@@ -152,12 +152,14 @@
NSArray *vipGift = [GiftInfoModel modelsWithArray:data.data[@"vipGift"]]; //
NSArray *luckyPoolGift = [GiftInfoModel modelsWithArray:data.data[@"luckyPoolGift"]];//
NSArray *normalGift = [GiftInfoModel modelsWithArray:data.data[@"normalGift"]]; //
NSArray *weekStarGift = [GiftInfoModel modelsWithArray:data.data[@"weekStarGift"]]; //
//TODO: luckyPoolGift
NSMutableArray *info = [NSMutableArray array];
NSMutableArray *totalInfo = [NSMutableArray array];
[info addObjectsFromArray:luckyBagGift];
[info addObjectsFromArray:vipGift];
[info addObjectsFromArray:normalGift];
[info addObjectsFromArray:weekStarGift];
[totalInfo addObjectsFromArray:info];
[totalInfo addObjectsFromArray:luckyPoolGift];
///