3
This commit is contained in:
149
keyBoard/Class/Login/VC/KBForgetVerPwdVC.m
Normal file
149
keyBoard/Class/Login/VC/KBForgetVerPwdVC.m
Normal file
@@ -0,0 +1,149 @@
|
||||
//
|
||||
// KBForgetVerPwdVC.m
|
||||
// keyBoard
|
||||
//
|
||||
// Created by Mac on 2025/12/3.
|
||||
//
|
||||
|
||||
#import "KBForgetVerPwdVC.h"
|
||||
#import "CRBoxInputView.h"
|
||||
|
||||
@interface KBForgetVerPwdVC ()
|
||||
|
||||
@property (nonatomic, strong) UILabel *titleLabel; // Reset Password
|
||||
@property (nonatomic, strong) UILabel *subTitleLabel; // Enter Email Verification Code
|
||||
@property (nonatomic, strong) CRBoxInputView *codeInputView;
|
||||
@property (nonatomic, strong) UIButton *nextButton; // Next Step
|
||||
|
||||
@end
|
||||
|
||||
@implementation KBForgetVerPwdVC
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
self.view.backgroundColor = [UIColor whiteColor];
|
||||
self.kb_titleLabel.text = KBLocalized(@"Reset Password");
|
||||
|
||||
[self setupUI];
|
||||
}
|
||||
|
||||
#pragma mark - UI
|
||||
|
||||
- (void)setupUI {
|
||||
[self.view addSubview:self.titleLabel];
|
||||
[self.view addSubview:self.subTitleLabel];
|
||||
[self.view addSubview:self.codeInputView];
|
||||
[self.view addSubview:self.nextButton];
|
||||
|
||||
// 标题
|
||||
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.view).offset(24);
|
||||
make.top.equalTo(self.view).offset(KB_NAV_TOTAL_HEIGHT + 32);
|
||||
}];
|
||||
|
||||
// 副标题
|
||||
[self.subTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.titleLabel);
|
||||
make.top.equalTo(self.titleLabel.mas_bottom).offset(16);
|
||||
}];
|
||||
|
||||
// 验证码输入框(CRBoxInputView)
|
||||
[self.codeInputView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.subTitleLabel.mas_bottom).offset(24);
|
||||
make.left.equalTo(self.view).offset(24);
|
||||
make.right.equalTo(self.view).offset(-24);
|
||||
make.height.mas_equalTo(56);
|
||||
}];
|
||||
|
||||
// Next Step 按钮
|
||||
[self.nextButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.codeInputView.mas_bottom).offset(32);
|
||||
make.left.equalTo(self.view).offset(24);
|
||||
make.right.equalTo(self.view).offset(-24);
|
||||
make.height.mas_equalTo(56);
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - Actions
|
||||
|
||||
- (void)onTapNext {
|
||||
NSString *code = self.codeInputView.textValue ?: @"";
|
||||
if (code.length == 0) {
|
||||
[KBHUD showInfo:KBLocalized(@"Enter Email Verification Code")];
|
||||
return;
|
||||
}
|
||||
KBLOG(@"KBVerPwdVC next step with code=%@", code);
|
||||
// TODO: 接后续重置密码的下一步逻辑
|
||||
}
|
||||
|
||||
#pragma mark - Lazy UI
|
||||
|
||||
- (UILabel *)titleLabel {
|
||||
if (!_titleLabel) {
|
||||
_titleLabel = [UILabel new];
|
||||
_titleLabel.text = KBLocalized(@"Reset Password");
|
||||
_titleLabel.textColor = [UIColor colorWithHex:KBBlackValue];
|
||||
_titleLabel.font = [KBFont bold:20];
|
||||
_titleLabel.textAlignment = NSTextAlignmentLeft;
|
||||
}
|
||||
return _titleLabel;
|
||||
}
|
||||
|
||||
- (UILabel *)subTitleLabel {
|
||||
if (!_subTitleLabel) {
|
||||
_subTitleLabel = [UILabel new];
|
||||
_subTitleLabel.text = KBLocalized(@"Enter Email Verification Code");
|
||||
_subTitleLabel.textColor = [UIColor colorWithHex:KBBlackValue];
|
||||
_subTitleLabel.font = [KBFont regular:14];
|
||||
_subTitleLabel.textAlignment = NSTextAlignmentLeft;
|
||||
}
|
||||
return _subTitleLabel;
|
||||
}
|
||||
|
||||
- (CRBoxInputView *)codeInputView {
|
||||
if (!_codeInputView) {
|
||||
// 6 位验证码
|
||||
_codeInputView = [[CRBoxInputView alloc] initWithCodeLength:6];
|
||||
_codeInputView.backgroundColor = [UIColor clearColor];
|
||||
_codeInputView.ifNeedCursor = YES;
|
||||
_codeInputView.keyBoardType = UIKeyboardTypeNumberPad;
|
||||
_codeInputView.inputType = CRInputType_Number;
|
||||
|
||||
// 布局:等宽方块,间距略大一些
|
||||
// CRBoxFlowLayout *layout = [[CRBoxFlowLayout alloc] init];
|
||||
// layout.itemSize = CGSizeMake(40, 48);
|
||||
// layout.minimumInteritemSpacing = 12;
|
||||
// layout.minimumLineSpacing = 12;
|
||||
// layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
|
||||
// _codeInputView.boxFlowLayout = layout;
|
||||
|
||||
CRBoxInputCellProperty *prop = [[CRBoxInputCellProperty alloc] init];
|
||||
prop.borderWidth = 0;
|
||||
prop.cornerRadius = 8.0;
|
||||
prop.cellBgColorNormal = [UIColor colorWithHex:0xF7F7F7];
|
||||
prop.cellBgColorSelected = [UIColor colorWithHex:0xE0F5F2];
|
||||
prop.cellFont = [KBFont bold:20];
|
||||
prop.cellTextColor = [UIColor colorWithHex:KBBlackValue];
|
||||
_codeInputView.customCellProperty = prop;
|
||||
|
||||
[_codeInputView loadAndPrepareView];
|
||||
}
|
||||
return _codeInputView;
|
||||
}
|
||||
|
||||
- (UIButton *)nextButton {
|
||||
if (!_nextButton) {
|
||||
_nextButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_nextButton setTitle:KBLocalized(@"Next Step") forState:UIControlStateNormal];
|
||||
[_nextButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
||||
_nextButton.titleLabel.font = [KBFont medium:16];
|
||||
_nextButton.backgroundColor = [UIColor colorWithHex:KBColorValue];
|
||||
_nextButton.layer.cornerRadius = 28.0;
|
||||
_nextButton.layer.masksToBounds = YES;
|
||||
[_nextButton addTarget:self action:@selector(onTapNext)
|
||||
forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _nextButton;
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user