Commit 4a360abd by suolong

处理代表演接口

parent 4bbb013d
...@@ -948,6 +948,12 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -948,6 +948,12 @@ NS_ASSUME_NONNULL_BEGIN
succeed:(void (^)(FUSTicketShowCollectTicketToggleResultModel *model))succeed succeed:(void (^)(FUSTicketShowCollectTicketToggleResultModel *model))succeed
failure:(void (^)(NSString *msg, NSInteger code))failure; failure:(void (^)(NSString *msg, NSInteger code))failure;
+ (void)fus_ticketShowReadyShowStartWithRoomId:(NSString *)roomId
channelId:(NSString *)channelId
roundId:(NSString *)roundId
succeed:(void (^)(FUSTicketShowCollectTicketToggleResultModel *model))succeed
failure:(void (^)(NSString *msg, NSInteger code))failure;
/// Ticket Show - 视图 - 获取表演票的集票信息(观众端进房刷新) /// Ticket Show - 视图 - 获取表演票的集票信息(观众端进房刷新)
/// @param roomId 房间ID /// @param roomId 房间ID
/// @param channelId 频道ID /// @param channelId 频道ID
......
...@@ -3092,6 +3092,35 @@ ...@@ -3092,6 +3092,35 @@
}]; }];
} }
+ (void)fus_ticketShowReadyShowStartWithRoomId:(NSString *)roomId
channelId:(NSString *)channelId
roundId:(NSString *)roundId
succeed:(void (^)(FUSTicketShowCollectTicketToggleResultModel *model))succeed
failure:(void (^)(NSString *msg, NSInteger code))failure {
NSString *uid = FUSCacheDataShare.shareStore.userDetailInfo.uid;
if ([NSString isNull:uid]
|| [NSString isNull:roomId]
|| [NSString isNull:channelId]
|| [NSString isNull:roundId]) {
if (failure) failure([NSString fus_localString:@"参数错误"], -3);
return;
}
NSDictionary *params = @{
@"uid": uid,
@"roomId": roomId,
@"channelId": channelId,
@"roundId": roundId
};
[FUSHttpHelper postRequestBinaryWithUrl:FUSShowRoomURLs.fus_URL_TicketShow_ReadyShow_Start params:params success:^(NSDictionary * _Nullable dataDict, int code) {
FUSTicketShowCollectTicketToggleResultModel *model = [FUSTicketShowCollectTicketToggleResultModel fus_modelWithDict:dataDict];
if (succeed) succeed(model);
} failure:^(NSDictionary * _Nullable dataDict, int code) {
if (failure) failure(dataDict[@"msg"], code);
}];
}
+ (void)fus_ticketShowProgressGetInfoWithRoomId:(NSString *)roomId + (void)fus_ticketShowProgressGetInfoWithRoomId:(NSString *)roomId
channelId:(NSString *)channelId channelId:(NSString *)channelId
roundId:(NSString *)roundId roundId:(NSString *)roundId
......
...@@ -3,23 +3,32 @@ ...@@ -3,23 +3,32 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
/** /**
限时表演(主播端)取消表演二次确认弹窗视图 限时表演(主播端)通用双按钮弹窗视图(对齐限时表演相关设计)
设计目标: 设计目标:
- 独立于 Helper 的 UI 视图类,仅负责界面与交互展示 - 独立于 Helper 的 UI 视图类,仅负责界面与交互展示
- 提供 30s(或外部传入)自动取消倒计时,倒计时结束自动触发“确定” - 提供 30s(或外部传入)自动取消倒计时
- 外部通过 block 获取“继续表演”和“确定”两种操作结果 - 外部通过 block 获取左右按钮点击与自动取消触发结果
- 使用 Masonry 进行约束布局,样式复用项目统一的配色和字体工具 - 使用 Masonry 进行约束布局,样式复用项目统一的配色和字体工具
*/ */
@interface FUSLiveShowTimeCancelConfirmPopView : UIView @interface FUSLiveShowTimeCancelConfirmPopView : UIView
/** 用户点击“继续表演”后的回调(不取消当前回合) */ /** 左侧按钮点击回调(默认用于“继续表演/取消集票”等) */
@property (nonatomic, copy, nullable) void (^continueHandler)(void); @property (nonatomic, copy, nullable) void (^continueHandler)(void);
/** 用户点击“确定”或倒计时归零后的回调(取消当前回合) */ /** 右侧按钮点击回调(默认用于“确定/开始表演”等) */
@property (nonatomic, copy, nullable) void (^confirmHandler)(void); @property (nonatomic, copy, nullable) void (^confirmHandler)(void);
/** /**
倒计时结束自动取消回调(仅“票已集齐,请开始表演!”弹窗会触发)
说明:
- 该弹窗倒计时文案为“30S 后自动取消”,业务上需要到点自动执行取消
- 点击左侧按钮仍会走二次确认弹窗(由外部决定是否再弹确认)
*/
@property (nonatomic, copy, nullable) void (^autoCancelHandler)(void);
/**
在指定父视图上展示弹窗并启动倒计时 在指定父视图上展示弹窗并启动倒计时
@param onView 承载弹窗的父视图(通常为手动弹层容器或顶层 VC.view) @param onView 承载弹窗的父视图(通常为手动弹层容器或顶层 VC.view)
...@@ -29,6 +38,15 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -29,6 +38,15 @@ NS_ASSUME_NONNULL_BEGIN
+ (instancetype)fus_showOnView:(UIView *)onView countdownSeconds:(NSInteger)seconds; + (instancetype)fus_showOnView:(UIView *)onView countdownSeconds:(NSInteger)seconds;
/** /**
在指定父视图上展示“票已集齐,请开始表演!”弹窗并启动倒计时
@param onView 承载弹窗的父视图(通常为手动弹层容器或顶层 VC.view)
@param seconds 初始倒计时秒数(<=0 则不展示倒计时文案与自动取消逻辑)
@return 已添加到父视图上的弹窗实例
*/
+ (instancetype)fus_showReadyToPerformOnView:(UIView *)onView countdownSeconds:(NSInteger)seconds;
/**
主动关闭弹窗 主动关闭弹窗
说明:会停止内部倒计时并移除自身 说明:会停止内部倒计时并移除自身
......
...@@ -24,6 +24,9 @@ ...@@ -24,6 +24,9 @@
@property (nonatomic, assign) BOOL hasConfirmed; @property (nonatomic, assign) BOOL hasConfirmed;
/// 弹窗样式类型:0-取消表演二次确认 1-票已集齐开始表演
@property (nonatomic, assign) NSInteger popStyleType;
@end @end
@implementation FUSLiveShowTimeCancelConfirmPopView @implementation FUSLiveShowTimeCancelConfirmPopView
...@@ -34,6 +37,35 @@ ...@@ -34,6 +37,35 @@
} }
FUSLiveShowTimeCancelConfirmPopView *view = [[FUSLiveShowTimeCancelConfirmPopView alloc] initWithFrame:CGRectZero]; FUSLiveShowTimeCancelConfirmPopView *view = [[FUSLiveShowTimeCancelConfirmPopView alloc] initWithFrame:CGRectZero];
view.popStyleType = 0;
[view fus_applyStyleIfNeeded];
[onView addSubview:view];
[view mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(onView);
}];
view.alpha = 0;
[UIView animateWithDuration:0.2 animations:^{
view.alpha = 1;
}];
if (seconds > 0) {
[view fus_startCountdownWithSeconds:seconds];
} else {
view.countdownLabel.text = @"";
}
return view;
}
+ (instancetype)fus_showReadyToPerformOnView:(UIView *)onView countdownSeconds:(NSInteger)seconds {
if (!onView) {
return [[self alloc] initWithFrame:CGRectZero];
}
FUSLiveShowTimeCancelConfirmPopView *view = [[FUSLiveShowTimeCancelConfirmPopView alloc] initWithFrame:CGRectZero];
view.popStyleType = 1;
[view fus_applyStyleIfNeeded];
[onView addSubview:view]; [onView addSubview:view];
[view mas_makeConstraints:^(MASConstraintMaker *make) { [view mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(onView); make.edges.equalTo(onView);
...@@ -61,9 +93,11 @@ ...@@ -61,9 +93,11 @@
self.backgroundColor = UIColor.clearColor; self.backgroundColor = UIColor.clearColor;
_remainingSeconds = 0; _remainingSeconds = 0;
_hasConfirmed = NO; _hasConfirmed = NO;
_popStyleType = 0;
[self fus_setupViews]; [self fus_setupViews];
[self fus_setupConstraints]; [self fus_setupConstraints];
[self fus_applyStyleIfNeeded];
return self; return self;
} }
...@@ -84,7 +118,6 @@ ...@@ -84,7 +118,6 @@
[self addSubview:self.contentView]; [self addSubview:self.contentView];
self.titleLabel = [[UILabel alloc] initWithFrame:CGRectZero]; self.titleLabel = [[UILabel alloc] initWithFrame:CGRectZero];
self.titleLabel.text = [NSString fus_localString:@"确定取消表演?"];
self.titleLabel.textColor = [UIColor colorWithHex:@"#111111"]; self.titleLabel.textColor = [UIColor colorWithHex:@"#111111"];
self.titleLabel.font = [UIFont fus_themeBoldFont:16]; self.titleLabel.font = [UIFont fus_themeBoldFont:16];
self.titleLabel.textAlignment = NSTextAlignmentCenter; self.titleLabel.textAlignment = NSTextAlignmentCenter;
...@@ -99,12 +132,9 @@ ...@@ -99,12 +132,9 @@
CGFloat buttonH = 40; CGFloat buttonH = 40;
self.continueButton = [UIButton buttonWithType:UIButtonTypeCustom]; self.continueButton = [UIButton buttonWithType:UIButtonTypeCustom];
self.continueButton.backgroundColor = UIColor.whiteColor; self.continueButton.backgroundColor = [UIColor colorWithHex:@"#E6E8EB"];
self.continueButton.layer.cornerRadius = buttonH / 2.0; self.continueButton.layer.cornerRadius = buttonH / 2.0;
self.continueButton.layer.masksToBounds = YES; self.continueButton.layer.masksToBounds = YES;
self.continueButton.layer.borderWidth = 1;
self.continueButton.layer.borderColor = [UIColor colorWithHex:@"#E6E8EB"].CGColor;
[self.continueButton setTitle:[NSString fus_localString:@"继续表演"] forState:UIControlStateNormal];
[self.continueButton setTitleColor:[UIColor colorWithHex:@"#1F1F1F"] forState:UIControlStateNormal]; [self.continueButton setTitleColor:[UIColor colorWithHex:@"#1F1F1F"] forState:UIControlStateNormal];
self.continueButton.titleLabel.font = [UIFont fus_themeBoldFont:15]; self.continueButton.titleLabel.font = [UIFont fus_themeBoldFont:15];
[self.continueButton addTarget:self action:@selector(fus_onTapContinue) forControlEvents:UIControlEventTouchUpInside]; [self.continueButton addTarget:self action:@selector(fus_onTapContinue) forControlEvents:UIControlEventTouchUpInside];
...@@ -114,13 +144,25 @@ ...@@ -114,13 +144,25 @@
self.confirmButton.backgroundColor = [UIColor colorWithHex:@"#52DDE2"]; self.confirmButton.backgroundColor = [UIColor colorWithHex:@"#52DDE2"];
self.confirmButton.layer.cornerRadius = buttonH / 2.0; self.confirmButton.layer.cornerRadius = buttonH / 2.0;
self.confirmButton.layer.masksToBounds = YES; self.confirmButton.layer.masksToBounds = YES;
[self.confirmButton setTitle:[NSString fus_localString:@"确定"] forState:UIControlStateNormal];
[self.confirmButton setTitleColor:UIColor.blackColor forState:UIControlStateNormal]; [self.confirmButton setTitleColor:UIColor.blackColor forState:UIControlStateNormal];
self.confirmButton.titleLabel.font = [UIFont fus_themeBoldFont:15]; self.confirmButton.titleLabel.font = [UIFont fus_themeBoldFont:15];
[self.confirmButton addTarget:self action:@selector(fus_onTapConfirm) forControlEvents:UIControlEventTouchUpInside]; [self.confirmButton addTarget:self action:@selector(fus_onTapConfirm) forControlEvents:UIControlEventTouchUpInside];
[self.contentView addSubview:self.confirmButton]; [self.contentView addSubview:self.confirmButton];
} }
- (void)fus_applyStyleIfNeeded {
if (self.popStyleType == 1) {
self.titleLabel.text = [NSString fus_localString:@"票已集齐,请开始表演!"];
[self.continueButton setTitle:[NSString fus_localString:@"取消集票"] forState:UIControlStateNormal];
[self.confirmButton setTitle:[NSString fus_localString:@"开始表演"] forState:UIControlStateNormal];
return;
}
self.titleLabel.text = [NSString fus_localString:@"确定取消表演?"];
[self.continueButton setTitle:[NSString fus_localString:@"继续表演"] forState:UIControlStateNormal];
[self.confirmButton setTitle:[NSString fus_localString:@"确定"] forState:UIControlStateNormal];
}
- (void)fus_setupConstraints { - (void)fus_setupConstraints {
[self.bgButton mas_makeConstraints:^(MASConstraintMaker *make) { [self.bgButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self); make.edges.equalTo(self);
...@@ -140,17 +182,17 @@ ...@@ -140,17 +182,17 @@
}]; }];
[self.countdownLabel mas_makeConstraints:^(MASConstraintMaker *make) { [self.countdownLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.titleLabel.mas_bottom).offset(10); make.top.equalTo(self.titleLabel.mas_bottom).offset(8);
make.left.equalTo(self.contentView).offset(20); make.left.equalTo(self.contentView).offset(20);
make.right.equalTo(self.contentView).offset(-20); make.right.equalTo(self.contentView).offset(-20);
}]; }];
CGFloat buttonH = 40; CGFloat buttonH = 40;
[self.continueButton mas_makeConstraints:^(MASConstraintMaker *make) { [self.continueButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.countdownLabel.mas_bottom).offset(20); make.top.equalTo(self.countdownLabel.mas_bottom).offset(18);
make.left.equalTo(self.contentView).offset(20); make.left.equalTo(self.contentView).offset(20);
make.height.equalTo(@(buttonH)); make.height.equalTo(@(buttonH));
make.bottom.equalTo(self.contentView).offset(-20); make.bottom.equalTo(self.contentView).offset(-18);
}]; }];
[self.confirmButton mas_makeConstraints:^(MASConstraintMaker *make) { [self.confirmButton mas_makeConstraints:^(MASConstraintMaker *make) {
...@@ -181,7 +223,7 @@ ...@@ -181,7 +223,7 @@
dispatch_source_cancel(strongSelf.countdownTimer); dispatch_source_cancel(strongSelf.countdownTimer);
strongSelf.countdownTimer = nil; strongSelf.countdownTimer = nil;
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
[strongSelf fus_triggerConfirmIfNeeded]; [strongSelf fus_triggerAutoCancelIfNeeded];
}); });
return; return;
} }
...@@ -195,6 +237,27 @@ ...@@ -195,6 +237,27 @@
dispatch_resume(self.countdownTimer); dispatch_resume(self.countdownTimer);
} }
- (void)fus_triggerAutoCancelIfNeeded {
if (self.hasConfirmed) {
return;
}
self.hasConfirmed = YES;
[self fus_stopCountdownTimer];
self.continueButton.enabled = NO;
self.confirmButton.enabled = NO;
if (self.popStyleType == 1) {
if (self.autoCancelHandler) {
self.autoCancelHandler();
}
return;
}
if (self.confirmHandler) {
self.confirmHandler();
}
}
- (void)fus_stopCountdownTimer { - (void)fus_stopCountdownTimer {
if (self.countdownTimer) { if (self.countdownTimer) {
dispatch_source_cancel(self.countdownTimer); dispatch_source_cancel(self.countdownTimer);
...@@ -204,7 +267,7 @@ ...@@ -204,7 +267,7 @@
- (void)fus_refreshCountdownText { - (void)fus_refreshCountdownText {
NSInteger seconds = MAX(0, self.remainingSeconds); NSInteger seconds = MAX(0, self.remainingSeconds);
self.countdownLabel.text = [NSString stringWithFormat:@"%zdS%@", (NSInteger)seconds, [NSString fus_localString:@"后自动取消"]]; self.countdownLabel.text = [NSString stringWithFormat:@"%zdS %@", (NSInteger)seconds, [NSString fus_localString:@"后自动取消"]];
} }
- (void)fus_onTapContinue { - (void)fus_onTapContinue {
......
...@@ -590,6 +590,9 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -590,6 +590,9 @@ NS_ASSUME_NONNULL_BEGIN
/// Ticket Show - 功能 - 主播端切换限时表演的集票(开始/取消) /// Ticket Show - 功能 - 主播端切换限时表演的集票(开始/取消)
+ (NSString *)fus_URL_TicketShow_CollectTicket_Toggle; + (NSString *)fus_URL_TicketShow_CollectTicket_Toggle;
/// Ticket Show - 功能 - 主播端进入待表演
+ (NSString *)fus_URL_TicketShow_ReadyShow_Start;
/// Ticket Show - 视图 - 获取表演票的集票信息(观众端进房刷新) /// Ticket Show - 视图 - 获取表演票的集票信息(观众端进房刷新)
+ (NSString *)fus_URL_TicketShow_Progress_GetInfo; + (NSString *)fus_URL_TicketShow_Progress_GetInfo;
......
...@@ -970,6 +970,12 @@ ...@@ -970,6 +970,12 @@
return [FUSConfig.sharedInstanced.pathConfigs apiUrl:@"/ticketshow/collectTicket/toggle"]; return [FUSConfig.sharedInstanced.pathConfigs apiUrl:@"/ticketshow/collectTicket/toggle"];
} }
/// Ticket Show - 功能 - 主播端进入待表演
+ (NSString *)fus_URL_TicketShow_ReadyShow_Start
{
return [FUSConfig.sharedInstanced.pathConfigs apiUrl:@"/ticketshow/readyShow/start"];
}
/// Ticket Show - 视图 - 获取表演票的集票信息(观众端进房刷新) /// Ticket Show - 视图 - 获取表演票的集票信息(观众端进房刷新)
+ (NSString *)fus_URL_TicketShow_Progress_GetInfo + (NSString *)fus_URL_TicketShow_Progress_GetInfo
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment