YOUPAIHRGuildCenterSearchCell.m 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. //
  2. // YOUPAIHRGuildCenterSearchCell.m
  3. // VQU
  4. //
  5. // Created by xiaohaoran on 2021/11/4.
  6. // Copyright © 2021 MS. All rights reserved.
  7. //
  8. #import "YOUPAIHRGuildCenterSearchCell.h"
  9. @interface YOUPAIHRGuildCenterSearchCell ()
  10. @end
  11. @implementation YOUPAIHRGuildCenterSearchCell
  12. -(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
  13. if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
  14. [self youpaifsetupUI];
  15. }
  16. return self;
  17. }
  18. -(void)youpaifsetupUI{
  19. //icon
  20. UIImageView *youpaipiconImageView = [UIImageView new];
  21. self.youpaipiconImageView = youpaipiconImageView;
  22. [self.contentView addSubview:youpaipiconImageView];
  23. [youpaipiconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
  24. make.left.mas_equalTo(14);
  25. make.centerY.mas_equalTo(0);
  26. make.size.mas_equalTo(CGSizeMake(40, 40));
  27. }];
  28. youpaipiconImageView.layer.cornerRadius = 20;
  29. youpaipiconImageView.layer.masksToBounds = YES;
  30. //公会名称
  31. UILabel *youpaipnickLabel = [UILabel new];
  32. self.youpaipnickLabel = youpaipnickLabel;
  33. [self.contentView addSubview:youpaipnickLabel];
  34. [youpaipnickLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  35. make.left.mas_equalTo(youpaipiconImageView.mas_right).offset(8);
  36. make.top.mas_equalTo(youpaipiconImageView).offset(5);
  37. }];
  38. youpaipnickLabel.font = LCBoldFont(14);
  39. youpaipnickLabel.textColor = [UIColor whiteColor];
  40. //公会ID
  41. UILabel *youpaipnickIDLabel = [UILabel new];
  42. self.youpaipnickIDLabel = youpaipnickIDLabel;
  43. [self.contentView addSubview:youpaipnickIDLabel];
  44. [youpaipnickIDLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  45. make.left.mas_equalTo(youpaipiconImageView.mas_right).offset(8);
  46. make.top.mas_equalTo(youpaipnickLabel.mas_bottom).offset(6);
  47. }];
  48. youpaipnickIDLabel.font = [UIFont systemFontOfSize:10];
  49. youpaipnickIDLabel.textColor = HexColorFromRGB(0x9F9DA5);
  50. //申请加入
  51. UIButton *youpaipjoinBtn = [UIButton new];
  52. self.youpaipjoinBtn =youpaipjoinBtn;
  53. [self.contentView addSubview:youpaipjoinBtn];
  54. [youpaipjoinBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  55. make.right.mas_equalTo(-14);
  56. make.centerY.mas_equalTo(0);
  57. make.size.mas_equalTo(CGSizeMake(64, 22));
  58. }];
  59. youpaipjoinBtn.layer.cornerRadius = 12;
  60. youpaipjoinBtn.layer.masksToBounds = YES;
  61. [youpaipjoinBtn setTitle:@"申请加入" forState:UIControlStateNormal];
  62. [youpaipjoinBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  63. youpaipjoinBtn.titleLabel.font = [UIFont systemFontOfSize:12];
  64. //分割线
  65. UIView *lineView = [UIView new];
  66. [self.contentView addSubview:lineView];
  67. [lineView mas_makeConstraints:^(MASConstraintMaker *make) {
  68. make.left.mas_equalTo(14);
  69. make.right.mas_equalTo(-14);
  70. make.bottom.mas_equalTo(0);
  71. make.height.mas_equalTo(0.5);
  72. }];
  73. lineView.backgroundColor = HexColorFromRGB(0x28262D);
  74. }
  75. -(void)setYoupaipmodel:(YOUPAIHRGuildCenterSearchModel *)youpaipmodel{
  76. _youpaipmodel = youpaipmodel;
  77. [self.youpaipiconImageView sd_setImageWithURL:[LCTools getImageUrlWithAddress:youpaipmodel.youpaipimg] placeholderImage:nil];
  78. self.youpaipnickLabel.text = youpaipmodel.youpaipname;
  79. self.youpaipnickIDLabel.text = [NSString stringWithFormat:@"公会ID%ld",youpaipmodel.youpaipguild_number];
  80. if (youpaipmodel.youpaipstatusType ==Status1_notJoin) {
  81. [self.youpaipjoinBtn setTitle:@"申请加入" forState:UIControlStateNormal];
  82. [self.youpaipjoinBtn setBackgroundImage:[LCTools ColorImage:CGSizeMake(64, 22) FromColors:@[ZYGradientOneColor,ZYGradientTwoColor] ByGradientType:1] forState:UIControlStateNormal];
  83. [self.youpaipjoinBtn addTarget:self action:@selector(youpaifjoinBtnClick) forControlEvents:UIControlEventTouchUpInside];
  84. }else if (youpaipmodel.youpaipstatusType ==Status2_wait_check){
  85. [self.youpaipjoinBtn setTitle:@"等待审核" forState:UIControlStateNormal];
  86. [self.youpaipjoinBtn setBackgroundImage:[LCTools ColorImage:CGSizeMake(64, 22) FromColors:@[HexColorFromRGB(0x4F4B5B),HexColorFromRGB(0x4F4B5B)] ByGradientType:1] forState:UIControlStateNormal];
  87. }else if (youpaipmodel.youpaipstatusType ==Status3_adopt){
  88. [self.youpaipjoinBtn setTitle:@"审核通过" forState:UIControlStateNormal];
  89. [self.youpaipjoinBtn setBackgroundImage:[LCTools ColorImage:CGSizeMake(64, 22) FromColors:@[HexColorFromRGB(0x4F4B5B),HexColorFromRGB(0x4F4B5B)] ByGradientType:1] forState:UIControlStateNormal];
  90. }else if (youpaipmodel.youpaipstatusType ==Status4_reject){
  91. [self.youpaipjoinBtn setTitle:@"被拒绝" forState:UIControlStateNormal];
  92. [self.youpaipjoinBtn setBackgroundImage:[LCTools ColorImage:CGSizeMake(64, 22) FromColors:@[HexColorFromRGB(0x4F4B5B),HexColorFromRGB(0x4F4B5B)] ByGradientType:1] forState:UIControlStateNormal];
  93. }
  94. }
  95. -(void)youpaifjoinBtnClick{
  96. if (self.youpaipjoinGuildBlock) {
  97. self.youpaipjoinGuildBlock(self.youpaipmodel);
  98. }
  99. }
  100. @end