// // YOUPAIHRGuildCenterSearchCell.m // VQU // // Created by xiaohaoran on 2021/11/4. // Copyright © 2021 MS. All rights reserved. // #import "YOUPAIHRGuildCenterSearchCell.h" @interface YOUPAIHRGuildCenterSearchCell () @end @implementation YOUPAIHRGuildCenterSearchCell -(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{ if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { [self youpaifsetupUI]; } return self; } -(void)youpaifsetupUI{ //icon UIImageView *youpaipiconImageView = [UIImageView new]; self.youpaipiconImageView = youpaipiconImageView; [self.contentView addSubview:youpaipiconImageView]; [youpaipiconImageView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(14); make.centerY.mas_equalTo(0); make.size.mas_equalTo(CGSizeMake(40, 40)); }]; youpaipiconImageView.layer.cornerRadius = 20; youpaipiconImageView.layer.masksToBounds = YES; //公会名称 UILabel *youpaipnickLabel = [UILabel new]; self.youpaipnickLabel = youpaipnickLabel; [self.contentView addSubview:youpaipnickLabel]; [youpaipnickLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(youpaipiconImageView.mas_right).offset(8); make.top.mas_equalTo(youpaipiconImageView).offset(5); }]; youpaipnickLabel.font = LCBoldFont(14); youpaipnickLabel.textColor = [UIColor whiteColor]; //公会ID UILabel *youpaipnickIDLabel = [UILabel new]; self.youpaipnickIDLabel = youpaipnickIDLabel; [self.contentView addSubview:youpaipnickIDLabel]; [youpaipnickIDLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(youpaipiconImageView.mas_right).offset(8); make.top.mas_equalTo(youpaipnickLabel.mas_bottom).offset(6); }]; youpaipnickIDLabel.font = [UIFont systemFontOfSize:10]; youpaipnickIDLabel.textColor = HexColorFromRGB(0x9F9DA5); //申请加入 UIButton *youpaipjoinBtn = [UIButton new]; self.youpaipjoinBtn =youpaipjoinBtn; [self.contentView addSubview:youpaipjoinBtn]; [youpaipjoinBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.right.mas_equalTo(-14); make.centerY.mas_equalTo(0); make.size.mas_equalTo(CGSizeMake(64, 22)); }]; youpaipjoinBtn.layer.cornerRadius = 12; youpaipjoinBtn.layer.masksToBounds = YES; [youpaipjoinBtn setTitle:@"申请加入" forState:UIControlStateNormal]; [youpaipjoinBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; youpaipjoinBtn.titleLabel.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:(YOUPAIHRGuildCenterSearchModel *)youpaipmodel{ _youpaipmodel = youpaipmodel; [self.youpaipiconImageView sd_setImageWithURL:[LCTools getImageUrlWithAddress:youpaipmodel.youpaipimg] placeholderImage:nil]; self.youpaipnickLabel.text = youpaipmodel.youpaipname; self.youpaipnickIDLabel.text = [NSString stringWithFormat:@"公会ID%ld",youpaipmodel.youpaipguild_number]; if (youpaipmodel.youpaipstatusType ==Status1_notJoin) { [self.youpaipjoinBtn setTitle:@"申请加入" forState:UIControlStateNormal]; [self.youpaipjoinBtn setBackgroundImage:[LCTools ColorImage:CGSizeMake(64, 22) FromColors:@[ZYGradientOneColor,ZYGradientTwoColor] ByGradientType:1] forState:UIControlStateNormal]; [self.youpaipjoinBtn addTarget:self action:@selector(youpaifjoinBtnClick) forControlEvents:UIControlEventTouchUpInside]; }else if (youpaipmodel.youpaipstatusType ==Status2_wait_check){ [self.youpaipjoinBtn setTitle:@"等待审核" forState:UIControlStateNormal]; [self.youpaipjoinBtn setBackgroundImage:[LCTools ColorImage:CGSizeMake(64, 22) FromColors:@[HexColorFromRGB(0x4F4B5B),HexColorFromRGB(0x4F4B5B)] ByGradientType:1] forState:UIControlStateNormal]; }else if (youpaipmodel.youpaipstatusType ==Status3_adopt){ [self.youpaipjoinBtn setTitle:@"审核通过" forState:UIControlStateNormal]; [self.youpaipjoinBtn setBackgroundImage:[LCTools ColorImage:CGSizeMake(64, 22) FromColors:@[HexColorFromRGB(0x4F4B5B),HexColorFromRGB(0x4F4B5B)] ByGradientType:1] forState:UIControlStateNormal]; }else if (youpaipmodel.youpaipstatusType ==Status4_reject){ [self.youpaipjoinBtn setTitle:@"被拒绝" forState:UIControlStateNormal]; [self.youpaipjoinBtn setBackgroundImage:[LCTools ColorImage:CGSizeMake(64, 22) FromColors:@[HexColorFromRGB(0x4F4B5B),HexColorFromRGB(0x4F4B5B)] ByGradientType:1] forState:UIControlStateNormal]; } } -(void)youpaifjoinBtnClick{ if (self.youpaipjoinGuildBlock) { self.youpaipjoinGuildBlock(self.youpaipmodel); } } @end