123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154 |
- //
- // YOUPAIHRPersonnelManagementCell.m
- // VQU
- //
- // Created by xiaohaoran on 2021/11/9.
- // Copyright © 2021 MS. All rights reserved.
- //
- #import "YOUPAIHRAddManagementCell.h"
- @interface YOUPAIHRAddManagementCell ()
- @property(nonatomic,strong)UIImageView *youpaipiconImageView;
- @property(nonatomic,strong)UILabel *youpaipnickLabel;
- @property(nonatomic,strong)UILabel *youpaipnickIDLabel;
- @property(nonatomic,strong)UIButton *youpaipjoinBtn;
- @property(nonatomic,strong)UILabel *youpaiptypeLabel;
- @end
- @implementation YOUPAIHRAddManagementCell
- -(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.contentMode = UIViewContentModeScaleAspectFill;
- youpaipiconImageView.layer.cornerRadius = 20;
- youpaipiconImageView.clipsToBounds = YES;
-
- //type
- UILabel *youpaiptypeLabel = [UILabel new];
- self.youpaiptypeLabel = youpaiptypeLabel;
- [self.contentView addSubview:youpaiptypeLabel];
- [youpaiptypeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(youpaipiconImageView.mas_right).offset(8);
- make.top.mas_equalTo(youpaipiconImageView).offset(5);
- make.size.mas_equalTo(CGSizeMake(32, 15));
- }];
- youpaiptypeLabel.textAlignment = NSTextAlignmentCenter;
- youpaiptypeLabel.textColor = [UIColor whiteColor];
- youpaiptypeLabel.font = [UIFont systemFontOfSize:10];
- youpaiptypeLabel.layer.cornerRadius = 7.5;
- youpaiptypeLabel.clipsToBounds = YES;
- //公会名称
- UILabel *youpaipnickLabel = [UILabel new];
- self.youpaipnickLabel = youpaipnickLabel;
- [self.contentView addSubview:youpaipnickLabel];
- [youpaipnickLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(youpaiptypeLabel.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(56, 22));
- }];
- [youpaipjoinBtn setBackgroundImage:[LCTools ColorImage:CGSizeMake(56, 22) FromColors:@[ZYGradientOneColor,ZYGradientTwoColor] ByGradientType:1] forState:UIControlStateNormal];
- 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);
- //事件
- [youpaipjoinBtn addTarget:self action:@selector(youpaifjoinBtnClick) forControlEvents:UIControlEventTouchUpInside];
- }
- -(void)youpaifjoinBtnClick{
- if (self.youpaipdidClickBlock) {
- self.youpaipdidClickBlock(self.youpaipmodel);
- }
-
- }
- -(void)setYoupaipmodel:(YOUPAIHRPersonnelManagementModel *)youpaipmodel{
-
- _youpaipmodel = youpaipmodel;
- [self.youpaipiconImageView sd_setImageWithURL:[LCTools getImageUrlWithAddress:youpaipmodel.youpaipavatar] placeholderImage:nil];
- self.youpaipnickLabel.text = youpaipmodel.youpaipnickname;
- self.youpaipnickIDLabel.text = [NSString stringWithFormat:@"花舞号:%@",youpaipmodel.youpaipusercode];
- if ([youpaipmodel.youpaipidentity isEqualToString:@"homeowner"]) {
- self.youpaiptypeLabel.hidden = NO;
- self.youpaiptypeLabel.text = @"房主";
- self.youpaiptypeLabel.backgroundColor = HexColorFromRGB(0xDD5C7E);
- [self.youpaipnickLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(self.youpaiptypeLabel.mas_right).offset(8);
- make.top.mas_equalTo(self.youpaipiconImageView).offset(5);
- }];
- }else if ([youpaipmodel.youpaipidentity isEqualToString:@"host"]){
- self.youpaiptypeLabel.hidden = NO;
- self.youpaiptypeLabel.text = @"主持";
- self.youpaiptypeLabel.backgroundColor = HexColorFromRGB(0xEA7B49);
- [self.youpaipnickLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(self.youpaiptypeLabel.mas_right).offset(8);
- make.top.mas_equalTo(self.youpaipiconImageView).offset(5);
- }];
- }else if ([youpaipmodel.youpaipidentity isEqualToString:@"manager"]){
- self.youpaiptypeLabel.hidden = NO;
- self.youpaiptypeLabel.text = @"管理";
- self.youpaiptypeLabel.backgroundColor = HexColorFromRGB(0x3A80DB);
- [self.youpaipnickLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(self.youpaiptypeLabel.mas_right).offset(8);
- make.top.mas_equalTo(self.youpaipiconImageView).offset(5);
- }];
-
- }else{
- self.youpaiptypeLabel.hidden = YES;
- [self.youpaipnickLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(self.youpaipiconImageView.mas_right).offset(8);
- make.top.mas_equalTo(self.youpaipiconImageView).offset(5);
- }];
-
- }
- }
- @end
|