Files
yuyin_ios/SweetParty/主类/狸猫新增/酒吧相亲厅/YYXQInviteAlert.m

84 lines
2.2 KiB
Mathematica
Raw Normal View History

2025-08-08 11:05:33 +08:00
//
// YYXQInviteAlert.m
// YaYin
//
// Created by bj_szd on 2023/7/12.
// Copyright © 2023 YaYin. All rights reserved.
//
#import "YYXQInviteAlert.h"
#import "ZWTimer.h"
@interface YYXQInviteAlert () <ZWTimerDelegate>
@property (nonatomic, strong) ZWTimer *timer;
@property (nonatomic, assign) NSInteger leftSecond;
@property (weak, nonatomic) IBOutlet UIView *containerView;
@end
@implementation YYXQInviteAlert
- (void)awakeFromNib {
[super awakeFromNib];
[self createUI];
}
- (void)createUI {
self.containerView.backgroundColor = [UIColor bm_colorGradientChangeWithSize:CGSizeMake(APPW-30, 200) direction:FXGradientChangeDirectionVertical startColor:HEXCOLOR(0xDFFFF6) endColor:HEXCOLOR(0xFFFFFF)];
[self.agreeBtn styleGradiBlueColor];
WEAK_SELF
[self.touchImgV dg_Tapped:^{
[weakSelf removeFromSuperview];
}];
}
- (void)setDataDict:(NSDictionary *)dataDict {
_dataDict = dataDict;
self.titleLab.text = [NSString stringWithFormat:@"主持人邀请您上台%@分钟,是否同意?", dataDict[@"time"]];
self.leftSecond = 10;
[self.timer startGCDTimer:1 delegate:self];
}
- (IBAction)onRefuse:(id)sender {
[self onRequestWith:NO];
}
- (IBAction)onAgree:(id)sender {
[self onRequestWith:YES];
}
- (void)onRequestWith:(BOOL)isAgree {
[self.timer stopTimer];
NSDictionary *params = @{@"rid":[self.dataDict safeStringForKey:@"rid"], @"id":[self.dataDict safeStringForKey:@"id"], @"micro_id":[self.dataDict safeStringForKey:@"micro_id"], @"type":isAgree?@"1":@"2"};
[[AFNetworkRequset shared] postRequestWithParams:params Path:@"/api/room/operate_room_owner_up_micro" Loading:YES Hud:YES Success:^(id _Nonnull responseDic) {
[self removeFromSuperview];
} Failure:^(id _Nonnull errorData) {
}];
}
- (void)onTimerFired:(ZWTimer *)timer {
self.timeLab.text = [NSString stringWithFormat:@"%ld秒后自动拒绝", self.leftSecond];
self.leftSecond -= 1;
if (self.leftSecond < 0) {
[self.timer stopTimer];
[self onRefuse:nil];
}
}
- (ZWTimer *)timer {
if (!_timer) {
_timer = [[ZWTimer alloc] init];
}
return _timer;
}
@end