YOUPAIHRPersonnelManagementCell.m 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. //
  2. // YOUPAIHRPersonnelManagementCell.m
  3. // VQU
  4. //
  5. // Created by xiaohaoran on 2021/11/9.
  6. // Copyright © 2021 MS. All rights reserved.
  7. //
  8. #import "YOUPAIHRPersonnelManagementCell.h"
  9. @interface YOUPAIHRPersonnelManagementCell ()
  10. @property(nonatomic,strong)UIImageView *youpaipiconImageView;
  11. @property(nonatomic,strong)UILabel *youpaipnickLabel;
  12. @property(nonatomic,strong)UILabel *youpaipnickIDLabel;
  13. @property(nonatomic,strong)UIButton *youpaipjoinBtn;
  14. @property(nonatomic,strong)UILabel *youpaiptypeLabel;
  15. @end
  16. @implementation YOUPAIHRPersonnelManagementCell
  17. -(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
  18. if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
  19. [self youpaifsetupUI];
  20. }
  21. return self;
  22. }
  23. -(void)youpaifsetupUI{
  24. //icon
  25. UIImageView *youpaipiconImageView = [UIImageView new];
  26. self.youpaipiconImageView = youpaipiconImageView;
  27. [self.contentView addSubview:youpaipiconImageView];
  28. [youpaipiconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
  29. make.left.mas_equalTo(14);
  30. make.centerY.mas_equalTo(0);
  31. make.size.mas_equalTo(CGSizeMake(40, 40));
  32. }];
  33. youpaipiconImageView.contentMode = UIViewContentModeScaleAspectFill;
  34. youpaipiconImageView.layer.cornerRadius = 20;
  35. youpaipiconImageView.clipsToBounds = YES;
  36. //type
  37. UILabel *youpaiptypeLabel = [UILabel new];
  38. self.youpaiptypeLabel = youpaiptypeLabel;
  39. [self.contentView addSubview:youpaiptypeLabel];
  40. [youpaiptypeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  41. make.left.mas_equalTo(youpaipiconImageView.mas_right).offset(8);
  42. make.top.mas_equalTo(youpaipiconImageView).offset(5);
  43. make.size.mas_equalTo(CGSizeMake(32, 15));
  44. }];
  45. youpaiptypeLabel.textAlignment = NSTextAlignmentCenter;
  46. youpaiptypeLabel.textColor = [UIColor whiteColor];
  47. youpaiptypeLabel.font = [UIFont systemFontOfSize:10];
  48. youpaiptypeLabel.layer.cornerRadius = 7.5;
  49. youpaiptypeLabel.clipsToBounds = YES;
  50. //公会名称
  51. UILabel *youpaipnickLabel = [UILabel new];
  52. self.youpaipnickLabel = youpaipnickLabel;
  53. [self.contentView addSubview:youpaipnickLabel];
  54. [youpaipnickLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  55. make.left.mas_equalTo(youpaiptypeLabel.mas_right).offset(4);
  56. make.centerY.mas_equalTo(youpaiptypeLabel);
  57. }];
  58. youpaipnickLabel.font = LCBoldFont(14);
  59. youpaipnickLabel.textColor = [UIColor whiteColor];
  60. //公会ID
  61. UILabel *youpaipnickIDLabel = [UILabel new];
  62. self.youpaipnickIDLabel =youpaipnickIDLabel;
  63. [self.contentView addSubview:youpaipnickIDLabel];
  64. [youpaipnickIDLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  65. make.left.mas_equalTo(youpaipiconImageView.mas_right).offset(8);
  66. make.top.mas_equalTo(youpaipnickLabel.mas_bottom).offset(6);
  67. }];
  68. youpaipnickIDLabel.font = [UIFont systemFontOfSize:10];
  69. youpaipnickIDLabel.textColor = HexColorFromRGB(0x9F9DA5);
  70. //申请加入
  71. UIButton *youpaipjoinBtn = [UIButton new];
  72. self.youpaipjoinBtn = youpaipjoinBtn;
  73. [self.contentView addSubview:youpaipjoinBtn];
  74. [youpaipjoinBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  75. make.right.mas_equalTo(-14);
  76. make.centerY.mas_equalTo(0);
  77. make.size.mas_equalTo(CGSizeMake(56, 22));
  78. }];
  79. [youpaipjoinBtn setBackgroundImage:[LCTools ColorImage:CGSizeMake(56, 22) FromColors:@[ZYGradientOneColor,ZYGradientTwoColor] ByGradientType:1] forState:UIControlStateNormal];
  80. youpaipjoinBtn.layer.cornerRadius = 12;
  81. youpaipjoinBtn.layer.masksToBounds = YES;
  82. [youpaipjoinBtn setTitle:@"解绑" forState:UIControlStateNormal];
  83. [youpaipjoinBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  84. youpaipjoinBtn.titleLabel.font = [UIFont systemFontOfSize:12];
  85. //分割线
  86. UIView *lineView = [UIView new];
  87. [self.contentView addSubview:lineView];
  88. [lineView mas_makeConstraints:^(MASConstraintMaker *make) {
  89. make.left.mas_equalTo(14);
  90. make.right.mas_equalTo(-14);
  91. make.bottom.mas_equalTo(0);
  92. make.height.mas_equalTo(0.5);
  93. }];
  94. lineView.backgroundColor = HexColorFromRGB(0x28262D);
  95. //事件
  96. [youpaipjoinBtn addTarget:self action:@selector(youpaifjoinBtnClick) forControlEvents:UIControlEventTouchUpInside];
  97. }
  98. -(void)youpaifjoinBtnClick{
  99. if (self.youpaipdidClickBlock) {
  100. self.youpaipdidClickBlock(self.youpaipmodel);
  101. }
  102. }
  103. -(void)setYoupaipmodel:(YOUPAIHRPersonnelManagementModel *)youpaipmodel
  104. {
  105. _youpaipmodel =youpaipmodel;
  106. [self.youpaipiconImageView sd_setImageWithURL:[LCTools getImageUrlWithAddress:youpaipmodel.youpaipavatar] placeholderImage:nil];
  107. self.youpaipnickLabel.text = youpaipmodel.youpaipnickname;
  108. self.youpaipnickIDLabel.text = [NSString stringWithFormat:@"花舞号:%@",youpaipmodel.youpaipusercode];
  109. if ([youpaipmodel.youpaipidentity isEqualToString:@"homeowner"]) {
  110. self.youpaiptypeLabel.text = @"房主";
  111. self.youpaiptypeLabel.backgroundColor = HexColorFromRGB(0xDD5C7E);
  112. }else if ([youpaipmodel.youpaipidentity isEqualToString:@"host"]){
  113. self.youpaiptypeLabel.text = @"主持";
  114. self.youpaiptypeLabel.backgroundColor = HexColorFromRGB(0xEA7B49);
  115. }else if ([youpaipmodel.youpaipidentity isEqualToString:@"manager"]){
  116. self.youpaiptypeLabel.text = @"管理";
  117. self.youpaiptypeLabel.backgroundColor = HexColorFromRGB(0x3A80DB);
  118. }
  119. }
  120. @end