// 短信验证码倒计时,aSecond参数表示总计倒计时多少秒
- (void)setButtonTimeVaule:(NSString* )aSecond {
int iSecond = aSecond.intValue;
buttonGetVericationCode.backgroundColor = [UIColor lightGrayColor];
buttonGetVericationCode.enabled = NO;
buttonGetVericationCode.titleLabel.text = [NSString stringWithFormat:@"倒计时%@秒", aSecond];
[buttonGetVericationCode setTitle:[NSString stringWithFormat:@"倒计时%@秒", aSecond] forState:UIControlStateNormal];
if (--iSecond < 0) {
buttonGetVericationCode.backgroundColor = TITLE_COLOR;
buttonGetVericationCode.enabled = YES;
buttonGetVericationCode.titleLabel.text = @"获取验证码";
[buttonGetVericationCode setTitle:@"获取验证码" forState:UIControlStateNormal];
return;
}
[self performSelector:@selector(setButtonTimeVaule:) withObject:[NSString stringWithFormat:@"%d", iSecond] afterDelay:1.0f];
int iSecond = aSecond.intValue;
buttonGetVericationCode.backgroundColor = [UIColor lightGrayColor];
buttonGetVericationCode.enabled = NO;
buttonGetVericationCode.titleLabel.text = [NSString stringWithFormat:@"倒计时%@秒", aSecond];
[buttonGetVericationCode setTitle:[NSString stringWithFormat:@"倒计时%@秒", aSecond] forState:UIControlStateNormal];
if (--iSecond < 0) {
buttonGetVericationCode.backgroundColor = TITLE_COLOR;
buttonGetVericationCode.enabled = YES;
buttonGetVericationCode.titleLabel.text = @"获取验证码";
[buttonGetVericationCode setTitle:@"获取验证码" forState:UIControlStateNormal];
return;
}
[self performSelector:@selector(setButtonTimeVaule:) withObject:[NSString stringWithFormat:@"%d", iSecond] afterDelay:1.0f];
}
// 获取短信验证码 和 验证码确定提交 通过block传给弹框层view
if ([UserInfoModel currentUser].Mobile.intValue == 0) {
ResumeRetrievalView* viewRetrieval = [[ResumeRetrievalView alloc] init];
[viewRetrieval animatedIn];
__block ResumeRetrievalView* TmpRetrieval = viewRetrieval;
//获取验证码
viewRetrieval.ResumeRetrievalGetVaildCodeBlock = ^(NSString* aMobile) {
[self startLoading];
NSDictionary * dic = @{@"MemberId":[UserInfoModel currentUser].MemberId,
@"Mobile":aMobile};
ResumeRetrievalView* viewRetrieval = [[ResumeRetrievalView alloc] init];
[viewRetrieval animatedIn];
__block ResumeRetrievalView* TmpRetrieval = viewRetrieval;
//获取验证码
viewRetrieval.ResumeRetrievalGetVaildCodeBlock = ^(NSString* aMobile) {
[self startLoading];
NSDictionary * dic = @{@"MemberId":[UserInfoModel currentUser].MemberId,
@"Mobile":aMobile};
__block NSString* sMobile = aMobile;
// 调用获取验证码的接口
[WWInterface GetVerifyCode:dic result:^(WWServiceResponse *response, NSError *error) {
[self stopLoading];
if (response != nil) {
if (response != nil) {
if ([self responseState:response error:error]) {
// 将发送验证码的号码保存起来
TmpRetrieval.sVaildMobile = sMobile;
[TmpRetrieval setButtonTimeVaule:@"120"];
}
}else{
[self showError:error];
}
}];
};
//确定提交
viewRetrieval.ResumeRetrievalConfirmBlock = ^(NSString* aMobile, NSString* aCode) {
[self startLoading];
[WWInterface PostUserTel:[UserInfoModel currentUser].MemberId Mobile:aMobile VaildCode:aCode result:^(WWServiceResponse *response, NSError *error) {
[self stopLoading];
if (response != nil) {
[TmpRetrieval setButtonTimeVaule:@"120"];
}
}else{
[self showError:error];
}
}];
};
//确定提交
viewRetrieval.ResumeRetrievalConfirmBlock = ^(NSString* aMobile, NSString* aCode) {
[self startLoading];
[WWInterface PostUserTel:[UserInfoModel currentUser].MemberId Mobile:aMobile VaildCode:aCode result:^(WWServiceResponse *response, NSError *error) {
[self stopLoading];
if (response != nil) {
if ([self responseState:response error:error]) {
// 验证码提交之后,将手机号码信息进行归档
[
UserInfoModel
currentUser
].
Mobile
= [
NSNumber
numberWithDouble
:aMobile.
doubleValue
];
[UserInfoModel syncCurrentUserToDisk];
[TmpRetrieval animatedOut];
ResumeSearchItemModel* dataItem = dataModel.arrayResumeInfo[aIndex];
PayResumeViewController* viewController = [[PayResumeViewController alloc] init];
viewController.sResumeId = dataItem.ResumeId;
if ([sSearchType isEqualToString:@"传统算法"])
viewController.sType = @"1";
else if ([sSearchType isEqualToString:@"VIP算法"])
viewController.sType = @"0";
[self.navigationController pushViewController:viewController animated:YES];
}
}else{
[self showError:error];
}
}];
};
return;
[TmpRetrieval animatedOut];
ResumeSearchItemModel* dataItem = dataModel.arrayResumeInfo[aIndex];
PayResumeViewController* viewController = [[PayResumeViewController alloc] init];
viewController.sResumeId = dataItem.ResumeId;
if ([sSearchType isEqualToString:@"传统算法"])
viewController.sType = @"1";
else if ([sSearchType isEqualToString:@"VIP算法"])
viewController.sType = @"0";
[self.navigationController pushViewController:viewController animated:YES];
}
}else{
[self showError:error];
}
}];
};
return;
}