123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177 |
- //
- // LDWithdrawUserView.m
- // YouHuiProject
- //
- // Created by 小花 on 2018/7/31.
- // Copyright © 2018年 kuxuan. All rights reserved.
- //
- #import "LDWithdrawUserView.h"
- @interface LDWithdrawUserView ()
- @property (nonatomic, strong) UIImageView *iconView;
- @property (nonatomic, strong) UILabel *nameTitle;
- @property (nonatomic, strong) UILabel *accountTitle;
- @property (nonatomic, strong) UILabel *name;
- @property (nonatomic, strong) UILabel *account;
- @property (nonatomic, strong) UIButton *updateButton;
- @end
- @implementation LDWithdrawUserView
- - (instancetype)initWithFrame:(CGRect)frame {
- self = [super initWithFrame:frame];
- if (self) {
- [self initSubViews];
- }
- return self;
- }
- - (void)initSubViews {
- self.backgroundColor =[UIColor whiteColor];
- [self addSubview:self.iconView];
- [self addSubview:self.nameTitle];
- [self addSubview:self.accountTitle];
- [self addSubview:self.name];
- [self addSubview:self.account];
- [self addSubview:self.updateButton];
-
- [self.iconView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(Fitsize(15));
- make.width.height.mas_equalTo(Fitsize(46));
- make.centerY.mas_equalTo(self.mas_centerY);
- }];
-
- [self.nameTitle mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(self.iconView.mas_right).mas_offset(Fitsize(20));
- make.top.mas_equalTo(self.iconView.mas_top);
- }];
-
- [self.accountTitle mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(self.nameTitle);
- make.bottom.mas_equalTo(self.iconView.mas_bottom);
- }];
-
- [self.name mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(self.nameTitle.mas_right).mas_offset(Fitsize(44));
- make.centerY.mas_equalTo(self.nameTitle.mas_centerY);
- }];
-
- [self.account mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(self.name);
- make.centerY.mas_equalTo(self.accountTitle.mas_centerY);
- }];
-
- [self.updateButton mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.right.mas_equalTo(-Fitsize(15));
- make.centerY.mas_equalTo(self.iconView.mas_centerY);
- make.width.mas_equalTo(SCREEN_WIDTH);
- make.height.mas_equalTo(self.mas_height);
- }];
- }
- - (void)updateClickAction {
- if (self.updateAction) {
- self.updateAction();
- }
- }
- - (void)setUserInfo:(NSDictionary *)dict {
-
- NSString *name = dict[@"real_name"];
-
- NSMutableString *newStr = [NSMutableString string];
- if (name.length > 1) {
- for (int i = 0; i < name.length; i++) {
- if (i == 0) {
- NSString *temp = [name substringWithRange:NSMakeRange(i,1)];
- [newStr appendString:temp];
- }else {
- [newStr appendString:@"*"];
- }
- }
- }
- self.name.text = newStr;
-
-
- NSString *accountStr = dict[@"alipay_account"];
- NSString *newAccountStr;
- if (accountStr.length == 11 && ![accountStr containsString:@"@"]) {
- newAccountStr = [accountStr stringByReplacingCharactersInRange:NSMakeRange(3, 4) withString:@"****"];
- }else {
- newAccountStr = accountStr;
- }
- self.account.text = newAccountStr;
-
- }
- #pragma mark ----
- - (UIImageView *)iconView {
- if (!_iconView) {
- _iconView = [[UIImageView alloc] init];
- _iconView.image = [UIImage imageNamed:@"alipay_icon"];
- }
- return _iconView;
- }
- - (UILabel *)nameTitle {
- if (!_nameTitle) {
- _nameTitle = [[UILabel alloc] init];
- _nameTitle.font = [UIFont systemFontOfSize:Fitsize(16)];
- _nameTitle.textColor = [UIColor YHColorWithHex:0x000000];
- _nameTitle.text = @"真实姓名";
- }
- return _nameTitle;
- }
- - (UILabel *)accountTitle {
- if (!_accountTitle) {
- _accountTitle = [[UILabel alloc] init];
- _accountTitle.font = [UIFont systemFontOfSize:Fitsize(16)];
- _accountTitle.textColor = [UIColor YHColorWithHex:0x000000];
- _accountTitle.text = @"支付宝账号";
- }
- return _accountTitle;
- }
- - (UILabel *)name {
- if (!_name) {
- _name = [[UILabel alloc] init];
- _name.font = [UIFont systemFontOfSize:Fitsize(16)];
- _name.textColor = [UIColor YHColorWithHex:0x3E3E3E];
- _name.text = @"加载中...";
- }
- return _name;
- }
- - (UILabel *)account {
- if (!_account) {
- _account = [[UILabel alloc] init];
- _account.font = [UIFont systemFontOfSize:Fitsize(16)];
- _account.textColor = [UIColor YHColorWithHex:0x3E3E3E];
- _account.text = @"加载中...";
- }
- return _account;
- }
- - (UIButton *)updateButton {
- if (!_updateButton) {
- _updateButton = [UIButton buttonWithType:UIButtonTypeCustom];
- // _updateButton.layer.cornerRadius = Fitsize(9);
- // _updateButton.layer.borderColor = [UIColor homeRedColor].CGColor;
- // _updateButton.layer.borderWidth = 1;
- [_updateButton setImage:[UIImage imageNamed:@"Dropdown Copy"] forState:UIControlStateNormal];
- // [_updateButton setTitle:@"修改" forState:UIControlStateNormal];
- // _updateButton.titleLabel.font = [UIFont systemFontOfSize:Fitsize(12)];
- // [_updateButton setTitleColor:[UIColor homeRedColor] forState:UIControlStateNormal];
- _updateButton.imageEdgeInsets=UIEdgeInsetsMake(FITSIZE(23), SCREEN_WIDTH-FITSIZE(22), FITSIZE(23), FITSIZE(15));
- [_updateButton addTarget:self action:@selector(updateClickAction) forControlEvents:UIControlEventTouchUpInside];
- }
- return _updateButton;
- }
- @end
|