AS_SignUpC.m 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. //
  2. // AS_SignUpC.m
  3. // Asteria
  4. //
  5. // Created by 王猛 on 2023/5/17.
  6. //
  7. #import "AS_SignUpC.h"
  8. #import "LoginSignUpV.h"
  9. @interface AS_SignUpC () <UIScrollViewDelegate>
  10. @property (nonatomic, strong) UIScrollView *scrollview;
  11. @property (nonatomic, strong) LoginSignUpV *xxx_signUpV;
  12. @end
  13. @implementation AS_SignUpC
  14. - (void)viewDidLoad {
  15. [super viewDidLoad];
  16. // Do any additional setup after loading the view.
  17. self.customNavBar.hidden = YES;
  18. self.navigationController.navigationBar.hidden = YES;
  19. [self ucm_subVeiwsTapBlock];
  20. }
  21. - (void)initSubviews{
  22. [super initSubviews];
  23. [self.view addSubview:self.scrollview];
  24. UIView *logNav = [self logNavView];
  25. [self.scrollview addSubview:logNav];
  26. UIImageView *Hi_imgV = [[UIImageView alloc]init];
  27. UIImage *hiImg = [UIImage imageNamed:@"login_signup"];
  28. Hi_imgV.image = hiImg;
  29. [self.scrollview addSubview:Hi_imgV];
  30. [self.scrollview addSubview:self.xxx_signUpV];
  31. Hi_imgV.frame = CGRectMake(20, CGRectGetMaxY(logNav.frame)+30, KScreenWidth-40, hiImg.size.height/hiImg.size.width*(KScreenWidth-40));
  32. self.xxx_signUpV.frame = CGRectMake(0, CGRectGetMaxY(Hi_imgV.frame)+30, KScreenWidth, 500);
  33. [self.xxx_signUpV sizeToFit];
  34. self.scrollview.contentSize = CGSizeMake(KScreenWidth, CGRectGetMaxY(self.xxx_signUpV.frame) + 34);
  35. }
  36. - (void)ucm_subVeiwsTapBlock{
  37. @weakify(self)
  38. self.xxx_signUpV.ViewtapClose = ^(NSInteger num, id _Nonnull data) {
  39. @strongify(self)
  40. [self reqNet_singup:(NSMutableDictionary *)data];
  41. };
  42. }
  43. -(void)reqNet_singup:(NSMutableDictionary *)dic{
  44. [MBProgressHUD showHUDAddedTo:self.view animated:YES];
  45. [ASNetTools.shared postWithPath:BaseRequestrUrl(@"customers") param:dic success:^(id _Nonnull json) {
  46. @weakify(self)
  47. NSMutableDictionary *logDic = [NSMutableDictionary dictionary];
  48. logDic[@"password"] = dic[@"password"];
  49. logDic[@"username"] = dic[@"customer"][@"email"];
  50. [ASNetTools xxx_loginWithParam:logDic success:^(id _Nonnull result) {
  51. [MBProgressHUD hideHUDForView:self.view animated:YES];
  52. [self.view makeToast:@"Success" duration:2 position:CSToastPositionCenter title:nil image:nil style:nil completion:^(BOOL didTap) {
  53. @strongify(self)
  54. [self handle_closeEvent:nil];
  55. }];
  56. } faild:^(NSString * _Nonnull code, NSString * _Nonnull msg) {
  57. [MBProgressHUD hideHUDForView:self.view animated:YES];
  58. [self.view makeToast:msg duration:2 position:CSToastPositionCenter];
  59. }];
  60. } faild:^(NSString * _Nonnull code, NSString * _Nonnull msg) {
  61. [MBProgressHUD hideHUDForView:self.view animated:YES];
  62. [self.view makeToast:msg duration:2 position:CSToastPositionCenter];
  63. }];
  64. }
  65. -(void)handle_closeEvent:(UIButton *)btn{
  66. [self.navigationController dismissViewControllerAnimated:YES completion:nil];
  67. }
  68. -(void)handle_popEvent:(UIButton *)btn{
  69. if (self.isPresent) {
  70. [self.navigationController dismissViewControllerAnimated:YES completion:nil];
  71. } else {
  72. [self.navigationController popViewControllerAnimated:YES];
  73. }
  74. }
  75. - (UIScrollView *)scrollview {
  76. if (!_scrollview) {
  77. _scrollview = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
  78. }
  79. return _scrollview;
  80. }
  81. -(UIView *)logNavView{
  82. IPhoneXHeigh
  83. UIView *topView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth, securitytop_Y)];
  84. UIButton *closeBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  85. [closeBtn setImage:[UIImage imageNamed:@"common_close"] forState:UIControlStateNormal];
  86. [closeBtn addTarget:self action:@selector(handle_popEvent:) forControlEvents:UIControlEventTouchUpInside];
  87. closeBtn.frame = CGRectMake(20, 44, 44, 44);
  88. [topView addSubview:closeBtn];
  89. UIImageView *headImg = [[UIImageView alloc]init];
  90. UIImage *bannerImg = [UIImage imageNamed:@"common_headLogo"];
  91. headImg.image = bannerImg ;
  92. headImg.frame = CGRectMake((KScreenWidth- bannerImg.size.width)/2, 20 , bannerImg.size.width, bannerImg.size.height);
  93. [topView addSubview:headImg];
  94. closeBtn.centerY = topView.centerY;
  95. headImg.centerY = topView.centerY;
  96. return topView;
  97. }
  98. - (LoginSignUpV *)xxx_signUpV {
  99. if (!_xxx_signUpV) {
  100. _xxx_signUpV = [[LoginSignUpV alloc] init];
  101. }
  102. return _xxx_signUpV;
  103. }
  104. @end