YOUPAIHRSubGuildDetailCell.m 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. //
  2. // YOUPAIHRSubGuildDetailCell.m
  3. // VQU
  4. //
  5. // Created by xiaohaoran on 2021/11/6.
  6. // Copyright © 2021 MS. All rights reserved.
  7. //
  8. #import "YOUPAIHRSubGuildDetailCell.h"
  9. @interface YOUPAIHRSubGuildDetailCell()
  10. @property(nonatomic,strong)UIImageView* youpaipavatarImgV;
  11. @property(nonatomic,strong)UILabel *youpaipnicknameL;
  12. @property(nonatomic,strong)UILabel* youpaiptimeLab;
  13. @property(nonatomic,strong)UILabel* youpaipvalueLab;
  14. @property(nonatomic,strong)UILabel* youpaipIDLab;
  15. @end
  16. @implementation YOUPAIHRSubGuildDetailCell
  17. - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
  18. if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
  19. self.selectionStyle = UITableViewCellSelectionStyleNone;
  20. self.backgroundColor = [UIColor clearColor];
  21. [self youpaifinitUI];
  22. }
  23. return self;
  24. }
  25. - (void)youpaifinitUI{
  26. UIView *bgV = [[UIView alloc] init];
  27. bgV.layer.cornerRadius = 5.0f;
  28. bgV.clipsToBounds = YES;
  29. bgV.backgroundColor = HexColorFromRGB(0x2A2935);
  30. [self.contentView addSubview:bgV];
  31. [bgV mas_makeConstraints:^(MASConstraintMaker *make) {
  32. make.left.offset(14.0f);
  33. make.top.offset(0.0f);
  34. make.right.offset(-14.0f);
  35. make.bottom.offset(-5.0f);
  36. }];
  37. self.youpaipavatarImgV = [[UIImageView alloc]init];
  38. self.youpaipavatarImgV.contentMode = UIViewContentModeScaleAspectFill;
  39. self.youpaipavatarImgV.layer.masksToBounds = YES;
  40. self.youpaipavatarImgV.layer.cornerRadius = 20;
  41. [bgV addSubview:self.youpaipavatarImgV];
  42. [self.youpaipavatarImgV makeConstraints:^(MASConstraintMaker *make) {
  43. make.left.equalTo(@12);
  44. make.centerY.equalTo(bgV);
  45. make.size.mas_equalTo(CGSizeMake(40, 40));
  46. }];
  47. UILabel* youpaipnicknameL = [[UILabel alloc]init];
  48. youpaipnicknameL.textColor = [UIColor whiteColor];
  49. youpaipnicknameL.font = LCFont14;
  50. [bgV addSubview:youpaipnicknameL];
  51. self.youpaipnicknameL = youpaipnicknameL;
  52. [youpaipnicknameL makeConstraints:^(MASConstraintMaker *make) {
  53. make.left.equalTo(self.youpaipavatarImgV.right).offset(@6);
  54. make.top.equalTo(self.youpaipavatarImgV.top).offset(@2);
  55. make.height.offset(14.0f);
  56. }];
  57. UILabel* youpaiptimeLab = [[UILabel alloc]init];
  58. youpaiptimeLab.textColor = HexColorFromRGB(0x999999);
  59. youpaiptimeLab.font = LCFont12;
  60. [bgV addSubview:youpaiptimeLab];
  61. self.youpaiptimeLab = youpaiptimeLab;
  62. [youpaiptimeLab makeConstraints:^(MASConstraintMaker *make) {
  63. make.left.equalTo(self.youpaipavatarImgV.right).offset(@4);
  64. make.top.equalTo(self.youpaipnicknameL.bottom).offset(@6);
  65. }];
  66. UILabel* youpaipvalueLab = [[UILabel alloc]init];
  67. youpaipvalueLab.textColor = HexColorFromRGB(0x5CFFC9);
  68. youpaipvalueLab.font = LCBoldFont(18);
  69. [bgV addSubview:youpaipvalueLab];
  70. self.youpaipvalueLab = youpaipvalueLab;
  71. [youpaipvalueLab makeConstraints:^(MASConstraintMaker *make) {
  72. make.right.offset(-14);
  73. make.top.equalTo(18);
  74. }];
  75. //id
  76. UILabel* youpaipIDLab = [[UILabel alloc]init];
  77. youpaipIDLab.textColor = HexColorFromRGB(0x9F9DA5);
  78. youpaipIDLab.font = [UIFont systemFontOfSize:11];
  79. [bgV addSubview:youpaipIDLab];
  80. self.youpaipIDLab = youpaipIDLab;
  81. [youpaipIDLab makeConstraints:^(MASConstraintMaker *make) {
  82. make.right.offset(-14);
  83. make.top.mas_equalTo(youpaipvalueLab.mas_bottom).offset(10);
  84. }];
  85. }
  86. - (void)setYoupaipbillModel:(listModel *)youpaipbillModel{
  87. _youpaipbillModel = youpaipbillModel;
  88. [self.youpaipavatarImgV sd_setImageWithURL:[LCTools getImageUrlWithAddress:youpaipbillModel.youpaipsend_avatar] placeholderImage:nil];
  89. self.youpaipnicknameL.text = youpaipbillModel.youpaiptype_name;
  90. NSString *keyName = @"赠送";
  91. NSString *name =youpaipbillModel.youpaipsend_nickname;
  92. NSString *string = [NSString stringWithFormat:@"%@%@%@%@ x%ld",name,keyName,youpaipbillModel.youpaipreceive_nickname,youpaipbillModel.youpaipgift_name,youpaipbillModel.youpaipgift_num];
  93. self.youpaiptimeLab.textColor = HexColorFromRGB(0xFFDB80);
  94. NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:string];
  95. NSRange range = NSMakeRange([[attributedString string] rangeOfString:keyName].location, keyName.length);
  96. [attributedString addAttribute:NSForegroundColorAttributeName value:HexColorFromRGB(0x999999) range:range];
  97. [self.youpaiptimeLab setAttributedText:attributedString];
  98. self.youpaipvalueLab.text = [NSString stringWithFormat:@"+%@",youpaipbillModel.youpaipchange_value];
  99. if ([youpaipbillModel.youpaiptype isEqualToString:@"room"]) {
  100. self.youpaipIDLab.text = [NSString stringWithFormat:@"ID:%ld",youpaipbillModel.youpaiptrack_id];
  101. }
  102. //头像 type //1充值 2提现 3视频 4礼物 5系统 6兑换 7私信
  103. // if (youpaipbillModel.type==5||youpaipbillModel.type==9||youpaipbillModel.type==10) {
  104. // self.youpaipavatarImgV.layer.cornerRadius = 0.0f;
  105. // self.youpaipavatarImgV.image = [UIImage imageNamed:@"vqu_images_appLogo"];
  106. // }else if (youpaipbillModel.type==1 || youpaipbillModel.type==2 || youpaipbillModel.type==6 ){
  107. // self.youpaipavatarImgV.layer.cornerRadius = 0.0f;
  108. // self.youpaipavatarImgV.image = [UIImage imageNamed:@"vqu_images_P_wallet"];
  109. // }else{
  110. // self.youpaipavatarImgV.layer.cornerRadius = 20.0f;
  111. // [self.youpaipavatarImgV sd_setImageWithURL:[LCTools getImageUrlWithAddress:youpaipbillModel.icon]];
  112. // }
  113. // //账户变动值
  114. // if (youpaipbillModel.change_value>0) {
  115. // if (youpaipbillModel.account_type==1||youpaipbillModel.account_type==2) {
  116. // self.youpaipvalueLab.attributedText = [LCTools setRichTextWithTitle:[NSString stringWithFormat:@"+%.2f",youpaipbillModel.change_value] subTitle:@"元" titleColor:[UIColor whiteColor] subTitleColor:[UIColor whiteColor] titleFontSize:18.0f subTitleFontSize:12.0f];
  117. // }else{
  118. // self.youpaipvalueLab.attributedText = [LCTools setRichTextWithTitle:[NSString stringWithFormat:@"+%.0f",youpaipbillModel.change_value] subTitle:@"钻石" titleColor:[UIColor whiteColor] subTitleColor:[UIColor whiteColor] titleFontSize:18.0f subTitleFontSize:12.0f];
  119. // }
  120. // }else{
  121. // if (youpaipbillModel.account_type==1||youpaipbillModel.account_type==2) {
  122. // self.youpaipvalueLab.attributedText = [LCTools setRichTextWithTitle:[NSString stringWithFormat:@"%.2f",youpaipbillModel.change_value] subTitle:@"元" titleColor:[UIColor whiteColor] subTitleColor:[UIColor whiteColor] titleFontSize:18.0f subTitleFontSize:12.0f];
  123. // }else{
  124. // self.youpaipvalueLab.attributedText = [LCTools setRichTextWithTitle:[NSString stringWithFormat:@"%.0f",youpaipbillModel.change_value] subTitle:@"钻石" titleColor:[UIColor whiteColor] subTitleColor:[UIColor whiteColor] titleFontSize:18.0f subTitleFontSize:12.0f];
  125. // }
  126. // }
  127. }
  128. @end