This commit is contained in:
启星
2025-11-21 16:17:05 +08:00
parent 7ac937ddbf
commit 8913ea6f48
283 changed files with 8474 additions and 800 deletions

View File

@@ -11,6 +11,7 @@ NS_ASSUME_NONNULL_BEGIN
@interface QXUserHomeHeaderView : UIView
@property (nonatomic,strong)QXUserHomeModel *model;
@property (nonatomic,strong)NSString *userId;
@end
@interface QXTagImageCell : UICollectionViewCell

View File

@@ -12,24 +12,35 @@
#import "NSString+QX.h"
#import "QXDynamicNetwork.h"
#import "QXChatViewController.h"
#import "CKShimmerLabel.h"
#import "QXUserCpDressView.h"
#import "QXUserCpCardView.h"
#import "QXGiftWallViewController.h"
#import "QXHeartBeatSpaceViewController.h"
@interface QXUserHomeHeaderView()<UICollectionViewDelegate,UICollectionViewDataSource>
//@property (nonatomic,strong) CKShimmerLabel * tempName;
@property (nonatomic,strong) QXSeatHeaderView* headerView;
@property (nonatomic,strong) UIView * whiteBgView;
@property (nonatomic,strong) UIView * grayBgView;
@property (nonatomic,strong) UILabel * nameLabel;
@property (nonatomic,strong) CKShimmerLabel * nameLabel;
@property (nonatomic,strong) UILabel * idLabel;
@property (nonatomic,strong) UILabel * ageLabel;
//@property (nonatomic,strong) UILabel * ageLabel;
@property (nonatomic,strong) UIImageView * guildBgImageView;
@property (nonatomic,strong) UILabel * guildLabel;
@property (nonatomic,strong) UICollectionView * collectionView;
@property (nonatomic,strong) NSMutableArray * tagArray;
@property (nonatomic,strong) UILabel *introduceLabel;
@property (nonatomic,strong) UICollectionView *inCollectionView;
@property (nonatomic, strong) UIImageView *useCodeImageView;
@property (nonatomic, strong)UIImageView *sexImageView;
//@property (nonatomic, strong)UIImageView *sexImageView;
@property (nonatomic,strong) UIButton *followBtn;
@property (nonatomic,strong) UIButton *playBtn;
@property (nonatomic,strong) QXUserCpDressView *cpDressView;
@property (nonatomic,strong) QXUserCpCardView *cpCardView;
@property (nonatomic,strong) UIButton *giftWallBtn;
@end
@implementation QXUserHomeHeaderView
@@ -45,8 +56,8 @@
-(void)initSubviews{
self.backgroundColor = [UIColor clearColor];
self.headerView = [[QXSeatHeaderView alloc] initWithFrame:CGRectMake(32, 26, 70, 84)];
self.headerView = [[QXSeatHeaderView alloc] initWithFrame:CGRectMake(32, 46, 70, 70)];
[self.headerView addRoundedCornersWithRadius:35];
[self addSubview:self.headerView];
[self.headerView mas_makeConstraints:^(MASConstraintMaker *make) {
@@ -56,34 +67,59 @@
make.top.mas_equalTo(26);
}];
self.nameLabel = [[UILabel alloc] init];
self.nameLabel = [[CKShimmerLabel alloc] initWithFrame:CGRectMake(32, self.headerView.bottom+4, 200, 24)];
// self.nameLabel.text = @"羽声语音";
self.nameLabel.shimmerWidth = 20;
self.nameLabel.shimmerRadius = 20;
self.nameLabel.durationTime = 1;
self.nameLabel.repeat = YES;
self.nameLabel.textColor = QXConfig.textColor;
self.nameLabel.font = [UIFont boldSystemFontOfSize:16];
// self.nameLabel.shimmerColor = [UIColor yellowColor];
self.nameLabel.font = [UIFont boldSystemFontOfSize:18];
// [self.nameLabel startShimmer];
[self addSubview:self.nameLabel];
[self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.headerView);
make.height.mas_equalTo(24);
make.top.equalTo(self.headerView.mas_bottom).offset(4);
make.width.mas_greaterThanOrEqualTo(200);
}];
self.sexImageView = [[UIImageView alloc] init];
[self addSubview:self.sexImageView];
[self.sexImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.nameLabel.mas_right).offset(5);
self.followBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.playBtn.left-6-91, self.whiteBgView.top+10, 91, 12)];
[self.followBtn setTitle:QXText(@"关注") forState:(UIControlStateNormal)];
[self.followBtn setTitle:QXText(@"已关注") forState:(UIControlStateSelected)];
[self.followBtn setTitleColor:QXConfig.btnTextColor forState:(UIControlStateNormal)];
[self.followBtn setTitleColor:RGB16(0x999999) forState:(UIControlStateSelected)];
[self.followBtn setBackgroundImage:[UIImage imageWithColor:QXConfig.themeColor] forState:UIControlStateNormal];
[self.followBtn setBackgroundImage:[UIImage imageWithColor:RGB16(0xF1F2F3)] forState:UIControlStateSelected];
self.followBtn.titleLabel.font = [UIFont systemFontOfSize:14];
[self.followBtn addRoundedCornersWithRadius:12];
self.followBtn.hidden = YES;
[self.followBtn addTarget:self action:@selector(followAction) forControlEvents:(UIControlEventTouchUpInside)];
[self addSubview:self.followBtn];
[self.followBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.nameLabel.mas_right).offset(10);
make.width.mas_equalTo(55);
make.height.mas_equalTo(24);
make.centerY.equalTo(self.nameLabel);
make.height.width.mas_equalTo(16);
}];
// self.sexImageView = [[UIImageView alloc] init];
// [self addSubview:self.sexImageView];
// [self.sexImageView mas_makeConstraints:^(MASConstraintMaker *make) {
// make.left.equalTo(self.nameLabel.mas_right).offset(5);
// make.centerY.equalTo(self.nameLabel);
// make.height.width.mas_equalTo(16);
// }];
self.idLabel = [[UILabel alloc] init];
self.idLabel.textColor = RGB16(0x999999);
self.idLabel.font = [UIFont boldSystemFontOfSize:12];
[self addSubview:self.idLabel];
[self.idLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.sexImageView.mas_right).offset(12);
make.height.mas_equalTo(24);
make.centerY.equalTo(self.nameLabel);
make.left.equalTo(self.nameLabel);
make.height.mas_equalTo(18);
make.top.equalTo(self.nameLabel.mas_bottom).offset(5);
}];
self.useCodeImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"mine_usercode_isLiang"]];
@@ -96,16 +132,16 @@
make.centerY.equalTo(self.idLabel);
}];
self.ageLabel = [[UILabel alloc] init];
self.ageLabel.textColor = RGB16(0x999999);
self.ageLabel.font = [UIFont boldSystemFontOfSize:12];
[self addSubview:self.ageLabel];
[self.ageLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.headerView);
make.height.mas_equalTo(18);
make.top.equalTo(self.nameLabel.mas_bottom).offset(8);
make.width.mas_greaterThanOrEqualTo(35);
}];
// self.ageLabel = [[UILabel alloc] init];
// self.ageLabel.textColor = RGB16(0x999999);
// self.ageLabel.font = [UIFont boldSystemFontOfSize:12];
// [self addSubview:self.ageLabel];
// [self.ageLabel mas_makeConstraints:^(MASConstraintMaker *make) {
// make.left.equalTo(self.headerView);
// make.height.mas_equalTo(18);
// make.top.equalTo(self.nameLabel.mas_bottom).offset(8);
// make.width.mas_greaterThanOrEqualTo(35);
// }];
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
layout.itemSize = CGSizeMake(UserIconWidth, UserIconHeight);
@@ -118,25 +154,13 @@
[self.collectionView registerClass:[QXTagImageCell class] forCellWithReuseIdentifier:@"QXTagImageCell"];
[self addSubview:self.collectionView];
[self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.ageLabel.mas_right).offset(8);
make.left.equalTo(self.nameLabel);
make.height.mas_equalTo(18);
make.centerY.equalTo(self.ageLabel);
make.width.mas_equalTo(300);
make.top.equalTo(self.idLabel.mas_bottom).offset(5);
make.width.mas_equalTo(ScaleWidth(240));
}];
self.guildLabel = [[UILabel alloc] init];
self.guildLabel.textColor = RGB16(0x999999);
self.guildLabel.text = @"所属公会";
self.guildLabel.font = [UIFont boldSystemFontOfSize:12];
[self addSubview:self.guildLabel];
[self.guildLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.headerView);
make.height.mas_equalTo(18);
make.top.equalTo(self.ageLabel.mas_bottom).offset(8);
make.width.mas_greaterThanOrEqualTo(35);
}];
self.introduceLabel = [[UILabel alloc] init];
self.introduceLabel.textColor = QXConfig.textColor;
self.introduceLabel.font = [UIFont systemFontOfSize:14];
@@ -144,9 +168,9 @@
[self addSubview:self.introduceLabel];
[self.introduceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.headerView);
make.top.equalTo(self.guildLabel.mas_bottom).offset(4);
make.top.equalTo(self.collectionView.mas_bottom).offset(6);
make.width.mas_equalTo(SCREEN_WIDTH-64);
make.height.mas_greaterThanOrEqualTo(22);
make.height.mas_greaterThanOrEqualTo(17);
}];
UICollectionViewFlowLayout *inlayout = [[UICollectionViewFlowLayout alloc] init];
@@ -164,70 +188,113 @@
make.left.equalTo(self.headerView);
make.height.mas_equalTo(22);
make.top.equalTo(self.introduceLabel.mas_bottom).offset(4);
make.width.mas_equalTo(SCREEN_WIDTH-64);
make.right.mas_equalTo(-32);
}];
self.whiteBgView = [[UIView alloc] initWithFrame:CGRectMake(0, 46, self.width, 167)];
self.whiteBgView.backgroundColor = [UIColor whiteColor];
self.whiteBgView.backgroundColor = RGB16(0xffffff);
[self.whiteBgView addRoundedCornersWithRadius:16];
[self insertSubview:self.whiteBgView belowSubview:self.headerView];
[self.whiteBgView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(16);
make.width.mas_equalTo(SCREEN_WIDTH-32);
make.left.mas_equalTo(0);
make.right.mas_equalTo(0);
make.top.equalTo(self.headerView.mas_top).offset(20);
make.bottom.equalTo(self);
make.bottom.equalTo(self.inCollectionView).offset(10);
}];
self.guildBgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"user_home_guild_bg"]];
[self.whiteBgView addSubview:self.guildBgImageView];
[self.guildBgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(-8);
make.height.mas_equalTo(31);
make.top.mas_equalTo(6);
make.width.mas_equalTo(94);
}];
self.guildLabel = [[UILabel alloc] init];
self.guildLabel.textColor = RGB16(0xffffff);
self.guildLabel.textAlignment = NSTextAlignmentCenter;
self.guildLabel.lineBreakMode = NSLineBreakByClipping;
self.guildLabel.font = [UIFont boldSystemFontOfSize:10];
[self.whiteBgView addSubview:self.guildLabel];
[self.guildLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.guildBgImageView).offset(6);
make.height.mas_equalTo(14);
make.top.equalTo(self.guildBgImageView).offset(6);
make.right.equalTo(self.guildBgImageView).offset(-28);
}];
self.grayBgView = [[UIView alloc] initWithFrame:CGRectMake(0, self.whiteBgView.top+75, self.width, 92)];
self.grayBgView.backgroundColor = RGB16(0xF6F6F6);
[self.grayBgView addRoundedCornersWithRadius:16 byRoundingCorners:(UIRectCornerTopLeft|UIRectCornerTopRight)];
self.grayBgView.backgroundColor = RGB16(0xF3F3F3);
// [self.grayBgView addRoundedCornersWithRadius:16 byRoundingCorners:(UIRectCornerTopLeft|UIRectCornerTopRight)];
[self insertSubview:self.grayBgView belowSubview:self.whiteBgView];
[self.grayBgView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(self);
make.height.mas_equalTo(92);
make.bottom.equalTo(self.whiteBgView);
make.top.equalTo(self.whiteBgView).offset(16);
make.bottom.equalTo(self);
}];
self.playBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.playBtn.left-6-91, self.whiteBgView.top+10, 91, 35)];
self.playBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.playBtn.left-6-91, self.whiteBgView.top+10, 91, 24)];
// [self.playBtn setTitle:QXText(@"私信") forState:(UIControlStateNormal)];
// [self.playBtn setTitleColor:UIColor.whiteColor forState:(UIControlStateNormal)];
// self.playBtn.backgroundColor = RGB16(0x333333);
self.playBtn.hidden = YES;
self.playBtn.titleLabel.font = [UIFont systemFontOfSize:14];
[self.playBtn addRoundedCornersWithRadius:17.5];
[self.playBtn addRoundedCornersWithRadius:12];
[self.playBtn addTarget:self action:@selector(playAction) forControlEvents:(UIControlEventTouchUpInside)];
[self addSubview:self.playBtn];
[self.whiteBgView addSubview:self.playBtn];
[self.playBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(-27);
make.width.mas_equalTo(91);
make.height.mas_equalTo(35);
make.top.equalTo(self.whiteBgView).offset(10);
make.right.equalTo(self.guildBgImageView.mas_left).offset(-6);
make.width.mas_equalTo(59);
make.height.mas_equalTo(24);
make.centerY.equalTo(self.guildBgImageView).offset(-2);
}];
self.followBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.playBtn.left-6-91, self.whiteBgView.top+10, 91, 35)];
[self.followBtn setTitle:QXText(@"关注") forState:(UIControlStateNormal)];
[self.followBtn setTitle:QXText(@"已关注") forState:(UIControlStateSelected)];
[self.followBtn setTitleColor:QXConfig.btnTextColor forState:(UIControlStateNormal)];
[self.followBtn setTitleColor:RGB16(0x999999) forState:(UIControlStateSelected)];
[self.followBtn setBackgroundImage:[UIImage imageWithColor:QXConfig.themeColor] forState:UIControlStateNormal];
[self.followBtn setBackgroundImage:[UIImage imageWithColor:RGB16(0xF1F2F3)] forState:UIControlStateSelected];
self.followBtn.titleLabel.font = [UIFont systemFontOfSize:14];
[self.followBtn addRoundedCornersWithRadius:17.5];
self.followBtn.hidden = YES;
[self.followBtn addTarget:self action:@selector(followAction) forControlEvents:(UIControlEventTouchUpInside)];
[self addSubview:self.followBtn];
[self.followBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.playBtn.mas_left).offset(-6);
make.width.mas_equalTo(91);
make.height.mas_equalTo(35);
make.centerY.equalTo(self.playBtn);
}];
// self.nameLabel.text = @"张三";
// self.idLabel.text = @"313213213";
// self.ageLabel.text = @"36岁";
// self.introduceLabel.text = @"个人简介个人简介个人简介个人简个人简介";
[self.inCollectionView reloadData];
self.cpDressView = [[QXUserCpDressView alloc] initWithFrame:CGRectMake(self.width-15-ScaleWidth(120), 0, ScaleWidth(120), ScaleWidth(194))];
self.cpDressView.hidden = YES;
[self.whiteBgView addSubview:self.cpDressView];
self.cpCardView = [[QXUserCpCardView alloc] init];
self.cpCardView.hidden = YES;
MJWeakSelf
[self.cpCardView addTapBlock:^(id _Nonnull obj) {
QXHeartBeatSpaceViewController*vc = [[QXHeartBeatSpaceViewController alloc] init];
vc.userId = weakSelf.userId;
[weakSelf.viewController.navigationController pushViewController:vc animated:YES];
}];
[self addSubview:self.cpCardView];
[self.cpCardView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(17);
make.right.mas_equalTo(-17);
make.top.equalTo(self.whiteBgView.mas_bottom).offset(14);
make.height.mas_equalTo(ScaleWidth(100));
}];
self.giftWallBtn = [[UIButton alloc] init];
[self.giftWallBtn addTarget:self action:@selector(giftWallAction) forControlEvents:(UIControlEventTouchUpInside)];
[self.giftWallBtn setBackgroundImage:[UIImage imageNamed:@"user_home_gift_wall"] forState:(UIControlStateNormal)];
[self addSubview:self.giftWallBtn];
[self.giftWallBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(17);
make.right.mas_equalTo(-17);
make.height.mas_equalTo(ScaleWidth(40));
make.top.equalTo(self.cpCardView.mas_bottom).offset(8);
}];
}
-(void)giftWallAction{
QXGiftWallViewController *vc = [[QXGiftWallViewController alloc] init];
vc.userId = self.userId;
[self.viewController.navigationController pushViewController:vc animated:YES];
}
-(void)followAction{
@@ -270,16 +337,60 @@
}
-(void)setModel:(QXUserHomeModel *)model{
_model = model;
// model.nickname = @"大家好撒客户端撒大厦尽快";
// self.tempName.text = model.nickname;
[self.headerView setHeadIcon:model.avatar dress:model.dress];
[self.headerView.nobilityImageView sd_setImageWithURL:[NSURL URLWithString:model.nobility_image]];
self.nameLabel.text = model.nickname;
if ([model.nickname_color isExist]) {
self.nameLabel.textColor = [UIColor colorWithHexString:model.nickname_color];
self.nameLabel.shimmerColor = [UIColor colorWithHexString:model.nickname_color];
[self.nameLabel startShimmer];
// self.tempName.shimmerColor = UIColor.redColor;
// [self.tempName startShimmer];
}else{
self.nameLabel.textColor = QXConfig.textColor;
[self.nameLabel stopShimmer];
}
self.idLabel.text = [NSString stringWithFormat:@"ID:%@",model.user_code];
self.ageLabel.text = [NSString stringWithFormat:@"%@|%ld岁",model.sex.intValue==1?QXText(@"男"):QXText(@"女"),[model.birthday ageWithDateOfBirth]];
self.nameLabel.text = model.nickname;
[self.nameLabel.contentLabel sizeToFit];
[self.nameLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.headerView);
make.height.mas_equalTo(24);
make.top.equalTo(self.headerView.mas_bottom).offset(4);
make.width.mas_equalTo(self.nameLabel.contentLabel.width);
}];
if (model.cp_info != nil) {
self.cpDressView.hidden = NO;
self.cpCardView.hidden = NO;
self.cpDressView.model = model.cp_info;
self.cpCardView.model = model.cp_info;
[self.giftWallBtn mas_remakeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(17);
make.right.mas_equalTo(-17);
make.height.mas_equalTo(ScaleWidth(40));
make.top.equalTo(self.cpCardView.mas_bottom).offset(8);
}];
}else{
self.cpDressView.hidden = YES;
self.cpCardView.hidden = YES;
[self.giftWallBtn mas_remakeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(17);
make.right.mas_equalTo(-17);
make.height.mas_equalTo(ScaleWidth(40));
make.top.equalTo(self.whiteBgView.mas_bottom).offset(8);
}];
}
// self.tempName.text = model.nickname;
// [self.tempName.contentLabel sizeToFit];
// [self.tempName mas_remakeConstraints:^(MASConstraintMaker *make) {
// make.top.left.mas_equalTo(0);
// make.height.mas_equalTo(24);
// make.width.mas_equalTo(self.tempName.contentLabel.width);
// }];
// self.tempName.text = model.nickname;
// self.idLabel.text = [NSString stringWithFormat:@"ID:%@",model.user_code];
self.idLabel.text = [NSString stringWithFormat:@"%@|%ld岁 ID:%@",model.sex.intValue==1?QXText(@"男"):QXText(@"女"),[model.birthday ageWithDateOfBirth],model.user_code];
self.introduceLabel.text = model.profile;
[self.inCollectionView reloadData];
[self.collectionView reloadData];
@@ -299,17 +410,17 @@
}
}
if ([model.guild isExist]) {
self.guildLabel.text = [NSString stringWithFormat:@"所属公会:%@",model.guild];
self.guildLabel.text = model.guild;
}else{
self.guildLabel.text = [NSString stringWithFormat:@"所属公会:%@",@"无"];
self.guildLabel.text = @"无";
}
if (model.is_use_code.intValue == 1) {
self.useCodeImageView.hidden = NO;
}else{
self.useCodeImageView.hidden = YES;
}
UIImage *sexImage = [UIImage imageNamed:model.sex.intValue==1?@"user_sex_boy":@"user_sex_girl"];
self.sexImageView.image = sexImage;
// UIImage *sexImage = [UIImage imageNamed:model.sex.intValue==1?@"user_sex_boy":@"user_sex_girl"];
// self.sexImageView.image = sexImage;
}
-(NSMutableArray *)tagArray{