// // 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 sub_veiwTapBlock]; } - (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]; NSLog(@"------%@",self.xxx_signUpV); } - (void)sub_veiwTapBlock{ @weakify(self) self.xxx_signUpV.ViewtapClose = ^(NSInteger num, id _Nonnull data) { @strongify(self) [self reqNet_singup:(NSDictionary *)data]; }; } //wm_todo 注册请求修改 -(void)reqNet_singup:(NSDictionary *)dic{ NSString *urlStr = [NSString stringWithFormat:@"%@V1/customers",AS_Server]; [MBProgressHUD showHUDAddedTo:self.view animated:YES]; [PPNetworkHelper POST:urlStr parameters:@{} success:^(id responseObject) { [MBProgressHUD hideHUDForView:self.view animated:YES]; NSDictionary *tmpDic = responseObject; @weakify(self) if([tmpDic[@"status"] intValue] ==1){ [self.view makeToast:@"Register Success" duration:2 position:CSToastPositionCenter title:nil image:nil style:nil completion:^(BOOL didTap) { @strongify(self) [self handle_closeEvent:nil]; }]; }else{ [self.view makeToast:MM_str(tmpDic[@"msg"]) duration:2 position:CSToastPositionCenter]; } } failure:^(NSError *error) { [MBProgressHUD hideHUDForView:self.view animated:YES]; [self.view makeToast:@"Network request failed" duration:2 position:CSToastPositionCenter]; }]; } -(void)handle_closeEvent:(UIButton *)btn{ [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_closeEvent:) 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