ModifyPhoneCheckController.m 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. //
  2. // ModifyPhoneCheckController.m
  3. // TeacherDaya
  4. //
  5. // Created by Kyle on 2020/3/9.
  6. // Copyright © 2020 DayaMusic. All rights reserved.
  7. //
  8. #import "ModifyPhoneCheckController.h"
  9. #import "PhoneCheckBodyView.h"
  10. #import "ModifyPhoneChangeController.h"
  11. #import "UserInfoManager.h"
  12. @interface ModifyPhoneCheckController ()
  13. @property (nonatomic, strong) PhoneCheckBodyView *bodyView;
  14. @end
  15. @implementation ModifyPhoneCheckController
  16. - (void)viewDidLoad {
  17. [super viewDidLoad];
  18. // Do any additional setup after loading the view.
  19. [self allocTitle:@"修改手机号"];
  20. [self configUI];
  21. }
  22. - (void)configUI {
  23. self.bodyView = [PhoneCheckBodyView shareInstance];
  24. _bodyView.frame = CGRectMake(0, 0, kScreenWidth, kScreenHeight - kNaviBarHeight - iPhoneXSafeBottomMargin);
  25. _bodyView.phoneField.userInteractionEnabled = NO;
  26. _bodyView.phoneField.text = USER_MANAGER.userInfo.phone;
  27. MJWeakSelf;
  28. [_bodyView sureCallback:^(NSString * _Nonnull phoneNo, NSString * _Nonnull pwdStr) {
  29. [weakSelf checkWithPhone:phoneNo password:pwdStr];
  30. }];
  31. [self.scrollView addSubview:_bodyView];
  32. }
  33. - (void)checkWithPhone:(NSString *)phoneNo password:(NSString *)password {
  34. [self showhud];
  35. [KSRequestManager checkUserRequest:KS_GET phone:phoneNo password:password success:^(NSDictionary * _Nonnull dic) {
  36. [self removehub];
  37. if ([dic integerValueForKey:@"code"] == 200 && [dic boolValueForKey:@"status"]) {
  38. [self nextChangeViewWithWithPhone:phoneNo];
  39. }
  40. else {
  41. [self MBPShow:MESSAGEKEY];
  42. }
  43. } faliure:^(NSError * _Nonnull error) {
  44. [self removehub];
  45. }];
  46. }
  47. - (void)nextChangeViewWithWithPhone:(NSString *)phone {
  48. ModifyPhoneChangeController *changeCtrl = [[ModifyPhoneChangeController alloc] init];
  49. changeCtrl.prePhone = phone;
  50. [self.navigationController pushViewController:changeCtrl animated:YES];
  51. }
  52. /*
  53. #pragma mark - Navigation
  54. // In a storyboard-based application, you will often want to do a little preparation before navigation
  55. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  56. // Get the new view controller using [segue destinationViewController].
  57. // Pass the selected object to the new view controller.
  58. }
  59. */
  60. @end