// // AS_SignUpC.m // Asteria // // Created by 王猛 on 2023/5/17. // #import "AS_SignUpC.h" #import "LoginSignUpV.h" @interface AS_SignUpC () @property (nonatomic, strong) UIScrollView *scrollview; @property (nonatomic, strong) LoginSignUpV *xxx_signUpV; @end @implementation AS_SignUpC - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. self.customNavBar.hidden = YES; self.navigationController.navigationBar.hidden = YES; [self ucm_subVeiwsTapBlock]; } - (void)initSubviews{ [super initSubviews]; [self.view addSubview:self.scrollview]; UIView *logNav = [self logNavView]; [self.scrollview addSubview:logNav]; UIImageView *Hi_imgV = [[UIImageView alloc]init]; UIImage *hiImg = [UIImage imageNamed:@"login_signup"]; Hi_imgV.image = hiImg; [self.scrollview addSubview:Hi_imgV]; [self.scrollview addSubview:self.xxx_signUpV]; Hi_imgV.frame = CGRectMake(20, CGRectGetMaxY(logNav.frame)+30, KScreenWidth-40, hiImg.size.height/hiImg.size.width*(KScreenWidth-40)); self.xxx_signUpV.frame = CGRectMake(0, CGRectGetMaxY(Hi_imgV.frame)+30, KScreenWidth, 500); [self.xxx_signUpV sizeToFit]; self.scrollview.contentSize = CGSizeMake(KScreenWidth, CGRectGetMaxY(self.xxx_signUpV.frame) + 34); } - (void)ucm_subVeiwsTapBlock{ @weakify(self) self.xxx_signUpV.ViewtapClose = ^(NSInteger num, id _Nonnull data) { @strongify(self) [self reqNet_singup:(NSMutableDictionary *)data]; }; } -(void)reqNet_singup:(NSMutableDictionary *)dic{ [MBProgressHUD showHUDAddedTo:self.view animated:YES]; [ASNetTools.shared postWithPath:BaseRequestrUrl(@"customers") param:dic success:^(id _Nonnull json) { @weakify(self) NSMutableDictionary *logDic = [NSMutableDictionary dictionary]; logDic[@"password"] = dic[@"password"]; logDic[@"username"] = dic[@"customer"][@"email"]; [ASNetTools xxx_loginWithParam:logDic success:^(id _Nonnull result) { [MBProgressHUD hideHUDForView:self.view animated:YES]; [self.view makeToast:@"Success" duration:2 position:CSToastPositionCenter title:nil image:nil style:nil completion:^(BOOL didTap) { @strongify(self) [self handle_closeEvent:nil]; }]; } faild:^(NSString * _Nonnull code, NSString * _Nonnull msg) { [MBProgressHUD hideHUDForView:self.view animated:YES]; [self.view makeToast:msg duration:2 position:CSToastPositionCenter]; }]; } faild:^(NSString * _Nonnull code, NSString * _Nonnull msg) { [MBProgressHUD hideHUDForView:self.view animated:YES]; [self.view makeToast:msg duration:2 position:CSToastPositionCenter]; }]; } -(void)handle_closeEvent:(UIButton *)btn{ [self.navigationController dismissViewControllerAnimated:YES completion:nil]; } -(void)handle_popEvent:(UIButton *)btn{ if (self.isPresent) { [self.navigationController dismissViewControllerAnimated:YES completion:nil]; } else { [self.navigationController popViewControllerAnimated:YES]; } } - (UIScrollView *)scrollview { if (!_scrollview) { _scrollview = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)]; } return _scrollview; } -(UIView *)logNavView{ IPhoneXHeigh UIView *topView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth, securitytop_Y)]; UIButton *closeBtn = [UIButton buttonWithType:UIButtonTypeCustom]; [closeBtn setImage:[UIImage imageNamed:@"common_close"] forState:UIControlStateNormal]; [closeBtn addTarget:self action:@selector(handle_popEvent:) forControlEvents:UIControlEventTouchUpInside]; closeBtn.frame = CGRectMake(20, 44, 44, 44); [topView addSubview:closeBtn]; UIImageView *headImg = [[UIImageView alloc]init]; UIImage *bannerImg = [UIImage imageNamed:@"common_headLogo"]; headImg.image = bannerImg ; headImg.frame = CGRectMake((KScreenWidth- bannerImg.size.width)/2, 20 , bannerImg.size.width, bannerImg.size.height); [topView addSubview:headImg]; closeBtn.centerY = topView.centerY; headImg.centerY = topView.centerY; return topView; } - (LoginSignUpV *)xxx_signUpV { if (!_xxx_signUpV) { _xxx_signUpV = [[LoginSignUpV alloc] init]; } return _xxx_signUpV; } @end