主播评级

This commit is contained in:
fengshuo
2022-12-13 21:09:48 +08:00
parent 942fc0639e
commit 1f9e998402
61 changed files with 1225 additions and 5 deletions

View File

@@ -1090,6 +1090,10 @@
E8C1CD7627D8AE3D00376F83 /* XPRoomFacePresenter.m in Sources */ = {isa = PBXBuildFile; fileRef = E8C1CD7527D8AE3D00376F83 /* XPRoomFacePresenter.m */; };
E8C1CD7A27D8B29E00376F83 /* RoomFaceInfoModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E8C1CD7927D8B29E00376F83 /* RoomFaceInfoModel.m */; };
E8C21501274B76F60079E6BF /* XPRoomAnimationHitView.m in Sources */ = {isa = PBXBuildFile; fileRef = E8C21500274B76F60079E6BF /* XPRoomAnimationHitView.m */; };
E8C219F92948527200344FC5 /* AnchorLevelView.m in Sources */ = {isa = PBXBuildFile; fileRef = E8C219F82948527200344FC5 /* AnchorLevelView.m */; };
E8C219FC294852F900344FC5 /* AnchorLevelProgressView.m in Sources */ = {isa = PBXBuildFile; fileRef = E8C219FB294852F900344FC5 /* AnchorLevelProgressView.m */; };
E8C21A00294854DA00344FC5 /* AnchorLevelModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E8C219FF294854DA00344FC5 /* AnchorLevelModel.m */; };
E8C21A032948651F00344FC5 /* AnchorLevelTimeView.m in Sources */ = {isa = PBXBuildFile; fileRef = E8C21A022948651F00344FC5 /* AnchorLevelTimeView.m */; };
E8C6FFCA27548120004DC9F0 /* XPHomePresenter.m in Sources */ = {isa = PBXBuildFile; fileRef = E8C6FFC027548120004DC9F0 /* XPHomePresenter.m */; };
E8C6FFCB27548120004DC9F0 /* XPHomePartyViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E8C6FFC527548120004DC9F0 /* XPHomePartyViewController.m */; };
E8C6FFCC27548120004DC9F0 /* Api+Home.m in Sources */ = {isa = PBXBuildFile; fileRef = E8C6FFC827548120004DC9F0 /* Api+Home.m */; };
@@ -3264,6 +3268,14 @@
E8C1CD7927D8B29E00376F83 /* RoomFaceInfoModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RoomFaceInfoModel.m; sourceTree = "<group>"; };
E8C214FF274B76F60079E6BF /* XPRoomAnimationHitView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomAnimationHitView.h; sourceTree = "<group>"; };
E8C21500274B76F60079E6BF /* XPRoomAnimationHitView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomAnimationHitView.m; sourceTree = "<group>"; };
E8C219F72948527200344FC5 /* AnchorLevelView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AnchorLevelView.h; sourceTree = "<group>"; };
E8C219F82948527200344FC5 /* AnchorLevelView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AnchorLevelView.m; sourceTree = "<group>"; };
E8C219FA294852F900344FC5 /* AnchorLevelProgressView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AnchorLevelProgressView.h; sourceTree = "<group>"; };
E8C219FB294852F900344FC5 /* AnchorLevelProgressView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AnchorLevelProgressView.m; sourceTree = "<group>"; };
E8C219FE294854DA00344FC5 /* AnchorLevelModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AnchorLevelModel.h; sourceTree = "<group>"; };
E8C219FF294854DA00344FC5 /* AnchorLevelModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AnchorLevelModel.m; sourceTree = "<group>"; };
E8C21A012948651F00344FC5 /* AnchorLevelTimeView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AnchorLevelTimeView.h; sourceTree = "<group>"; };
E8C21A022948651F00344FC5 /* AnchorLevelTimeView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AnchorLevelTimeView.m; sourceTree = "<group>"; };
E8C6FFBF27548120004DC9F0 /* XPHomePresenter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XPHomePresenter.h; sourceTree = "<group>"; };
E8C6FFC027548120004DC9F0 /* XPHomePresenter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XPHomePresenter.m; sourceTree = "<group>"; };
E8C6FFC227548120004DC9F0 /* XPHomeProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XPHomeProtocol.h; sourceTree = "<group>"; };
@@ -8186,6 +8198,28 @@
path = Cell;
sourceTree = "<group>";
};
E8C219F62948525500344FC5 /* AnchorLevel */ = {
isa = PBXGroup;
children = (
E8C219F72948527200344FC5 /* AnchorLevelView.h */,
E8C219F82948527200344FC5 /* AnchorLevelView.m */,
E8C219FA294852F900344FC5 /* AnchorLevelProgressView.h */,
E8C219FB294852F900344FC5 /* AnchorLevelProgressView.m */,
E8C21A012948651F00344FC5 /* AnchorLevelTimeView.h */,
E8C21A022948651F00344FC5 /* AnchorLevelTimeView.m */,
);
path = AnchorLevel;
sourceTree = "<group>";
};
E8C219FD294854C300344FC5 /* AnchorLevel */ = {
isa = PBXGroup;
children = (
E8C219FE294854DA00344FC5 /* AnchorLevelModel.h */,
E8C219FF294854DA00344FC5 /* AnchorLevelModel.m */,
);
path = AnchorLevel;
sourceTree = "<group>";
};
E8C6FFBD27548120004DC9F0 /* Home */ = {
isa = PBXGroup;
children = (
@@ -8607,6 +8641,7 @@
E8E70D7026F2EB3800F03460 /* Model */ = {
isa = PBXGroup;
children = (
E8C219FD294854C300344FC5 /* AnchorLevel */,
9BD2ECCF288F832300F5CD9A /* FootPrint */,
E80B070F280D0A6700A79F63 /* Friend */,
9B1B729A28002249003FACE9 /* AnchorFansTeam */,
@@ -8758,6 +8793,7 @@
E8E70D7F26F2F39000F03460 /* SubViews */ = {
isa = PBXGroup;
children = (
E8C219F62948525500344FC5 /* AnchorLevel */,
9BBC02882786E0060007C24B /* NobleCenter */,
E8B846CC26FDD93D00A777FE /* Recharge */,
E88B5CC226FB429C00DA9178 /* MineInfo */,
@@ -9532,6 +9568,7 @@
E80B0712280D0A6700A79F63 /* FansInfoModel.m in Sources */,
E8EEB8F326FC2050007C6EBA /* SDWaitingView.m in Sources */,
E8F9168B27EC940E00F10D8F /* XPHomeLittleGameTableViewCell.m in Sources */,
E8C219FC294852F900344FC5 /* AnchorLevelProgressView.m in Sources */,
E8DEC9A12764A5D20078CB70 /* XPRoomMoreItemModel.m in Sources */,
E80EC81028ACD84000D133C5 /* QExtendBoardView.m in Sources */,
9B87B3CD2926473D00085110 /* XPSessionListHeadFriendCell.m in Sources */,
@@ -9728,6 +9765,7 @@
186A534E26FC6ED900D67B2C /* TTPopupService.m in Sources */,
18A61BD7274F7F6900A09A54 /* NetImageConfig.m in Sources */,
E800806E27FD6BF40055A8AB /* XPGuildPresenter.m in Sources */,
E8C21A032948651F00344FC5 /* AnchorLevelTimeView.m in Sources */,
E8C21501274B76F60079E6BF /* XPRoomAnimationHitView.m in Sources */,
E873EB0F28098D500071030D /* MessageContentGiftView.m in Sources */,
E8D34D4D28080351009C4835 /* XPMineDataClanTableViewCell.m in Sources */,
@@ -10034,6 +10072,7 @@
E8C6FFDA2754BE81004DC9F0 /* ThemeColor+Home.m in Sources */,
E80A086227F2AC190027B30C /* RoomPKDetailInfoModel.m in Sources */,
E824545126F5CE6E00BE8163 /* XPMineModifPayPwdPresenter.m in Sources */,
E8C21A00294854DA00344FC5 /* AnchorLevelModel.m in Sources */,
E8A86DF727BA2F1C001C21F9 /* XPRoomLittleGameContainerView.m in Sources */,
E8098CB1282E86EF0090B9F0 /* XPMonentsContentView.m in Sources */,
E85E3FA728B7A6F000268DC8 /* MessageContentMonentsView.m in Sources */,
@@ -10202,6 +10241,7 @@
E8A6C28C27CF436300AC7442 /* XPHomeLikeViewController.m in Sources */,
E878B8582835F0D300E22DCF /* MonentsInteractiveModel.m in Sources */,
9BCF586227995426008401A4 /* XPSkillCardSelectPropCell.m in Sources */,
E8C219F92948527200344FC5 /* AnchorLevelView.m in Sources */,
9B64BCB028E2A3D900778F13 /* XPMineHeadTeenagerView.m in Sources */,
9BD2ECCE288F829600F5CD9A /* XPMineFootPrintViewController.m in Sources */,
9B4E920028E57A620033419E /* XPGiftHeadTypeView.m in Sources */,

View File

@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

@@ -280,6 +280,11 @@ NS_ASSUME_NONNULL_BEGIN
/// @param completion 完成
+ (void)requestFansParty:(HttpRequestHelperCompletion)completion;
/// 请求主播评级
/// @param completion 完成
+ (void)requestAnchorGradeInfo:(HttpRequestHelperCompletion)completion;
@end
NS_ASSUME_NONNULL_END

View File

@@ -312,7 +312,12 @@
///
/// @param completion
+ (void)requestFansParty:(HttpRequestHelperCompletion)completion {
[self makeRequest:@"fans/fansPartList" method:HttpRequestHelperMethodGET completion:completion, __FUNCTION__, nil];
[self makeRequest:@"fans/fansPartList" method:HttpRequestHelperMethodGET completion:completion, __FUNCTION__, nil];
}
///
/// @param completion
+ (void)requestAnchorGradeInfo:(HttpRequestHelperCompletion)completion {
[self makeRequest:@"anchorGrade/get" method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__, nil];
}
@end

View File

@@ -0,0 +1,32 @@
//
// AnchorLevelModel.h
// xplan-ios
//
// Created by 冯硕 on 2022/12/13.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface AnchorLevelModel : NSObject
///uid
@property (nonatomic,assign) NSInteger uid;
/// 最高等级需要的钻石数
@property (nonatomic,assign) NSInteger currentDiamond;
///最高等级s
@property (nonatomic,assign) NSInteger targetDiamond;
///等级 S / A / B / C / D
@property (nonatomic,copy) NSString *grade;
///当前回复率,小数点形式
@property (nonatomic,assign) CGFloat currentReply;
///本周期结束剩余时长(秒)
@property (nonatomic,assign) int nextRemaining;
///最高等级需要的回复率
@property (nonatomic,assign) CGFloat targetReply;
///本地字段
///下一个等级 S / A / B / C / D
@property (nonatomic,copy) NSString *nextGrade;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,29 @@
//
// AnchorLevelModel.m
// xplan-ios
//
// Created by on 2022/12/13.
//
#import "AnchorLevelModel.h"
@implementation AnchorLevelModel
/// S / A / B / C / D
- (void)setGrade:(NSString *)grade {
_grade = grade;
if ([_grade isEqualToString:@"D"]) {
self.nextGrade = @"C";
} else if ([_grade isEqualToString:@"C"]) {
self.nextGrade = @"B";
} else if ([_grade isEqualToString:@"B"]) {
self.nextGrade = @"S";
}else if ([_grade isEqualToString:@"A"]) {
self.nextGrade = @"S";
}else {
self.nextGrade = @"S";
}
}
@end

View File

@@ -36,6 +36,9 @@ NS_ASSUME_NONNULL_BEGIN
/// @param mgId 游戏ID
- (void)quickMatchLittleGameWithMgId:(NSString *)mgId;
///主播评级
- (void)getAnchorGradeInfo;
@end
NS_ASSUME_NONNULL_END

View File

@@ -26,6 +26,7 @@
#import "WalletInfoModel.h"
#import "NobleCenterModel.h"
#import "ClanDetailInfoModel.h"
#import "AnchorLevelModel.h"
///Protocol
#import "XPMineProtocol.h"
@implementation XPMinePresent
@@ -127,4 +128,12 @@
}] uid:uid mgId:mgId];
}
///
- (void)getAnchorGradeInfo {
[Api requestAnchorGradeInfo:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
AnchorLevelModel * model = [AnchorLevelModel modelWithDictionary:data.data];
[[self getView] getAnchorGradeInfoSuccess:model];
}]];
}
@end

View File

@@ -8,7 +8,7 @@
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@class XPMineItemModel, UserInfoModel, NobleCenterModel, ClanDetailInfoModel, XPMineFuntionItemModel, LittleGameInfoModel, HomeBannerInfoModel, WalletInfoModel, HomeLittleGameRoomModel;
@class XPMineItemModel, UserInfoModel, NobleCenterModel, ClanDetailInfoModel, XPMineFuntionItemModel, LittleGameInfoModel, HomeBannerInfoModel, WalletInfoModel, HomeLittleGameRoomModel, AnchorLevelModel;
@protocol XPMineProtocol <NSObject>
///获取用户信息成功
@@ -29,6 +29,8 @@ NS_ASSUME_NONNULL_BEGIN
///匹配游戏房成功
- (void)quickMatchLittleGameRoomSuccess:(HomeLittleGameRoomModel *)roomInfo mgId:(NSString *)mgId;
///获取主播评级成功
- (void)getAnchorGradeInfoSuccess:(AnchorLevelModel *)info;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,19 @@
//
// AnchorLevelProgressView.h
// xplan-ios
//
// Created by 冯硕 on 2022/12/13.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@class AnchorLevelModel;
@interface AnchorLevelProgressView : UIView
///评级信息
@property (nonatomic,strong) AnchorLevelModel *levelInfo;
///是否是钻石
@property (nonatomic,assign) BOOL isDiamond;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,181 @@
//
// AnchorLevelProgressView.m
// xplan-ios
//
// Created by on 2022/12/13.
//
#import "AnchorLevelProgressView.h"
///Third
#import <Masonry/Masonry.h>
///Tool
#import "ThemeColor.h"
#import "UIImage+Utils.h"
///Model
#import "AnchorLevelModel.h"
@interface AnchorLevelProgressView ()
///
@property (nonatomic,strong) UILabel *taskLabel;
///
@property (nonatomic,strong) UIView *backView;
///
@property (nonatomic,strong) UILabel *currentLevelLabel;
///
@property (nonatomic,strong) UILabel *nextLevelLabel;
///
@property (nonatomic,strong) UILabel *titleLabel;
///
@property (nonatomic,strong) UIImageView *progressView;
@end
@implementation AnchorLevelProgressView
- (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.taskLabel];
[self addSubview:self.backView];
[self.backView addSubview:self.progressView];
[self.backView addSubview:self.currentLevelLabel];
[self.backView addSubview:self.nextLevelLabel];
[self.backView addSubview:self.titleLabel];
}
- (void)initSubViewConstraints {
[self.taskLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self).offset(18);
make.top.mas_equalTo(self);
}];
[self.backView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self);
make.width.mas_equalTo(260);
make.height.mas_equalTo(16);
make.top.mas_equalTo(self.taskLabel.mas_bottom).offset(8);
}];
[self.currentLevelLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(self.backView);
make.left.mas_equalTo(self.backView).offset(5);
}];
[self.nextLevelLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(self.backView);
make.right.mas_equalTo(self.backView).offset(-5);
}];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.currentLevelLabel.mas_right).offset(2);
make.centerY.mas_equalTo(self.backView);
}];
[self.progressView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.top.bottom.mas_equalTo(self.backView);
make.width.mas_equalTo(20);
}];
}
#pragma mark - Getters And Setters
- (void)setLevelInfo:(AnchorLevelModel *)levelInfo {
_levelInfo = levelInfo;
if (_levelInfo) {
self.currentLevelLabel.text = _levelInfo.grade;
self.nextLevelLabel.text = _levelInfo.nextGrade;
if (self.isDiamond) {
NSString * diamond = [NSString stringWithFormat:@"%ld", _levelInfo.currentDiamond];
NSString * task = [NSString stringWithFormat:@"收礼钻石数:%@", diamond];
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] initWithString:task attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:11], NSForegroundColorAttributeName:[ThemeColor colorWithHexString:@"#8A8CAB"]}];
[attribute addAttribute:NSForegroundColorAttributeName value:[ThemeColor colorWithHexString:@"#F86099"] range:[task rangeOfString:diamond]];
self.taskLabel.attributedText = attribute;
self.titleLabel.text = [NSString stringWithFormat:@"还差%ld钻可完成", (_levelInfo.targetDiamond - _levelInfo.currentDiamond)];
CGFloat itemWidth = ((CGFloat)_levelInfo.currentDiamond / (CGFloat)_levelInfo.targetDiamond)* 260;
[self.progressView mas_updateConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(itemWidth);
}];
} else {
NSString * diamond = [NSString stringWithFormat:@"%.0f%@", _levelInfo.currentReply * 100, @"%"];
NSString * task = [NSString stringWithFormat:@"新用户私聊回复率:%@", diamond];
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] initWithString:task attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:11], NSForegroundColorAttributeName:[ThemeColor colorWithHexString:@"#8A8CAB"]}];
[attribute addAttribute:NSForegroundColorAttributeName value:[ThemeColor colorWithHexString:@"#F86099"] range:[task rangeOfString:diamond]];
self.taskLabel.attributedText = attribute;
self.titleLabel.text = [NSString stringWithFormat:@"还差%.0f%@可完成", (_levelInfo.targetReply - _levelInfo.currentReply) * 100, @"%"];
CGFloat itemWidth = _levelInfo.currentReply * 260;
[self.progressView mas_updateConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(itemWidth);
}];
}
}
}
- (UILabel *)taskLabel {
if (!_taskLabel) {
_taskLabel = [[UILabel alloc] init];
}
return _taskLabel;
}
- (UILabel *)currentLevelLabel {
if (!_currentLevelLabel) {
_currentLevelLabel = [[UILabel alloc] init];
_currentLevelLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightMedium];
_currentLevelLabel.textColor = [UIColor whiteColor];
}
return _currentLevelLabel;
}
- (UILabel *)nextLevelLabel {
if (!_nextLevelLabel) {
_nextLevelLabel = [[UILabel alloc] init];
_nextLevelLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightMedium];
_nextLevelLabel.textColor = [UIColor whiteColor];
}
return _nextLevelLabel;
}
- (UILabel *)titleLabel {
if (!_titleLabel) {
_titleLabel = [[UILabel alloc] init];
_titleLabel.font = [UIFont systemFontOfSize:10];
_titleLabel.textColor = [UIColor whiteColor];
}
return _titleLabel;
}
- (UIView *)backView {
if (!_backView) {
_backView = [[UIView alloc] init];
_backView.backgroundColor = UIColorRGBAlpha(0x000124, 0.1);
_backView.layer.masksToBounds = YES;
_backView.layer.cornerRadius = 8;
}
return _backView;
}
- (UIImageView *)progressView {
if (!_progressView) {
_progressView = [[UIImageView alloc] init];
_progressView.userInteractionEnabled = YES;
_progressView.image = [UIImage gradientColorImageFromColors:@[[ThemeColor colorWithHexString:@"#FFAAAA"], [ThemeColor colorWithHexString:@"#FF5A88"]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)];
_progressView.contentMode = UIViewContentModeScaleAspectFill;
_progressView.layer.masksToBounds = YES;
_progressView.layer.cornerRadius = 8;
}
return _progressView;
}
@end

View File

@@ -0,0 +1,17 @@
//
// AnchorLevelTimeView.h
// xplan-ios
//
// Created by 冯硕 on 2022/12/13.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface AnchorLevelTimeView : UIView
///剩余时间秒
@property (nonatomic,assign) int nextRemaining;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,259 @@
//
// AnchorLevelTimeView.m
// xplan-ios
//
// Created by on 2022/12/13.
//
#import "AnchorLevelTimeView.h"
///Third
#import <Masonry/Masonry.h>
///Tool
#import "ThemeColor.h"
@interface AnchorLevelTimeView ()
///
@property (nonatomic,strong) UILabel *firstHourLabel;
///
@property (nonatomic,strong) UILabel *secondHourLabel;
///
@property (nonatomic,strong) UILabel *hourLabel;
///
@property (nonatomic,strong) UILabel *firstMinuteLabel;
///
@property (nonatomic,strong) UILabel *secondMinuteLabel;
///
@property (nonatomic,strong) UILabel *minuteLabel;
///
@property (nonatomic,strong) UILabel *firstSecondLabel;
///
@property (nonatomic,strong) UILabel *secondSecondabel;
///
@property (nonatomic,strong) UILabel *secondsLabel;
@end
@implementation AnchorLevelTimeView
- (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.firstHourLabel];
[self addSubview:self.secondHourLabel];
[self addSubview:self.hourLabel];
[self addSubview:self.firstMinuteLabel];
[self addSubview:self.secondMinuteLabel];
[self addSubview:self.minuteLabel];
[self addSubview:self.firstSecondLabel];
[self addSubview:self.secondSecondabel];
[self addSubview:self.secondsLabel];
}
- (void)initSubViewConstraints {
[self.firstHourLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(24, 24));
make.top.mas_equalTo(self);
make.left.mas_equalTo(self).offset(44);
}];
[self.secondHourLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.centerY.mas_equalTo(self.firstHourLabel);
make.left.mas_equalTo(self.firstHourLabel.mas_right).offset(4);
}];
[self.hourLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(self.firstHourLabel);
make.width.mas_equalTo(20);
make.left.mas_equalTo(self.secondHourLabel.mas_right);
}];
[self.firstMinuteLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.centerY.mas_equalTo(self.firstHourLabel);
make.left.mas_equalTo(self.hourLabel.mas_right).offset(0);
}];
[self.secondMinuteLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.centerY.mas_equalTo(self.firstHourLabel);
make.left.mas_equalTo(self.firstMinuteLabel.mas_right).offset(4);
}];
[self.minuteLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(self.firstHourLabel);
make.width.mas_equalTo(20);
make.left.mas_equalTo(self.secondMinuteLabel.mas_right);
}];
[self.firstSecondLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.centerY.mas_equalTo(self.firstHourLabel);
make.left.mas_equalTo(self.minuteLabel.mas_right).offset(0);
}];
[self.secondSecondabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.centerY.mas_equalTo(self.firstHourLabel);
make.left.mas_equalTo(self.firstSecondLabel.mas_right).offset(4);
}];
[self.secondsLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(self.firstHourLabel);
make.width.mas_equalTo(20);
make.left.mas_equalTo(self.secondSecondabel.mas_right);
}];
}
#pragma mark - Getters And Setters
- (void)setNextRemaining:(int)nextRemaining {
_nextRemaining = nextRemaining;
if (_nextRemaining > 0) {
int seconds = _nextRemaining % 60;
int minutes = (_nextRemaining / 60) % 60;
int hours = _nextRemaining / 3600;
NSString * hour = [NSString stringWithFormat:@"%02d", hours];
NSString * minute = [NSString stringWithFormat:@"%02d", minutes];
NSString * second = [NSString stringWithFormat:@"%02d", seconds];
if (second.length > 1){
self.firstSecondLabel.text = [second substringWithRange:NSMakeRange(0, second.length -1)];
self.secondSecondabel.text = [second substringFromIndex:second.length - 1];
}
if (minute.length > 1){
self.firstMinuteLabel.text = [second substringWithRange:NSMakeRange(0, second.length -1)];
self.secondMinuteLabel.text = [second substringFromIndex:second.length - 1];
}
if (hour.length > 1){
self.firstHourLabel.text = [second substringWithRange:NSMakeRange(0, second.length -1)];
self.secondHourLabel.text = [second substringFromIndex:second.length - 1];
}
}
}
- (UILabel *)firstHourLabel {
if (!_firstHourLabel) {
_firstHourLabel = [[UILabel alloc] init];
_firstHourLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightMedium];
_firstHourLabel.textColor = [ThemeColor mainTextColor];
_firstHourLabel.backgroundColor = [ThemeColor colorWithHexString:@"#E8EAF3"];
_firstHourLabel.textAlignment = NSTextAlignmentCenter;
_firstHourLabel.layer.masksToBounds = YES;
_firstHourLabel.layer.cornerRadius = 4;
_firstHourLabel.text = @"0";
}
return _firstHourLabel;
}
- (UILabel *)secondHourLabel {
if (!_secondHourLabel) {
_secondHourLabel = [[UILabel alloc] init];
_secondHourLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightMedium];
_secondHourLabel.textColor = [ThemeColor mainTextColor];
_secondHourLabel.backgroundColor = [ThemeColor colorWithHexString:@"#E8EAF3"];
_secondHourLabel.textAlignment = NSTextAlignmentCenter;
_secondHourLabel.layer.masksToBounds = YES;
_secondHourLabel.layer.cornerRadius = 4;
_secondHourLabel.text = @"0";
}
return _secondHourLabel;
}
- (UILabel *)hourLabel {
if (!_hourLabel) {
_hourLabel = [[UILabel alloc] init];
_hourLabel.font = [UIFont systemFontOfSize:12];
_hourLabel.textColor = [ThemeColor mainTextColor];
_hourLabel.text = @"时";
}
return _hourLabel;
}
- (UILabel *)firstMinuteLabel {
if (!_firstMinuteLabel) {
_firstMinuteLabel = [[UILabel alloc] init];
_firstMinuteLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightMedium];
_firstMinuteLabel.textColor = [ThemeColor mainTextColor];
_firstMinuteLabel.backgroundColor = [ThemeColor colorWithHexString:@"#E8EAF3"];
_firstMinuteLabel.textAlignment = NSTextAlignmentCenter;
_firstMinuteLabel.layer.masksToBounds = YES;
_firstMinuteLabel.layer.cornerRadius = 4;
_firstMinuteLabel.text = @"0";
}
return _firstMinuteLabel;
}
- (UILabel *)secondMinuteLabel {
if (!_secondMinuteLabel) {
_secondMinuteLabel = [[UILabel alloc] init];
_secondMinuteLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightMedium];
_secondMinuteLabel.textColor = [ThemeColor mainTextColor];
_secondMinuteLabel.backgroundColor = [ThemeColor colorWithHexString:@"#E8EAF3"];
_secondMinuteLabel.textAlignment = NSTextAlignmentCenter;
_secondMinuteLabel.layer.masksToBounds = YES;
_secondMinuteLabel.layer.cornerRadius = 4;
_secondMinuteLabel.text = @"0";
}
return _secondMinuteLabel;
}
- (UILabel *)minuteLabel {
if (!_minuteLabel) {
_minuteLabel = [[UILabel alloc] init];
_minuteLabel.font = [UIFont systemFontOfSize:12];
_minuteLabel.textColor = [ThemeColor mainTextColor];
_minuteLabel.text = @"分";
}
return _minuteLabel;
}
- (UILabel *)firstSecondLabel {
if (!_firstSecondLabel) {
_firstSecondLabel = [[UILabel alloc] init];
_firstSecondLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightMedium];
_firstSecondLabel.textColor = [ThemeColor mainTextColor];
_firstSecondLabel.backgroundColor = [ThemeColor colorWithHexString:@"#E8EAF3"];
_firstSecondLabel.textAlignment = NSTextAlignmentCenter;
_firstSecondLabel.layer.masksToBounds = YES;
_firstSecondLabel.layer.cornerRadius = 4;
_firstSecondLabel.text = @"0";
}
return _firstSecondLabel;
}
- (UILabel *)secondSecondabel {
if (!_secondSecondabel) {
_secondSecondabel = [[UILabel alloc] init];
_secondSecondabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightMedium];
_secondSecondabel.textColor = [ThemeColor mainTextColor];
_secondSecondabel.backgroundColor = [ThemeColor colorWithHexString:@"#E8EAF3"];
_secondSecondabel.textAlignment = NSTextAlignmentCenter;
_secondSecondabel.layer.masksToBounds = YES;
_secondSecondabel.layer.cornerRadius = 4;
_secondSecondabel.text = @"0";
}
return _secondSecondabel;
}
- (UILabel *)secondsLabel {
if (!_secondsLabel) {
_secondsLabel = [[UILabel alloc] init];
_secondsLabel.font = [UIFont systemFontOfSize:16];
_secondsLabel.textColor = [ThemeColor mainTextColor];
_secondsLabel.text = @"秒";
}
return _secondsLabel;
}
@end

View File

@@ -0,0 +1,17 @@
//
// AnchorLevelView.h
// xplan-ios
//
// Created by 冯硕 on 2022/12/13.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@class AnchorLevelModel;
@interface AnchorLevelView : UIView
///用户评级信息
@property (nonatomic,strong) AnchorLevelModel *levelInfo;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,211 @@
//
// AnchorLevelView.m
// xplan-ios
//
// Created by on 2022/12/13.
//
#import "AnchorLevelView.h"
///Third
#import <Masonry/Masonry.h>
///Tool
#import "ThemeColor.h"
///Model
#import "AnchorLevelModel.h"
///View
#import "AnchorLevelProgressView.h"
#import "AnchorLevelTimeView.h"
@interface AnchorLevelView ()
///
@property (nonatomic,strong) UIImageView *backImageView;
///
@property (nonatomic,strong) UILabel *currentLevelLabel;
///
@property (nonatomic,strong) UIImageView *levelImageView;
///
@property (nonatomic,strong) UIImageView *titleImageView;
///
@property (nonatomic,strong) AnchorLevelProgressView *diamondView;
///
@property (nonatomic,strong) AnchorLevelProgressView * replyView;
///
@property (nonatomic,strong) UIImageView *updateImageView;
///
@property (nonatomic,strong) AnchorLevelTimeView *timeView;
@end
@implementation AnchorLevelView
- (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.backImageView];
[self addSubview:self.levelImageView];
[self addSubview:self.titleImageView];
[self.backImageView addSubview:self.currentLevelLabel];
[self.backImageView addSubview:self.diamondView];
[self.backImageView addSubview:self.replyView];
[self.backImageView addSubview:self.updateImageView];
[self.backImageView addSubview:self.timeView];
}
- (void)initSubViewConstraints {
[self mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(303);
make.height.mas_equalTo(291);
}];
[self.levelImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(80, 120));
make.top.mas_equalTo(self).offset(0);
make.right.mas_equalTo(self.backImageView).offset(-13);
}];
[self.currentLevelLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(self).offset(-80);
make.top.mas_equalTo(self).offset(27);
}];
[self.backImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(303, 280));
make.top.mas_equalTo(self).offset(11);
make.centerX.mas_equalTo(self);
}];
[self.titleImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(159, 20));
make.left.mas_equalTo(self.backImageView).offset(12);
make.top.mas_equalTo(self.backImageView).offset(48);
}];
[self.diamondView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.mas_equalTo(self.backImageView);
make.top.mas_equalTo(self.titleImageView.mas_bottom).offset(25);
make.height.mas_equalTo(40);
}];
[self.replyView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.mas_equalTo(self.backImageView);
make.top.mas_equalTo(self.diamondView.mas_bottom).offset(23);
make.height.mas_equalTo(40);
}];
[self.updateImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(94, 20));
make.centerX.mas_equalTo(self.backImageView);
make.top.mas_equalTo(self.replyView.mas_bottom).offset(17);
}];
[self.timeView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.mas_equalTo(self.backImageView);
make.height.mas_equalTo(24);
make.top.mas_equalTo(self.updateImageView.mas_bottom).offset(7);
}];
}
#pragma mark - Getters And Setters
- (void)setLevelInfo:(AnchorLevelModel *)levelInfo {
_levelInfo = levelInfo;
if (_levelInfo) {
self.diamondView.levelInfo = _levelInfo;
self.replyView.levelInfo = _levelInfo;
self.timeView.nextRemaining = _levelInfo.nextRemaining;
if ([_levelInfo.grade isEqualToString:@"S"]) {
self.levelImageView.image = [UIImage imageNamed:@"mine_anchor_level_s"];
} else if([_levelInfo.grade isEqualToString:@"B"]) {
self.levelImageView.image = [UIImage imageNamed:@"mine_anchor_level_b"];
} else if([_levelInfo.grade isEqualToString:@"C"]) {
self.levelImageView.image = [UIImage imageNamed:@"mine_anchor_level_c"];
}else if([_levelInfo.grade isEqualToString:@"D"]) {
self.levelImageView.image = [UIImage imageNamed:@"mine_anchor_level_d"];
} else {
self.levelImageView.image = [UIImage imageNamed:@"mine_anchor_level_a"];
}
}
}
- (UIImageView *)backImageView {
if (!_backImageView) {
_backImageView = [[UIImageView alloc] init];
_backImageView.userInteractionEnabled = YES;
_backImageView.image = [UIImage imageNamed:@"mine_anchor_level_bg"];
}
return _backImageView;
}
- (UILabel *)currentLevelLabel {
if (!_currentLevelLabel) {
_currentLevelLabel = [[UILabel alloc] init];
_currentLevelLabel.font = [UIFont systemFontOfSize:10 weight:UIFontWeightBold];
_currentLevelLabel.textColor = [UIColor whiteColor];
_currentLevelLabel.text = @"当前评级";
}
return _currentLevelLabel;
}
- (UIImageView *)levelImageView {
if (!_levelImageView) {
_levelImageView = [[UIImageView alloc] init];
_levelImageView.userInteractionEnabled = YES;
}
return _levelImageView;
}
- (UIImageView *)titleImageView {
if (!_titleImageView) {
_titleImageView = [[UIImageView alloc] init];
_titleImageView.userInteractionEnabled = YES;
_titleImageView.image = [UIImage imageNamed:@"mine_anchor_level_title"];
}
return _titleImageView;
}
- (AnchorLevelProgressView *)diamondView {
if (!_diamondView) {
_diamondView = [[AnchorLevelProgressView alloc] init];
_diamondView.isDiamond = YES;
}
return _diamondView;
}
- (AnchorLevelProgressView *)replyView {
if (!_replyView) {
_replyView = [[AnchorLevelProgressView alloc] init];
}
return _replyView;
}
- (UIImageView *)updateImageView {
if (!_updateImageView) {
_updateImageView = [[UIImageView alloc] init];
_updateImageView.userInteractionEnabled = YES;
_updateImageView.image = [UIImage imageNamed:@"mine_anchor_level_update"];
}
return _updateImageView;
}
- (AnchorLevelTimeView *)timeView {
if (!_timeView) {
_timeView = [[AnchorLevelTimeView alloc] init];
}
return _timeView;
}
@end

View File

@@ -8,7 +8,7 @@
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@class UserInfoModel,XPMineHeadView, WalletInfoModel, NobleCenterModel;
@class UserInfoModel,XPMineHeadView, WalletInfoModel, NobleCenterModel, AnchorLevelModel;
@protocol XPMineHeadViewDelegate <NSObject>
///点击了头像
- (void)xPMineHeadView:(XPMineHeadView *)view didClickAvatar:(UserInfoModel *)info;
@@ -28,7 +28,8 @@ NS_ASSUME_NONNULL_BEGIN
- (void)xPMineHeadViewCliekNobleCenter;
///点击了青少年模式
- (void)xPmineHeadViewClickTeenager;
///点击主播评级
- (void)xPMineHeadView:(XPMineHeadView *)view didClickAnchorLevel:(AnchorLevelModel *)info;
@end
@interface XPMineHeadView : UIView
///用户信息
@@ -39,6 +40,8 @@ NS_ASSUME_NONNULL_BEGIN
///访客未读数量
@property (nonatomic, assign) NSInteger visitorUnReadCount;
@property (nonatomic, strong) NobleCenterModel *nobleInfo;
///主播评级信息
@property (nonatomic,strong) AnchorLevelModel *anchorLevelInfo;
@end
NS_ASSUME_NONNULL_END

View File

@@ -67,6 +67,9 @@
@property (nonatomic, strong) XPMineHeadTeenagerView *teenagerView;
///
@property (nonatomic,strong) UIButton *anchorLevel;
@end
@implementation XPMineHeadView
@@ -89,6 +92,7 @@
[self addSubview:self.nobleImageView];
[self addSubview:self.nameStackView];
[self addSubview:self.idStackView];
[self addSubview:self.anchorLevel];
[self.nameStackView addArrangedSubview:self.nameLabel];
[self.idStackView addArrangedSubview:self.idLabel];
[self.idStackView addArrangedSubview:self.sexImageView];
@@ -142,7 +146,7 @@
make.top.mas_equalTo(self.idStackView.mas_bottom).offset(8);
}];
[self.skillCardButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.mas_equalTo(self.avatarImageView).mas_offset(-6);
make.bottom.mas_equalTo(self.avatarImageView).mas_offset(-1);
make.right.mas_equalTo(14);
make.width.mas_equalTo(87);
make.height.mas_equalTo(28);
@@ -180,6 +184,13 @@
make.size.mas_equalTo(CGSizeMake(width, height));
make.right.mas_equalTo(-15);
}];
[self.anchorLevel mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(95);
make.height.mas_equalTo(25);
make.right.mas_equalTo(self);
make.bottom.mas_equalTo(self.skillCardButton.mas_top).offset(-14);
}];
}
#pragma mark - Action
@@ -242,6 +253,12 @@
}
}
- (void)anchorLevelAction:(UIButton *)sender {
if (self.delegate && [self.delegate respondsToSelector:@selector(xPMineHeadView:didClickAnchorLevel:)]) {
[self.delegate xPMineHeadView:self didClickAnchorLevel:self.anchorLevelInfo];
}
}
#pragma mark - NSMutableAttributedString
-(NSInteger) getMonth:(long )time
{
@@ -512,6 +529,15 @@
self.nobleEntranceView.nobleInfo = nobleInfo;
}
- (void)setAnchorLevelInfo:(AnchorLevelModel *)anchorLevelInfo {
_anchorLevelInfo = anchorLevelInfo;
if (_anchorLevelInfo) {
self.anchorLevel.hidden = NO;
} else {
self.anchorLevel.hidden = YES;
}
}
- (NetImageView *)avatarImageView {
if (!_avatarImageView) {
NetImageConfig * config = [[NetImageConfig alloc]init];
@@ -701,4 +727,15 @@
}
return _manager;
}
- (UIButton *)anchorLevel {
if (!_anchorLevel) {
_anchorLevel = [UIButton buttonWithType:UIButtonTypeCustom];
[_anchorLevel setImage:[UIImage imageNamed:@"mine_anchor_level_enter"] forState:UIControlStateNormal];
[_anchorLevel setImage:[UIImage imageNamed:@"mine_anchor_level_enter"] forState:UIControlStateSelected];
[_anchorLevel addTarget:self action:@selector(anchorLevelAction:) forControlEvents:UIControlEventTouchUpInside];
}
return _anchorLevel;
}
@end

View File

@@ -42,6 +42,7 @@
#import "XPMineGameTableViewCell.h"
#import "XPHomeBannerTableViewCell.h"
#import "XPMineNewUserRechargeView.h"
#import "AnchorLevelView.h"
///VC
#import "XPMineSettingViewController.h"
#import "XPMineTeenagerViewController.h"
@@ -87,6 +88,8 @@
@property (nonatomic,strong) XPMineItemModel *guildItemModel;
///
@property (nonatomic, strong) XPMineNewUserRechargeView *userRechargeView;
///
@property (nonatomic,strong) AnchorLevelModel *anchorGradeInfo;
@end
@@ -422,6 +425,12 @@
[self pushViewControllerWithType:XPMineItemType_Teenager_Mode functionItem:nil];
}
- (void)xPMineHeadView:(XPMineHeadView *)view didClickAnchorLevel:(AnchorLevelModel *)info {
AnchorLevelView * gradeView = [[AnchorLevelView alloc] init];
gradeView.levelInfo = info;
[TTPopup popupView:gradeView style:TTPopupStyleAlert];
}
#pragma mark - XPMineProtocol
///
- (void)onGetMineFuntionItemSuccess:(NSArray<XPMineFuntionItemModel *> *)items {
@@ -520,6 +529,9 @@
///
- (void)onGetClanDetailInfoSuccess:(ClanDetailInfoModel *)clanInfo {
self.clanInfo = clanInfo;
if (self.clanInfo.hall.hallId > 0) {
[self.presenter getAnchorGradeInfo];
}
}
///
@@ -572,6 +584,11 @@
[XPRoomViewController openRoom:[NSString stringWithFormat:@"%ld", self.userInfo.uid] mgId:mgId viewController:self];
}
- (void)getAnchorGradeInfoSuccess:(AnchorLevelModel *)info {
self.anchorGradeInfo = info;
self.headView.anchorLevelInfo = info;
}
#pragma mark - XPMineHeadItemTableViewCellDelegate
- (void)xPMineHeadItemTableViewCell:(XPMineHeadItemTableViewCell *)cell didSelectItem:(XPMineFuntionItemModel *)item {
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventusercenter_function_click eventAttributes:@{@"functionName" : item.centerName}];