MerchantAdminSetupView.m 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608
  1. //
  2. // MerchantAdminSetupView.m
  3. // merchant
  4. //
  5. // Created by qitewei on 2025/8/14.
  6. // Copyright © 2025 xfg. All rights reserved.
  7. //
  8. #import "MerchantAdminSetupView.h"
  9. #import "UIView+Extention.h"
  10. @implementation MerchantAdminSetupView
  11. - (instancetype)initWithFrame:(CGRect)frame
  12. {
  13. self = [super initWithFrame:frame];
  14. if (self) {
  15. [self setupUI];
  16. [self setupConstraints];
  17. }
  18. return self;
  19. }
  20. - (void)setupUI {
  21. self.backgroundColor = [UIColor clearColor];
  22. // 添加姓名区域
  23. [self setupNameSection];
  24. // 添加电话号码区域
  25. [self setupPhoneSection];
  26. // 添加验证码区域
  27. [self setupVerifyCodeSection];
  28. // 添加密码区域
  29. [self setupPasswordSection];
  30. }
  31. - (void)setupNameSection {
  32. [self.contentView addSubview:self.nameLabel];
  33. [self.contentView addSubview:self.nameTextField];
  34. }
  35. - (void)setupPhoneSection {
  36. [self.contentView addSubview:self.phoneLabel];
  37. [self.contentView addSubview:self.phoneTextField];
  38. [self.contentView addSubview:self.phoneWarningView];
  39. [self.phoneWarningView addSubview:self.phoneWarningIcon];
  40. [self.phoneWarningView addSubview:self.phoneWarningLabel];
  41. }
  42. - (void)setupVerifyCodeSection {
  43. [self.contentView addSubview:self.verifyCodeLabel];
  44. [self.contentView addSubview:self.verifyCodeContainerView];
  45. [self.verifyCodeContainerView addSubview:self.verifyCodeTextField];
  46. [self.verifyCodeContainerView addSubview:self.getVerifyCodeButton];
  47. }
  48. - (void)setupPasswordSection {
  49. [self.contentView addSubview:self.passwordSectionLabel];
  50. [self.contentView addSubview:self.passwordWarningView];
  51. [self.passwordWarningView addSubview:self.passwordWarningIcon];
  52. [self.passwordWarningView addSubview:self.passwordWarningLabel];
  53. [self.contentView addSubview:self.passwordLabel];
  54. [self.contentView addSubview:self.passwordContainerView];
  55. [self.passwordContainerView addSubview:self.passwordTextField];
  56. [self.passwordContainerView addSubview:self.passwordEyeButton];
  57. [self.contentView addSubview:self.confirmPasswordLabel];
  58. [self.contentView addSubview:self.confirmPasswordContainerView];
  59. [self.confirmPasswordContainerView addSubview:self.confirmPasswordTextField];
  60. [self.confirmPasswordContainerView addSubview:self.confirmPasswordEyeButton];
  61. }
  62. - (void)setupConstraints {
  63. // 姓名
  64. [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  65. make.left.equalTo(self.contentView).offset(kRealValue(24));
  66. make.top.equalTo(self.contentView).offset(kRealValue(20));
  67. }];
  68. [self.nameTextField mas_makeConstraints:^(MASConstraintMaker *make) {
  69. make.left.equalTo(self.nameLabel);
  70. make.right.equalTo(self.contentView).offset(-kRealValue(24));
  71. make.top.equalTo(self.nameLabel.mas_bottom).offset(kRealValue(12));
  72. make.height.mas_equalTo(kRealValue(48));
  73. }];
  74. // 电话号码
  75. [self.phoneLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  76. make.left.equalTo(self.nameLabel);
  77. make.top.equalTo(self.nameTextField.mas_bottom).offset(kRealValue(24));
  78. }];
  79. [self.phoneTextField mas_makeConstraints:^(MASConstraintMaker *make) {
  80. make.left.equalTo(self.phoneLabel);
  81. make.right.equalTo(self.contentView).offset(-kRealValue(24));
  82. make.top.equalTo(self.phoneLabel.mas_bottom).offset(kRealValue(12));
  83. make.height.mas_equalTo(kRealValue(48));
  84. }];
  85. // 电话号码提示信息
  86. [self.phoneWarningView mas_makeConstraints:^(MASConstraintMaker *make) {
  87. make.left.right.equalTo(self.phoneTextField);
  88. make.top.equalTo(self.phoneTextField.mas_bottom).offset(kRealValue(8));
  89. make.height.mas_equalTo(kRealValue(32));
  90. }];
  91. [self.phoneWarningIcon mas_makeConstraints:^(MASConstraintMaker *make) {
  92. make.left.equalTo(self.phoneWarningView).offset(kRealValue(8));
  93. make.centerY.equalTo(self.phoneWarningView);
  94. make.size.mas_equalTo(CGSizeMake(kRealValue(14), kRealValue(14)));
  95. }];
  96. [self.phoneWarningLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  97. make.left.equalTo(self.phoneWarningIcon.mas_right).offset(kRealValue(6));
  98. make.right.equalTo(self.phoneWarningView).offset(-kRealValue(8));
  99. make.centerY.equalTo(self.phoneWarningView);
  100. }];
  101. // 验证码
  102. [self.verifyCodeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  103. make.left.equalTo(self.nameLabel);
  104. make.top.equalTo(self.phoneWarningView.mas_bottom).offset(kRealValue(24));
  105. }];
  106. [self.verifyCodeContainerView mas_makeConstraints:^(MASConstraintMaker *make) {
  107. make.left.equalTo(self.verifyCodeLabel);
  108. make.right.equalTo(self.contentView).offset(-kRealValue(24));
  109. make.top.equalTo(self.verifyCodeLabel.mas_bottom).offset(kRealValue(12));
  110. make.height.mas_equalTo(kRealValue(48));
  111. }];
  112. [self.getVerifyCodeButton mas_makeConstraints:^(MASConstraintMaker *make) {
  113. make.right.equalTo(self.verifyCodeContainerView).offset(-kRealValue(8));
  114. make.centerY.equalTo(self.verifyCodeContainerView);
  115. make.width.mas_equalTo(kRealValue(80));
  116. make.height.mas_equalTo(kRealValue(32));
  117. }];
  118. [self.verifyCodeTextField mas_makeConstraints:^(MASConstraintMaker *make) {
  119. make.left.equalTo(self.verifyCodeContainerView).offset(kRealValue(16));
  120. make.right.equalTo(self.getVerifyCodeButton.mas_left).offset(-kRealValue(8));
  121. make.centerY.equalTo(self.verifyCodeContainerView);
  122. make.height.mas_equalTo(kRealValue(48));
  123. }];
  124. // PC端商家后台登录密码标题
  125. [self.passwordSectionLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  126. make.left.equalTo(self.nameLabel);
  127. make.top.equalTo(self.verifyCodeContainerView.mas_bottom).offset(kRealValue(24));
  128. }];
  129. // 密码提示信息
  130. [self.passwordWarningView mas_makeConstraints:^(MASConstraintMaker *make) {
  131. make.left.equalTo(self.nameLabel);
  132. make.right.equalTo(self.contentView).offset(-kRealValue(24));
  133. make.top.equalTo(self.passwordSectionLabel.mas_bottom).offset(kRealValue(8));
  134. make.height.mas_equalTo(kRealValue(32));
  135. }];
  136. [self.passwordWarningIcon mas_makeConstraints:^(MASConstraintMaker *make) {
  137. make.left.equalTo(self.passwordWarningView).offset(kRealValue(8));
  138. make.centerY.equalTo(self.passwordWarningView);
  139. make.size.mas_equalTo(CGSizeMake(kRealValue(14), kRealValue(14)));
  140. }];
  141. [self.passwordWarningLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  142. make.left.equalTo(self.passwordWarningIcon.mas_right).offset(kRealValue(6));
  143. make.right.equalTo(self.passwordWarningView).offset(-kRealValue(8));
  144. make.centerY.equalTo(self.passwordWarningView);
  145. }];
  146. // 密码输入框
  147. [self.passwordLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  148. make.left.equalTo(self.nameLabel);
  149. make.top.equalTo(self.passwordWarningView.mas_bottom).offset(kRealValue(16));
  150. }];
  151. [self.passwordContainerView mas_makeConstraints:^(MASConstraintMaker *make) {
  152. make.left.equalTo(self.passwordLabel);
  153. make.right.equalTo(self.contentView).offset(-kRealValue(24));
  154. make.top.equalTo(self.passwordLabel.mas_bottom).offset(kRealValue(12));
  155. make.height.mas_equalTo(kRealValue(48));
  156. }];
  157. [self.passwordEyeButton mas_makeConstraints:^(MASConstraintMaker *make) {
  158. make.right.equalTo(self.passwordContainerView).offset(-kRealValue(16));
  159. make.centerY.equalTo(self.passwordContainerView);
  160. make.size.mas_equalTo(CGSizeMake(kRealValue(20), kRealValue(20)));
  161. }];
  162. [self.passwordTextField mas_makeConstraints:^(MASConstraintMaker *make) {
  163. make.left.equalTo(self.passwordContainerView).offset(kRealValue(16));
  164. make.right.equalTo(self.passwordEyeButton.mas_left).offset(-kRealValue(8));
  165. make.centerY.equalTo(self.passwordContainerView);
  166. make.height.mas_equalTo(kRealValue(48));
  167. }];
  168. // 确认密码输入框
  169. [self.confirmPasswordLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  170. make.left.equalTo(self.nameLabel);
  171. make.top.equalTo(self.passwordContainerView.mas_bottom).offset(kRealValue(24));
  172. }];
  173. [self.confirmPasswordContainerView mas_makeConstraints:^(MASConstraintMaker *make) {
  174. make.left.equalTo(self.confirmPasswordLabel);
  175. make.right.equalTo(self.contentView).offset(-kRealValue(24));
  176. make.top.equalTo(self.confirmPasswordLabel.mas_bottom).offset(kRealValue(12));
  177. make.height.mas_equalTo(kRealValue(48));
  178. make.bottom.equalTo(self.contentView).offset(-kRealValue(20));
  179. }];
  180. [self.confirmPasswordEyeButton mas_makeConstraints:^(MASConstraintMaker *make) {
  181. make.right.equalTo(self.confirmPasswordContainerView).offset(-kRealValue(16));
  182. make.centerY.equalTo(self.confirmPasswordContainerView);
  183. make.size.mas_equalTo(CGSizeMake(kRealValue(20), kRealValue(20)));
  184. }];
  185. [self.confirmPasswordTextField mas_makeConstraints:^(MASConstraintMaker *make) {
  186. make.left.equalTo(self.confirmPasswordContainerView).offset(kRealValue(16));
  187. make.right.equalTo(self.confirmPasswordEyeButton.mas_left).offset(-kRealValue(8));
  188. make.centerY.equalTo(self.confirmPasswordContainerView);
  189. make.height.mas_equalTo(kRealValue(48));
  190. }];
  191. }
  192. #pragma mark - Actions
  193. - (void)getVerifyCodeButtonTapped:(UIButton *)sender {
  194. // TODO: 实现获取验证码功能
  195. NSLog(@"Get verify code button tapped");
  196. // 简单的倒计时效果
  197. sender.enabled = NO;
  198. [sender setTitle:ASLocalizedString(@"60s后重试") forState:UIControlStateDisabled];
  199. [sender setTitleColor:[UIColor grayColor] forState:UIControlStateDisabled];
  200. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(60 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  201. sender.enabled = YES;
  202. [sender setTitle:ASLocalizedString(@"获取验证码") forState:UIControlStateNormal];
  203. });
  204. }
  205. - (void)passwordEyeButtonTapped:(UIButton *)sender {
  206. self.passwordTextField.secureTextEntry = !self.passwordTextField.secureTextEntry;
  207. UIImage *eyeImage = self.passwordTextField.secureTextEntry ?
  208. [UIImage imageNamed:@"icon_eye_close"] : [UIImage imageNamed:@"icon_eye_open"];
  209. if (!eyeImage) {
  210. // 使用系统图标作为降级方案
  211. if (@available(iOS 13.0, *)) {
  212. eyeImage = self.passwordTextField.secureTextEntry ?
  213. [UIImage systemImageNamed:@"eye.slash"] : [UIImage systemImageNamed:@"eye"];
  214. }
  215. }
  216. [sender setImage:eyeImage forState:UIControlStateNormal];
  217. }
  218. - (void)confirmPasswordEyeButtonTapped:(UIButton *)sender {
  219. self.confirmPasswordTextField.secureTextEntry = !self.confirmPasswordTextField.secureTextEntry;
  220. UIImage *eyeImage = self.confirmPasswordTextField.secureTextEntry ?
  221. [UIImage imageNamed:@"icon_eye_close"] : [UIImage imageNamed:@"icon_eye_open"];
  222. if (!eyeImage) {
  223. // 使用系统图标作为降级方案
  224. if (@available(iOS 13.0, *)) {
  225. eyeImage = self.confirmPasswordTextField.secureTextEntry ?
  226. [UIImage systemImageNamed:@"eye.slash"] : [UIImage systemImageNamed:@"eye"];
  227. }
  228. }
  229. [sender setImage:eyeImage forState:UIControlStateNormal];
  230. }
  231. #pragma mark - Lazy Loading
  232. - (UILabel *)nameLabel {
  233. if (!_nameLabel) {
  234. _nameLabel = [[UILabel alloc] init];
  235. _nameLabel.text = ASLocalizedString(@"姓名");
  236. _nameLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightMedium];
  237. _nameLabel.textColor = [UIColor blackColor];
  238. // 添加红色星号
  239. NSMutableAttributedString *attributedText = [[NSMutableAttributedString alloc] initWithString:_nameLabel.text];
  240. NSAttributedString *redStar = [[NSAttributedString alloc] initWithString:@" *" attributes:@{
  241. NSForegroundColorAttributeName: [UIColor redColor],
  242. NSFontAttributeName: [UIFont systemFontOfSize:16 weight:UIFontWeightMedium]
  243. }];
  244. [attributedText appendAttributedString:redStar];
  245. _nameLabel.attributedText = attributedText;
  246. }
  247. return _nameLabel;
  248. }
  249. - (UITextField *)nameTextField {
  250. if (!_nameTextField) {
  251. _nameTextField = [[UITextField alloc] init];
  252. _nameTextField.placeholder = ASLocalizedString(@"请输入管理员姓名");
  253. _nameTextField.font = [UIFont systemFontOfSize:16];
  254. _nameTextField.textColor = [UIColor blackColor];
  255. _nameTextField.backgroundColor = [UIColor whiteColor];
  256. _nameTextField.layer.cornerRadius = kRealValue(8);
  257. _nameTextField.layer.borderWidth = 1;
  258. _nameTextField.layer.borderColor = [UIColor colorWithHexString:@"#E5E5E5"].CGColor;
  259. // 设置内边距
  260. UIView *leftView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kRealValue(16), kRealValue(48))];
  261. _nameTextField.leftView = leftView;
  262. _nameTextField.leftViewMode = UITextFieldViewModeAlways;
  263. UIView *rightView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kRealValue(16), kRealValue(48))];
  264. _nameTextField.rightView = rightView;
  265. _nameTextField.rightViewMode = UITextFieldViewModeAlways;
  266. }
  267. return _nameTextField;
  268. }
  269. - (UILabel *)phoneLabel {
  270. if (!_phoneLabel) {
  271. _phoneLabel = [[UILabel alloc] init];
  272. _phoneLabel.text = ASLocalizedString(@"电话号码");
  273. _phoneLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightMedium];
  274. _phoneLabel.textColor = [UIColor blackColor];
  275. // 添加红色星号
  276. NSMutableAttributedString *attributedText = [[NSMutableAttributedString alloc] initWithString:_phoneLabel.text];
  277. NSAttributedString *redStar = [[NSAttributedString alloc] initWithString:@" *" attributes:@{
  278. NSForegroundColorAttributeName: [UIColor redColor],
  279. NSFontAttributeName: [UIFont systemFontOfSize:16 weight:UIFontWeightMedium]
  280. }];
  281. [attributedText appendAttributedString:redStar];
  282. _phoneLabel.attributedText = attributedText;
  283. }
  284. return _phoneLabel;
  285. }
  286. - (UITextField *)phoneTextField {
  287. if (!_phoneTextField) {
  288. _phoneTextField = [[UITextField alloc] init];
  289. _phoneTextField.placeholder = ASLocalizedString(@"请输入管理员电话号码");
  290. _phoneTextField.font = [UIFont systemFontOfSize:16];
  291. _phoneTextField.textColor = [UIColor blackColor];
  292. _phoneTextField.backgroundColor = [UIColor whiteColor];
  293. _phoneTextField.layer.cornerRadius = kRealValue(8);
  294. _phoneTextField.layer.borderWidth = 1;
  295. _phoneTextField.layer.borderColor = [UIColor colorWithHexString:@"#E5E5E5"].CGColor;
  296. _phoneTextField.keyboardType = UIKeyboardTypePhonePad;
  297. // 设置内边距
  298. UIView *leftView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kRealValue(16), kRealValue(48))];
  299. _phoneTextField.leftView = leftView;
  300. _phoneTextField.leftViewMode = UITextFieldViewModeAlways;
  301. UIView *rightView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kRealValue(16), kRealValue(48))];
  302. _phoneTextField.rightView = rightView;
  303. _phoneTextField.rightViewMode = UITextFieldViewModeAlways;
  304. }
  305. return _phoneTextField;
  306. }
  307. - (UIView *)phoneWarningView {
  308. if (!_phoneWarningView) {
  309. _phoneWarningView = [[UIView alloc] init];
  310. _phoneWarningView.backgroundColor = [UIColor colorWithHexString:@"#FFF8E1"];
  311. _phoneWarningView.layer.cornerRadius = kRealValue(6);
  312. }
  313. return _phoneWarningView;
  314. }
  315. - (UIImageView *)phoneWarningIcon {
  316. if (!_phoneWarningIcon) {
  317. _phoneWarningIcon = [[UIImageView alloc] init];
  318. UIImage *warningImage = [UIImage imageNamed:@"store_bank_tips"];
  319. if (!warningImage) {
  320. if (@available(iOS 13.0, *)) {
  321. warningImage = [UIImage systemImageNamed:@"info.circle.fill"];
  322. }
  323. }
  324. _phoneWarningIcon.image = warningImage;
  325. _phoneWarningIcon.contentMode = UIViewContentModeScaleAspectFit;
  326. _phoneWarningIcon.tintColor = [UIColor colorWithHexString:@"#F57C00"];
  327. }
  328. return _phoneWarningIcon;
  329. }
  330. - (UILabel *)phoneWarningLabel {
  331. if (!_phoneWarningLabel) {
  332. _phoneWarningLabel = [[UILabel alloc] init];
  333. _phoneWarningLabel.text = ASLocalizedString(@"此电话默认为PC端商家后台管理登录账号");
  334. _phoneWarningLabel.font = [UIFont systemFontOfSize:11];
  335. _phoneWarningLabel.textColor = [UIColor colorWithHexString:@"#F57C00"];
  336. _phoneWarningLabel.numberOfLines = 0;
  337. }
  338. return _phoneWarningLabel;
  339. }
  340. - (UILabel *)verifyCodeLabel {
  341. if (!_verifyCodeLabel) {
  342. _verifyCodeLabel = [[UILabel alloc] init];
  343. _verifyCodeLabel.text = ASLocalizedString(@"验证码");
  344. _verifyCodeLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightMedium];
  345. _verifyCodeLabel.textColor = [UIColor blackColor];
  346. // 添加红色星号
  347. NSMutableAttributedString *attributedText = [[NSMutableAttributedString alloc] initWithString:_verifyCodeLabel.text];
  348. NSAttributedString *redStar = [[NSAttributedString alloc] initWithString:@" *" attributes:@{
  349. NSForegroundColorAttributeName: [UIColor redColor],
  350. NSFontAttributeName: [UIFont systemFontOfSize:16 weight:UIFontWeightMedium]
  351. }];
  352. [attributedText appendAttributedString:redStar];
  353. _verifyCodeLabel.attributedText = attributedText;
  354. }
  355. return _verifyCodeLabel;
  356. }
  357. - (UIView *)verifyCodeContainerView {
  358. if (!_verifyCodeContainerView) {
  359. _verifyCodeContainerView = [[UIView alloc] init];
  360. _verifyCodeContainerView.backgroundColor = [UIColor whiteColor];
  361. _verifyCodeContainerView.layer.cornerRadius = kRealValue(8);
  362. _verifyCodeContainerView.layer.borderWidth = 1;
  363. _verifyCodeContainerView.layer.borderColor = [UIColor colorWithHexString:@"#E5E5E5"].CGColor;
  364. }
  365. return _verifyCodeContainerView;
  366. }
  367. - (UITextField *)verifyCodeTextField {
  368. if (!_verifyCodeTextField) {
  369. _verifyCodeTextField = [[UITextField alloc] init];
  370. _verifyCodeTextField.placeholder = ASLocalizedString(@"请输入验证码");
  371. _verifyCodeTextField.font = [UIFont systemFontOfSize:16];
  372. _verifyCodeTextField.textColor = [UIColor blackColor];
  373. _verifyCodeTextField.backgroundColor = [UIColor clearColor];
  374. _verifyCodeTextField.keyboardType = UIKeyboardTypeNumberPad;
  375. _verifyCodeTextField.borderStyle = UITextBorderStyleNone;
  376. }
  377. return _verifyCodeTextField;
  378. }
  379. - (UIButton *)getVerifyCodeButton {
  380. if (!_getVerifyCodeButton) {
  381. _getVerifyCodeButton = [UIButton buttonWithType:UIButtonTypeCustom];
  382. [_getVerifyCodeButton setTitle:ASLocalizedString(@"获取验证码") forState:UIControlStateNormal];
  383. [_getVerifyCodeButton setTitleColor:[UIColor colorWithHexString:@"#1A65FF"] forState:UIControlStateNormal];
  384. _getVerifyCodeButton.titleLabel.font = [UIFont systemFontOfSize:12];
  385. _getVerifyCodeButton.backgroundColor = [UIColor clearColor];
  386. _getVerifyCodeButton.layer.cornerRadius = kRealValue(4);
  387. _getVerifyCodeButton.layer.borderWidth = 1;
  388. _getVerifyCodeButton.layer.borderColor = [UIColor colorWithHexString:@"#1A65FF"].CGColor;
  389. [_getVerifyCodeButton addTarget:self action:@selector(getVerifyCodeButtonTapped:) forControlEvents:UIControlEventTouchUpInside];
  390. }
  391. return _getVerifyCodeButton;
  392. }
  393. - (UILabel *)passwordSectionLabel {
  394. if (!_passwordSectionLabel) {
  395. _passwordSectionLabel = [[UILabel alloc] init];
  396. _passwordSectionLabel.text = ASLocalizedString(@"PC端商家后台登录密码");
  397. _passwordSectionLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightMedium];
  398. _passwordSectionLabel.textColor = [UIColor blackColor];
  399. // 添加红色星号
  400. NSMutableAttributedString *attributedText = [[NSMutableAttributedString alloc] initWithString:_passwordSectionLabel.text];
  401. NSAttributedString *redStar = [[NSAttributedString alloc] initWithString:@" *" attributes:@{
  402. NSForegroundColorAttributeName: [UIColor redColor],
  403. NSFontAttributeName: [UIFont systemFontOfSize:16 weight:UIFontWeightMedium]
  404. }];
  405. [attributedText appendAttributedString:redStar];
  406. _passwordSectionLabel.attributedText = attributedText;
  407. }
  408. return _passwordSectionLabel;
  409. }
  410. - (UIView *)passwordWarningView {
  411. if (!_passwordWarningView) {
  412. _passwordWarningView = [[UIView alloc] init];
  413. _passwordWarningView.backgroundColor = [UIColor colorWithHexString:@"#FFF8E1"];
  414. _passwordWarningView.layer.cornerRadius = kRealValue(6);
  415. }
  416. return _passwordWarningView;
  417. }
  418. - (UIImageView *)passwordWarningIcon {
  419. if (!_passwordWarningIcon) {
  420. _passwordWarningIcon = [[UIImageView alloc] init];
  421. UIImage *warningImage = [UIImage imageNamed:@"store_bank_tips"];
  422. if (!warningImage) {
  423. if (@available(iOS 13.0, *)) {
  424. warningImage = [UIImage systemImageNamed:@"info.circle.fill"];
  425. }
  426. }
  427. _passwordWarningIcon.image = warningImage;
  428. _passwordWarningIcon.contentMode = UIViewContentModeScaleAspectFit;
  429. _passwordWarningIcon.tintColor = [UIColor colorWithHexString:@"#F57C00"];
  430. }
  431. return _passwordWarningIcon;
  432. }
  433. - (UILabel *)passwordWarningLabel {
  434. if (!_passwordWarningLabel) {
  435. _passwordWarningLabel = [[UILabel alloc] init];
  436. _passwordWarningLabel.text = ASLocalizedString(@"请牢记此密码,用于PC端商家后台管理登录");
  437. _passwordWarningLabel.font = [UIFont systemFontOfSize:11];
  438. _passwordWarningLabel.textColor = [UIColor colorWithHexString:@"#F57C00"];
  439. _passwordWarningLabel.numberOfLines = 0;
  440. }
  441. return _passwordWarningLabel;
  442. }
  443. - (UILabel *)passwordLabel {
  444. if (!_passwordLabel) {
  445. _passwordLabel = [[UILabel alloc] init];
  446. _passwordLabel.text = ASLocalizedString(@"请输入密码");
  447. _passwordLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightMedium];
  448. _passwordLabel.textColor = [UIColor blackColor];
  449. }
  450. return _passwordLabel;
  451. }
  452. - (UIView *)passwordContainerView {
  453. if (!_passwordContainerView) {
  454. _passwordContainerView = [[UIView alloc] init];
  455. _passwordContainerView.backgroundColor = [UIColor whiteColor];
  456. _passwordContainerView.layer.cornerRadius = kRealValue(8);
  457. _passwordContainerView.layer.borderWidth = 1;
  458. _passwordContainerView.layer.borderColor = [UIColor colorWithHexString:@"#E5E5E5"].CGColor;
  459. }
  460. return _passwordContainerView;
  461. }
  462. - (UITextField *)passwordTextField {
  463. if (!_passwordTextField) {
  464. _passwordTextField = [[UITextField alloc] init];
  465. _passwordTextField.placeholder = ASLocalizedString(@"请输入密码");
  466. _passwordTextField.font = [UIFont systemFontOfSize:16];
  467. _passwordTextField.textColor = [UIColor blackColor];
  468. _passwordTextField.backgroundColor = [UIColor clearColor];
  469. _passwordTextField.secureTextEntry = YES;
  470. _passwordTextField.borderStyle = UITextBorderStyleNone;
  471. }
  472. return _passwordTextField;
  473. }
  474. - (UIButton *)passwordEyeButton {
  475. if (!_passwordEyeButton) {
  476. _passwordEyeButton = [UIButton buttonWithType:UIButtonTypeCustom];
  477. UIImage *eyeImage = [UIImage imageNamed:@"store_password4"];
  478. [_passwordEyeButton setImage:eyeImage forState:UIControlStateNormal];
  479. _passwordEyeButton.tintColor = [UIColor grayColor];
  480. [_passwordEyeButton addTarget:self action:@selector(passwordEyeButtonTapped:) forControlEvents:UIControlEventTouchUpInside];
  481. }
  482. return _passwordEyeButton;
  483. }
  484. - (UILabel *)confirmPasswordLabel {
  485. if (!_confirmPasswordLabel) {
  486. _confirmPasswordLabel = [[UILabel alloc] init];
  487. _confirmPasswordLabel.text = ASLocalizedString(@"再次输入密码");
  488. _confirmPasswordLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightMedium];
  489. _confirmPasswordLabel.textColor = [UIColor blackColor];
  490. }
  491. return _confirmPasswordLabel;
  492. }
  493. - (UIView *)confirmPasswordContainerView {
  494. if (!_confirmPasswordContainerView) {
  495. _confirmPasswordContainerView = [[UIView alloc] init];
  496. _confirmPasswordContainerView.backgroundColor = [UIColor whiteColor];
  497. _confirmPasswordContainerView.layer.cornerRadius = kRealValue(8);
  498. _confirmPasswordContainerView.layer.borderWidth = 1;
  499. _confirmPasswordContainerView.layer.borderColor = [UIColor colorWithHexString:@"#E5E5E5"].CGColor;
  500. }
  501. return _confirmPasswordContainerView;
  502. }
  503. - (UITextField *)confirmPasswordTextField {
  504. if (!_confirmPasswordTextField) {
  505. _confirmPasswordTextField = [[UITextField alloc] init];
  506. _confirmPasswordTextField.placeholder = ASLocalizedString(@"再次输入密码");
  507. _confirmPasswordTextField.font = [UIFont systemFontOfSize:16];
  508. _confirmPasswordTextField.textColor = [UIColor blackColor];
  509. _confirmPasswordTextField.backgroundColor = [UIColor clearColor];
  510. _confirmPasswordTextField.secureTextEntry = YES;
  511. _confirmPasswordTextField.borderStyle = UITextBorderStyleNone;
  512. }
  513. return _confirmPasswordTextField;
  514. }
  515. - (UIButton *)confirmPasswordEyeButton {
  516. if (!_confirmPasswordEyeButton) {
  517. _confirmPasswordEyeButton = [UIButton buttonWithType:UIButtonTypeCustom];
  518. UIImage *eyeImage = [UIImage imageNamed:@"store_password4"];
  519. [_confirmPasswordEyeButton setImage:eyeImage forState:UIControlStateNormal];
  520. _confirmPasswordEyeButton.tintColor = [UIColor grayColor];
  521. [_confirmPasswordEyeButton addTarget:self action:@selector(confirmPasswordEyeButtonTapped:) forControlEvents:UIControlEventTouchUpInside];
  522. }
  523. return _confirmPasswordEyeButton;
  524. }
  525. @end