// // YOUPAIHRGuildCenterDetailCell.m // VQU // // Created by xiaohaoran on 2021/11/4. // Copyright © 2021 MS. All rights reserved. // #import "YOUPAIHRGuildCenterDetailCell.h" #import "YOUPAILZLevelView.h" @interface YOUPAIHRGuildCenterDetailCell () @property(nonatomic,strong)UIImageView *youpaipavatarImgV; @property(nonatomic,strong)UILabel * youpaipnicknameL; @property(nonatomic,strong)UIImageView *youpaipvipV; @property(nonatomic,strong)UIImageView *youpaipbadgeImgV; @property(nonatomic,strong)YOUPAILZLevelView *youpaiplevelView; @property(nonatomic,strong)UILabel *youpaipnearLabel; @property(nonatomic,strong)UILabel *youpaiptimeLabel; @property(nonatomic,strong)UILabel *youpaipIDLabel; @property(nonatomic,strong)UILabel *youpaiphuizhangLabel; @end @implementation YOUPAIHRGuildCenterDetailCell -(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{ if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { [self youpaifsetSubView]; } return self; } -(void)youpaifsetSubView{ //头像 UIImageView *youpaipavatarImgV = [[UIImageView alloc]init]; [self.contentView addSubview:youpaipavatarImgV]; self.youpaipavatarImgV = youpaipavatarImgV; [youpaipavatarImgV mas_makeConstraints:^(MASConstraintMaker *make) { make.left.offset(14.0f); make.centerY.mas_equalTo(0); make.size.mas_equalTo(CGSizeMake(40, 40));; }]; youpaipavatarImgV.layer.cornerRadius = 20; youpaipavatarImgV.layer.masksToBounds = YES; //V youpaipavatarImgV.userInteractionEnabled = YES; //会长 UILabel *youpaiphuizhangLabel = [UILabel new]; self.youpaiphuizhangLabel = youpaiphuizhangLabel; [self.contentView addSubview:youpaiphuizhangLabel]; [youpaiphuizhangLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(youpaipavatarImgV.mas_right).offset(8); make.top.mas_equalTo(youpaipavatarImgV).offset(3); make.size.mas_equalTo(CGSizeMake(32, 15)); }]; youpaiphuizhangLabel.textColor = [UIColor whiteColor]; youpaiphuizhangLabel.text = @"会长"; youpaiphuizhangLabel.font = [UIFont systemFontOfSize:10]; youpaiphuizhangLabel.textAlignment = NSTextAlignmentCenter; youpaiphuizhangLabel.backgroundColor = [UIColor colorWithPatternImage:[LCTools ColorImage:CGSizeMake(32, 15) FromColors:@[ZYGradientOneColor,ZYGradientTwoColor] ByGradientType:1]]; youpaiphuizhangLabel.layer.cornerRadius = 7.5; youpaiphuizhangLabel.layer.masksToBounds = YES; youpaiphuizhangLabel.hidden = YES; //昵称 UILabel *youpaipnicknameL = [[UILabel alloc] init]; youpaipnicknameL.font = LCBoldFont(14); youpaipnicknameL.textColor = [UIColor whiteColor]; [self.contentView addSubview:youpaipnicknameL]; self.youpaipnicknameL = youpaipnicknameL; [youpaipnicknameL mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(youpaiphuizhangLabel.mas_right).offset(4.0f); make.top.offset(10); make.height.offset(24.5f); }]; //Vip UIImageView *youpaipvipV = [[UIImageView alloc] init]; [self addSubview:youpaipvipV]; self.youpaipvipV = youpaipvipV; [youpaipvipV mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(youpaipnicknameL.mas_right).offset(3.0f); make.centerY.equalTo(youpaipnicknameL); }]; UIImageView *youpaipbadgeImgV = [[UIImageView alloc] init]; [self addSubview:youpaipbadgeImgV]; self.youpaipbadgeImgV = youpaipbadgeImgV; [youpaipbadgeImgV mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(youpaipvipV.mas_right).offset(3.0f); make.centerY.equalTo(youpaipnicknameL); }]; //等级 UIImageView *leveImgV = [[UIImageView alloc] init]; [self addSubview:leveImgV]; [leveImgV mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(youpaipbadgeImgV.mas_right).offset(3.0f); make.centerY.equalTo(youpaipnicknameL); }]; // YOUPAILZLevelView *youpaiplevelView = [[YOUPAILZLevelView alloc] init]; // [self addSubview:youpaiplevelView]; // self.youpaiplevelView = youpaiplevelView; // youpaiplevelView.hidden = YES; // [youpaiplevelView mas_makeConstraints:^(MASConstraintMaker *make) { // make.left.equalTo(youpaipnicknameL.mas_right).offset(3.0f); // make.centerY.equalTo(youpaipnicknameL); // }]; //年份月份 UILabel *youpaipnearLabel = [UILabel new]; self.youpaipnearLabel = youpaipnearLabel; [self.contentView addSubview:youpaipnearLabel]; [youpaipnearLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.right.mas_equalTo(-14); make.top.mas_equalTo(16.5); }]; youpaipnearLabel.textColor = HexColorFromRGB(0x9F9DA5); youpaipnearLabel.font = [UIFont systemFontOfSize:11]; //时分秒 UILabel *youpaiptimeLabel = [UILabel new]; self.youpaiptimeLabel = youpaiptimeLabel; [self.contentView addSubview:youpaiptimeLabel]; [youpaiptimeLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.right.mas_equalTo(youpaipnearLabel); make.top.mas_equalTo(youpaipnearLabel.mas_bottom).offset(12); }]; youpaiptimeLabel.textColor = HexColorFromRGB(0x9F9DA5); youpaiptimeLabel.font = [UIFont systemFontOfSize:11]; //id UILabel *youpaipIDLabel = [UILabel new]; self.youpaipIDLabel = youpaipIDLabel; [self.contentView addSubview:youpaipIDLabel]; [youpaipIDLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(youpaipavatarImgV.mas_right).offset(8); make.top.mas_equalTo(youpaipnicknameL.mas_bottom).offset(6); }]; youpaipIDLabel.textColor = HexColorFromRGB(0x9F9DA5); youpaipIDLabel.font = [UIFont systemFontOfSize:12]; //分割线 UIView *lineView = [UIView new]; [self.contentView addSubview:lineView]; [lineView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(14); make.right.mas_equalTo(-14); make.bottom.mas_equalTo(0); make.height.mas_equalTo(0.5); }]; lineView.backgroundColor = HexColorFromRGB(0x28262D); } -(void)setYoupaipmodel:(GuildMemberList *)youpaipmodel{ _youpaipmodel = youpaipmodel; [self.youpaipavatarImgV sd_setImageWithURL:[LCTools getImageUrlWithAddress:youpaipmodel.avatar] placeholderImage:nil]; self.youpaipnicknameL.text = youpaipmodel.nickname; self.youpaipIDLabel.text = [NSString stringWithFormat:@"花舞号:%@",youpaipmodel.usercode]; self.youpaipnearLabel.text = youpaipmodel.update_date; self.youpaiptimeLabel.text = youpaipmodel.update_time; CGFloat width = 0; if (youpaipmodel.nickname.length>5) { NSString *str = [youpaipmodel.nickname substringToIndex:5]; width = [LCTools widthWithString:str withFont:LCBoldFont(14)]+5; }else{ width = [LCTools widthWithString:youpaipmodel.nickname withFont:LCBoldFont(14)]+5; } self.youpaiphuizhangLabel.hidden = YES; if (youpaipmodel.isHuiZ) { self.youpaiphuizhangLabel.hidden = NO; [self.youpaipnicknameL mas_remakeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.youpaiphuizhangLabel.mas_right).offset(4.0f); make.top.offset(10); make.height.offset(24.5f); }]; }else{ [self.youpaipnicknameL mas_remakeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.youpaipavatarImgV.mas_right).offset(8.0f); make.top.offset(10); make.height.offset(24.5f); }]; } UIView *frontV; self.youpaiplevelView.hidden = NO; [self.youpaiplevelView youpaifreloadWithIcon:youpaipmodel.grade.youpaipimg1 iconWidth:youpaipmodel.grade.youpaipicon_width bgImg:youpaipmodel.grade.youpaipimg2 bgImgWidth:youpaipmodel.grade.youpaipicon1_width levelName:youpaipmodel.grade.youpaipgrade_name level:youpaipmodel.grade.youpaipgrade]; [self.youpaiplevelView mas_remakeConstraints:^(MASConstraintMaker *make) { if (frontV == nil) { make.left.equalTo(self.youpaipnicknameL.mas_right).offset(3.0f); }else{ make.left.equalTo(frontV.mas_right).offset(3.0f); } make.centerY.equalTo(self.youpaipnicknameL); make.size.mas_offset(self.youpaiplevelView.mj_size); }]; frontV = self.youpaiplevelView; if (self.youpaipmodel.vip_icon.length != 0) { self.youpaipvipV.hidden = NO; [self.youpaipvipV sd_setImageWithURL:[LCTools getImageUrlWithAddress:self.youpaipmodel.vip_icon]]; [self.youpaipvipV mas_remakeConstraints:^(MASConstraintMaker *make) { if (frontV == nil) { make.left.equalTo(self.youpaipnicknameL.mas_right).offset(3.0f); }else{ make.left.equalTo(frontV.mas_right).offset(3.0f); } make.centerY.equalTo(self.youpaipnicknameL); make.size.mas_offset(CGSizeMake(30.0f, 19.0f)); }]; frontV = self.youpaipvipV; } if (self.youpaipmodel.rankInfo.youpaipimg.length != 0) { self.youpaipbadgeImgV.hidden = NO; [self.youpaipbadgeImgV sd_setImageWithURL:[LCTools getImageUrlWithAddress:self.youpaipmodel.rankInfo.youpaipimg]]; [self.youpaipbadgeImgV mas_remakeConstraints:^(MASConstraintMaker *make) { if (frontV == nil) { make.left.equalTo(self.youpaipnicknameL.mas_right).offset(3.0f); }else{ make.left.equalTo(frontV.mas_right).offset(3.0f); } make.centerY.equalTo(self.youpaipnicknameL); make.size.mas_offset(CGSizeMake(20, 17.0f)); }]; } } @end