//
|
// PBPanoramaTableViewCell.m
|
// IphoneBIMe
|
//
|
// Created by ZhangJF on 2022/10/18.
|
// Copyright © 2022 ProBIM. All rights reserved.
|
//
|
|
#import "PBPanoramaTableViewCell.h"
|
#import "PBPanoramaModel.h"
|
#import "PBPanoramaItemModel.h"
|
@interface PBPanoramaTableViewCell()
|
@property (nonatomic, weak) UIImageView *imageV;
|
@property (nonatomic, weak) UILabel *nameL;
|
@property (nonatomic, weak) UILabel *labelNameL;
|
@property (nonatomic, weak) UILabel *creatTimeL;
|
@property (nonatomic, weak) UILabel *labelTieleL;
|
@property (nonatomic, weak) UIImageView *statuV;
|
@end
|
@implementation PBPanoramaTableViewCell
|
|
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
|
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]){
|
[self setupUI];
|
}
|
return self;
|
}
|
- (void)setupUI {
|
self.contentView.backgroundColor = [UIColor z_colorWithR:248 G:248 B:248];
|
UIView *bgView = [[UIView alloc] init];
|
bgView.backgroundColor = [UIColor whiteColor];
|
[self.contentView addSubview:bgView];
|
[bgView mas_makeConstraints:^(MASConstraintMaker *make) {
|
make.top.left.equalTo(self.contentView).offset(10);
|
make.right.equalTo(self.contentView).offset(-10);
|
make.height.equalTo(@104);
|
}];
|
[bgView circleViewWithRadius:6];
|
|
UIImageView *imageV = [[UIImageView alloc] init];
|
// imageV.contentMode = UIViewContentModeScaleAspectFill;
|
[bgView addSubview:imageV];
|
[imageV mas_makeConstraints:^(MASConstraintMaker *make) {
|
make.top.equalTo(bgView).offset(10);
|
make.left.equalTo(bgView).offset(10);
|
make.size.mas_equalTo(CGSizeMake(120, 84));
|
}];
|
[imageV circleViewWithRadius:6];
|
|
UIImageView *statuV = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"guanlian"]];
|
[self.contentView addSubview:statuV];
|
[statuV mas_makeConstraints:^(MASConstraintMaker *make) {
|
make.top.equalTo(imageV).offset(4);
|
make.right.equalTo(imageV).offset(-4);
|
make.size.mas_equalTo(CGSizeMake(24, 24));
|
}];
|
|
UILabel *nameL = [UILabel z_labelWithText:@"大兴机场监管库" Color:[UIColor z_colorWithR:51 G:51 B:51] isBold:YES Font:16];
|
nameL.numberOfLines = 0;
|
[self.contentView addSubview:nameL];
|
[nameL mas_makeConstraints:^(MASConstraintMaker *make) {
|
make.top.equalTo(imageV).offset(4);
|
make.left.equalTo(imageV.mas_right).offset(8);
|
make.right.equalTo(bgView).offset(-8);
|
make.height.equalTo(@22);
|
}];
|
|
|
UILabel *labelTieleL = [UILabel z_labelWithText:@"标签名称" Color:[UIColor z_colorWithR:102 G:102 B:102] isBold:NO Font:14];
|
labelTieleL.numberOfLines = 0;
|
[self.contentView addSubview:labelTieleL];
|
[labelTieleL mas_makeConstraints:^(MASConstraintMaker *make) {
|
make.top.equalTo(nameL.mas_bottom).offset(5);
|
make.left.equalTo(nameL);
|
make.width.equalTo(@60);
|
make.height.equalTo(@17);
|
}];
|
|
UILabel *labelNameL = [UILabel z_labelWithText:@"第38期" Color:[UIColor z_colorWithR:0 G:122 B:255] isBold:NO Font:14];
|
labelNameL.numberOfLines = 0;
|
[self.contentView addSubview:labelNameL];
|
[labelNameL mas_makeConstraints:^(MASConstraintMaker *make) {
|
make.top.equalTo(labelTieleL);
|
make.left.equalTo(labelTieleL.mas_right).offset(20);
|
make.height.equalTo(labelTieleL);
|
make.right.equalTo(nameL);
|
}];
|
UILabel *creatTimeL = [UILabel z_labelWithText:@"创建时间:2022-08-12" Color:[UIColor z_colorWithR:102 G:102 B:102] isBold:NO Font:14];
|
creatTimeL.numberOfLines = 0;
|
[self.contentView addSubview:creatTimeL];
|
[creatTimeL mas_makeConstraints:^(MASConstraintMaker *make) {
|
make.bottom.equalTo(imageV).offset(-4);
|
make.left.right.equalTo(nameL);
|
make.height.equalTo(@20);
|
}];
|
|
self.imageV = imageV;
|
self.nameL = nameL;
|
self.labelNameL = labelNameL;
|
self.creatTimeL = creatTimeL;
|
self.labelTieleL = labelTieleL;
|
self.statuV = statuV;
|
}
|
|
- (void)setPanoramaModel:(PBPanoramaModel *)panoramaModel {
|
_panoramaModel = panoramaModel;
|
self.statuV.hidden = YES;
|
NSString *status = @"";
|
if (panoramaModel.PqFlag == 0) {
|
status = @"(待转换)";
|
}else if (panoramaModel.PqFlag == 1){
|
status = @"(转换中)";
|
}else if (panoramaModel.PqFlag == 3){
|
status = @"(转换失败)";
|
}
|
|
NSURL *imageUrl = [NSURL URLWithString:[NSString stringWithFormat:@"%@/Panorama%@/cover.png", PanoramaUrl, panoramaModel.PbUrl]];
|
[self.imageV sd_setImageWithURL:imageUrl placeholderImage:[UIImage imageNamed:@""]];
|
self.nameL.text = [NSString stringWithFormat:@"%@%@",panoramaModel.PbName, status];
|
self.labelNameL.text = panoramaModel.LabelName;
|
self.labelTieleL.text = @"标签名称";
|
NSRange range = [panoramaModel.PbUpdatetime rangeOfString:@"T"];
|
NSString *string = [panoramaModel.PbUpdatetime substringToIndex:range.location];
|
self.creatTimeL.text = [NSString stringWithFormat:@"创建时间:%@", string];
|
|
|
}
|
- (void)setPanoramaItemModel:(PBPanoramaItemModel *)panoramaItemModel {
|
_panoramaItemModel = panoramaItemModel;
|
NSURL *imageUrl = [NSURL URLWithString:[NSString stringWithFormat:@"%@/Panorama%@/vtour/panos/%@.tiles/thumb.jpg", PanoramaUrl, panoramaItemModel.PbUrl, panoramaItemModel.PsScenename]];
|
[self.imageV sd_setImageWithURL:imageUrl placeholderImage:[UIImage imageNamed:@""]];
|
self.nameL.text = panoramaItemModel.PchChname;
|
self.labelNameL.text = panoramaItemModel.pbName;
|
self.labelTieleL.text = @"所属图集:";
|
NSRange range = [panoramaItemModel.PsCollecteddatetime rangeOfString:@"T"];
|
NSString *string = [panoramaItemModel.PsCollecteddatetime substringToIndex:range.location];
|
self.creatTimeL.text = [NSString stringWithFormat:@"创建时间:%@", string];
|
if (panoramaItemModel.ViewId) {
|
self.statuV.hidden = NO;
|
}else {
|
self.statuV.hidden = YES;
|
}
|
}
|
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
|
[super setSelected:selected animated:animated];
|
|
// Configure the view for the selected state
|
}
|
@end
|