个人中心-贵族入口优化
This commit is contained in:
@@ -17,8 +17,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/// 获取钱包信息
|
||||
- (void)getUserWalletInfo;
|
||||
|
||||
/// 获取家族详细的信息
|
||||
- (void)getClanDetailInfo;
|
||||
///获取贵族信息
|
||||
- (void)getNobleInfo;
|
||||
|
||||
///获取个人功能列表
|
||||
- (void)getPersonItemList;
|
||||
|
@@ -13,6 +13,7 @@
|
||||
#import "Api+Guild.h"
|
||||
#import "Api+LittleGame.h"
|
||||
#import "Api+Home.h"
|
||||
#import "Api+NobleCenter.h"
|
||||
///Model
|
||||
#import "XPMineItemModel.h"
|
||||
#import "UserInfoModel.h"
|
||||
@@ -22,6 +23,7 @@
|
||||
#import "HomeBannerInfoModel.h"
|
||||
#import "HomeLittleGameRoomModel.h"
|
||||
#import "WalletInfoModel.h"
|
||||
#import "NobleCenterModel.h"
|
||||
///Protocol
|
||||
#import "XPMineProtocol.h"
|
||||
@implementation XPMinePresent
|
||||
@@ -52,16 +54,12 @@
|
||||
}] uid:uid ticket:ticket];
|
||||
}
|
||||
|
||||
/// 获取家族详细的信息
|
||||
- (void)getClanDetailInfo {
|
||||
NSString * uid = [[AccountInfoStorage instance] getUid];
|
||||
if (uid == nil) {
|
||||
return;
|
||||
}
|
||||
[Api getClanDetailInfo:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
ClanDetailInfoModel * clanDetailInfo = [ClanDetailInfoModel modelWithDictionary:data.data];
|
||||
[[self getView] onGetClanDetailInfoSuccess:clanDetailInfo];
|
||||
}] uid:uid];
|
||||
///获取贵族信息
|
||||
- (void)getNobleInfo {
|
||||
[Api nobleCenterLevelList:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
NobleCenterModel *model = [NobleCenterModel modelWithDictionary:data.data];
|
||||
[[self getView] getNobleCenterInfoSuccess:model];
|
||||
}]];
|
||||
}
|
||||
|
||||
///获取个人功能列表
|
||||
|
@@ -8,16 +8,15 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
@class XPMineItemModel, UserInfoModel, ClanDetailInfoModel, XPMineFuntionItemModel, LittleGameInfoModel, HomeBannerInfoModel, WalletInfoModel, HomeLittleGameRoomModel;
|
||||
@class XPMineItemModel, UserInfoModel, NobleCenterModel, XPMineFuntionItemModel, LittleGameInfoModel, HomeBannerInfoModel, WalletInfoModel, HomeLittleGameRoomModel;
|
||||
@protocol XPMineProtocol <NSObject>
|
||||
|
||||
///获取用户信息成功
|
||||
- (void)onGetUserInfoSuccess:(UserInfoModel *)userInfo;
|
||||
///获取家族公会信息成功
|
||||
- (void)onGetClanDetailInfoSuccess:(ClanDetailInfoModel *)clanInfo;
|
||||
///获取账户余额
|
||||
- (void)getUserWalletInfo:(WalletInfoModel *)balanceInfo;
|
||||
|
||||
///获取贵族信息成功
|
||||
- (void)getNobleCenterInfoSuccess:(NobleCenterModel *)model;
|
||||
///获取个人中心功能
|
||||
- (void)onGetMineFuntionItemSuccess:(NSArray<XPMineFuntionItemModel *> *)items;
|
||||
///获取小游戏列表
|
||||
|
@@ -7,12 +7,14 @@
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "UserVipInfoVo.h"
|
||||
#import "NobleCenterModel.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface XPNobleCenterEntranceView : UIView
|
||||
|
||||
@property (nonatomic, strong) UserVipInfoVo *vipInfo;
|
||||
@property (nonatomic, strong) NobleCenterModel *nobleInfo;
|
||||
|
||||
@end
|
||||
|
||||
|
@@ -9,6 +9,7 @@
|
||||
#import <Masonry/Masonry.h>
|
||||
#import "ThemeColor.h"
|
||||
#import "NetImageView.h"
|
||||
#import "UIImage+Utils.h"
|
||||
|
||||
@interface XPNobleCenterEntranceView ()
|
||||
|
||||
@@ -17,6 +18,12 @@
|
||||
@property (nonatomic,strong) NetImageView *nobleIconImage;
|
||||
@property (nonatomic, strong) UILabel *titleLabel;
|
||||
@property (nonatomic, strong) UILabel *descLabel;
|
||||
///底层进度条
|
||||
@property (nonatomic, strong) UIView *backProgressView;
|
||||
///当前进度条
|
||||
@property (nonatomic, strong) UIImageView *currentProgressView;
|
||||
///下一等级
|
||||
@property (nonatomic, strong) UILabel *nextLevelLabel;
|
||||
|
||||
@end
|
||||
|
||||
@@ -37,6 +44,9 @@
|
||||
[self addSubview:self.bgImageView];
|
||||
[self addSubview:self.titleLabel];
|
||||
[self addSubview:self.descLabel];
|
||||
[self addSubview:self.backProgressView];
|
||||
[self.backProgressView addSubview:self.currentProgressView];
|
||||
[self.backProgressView addSubview:self.nextLevelLabel];
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
@@ -56,26 +66,71 @@
|
||||
make.right.mas_equalTo(0);
|
||||
make.height.mas_equalTo(14);
|
||||
}];
|
||||
|
||||
[self.backProgressView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.mas_equalTo(self).inset(14);
|
||||
make.height.mas_equalTo(10);
|
||||
make.top.mas_equalTo(self.descLabel.mas_bottom).mas_offset(2);
|
||||
}];
|
||||
[self.currentProgressView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.top.bottom.mas_equalTo(self.backProgressView);
|
||||
make.width.mas_equalTo(0);
|
||||
}];
|
||||
[self.nextLevelLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.mas_equalTo(-4);
|
||||
make.centerY.mas_equalTo(self.backProgressView);
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)setVipInfo:(UserVipInfoVo *)vipInfo {
|
||||
_vipInfo = vipInfo;
|
||||
if (vipInfo) {
|
||||
// [self addSubview:self.nobleIconImage];
|
||||
// self.nobleIconImage.imageUrl = vipInfo.vipIcon;
|
||||
// self.titleLabel.text = vipInfo.vipName;
|
||||
[self addSubview:self.nobleIconImage];
|
||||
self.nobleIconImage.imageUrl = vipInfo.vipIcon;
|
||||
self.titleLabel.text = vipInfo.vipName;
|
||||
self.bgImageView.image = [UIImage imageNamed:@"mine_noble_entrance_hadNoble"];
|
||||
// [self.nobleIconImage mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
// make.left.mas_equalTo(14);
|
||||
// make.centerY.mas_equalTo(self.titleLabel);
|
||||
// make.size.mas_equalTo(CGSizeMake(25, 19));
|
||||
// }];
|
||||
// [self.titleLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
// make.left.mas_equalTo(self.nobleIconImage.mas_right).mas_offset(5);
|
||||
// make.bottom.mas_equalTo(self.mas_centerY);
|
||||
// make.right.mas_equalTo(0);
|
||||
// make.height.mas_equalTo(22);
|
||||
// }];
|
||||
self.descLabel.text = @"查看我的特权";
|
||||
[self.nobleIconImage mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(14);
|
||||
make.centerY.mas_equalTo(self.titleLabel);
|
||||
make.size.mas_equalTo(CGSizeMake(25, 19));
|
||||
}];
|
||||
[self.titleLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.nobleIconImage.mas_right).mas_offset(5);
|
||||
make.top.mas_equalTo(8);
|
||||
make.right.mas_equalTo(0);
|
||||
make.height.mas_equalTo(22);
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setNobleInfo:(NobleCenterModel *)nobleInfo {
|
||||
if (self.vipInfo) {
|
||||
self.backProgressView.hidden = NO;
|
||||
NSInteger distanceValue = 0;
|
||||
NSInteger saveScore = 0;
|
||||
NSInteger nextScore = 0;
|
||||
NSString *nextLevelName = @"";
|
||||
BOOL hadNextLevel = YES;//标记
|
||||
for (NobleInfo *info in nobleInfo.vipInfos) {
|
||||
if (info.vipLevel == nobleInfo.currLevel) {
|
||||
saveScore = info.levelKeepScore;
|
||||
nextScore = info.levelUpScore;
|
||||
distanceValue = info.levelUpScore - nobleInfo.currScore;
|
||||
}
|
||||
if (info.vipLevel > nobleInfo.currLevel && hadNextLevel) {
|
||||
hadNextLevel = NO;
|
||||
nextLevelName = info.vipName;
|
||||
}
|
||||
}
|
||||
self.descLabel.text = [NSString stringWithFormat:@"距下一等级还差%ld权力值", distanceValue];
|
||||
self.nextLevelLabel.text = nextLevelName;
|
||||
|
||||
CGFloat margin = self.backProgressView.frame.size.width * (nobleInfo.currScore * 1.0 / nextScore);
|
||||
[self.currentProgressView mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.mas_equalTo(self.backProgressView.mas_left).mas_offset(margin);
|
||||
}];
|
||||
} else {
|
||||
self.backProgressView.hidden = YES;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,4 +172,35 @@
|
||||
return _nobleIconImage;
|
||||
}
|
||||
|
||||
- (UIView *)backProgressView {
|
||||
if (!_backProgressView) {
|
||||
_backProgressView = [[UIView alloc] init];
|
||||
_backProgressView.backgroundColor = UIColorFromRGB(0x8770DC);
|
||||
_backProgressView.layer.cornerRadius = 5;
|
||||
_backProgressView.layer.masksToBounds = YES;
|
||||
_backProgressView.hidden = YES;
|
||||
}
|
||||
return _backProgressView;
|
||||
}
|
||||
|
||||
- (UIImageView *)currentProgressView {
|
||||
if (!_currentProgressView) {
|
||||
_currentProgressView = [[UIImageView alloc] init];
|
||||
UIImage *image = [UIImage gradientColorImageFromColors:@[UIColorFromRGB(0xFFFFFF),UIColorFromRGB(0xFFFFFF)] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)];
|
||||
_currentProgressView.image = image;
|
||||
_currentProgressView.layer.cornerRadius = 5;
|
||||
_currentProgressView.layer.masksToBounds = YES;
|
||||
}
|
||||
return _currentProgressView;
|
||||
}
|
||||
|
||||
- (UILabel *)nextLevelLabel {
|
||||
if (!_nextLevelLabel) {
|
||||
_nextLevelLabel = [[UILabel alloc] init];
|
||||
_nextLevelLabel.font = [UIFont systemFontOfSize:8];
|
||||
_nextLevelLabel.textColor = [UIColor whiteColor];
|
||||
}
|
||||
return _nextLevelLabel;
|
||||
}
|
||||
|
||||
@end
|
||||
|
@@ -8,7 +8,7 @@
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
@class UserInfoModel,XPMineHeadView, WalletInfoModel;
|
||||
@class UserInfoModel,XPMineHeadView, WalletInfoModel, NobleCenterModel;
|
||||
@protocol XPMineHeadViewDelegate <NSObject>
|
||||
///点击了头像
|
||||
- (void)xPMineHeadView:(XPMineHeadView *)view didClickAvatar:(UserInfoModel *)info;
|
||||
@@ -36,6 +36,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@property (nonatomic,assign) id<XPMineHeadViewDelegate> delegate;
|
||||
///访客未读数量
|
||||
@property (nonatomic, assign) NSInteger visitorUnReadCount;
|
||||
@property (nonatomic, strong) NobleCenterModel *nobleInfo;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -22,6 +22,7 @@
|
||||
///Model
|
||||
#import "UserInfoModel.h"
|
||||
#import "WalletInfoModel.h"
|
||||
#import "NobleCenterModel.h"
|
||||
|
||||
@interface XPMineHeadView ()
|
||||
///头像
|
||||
@@ -441,6 +442,10 @@
|
||||
self.visitorView.visitorNum = visitorUnReadCount;
|
||||
}
|
||||
|
||||
- (void)setNobleInfo:(NobleCenterModel *)nobleInfo {
|
||||
self.nobleEntranceView.nobleInfo = nobleInfo;
|
||||
}
|
||||
|
||||
- (NetImageView *)avatarImageView {
|
||||
if (!_avatarImageView) {
|
||||
NetImageConfig * config = [[NetImageConfig alloc]init];
|
||||
|
@@ -29,6 +29,7 @@
|
||||
#import "LittleGameInfoModel.h"
|
||||
#import "WalletInfoModel.h"
|
||||
#import "HomeLittleGameRoomModel.h"
|
||||
#import "NobleCenterModel.h"
|
||||
///P
|
||||
#import "XPMineProtocol.h"
|
||||
#import "XPMinePresent.h"
|
||||
@@ -417,12 +418,18 @@
|
||||
self.userInfo = userInfo;
|
||||
self.headView.userInfo = userInfo;
|
||||
[self.tableView reloadData];
|
||||
[self.presenter getNobleInfo];
|
||||
}
|
||||
|
||||
- (void)getUserWalletInfo:(WalletInfoModel *)balanceInfo {
|
||||
self.headView.walletInfo = balanceInfo;
|
||||
}
|
||||
|
||||
///获取贵族信息成功
|
||||
- (void)getNobleCenterInfoSuccess:(NobleCenterModel *)model {
|
||||
self.headView.nobleInfo = model;
|
||||
}
|
||||
|
||||
- (void)onGetClanDetailInfoSuccess:(ClanDetailInfoModel *)clanInfo {
|
||||
self.clanInfo = clanInfo;
|
||||
}
|
||||
|
Reference in New Issue
Block a user