From 431a19b0435052ab81fb7de818338fcc5cb0586d Mon Sep 17 00:00:00 2001 From: lianxiang <13052344590@163.com> Date: Sun, 30 Sep 2018 16:08:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=89=8B=E6=9C=BA=E9=AA=8C?= =?UTF-8?q?=E8=AF=81=E7=A0=81=E8=A7=A6=E5=8F=91=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../LogIn/Controller/GiGaRegistViewController.m | 8 +++++--- GIGA/Modules/LogIn/Controller/PassWordResetVC.m | 14 ++++++-------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/GIGA/Modules/LogIn/Controller/GiGaRegistViewController.m b/GIGA/Modules/LogIn/Controller/GiGaRegistViewController.m index ce59090..53664df 100644 --- a/GIGA/Modules/LogIn/Controller/GiGaRegistViewController.m +++ b/GIGA/Modules/LogIn/Controller/GiGaRegistViewController.m @@ -90,12 +90,12 @@ GIGA_ShowToast(@"请输入正确手机号"); return; } - btn.userInteractionEnabled = NO; - [self startTimer:btn]; + [self sendVerifiCode:btn]; } -(void)startTimer:(UIButton *)btn{ + btn.userInteractionEnabled = NO; if (_time>0) { _timer = [NSTimer scheduledTimerWithTimeInterval:1 count:60 callback:^{ NSString *timeStr=[NSString stringWithFormat:@"%lds",(long)self->_time]; @@ -128,7 +128,9 @@ [api requstDataWithResult:^(GiGaAPIResult *result) { [MBProgressHUD hideHUDForView:self.view animated:YES]; GILog(@"短信获取%@",result.message); - btn.userInteractionEnabled = YES; + if (result.success) { + [self startTimer:btn]; + } }]; } diff --git a/GIGA/Modules/LogIn/Controller/PassWordResetVC.m b/GIGA/Modules/LogIn/Controller/PassWordResetVC.m index 7ebfdce..d636fea 100644 --- a/GIGA/Modules/LogIn/Controller/PassWordResetVC.m +++ b/GIGA/Modules/LogIn/Controller/PassWordResetVC.m @@ -79,17 +79,13 @@ GIGA_ShowToast(@"请输入正确手机号"); return; } - - - btn.userInteractionEnabled = NO; - - [self startTimer:btn]; + [self requstCode:btn]; } //计时 -(void)startTimer:(UIButton *)btn{ - + btn.userInteractionEnabled = NO; if (_time>0) { _timer = [NSTimer scheduledTimerWithTimeInterval:1 count:60 callback:^{ NSString *timeStr=[NSString stringWithFormat:@"%lds",(long)self->_time]; @@ -123,10 +119,12 @@ NSDictionary *params = @{@"mobile":self.phoneNumberTextField.text}; GiGaBaseAPiRequest *requst = [GiGaBaseAPiRequest initWithRequestPath:@"msg/sms/v1/retrievesendcode" method:RequestPostMethod parms:params]; [requst requstDataWithResult:^(GiGaAPIResult *result) { - btn.userInteractionEnabled = YES; [self.view hideToastActivity]; GIGA_ShowToast(result.message); - + if (result.success) { + //成功后再开始倒计时 + [self startTimer:btn]; + } }]; }