Files
midi_ios/QXLive/Mine(音域)/View/钱包/QXReVerificationPopView.m
2025-08-14 10:07:49 +08:00

114 lines
3.8 KiB
Objective-C

//
// QXReVerificationPopView.m
// QXLive
//
// Created by 启星 on 2025/5/27.
//
#import "QXReVerificationPopView.h"
#import "QXLoginTextField.h"
#import "QXLoginNetwork.h"
@interface QXReVerificationPopView()<QXLoginTextFieldDelegate>
@property (nonatomic,strong)UILabel *titleLabel;
@property (nonatomic,strong)QXLoginTextField *codeTextField;
@property (nonatomic,strong)UIButton *closeBtn;
@property (nonatomic,strong)UIButton *commitBtn;
@end
@implementation QXReVerificationPopView
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self initSubviews];
}
return self;
}
- (instancetype)init
{
self = [super init];
if (self) {
[self initSubviews];
}
return self;
}
-(void)initSubviews{
self.backgroundColor = [UIColor whiteColor];
[self addRoundedCornersWithRadius:16];
self.titleLabel = [[UILabel alloc] init];
self.titleLabel.font = [UIFont boldSystemFontOfSize:16];
self.titleLabel.textColor = QXConfig.textColor;
self.titleLabel.text = QXText(@"二次验证");
[self addSubview:self.titleLabel];
self.codeTextField = [[QXLoginTextField alloc] init];
self.codeTextField.delegate = self;
self.codeTextField.type = LoginTextTypeCode;
self.codeTextField.backgroundColor = RGB16(0xEFF2F8);
[self.codeTextField addRoundedCornersWithRadius:10];
[self addSubview:self.codeTextField];
self.closeBtn = [[UIButton alloc] init];
[self.closeBtn addTarget:self action:@selector(closeAction) forControlEvents:(UIControlEventTouchUpInside)];
[self.closeBtn setImage:[UIImage imageNamed:@"wallet_close"] forState:(UIControlStateNormal)];
[self addSubview:self.closeBtn];
self.commitBtn = [[UIButton alloc] init];
[self.commitBtn setTitle:QXText(@"确定") forState:(UIControlStateNormal)];
self.commitBtn.titleLabel.font = [UIFont systemFontOfSize:14];;
[self.commitBtn addRoundedCornersWithRadius:21];
self.commitBtn.backgroundColor = QXConfig.themeColor;
[self.commitBtn setTitleColor:QXConfig.btnTextColor forState:(UIControlStateNormal)];
[self.commitBtn addTarget:self action:@selector(commitAction) forControlEvents:(UIControlEventTouchUpInside)];
[self addSubview:self.commitBtn];
[self.commitBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(38);
make.right.mas_equalTo(-38);
make.height.mas_equalTo(42);
make.bottom.mas_equalTo(-16);
}];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self);
make.top.mas_equalTo(12);
make.height.mas_equalTo(24);
}];
[self.codeTextField mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(10);
make.right.mas_equalTo(-10);
make.bottom.equalTo(self.commitBtn.mas_top).offset(-30);
make.height.mas_equalTo(44);
}];
[self.closeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.right.equalTo(self);
make.size.mas_equalTo(CGSizeMake(45, 45));
}];
}
-(void)closeAction{
[[QXGlobal shareGlobal] hideViewBlock:^{
}];
}
-(void)commitAction{
if (self.commitBlock) {
self.commitBlock(self.codeTextField.textField.text);
}
}
-(void)didClickSendCode:(UIButton *)sender{
NSString*mobile = [QXGlobal shareGlobal].loginModel.mobile;
if (mobile.length == 0) {
showToast(@"请先绑定手机号");
return;
}
MJWeakSelf
[QXLoginNetwork getSmscodeWithMobile:[QXGlobal shareGlobal].loginModel.mobile type:GetSmscodeTypeWithDraw successBlock:^(id _Nonnull responseObject) {
[weakSelf.codeTextField startTimeDown];
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
}];
}
@end