// // YYRoomPswAlert.m // SweetParty // // Created by bj_szd on 2022/6/9. // #import "YYRoomPswAlert.h" #import "HWTFCodeBView.h" @interface YYRoomPswAlert () @property (nonatomic, strong) HWTFCodeBView *codeView; @end @implementation YYRoomPswAlert - (void)awakeFromNib { [super awakeFromNib]; [self createUI]; } - (void)createUI { [self.confirmBtn setJianBianWithCGSize:CGSizeMake(ScreenWidth-32*2, 45)]; WEAK_SELF [self.touchImgV dg_Tapped:^{ [weakSelf removeFromSuperview]; }]; HWTFCodeBView *codeView = [[HWTFCodeBView alloc] initWithCount:4 margin:15]; codeView.frame = CGRectMake(0, 0, 245, 50); codeView.backgroundColor = kClearColor; [self.pswBgView addSubview:codeView]; self.codeView = codeView; } - (void)setModel:(YYRoomSetModel *)model { _model = model; self.codeView.originCode = model.room_password; } - (IBAction)onConfirm:(id)sender { if (self.codeView.code.length <= 0) { [HelpPageDefine showMessage:@"请输入房间密码"]; return; } NSMutableDictionary *params = [NSMutableDictionary dictionaryWithDictionary:self.model.mj_JSONObject]; [params setObject:self.codeView.code forKey:@"room_password"]; [[AFNetworkRequset shared] postRequestWithParams:params Path:@"/api/room/modify_room_info" Loading:YES Hud:YES Success:^(id _Nonnull responseDic) { if (self.onCompleteBlock) { self.onCompleteBlock(); } [self removeFromSuperview]; } Failure:^(id _Nonnull errorData) { }]; } @end