AS_ForgotC.m 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. //
  2. // AS_ForgotC.m
  3. // Asteria
  4. //
  5. // Created by 王猛 on 2023/5/22.
  6. //
  7. #import "AS_ForgotC.h"
  8. #import "EamilTFmatchV.h"
  9. @interface AS_ForgotC ()
  10. @property (nonatomic, strong) UIScrollView *scrollview;
  11. @property (nonatomic, strong) EamilTFmatchV *xxx_emailTFV;
  12. @property (nonatomic, strong) UIButton *xxx_sureBtn;
  13. @end
  14. @implementation AS_ForgotC
  15. - (void)viewDidLoad {
  16. [super viewDidLoad];
  17. // Do any additional setup after loading the view.
  18. self.customNavBar.hidden = YES;
  19. self.navigationController.navigationBar.hidden = YES;
  20. }
  21. - (void)initSubviews{
  22. [super initSubviews];
  23. [self.view addSubview:self.scrollview];
  24. UIView *topNavV = [self logNavView];
  25. [self.scrollview addSubview:topNavV];
  26. UILabel *titileLab = [UILabel new];
  27. titileLab.text = @"RETRIEVE YOUR PASSWORD";
  28. titileLab.font = [UIFont boldSystemFontOfSize:16];
  29. titileLab.textAlignment = NSTextAlignmentCenter;
  30. titileLab.textColor = [UIColor colorWithHexString:@"#000000"];
  31. [self.scrollview addSubview:titileLab];
  32. titileLab.frame = CGRectMake(20, CGRectGetMaxY(topNavV.frame)+50, KScreenWidth-40, 20);
  33. QMUILabel *detailLab = [[QMUILabel alloc]init];
  34. detailLab.text = @"If You Forgotten Your Password, Please Enter Your Registered Email Address.\n\n\n You’ll Receive A Link To Reset Your Password.";
  35. detailLab.textAlignment = NSTextAlignmentCenter;
  36. detailLab.font = [UIFont systemFontOfSize:14];
  37. detailLab.numberOfLines = 0;
  38. [self.scrollview addSubview:detailLab];
  39. detailLab.frame = CGRectMake(36, CGRectGetMaxY(titileLab.frame)+15, KScreenWidth-72, 100);
  40. [self.scrollview addSubview:self.xxx_emailTFV];
  41. self.xxx_emailTFV.mj_y = detailLab.maxY+20;
  42. [self.scrollview addSubview:self.xxx_sureBtn];
  43. self.xxx_sureBtn.mj_y = self.xxx_emailTFV.maxY+30;
  44. [self.scrollview bringSubviewToFront:self.xxx_emailTFV];
  45. }
  46. #pragma mark - **************** handle ****************
  47. -(void)handle_closeEvent{
  48. [self.navigationController popViewControllerAnimated:YES];
  49. }
  50. -(void)action_submitClick:(UIButton *)btn{
  51. if (![Current_normalTool xxx_isValidateEmail:self.xxx_emailTFV.xxx_emailTF.text]) {
  52. [self.view makeToast:@"Please prvide an email address." duration:2 position:CSToastPositionCenter];
  53. return;
  54. }
  55. [self reqNet_forgotPassWord];
  56. }
  57. -(void)reqNet_forgotPassWord{
  58. NSString *url = [NSString stringWithFormat:@"%@%@",AS_Server,@"login/forgotPassword"];
  59. NSMutableDictionary *paraDic = [NSMutableDictionary dictionary];
  60. [paraDic setObject:self.xxx_emailTFV.xxx_emailTF.text forKey:@"email"];
  61. [MBProgressHUD showHUDAddedTo:self.view animated:YES];
  62. [PPNetworkHelper POST:url
  63. parameters:paraDic
  64. success:^(id responseObject) {
  65. [MBProgressHUD hideHUDForView:self.view animated:YES];
  66. if (RequestSuccess) {
  67. [FTT_Helper CreateTitle:[NSString stringWithFormat:@"If there is an account associated %@ you will receive an email with a link to reset your password.",self.xxx_emailTFV.xxx_emailTF.text] message:nil Sure:@"Sure" preferredStyle:UIAlertControllerStyleAlert action:^{
  68. [self handle_closeEvent];
  69. } ViewController:self];
  70. }else{
  71. [self.view makeToast:RequestErrorMsg duration:2 position:CSToastPositionCenter];
  72. }
  73. } failure:^(NSError *error) {
  74. [MBProgressHUD hideHUDForView:self.view animated:YES];
  75. [self.view makeToast:ReqNetWorkFaild duration:2 position:CSToastPositionCenter];
  76. }];
  77. }
  78. -(UIView *)logNavView{
  79. IPhoneXHeigh
  80. UIView *topView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth, securitytop_Y)];
  81. UIButton *closeBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  82. [closeBtn setImage:[UIImage imageNamed:@"common_close"] forState:UIControlStateNormal];
  83. [closeBtn addTarget:self action:@selector(handle_closeEvent) forControlEvents:UIControlEventTouchUpInside];
  84. closeBtn.frame = CGRectMake(20, 44, 44, 44);
  85. [topView addSubview:closeBtn];
  86. UIImageView *headImg = [[UIImageView alloc]init];
  87. UIImage *bannerImg = [UIImage imageNamed:@"common_headLogo"];
  88. headImg.image = bannerImg ;
  89. headImg.frame = CGRectMake((KScreenWidth- bannerImg.size.width)/2, 20 , bannerImg.size.width, bannerImg.size.height);
  90. [topView addSubview:headImg];
  91. closeBtn.centerY = topView.centerY;
  92. headImg.centerY = topView.centerY;
  93. return topView;
  94. }
  95. -(EamilTFmatchV *)xxx_emailTFV{
  96. if (!_xxx_emailTFV) {
  97. _xxx_emailTFV = [[EamilTFmatchV alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth, 50)];
  98. _xxx_emailTFV.xxx_emailTF.placeholder = @"* Email Address";
  99. }
  100. return _xxx_emailTFV;
  101. }
  102. -(UIButton *)xxx_sureBtn{
  103. if (!_xxx_sureBtn) {
  104. _xxx_sureBtn = [TT_ControlTool FTT_ControlToolUIButtonFrame:CGRectMake(20,0 ,KScreenWidth-40,50)
  105. taeget:self
  106. sel:@selector(action_submitClick:)
  107. tag:0
  108. AntTitle:@"SUBMIT"
  109. titleFont:17
  110. titleColor:[UIColor whiteColor]
  111. andImage:nil
  112. AndBackColor:nil
  113. adjustsFontSizesTowidth:NO
  114. masksToBounds:YES
  115. conrenRadius:5
  116. BorderColor:nil
  117. BorderWidth:0
  118. ContentHorizontalAligment:0];
  119. _xxx_sureBtn.backgroundColor = ThemeColor;
  120. }
  121. return _xxx_sureBtn;
  122. }
  123. - (UIScrollView *)scrollview {
  124. if (!_scrollview) {
  125. _scrollview = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
  126. }
  127. return _scrollview;
  128. }
  129. @end