// // JXGenXinPhoneVc.m // shiku_im // // Created by 123 on 2020/5/30. // Copyright © 2020 Reese. All rights reserved. // #import "JXGenXinPhoneVc.h" #import "JXXiugaiPhoneNumVc.h" @interface JXGenXinPhoneVc () @property (weak, nonatomic) IBOutlet UITextField *textTF; @property (weak, nonatomic) IBOutlet UIButton *phoneBtn; @end @implementation JXGenXinPhoneVc - (IBAction)backbtn:(id)sender { [g_navigation dismissViewController:self animated:YES]; } - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view from its nib. self.phoneBtn.layer.cornerRadius=5; self.phoneBtn.layer.masksToBounds=YES; self.phoenL.text=[NSString stringWithFormat:@"绑定的手机号:%@",_strURL]; [_phoneBtn addTarget:self action:@selector(updateBtn) forControlEvents:UIControlEventTouchUpInside]; self.textTF.returnKeyType=UIReturnKeyDone; self.textTF.delegate=self; } - (void)updateBtn{ JXXiugaiPhoneNumVc *vc=[JXXiugaiPhoneNumVc new]; [g_navigation pushViewController:vc animated:YES]; return; [_textTF resignFirstResponder]; if (self.textTF.text.length==0) { [SVProgressHUD showWithStatus:@"请输入需要更改的手机号"]; [SVProgressHUD dismissWithDelay:1.0]; return ; } [SVProgressHUD show]; long time = (long)[[NSDate date] timeIntervalSince1970]; time = (time *1000 + g_server.timeDifference); NSString *salt = [NSString stringWithFormat:@"%ld", time]; [g_server getact_UserupdateUserPhone:salt telephone:self.textTF.text toView:self]; } - (BOOL)textFieldShouldReturn:(UITextField *)textField{ if (textField.text.length==0) { [SVProgressHUD showWithStatus:@"请输入需要更改的手机号"]; [SVProgressHUD dismissWithDelay:1.0]; return NO; } [_textTF resignFirstResponder]; [SVProgressHUD show]; long time = (long)[[NSDate date] timeIntervalSince1970]; time = (time *1000 + g_server.timeDifference); NSString *salt = [NSString stringWithFormat:@"%ld", time]; [g_server getact_UserupdateUserPhone:salt telephone:textField.text toView:self]; return YES; } #pragma mark --- 请求成功 -(void) didServerResultSucces:(JXConnection*)aDownload dict:(NSDictionary*)dict array:(NSArray*)array1{ [SVProgressHUD dismiss]; if([aDownload.action isEqualToString:act_updateUserPhone]) { [SVProgressHUD showWithStatus:@"更改手机号码成功"]; [SVProgressHUD dismissWithDelay:1.0]; [g_navigation dismissViewController:self animated:YES]; } } -(int) didServerResultFailed:(JXConnection*)aDownload dict:(NSDictionary*)dict{ [SVProgressHUD dismiss]; NSString * errorCode = [NSString stringWithFormat:@"%@",[dict objectForKey:@"resultMsg"]]; if([errorCode isEqualToString:@"权限验证失败"]) { } return [errorCode intValue]; } -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ [self.view endEditing:YES]; } @end