You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

119 lines
4.0 KiB

//
// MemberListTableViewCell.m
// LekangGuard
//
// Created by ecell on 2023/8/29.
//
#import "MemberListTableViewCell.h"
@interface MemberListTableViewCell ()
/// 头像
@property (nonatomic ,weak) UIImageView *iconImg;
/// 姓名
@property (nonatomic ,weak) UILabel *nameLabel;
/// 手机号
@property (nonatomic ,weak) UILabel *phoneLabel;
@property (nonatomic ,weak) UILabel *typeLabel;
@end
@implementation MemberListTableViewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self)
{
self.selectionStyle = UITableViewCellSelectionStyleNone;
self.backgroundColor = KKClearColor;
[self subCellView];
}
return self;
}
- (void)setContactsModel:(ContactsModel *)contactsModel
{
//NSLog(@"-->%@",contactsModel);
_contactsModel = contactsModel;
self.iconImg.image = [UICommon getClickRelationshipImageWithCodeID:contactsModel.image deviceType:APIManager.sharedManager.deviceModel.deviceType];
self.nameLabel.text = contactsModel.relation;
self.phoneLabel.text = contactsModel.phone;
self.typeLabel.text = contactsModel.identity == 2 ? @"管理员" : @"家庭成员";
self.typeLabel.backgroundColor = contactsModel.identity == 2 ? RGB(255, 185, 79) : RGB(255, 216, 154);
if ([contactsModel.openId isEqualToString:APIManager.sharedManager.loginModel.openid])
self.nameLabel.text = @"家庭成员(我)";
else
self.nameLabel.text = F(@"家庭成员(%@)",contactsModel.relation);
}
- (void)subCellView
{
UIView *bgView = [UICommon ui_view:CGRectZero backgroundColor:KKWhiteColorColor cornerRadius:10 borderWidth:0 borderColor:KKWhiteColorColor];
[self.contentView addSubview:bgView];
[bgView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.contentView.mas_left).offset(10);
make.right.equalTo(self.contentView.mas_right).inset(10);
make.top.equalTo(self.contentView.mas_top).offset(12);
make.bottom.equalTo(self.contentView.mas_bottom);
}];
UIImageView *iconImg = [UICommon ui_imageView:CGRectZero fileName:@""];
iconImg.layer.cornerRadius = 25;
iconImg.layer.masksToBounds = YES;
self.iconImg = iconImg;
[bgView addSubview:iconImg];
[iconImg mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(bgView).offset(11);
make.centerY.equalTo(bgView);
make.size.mas_equalTo(CGSizeMake(50, 50));
}];
UILabel *nameLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentCenter font:FontADA_(14) textColor:KKTextBlackColor text:@"" Radius:0];
self.nameLabel = nameLabel;
[bgView addSubview:nameLabel];
[nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(iconImg.mas_right).offset(10);
make.top.equalTo(iconImg).offset(5);
}];
UILabel *phoneLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentCenter font:FontADA_(12) textColor:KKGrey133 text:@"" Radius:0];
self.phoneLabel = phoneLabel;
[bgView addSubview:phoneLabel];
[phoneLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(nameLabel);
make.bottom.equalTo(iconImg.mas_bottom).inset(5);
}];
UILabel *typeLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentCenter font:Font_(12) textColor:KKWhiteColorColor text:@"" Radius:8];
self.typeLabel = typeLabel;
[bgView addSubview:typeLabel];
[typeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(bgView.mas_right).inset(11);
make.centerY.equalTo(bgView);
make.size.mas_equalTo(CGSizeMake(68, 25));
}];
}
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end