|
|
|
//
|
|
|
|
// OtherTableViewCell.m
|
|
|
|
// LekangGuard
|
|
|
|
//
|
|
|
|
// Created by ecell on 2022/11/28.
|
|
|
|
//
|
|
|
|
|
|
|
|
#import "OtherTableViewCell.h"
|
|
|
|
|
|
|
|
@interface OtherTableViewCell ()
|
|
|
|
|
|
|
|
@property (nonatomic ,weak) UIImageView *selectImg;
|
|
|
|
|
|
|
|
/// 头像
|
|
|
|
@property (nonatomic ,weak) UIImageView *iconImg;
|
|
|
|
|
|
|
|
/// 姓名
|
|
|
|
@property (nonatomic ,weak) UILabel *nameLabel;
|
|
|
|
|
|
|
|
/// 手机号
|
|
|
|
@property (nonatomic ,weak) UILabel *phoneLabel;
|
|
|
|
|
|
|
|
|
|
|
|
@property (nonatomic ,weak) UILabel *typeLabel;
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation OtherTableViewCell
|
|
|
|
|
|
|
|
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
|
|
|
|
{
|
|
|
|
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
|
|
|
|
if (self)
|
|
|
|
{
|
|
|
|
self.selectionStyle = UITableViewCellSelectionStyleNone;
|
|
|
|
self.backgroundColor = KKWhiteColorColor;
|
|
|
|
[self subCellView];
|
|
|
|
}
|
|
|
|
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)setIsDeletMode:(BOOL)isDeletMode
|
|
|
|
{
|
|
|
|
_isDeletMode = isDeletMode;
|
|
|
|
[self.iconImg mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
if (isDeletMode && self.contactsModel.setBind == 0)
|
|
|
|
make.left.equalTo(self.selectImg.mas_right).offset(10);
|
|
|
|
else
|
|
|
|
make.left.equalTo(self.contentView).offset(15);
|
|
|
|
make.centerY.equalTo(self.contentView);
|
|
|
|
make.size.mas_equalTo(CGSizeMake(Adapted(40), Adapted(40)));
|
|
|
|
}];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)setContactsModel:(ContactsModel *)contactsModel
|
|
|
|
{
|
|
|
|
//NSLog(@"-->%@",contactsModel);
|
|
|
|
_contactsModel = contactsModel;
|
|
|
|
self.iconImg.image = [UICommon getClickRelationshipImageWithCodeID:contactsModel.image deviceType:APIManager.sharedManager.deviceModel.deviceType];
|
|
|
|
if (contactsModel.addMethod == 0)
|
|
|
|
self.nameLabel.text = contactsModel.name;
|
|
|
|
else
|
|
|
|
self.nameLabel.text = contactsModel.relation;
|
|
|
|
self.phoneLabel.text = contactsModel.phone;
|
|
|
|
self.selectImg.image = contactsModel.isSelect ? ImageName_(@"icon_selectImg_Yes") : ImageName_(@"icon_selectImg_No");
|
|
|
|
|
|
|
|
NSString *str;
|
|
|
|
if ([contactsModel.openId isEqualToString:APIManager.sharedManager.loginModel.openid] )
|
|
|
|
{
|
|
|
|
str = contactsModel.identity == 2 ? GJText(@"(我) 管理员") : GJText(@"(我)");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
str = contactsModel.identity == 2 ? GJText(@"管理员") : @"";
|
|
|
|
}
|
|
|
|
self.typeLabel.text = str;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)subCellView
|
|
|
|
{
|
|
|
|
UIImageView *selectImg = [UICommon ui_imageView:CGRectZero fileName:@"icon_selectImg_No"];
|
|
|
|
self.selectImg = selectImg;
|
|
|
|
[self.contentView addSubview:selectImg];
|
|
|
|
[selectImg mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
make.left.equalTo(self.contentView).offset(15);
|
|
|
|
make.centerY.equalTo(self.contentView);
|
|
|
|
make.size.mas_equalTo(CGSizeMake(Adapted(selectImg.image.size.width), Adapted(selectImg.image.size.height)));
|
|
|
|
}];
|
|
|
|
|
|
|
|
UIImageView *iconImg = [UICommon ui_imageView:CGRectZero fileName:@""];
|
|
|
|
self.iconImg = iconImg;
|
|
|
|
[self.contentView addSubview:iconImg];
|
|
|
|
[iconImg mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
make.left.equalTo(self.contentView).offset(15);
|
|
|
|
make.centerY.equalTo(self.contentView);
|
|
|
|
make.size.mas_equalTo(CGSizeMake(Adapted(40), Adapted(40)));
|
|
|
|
}];
|
|
|
|
|
|
|
|
|
|
|
|
UILabel *nameLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentCenter font:FontADA_(15) textColor:KKTextBlackColor text:@"" Radius:0];
|
|
|
|
self.nameLabel = nameLabel;
|
|
|
|
[self.contentView addSubview:nameLabel];
|
|
|
|
[nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
make.left.equalTo(iconImg.mas_right).offset(10);
|
|
|
|
make.top.equalTo(iconImg);
|
|
|
|
}];
|
|
|
|
|
|
|
|
UILabel *phoneLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentCenter font:FontADA_(13) textColor:KKGrey102 text:@"" Radius:0];
|
|
|
|
self.phoneLabel = phoneLabel;
|
|
|
|
[self.contentView addSubview:phoneLabel];
|
|
|
|
[phoneLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
make.left.equalTo(nameLabel);
|
|
|
|
make.bottom.equalTo(iconImg.mas_bottom);
|
|
|
|
}];
|
|
|
|
|
|
|
|
UILabel *typeLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentCenter font:FontADA_(15) textColor:KKMainColor text:@"" Radius:0];
|
|
|
|
self.typeLabel = typeLabel;
|
|
|
|
[self.contentView addSubview:typeLabel];
|
|
|
|
[typeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
make.left.equalTo(nameLabel.mas_right).offset(5);
|
|
|
|
make.centerY.equalTo(nameLabel);
|
|
|
|
}];
|
|
|
|
|
|
|
|
UIImageView *rightImg = [UICommon ui_imageView:CGRectZero fileName:@"icon_enter_gray"];
|
|
|
|
[self.contentView addSubview:rightImg];
|
|
|
|
[rightImg mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
make.right.equalTo(self.contentView.mas_right).inset(15);
|
|
|
|
make.centerY.equalTo(self.contentView);
|
|
|
|
make.size.mas_equalTo(rightImg.image.size);
|
|
|
|
}];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (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
|