修复bug
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
//
|
||||
// YMLoginVerifBindPhoneViewController.m
|
||||
// YUMI
|
||||
// XPLoginVerifBindPhoneViewController.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by YUMI on 2021/9/18.
|
||||
// Created by 冯硕 on 2021/9/18.
|
||||
//
|
||||
|
||||
#import "XPLoginVerifBindPhoneViewController.h"
|
||||
@@ -10,9 +10,8 @@
|
||||
#import <Masonry/Masonry.h>
|
||||
#import <ReactiveObjC/ReactiveObjC.h>
|
||||
///Tool
|
||||
#import "DJDKMIMOMColor.h"
|
||||
#import "YUMIConstant.h"
|
||||
#import "YUMIMacroUitls.h"
|
||||
|
||||
|
||||
#import "UIImage+Utils.h"
|
||||
#import "CountDownHelper.h"
|
||||
///Model
|
||||
@@ -25,409 +24,254 @@
|
||||
#import "XPMineSettingViewController.h"
|
||||
///View
|
||||
#import "XPLoginBindSuccessView.h"
|
||||
#import "LoginForgetEditView.h"
|
||||
#import "XPLoginAraeViewController.h"
|
||||
|
||||
@interface XPLoginVerifBindPhoneViewController ()<XPLoginVerifBindPhoneProtocol, CountDownHelperDelegate>
|
||||
@property (nonatomic, strong) UIView *containerView;
|
||||
@property (nonatomic, strong) UILabel *areaLabel;
|
||||
@property (nonatomic, strong) UIButton *countryBtn;
|
||||
@property (nonatomic, strong) UIView *areaLineView;
|
||||
@interface XPLoginVerifBindPhoneViewController ()<XPLoginAraeViewControllerDelegate,XPLoginVerifBindPhoneProtocol, CountDownHelperDelegate>
|
||||
|
||||
@property (nonatomic, strong) UIView *phoneLineView;
|
||||
@property (nonatomic, strong) UIView *authLineView;
|
||||
@property (nonatomic, strong) UILabel *areaCodeLabel;
|
||||
|
||||
@property (nonatomic, strong) UIButton *authCodeBtn;
|
||||
@property (nonatomic, strong) UITextField *phoneNumTextField;
|
||||
@property (nonatomic, strong) UITextField *authCodeTextField;
|
||||
|
||||
@property (nonatomic, strong) UIButton *confirmBtn; // 确认按钮
|
||||
|
||||
@property (nonatomic, strong) UILabel *tipsLabel; // 手机号丢失
|
||||
@property (nonatomic, assign) BOOL isResetPhone; // 重新绑定手机
|
||||
///手机号
|
||||
@property (nonatomic,strong) LoginForgetEditView *phoneView;
|
||||
///验证码
|
||||
@property (nonatomic,strong) LoginForgetEditView *codeView;
|
||||
///手机区号
|
||||
@property (nonatomic,copy)NSString *phoneAreaCode;
|
||||
// 确认按钮
|
||||
@property (nonatomic, strong) UIButton *confirmBtn;
|
||||
// 重新绑定手机
|
||||
@property (nonatomic, assign) BOOL isResetPhone;
|
||||
@end
|
||||
|
||||
@implementation XPLoginVerifBindPhoneViewController
|
||||
|
||||
- (void)dealloc {
|
||||
[[CountDownHelper shareHelper] stopCountDown];
|
||||
[[CountDownHelper shareHelper] stopCountDown];
|
||||
}
|
||||
|
||||
- (XPLoginVerifBindPhonePresenter *)createPresenter {
|
||||
return [[XPLoginVerifBindPhonePresenter alloc] init];
|
||||
return [[XPLoginVerifBindPhonePresenter alloc] init];
|
||||
}
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
[self setConfigs];
|
||||
[self setEvents];
|
||||
self.phoneAreaCode = @"852";
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
[self setConfigs];
|
||||
[self setEvents];
|
||||
}
|
||||
|
||||
- (void)viewDidDisappear:(BOOL)animated {
|
||||
[super viewDidDisappear:animated];
|
||||
[[CountDownHelper shareHelper] stopCountDown];
|
||||
[super viewDidDisappear:animated];
|
||||
[[CountDownHelper shareHelper] stopCountDown];
|
||||
self.codeView.authCodeButton.enabled= YES;
|
||||
[self.codeView.authCodeButton setTitle:YMLocalizedString(@"XPLoginVerifBindPhoneViewController11") forState:UIControlStateNormal];
|
||||
}
|
||||
|
||||
#pragma mark - Private Method
|
||||
- (void)initSubViews {
|
||||
[CountDownHelper shareHelper].delegate = self;
|
||||
[self.view addSubview:self.containerView];
|
||||
[self.containerView addSubview:self.areaLabel];
|
||||
[self.containerView addSubview:self.countryBtn];
|
||||
|
||||
[self.containerView addSubview:self.areaLineView];
|
||||
[self.containerView addSubview:self.areaCodeLabel];
|
||||
[self.containerView addSubview:self.phoneNumTextField];
|
||||
[self.containerView addSubview:self.phoneLineView];
|
||||
|
||||
[self.containerView addSubview:self.authCodeBtn];
|
||||
[self.containerView addSubview:self.authCodeTextField];
|
||||
[self.containerView addSubview:self.authLineView];
|
||||
|
||||
[self.containerView addSubview:self.confirmBtn];
|
||||
[self.containerView addSubview:self.tipsLabel];
|
||||
[CountDownHelper shareHelper].delegate = self;
|
||||
self.view.backgroundColor = [UIColor whiteColor];
|
||||
[self.view addSubview:self.codeView];
|
||||
[self.view addSubview:self.phoneView];
|
||||
[self.view addSubview:self.confirmBtn];
|
||||
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
[self.containerView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(0);
|
||||
make.left.right.bottom.mas_equalTo(0);
|
||||
}];
|
||||
|
||||
[self.areaLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(32);
|
||||
make.top.mas_equalTo(20);
|
||||
}];
|
||||
|
||||
[self.countryBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.mas_equalTo(-32);
|
||||
make.centerY.mas_equalTo(self.areaLabel);
|
||||
}];
|
||||
|
||||
[self.areaLineView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(self.areaLabel.mas_bottom).offset(18);
|
||||
make.left.right.mas_equalTo(0).inset(32);
|
||||
make.height.mas_equalTo(1);
|
||||
}];
|
||||
|
||||
[self.areaCodeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(self.areaLineView.mas_bottom).offset(18);
|
||||
make.left.mas_equalTo(self.areaLabel);
|
||||
}];
|
||||
|
||||
[self.phoneNumTextField mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(80);
|
||||
make.centerY.mas_equalTo(self.areaCodeLabel);
|
||||
make.right.mas_equalTo(self.authCodeBtn.mas_left).offset(-20);
|
||||
}];
|
||||
|
||||
[self.authCodeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.mas_equalTo(-32);
|
||||
make.centerY.mas_equalTo(self.areaCodeLabel);
|
||||
}];
|
||||
|
||||
[self.phoneLineView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.height.mas_equalTo(self.areaLineView);
|
||||
make.top.mas_equalTo(self.areaCodeLabel.mas_bottom).offset(18);
|
||||
}];
|
||||
|
||||
[self.authCodeTextField mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.mas_equalTo(0).inset(32);
|
||||
make.height.mas_equalTo(48);
|
||||
make.top.mas_equalTo(self.phoneLineView.mas_bottom);
|
||||
}];
|
||||
|
||||
[self.authLineView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.left.right.mas_equalTo(self.areaLineView);
|
||||
make.top.mas_equalTo(self.authCodeTextField.mas_bottom);
|
||||
}];
|
||||
|
||||
[self.confirmBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.mas_equalTo(0).inset(32);
|
||||
make.top.mas_equalTo(self.authLineView.mas_bottom).offset(70);
|
||||
make.height.mas_equalTo(45);
|
||||
}];
|
||||
|
||||
[self.tipsLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(self.confirmBtn.mas_bottom).offset(36);
|
||||
make.centerX.mas_equalTo(0);
|
||||
}];
|
||||
[self.phoneView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(kGetScaleWidth(30));
|
||||
make.leading.trailing.equalTo(self.view).inset(kGetScaleWidth(15));
|
||||
make.height.mas_equalTo(kGetScaleWidth(48));
|
||||
}];
|
||||
[self.codeView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.leading.trailing.height.equalTo(self.phoneView);
|
||||
make.top.equalTo(self.phoneView.mas_bottom).mas_offset(kGetScaleWidth(25));
|
||||
}];
|
||||
[self.confirmBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.leading.trailing.equalTo(self.view).inset(kGetScaleWidth(15));
|
||||
make.height.mas_equalTo(kGetScaleWidth(46));
|
||||
make.top.mas_equalTo(kGetScaleWidth(275));
|
||||
}];
|
||||
}
|
||||
#pragma mark -配置
|
||||
- (void)setConfigs {
|
||||
switch (self.bindingPhoneNumType) {
|
||||
case XPBindingPhoneNumTypeEdit:{
|
||||
self.navigationItem.title = YMLocalizedString(@"XPLoginVerifBindPhoneViewController0");
|
||||
}
|
||||
break;
|
||||
case XPBindingPhoneNumTypeNormal:{
|
||||
self.navigationItem.title = YMLocalizedString(@"XPLoginVerifBindPhoneViewController1");
|
||||
}
|
||||
break;
|
||||
case XPBindingPhoneNumTypeConfirm:{
|
||||
self.tipsLabel.hidden = NO;
|
||||
self.navigationItem.title = YMLocalizedString(@"XPLoginVerifBindPhoneViewController2");
|
||||
[self.confirmBtn setTitle:YMLocalizedString(@"XPLoginVerifBindPhoneViewController3") forState:UIControlStateNormal];
|
||||
if (self.userInfo.isBindPhone) {
|
||||
self.phoneNumTextField.enabled = NO;
|
||||
self.phoneNumTextField.text = self.userInfo.phone;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
RAC(self.confirmBtn,enabled) = [RACSignal combineLatest:@[self.phoneNumTextField.rac_textSignal,self.authCodeTextField.rac_textSignal] reduce:^(NSString *phone,NSString *code){
|
||||
return @(phone.length == 11 && code.length == 5);
|
||||
}];
|
||||
|
||||
switch (self.bindingPhoneNumType) {
|
||||
case XPBindingPhoneNumTypeEdit:{
|
||||
self.navigationItem.title = YMLocalizedString(@"XPLoginVerifBindPhoneViewController0");
|
||||
}
|
||||
break;
|
||||
case XPBindingPhoneNumTypeNormal:{
|
||||
self.navigationItem.title = YMLocalizedString(@"XPLoginVerifBindPhoneViewController1");
|
||||
}
|
||||
break;
|
||||
case XPBindingPhoneNumTypeConfirm:{
|
||||
|
||||
self.navigationItem.title = YMLocalizedString(@"XPLoginVerifBindPhoneViewController2");
|
||||
[self.confirmBtn setTitle:YMLocalizedString(@"XPLoginVerifBindPhoneViewController3") forState:UIControlStateNormal];
|
||||
if (self.userInfo.isBindPhone) {
|
||||
// self.phoneNumTextField.enabled = NO;
|
||||
// self.phoneNumTextField.text = self.userInfo.phone;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
RAC(self.confirmBtn,enabled) = [RACSignal combineLatest:@[self.phoneView.textField.rac_textSignal,self.codeView.textField.rac_textSignal] reduce:^(NSString *phone,NSString *code){
|
||||
return @(phone.length > 0 && code.length == 5);
|
||||
}];
|
||||
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - XPChooseAreaCodeVCDelegate
|
||||
-(void)chooseAreaCodeSuccess:(NSString *)code{
|
||||
self.phoneAreaCode = code;
|
||||
self.phoneView.areaCode = [NSString stringWithFormat:@"+%@",code];
|
||||
}
|
||||
-(void)chooseAreaCodeAction{
|
||||
XPLoginAraeViewController *codeVC = [XPLoginAraeViewController new];
|
||||
codeVC.delegate = self;
|
||||
[self.navigationController pushViewController:codeVC animated:YES];
|
||||
}
|
||||
#pragma mark 交互事件
|
||||
- (void)setEvents {
|
||||
@weakify(self)
|
||||
// 获取验证码点击事件
|
||||
[[[self.authCodeBtn rac_signalForControlEvents:UIControlEventTouchUpInside] filter:^BOOL(__kindof UIControl * _Nullable value) {
|
||||
// 获取验证码
|
||||
if (self.phoneNumTextField.text.length == 0) {
|
||||
[self showErrorToast:YMLocalizedString(@"XPLoginVerifBindPhoneViewController4")];
|
||||
return NO;
|
||||
}else if (self.phoneNumTextField.text.length < 11) {
|
||||
[self showErrorToast:YMLocalizedString(@"XPLoginVerifBindPhoneViewController5")];
|
||||
return NO;
|
||||
}else {
|
||||
return YES;
|
||||
}
|
||||
}] subscribeNext:^(id _Nullable x) {
|
||||
@strongify(self);
|
||||
[self.presenter phoneSmsCode:self.phoneNumTextField.text type:self.bindingPhoneNumType == XPBindingPhoneNumTypeConfirm ? GetSmsType_Unbind_Phone : GetSmsType_Bind_Phone phoneAreaCode:@""];
|
||||
}];
|
||||
|
||||
|
||||
// 绑定和验证
|
||||
[[[self.confirmBtn rac_signalForControlEvents:UIControlEventTouchUpInside] filter:^BOOL(__kindof UIControl * _Nullable value) {
|
||||
@strongify(self)
|
||||
// 确认绑定手机号
|
||||
if (self.phoneNumTextField.text.length == 0) {
|
||||
[self showErrorToast:YMLocalizedString(@"XPLoginVerifBindPhoneViewController6")];
|
||||
return NO;
|
||||
}else if (self.authCodeTextField.text.length == 0) {
|
||||
[self showErrorToast:YMLocalizedString(@"XPLoginVerifBindPhoneViewController7")];
|
||||
return NO;
|
||||
}else {
|
||||
return YES;
|
||||
}
|
||||
}] subscribeNext:^(id _Nullable x) {
|
||||
@strongify(self)
|
||||
if (self.bindingPhoneNumType == XPBindingPhoneNumTypeConfirm) {
|
||||
[self.presenter checkMoblieCodeWithMoblie:self.phoneNumTextField.text code:self.authCodeTextField.text];
|
||||
} else {
|
||||
[self.presenter bindkMoblieCodeWithMoblie:self.phoneNumTextField.text code:self.authCodeTextField.text];
|
||||
}
|
||||
} error:^(NSError * _Nullable error) {
|
||||
|
||||
}];
|
||||
@weakify(self)
|
||||
// 获取验证码点击事件
|
||||
[[[self.codeView.authCodeButton rac_signalForControlEvents:UIControlEventTouchUpInside] filter:^BOOL(__kindof UIControl * _Nullable value) {
|
||||
// 获取验证码
|
||||
if (self.phoneView.textField.text.length == 0) {
|
||||
[self showErrorToast:YMLocalizedString(@"XPLoginVerifBindPhoneViewController4")];
|
||||
return NO;
|
||||
}
|
||||
return YES;
|
||||
}] subscribeNext:^(id _Nullable x) {
|
||||
@strongify(self);
|
||||
[self.presenter phoneSmsCode:[NSString stringWithFormat:@"%@%@",self.phoneAreaCode,self.phoneView.textField.text] type:self.bindingPhoneNumType == XPBindingPhoneNumTypeConfirm ? GetSmsType_Unbind_Phone : GetSmsType_Bind_Phone phoneAreaCode:self.phoneAreaCode];
|
||||
}];
|
||||
|
||||
// // 绑定和验证
|
||||
[[[self.confirmBtn rac_signalForControlEvents:UIControlEventTouchUpInside] filter:^BOOL(__kindof UIControl * _Nullable value) {
|
||||
@strongify(self)
|
||||
// 确认绑定手机号
|
||||
if (self.phoneView.textField.text.length == 0) {
|
||||
[self showErrorToast:YMLocalizedString(@"XPLoginVerifBindPhoneViewController6")];
|
||||
return NO;
|
||||
}else if (self.codeView.textField.text.length == 0) {
|
||||
[self showErrorToast:YMLocalizedString(@"XPLoginVerifBindPhoneViewController7")];
|
||||
return NO;
|
||||
}else {
|
||||
return YES;
|
||||
}
|
||||
}] subscribeNext:^(id _Nullable x) {
|
||||
@strongify(self)
|
||||
[self.view endEditing:YES];
|
||||
if (self.bindingPhoneNumType == XPBindingPhoneNumTypeConfirm) {
|
||||
[self.presenter checkMoblieCodeWithMoblie:[NSString stringWithFormat:@"%@%@",self.phoneAreaCode,self.phoneView.textField.text] code:self.codeView.textField.text phoneAreaCode:self.phoneAreaCode];
|
||||
} else {
|
||||
[self.presenter bindkMoblieCodeWithMoblie:[NSString stringWithFormat:@"%@%@",self.phoneAreaCode,self.phoneView.textField.text] code:self.codeView.textField.text phoneAreaCode:self.phoneAreaCode];
|
||||
}
|
||||
} error:^(NSError * _Nullable error) {
|
||||
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - XPLoginVerifBindPhoneProtocol
|
||||
- (void)phoneSmsCodeSuccess {
|
||||
self.authCodeBtn.enabled = NO;
|
||||
[self showSuccessToast:YMLocalizedString(@"XPLoginVerifBindPhoneViewController8")];
|
||||
[[CountDownHelper shareHelper] openCountdownWithTime:60];
|
||||
self.codeView.authCodeButton.enabled = NO;
|
||||
[self showSuccessToast:YMLocalizedString(@"XPLoginVerifBindPhoneViewController8")];
|
||||
[[CountDownHelper shareHelper] openCountdownWithTime:60];
|
||||
}
|
||||
|
||||
- (void)checkMoblieCodeWithMoblieSuccess {
|
||||
[self showSuccessToast:YMLocalizedString(@"XPLoginVerifBindPhoneViewController9")];
|
||||
[[CountDownHelper shareHelper] stopCountDown];
|
||||
XPLoginVerifBindPhoneViewController *vc = [[XPLoginVerifBindPhoneViewController alloc] init];
|
||||
vc.bindingPhoneNumType = XPBindingPhoneNumTypeEdit;
|
||||
vc.userInfo = self.userInfo;
|
||||
[self.navigationController pushViewController:vc animated:YES];
|
||||
[self showSuccessToast:YMLocalizedString(@"XPLoginVerifBindPhoneViewController9")];
|
||||
[[CountDownHelper shareHelper] stopCountDown];
|
||||
XPLoginVerifBindPhoneViewController *vc = [[XPLoginVerifBindPhoneViewController alloc] init];
|
||||
vc.bindingPhoneNumType = XPBindingPhoneNumTypeEdit;
|
||||
vc.userInfo = self.userInfo;
|
||||
[self.navigationController pushViewController:vc animated:YES];
|
||||
}
|
||||
|
||||
- (void)bindMoblieCodeWithMoblieSuccess {
|
||||
[[CountDownHelper shareHelper] stopCountDown];
|
||||
// 修改绑定信息
|
||||
if (self.bindingPhoneNumType == XPBindingPhoneNumTypeEdit) {
|
||||
@weakify(self);
|
||||
[XPLoginBindSuccessView showBindSuccessViewWithHandler:^{
|
||||
@strongify(self);
|
||||
// 返回设置页面
|
||||
__block __kindof UIViewController *vc;
|
||||
[self.navigationController.childViewControllers enumerateObjectsUsingBlock:^(__kindof UIViewController * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
if ([obj isKindOfClass:[XPMineSettingViewController class]]) {
|
||||
vc = obj; // 导航控制器中有设置VC
|
||||
}
|
||||
}];
|
||||
|
||||
if ([self.navigationController.childViewControllers containsObject:vc]) {
|
||||
[self.navigationController popToViewController:vc animated:YES];
|
||||
} else {
|
||||
[self.navigationController popViewControllerAnimated:YES];
|
||||
}
|
||||
}];
|
||||
} else if (self.bindingPhoneNumType == XPBindingPhoneNumTypeNormal) {
|
||||
@weakify(self);
|
||||
[XPLoginBindSuccessView showBindSuccessViewWithHandler:^{
|
||||
@strongify(self);
|
||||
[self.navigationController popViewControllerAnimated:YES];
|
||||
}];
|
||||
}
|
||||
self.confirmBtn.enabled = YES; // 打开交互
|
||||
|
||||
[[CountDownHelper shareHelper] stopCountDown];
|
||||
// 修改绑定信息
|
||||
if (self.bindingPhoneNumType == XPBindingPhoneNumTypeEdit) {
|
||||
@weakify(self);
|
||||
[XPLoginBindSuccessView showBindSuccessViewWithHandler:^{
|
||||
@strongify(self);
|
||||
// 返回设置页面
|
||||
__block __kindof UIViewController *vc;
|
||||
[self.navigationController.childViewControllers enumerateObjectsUsingBlock:^(__kindof UIViewController * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
if ([obj isKindOfClass:[XPMineSettingViewController class]]) {
|
||||
vc = obj; // 导航控制器中有设置VC
|
||||
}
|
||||
}];
|
||||
|
||||
if ([self.navigationController.childViewControllers containsObject:vc]) {
|
||||
[self.navigationController popToViewController:vc animated:YES];
|
||||
} else {
|
||||
[self.navigationController popViewControllerAnimated:YES];
|
||||
}
|
||||
}];
|
||||
} else if (self.bindingPhoneNumType == XPBindingPhoneNumTypeNormal) {
|
||||
@weakify(self);
|
||||
[XPLoginBindSuccessView showBindSuccessViewWithHandler:^{
|
||||
@strongify(self);
|
||||
[self.navigationController popViewControllerAnimated:YES];
|
||||
}];
|
||||
}
|
||||
self.confirmBtn.enabled = YES; // 打开交互
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - CountDownHelperDelegate
|
||||
///倒计时进行中
|
||||
- (void)onCountdownOpen:(int)time {
|
||||
[self.authCodeBtn setTitle:[NSString stringWithFormat:YMLocalizedString(@"XPLoginVerifBindPhoneViewController10"), time] forState:UIControlStateDisabled];
|
||||
[self.codeView.authCodeButton setTitle:[NSString stringWithFormat:YMLocalizedString(@"XPLoginVerifBindPhoneViewController10"), time] forState:UIControlStateDisabled];
|
||||
}
|
||||
///倒计时结束
|
||||
- (void)onCountdownFinish {
|
||||
self.authCodeBtn.enabled= YES;
|
||||
[self.authCodeBtn setTitle:YMLocalizedString(@"XPLoginVerifBindPhoneViewController11") forState:UIControlStateNormal];
|
||||
self.codeView.authCodeButton.enabled= YES;
|
||||
[self.codeView.authCodeButton setTitle:YMLocalizedString(@"XPLoginVerifBindPhoneViewController11") forState:UIControlStateNormal];
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (UIView *)containerView{
|
||||
if (!_containerView) {
|
||||
_containerView = [[UIView alloc] init];
|
||||
_containerView.backgroundColor = [DJDKMIMOMColor appBackgroundColor];
|
||||
}
|
||||
return _containerView;
|
||||
}
|
||||
|
||||
- (UILabel *)areaLabel{
|
||||
if (!_areaLabel) {
|
||||
_areaLabel = [[UILabel alloc] init];
|
||||
_areaLabel.text = YMLocalizedString(@"XPLoginVerifBindPhoneViewController12");
|
||||
_areaLabel.textColor = [DJDKMIMOMColor secondTextColor];
|
||||
_areaLabel.font = [UIFont systemFontOfSize:14.f];
|
||||
_areaLabel.adjustsFontSizeToFitWidth = YES;
|
||||
}
|
||||
return _areaLabel;
|
||||
}
|
||||
|
||||
- (UILabel *)areaCodeLabel{
|
||||
if (!_areaCodeLabel) {
|
||||
_areaCodeLabel = [[UILabel alloc] init];
|
||||
_areaCodeLabel.text = @"+852";
|
||||
_areaCodeLabel.textColor = [DJDKMIMOMColor secondTextColor];
|
||||
_areaCodeLabel.font = [UIFont systemFontOfSize:14.f];
|
||||
_areaCodeLabel.adjustsFontSizeToFitWidth = YES;
|
||||
}
|
||||
return _areaCodeLabel;
|
||||
}
|
||||
|
||||
- (UIButton *)countryBtn {
|
||||
if (!_countryBtn) {
|
||||
_countryBtn = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_countryBtn setTitle:YMLocalizedString(@"XPLoginVerifBindPhoneViewController13") forState:UIControlStateNormal];
|
||||
[_countryBtn setImage:[UIImage imageNamed:@"mine_item_arrow"] forState:UIControlStateNormal];
|
||||
_countryBtn.transform = CGAffineTransformMakeScale(-1.0, 1.0);
|
||||
_countryBtn.titleLabel.transform = CGAffineTransformMakeScale(-1.0, 1.0);
|
||||
_countryBtn.imageView.transform = CGAffineTransformMakeScale(-1.0, 1.0);
|
||||
_countryBtn.imageEdgeInsets = UIEdgeInsetsMake(0, -10, 0, 0);
|
||||
[_countryBtn setTitleColor:[DJDKMIMOMColor secondTextColor] forState:UIControlStateNormal];
|
||||
[_countryBtn.titleLabel setFont:[UIFont systemFontOfSize:14.f]];
|
||||
}
|
||||
return _countryBtn;
|
||||
}
|
||||
|
||||
- (UIButton *)confirmBtn {
|
||||
if (!_confirmBtn) {
|
||||
_confirmBtn = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_confirmBtn setTitle:YMLocalizedString(@"XPLoginVerifBindPhoneViewController14") forState:UIControlStateNormal];
|
||||
[_confirmBtn setTitleColor:[DJDKMIMOMColor confirmButtonTextColor] forState:UIControlStateNormal];
|
||||
[_confirmBtn setTitleColor:[DJDKMIMOMColor disableButtonTextColor] forState:UIControlStateDisabled];
|
||||
[_confirmBtn.titleLabel setFont:[UIFont fontWithName:@"PingFang-SC-Medium" size:18]];
|
||||
_confirmBtn.layer.cornerRadius = 22.5f;
|
||||
_confirmBtn.layer.masksToBounds = YES;
|
||||
_confirmBtn.enabled = NO;
|
||||
[_confirmBtn setBackgroundImage:[UIImage gradientColorImageFromColors:@[[DJDKMIMOMColor confirmButtonGradientStartColor], [DJDKMIMOMColor confirmButtonGradientEndColor]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)] forState:UIControlStateNormal];
|
||||
[_confirmBtn setBackgroundImage:[UIImage gradientColorImageFromColors:@[[DJDKMIMOMColor disableButtonColor], [DJDKMIMOMColor disableButtonColor]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)] forState:UIControlStateDisabled];
|
||||
}
|
||||
return _confirmBtn;
|
||||
if (!_confirmBtn) {
|
||||
_confirmBtn = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_confirmBtn setTitle:YMLocalizedString(@"XPLoginVerifBindPhoneViewController14") forState:UIControlStateNormal];
|
||||
[_confirmBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
||||
[_confirmBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateDisabled];
|
||||
[_confirmBtn.titleLabel setFont:kFontRegular(16)];
|
||||
_confirmBtn.layer.cornerRadius = kGetScaleWidth(23);
|
||||
_confirmBtn.layer.masksToBounds = YES;
|
||||
_confirmBtn.enabled = NO;
|
||||
[_confirmBtn setBackgroundImage:[UIImage gradientColorImageFromColors:@[[DJDKMIMOMColor confirmButtonGradientStartColor], [DJDKMIMOMColor confirmButtonGradientEndColor]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)] forState:UIControlStateNormal];
|
||||
|
||||
}
|
||||
return _confirmBtn;
|
||||
}
|
||||
|
||||
- (UIButton *)authCodeBtn {
|
||||
if (!_authCodeBtn) {
|
||||
_authCodeBtn = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_authCodeBtn setTitle:YMLocalizedString(@"XPLoginVerifBindPhoneViewController15") forState:UIControlStateNormal];
|
||||
[_authCodeBtn setTitleColor:[DJDKMIMOMColor appMainColor] forState:UIControlStateNormal];
|
||||
[_authCodeBtn setTitleColor:[DJDKMIMOMColor secondTextColor] forState:UIControlStateDisabled];
|
||||
[_authCodeBtn.titleLabel setFont:[UIFont systemFontOfSize:12.f]];
|
||||
}
|
||||
return _authCodeBtn;
|
||||
- (LoginForgetEditView *)phoneView {
|
||||
if (!_phoneView) {
|
||||
_phoneView = [[LoginForgetEditView alloc] init];
|
||||
// _phoneView.placeholder = YMLocalizedString(@"LoginForgetPasswordViewController7");
|
||||
_phoneView.type = LoginForgetEditViewTypeNormal;
|
||||
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(chooseAreaCodeAction)];
|
||||
[_phoneView.codeView addGestureRecognizer:tap];
|
||||
}
|
||||
return _phoneView;
|
||||
}
|
||||
|
||||
- (UITextField *)phoneNumTextField {
|
||||
if (!_phoneNumTextField) {
|
||||
_phoneNumTextField = [[UITextField alloc] init];
|
||||
_phoneNumTextField.textColor = [DJDKMIMOMColor mainTextColor];
|
||||
_phoneNumTextField.font = [UIFont systemFontOfSize:14.f];
|
||||
_phoneNumTextField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:YMLocalizedString(@"XPLoginVerifBindPhoneViewController16")attributes:@{NSForegroundColorAttributeName: [DJDKMIMOMColor secondTextColor]}];
|
||||
_phoneNumTextField.clearButtonMode = UITextFieldViewModeWhileEditing;
|
||||
_phoneNumTextField.borderStyle = UITextBorderStyleNone;
|
||||
_phoneNumTextField.keyboardType = UIKeyboardTypeNumberPad;
|
||||
_phoneNumTextField.tintColor = [DJDKMIMOMColor mainTextColor];
|
||||
}
|
||||
return _phoneNumTextField;
|
||||
}
|
||||
|
||||
|
||||
- (UITextField *)authCodeTextField {
|
||||
if (!_authCodeTextField) {
|
||||
_authCodeTextField = [[UITextField alloc] init];
|
||||
_authCodeTextField.textColor = [DJDKMIMOMColor mainTextColor];
|
||||
_authCodeTextField.font = [UIFont systemFontOfSize:14.f];
|
||||
_authCodeTextField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:YMLocalizedString(@"XPLoginVerifBindPhoneViewController17")attributes:@{NSForegroundColorAttributeName: [DJDKMIMOMColor secondTextColor]}];
|
||||
_authCodeTextField.clearButtonMode = UITextFieldViewModeWhileEditing;
|
||||
_authCodeTextField.borderStyle = UITextBorderStyleNone;
|
||||
_authCodeTextField.keyboardType = UIKeyboardTypeNumberPad;
|
||||
_authCodeTextField.tintColor = [DJDKMIMOMColor mainTextColor];
|
||||
}
|
||||
return _authCodeTextField;
|
||||
}
|
||||
|
||||
- (UIView *)areaLineView {
|
||||
if (!_areaLineView) {
|
||||
_areaLineView = [[UIView alloc] init];
|
||||
_areaLineView.backgroundColor = [DJDKMIMOMColor dividerColor];
|
||||
}
|
||||
return _areaLineView;
|
||||
}
|
||||
|
||||
- (UIView *)phoneLineView {
|
||||
if (!_phoneLineView) {
|
||||
_phoneLineView = [[UIView alloc] init];
|
||||
_phoneLineView.backgroundColor = [DJDKMIMOMColor dividerColor];
|
||||
}
|
||||
return _phoneLineView;
|
||||
}
|
||||
|
||||
- (UIView *)authLineView {
|
||||
if (!_authLineView) {
|
||||
_authLineView = [[UIView alloc] init];
|
||||
_authLineView.backgroundColor = [DJDKMIMOMColor dividerColor];
|
||||
}
|
||||
return _authLineView;
|
||||
}
|
||||
|
||||
- (UILabel *)tipsLabel{
|
||||
if (!_tipsLabel) {
|
||||
_tipsLabel = [[UILabel alloc] init];
|
||||
_tipsLabel.text = [NSString stringWithFormat:@"如果您的手机号已丢失\n请咨询客服,ID:%@", @"88001"];
|
||||
_tipsLabel.textColor = [DJDKMIMOMColor textThirdColor];
|
||||
_tipsLabel.font = [UIFont systemFontOfSize:14.f];
|
||||
_tipsLabel.adjustsFontSizeToFitWidth = YES;
|
||||
_tipsLabel.numberOfLines = 0;
|
||||
_tipsLabel.hidden = YES;
|
||||
}
|
||||
return _tipsLabel;
|
||||
- (LoginForgetEditView *)codeView {
|
||||
if (!_codeView) {
|
||||
_codeView = [[LoginForgetEditView alloc] init];
|
||||
_codeView.placeholder = YMLocalizedString(@"XPLoginVerifBindPhoneViewController17");
|
||||
_codeView.type = LoginForgetEditViewTypeSms;
|
||||
}
|
||||
return _codeView;
|
||||
}
|
||||
|
||||
@end
|
||||
|
Reference in New Issue
Block a user