主播评级完成

This commit is contained in:
fengshuo
2022-12-14 16:28:15 +08:00
parent 1f9e998402
commit b050611c55
36 changed files with 152 additions and 87 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.8 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.8 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.1 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

@@ -1,22 +0,0 @@
{
"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.

Before

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

View File

@@ -1,21 +0,0 @@
{
"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
}
}

View File

@@ -10,6 +10,7 @@
"scale" : "2x"
},
{
"filename" : "mine_anchor_level_enter_b@3x.png",
"idiom" : "universal",
"scale" : "3x"
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.7 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

@@ -104,6 +104,11 @@ UIKIT_EXTERN NSString *const StatisticsServiceEventRoom_sayhi_pop_show; ///打
UIKIT_EXTERN NSString *const StatisticsServiceEventRoom_sayhi_pop_find_click; ///打招呼弹窗去找TA点击-统计进房房间的id
UIKIT_EXTERN NSString *const StatisticsServiceEventRoom_sayhi_pop_voice_click; ///打招呼弹窗播放声音秀点击
#pragma mark - 主播评级
UIKIT_EXTERN NSString *const StatisticsServiceEventRoom_grade_profit_pop_click; ///主播评级入口点击
UIKIT_EXTERN NSString *const StatisticsServiceEventRoom_grade_profit_pop_show; ///主播评级入口曝光
UIKIT_EXTERN NSString *const StatisticsServiceEventRoom_grade_profit_close_click; ///主播评级弹窗关闭点击
///
/// 埋点事件
/// @param eventKey key
+ (void)trackEventWithKey:(NSString *)eventKey;

View File

@@ -100,6 +100,11 @@ NSString *const StatisticsServiceEventRoom_sayhi_pop_show = @"sayhi_pop_show"; /
NSString *const StatisticsServiceEventRoom_sayhi_pop_find_click = @"sayhi_pop_find_click"; ///TA-id
NSString *const StatisticsServiceEventRoom_sayhi_pop_voice_click = @"sayhi_pop_voice_click"; ///
#pragma mark -
NSString *const StatisticsServiceEventRoom_grade_profit_pop_click = @"grade_profit_pop_click"; ///
NSString *const StatisticsServiceEventRoom_grade_profit_pop_show = @"grade_profit_pop_show"; ///
NSString *const StatisticsServiceEventRoom_grade_profit_close_click = @"grade_profit_close_click"; ///
///
/// @param eventKey key
+ (void)trackEventWithKey:(NSString *)eventKey {

View File

@@ -8,7 +8,7 @@
#import "BaseMvpPresenter.h"
NS_ASSUME_NONNULL_BEGIN
@class AnchorLevelModel;
@interface XPMinePresent : BaseMvpPresenter
/// 获取用户信息
@@ -39,6 +39,9 @@ NS_ASSUME_NONNULL_BEGIN
///主播评级
- (void)getAnchorGradeInfo;
//主播评级
- (void)getAnchorGradeInfoCompletion:(void(^)(AnchorLevelModel * info))success;
@end
NS_ASSUME_NONNULL_END

View File

@@ -136,4 +136,14 @@
}]];
}
//
- (void)getAnchorGradeInfoCompletion:(void(^)(AnchorLevelModel * info))success {
[Api requestAnchorGradeInfo:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
AnchorLevelModel * model = [AnchorLevelModel modelWithDictionary:data.data];
if (success) {
success(model);
}
}]];
}
@end

View File

@@ -31,11 +31,18 @@
@property (nonatomic,strong) UILabel *secondSecondabel;
///
@property (nonatomic,strong) UILabel *secondsLabel;
///
@property (strong, nonatomic) dispatch_source_t timer;
@end
@implementation AnchorLevelTimeView
- (void)dealloc {
[self stopCountDown];
}
- (instancetype)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
@@ -111,30 +118,74 @@
}];
}
//
- (void)stopCountDown {
if (self.timer != nil) {
dispatch_source_cancel(self.timer);
self.timer = nil;
}
}
//
- (void)openCountdownWithTime:(int)totalTime{
if (time <= 0) {
return;
}
__block int time = totalTime; //
if (self.timer != nil) {
dispatch_source_cancel(self.timer);
}
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
self.timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, queue);
dispatch_source_set_timer(self.timer,dispatch_walltime(NULL, 0),1.0*NSEC_PER_SEC, 0); //
__weak typeof(self) weakself = self;
dispatch_source_set_event_handler(self.timer, ^{
__strong typeof(weakself) self = weakself;
if(time <= 0){ //
dispatch_source_cancel(self.timer);
dispatch_async(dispatch_get_main_queue(), ^{
self.firstHourLabel.text = @"0";
self.secondHourLabel.text = @"0";
self.firstMinuteLabel.text = @"0";
self.secondMinuteLabel.text = @"0";
self.firstSecondLabel.text = @"0";
self.secondSecondabel.text = @"0";
});
}else{
time--;
dispatch_async(dispatch_get_main_queue(), ^{
int seconds = time % 60;
int minutes = (time / 60) % 60;
int hours = time / 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 = [minute substringWithRange:NSMakeRange(0, minute.length -1)];
self.secondMinuteLabel.text = [minute substringFromIndex:minute.length - 1];
}
if (hour.length > 1){
self.firstHourLabel.text = [hour substringWithRange:NSMakeRange(0, hour.length -1)];
self.secondHourLabel.text = [hour substringFromIndex:hour.length - 1];
}
});
}
});
dispatch_resume(self.timer);
}
#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];
}
[self openCountdownWithTime:_nextRemaining];
}
}
@@ -172,6 +223,8 @@
_hourLabel.font = [UIFont systemFontOfSize:12];
_hourLabel.textColor = [ThemeColor mainTextColor];
_hourLabel.text = @"时";
_hourLabel.textAlignment = NSTextAlignmentCenter;
}
return _hourLabel;
}
@@ -211,6 +264,7 @@
_minuteLabel.font = [UIFont systemFontOfSize:12];
_minuteLabel.textColor = [ThemeColor mainTextColor];
_minuteLabel.text = @"分";
_minuteLabel.textAlignment = NSTextAlignmentCenter;
}
return _minuteLabel;
}
@@ -248,9 +302,10 @@
- (UILabel *)secondsLabel {
if (!_secondsLabel) {
_secondsLabel = [[UILabel alloc] init];
_secondsLabel.font = [UIFont systemFontOfSize:16];
_secondsLabel.font = [UIFont systemFontOfSize:12];
_secondsLabel.textColor = [ThemeColor mainTextColor];
_secondsLabel.text = @"秒";
_secondsLabel.textAlignment = NSTextAlignmentCenter;
}
return _secondsLabel;
}

View File

@@ -51,10 +51,10 @@
#pragma mark - Private Method
- (void)initSubViews {
[self addSubview:self.backImageView];
[self addSubview:self.levelImageView];
[self addSubview:self.titleImageView];
[self.backImageView addSubview:self.levelImageView];
[self.backImageView addSubview:self.titleImageView];
[self.backImageView addSubview:self.currentLevelLabel];
[self.backImageView addSubview:self.diamondView];
[self.backImageView addSubview:self.replyView];
@@ -65,26 +65,25 @@
- (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);
make.height.mas_equalTo(280);
}];
[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);
make.edges.equalTo(self);
}];
[self.levelImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(90, 80));
make.top.mas_equalTo(self).offset(11);
make.right.mas_equalTo(self.backImageView).offset(-7);
}];
[self.currentLevelLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(self.levelImageView.mas_left).offset(0);
make.top.mas_equalTo(self).offset(16);
}];
[self.titleImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(159, 20));
make.left.mas_equalTo(self.backImageView).offset(12);
@@ -121,6 +120,7 @@
- (void)setLevelInfo:(AnchorLevelModel *)levelInfo {
_levelInfo = levelInfo;
if (_levelInfo) {
_levelInfo.grade = @"S";
self.diamondView.levelInfo = _levelInfo;
self.replyView.levelInfo = _levelInfo;
self.timeView.nextRemaining = _levelInfo.nextRemaining;

View File

@@ -15,6 +15,7 @@
#import "UIImage+Utils.h"
#import <YYImage/YYAnimatedImageView.h>
#import "SpriteSheetImageManager.h"
#import "StatisticsServiceHelper.h"
///View
#import "NetImageView.h"
#import "UIImage+Utils.h"
@@ -26,6 +27,7 @@
#import "UserInfoModel.h"
#import "WalletInfoModel.h"
#import "NobleCenterModel.h"
#import "AnchorLevelModel.h"
@interface XPMineHeadView ()
///
@@ -186,8 +188,8 @@
}];
[self.anchorLevel mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(95);
make.height.mas_equalTo(25);
make.width.mas_equalTo(91);
make.height.mas_equalTo(28);
make.right.mas_equalTo(self);
make.bottom.mas_equalTo(self.skillCardButton.mas_top).offset(-14);
}];
@@ -532,7 +534,19 @@
- (void)setAnchorLevelInfo:(AnchorLevelModel *)anchorLevelInfo {
_anchorLevelInfo = anchorLevelInfo;
if (_anchorLevelInfo) {
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventRoom_grade_profit_pop_show];
self.anchorLevel.hidden = NO;
if ([_anchorLevelInfo.grade isEqualToString:@"S"]) {
[self.anchorLevel setBackgroundImage:[UIImage imageNamed:@"mine_anchor_level_enter_s"] forState:UIControlStateNormal];
} else if([_anchorLevelInfo.grade isEqualToString:@"B"]) {
[self.anchorLevel setBackgroundImage:[UIImage imageNamed:@"mine_anchor_level_enter_b"] forState:UIControlStateNormal];
} else if([_anchorLevelInfo.grade isEqualToString:@"C"]) {
[self.anchorLevel setBackgroundImage:[UIImage imageNamed:@"mine_anchor_level_enter_c"] forState:UIControlStateNormal];
}else if([_anchorLevelInfo.grade isEqualToString:@"D"]) {
[self.anchorLevel setBackgroundImage:[UIImage imageNamed:@"mine_anchor_level_enter_d"] forState:UIControlStateNormal];
} else {
[self.anchorLevel setBackgroundImage:[UIImage imageNamed:@"mine_anchor_level_enter_a"] forState:UIControlStateNormal];
}
} else {
self.anchorLevel.hidden = YES;
}
@@ -733,6 +747,10 @@
_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 setTitle:@"主播评级" forState:UIControlStateNormal];
_anchorLevel.titleLabel.font = [UIFont systemFontOfSize:12];
[_anchorLevel setTitleColor:[ThemeColor mainTextColor] forState:UIControlStateNormal];
[_anchorLevel setTitleEdgeInsets:UIEdgeInsetsMake(0, 25, 0, 0)];
[_anchorLevel addTarget:self action:@selector(anchorLevelAction:) forControlEvents:UIControlEventTouchUpInside];
}
return _anchorLevel;

View File

@@ -426,9 +426,20 @@
}
- (void)xPMineHeadView:(XPMineHeadView *)view didClickAnchorLevel:(AnchorLevelModel *)info {
AnchorLevelView * gradeView = [[AnchorLevelView alloc] init];
gradeView.levelInfo = info;
[TTPopup popupView:gradeView style:TTPopupStyleAlert];
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventRoom_grade_profit_pop_click];
@kWeakify(self);
[self.presenter getAnchorGradeInfoCompletion:^(AnchorLevelModel * _Nonnull info) {
@kStrongify(self);
self.headView.anchorLevelInfo = info;
AnchorLevelView * gradeView = [[AnchorLevelView alloc] init];
gradeView.levelInfo = info;
TTPopupService * config = [[TTPopupService alloc] init];
config.contentView = gradeView;
config.didFinishDismissHandler = ^(BOOL isDismissOnBackgroundTouch) {
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventRoom_grade_profit_close_click];
};
[TTPopup popupWithConfig:config];
}];
}
#pragma mark - XPMineProtocol