HJAuthView.m 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. //
  2. // HJAuthView.m
  3. // HappyJob
  4. //
  5. // Created by 张晓光 on 2021/6/4.
  6. // Copyright © 2021 Bob. All rights reserved.
  7. //
  8. #import "HJAuthView.h"
  9. @implementation HJAuthView
  10. - (instancetype)initWithFrame:(CGRect)frame {
  11. if (self = [super initWithFrame:frame])
  12. {
  13. self.backgroundColor = COLOR_F5F5F5;
  14. [self makeConstraints];
  15. }
  16. return self;
  17. }
  18. #pragma mark -- 布局
  19. - (void)makeConstraints {
  20. [self addSubview:self.topView];
  21. [self.topView addSubview:self.promptLabel];
  22. [self.topView addSubview:self.cardPositiveView];
  23. [self.topView addSubview:self.cardReverseView];
  24. [self addSubview:self.nameView];
  25. [self addSubview:self.IDView];
  26. [self addSubview:self.bottomView];
  27. [self.bottomView addSubview:self.applyButton];
  28. [self.topView mas_makeConstraints:^(MASConstraintMaker *make) {
  29. make.left.top.right.equalTo(self).offset(0);
  30. }];
  31. [self.promptLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  32. make.left.top.right.equalTo(self.topView).offset(0);
  33. make.height.mas_equalTo(40);
  34. }];
  35. NSArray *IDArray = @[self.cardPositiveView,self.cardReverseView];
  36. [IDArray mas_distributeViewsAlongAxis:MASAxisTypeHorizontal withFixedSpacing:25 leadSpacing:15 tailSpacing:15];
  37. [IDArray mas_makeConstraints:^(MASConstraintMaker *make) {
  38. make.top.equalTo(self.promptLabel.mas_bottom).offset(28);
  39. make.bottom.equalTo(self.topView.mas_bottom).offset(-28);
  40. }];
  41. [self.nameView mas_makeConstraints:^(MASConstraintMaker *make) {
  42. make.left.right.equalTo(self).offset(0);
  43. make.top.equalTo(self.topView.mas_bottom).offset(10);
  44. make.height.mas_equalTo(60);
  45. }];
  46. [self.IDView mas_makeConstraints:^(MASConstraintMaker *make) {
  47. make.left.right.equalTo(self).offset(0);
  48. make.top.equalTo(self.nameView.mas_bottom).offset(0);
  49. make.height.mas_equalTo(60);
  50. }];
  51. [self.bottomView mas_makeConstraints:^(MASConstraintMaker *make) {
  52. make.left.bottom.right.equalTo(self).offset(0);
  53. make.height.mas_equalTo(64);
  54. }];
  55. [self.applyButton mas_makeConstraints:^(MASConstraintMaker *make) {
  56. make.centerY.equalTo(self.bottomView);
  57. make.left.equalTo(self.bottomView).offset(15);
  58. make.right.equalTo(self.bottomView).offset(-15);
  59. make.height.mas_equalTo(44);
  60. }];
  61. self.IDView.hidden = YES;
  62. self.nameView.hidden = YES;
  63. }
  64. #pragma mark -- lazy
  65. - (UIView *)topView {
  66. if (_topView == nil)
  67. {
  68. _topView = [[UIView alloc] init];
  69. _topView.backgroundColor = [UIColor whiteColor];
  70. }
  71. return _topView;
  72. }
  73. - (UILabel *)promptLabel {
  74. if (_promptLabel == nil)
  75. {
  76. _promptLabel = [[UILabel alloc] init];
  77. _promptLabel.text = @"为了您的账户及资金安全,请上传本人真实身份证照片!";
  78. _promptLabel.font = [UIFont systemFontOfSize:13];
  79. _promptLabel.textColor = [UIColor colorFromHexString:@"FF6300"];
  80. _promptLabel.backgroundColor = [UIColor colorFromHexString:@"FFEBE3"];
  81. _promptLabel.textAlignment = NSTextAlignmentCenter;
  82. }
  83. return _promptLabel;
  84. }
  85. - (HJLabelTextFieldView *)nameView {
  86. if (_nameView == nil)
  87. {
  88. _nameView = [[HJLabelTextFieldView alloc] init];
  89. _nameView.titleLabel.text = @"姓名:";
  90. _nameView.contentTextField.placeholder = @"请输入真实姓名";
  91. _nameView.hiddenRightImageV = YES;
  92. _nameView.contentTextField.userInteractionEnabled = NO;
  93. _nameView.contentTextField.textColor = [UIColor colorFromHexString:@"AAAAAA"];
  94. }
  95. return _nameView;
  96. }
  97. - (HJLabelTextFieldView *)IDView {
  98. if (_IDView == nil)
  99. {
  100. _IDView = [[HJLabelTextFieldView alloc] init];
  101. _IDView.titleLabel.text = @"证件号码:";
  102. _IDView.contentTextField.placeholder = @"请输入证件号码";
  103. _IDView.hiddenRightImageV = YES;
  104. _IDView.contentTextField.userInteractionEnabled = NO;
  105. _IDView.contentTextField.textColor = [UIColor colorFromHexString:@"AAAAAA"];
  106. }
  107. return _IDView;
  108. }
  109. - (HJAuthUploadImageView *)cardPositiveView {
  110. if (_cardPositiveView == nil)
  111. {
  112. _cardPositiveView = [[HJAuthUploadImageView alloc] init];
  113. _cardPositiveView.pictureImageV.image = [UIImage imageNamed:@"auth_card_foreground"];
  114. [_cardPositiveView.titleLabel setTitle:@"身份证正面" forState:UIControlStateNormal];
  115. }
  116. return _cardPositiveView;
  117. }
  118. - (HJAuthUploadImageView *)cardReverseView {
  119. if (_cardReverseView == nil)
  120. {
  121. _cardReverseView = [[HJAuthUploadImageView alloc] init];
  122. _cardReverseView.pictureImageV.image = [UIImage imageNamed:@"auth_card_background"];
  123. [_cardReverseView.titleLabel setTitle:@"身份证背面" forState:UIControlStateNormal];
  124. }
  125. return _cardReverseView;
  126. }
  127. - (UIView *)bottomView {
  128. if (_bottomView == nil)
  129. {
  130. _bottomView = [[UIView alloc] init];
  131. _bottomView.backgroundColor = [UIColor whiteColor];
  132. }
  133. return _bottomView;
  134. }
  135. - (UIButton *)applyButton {
  136. if (_applyButton == nil)
  137. {
  138. _applyButton = [UIButton buttonWithType:UIButtonTypeCustom];
  139. [_applyButton setTitle:@"提交认证" forState:UIControlStateNormal];
  140. _applyButton.titleLabel.font = [UIFont boldSystemFontOfSize:17];
  141. // _applyButton.userInteractionEnabled = NO;
  142. _applyButton.backgroundColor = [UIColor colorFromHexString:@"0177FF" Alpha:0.5];
  143. _applyButton.layer.cornerRadius = 5;
  144. _applyButton.layer.masksToBounds = YES;
  145. }
  146. return _applyButton;
  147. }
  148. @end