// // YOUPAIHRSubGuildDetailCell.m // VQU // // Created by xiaohaoran on 2021/11/6. // Copyright © 2021 MS. All rights reserved. // #import "YOUPAIHRSubGuildDetailCell.h" @interface YOUPAIHRSubGuildDetailCell() @property(nonatomic,strong)UIImageView* youpaipavatarImgV; @property(nonatomic,strong)UILabel *youpaipnicknameL; @property(nonatomic,strong)UILabel* youpaiptimeLab; @property(nonatomic,strong)UILabel* youpaipvalueLab; @property(nonatomic,strong)UILabel* youpaipIDLab; @end @implementation YOUPAIHRSubGuildDetailCell - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{ if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { self.selectionStyle = UITableViewCellSelectionStyleNone; self.backgroundColor = [UIColor clearColor]; [self youpaifinitUI]; } return self; } - (void)youpaifinitUI{ UIView *bgV = [[UIView alloc] init]; bgV.layer.cornerRadius = 5.0f; bgV.clipsToBounds = YES; bgV.backgroundColor = HexColorFromRGB(0x2A2935); [self.contentView addSubview:bgV]; [bgV mas_makeConstraints:^(MASConstraintMaker *make) { make.left.offset(14.0f); make.top.offset(0.0f); make.right.offset(-14.0f); make.bottom.offset(-5.0f); }]; self.youpaipavatarImgV = [[UIImageView alloc]init]; self.youpaipavatarImgV.contentMode = UIViewContentModeScaleAspectFill; self.youpaipavatarImgV.layer.masksToBounds = YES; self.youpaipavatarImgV.layer.cornerRadius = 20; [bgV addSubview:self.youpaipavatarImgV]; [self.youpaipavatarImgV makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(@12); make.centerY.equalTo(bgV); make.size.mas_equalTo(CGSizeMake(40, 40)); }]; UILabel* youpaipnicknameL = [[UILabel alloc]init]; youpaipnicknameL.textColor = [UIColor whiteColor]; youpaipnicknameL.font = LCFont14; [bgV addSubview:youpaipnicknameL]; self.youpaipnicknameL = youpaipnicknameL; [youpaipnicknameL makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.youpaipavatarImgV.right).offset(@6); make.top.equalTo(self.youpaipavatarImgV.top).offset(@2); make.height.offset(14.0f); }]; UILabel* youpaiptimeLab = [[UILabel alloc]init]; youpaiptimeLab.textColor = HexColorFromRGB(0x999999); youpaiptimeLab.font = LCFont12; [bgV addSubview:youpaiptimeLab]; self.youpaiptimeLab = youpaiptimeLab; [youpaiptimeLab makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.youpaipavatarImgV.right).offset(@4); make.top.equalTo(self.youpaipnicknameL.bottom).offset(@6); }]; UILabel* youpaipvalueLab = [[UILabel alloc]init]; youpaipvalueLab.textColor = HexColorFromRGB(0x5CFFC9); youpaipvalueLab.font = LCBoldFont(18); [bgV addSubview:youpaipvalueLab]; self.youpaipvalueLab = youpaipvalueLab; [youpaipvalueLab makeConstraints:^(MASConstraintMaker *make) { make.right.offset(-14); make.top.equalTo(18); }]; //id UILabel* youpaipIDLab = [[UILabel alloc]init]; youpaipIDLab.textColor = HexColorFromRGB(0x9F9DA5); youpaipIDLab.font = [UIFont systemFontOfSize:11]; [bgV addSubview:youpaipIDLab]; self.youpaipIDLab = youpaipIDLab; [youpaipIDLab makeConstraints:^(MASConstraintMaker *make) { make.right.offset(-14); make.top.mas_equalTo(youpaipvalueLab.mas_bottom).offset(10); }]; } - (void)setYoupaipbillModel:(listModel *)youpaipbillModel{ _youpaipbillModel = youpaipbillModel; [self.youpaipavatarImgV sd_setImageWithURL:[LCTools getImageUrlWithAddress:youpaipbillModel.youpaipsend_avatar] placeholderImage:nil]; self.youpaipnicknameL.text = youpaipbillModel.youpaiptype_name; NSString *keyName = @"赠送"; NSString *name =youpaipbillModel.youpaipsend_nickname; NSString *string = [NSString stringWithFormat:@"%@%@%@%@ x%ld",name,keyName,youpaipbillModel.youpaipreceive_nickname,youpaipbillModel.youpaipgift_name,youpaipbillModel.youpaipgift_num]; self.youpaiptimeLab.textColor = HexColorFromRGB(0xFFDB80); NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:string]; NSRange range = NSMakeRange([[attributedString string] rangeOfString:keyName].location, keyName.length); [attributedString addAttribute:NSForegroundColorAttributeName value:HexColorFromRGB(0x999999) range:range]; [self.youpaiptimeLab setAttributedText:attributedString]; self.youpaipvalueLab.text = [NSString stringWithFormat:@"+%@",youpaipbillModel.youpaipchange_value]; if ([youpaipbillModel.youpaiptype isEqualToString:@"room"]) { self.youpaipIDLab.text = [NSString stringWithFormat:@"ID:%ld",youpaipbillModel.youpaiptrack_id]; } //头像 type //1充值 2提现 3视频 4礼物 5系统 6兑换 7私信 // if (youpaipbillModel.type==5||youpaipbillModel.type==9||youpaipbillModel.type==10) { // self.youpaipavatarImgV.layer.cornerRadius = 0.0f; // self.youpaipavatarImgV.image = [UIImage imageNamed:@"vqu_images_appLogo"]; // }else if (youpaipbillModel.type==1 || youpaipbillModel.type==2 || youpaipbillModel.type==6 ){ // self.youpaipavatarImgV.layer.cornerRadius = 0.0f; // self.youpaipavatarImgV.image = [UIImage imageNamed:@"vqu_images_P_wallet"]; // }else{ // self.youpaipavatarImgV.layer.cornerRadius = 20.0f; // [self.youpaipavatarImgV sd_setImageWithURL:[LCTools getImageUrlWithAddress:youpaipbillModel.icon]]; // } // //账户变动值 // if (youpaipbillModel.change_value>0) { // if (youpaipbillModel.account_type==1||youpaipbillModel.account_type==2) { // self.youpaipvalueLab.attributedText = [LCTools setRichTextWithTitle:[NSString stringWithFormat:@"+%.2f",youpaipbillModel.change_value] subTitle:@"元" titleColor:[UIColor whiteColor] subTitleColor:[UIColor whiteColor] titleFontSize:18.0f subTitleFontSize:12.0f]; // }else{ // self.youpaipvalueLab.attributedText = [LCTools setRichTextWithTitle:[NSString stringWithFormat:@"+%.0f",youpaipbillModel.change_value] subTitle:@"钻石" titleColor:[UIColor whiteColor] subTitleColor:[UIColor whiteColor] titleFontSize:18.0f subTitleFontSize:12.0f]; // } // }else{ // if (youpaipbillModel.account_type==1||youpaipbillModel.account_type==2) { // self.youpaipvalueLab.attributedText = [LCTools setRichTextWithTitle:[NSString stringWithFormat:@"%.2f",youpaipbillModel.change_value] subTitle:@"元" titleColor:[UIColor whiteColor] subTitleColor:[UIColor whiteColor] titleFontSize:18.0f subTitleFontSize:12.0f]; // }else{ // self.youpaipvalueLab.attributedText = [LCTools setRichTextWithTitle:[NSString stringWithFormat:@"%.0f",youpaipbillModel.change_value] subTitle:@"钻石" titleColor:[UIColor whiteColor] subTitleColor:[UIColor whiteColor] titleFontSize:18.0f subTitleFontSize:12.0f]; // } // } } @end