AS_SignUpC.m 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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 sub_veiwTapBlock];
  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)sub_veiwTapBlock{
  37. @weakify(self)
  38. self.xxx_signUpV.ViewtapClose = ^(NSInteger num, id _Nonnull data) {
  39. @strongify(self)
  40. [self reqNet_singup:(NSDictionary *)data];
  41. };
  42. }
  43. //wm_todo 注册请求修改
  44. -(void)reqNet_singup:(NSDictionary *)dic{
  45. NSString *urlStr = [NSString stringWithFormat:@"%@V1/customers",AS_Server];
  46. [MBProgressHUD showHUDAddedTo:self.view animated:YES];
  47. [PPNetworkHelper POST:urlStr parameters:@{} success:^(id responseObject) {
  48. [MBProgressHUD hideHUDForView:self.view animated:YES];
  49. NSDictionary *tmpDic = responseObject;
  50. @weakify(self)
  51. if([tmpDic[@"status"] intValue] ==1){
  52. [self.view makeToast:@"Register Success" duration:2 position:CSToastPositionCenter title:nil image:nil style:nil completion:^(BOOL didTap) {
  53. @strongify(self)
  54. [self handle_closeEvent:nil];
  55. }];
  56. }else{
  57. [self.view makeToast:MM_str(tmpDic[@"msg"]) duration:2 position:CSToastPositionCenter];
  58. }
  59. } failure:^(NSError *error) {
  60. [MBProgressHUD hideHUDForView:self.view animated:YES];
  61. [self.view makeToast:@"Network request failed" duration:2 position:CSToastPositionCenter];
  62. }];
  63. }
  64. -(void)handle_closeEvent:(UIButton *)btn{
  65. [self.navigationController popViewControllerAnimated:YES];
  66. }
  67. - (UIScrollView *)scrollview {
  68. if (!_scrollview) {
  69. _scrollview = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
  70. }
  71. return _scrollview;
  72. }
  73. -(UIView *)logNavView{
  74. IPhoneXHeigh
  75. UIView *topView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth, securitytop_Y)];
  76. UIButton *closeBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  77. [closeBtn setImage:[UIImage imageNamed:@"common_close"] forState:UIControlStateNormal];
  78. [closeBtn addTarget:self action:@selector(handle_closeEvent:) forControlEvents:UIControlEventTouchUpInside];
  79. closeBtn.frame = CGRectMake(20, 44, 44, 44);
  80. [topView addSubview:closeBtn];
  81. UIImageView *headImg = [[UIImageView alloc]init];
  82. UIImage *bannerImg = [UIImage imageNamed:@"common_headLogo"];
  83. headImg.image = bannerImg ;
  84. headImg.frame = CGRectMake((KScreenWidth- bannerImg.size.width)/2, 20 , bannerImg.size.width, bannerImg.size.height);
  85. [topView addSubview:headImg];
  86. closeBtn.centerY = topView.centerY;
  87. headImg.centerY = topView.centerY;
  88. return topView;
  89. }
  90. - (LoginSignUpV *)xxx_signUpV {
  91. if (!_xxx_signUpV) {
  92. _xxx_signUpV = [[LoginSignUpV alloc] init];
  93. }
  94. return _xxx_signUpV;
  95. }
  96. @end