// // YOUPAIHROperationRecordCell.m // VQU // // Created by xiaohaoran on 2021/11/8. // Copyright © 2021 MS. All rights reserved. // #import "YOUPAIHROperationRecordCell.h" @interface YOUPAIHROperationRecordCell () @property(nonatomic,strong)UILabel *youpaiptypeLabel; @property(nonatomic,strong)UILabel *youpaipnickLabel; @property(nonatomic,strong)UILabel *youpaipnearLabel; @property(nonatomic,strong)UILabel *youpaiptimeLabel; @property(nonatomic,strong)UILabel *youpaipmessageLabel; @end @implementation YOUPAIHROperationRecordCell -(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{ if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { [self youpaifsetSubView]; } return self; } -(void)youpaifsetSubView{ //type UILabel *youpaiptypeLabel = [UILabel new]; self.youpaiptypeLabel = youpaiptypeLabel; [self.contentView addSubview:youpaiptypeLabel]; [youpaiptypeLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(14); make.top.mas_equalTo(14); make.size.mas_equalTo(CGSizeMake(32, 15)); }]; youpaiptypeLabel.textAlignment = NSTextAlignmentCenter; youpaiptypeLabel.textColor = [UIColor whiteColor]; youpaiptypeLabel.font = [UIFont systemFontOfSize:10]; youpaiptypeLabel.layer.cornerRadius = 7.5; youpaiptypeLabel.clipsToBounds = YES; //昵称 UILabel *youpaipnickLabel = [UILabel new]; self.youpaipnickLabel = youpaipnickLabel; [self.contentView addSubview:youpaipnickLabel]; [youpaipnickLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(youpaiptypeLabel.mas_right).offset(4); make.centerY.mas_equalTo(youpaiptypeLabel); }]; youpaipnickLabel.text = @"David Myers"; youpaipnickLabel.font = LCBoldFont(14); youpaipnickLabel.textColor = [UIColor whiteColor]; //年 UILabel *youpaipnearLabel = [UILabel new]; self.youpaipnearLabel = youpaipnearLabel; [self.contentView addSubview:youpaipnearLabel]; [youpaipnearLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.right.mas_equalTo(-14); make.centerY.mas_equalTo(youpaipnickLabel); }]; // youpaipnearLabel.text = @"2021-11-22"; 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(-14); make.top.mas_equalTo(youpaipnearLabel.mas_bottom).offset(12); }]; // youpaiptimeLabel.text = @"08:56"; youpaiptimeLabel.textColor = HexColorFromRGB(0x9F9DA5); youpaiptimeLabel.font =[UIFont systemFontOfSize:11]; //image UIImageView *im = [UIImageView new]; [self.contentView addSubview:im]; [im mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(14); make.top.mas_equalTo(youpaiptypeLabel.mas_bottom).offset(8); make.size.mas_equalTo(CGSizeMake(16, 16)); }]; im.image = [UIImage imageNamed:@"vqu_images_chatroom_record"]; //message UILabel *messageLabel = [UILabel new]; self.youpaipmessageLabel = messageLabel; [self.contentView addSubview:messageLabel]; [messageLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(im.mas_right).offset(4); make.centerY.mas_equalTo(im); }]; // messageLabel.text= @"设置房间密码为:1234"; messageLabel.textColor = HexColorFromRGB(0x9F9DA5); messageLabel.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:(YOUPAIHROperationRecordModel *)youpaipmodel { _youpaipmodel = youpaipmodel; //homeowner == 房主 host= 主持 manager = 管理 if ([youpaipmodel.youpaipmanager_identity isEqualToString:@"homeowner"]) { self.youpaiptypeLabel.text = @"房主"; self.youpaiptypeLabel.backgroundColor = HexColorFromRGB(0xDD5C7E); }else if ([youpaipmodel.youpaipmanager_identity isEqualToString:@"host"]){ self.youpaiptypeLabel.text = @"主持"; self.youpaiptypeLabel.backgroundColor = HexColorFromRGB(0xEA7B49); }else if ([youpaipmodel.youpaipmanager_identity isEqualToString:@"manager"]){ self.youpaiptypeLabel.text = @"管理"; self.youpaiptypeLabel.backgroundColor = HexColorFromRGB(0x3A80DB); }else if ([youpaipmodel.youpaipmanager_identity isEqualToString:@"super_manager"]){ self.youpaiptypeLabel.text = @"超管"; self.youpaiptypeLabel.backgroundColor = HexColorFromRGB(0xff3a3a); } self.youpaipnearLabel.text = youpaipmodel.youpaipcreate_time; self.youpaiptimeLabel.text = youpaipmodel.youpaipSF_time; self.youpaipnickLabel.text= youpaipmodel.youpaipnickname; NSString *str = youpaipmodel.youpaipdes; NSString *changeStr = youpaipmodel.youpaipop_user_name; NSRange rangeRmb=[str rangeOfString:[NSString stringWithFormat:@"%@", changeStr]]; NSMutableAttributedString *rmbStr=[[NSMutableAttributedString alloc] initWithString:str attributes:nil]; if ([[[UIDevice currentDevice] systemVersion] floatValue]>=6.0) { NSDictionary *fontDic=[NSDictionary dictionaryWithObjectsAndKeys:HexColorFromRGB(0xFFDB80),NSForegroundColorAttributeName,[UIFont systemFontOfSize:12],NSFontAttributeName, nil]; [rmbStr addAttributes:fontDic range:rangeRmb]; self.youpaipmessageLabel.attributedText = rmbStr; }else{ self.youpaipmessageLabel.text=rmbStr.string; } } @end