// // PBIssueListTableViewCell.m // IphoneBIMe // // Created by zjf on 2018/8/8. // Copyright © 2018年 ProBIM. All rights reserved. // #import "PBIssueListTableViewCell.h" #import "PBIssueListModel.h" #import "PBProjectModel.h" @interface PBIssueListTableViewCell() @property (nonatomic, weak) UIImageView *imageV; @property (nonatomic, weak) UILabel *titleL; @property (nonatomic, weak) UILabel *creatorL; @property (nonatomic, weak) UILabel *creatimeL; @property (nonatomic, weak) UILabel *archiveL; @end @implementation PBIssueListTableViewCell - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]){ [self setupUI]; } return self; } - (void)setupUI { UIImageView *imageV = [[UIImageView alloc] init]; [self.contentView addSubview:imageV]; [imageV mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(self.contentView).offset(10); make.left.equalTo(self.contentView).offset(16); make.size.mas_equalTo(CGSizeMake(120, 90)); }]; UILabel *titleL = [UILabel z_labelWithText:@"测试问题追踪" Color:TitleColor isBold:NO Font:TitleFontSize]; titleL.numberOfLines = 0; [self.contentView addSubview:titleL]; [titleL mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(imageV); make.left.equalTo(imageV.mas_right).offset(8); make.right.equalTo(self.contentView).offset(-16); make.height.equalTo(@44); }]; UIImageView *creatorV = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Project_list_cell_manager"]]; [self.contentView addSubview:creatorV]; [creatorV mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(titleL.mas_bottom).offset(12); make.left.equalTo(imageV.mas_right).offset(8); make.size.mas_equalTo(CGSizeMake(24, 24)); }]; UILabel *creatorL = [UILabel z_labelWithText:@"张三丰" Color:IndicatedColor isBold:NO Font:DescFontSize]; [self.contentView addSubview:creatorL]; [creatorL mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(creatorV.mas_right).offset(8); make.centerY.equalTo(creatorV); make.width.equalTo(@70); }]; UILabel *creatimeL = [UILabel z_labelWithText:@"" Color:DescColor isBold:NO Font:DescFontSize]; [self.contentView addSubview:creatimeL]; [creatimeL mas_makeConstraints:^(MASConstraintMaker *make) { make.centerY.equalTo(creatorV); make.right.equalTo(self.contentView).offset(-16); }]; UILabel *archiveL = [UILabel z_labelWithText:@"已归档" Color:[UIColor redColor] isBold:YES Font:12]; [self.contentView addSubview:archiveL]; [archiveL mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(creatimeL.mas_bottom).offset(5); make.right.equalTo(self.contentView).offset(-20); }]; self.imageV = imageV; self.titleL = titleL; self.creatorL = creatorL; self.creatimeL = creatimeL; self.archiveL = archiveL; } - (void)setIssueListModel:(PBIssueListModel *)issueListModel { _issueListModel = issueListModel; if ([issueListModel.DeleteMark isEqualToString:@"2"]) { self.archiveL.hidden = NO; }else { self.archiveL.hidden = YES; } // NSString *url = [NSString stringWithFormat:@"%@/api/Doc/GetHideFile?ProjectID=%@&FileId=%@&FileType=Issue",BimUrl,self.projectModel.bimcomposerid,issueListModel.FileId]; if (issueListModel.ViewpointID == nil || [issueListModel.ViewpointID isEqualToString:@""]) { [self.imageV sd_setImageWithURL:[NSURL URLWithString:issueListModel.bgpicture_src] placeholderImage:[UIImage imageNamed:@"Issue_listimg_defult"]]; }else { [self.imageV sd_setImageWithURL:[NSURL URLWithString:issueListModel.ImageUrl] placeholderImage:[UIImage imageNamed:@"Issue_listimg_defult"]]; } _titleL.text = issueListModel.Title; _creatorL.text = _issueListModel.CreateUserName; NSString *time = issueListModel.CreateDate; time = [time stringByReplacingOccurrencesOfString:@"T" withString:@" "]; time = [time stringByReplacingOccurrencesOfString:@"-" withString:@"/"]; time = [time substringToIndex:time.length - 3]; _creatimeL.text = time; } - (void)setProjectModel:(PBProjectModel *)projectModel { _projectModel = projectModel; } @end