2025-05-06 16:45:34 +08:00
|
|
|
//
|
|
|
|
// EventCenterEventCell.m
|
|
|
|
// YuMi
|
|
|
|
//
|
|
|
|
// Created by P on 2025/4/29.
|
|
|
|
//
|
|
|
|
|
|
|
|
#import "EventCenterEventCell.h"
|
|
|
|
|
2025-05-15 16:24:43 +08:00
|
|
|
@interface EventCenterEventCell()
|
|
|
|
|
|
|
|
@property (nonatomic, strong) EventItemModel *model;
|
|
|
|
|
|
|
|
@property (nonatomic, strong) NetImageView *bgImageView;
|
|
|
|
@property (nonatomic, strong) NetImageView *avatarImageView;
|
|
|
|
@property (nonatomic, strong) UILabel *nameLabel;
|
|
|
|
@property (nonatomic, strong) UILabel *idLabel;
|
|
|
|
@property (nonatomic, strong) UILabel *eventDescLabel;
|
|
|
|
@property (nonatomic, strong) UILabel *timeLabel;
|
|
|
|
@property (nonatomic, strong) UILabel *subLabel;
|
|
|
|
|
|
|
|
@property (nonatomic, strong) UIImageView *sexImageView;
|
|
|
|
@property (nonatomic, strong) UIImageView *clockImageView;
|
|
|
|
@property (nonatomic, strong) UIImageView *ringImageView;
|
|
|
|
|
|
|
|
@property (nonatomic, strong) UIButton *statusButton;
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
2025-05-06 16:45:34 +08:00
|
|
|
@implementation EventCenterEventCell
|
|
|
|
|
2025-05-15 16:24:43 +08:00
|
|
|
+ (CGFloat)cellHeight {
|
|
|
|
return 130;
|
|
|
|
}
|
|
|
|
|
|
|
|
+ (void)registerTo:(UITableView *)tableView {
|
|
|
|
[tableView registerClass:[self class]
|
|
|
|
forCellReuseIdentifier:NSStringFromClass([self class])];
|
|
|
|
}
|
|
|
|
|
|
|
|
+ (EventCenterEventCell *)cellFor:(UITableView *)tableView atIndexPath:(NSIndexPath *)indexPath {
|
|
|
|
return [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([self class])
|
|
|
|
forIndexPath:indexPath];
|
2025-05-06 16:45:34 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
|
|
|
|
[super setSelected:selected animated:animated];
|
2025-05-15 16:24:43 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
|
|
|
|
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
|
|
|
|
self.selectionStyle = UITableViewCellSelectionStyleNone;
|
|
|
|
self.separatorInset = UIEdgeInsetsZero;
|
|
|
|
self.contentView.backgroundColor = [UIColor whiteColor];
|
|
|
|
|
|
|
|
[self.contentView addSubview:self.bgImageView];
|
|
|
|
[self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
make.top.mas_equalTo(self.contentView).inset(12);
|
|
|
|
make.leading.trailing.mas_equalTo(self.contentView).inset(15);
|
|
|
|
make.height.mas_equalTo(118);
|
|
|
|
}];
|
|
|
|
|
|
|
|
UIView *mask_1 = [self blackMask];
|
|
|
|
[self.contentView addSubview:mask_1];
|
|
|
|
[mask_1 mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
make.edges.mas_equalTo(self.bgImageView);
|
|
|
|
}];
|
|
|
|
|
|
|
|
[self.contentView addSubview:self.avatarImageView];
|
|
|
|
[self.avatarImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
make.top.leading.mas_equalTo(self.bgImageView).offset(12);
|
|
|
|
make.size.mas_equalTo(CGSizeMake(35, 35));
|
|
|
|
}];
|
|
|
|
|
|
|
|
[self.contentView addSubview:self.nameLabel];
|
|
|
|
[self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
make.top.mas_equalTo(self.avatarImageView).offset(1);
|
|
|
|
make.leading.mas_equalTo(self.avatarImageView.mas_trailing).offset(6);
|
|
|
|
}];
|
|
|
|
|
|
|
|
[self.contentView addSubview:self.sexImageView];
|
|
|
|
[self.sexImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
make.centerY.mas_equalTo(self.nameLabel);
|
|
|
|
make.leading.mas_equalTo(2);
|
|
|
|
make.size.mas_equalTo(CGSizeMake(14, 14));
|
|
|
|
}];
|
|
|
|
|
|
|
|
[self.contentView addSubview:self.idLabel];
|
|
|
|
[self.idLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
make.bottom.mas_equalTo(self.avatarImageView).offset(1);
|
|
|
|
make.leading.mas_equalTo(self.nameLabel);
|
|
|
|
}];
|
|
|
|
|
|
|
|
[self.contentView addSubview:self.eventDescLabel];
|
|
|
|
[self.eventDescLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
make.leading.trailing.mas_equalTo(self.bgImageView).inset(12);
|
|
|
|
make.centerY.mas_equalTo(self.bgImageView);
|
|
|
|
}];
|
|
|
|
|
|
|
|
UIView *mask_2 = [self blackMask];
|
|
|
|
[self.contentView addSubview:mask_2];
|
|
|
|
[mask_2 mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
make.bottom.leading.trailing.mas_equalTo(self.bgImageView);
|
|
|
|
make.height.mas_equalTo(32);
|
|
|
|
}];
|
|
|
|
|
|
|
|
[self.contentView addSubview:self.clockImageView];
|
|
|
|
[self.clockImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
make.centerY.mas_equalTo(mask_2);
|
|
|
|
make.leading.mas_equalTo(mask_2).offset(13);
|
|
|
|
make.size.mas_equalTo(CGSizeMake(14, 14));
|
|
|
|
}];
|
|
|
|
|
|
|
|
[self.contentView addSubview:self.timeLabel];
|
|
|
|
[self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
make.leading.mas_equalTo(self.clockImageView.mas_trailing).offset(1);
|
|
|
|
make.centerY.mas_equalTo(mask_2);
|
|
|
|
}];
|
|
|
|
|
|
|
|
[self.contentView addSubview:self.subLabel];
|
|
|
|
[self.subLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
make.trailing.mas_equalTo(mask_2).offset(-13);
|
|
|
|
make.centerY.mas_equalTo(mask_2);
|
|
|
|
}];
|
|
|
|
|
|
|
|
[self.contentView addSubview:self.ringImageView];
|
|
|
|
[self.ringImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
make.centerY.mas_equalTo(mask_2);
|
|
|
|
make.trailing.mas_equalTo(self.subLabel.mas_leading).offset(-1);
|
|
|
|
make.size.mas_equalTo(CGSizeMake(14, 14));
|
|
|
|
}];
|
|
|
|
}
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)updateCell:(EventItemModel *)model {
|
|
|
|
_model = model;
|
|
|
|
self.bgImageView.imageUrl = model.eventBanner;
|
|
|
|
self.avatarImageView.imageUrl = model.roomAvatar;
|
|
|
|
self.nameLabel.text = @"123";
|
|
|
|
self.idLabel.text = [NSString stringWithFormat:@"ID:%@", @(model.roomErbanNo)];
|
|
|
|
self.eventDescLabel.text = model.eventTopic;
|
|
|
|
self.timeLabel.text = @(model.eventStartTime).stringValue;
|
|
|
|
self.subLabel.text = @(model.subNum).stringValue;
|
|
|
|
}
|
|
|
|
|
|
|
|
#pragma mark -
|
|
|
|
- (NetImageView *)bgImageView {
|
|
|
|
if (!_bgImageView) {
|
|
|
|
NetImageConfig *config = [[NetImageConfig alloc] init];
|
|
|
|
config.placeHolder = [UIImageConstant defaultBannerPlaceholder];
|
|
|
|
_bgImageView = [[NetImageView alloc] initWithConfig:config];
|
|
|
|
[_bgImageView setCornerRadius:12];
|
|
|
|
}
|
|
|
|
return _bgImageView;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (NetImageView *)avatarImageView {
|
|
|
|
if (!_avatarImageView) {
|
|
|
|
NetImageConfig *config = [[NetImageConfig alloc] init];
|
|
|
|
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
|
|
|
_avatarImageView = [[NetImageView alloc] initWithConfig:config];
|
|
|
|
[_avatarImageView setCornerRadius:35/2
|
|
|
|
corners:kCALayerMaxXMaxYCorner | kCALayerMaxXMinYCorner | kCALayerMinXMaxYCorner | kCALayerMinXMinYCorner
|
|
|
|
borderWidth:1
|
|
|
|
borderColor:UIColorFromRGB(0xfffff)];
|
|
|
|
}
|
|
|
|
return _avatarImageView;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (UILabel *)nameLabel {
|
|
|
|
if (!_nameLabel) {
|
|
|
|
_nameLabel = [UILabel labelInitWithText:@""
|
|
|
|
font:kFontRegular(14)
|
|
|
|
textColor:[UIColor whiteColor]];
|
|
|
|
}
|
|
|
|
return _nameLabel;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (UILabel *)idLabel {
|
|
|
|
if (!_idLabel) {
|
|
|
|
_idLabel = [UILabel labelInitWithText:@""
|
|
|
|
font:kFontRegular(12)
|
|
|
|
textColor:[UIColor colorWithWhite:1 alpha:0.6]];
|
|
|
|
}
|
|
|
|
return _idLabel;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (UILabel *)eventDescLabel {
|
|
|
|
if (!_eventDescLabel) {
|
|
|
|
_eventDescLabel = [UILabel labelInitWithText:@""
|
|
|
|
font:kFontMedium(14)
|
|
|
|
textColor:[UIColor colorWithWhite:1 alpha:1]];
|
|
|
|
_eventDescLabel.numberOfLines = 0;
|
|
|
|
}
|
|
|
|
return _eventDescLabel;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (UILabel *)timeLabel {
|
|
|
|
if (!_timeLabel) {
|
|
|
|
_timeLabel = [UILabel labelInitWithText:@""
|
|
|
|
font:kFontRegular(12)
|
|
|
|
textColor:[UIColor colorWithWhite:1 alpha:0.6]];
|
|
|
|
}
|
|
|
|
return _timeLabel;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (UILabel *)subLabel {
|
|
|
|
if (!_subLabel) {
|
|
|
|
_subLabel = [UILabel labelInitWithText:@""
|
|
|
|
font:kFontRegular(12)
|
|
|
|
textColor:[UIColor colorWithWhite:1 alpha:0.6]];
|
|
|
|
}
|
|
|
|
return _subLabel;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (UIImageView *)sexImageView {
|
|
|
|
if (!_sexImageView) {
|
|
|
|
_sexImageView = [UIImageView new];
|
|
|
|
}
|
|
|
|
return _sexImageView;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (UIImageView *)clockImageView {
|
|
|
|
if (!_clockImageView) {
|
|
|
|
_clockImageView = [[UIImageView alloc] initWithImage:kImage(@"event_clock")];
|
|
|
|
}
|
|
|
|
return _clockImageView;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (UIImageView *)ringImageView {
|
|
|
|
if (!_ringImageView) {
|
|
|
|
_ringImageView = [[UIImageView alloc] initWithImage:kImage(@"event_ring")];
|
|
|
|
}
|
|
|
|
return _ringImageView;
|
|
|
|
}
|
2025-05-06 16:45:34 +08:00
|
|
|
|
2025-05-15 16:24:43 +08:00
|
|
|
- (UIView *)blackMask {
|
|
|
|
UIView *v = [[UIView alloc] init];
|
|
|
|
v.backgroundColor = [UIColor colorWithWhite:0 alpha:0.6];
|
|
|
|
return v;
|
2025-05-06 16:45:34 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
@end
|