123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749 |
- //
- // YOUPAILZProfileHeaderView.m
- // VQU
- //
- // Created by CY on 2021/6/30.
- // Copyright © 2021 leo. All rights reserved.
- //
- #import "YOUPAILZProfileHeaderView.h"
- //#import "YOUPAILCEditUserMsgVC.h"
- #import "YOUPAILCFollowVC.h"
- #import "YOUPAILCFansVC.h"
- #import "YOUPAILCSeenVC.h"
- #import "YOUPAILCVisitVC.h"
- #import "YOUPAILZUserShowVC.h"
- #import "YOUPAILZProfitVC.h"
- #import "YOUPAIZYVideoLikesVC.h"
- #import "YOUPAIXRWalletVC.h"
- #import "LZAlertWindow.h"
- #import "UIViewController+TFPresent.h"
- #import "YOUPAILZLevelView.h"
- #import "YOUPAILZAvatarView.h"
- #import "YOUPAILCSettingVC.h"
- #import "YOUPAILZPersonalizedDressVC.h"
- #import "MSYMineinfoEditVC.h"
- #import "WHVipDropView.h"
- @interface LZProfileBadgeButton : UIButton
- @property (nonatomic, assign) NSInteger youpaipbadgeValue;
- @property (nonatomic, assign) NSInteger youpaipcount;
- @property (nonatomic, strong) NSString *youpaiptitleStr;
- @property (nonatomic, weak) UILabel *youpaipcountL;
- @property (nonatomic, weak) UILabel *youpaiptitleL;
- @property (nonatomic, weak) UILabel *youpaipbadgeL;
- @property (nonatomic, weak) UIView *youpaipbadgeBgV;
- @end
- @implementation LZProfileBadgeButton
- - (instancetype)init{
- if (self = [super init]) {
- [self youpaifinitUI];
- }
- return self;
- }
- - (void)youpaifinitUI{
-
- UILabel *countL = [[UILabel alloc] init];
- countL.font = LCBoldFont(16);
- countL.textColor = [UIColor whiteColor];
- [self addSubview:countL];
- self.youpaipcountL = countL;
- [countL mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerX.equalTo(self);
- make.top.offset(0.0f);
- }];
-
- UILabel *titleL = [[UILabel alloc] init];
- titleL.font = LCFont(12.0f);
- titleL.textColor = [UIColor whiteColor];
- titleL.textAlignment = NSTextAlignmentCenter;
- [self addSubview:titleL];
- self.youpaiptitleL = titleL;
- [titleL mas_makeConstraints:^(MASConstraintMaker *make) {
- make.bottom.left.right.offset(0.0f);
- }];
-
- UIView *badgeBgV = [[UIView alloc] init];
- badgeBgV.backgroundColor = HexColorFromRGB(0xF4003F);
- badgeBgV.layer.cornerRadius = 7.0f;
- badgeBgV.clipsToBounds = YES;
- badgeBgV.hidden = YES;
- [self addSubview:badgeBgV];
- self.youpaipbadgeBgV = badgeBgV;
- [badgeBgV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(countL.mas_right).offset(-5.0f);
- make.bottom.equalTo(countL.mas_top).offset(5.0f);
- make.height.offset(14.0f);
- make.width.greaterThanOrEqualTo(14.0f);
- }];
- UILabel *badgeL = [[UILabel alloc] init];
- badgeL.font = LCFont(10.0f);
- badgeL.textColor = [UIColor whiteColor];
- badgeL.textAlignment = NSTextAlignmentCenter;
- [badgeBgV addSubview:badgeL];
- self.youpaipbadgeL = badgeL;
- [badgeL mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.offset(2.0f);
- make.right.offset(-2.0f);
- make.top.bottom.offset(0.0f);
- }];
- }
- - (void)setYoupaipbadgeValue:(NSInteger)badgeValue{
- _youpaipbadgeValue = badgeValue;
- self.youpaipbadgeBgV.hidden = badgeValue <= 0;
- self.youpaipbadgeL.text = [NSString stringWithFormat:@"%ld",badgeValue];
- if (badgeValue > 99) {
- self.youpaipbadgeL.text = @"99+";
- }
- }
- - (void)setYoupaiptitleStr:(NSString *)titleStr{
- _youpaiptitleStr = titleStr;
- self.youpaiptitleL.text = titleStr;
- }
- - (void)setYoupaipcount:(NSInteger)count{
- _youpaipcount = count;
- self.youpaipcountL.text = [NSString stringWithFormat:@"%@",@(count)];
- }
- @end
- @interface YOUPAILZProfileHeaderView()
- @property (nonatomic, weak) YOUPAILZAvatarView *youpaipavatarImgV; // 头像
- @property (nonatomic,weak) UIImageView *youpaipanchorTagImgV;
- @property (nonatomic, weak) UILabel *youpaipnicknameL; // 昵称
- @property (nonatomic, weak) UIButton *youpaipidBtn; // id
- @property (nonatomic, weak) UILabel *signLab; // 个性签名
- @property (nonatomic, weak) LZProfileBadgeButton *youpaipfollowBtn; // 关注
- @property (nonatomic, weak) LZProfileBadgeButton *youpaipfansBtn; // 粉丝
- @property (nonatomic, weak) LZProfileBadgeButton *youpaipvisitBtn; // 访客
- @property (nonatomic, weak) LZProfileBadgeButton *youpaipliveBtn; // 获赞
- @property (nonatomic, weak) UILabel *youpaipbalanceL; // 余额
- @property (nonatomic, weak) UILabel *youpaipprofitL; // 收益
- @property (nonatomic, strong) YOUPAILCUserModel *youpaipuserModel;
- @property (nonatomic, strong) YOUPAILZLiveCardModel *youpaipcardModel;
- @property (nonatomic, weak) UIImageView *youpaipvipV;
- @property (nonatomic, weak) UIImageView *youpaipbadgeImgV;
- @property (nonatomic, weak) YOUPAILZLevelView *youpaiplevelView;
- @property (nonatomic, weak) UIView *youpaipredView;//红点
- @property(nonatomic,strong)UIButton *finishMessageBtn;
- @property(nonatomic,strong)NSTimer *timer;
- @property (nonatomic, strong) WHVipDropView *vipDropView;
- @end
- @implementation YOUPAILZProfileHeaderView
- - (instancetype)initWithFrame:(CGRect)frame{
- if (self = [super initWithFrame:frame]) {
- [self youpaifinitUI];
- }
- return self;
- }
- - (void)youpaifinitUI{
- UIButton *editBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- editBtn.frame = CGRectMake(0.0f, 0.0f, WHScreenEqualWidth(80), WHScreenEqualWidth(28));
- [editBtn.layer setCornerRadius:WHScreenEqualWidth(14)];
- [editBtn.layer setMasksToBounds:YES];
- [editBtn setImage:[UIImage imageNamed:@"vqu_images_ic_profile_edit_arrow"] forState:UIControlStateNormal];
- [editBtn setImage:[UIImage imageNamed:@"vqu_images_ic_profile_edit_arrow"] forState:UIControlStateHighlighted];
- [editBtn setTitle:@"编辑资料" forState:UIControlStateNormal];
- [editBtn setBackgroundColor:[UIColor colorWithWhite:0 alpha:0.15]];
- [editBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
- editBtn.titleLabel.font = LCFont(10.0f);
- [editBtn addTarget:self action:@selector(youpaifeditBtnClick) forControlEvents:UIControlEventTouchUpInside];
- CGFloat btnImageWidth = editBtn.imageView.bounds.size.width;
- CGFloat btnLabelWidth = editBtn.titleLabel.bounds.size.width;
- [editBtn setTitleEdgeInsets:UIEdgeInsetsMake(0, -btnImageWidth, 0, btnImageWidth)];
- [editBtn setImageEdgeInsets:UIEdgeInsetsMake(0, btnLabelWidth, 0, -btnLabelWidth)];
- [self addSubview:editBtn];
- [editBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.offset(WHScreenEqualWidth(12));
- make.top.offset(37.0f + StatusBarHeight);
- make.height.offset(WHScreenEqualWidth(28));
- make.width.offset(WHScreenEqualWidth(80));
- }];
- //完善资料图片
- // UIButton *finishMessageBtn = [UIButton new];
- // self.finishMessageBtn = finishMessageBtn;
- // [self addSubview:finishMessageBtn];
- // [finishMessageBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.right.mas_equalTo(-12);
- // make.top.mas_equalTo(editBtn.mas_bottom).offset(0);
- // make.size.mas_equalTo(CGSizeMake(97, 29));
- // }];
- // [finishMessageBtn setBackgroundImage:[UIImage imageNamed:@"vqu_images_finish_bg"] forState:UIControlStateNormal];
- //
- // [finishMessageBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
- // finishMessageBtn.titleLabel.font = [UIFont systemFontOfSize:11];
- //未读红点
- UIView *redView = [UIView new];
- [self addSubview:redView];
- self.youpaipredView = redView;
- [redView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.mas_equalTo(editBtn.mas_left).offset(-4);
- make.centerY.mas_equalTo(editBtn).offset(15);
- make.size.mas_equalTo(CGSizeMake(4, 4));
- }];
- redView.layer.cornerRadius = 2;
- redView.layer.masksToBounds = YES;
- redView.backgroundColor = LCRedColor;
- redView.hidden = YES;
-
- UIButton *userBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- [userBtn addTarget:self action:@selector(youpaifuserBtnClick) forControlEvents:UIControlEventTouchUpInside];
- [self addSubview:userBtn];
- [userBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.offset(20.0f);
- make.top.equalTo(35.0f + StatusBarHeight);
- make.height.offset(65.0f);
- make.right.equalTo(editBtn.mas_left).offset(-10.0f);
- }];
- YOUPAILZAvatarView *avatarImgV = [YOUPAILZAvatarView youpaifavatarViewWithFrame:CGRectMake(0.0f, 0.0f, 65.0f, 65.0f) avatarURL:nil personalityBoxURL:nil];
- avatarImgV.userInteractionEnabled = NO;
- [userBtn addSubview:avatarImgV];
- self.youpaipavatarImgV = avatarImgV;
- [avatarImgV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.top.bottom.offset(0.0f);
- make.width.offset(65.0f);
- }];
-
- avatarImgV.userInteractionEnabled = YES;
- UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(youpaifdidAvatarClick)];
- [avatarImgV addGestureRecognizer:tap];
-
- UIImageView *anchorTagImgV = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"vqu_images_anchor_vlog"]];
- anchorTagImgV.hidden = YES;
- [userBtn addSubview:anchorTagImgV];
- self.youpaipanchorTagImgV = anchorTagImgV;
- [anchorTagImgV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.equalTo(self.youpaipavatarImgV.youpaipavatarImgV.mas_right).offset(0.0f);
- make.bottom.equalTo(self.youpaipavatarImgV.youpaipavatarImgV.mas_bottom).offset(0.0f);
- make.size.mas_offset(CGSizeMake(10.0f, 10.0f));
- }];
-
- UILabel *nicknameL = [[UILabel alloc] init];
- nicknameL.font = LCBoldFont(16);
- nicknameL.textColor = [UIColor whiteColor];
- nicknameL.text = [LCSaveModel getUserModel].youpaipuserinfo.youpaipnickname;
- [userBtn addSubview:nicknameL];
- self.youpaipnicknameL = nicknameL;
- [nicknameL mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(avatarImgV.mas_right).offset(10.0f);
- make.top.offset(0.0f);
- make.height.offset(20.5f);
- }];
-
- UIImageView *vipV = [[UIImageView alloc] init];
- [self addSubview:vipV];
- self.youpaipvipV = vipV;
- // vipV.hidden = YES;
- [vipV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(nicknameL);
- make.top.equalTo(nicknameL.mas_bottom).offset(3);
- }];
-
- UIImageView *badgeImgV = [[UIImageView alloc] init];
- [self addSubview:badgeImgV];
- self.youpaipbadgeImgV = badgeImgV;
- // badgeImgV.hidden = YES;
- [badgeImgV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(nicknameL);
- make.top.equalTo(nicknameL.mas_bottom).offset(3);
- }];
-
-
- // 等级 凡人
- // YOUPAILZLevelView *levelView = [[YOUPAILZLevelView alloc] init];
- // [self addSubview:levelView];
- // self.youpaiplevelView = levelView;
- // levelView.hidden = YES;
- // [levelView mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.left.equalTo(nicknameL);
- // make.top.equalTo(nicknameL.mas_bottom).offset(3);
- // }];
-
- // UITapGestureRecognizer *tapGest = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(youpaiftouchUserLevel)];
- // [levelView addGestureRecognizer:tapGest];
-
-
- UIButton *idBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- idBtn.titleLabel.font = LCFont12;
- [idBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
- [idBtn setTitle:[NSString stringWithFormat:@"花舞号:%@",[LCSaveModel getUserModel].youpaipuserinfo.youpaipusercode] forState:UIControlStateNormal];
- [idBtn addTarget:self action:@selector(youpaifcopyBtnClick) forControlEvents:UIControlEventTouchUpInside];
- [userBtn addSubview:idBtn];
- self.youpaipidBtn = idBtn;
- [idBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(avatarImgV.mas_right).offset(10.0f);
- // make.bottom.offset(0.0f);
- make.top.equalTo(nicknameL.mas_bottom).offset(4);
- make.height.mas_equalTo(WHScreenEqualWidth(17));
- }];
-
- UIButton *copyIDBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- [copyIDBtn setImage:[UIImage imageNamed:@"vqu_images_chatroom_copy"] forState:UIControlStateNormal];
- [copyIDBtn addTarget:self action:@selector(youpaifcopyBtnClick) forControlEvents:UIControlEventTouchUpInside];
- [userBtn addSubview:copyIDBtn];
- [copyIDBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(idBtn.mas_right).offset(3.0f);
- make.centerY.equalTo(idBtn.mas_centerY);
- make.size.mas_offset(CGSizeMake(12.0f, 12.0f));
- }];
-
- UIView *countBtnBgV = [[UIView alloc] init];
- [self addSubview:countBtnBgV];
- [countBtnBgV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.offset(12.0f);
- make.right.offset(-12.0f);
- make.top.equalTo(avatarImgV.mas_bottom).offset(10.0f);
- make.height.offset(35.0f);
- }];
-
- // 个性签名
- UILabel *signLab = [[UILabel alloc] init];
- signLab.font = [UIFont systemFontOfSize:WHScreenEqualWidth(10)];
- signLab.textColor = [UIColor whiteColor];
- signLab.text = [LCSaveModel getUserModel].youpaipuserinfo.youpaipsign;
- [userBtn addSubview:signLab];
- self.signLab = signLab;
- [signLab mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(avatarImgV.mas_right).offset(10.0f);
- make.top.equalTo(self.youpaipidBtn.mas_bottom).offset(WHScreenEqualWidth(5));
- make.height.offset(14.5f);
- make.width.mas_lessThanOrEqualTo(kFrameWidth/3*2);
- }];
-
- NSArray *btnContents = @[
- @{@"title":@"关注",@"count":@"0"},
- @{@"title":@"粉丝",@"count":@"0"},
- @{@"title":[LCSaveModel getUserModel].youpaipuserinfo.youpaipis_anchor != 0 ? @"获赞" : @"足迹",@"count":@"0"},
- @{@"title":@"访客",@"count":@"0"},
- ];
- NSArray *sels = @[
- @"youpaiffollowBtnClick",
- @"youpaiffansBtnClick",
- [LCSaveModel getUserModel].youpaipuserinfo.youpaipis_anchor != 0 ? @"youpaifliveBtnClick" : @"youpaifvisitClick",
- @"youpaifvisitBtnClick",
- ];
- NSMutableArray <LZProfileBadgeButton *> *btns = [NSMutableArray array];
- for (NSInteger i = 0; i < btnContents.count; i ++) {
- NSDictionary *dict = btnContents[i];
- LZProfileBadgeButton *badgeBtn = [[LZProfileBadgeButton alloc] init];
- badgeBtn.youpaipcount = [dict[@"count"] integerValue];
- badgeBtn.youpaiptitleStr = dict[@"title"];
- [countBtnBgV addSubview:badgeBtn];
- [badgeBtn addTarget:self action:NSSelectorFromString(sels[i]) forControlEvents:UIControlEventTouchUpInside];
- [btns addObject:badgeBtn];
- if (i == 0) {
- self.youpaipfollowBtn = badgeBtn;
- }else if (i == 1){
- self.youpaipfansBtn = badgeBtn;
- }else if (i == 2){
- self.youpaipliveBtn = badgeBtn;
- }else{
- self.youpaipvisitBtn = badgeBtn;
- }
- }
- [btns mas_distributeViewsAlongAxis:MASAxisTypeHorizontal withFixedSpacing:0 leadSpacing:0 tailSpacing:0];
- [btns mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.bottom.offset(0.0f);
- }];
-
- [countBtnBgV addSubview:self.vipDropView]; // 会员入口
- LZProfileBadgeButton *tmp = btns.firstObject;
- [self.vipDropView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.offset(WHScreenEqualWidth(0));
- make.right.offset(WHScreenEqualWidth(0));
- make.height.mas_equalTo(WHScreenEqualWidth(45));
- make.top.equalTo(tmp.mas_bottom).offset(WHScreenEqualWidth(18));
- }];
-
-
- for (NSInteger i = 1; i < btns.count; i ++) {
- LZProfileBadgeButton *badgeBtn = btns[i];
- UIView *line = [[UIView alloc] init];
- line.backgroundColor = [[UIColor whiteColor] colorWithAlphaComponent:0.22f];
- [countBtnBgV addSubview:line];
- [line mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.equalTo(badgeBtn.mas_left);
- make.centerY.equalTo(badgeBtn);
- make.size.mas_offset(CGSizeMake(1.0f, 10.0f));
- }];
- }
-
- UIView *walletBgV = [[UIView alloc] init];
- walletBgV.backgroundColor = [UIColor clearColor];
- [self addSubview:walletBgV];
- [walletBgV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.offset(12.0f);
- make.right.offset(-12.0f);
- make.top.equalTo(self.vipDropView.mas_bottom).offset(WHScreenEqualWidth(16));
- make.height.offset(64.0f);
- }];
-
- UIView *line = [[UIView alloc] init];
- line.backgroundColor = [UIColor clearColor];
- [walletBgV addSubview:line];
- [line mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerY.equalTo(walletBgV);
- make.centerX.equalTo(walletBgV);
- make.size.mas_offset(CGSizeMake(9.0f, 64.0f));
- }];
- NSArray *walletContents = @[
- @{@"bgImage":[UIImage imageNamed:@"profile_balance_bg"],@"image":[UIImage imageNamed:@"vqu_images_ic_profile_balance"],@"number":@(0),@"details":@"我的钻石",@"arrow":@"vqu_images_mine_arrow"},
- @{@"bgImage":[UIImage imageNamed:@"profile_profit_bg"],@"image":[UIImage imageNamed:@"vqu_images_ic_profile_profit"],@"number":@(0),@"details":LCStr(word2),@"arrow":@"vqu_images_mine_arrow"}
- ];
-
- NSArray *walletSels = @[
- @"youpaifbalanceBtnClick",
- @"youpaifprofitBtnClick"
- ];
- NSMutableArray <UIButton *> *accountBtns = [NSMutableArray array];
- for (NSInteger i = 0; i < walletContents.count; i ++) {
- NSDictionary *dict = walletContents[i];
-
- UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
- [btn addTarget:self action:NSSelectorFromString(walletSels[i]) forControlEvents:UIControlEventTouchUpInside];
- [walletBgV addSubview:btn];
- [accountBtns addObject:btn];
- btn.layer.cornerRadius = 10;
- btn.layer.masksToBounds = YES;
- btn.backgroundColor = [UIColor clearColor];
- // [btn setBackgroundImage:dict[@"bgImage"] forState:UIControlStateNormal];
- // [btn setImage:dict[@"bgImage"] forState:(UIControlStateNormal)];
- // [btn.imageView setContentMode:(UIViewContentModeScaleToFill)];
- // [btn setContentMode:UIViewContentModeScaleAspectFit];
-
- // 渐变色背景
- UIImageView *bgImgV = [[UIImageView alloc] init];
- bgImgV.image = dict[@"bgImage"];
- [btn addSubview:bgImgV];
- [bgImgV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.edges.equalTo(btn);
- }];
-
- UIImageView *imgV = [[UIImageView alloc] init];
- imgV.image = dict[@"image"];
- [btn addSubview:imgV];
- [imgV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.offset(WHScreenEqualWidth(15.0f));
- make.centerY.equalTo(btn);
- make.size.mas_offset(CGSizeMake(WHScreenEqualWidth(38), WHScreenEqualWidth(38)));
- }];
- UIImageView *arrowImage = [[UIImageView alloc] init];
- [btn addSubview:arrowImage];
- [arrowImage mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.offset(-ScaleSize(10));
- make.centerY.equalTo(0);
- make.size.mas_offset(CGSizeMake(10.0f, 10.0f));
- }];
- arrowImage.image = [UIImage imageNamed:dict[@"arrow"]];
-
- UILabel *numberL = [[UILabel alloc] init];
- numberL.text = [NSString stringWithFormat:@"%@",dict[@"number"]];
- numberL.font = LCBoldFont(14.0f);
- numberL.textColor = HexColorFromRGB(0x1C1D23);
- [btn addSubview:numberL];
- [numberL mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(imgV.mas_right).offset(5.0f);
- make.top.offset(17.0f);
- make.right.offset(-20.0f);
- }];
-
- if (i == 0) {
- self.youpaipbalanceL = numberL;
- }else{
- self.youpaipprofitL = numberL;
- }
-
- UIButton *detailsBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- detailsBtn.userInteractionEnabled = NO;
- detailsBtn.frame = CGRectMake(0.0f, 0.0f, 43.0f, 16.0f);
- [detailsBtn setTitle:dict[@"details"] forState:UIControlStateNormal];
- [detailsBtn setTitleColor:HexColorFromRGB(0xA3AABE) forState:UIControlStateNormal];
- detailsBtn.titleLabel.font = LCFont(10.0f);
- // CGFloat btnImageWidth = detailsBtn.imageView.bounds.size.width;
- // CGFloat btnLabelWidth = detailsBtn.titleLabel.bounds.size.width;
- // [detailsBtn setTitleEdgeInsets:UIEdgeInsetsMake(0, -btnImageWidth, 0, btnImageWidth)];
- // [detailsBtn setImageEdgeInsets:UIEdgeInsetsMake(0, btnLabelWidth, 0, -btnLabelWidth)];
- [btn addSubview:detailsBtn];
- [detailsBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(numberL);
- make.top.equalTo(numberL.mas_bottom).offset(0.0f);
- make.height.offset(16.0f);
- make.width.offset(43.0f);
- }];
- }
- /*等间隔排列 - 多个固定大小固定,间隔空隙变化
- * axisType 轴线方向 横排还是竖排
- * withFixedItemLength 控件的宽或高
- * leadSpacing 头部间隔 第一个控件与边缘的间隔
- * tailSpacing 尾部间隔 最后一个控件与边缘的间隔
- */
-
- [accountBtns mas_distributeViewsAlongAxis:MASAxisTypeHorizontal withFixedSpacing:9 leadSpacing:0 tailSpacing:0];
- [accountBtns mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.bottom.offset(0.0f);
- }];
-
-
-
- }
- - (WHVipDropView *)vipDropView{
- if(!_vipDropView){
- _vipDropView = [[WHVipDropView alloc] init];
- }
- return _vipDropView;
- }
- -(void)setIs_complete_info:(NSInteger)is_complete_info{
- _is_complete_info = is_complete_info;
- // if (is_complete_info == 1) {
- //// self.finishMessageBtn.hidden = NO;
- //// self.timer = [NSTimer scheduledTimerWithTimeInterval:3.0 target:self selector:@selector(youpaiftimerAction) userInfo:nil repeats:YES];
- //// [[NSRunLoop currentRunLoop] addTimer:self.timer forMode:NSRunLoopCommonModes];
- //
- // }else{
- // self.finishMessageBtn.hidden = YES;
- // }
- }
- -(void)youpaiftimerAction{
- // self.finishMessageBtn.hidden = YES;
- [self.timer invalidate];
- self.timer = nil;
- }
- - (void)youpaiftouchUserLevel{
- if (self.youpaipmyGrade.length == 0) {
- LZAlertAction *action = [LZAlertAction actionWithTitle:@"好的" handler:^(LZAlertAction *action) {
-
- }];
- action.bgColor = [UIColor colorWithPatternImage:[LCTools ColorImage:CGSizeMake(KScreenWidth - 128.0f, 48.0f) FromColors:@[LZBFB6FFColor,LZ7C69FEColor] ByGradientType:GradientLeftToRight]];
- LZAlertWindow *alert = [LZAlertWindow alertWithTitle:@"" content:@"在视频中或直播中送礼即可提升等级" action:@[action]];
- alert.contentFont = LCFont16;
- alert.contentHorizontalSpace = 32.0f;
- [[LCTools getCurrentVC] TFPresentVC:alert completion:^{}];
- }else{
- ZCBaseWebVC *webVC = [[ZCBaseWebVC alloc] init];
- webVC.contentUrl = self.youpaipmyGrade;
- [[LCTools getContainNavigationControllerCurrentVC].navigationController pushViewController:webVC animated:YES];
- }
-
- }
- /// 更新用户信息
- - (void)youpaifreloadUserInfoWithModel:(YOUPAILCUserModel *)userModel{
- self.youpaipuserModel = userModel;
- self.youpaipavatarImgV.youpaipavatarURL = [LCTools getImageUrlWithAddress:userModel.youpaipuserinfo.youpaipavatar];
- self.youpaipavatarImgV.youpaippersonalityBoxURL = [LCTools getImageUrlWithAddress:userModel.youpaipuserinfo.youpaipavatar_frame];
- // [self.avatarImgV sd_setImageWithURL:[LCTools getImageUrlWithAddress:userModel.userinfo.avatar]];
- self.youpaipnicknameL.text = userModel.youpaipuserinfo.youpaipnickname;
- [self.youpaipidBtn setTitle:[NSString stringWithFormat:@"花舞号:%@",userModel.youpaipuserinfo.youpaipusercode] forState:UIControlStateNormal];
- self.youpaipanchorTagImgV.hidden = userModel.youpaipuserinfo.youpaipis_live != 1;
- [self youpaifreloadTags];
- self.signLab.text = [LCSaveModel getUserModel].youpaipuserinfo.youpaipsign;
- }
- /// 更新数量信息
- - (void)youpaifreloadCountWithModel:(YOUPAILCUserCountModel *)model{
- self.youpaipfollowBtn.youpaipcount = model.youpaipfollow_count;
-
- self.youpaipfansBtn.youpaipcount = model.youpaipfans_count;
- self.youpaipfansBtn.youpaipbadgeValue = model.youpaipnew_fans_count;
- self.youpaipvisitBtn.youpaipcount = model.youpaipvisitor_count;
- self.youpaipvisitBtn.youpaipbadgeValue = model.youpaipnew_visitor_count;
-
- if ([LCSaveModel getUserModel].youpaipuserinfo.youpaipis_anchor != 0) {
- self.youpaipliveBtn.youpaipbadgeValue = model.youpaipnew_videoTrendsLike_count;
- self.youpaipliveBtn.youpaipcount = model.youpaipnew_videoTrendsLike_count;
- }else{
- self.youpaipliveBtn.youpaipbadgeValue = 0;
- self.youpaipliveBtn.youpaipcount = model.youpaipviewer_count;
- }
-
- }
- /// 更新用户等级
- - (void)youpaifreloadUserLevelModel:(YOUPAILZLiveCardModel *)model{
- self.youpaipcardModel = model;
- [self youpaifreloadTags];
-
- }
- ///红点显示
- - (void)youpaifreloadUserRedDotModel:(YOUPAIHRReddotModel *)model{
- // if (model.youpaipis_edit == 1) {
- // self.youpaipredView.hidden = NO;
- // }else{
- // self.youpaipredView.hidden = YES;
- // }
-
- }
- - (void)youpaifreloadTags{
- // self.youpaipvipV.hidden = YES;
- self.youpaipbadgeImgV.hidden = YES;
- self.youpaiplevelView.hidden = YES;
- UIView *frontV;
-
- if (self.youpaipuserModel.youpaipuserinfo.youpaipvip_icon.length != 0) {
- self.youpaipvipV.hidden = NO;
- [self.youpaipvipV sd_setImageWithURL:[LCTools getImageUrlWithAddress:self.youpaipuserModel.youpaipuserinfo.youpaipvip_icon]];
- [self.youpaipvipV mas_remakeConstraints:^(MASConstraintMaker *make) {
- if (frontV == nil) {
- make.left.equalTo(self.youpaipnicknameL);
- }else{
- make.left.equalTo(frontV.mas_right).offset(3.0f);
- }
-
- make.top.equalTo(self.youpaipnicknameL.mas_bottom).offset(3);
- make.size.mas_offset(CGSizeMake(30.0f, 19.0f));
- }];
- frontV = self.youpaipvipV;
- }
-
- if (self.youpaipuserModel.youpaipuserinfo.youpaipbadge_info.youpaipfile.length != 0) {
- self.youpaipbadgeImgV.hidden = NO;
- [self.youpaipbadgeImgV sd_setImageWithURL:[LCTools getImageUrlWithAddress:self.youpaipuserModel.youpaipuserinfo.youpaipbadge_info.youpaipfile]];
- [self.youpaipbadgeImgV mas_remakeConstraints:^(MASConstraintMaker *make) {
- if (frontV == nil) {
- make.left.equalTo(self.youpaipnicknameL);
- }else{
- make.left.equalTo(frontV.mas_right).offset(3.0f);
- }
- make.top.equalTo(self.youpaipnicknameL.mas_bottom).offset(3);
- make.size.mas_offset(CGSizeMake(self.youpaipuserModel.youpaipuserinfo.youpaipbadge_info.youpaipwidth, 17.0f));
- }];
- frontV = self.youpaipbadgeImgV;
- }
- // self.youpaiplevelView.hidden = NO;
- // [self.youpaiplevelView youpaifreloadWithIcon:self.youpaipcardModel.youpaipgrade.youpaipimg1 iconWidth:self.youpaipcardModel.youpaipgrade.youpaipicon_width bgImg:self.youpaipcardModel.youpaipgrade.youpaipimg2 bgImgWidth:self.youpaipcardModel.youpaipgrade.youpaipicon1_width levelName:self.youpaipcardModel.youpaipgrade.youpaipgrade_name level:self.youpaipcardModel.youpaipgrade.youpaipgrade];
- // [self.youpaiplevelView mas_remakeConstraints:^(MASConstraintMaker *make) {
- // if (frontV == nil) {
- // make.left.equalTo(self.youpaipnicknameL);
- // }else{
- // make.left.equalTo(frontV.mas_right).offset(3.0f);
- // }
- // make.top.equalTo(self.youpaipnicknameL.mas_bottom).offset(3);
- // make.size.mas_offset(self.youpaiplevelView.mj_size);
- // }];
- }
- /// 更新账户资产信息
- /// balance 余额
- /// profit 收益
- - (void)youpaifreloadAccountWithBalance:(NSInteger)balance profit:(NSString*)profit{
- self.youpaipbalanceL.text = [NSString stringWithFormat:@"%@",@(balance)];
- self.youpaipprofitL.text = [NSString stringWithFormat:@"%@",profit];
- }
- // 个人主页
- -(void)youpaifsetMineBtnClick{
-
- YOUPAILZUserShowVC *showVC = [[YOUPAILZUserShowVC alloc]init];
- showVC.youpaipuserId = [LCSaveModel getUserModel].youpaipuserinfo.youpaipuser_id;
- [[LCTools getCurrentVC].navigationController pushViewController:showVC animated:YES];
-
- }
- //点击进入个人装扮
- - (void)youpaifdidAvatarClick{
-
- // YOUPAILZPersonalizedDressVC* vc = [[YOUPAILZPersonalizedDressVC alloc]init];
- // [[LCTools getCurrentVC].navigationController pushViewController:vc animated:YES];
- YOUPAILZUserShowVC *showVC = [[YOUPAILZUserShowVC alloc]init];
- showVC.youpaipuserId = [LCSaveModel getUserModel].youpaipuserinfo.youpaipuser_id;
- [[LCTools getCurrentVC].navigationController pushViewController:showVC animated:YES];
- }
- //编辑资料
- -(void)youpaifeditBtnClick{
- // TODO: xiaoqy 2022.3.2 替换原来的
- MSYMineinfoEditVC * editvc = [MSYMineinfoEditVC new];
- [[LCTools getCurrentVC].navigationController pushViewController:editvc animated:true];
- return;
-
- }
- // 用户信息点击事件
- - (void)youpaifuserBtnClick{
- YOUPAILZUserShowVC *showVC = [[YOUPAILZUserShowVC alloc]init];
- showVC.youpaipuserId = [LCSaveModel getUserModel].youpaipuserinfo.youpaipuser_id;
- [[LCTools getCurrentVC].navigationController pushViewController:showVC animated:YES];
-
- // YOUPAILCEditUserMsgVC* editMsg = [[YOUPAILCEditUserMsgVC alloc]init];
- // [[LCTools getCurrentVC].navigationController pushViewController:editMsg animated:YES];
-
-
- }
- // 复制ID点击事件
- - (void)youpaifcopyBtnClick{
- UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
- pasteboard.string = self.youpaipuserModel.youpaipuserinfo.youpaipusercode;
- [ZCHUDHelper showTitle:@"复制成功"];
- }
- // 关注点击事件
- - (void)youpaiffollowBtnClick{
- YOUPAILCFollowVC* youpaiffollow = [[YOUPAILCFollowVC alloc]init];
- [[LCTools getCurrentVC].navigationController pushViewController:youpaiffollow animated:YES];
- }
- // 粉丝点击事件
- - (void)youpaiffansBtnClick{
- YOUPAILCFansVC* fan = [[YOUPAILCFansVC alloc]init];
- [[LCTools getCurrentVC].navigationController pushViewController:fan animated:YES];
- }
- // 访客点击事件
- - (void)youpaifvisitBtnClick{
- YOUPAILCSeenVC* seen = [[YOUPAILCSeenVC alloc]init];
- [[LCTools getCurrentVC].navigationController pushViewController:seen animated:YES];
- }
- // 获赞点击事件
- - (void)youpaifliveBtnClick{
- YOUPAIZYVideoLikesVC* fan = [[YOUPAIZYVideoLikesVC alloc]init];
- [[LCTools getCurrentVC].navigationController pushViewController:fan animated:YES];
- }
- // 足迹点击事件
- - (void)youpaifvisitClick{
- YOUPAILCVisitVC* visitVC = [[YOUPAILCVisitVC alloc]init];
- [[LCTools getCurrentVC].navigationController pushViewController:visitVC animated:YES];
- }
- // 账户余额
- - (void)youpaifbalanceBtnClick{
- YOUPAIXRWalletVC *wallet = [[YOUPAIXRWalletVC alloc]init];
- [[LCTools getCurrentVC].navigationController pushViewController:wallet animated:YES];
- }
- // 我的收益
- - (void)youpaifprofitBtnClick{
- YOUPAILZProfitVC *rechargeVC = [[YOUPAILZProfitVC alloc]init];
- [[LCTools getCurrentVC].navigationController pushViewController:rechargeVC animated:YES];
- }
- @end
|