| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608 |
- //
- // MerchantAdminSetupView.m
- // merchant
- //
- // Created by qitewei on 2025/8/14.
- // Copyright © 2025 xfg. All rights reserved.
- //
- #import "MerchantAdminSetupView.h"
- #import "UIView+Extention.h"
- @implementation MerchantAdminSetupView
- - (instancetype)initWithFrame:(CGRect)frame
- {
- self = [super initWithFrame:frame];
- if (self) {
- [self setupUI];
- [self setupConstraints];
-
- }
- return self;
- }
- - (void)setupUI {
- self.backgroundColor = [UIColor clearColor];
-
- // 添加姓名区域
- [self setupNameSection];
-
- // 添加电话号码区域
- [self setupPhoneSection];
-
- // 添加验证码区域
- [self setupVerifyCodeSection];
-
- // 添加密码区域
- [self setupPasswordSection];
-
- }
- - (void)setupNameSection {
- [self.contentView addSubview:self.nameLabel];
- [self.contentView addSubview:self.nameTextField];
- }
- - (void)setupPhoneSection {
- [self.contentView addSubview:self.phoneLabel];
- [self.contentView addSubview:self.phoneTextField];
- [self.contentView addSubview:self.phoneWarningView];
- [self.phoneWarningView addSubview:self.phoneWarningIcon];
- [self.phoneWarningView addSubview:self.phoneWarningLabel];
- }
- - (void)setupVerifyCodeSection {
- [self.contentView addSubview:self.verifyCodeLabel];
- [self.contentView addSubview:self.verifyCodeContainerView];
- [self.verifyCodeContainerView addSubview:self.verifyCodeTextField];
- [self.verifyCodeContainerView addSubview:self.getVerifyCodeButton];
- }
- - (void)setupPasswordSection {
- [self.contentView addSubview:self.passwordSectionLabel];
- [self.contentView addSubview:self.passwordWarningView];
- [self.passwordWarningView addSubview:self.passwordWarningIcon];
- [self.passwordWarningView addSubview:self.passwordWarningLabel];
-
- [self.contentView addSubview:self.passwordLabel];
- [self.contentView addSubview:self.passwordContainerView];
- [self.passwordContainerView addSubview:self.passwordTextField];
- [self.passwordContainerView addSubview:self.passwordEyeButton];
-
- [self.contentView addSubview:self.confirmPasswordLabel];
- [self.contentView addSubview:self.confirmPasswordContainerView];
- [self.confirmPasswordContainerView addSubview:self.confirmPasswordTextField];
- [self.confirmPasswordContainerView addSubview:self.confirmPasswordEyeButton];
- }
- - (void)setupConstraints {
-
-
- // 姓名
- [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.contentView).offset(kRealValue(24));
- make.top.equalTo(self.contentView).offset(kRealValue(20));
- }];
-
- [self.nameTextField mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.nameLabel);
- make.right.equalTo(self.contentView).offset(-kRealValue(24));
- make.top.equalTo(self.nameLabel.mas_bottom).offset(kRealValue(12));
- make.height.mas_equalTo(kRealValue(48));
- }];
-
- // 电话号码
- [self.phoneLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.nameLabel);
- make.top.equalTo(self.nameTextField.mas_bottom).offset(kRealValue(24));
- }];
-
- [self.phoneTextField mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.phoneLabel);
- make.right.equalTo(self.contentView).offset(-kRealValue(24));
- make.top.equalTo(self.phoneLabel.mas_bottom).offset(kRealValue(12));
- make.height.mas_equalTo(kRealValue(48));
- }];
-
- // 电话号码提示信息
- [self.phoneWarningView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.right.equalTo(self.phoneTextField);
- make.top.equalTo(self.phoneTextField.mas_bottom).offset(kRealValue(8));
- make.height.mas_equalTo(kRealValue(32));
- }];
-
- [self.phoneWarningIcon mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.phoneWarningView).offset(kRealValue(8));
- make.centerY.equalTo(self.phoneWarningView);
- make.size.mas_equalTo(CGSizeMake(kRealValue(14), kRealValue(14)));
- }];
-
- [self.phoneWarningLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.phoneWarningIcon.mas_right).offset(kRealValue(6));
- make.right.equalTo(self.phoneWarningView).offset(-kRealValue(8));
- make.centerY.equalTo(self.phoneWarningView);
- }];
-
- // 验证码
- [self.verifyCodeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.nameLabel);
- make.top.equalTo(self.phoneWarningView.mas_bottom).offset(kRealValue(24));
- }];
-
- [self.verifyCodeContainerView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.verifyCodeLabel);
- make.right.equalTo(self.contentView).offset(-kRealValue(24));
- make.top.equalTo(self.verifyCodeLabel.mas_bottom).offset(kRealValue(12));
- make.height.mas_equalTo(kRealValue(48));
- }];
-
- [self.getVerifyCodeButton mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.equalTo(self.verifyCodeContainerView).offset(-kRealValue(8));
- make.centerY.equalTo(self.verifyCodeContainerView);
- make.width.mas_equalTo(kRealValue(80));
- make.height.mas_equalTo(kRealValue(32));
- }];
-
- [self.verifyCodeTextField mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.verifyCodeContainerView).offset(kRealValue(16));
- make.right.equalTo(self.getVerifyCodeButton.mas_left).offset(-kRealValue(8));
- make.centerY.equalTo(self.verifyCodeContainerView);
- make.height.mas_equalTo(kRealValue(48));
- }];
-
- // PC端商家后台登录密码标题
- [self.passwordSectionLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.nameLabel);
- make.top.equalTo(self.verifyCodeContainerView.mas_bottom).offset(kRealValue(24));
- }];
-
- // 密码提示信息
- [self.passwordWarningView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.nameLabel);
- make.right.equalTo(self.contentView).offset(-kRealValue(24));
- make.top.equalTo(self.passwordSectionLabel.mas_bottom).offset(kRealValue(8));
- make.height.mas_equalTo(kRealValue(32));
- }];
-
- [self.passwordWarningIcon mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.passwordWarningView).offset(kRealValue(8));
- make.centerY.equalTo(self.passwordWarningView);
- make.size.mas_equalTo(CGSizeMake(kRealValue(14), kRealValue(14)));
- }];
-
- [self.passwordWarningLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.passwordWarningIcon.mas_right).offset(kRealValue(6));
- make.right.equalTo(self.passwordWarningView).offset(-kRealValue(8));
- make.centerY.equalTo(self.passwordWarningView);
- }];
-
- // 密码输入框
- [self.passwordLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.nameLabel);
- make.top.equalTo(self.passwordWarningView.mas_bottom).offset(kRealValue(16));
- }];
-
- [self.passwordContainerView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.passwordLabel);
- make.right.equalTo(self.contentView).offset(-kRealValue(24));
- make.top.equalTo(self.passwordLabel.mas_bottom).offset(kRealValue(12));
- make.height.mas_equalTo(kRealValue(48));
- }];
-
- [self.passwordEyeButton mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.equalTo(self.passwordContainerView).offset(-kRealValue(16));
- make.centerY.equalTo(self.passwordContainerView);
- make.size.mas_equalTo(CGSizeMake(kRealValue(20), kRealValue(20)));
- }];
-
- [self.passwordTextField mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.passwordContainerView).offset(kRealValue(16));
- make.right.equalTo(self.passwordEyeButton.mas_left).offset(-kRealValue(8));
- make.centerY.equalTo(self.passwordContainerView);
- make.height.mas_equalTo(kRealValue(48));
- }];
-
- // 确认密码输入框
- [self.confirmPasswordLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.nameLabel);
- make.top.equalTo(self.passwordContainerView.mas_bottom).offset(kRealValue(24));
- }];
-
- [self.confirmPasswordContainerView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.confirmPasswordLabel);
- make.right.equalTo(self.contentView).offset(-kRealValue(24));
- make.top.equalTo(self.confirmPasswordLabel.mas_bottom).offset(kRealValue(12));
- make.height.mas_equalTo(kRealValue(48));
- make.bottom.equalTo(self.contentView).offset(-kRealValue(20));
- }];
-
- [self.confirmPasswordEyeButton mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.equalTo(self.confirmPasswordContainerView).offset(-kRealValue(16));
- make.centerY.equalTo(self.confirmPasswordContainerView);
- make.size.mas_equalTo(CGSizeMake(kRealValue(20), kRealValue(20)));
- }];
-
- [self.confirmPasswordTextField mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.confirmPasswordContainerView).offset(kRealValue(16));
- make.right.equalTo(self.confirmPasswordEyeButton.mas_left).offset(-kRealValue(8));
- make.centerY.equalTo(self.confirmPasswordContainerView);
- make.height.mas_equalTo(kRealValue(48));
- }];
-
- }
- #pragma mark - Actions
- - (void)getVerifyCodeButtonTapped:(UIButton *)sender {
- // TODO: 实现获取验证码功能
- NSLog(@"Get verify code button tapped");
-
- // 简单的倒计时效果
- sender.enabled = NO;
- [sender setTitle:ASLocalizedString(@"60s后重试") forState:UIControlStateDisabled];
- [sender setTitleColor:[UIColor grayColor] forState:UIControlStateDisabled];
-
- dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(60 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
- sender.enabled = YES;
- [sender setTitle:ASLocalizedString(@"获取验证码") forState:UIControlStateNormal];
- });
- }
- - (void)passwordEyeButtonTapped:(UIButton *)sender {
- self.passwordTextField.secureTextEntry = !self.passwordTextField.secureTextEntry;
- UIImage *eyeImage = self.passwordTextField.secureTextEntry ?
- [UIImage imageNamed:@"icon_eye_close"] : [UIImage imageNamed:@"icon_eye_open"];
- if (!eyeImage) {
- // 使用系统图标作为降级方案
- if (@available(iOS 13.0, *)) {
- eyeImage = self.passwordTextField.secureTextEntry ?
- [UIImage systemImageNamed:@"eye.slash"] : [UIImage systemImageNamed:@"eye"];
- }
- }
- [sender setImage:eyeImage forState:UIControlStateNormal];
- }
- - (void)confirmPasswordEyeButtonTapped:(UIButton *)sender {
- self.confirmPasswordTextField.secureTextEntry = !self.confirmPasswordTextField.secureTextEntry;
- UIImage *eyeImage = self.confirmPasswordTextField.secureTextEntry ?
- [UIImage imageNamed:@"icon_eye_close"] : [UIImage imageNamed:@"icon_eye_open"];
- if (!eyeImage) {
- // 使用系统图标作为降级方案
- if (@available(iOS 13.0, *)) {
- eyeImage = self.confirmPasswordTextField.secureTextEntry ?
- [UIImage systemImageNamed:@"eye.slash"] : [UIImage systemImageNamed:@"eye"];
- }
- }
- [sender setImage:eyeImage forState:UIControlStateNormal];
- }
- #pragma mark - Lazy Loading
- - (UILabel *)nameLabel {
- if (!_nameLabel) {
- _nameLabel = [[UILabel alloc] init];
- _nameLabel.text = ASLocalizedString(@"姓名");
- _nameLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightMedium];
- _nameLabel.textColor = [UIColor blackColor];
-
- // 添加红色星号
- NSMutableAttributedString *attributedText = [[NSMutableAttributedString alloc] initWithString:_nameLabel.text];
- NSAttributedString *redStar = [[NSAttributedString alloc] initWithString:@" *" attributes:@{
- NSForegroundColorAttributeName: [UIColor redColor],
- NSFontAttributeName: [UIFont systemFontOfSize:16 weight:UIFontWeightMedium]
- }];
- [attributedText appendAttributedString:redStar];
- _nameLabel.attributedText = attributedText;
- }
- return _nameLabel;
- }
- - (UITextField *)nameTextField {
- if (!_nameTextField) {
- _nameTextField = [[UITextField alloc] init];
- _nameTextField.placeholder = ASLocalizedString(@"请输入管理员姓名");
- _nameTextField.font = [UIFont systemFontOfSize:16];
- _nameTextField.textColor = [UIColor blackColor];
- _nameTextField.backgroundColor = [UIColor whiteColor];
- _nameTextField.layer.cornerRadius = kRealValue(8);
- _nameTextField.layer.borderWidth = 1;
- _nameTextField.layer.borderColor = [UIColor colorWithHexString:@"#E5E5E5"].CGColor;
-
- // 设置内边距
- UIView *leftView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kRealValue(16), kRealValue(48))];
- _nameTextField.leftView = leftView;
- _nameTextField.leftViewMode = UITextFieldViewModeAlways;
-
- UIView *rightView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kRealValue(16), kRealValue(48))];
- _nameTextField.rightView = rightView;
- _nameTextField.rightViewMode = UITextFieldViewModeAlways;
- }
- return _nameTextField;
- }
- - (UILabel *)phoneLabel {
- if (!_phoneLabel) {
- _phoneLabel = [[UILabel alloc] init];
- _phoneLabel.text = ASLocalizedString(@"电话号码");
- _phoneLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightMedium];
- _phoneLabel.textColor = [UIColor blackColor];
-
- // 添加红色星号
- NSMutableAttributedString *attributedText = [[NSMutableAttributedString alloc] initWithString:_phoneLabel.text];
- NSAttributedString *redStar = [[NSAttributedString alloc] initWithString:@" *" attributes:@{
- NSForegroundColorAttributeName: [UIColor redColor],
- NSFontAttributeName: [UIFont systemFontOfSize:16 weight:UIFontWeightMedium]
- }];
- [attributedText appendAttributedString:redStar];
- _phoneLabel.attributedText = attributedText;
- }
- return _phoneLabel;
- }
- - (UITextField *)phoneTextField {
- if (!_phoneTextField) {
- _phoneTextField = [[UITextField alloc] init];
- _phoneTextField.placeholder = ASLocalizedString(@"请输入管理员电话号码");
- _phoneTextField.font = [UIFont systemFontOfSize:16];
- _phoneTextField.textColor = [UIColor blackColor];
- _phoneTextField.backgroundColor = [UIColor whiteColor];
- _phoneTextField.layer.cornerRadius = kRealValue(8);
- _phoneTextField.layer.borderWidth = 1;
- _phoneTextField.layer.borderColor = [UIColor colorWithHexString:@"#E5E5E5"].CGColor;
- _phoneTextField.keyboardType = UIKeyboardTypePhonePad;
-
- // 设置内边距
- UIView *leftView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kRealValue(16), kRealValue(48))];
- _phoneTextField.leftView = leftView;
- _phoneTextField.leftViewMode = UITextFieldViewModeAlways;
-
- UIView *rightView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kRealValue(16), kRealValue(48))];
- _phoneTextField.rightView = rightView;
- _phoneTextField.rightViewMode = UITextFieldViewModeAlways;
- }
- return _phoneTextField;
- }
- - (UIView *)phoneWarningView {
- if (!_phoneWarningView) {
- _phoneWarningView = [[UIView alloc] init];
- _phoneWarningView.backgroundColor = [UIColor colorWithHexString:@"#FFF8E1"];
- _phoneWarningView.layer.cornerRadius = kRealValue(6);
- }
- return _phoneWarningView;
- }
- - (UIImageView *)phoneWarningIcon {
- if (!_phoneWarningIcon) {
- _phoneWarningIcon = [[UIImageView alloc] init];
- UIImage *warningImage = [UIImage imageNamed:@"store_bank_tips"];
- if (!warningImage) {
- if (@available(iOS 13.0, *)) {
- warningImage = [UIImage systemImageNamed:@"info.circle.fill"];
- }
- }
- _phoneWarningIcon.image = warningImage;
- _phoneWarningIcon.contentMode = UIViewContentModeScaleAspectFit;
- _phoneWarningIcon.tintColor = [UIColor colorWithHexString:@"#F57C00"];
- }
- return _phoneWarningIcon;
- }
- - (UILabel *)phoneWarningLabel {
- if (!_phoneWarningLabel) {
- _phoneWarningLabel = [[UILabel alloc] init];
- _phoneWarningLabel.text = ASLocalizedString(@"此电话默认为PC端商家后台管理登录账号");
- _phoneWarningLabel.font = [UIFont systemFontOfSize:11];
- _phoneWarningLabel.textColor = [UIColor colorWithHexString:@"#F57C00"];
- _phoneWarningLabel.numberOfLines = 0;
- }
- return _phoneWarningLabel;
- }
- - (UILabel *)verifyCodeLabel {
- if (!_verifyCodeLabel) {
- _verifyCodeLabel = [[UILabel alloc] init];
- _verifyCodeLabel.text = ASLocalizedString(@"验证码");
- _verifyCodeLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightMedium];
- _verifyCodeLabel.textColor = [UIColor blackColor];
-
- // 添加红色星号
- NSMutableAttributedString *attributedText = [[NSMutableAttributedString alloc] initWithString:_verifyCodeLabel.text];
- NSAttributedString *redStar = [[NSAttributedString alloc] initWithString:@" *" attributes:@{
- NSForegroundColorAttributeName: [UIColor redColor],
- NSFontAttributeName: [UIFont systemFontOfSize:16 weight:UIFontWeightMedium]
- }];
- [attributedText appendAttributedString:redStar];
- _verifyCodeLabel.attributedText = attributedText;
- }
- return _verifyCodeLabel;
- }
- - (UIView *)verifyCodeContainerView {
- if (!_verifyCodeContainerView) {
- _verifyCodeContainerView = [[UIView alloc] init];
- _verifyCodeContainerView.backgroundColor = [UIColor whiteColor];
- _verifyCodeContainerView.layer.cornerRadius = kRealValue(8);
- _verifyCodeContainerView.layer.borderWidth = 1;
- _verifyCodeContainerView.layer.borderColor = [UIColor colorWithHexString:@"#E5E5E5"].CGColor;
- }
- return _verifyCodeContainerView;
- }
- - (UITextField *)verifyCodeTextField {
- if (!_verifyCodeTextField) {
- _verifyCodeTextField = [[UITextField alloc] init];
- _verifyCodeTextField.placeholder = ASLocalizedString(@"请输入验证码");
- _verifyCodeTextField.font = [UIFont systemFontOfSize:16];
- _verifyCodeTextField.textColor = [UIColor blackColor];
- _verifyCodeTextField.backgroundColor = [UIColor clearColor];
- _verifyCodeTextField.keyboardType = UIKeyboardTypeNumberPad;
- _verifyCodeTextField.borderStyle = UITextBorderStyleNone;
- }
- return _verifyCodeTextField;
- }
- - (UIButton *)getVerifyCodeButton {
- if (!_getVerifyCodeButton) {
- _getVerifyCodeButton = [UIButton buttonWithType:UIButtonTypeCustom];
- [_getVerifyCodeButton setTitle:ASLocalizedString(@"获取验证码") forState:UIControlStateNormal];
- [_getVerifyCodeButton setTitleColor:[UIColor colorWithHexString:@"#1A65FF"] forState:UIControlStateNormal];
- _getVerifyCodeButton.titleLabel.font = [UIFont systemFontOfSize:12];
- _getVerifyCodeButton.backgroundColor = [UIColor clearColor];
- _getVerifyCodeButton.layer.cornerRadius = kRealValue(4);
- _getVerifyCodeButton.layer.borderWidth = 1;
- _getVerifyCodeButton.layer.borderColor = [UIColor colorWithHexString:@"#1A65FF"].CGColor;
- [_getVerifyCodeButton addTarget:self action:@selector(getVerifyCodeButtonTapped:) forControlEvents:UIControlEventTouchUpInside];
- }
- return _getVerifyCodeButton;
- }
- - (UILabel *)passwordSectionLabel {
- if (!_passwordSectionLabel) {
- _passwordSectionLabel = [[UILabel alloc] init];
- _passwordSectionLabel.text = ASLocalizedString(@"PC端商家后台登录密码");
- _passwordSectionLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightMedium];
- _passwordSectionLabel.textColor = [UIColor blackColor];
-
- // 添加红色星号
- NSMutableAttributedString *attributedText = [[NSMutableAttributedString alloc] initWithString:_passwordSectionLabel.text];
- NSAttributedString *redStar = [[NSAttributedString alloc] initWithString:@" *" attributes:@{
- NSForegroundColorAttributeName: [UIColor redColor],
- NSFontAttributeName: [UIFont systemFontOfSize:16 weight:UIFontWeightMedium]
- }];
- [attributedText appendAttributedString:redStar];
- _passwordSectionLabel.attributedText = attributedText;
- }
- return _passwordSectionLabel;
- }
- - (UIView *)passwordWarningView {
- if (!_passwordWarningView) {
- _passwordWarningView = [[UIView alloc] init];
- _passwordWarningView.backgroundColor = [UIColor colorWithHexString:@"#FFF8E1"];
- _passwordWarningView.layer.cornerRadius = kRealValue(6);
- }
- return _passwordWarningView;
- }
- - (UIImageView *)passwordWarningIcon {
- if (!_passwordWarningIcon) {
- _passwordWarningIcon = [[UIImageView alloc] init];
- UIImage *warningImage = [UIImage imageNamed:@"store_bank_tips"];
- if (!warningImage) {
- if (@available(iOS 13.0, *)) {
- warningImage = [UIImage systemImageNamed:@"info.circle.fill"];
- }
- }
- _passwordWarningIcon.image = warningImage;
- _passwordWarningIcon.contentMode = UIViewContentModeScaleAspectFit;
- _passwordWarningIcon.tintColor = [UIColor colorWithHexString:@"#F57C00"];
- }
- return _passwordWarningIcon;
- }
- - (UILabel *)passwordWarningLabel {
- if (!_passwordWarningLabel) {
- _passwordWarningLabel = [[UILabel alloc] init];
- _passwordWarningLabel.text = ASLocalizedString(@"请牢记此密码,用于PC端商家后台管理登录");
- _passwordWarningLabel.font = [UIFont systemFontOfSize:11];
- _passwordWarningLabel.textColor = [UIColor colorWithHexString:@"#F57C00"];
- _passwordWarningLabel.numberOfLines = 0;
- }
- return _passwordWarningLabel;
- }
- - (UILabel *)passwordLabel {
- if (!_passwordLabel) {
- _passwordLabel = [[UILabel alloc] init];
- _passwordLabel.text = ASLocalizedString(@"请输入密码");
- _passwordLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightMedium];
- _passwordLabel.textColor = [UIColor blackColor];
- }
- return _passwordLabel;
- }
- - (UIView *)passwordContainerView {
- if (!_passwordContainerView) {
- _passwordContainerView = [[UIView alloc] init];
- _passwordContainerView.backgroundColor = [UIColor whiteColor];
- _passwordContainerView.layer.cornerRadius = kRealValue(8);
- _passwordContainerView.layer.borderWidth = 1;
- _passwordContainerView.layer.borderColor = [UIColor colorWithHexString:@"#E5E5E5"].CGColor;
- }
- return _passwordContainerView;
- }
- - (UITextField *)passwordTextField {
- if (!_passwordTextField) {
- _passwordTextField = [[UITextField alloc] init];
- _passwordTextField.placeholder = ASLocalizedString(@"请输入密码");
- _passwordTextField.font = [UIFont systemFontOfSize:16];
- _passwordTextField.textColor = [UIColor blackColor];
- _passwordTextField.backgroundColor = [UIColor clearColor];
- _passwordTextField.secureTextEntry = YES;
- _passwordTextField.borderStyle = UITextBorderStyleNone;
- }
- return _passwordTextField;
- }
- - (UIButton *)passwordEyeButton {
- if (!_passwordEyeButton) {
- _passwordEyeButton = [UIButton buttonWithType:UIButtonTypeCustom];
- UIImage *eyeImage = [UIImage imageNamed:@"store_password4"];
- [_passwordEyeButton setImage:eyeImage forState:UIControlStateNormal];
- _passwordEyeButton.tintColor = [UIColor grayColor];
- [_passwordEyeButton addTarget:self action:@selector(passwordEyeButtonTapped:) forControlEvents:UIControlEventTouchUpInside];
- }
- return _passwordEyeButton;
- }
- - (UILabel *)confirmPasswordLabel {
- if (!_confirmPasswordLabel) {
- _confirmPasswordLabel = [[UILabel alloc] init];
- _confirmPasswordLabel.text = ASLocalizedString(@"再次输入密码");
- _confirmPasswordLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightMedium];
- _confirmPasswordLabel.textColor = [UIColor blackColor];
- }
- return _confirmPasswordLabel;
- }
- - (UIView *)confirmPasswordContainerView {
- if (!_confirmPasswordContainerView) {
- _confirmPasswordContainerView = [[UIView alloc] init];
- _confirmPasswordContainerView.backgroundColor = [UIColor whiteColor];
- _confirmPasswordContainerView.layer.cornerRadius = kRealValue(8);
- _confirmPasswordContainerView.layer.borderWidth = 1;
- _confirmPasswordContainerView.layer.borderColor = [UIColor colorWithHexString:@"#E5E5E5"].CGColor;
- }
- return _confirmPasswordContainerView;
- }
- - (UITextField *)confirmPasswordTextField {
- if (!_confirmPasswordTextField) {
- _confirmPasswordTextField = [[UITextField alloc] init];
- _confirmPasswordTextField.placeholder = ASLocalizedString(@"再次输入密码");
- _confirmPasswordTextField.font = [UIFont systemFontOfSize:16];
- _confirmPasswordTextField.textColor = [UIColor blackColor];
- _confirmPasswordTextField.backgroundColor = [UIColor clearColor];
- _confirmPasswordTextField.secureTextEntry = YES;
- _confirmPasswordTextField.borderStyle = UITextBorderStyleNone;
- }
- return _confirmPasswordTextField;
- }
- - (UIButton *)confirmPasswordEyeButton {
- if (!_confirmPasswordEyeButton) {
- _confirmPasswordEyeButton = [UIButton buttonWithType:UIButtonTypeCustom];
- UIImage *eyeImage = [UIImage imageNamed:@"store_password4"];
- [_confirmPasswordEyeButton setImage:eyeImage forState:UIControlStateNormal];
- _confirmPasswordEyeButton.tintColor = [UIColor grayColor];
- [_confirmPasswordEyeButton addTarget:self action:@selector(confirmPasswordEyeButtonTapped:) forControlEvents:UIControlEventTouchUpInside];
- }
- return _confirmPasswordEyeButton;
- }
- @end
|