// // ASUserCenterTopView.m // Asteria // // Created by iOS on 2023/5/15. // #import "ASUserCenterTopView.h" #import "ASUserAvaterView.h" #import "ASUserBaseInfoView.h" @interface ASUserCenterTopView () @property (nonatomic, strong) UIView *bgV; @property (nonatomic, strong) ASUserAvaterView *bgAvaterV; @property (nonatomic, strong) ASUserBaseInfoView *userInfoV; @property (nonatomic, strong) UIButton *settingBt; @property (nonatomic,strong) UIView *vipContentV; @property (nonatomic,strong) UIView *vipLineV1; @property (nonatomic,strong) UIView *vipLineV2; @property (nonatomic,strong) UIView *vipPointV1; @property (nonatomic,strong) UIView *vipPointV2; @property (nonatomic,strong) UIImageView *currentVipTipV; @property (nonatomic,strong) UIImageView *vipLevel1; @property (nonatomic,strong) UIImageView *vipLevel2; @property (nonatomic,strong) UILabel *vipDesLb; @end @implementation ASUserCenterTopView - (void)setDemoData { [self.bgAvaterV setUserHeadV:@"" uName:@"new"]; [self.bgAvaterV setBorderColor:[UIColor clearColor] width:0]; self.backgroundColor = _F0F0F0; } - (void)settingAction { if (self.settingBlock) { self.settingBlock(); } } // MARK: - SubUI - (instancetype)initWithFrame:(CGRect)frame { self = [super initWithFrame:CGRectMake(0, 0, KScreenWidth, 226)]; if (self) { self.backgroundColor = UIColor.clearColor; [self loadSubV]; [self setDemoData]; } return self; } - (void)loadSubV { self.backgroundColor = Col_FFF; [self addSubview:self.bgV]; self.bgV.backgroundColor = _F8F8F8; self.bgV.frame = CGRectMake(10, 10, KScreenWidth-20, 206); UIVisualEffectView *blurV = [UIView getBlurV:self.bgV.bounds]; blurV.alpha = 0.95; [self.bgV addSubview:self.bgAvaterV]; [self.bgAvaterV mas_makeConstraints:^(MASConstraintMaker *make) { make.edges.equalTo(self.bgV); }]; [self.bgV addSubview:blurV]; [self.bgV addSubview:self.userInfoV]; [self.bgV addSubview:self.settingBt]; [self.bgV addSubview:self.vipContentV]; [self.bgV mas_makeConstraints:^(MASConstraintMaker *make) { make.top.leading.equalTo(self).offset(10); make.bottom.trailing.equalTo(self).offset(-10); make.height.equalTo(@206); }]; [self.userInfoV mas_makeConstraints:^(MASConstraintMaker *make) { make.top.leading.equalTo(self.bgV).offset(10); make.trailing.equalTo(self.bgV).offset(-10); make.height.equalTo(@100); }]; [self.settingBt mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(self.bgV).offset(10); make.trailing.equalTo(self.bgV).offset(-10); make.width.height.equalTo(@24); }]; [self.vipContentV mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(self.userInfoV.mas_bottom).offset(20); make.bottom.equalTo(self.bgV).offset(-20); make.leading.equalTo(self.userInfoV); make.width.equalTo(self.userInfoV); }]; // vip [self.vipContentV addSubview:self.vipDesLb]; [self.vipContentV addSubview:self.vipLineV1]; [self.vipContentV addSubview:self.vipLineV2]; [self.vipContentV addSubview:self.vipPointV1]; [self.vipContentV addSubview:self.vipPointV2]; [self.vipContentV addSubview:self.currentVipTipV]; [self.vipContentV addSubview:self.vipLevel1]; [self.vipContentV addSubview:self.vipLevel2]; [self.vipDesLb mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.vipContentV).offset(0); make.right.equalTo(self.vipContentV).offset(0); make.top.equalTo(self.vipContentV).offset(0); make.height.equalTo(@14); }]; [self.vipLineV1 mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.vipContentV).offset(0); make.right.equalTo(self.vipContentV).offset(0); make.top.equalTo(self.vipDesLb.mas_bottom).offset(17); make.height.equalTo(@2); }]; [self.vipLineV2 mas_makeConstraints:^(MASConstraintMaker *make) { make.trailing.equalTo(self.vipLineV1); make.centerY.equalTo(self.vipLineV1); make.width.equalTo(self.vipLineV1.mas_width).multipliedBy(0.68); make.height.equalTo(self.vipLineV1); }]; [self.vipPointV1 mas_makeConstraints:^(MASConstraintMaker *make) { make.centerX.equalTo(self.vipLineV2.mas_left); make.centerY.equalTo(self.vipLineV1); make.width.height.equalTo(@10); }]; [self.vipPointV2 mas_makeConstraints:^(MASConstraintMaker *make) { make.right.equalTo(self.vipLineV2.mas_right); make.centerY.equalTo(self.vipLineV1); make.width.height.equalTo(@10); }]; [self.currentVipTipV mas_makeConstraints:^(MASConstraintMaker *make) { make.bottom.equalTo(self.vipPointV1.mas_top); make.centerX.equalTo(self.vipPointV1); make.width.equalTo(@10); make.height.equalTo(@8); }]; [self.vipLevel1 mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(self.vipPointV1.mas_bottom).offset(5); make.trailing.equalTo(self.vipPointV1); make.width.equalTo(@35); make.height.equalTo(@20); }]; [self.vipLevel2 mas_makeConstraints:^(MASConstraintMaker *make) { make.trailing.equalTo(self.vipPointV2); make.centerY.equalTo(self.vipLevel1); make.width.equalTo(@35); make.height.equalTo(@20); }]; } - (UIView *)bgV { if (!_bgV) { UIView *v = [UIView baseV]; v.layer.cornerRadius = 8; v.layer.masksToBounds = true; _bgV = v; } return _bgV; } - (ASUserAvaterView *)bgAvaterV { if (!_bgAvaterV) { ASUserAvaterView *v = [[ASUserAvaterView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth-20, 206)]; _bgAvaterV = v; } return _bgAvaterV; } - (ASUserBaseInfoView *)userInfoV { if (!_userInfoV) { ASUserBaseInfoView *v = [[ASUserBaseInfoView alloc] initWithFrame:CGRectZero]; _userInfoV = v; } return _userInfoV; } - (UIButton *)settingBt { if (!_settingBt) { UIButton *bt = [UIButton buttonWithType:UIButtonTypeCustom]; [bt setImage:[UIImage imageNamed:@"uc_setting"] forState:UIControlStateNormal]; [bt addTarget:self action:@selector(settingAction) forControlEvents:UIControlEventTouchUpInside]; _settingBt = bt; } return _settingBt; } // MARK: vip等级 - (UIImageView *)vipLevel1 { if (!_vipLevel1) { _vipLevel1 = [UIView baseImgV]; _vipLevel1.image = [UIImage imageNamed:@"vip_1"]; } return _vipLevel1; } -(UIImageView *)vipLevel2 { if (!_vipLevel2) { _vipLevel2 = [UIView baseImgV]; _vipLevel2.image = [UIImage imageNamed:@"vip_2"]; } return _vipLevel2; } - (UILabel *)vipDesLb { if (!_vipDesLb) { UILabel *lb = [UIView baseLb]; lb.font = [UIFont fontWithName:Rob_Regular size:12]; lb.text = @"Growth Value 7220/10000"; lb.textAlignment = NSTextAlignmentLeft; _vipDesLb = lb; } return _vipDesLb; } -(UIView *)vipLineV1 { if (!_vipLineV1) { _vipLineV1 = [UIView baseV]; _vipLineV1.backgroundColor = [UIColor blackColor]; } return _vipLineV1; } -(UIView *)vipLineV2 { if (!_vipLineV2) { _vipLineV2 = [UIView baseV]; _vipLineV2.backgroundColor = Col_FFF; } return _vipLineV2; } -(UIView *)vipPointV1 { if (!_vipPointV1) { _vipPointV1 = [UIView baseV]; _vipPointV1.backgroundColor = UIColor.blackColor; _vipPointV1.layer.cornerRadius = 5; _vipPointV1.layer.masksToBounds = true; } return _vipPointV1; } -(UIView *)vipPointV2 { if (!_vipPointV2) { _vipPointV2 = [UIView baseV]; _vipPointV2.backgroundColor = UIColor.blackColor; _vipPointV2.layer.cornerRadius = 5; _vipPointV2.layer.masksToBounds = true; } return _vipPointV2; } -(UIView *)vipContentV { if (!_vipContentV) { _vipContentV = [UIView baseV]; _vipContentV.backgroundColor = UIColor.clearColor; } return _vipContentV; } -(UIImageView *)currentVipTipV { if (!_currentVipTipV) { _currentVipTipV = [UIView baseImgV]; _currentVipTipV.image = [UIImage imageNamed:@"mine_current_position"]; } return _currentVipTipV; } @end