123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297 |
- //
- // 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)setData {
- ASUserModel *user = ASUserInfoManager.shared.userInfo;
- NSString *userName = [NSString stringWithFormat:@"%@ %@", user.lastname, user.firstname];
- [self.bgAvaterV setUserHeadV:@"" uName:userName];
- [self.bgAvaterV setBorderColor:[UIColor clearColor] width:0];
-
- [self.userInfoV setData];
-
- ASVipModel *curVipM = ASUserInfoManager.shared.curVipInfo;
- ASVipModel *nexVipM = ASUserInfoManager.shared.nextVipInfo;
- self.vipLevel1.image = [UIImage imageNamed:[NSString stringWithFormat:@"uc_vip_level_%ld", curVipM.level.integerValue]];
- self.vipDesLb.text = [NSString stringWithFormat:@"Growth Value %ld/%ld", ASUserInfoManager.shared.pointAmount.integerValue, nexVipM.exppoints.integerValue];
-
- self.vipLevel2.image = [UIImage imageNamed:[NSString stringWithFormat:@"uc_vip_level_%ld", nexVipM.level.integerValue]];
-
-
-
-
-
- }
- - (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];
- }
- return self;
- }
- - (void)loadSubV {
- self.backgroundColor = Col_FFF;
- [self addSubview:self.bgV];
- self.bgV.backgroundColor = Col_FFF;
- 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
|