JXGenXinPhoneVc.m 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. //
  2. // JXGenXinPhoneVc.m
  3. // shiku_im
  4. //
  5. // Created by 123 on 2020/5/30.
  6. // Copyright © 2020 Reese. All rights reserved.
  7. //
  8. #import "JXGenXinPhoneVc.h"
  9. #import "JXXiugaiPhoneNumVc.h"
  10. @interface JXGenXinPhoneVc ()<UITextFieldDelegate>
  11. @property (weak, nonatomic) IBOutlet UITextField *textTF;
  12. @property (weak, nonatomic) IBOutlet UIButton *phoneBtn;
  13. @end
  14. @implementation JXGenXinPhoneVc
  15. - (IBAction)backbtn:(id)sender {
  16. [g_navigation dismissViewController:self animated:YES];
  17. }
  18. - (void)viewDidLoad {
  19. [super viewDidLoad];
  20. // Do any additional setup after loading the view from its nib.
  21. self.phoneBtn.layer.cornerRadius=5;
  22. self.phoneBtn.layer.masksToBounds=YES;
  23. self.phoenL.text=[NSString stringWithFormat:@"绑定的手机号:%@",_strURL];
  24. [_phoneBtn addTarget:self action:@selector(updateBtn) forControlEvents:UIControlEventTouchUpInside];
  25. self.textTF.returnKeyType=UIReturnKeyDone;
  26. self.textTF.delegate=self;
  27. }
  28. - (void)updateBtn{
  29. JXXiugaiPhoneNumVc *vc=[JXXiugaiPhoneNumVc new];
  30. [g_navigation pushViewController:vc animated:YES];
  31. return;
  32. [_textTF resignFirstResponder];
  33. if (self.textTF.text.length==0) {
  34. [SVProgressHUD showWithStatus:@"请输入需要更改的手机号"];
  35. [SVProgressHUD dismissWithDelay:1.0];
  36. return ;
  37. }
  38. [SVProgressHUD show];
  39. long time = (long)[[NSDate date] timeIntervalSince1970];
  40. time = (time *1000 + g_server.timeDifference);
  41. NSString *salt = [NSString stringWithFormat:@"%ld", time];
  42. [g_server getact_UserupdateUserPhone:salt telephone:self.textTF.text toView:self];
  43. }
  44. - (BOOL)textFieldShouldReturn:(UITextField *)textField{
  45. if (textField.text.length==0) {
  46. [SVProgressHUD showWithStatus:@"请输入需要更改的手机号"];
  47. [SVProgressHUD dismissWithDelay:1.0];
  48. return NO;
  49. }
  50. [_textTF resignFirstResponder];
  51. [SVProgressHUD show];
  52. long time = (long)[[NSDate date] timeIntervalSince1970];
  53. time = (time *1000 + g_server.timeDifference);
  54. NSString *salt = [NSString stringWithFormat:@"%ld", time];
  55. [g_server getact_UserupdateUserPhone:salt telephone:textField.text toView:self];
  56. return YES;
  57. }
  58. #pragma mark --- 请求成功
  59. -(void) didServerResultSucces:(JXConnection*)aDownload dict:(NSDictionary*)dict array:(NSArray*)array1{
  60. [SVProgressHUD dismiss];
  61. if([aDownload.action isEqualToString:act_updateUserPhone])
  62. {
  63. [SVProgressHUD showWithStatus:@"更改手机号码成功"];
  64. [SVProgressHUD dismissWithDelay:1.0];
  65. [g_navigation dismissViewController:self animated:YES];
  66. }
  67. }
  68. -(int) didServerResultFailed:(JXConnection*)aDownload dict:(NSDictionary*)dict{
  69. [SVProgressHUD dismiss];
  70. NSString * errorCode = [NSString stringWithFormat:@"%@",[dict objectForKey:@"resultMsg"]];
  71. if([errorCode isEqualToString:@"权限验证失败"])
  72. {
  73. }
  74. return [errorCode intValue];
  75. }
  76. -(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
  77. [self.view endEditing:YES];
  78. }
  79. @end