AS_SignUpC.m 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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. NSLog(@"------%@",self.xxx_signUpV);
  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. [self.navigationController popViewControllerAnimated:YES];
  70. }
  71. - (UIScrollView *)scrollview {
  72. if (!_scrollview) {
  73. _scrollview = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
  74. }
  75. return _scrollview;
  76. }
  77. -(UIView *)logNavView{
  78. IPhoneXHeigh
  79. UIView *topView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth, securitytop_Y)];
  80. UIButton *closeBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  81. [closeBtn setImage:[UIImage imageNamed:@"common_close"] forState:UIControlStateNormal];
  82. [closeBtn addTarget:self action:@selector(handle_popEvent:) forControlEvents:UIControlEventTouchUpInside];
  83. closeBtn.frame = CGRectMake(20, 44, 44, 44);
  84. [topView addSubview:closeBtn];
  85. UIImageView *headImg = [[UIImageView alloc]init];
  86. UIImage *bannerImg = [UIImage imageNamed:@"common_headLogo"];
  87. headImg.image = bannerImg ;
  88. headImg.frame = CGRectMake((KScreenWidth- bannerImg.size.width)/2, 20 , bannerImg.size.width, bannerImg.size.height);
  89. [topView addSubview:headImg];
  90. closeBtn.centerY = topView.centerY;
  91. headImg.centerY = topView.centerY;
  92. return topView;
  93. }
  94. - (LoginSignUpV *)xxx_signUpV {
  95. if (!_xxx_signUpV) {
  96. _xxx_signUpV = [[LoginSignUpV alloc] init];
  97. }
  98. return _xxx_signUpV;
  99. }
  100. @end