zjf
2023-03-06 392b76515f40376b6d36f40a114850ef63650384
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
//
//  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