123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- //
- // 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
|