239 lines
8.7 KiB
Objective-C
Executable File
239 lines
8.7 KiB
Objective-C
Executable File
//
|
|
// RoomFluctuationOfWheatCell.m
|
|
// QiaoYuYueWan
|
|
//
|
|
// Created by apple on 2020/4/11.
|
|
// Copyright © 2020 QiaoYuYueWan. All rights reserved.
|
|
//
|
|
|
|
#import "BJRoomBaomaiCell.h"
|
|
#import "LiangView.h"
|
|
@interface BJRoomBaomaiCell ()
|
|
/*靓号ID*/
|
|
//@property(nonatomic, strong) UIButton *liangBtn;
|
|
|
|
//新的靓号ID
|
|
@property(nonatomic, strong) LiangView *liangView;
|
|
@end
|
|
@implementation BJRoomBaomaiCell
|
|
|
|
#pragma mark - 快速创建cell
|
|
+ (instancetype)cellWithTableView:(UITableView *)tableView{
|
|
static NSString *ID = @"BJRoomBaomaiCell";
|
|
|
|
BJRoomBaomaiCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
|
|
|
|
if (cell == nil) {
|
|
cell = [[BJRoomBaomaiCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:ID];
|
|
// cell.selectedBackgroundView = cell.seletView ;
|
|
cell.selectionStyle = UITableViewCellSelectionStyleNone;
|
|
cell.contentView.backgroundColor = [UIColor clearColor];
|
|
cell.backgroundColor = [UIColor clearColor];
|
|
}
|
|
return cell;
|
|
}
|
|
|
|
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
|
|
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
|
|
[self addSomeViews];
|
|
}
|
|
return self;
|
|
}
|
|
|
|
- (void)quDingButtonClick:(UIButton *)sender{
|
|
! self.quDingButtonClickBlock ?: self.quDingButtonClickBlock(self.model);
|
|
}
|
|
- (void)setModel:(BJRoomBaomaiModel *)model{
|
|
_model = model;
|
|
if ([model.is_mic integerValue] == 1) {
|
|
self.bgView.hidden = YES;
|
|
[self.quDingButton setTitle:@"下麦" forState:UIControlStateNormal];
|
|
}else{
|
|
self.bgView.hidden = YES;
|
|
[self.quDingButton setTitle:@"上麦" forState:UIControlStateNormal];
|
|
}
|
|
[self.quDingButton.titleLabel setFont:Font(12)];
|
|
[self.icon sd_setImageWithURL:[NSURL URLWithString:model.head_pic] placeholderImage:[UIImage imageNamed:@"default_userIcon"]];
|
|
self.nickName.text = model.nick_name;
|
|
// if (model.special_uid.length>2) {
|
|
// self.liangBtn.hidden = NO;
|
|
// self.uid.hidden = YES;
|
|
// CGSize size = [NSStringFormat(@"%@",model.uid) sizeWithFont:FONT_12 hiegth:20];
|
|
// [self.liangBtn setTitle:NSStringFormat(@"%@",model.uid) forState:UIControlStateNormal];
|
|
// [self.liangBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
// make.left.equalTo(self.nickName);
|
|
// make.centerY.equalTo(self.icon);
|
|
// make.width.mas_equalTo(size.width+30);
|
|
// make.height.mas_equalTo(22);
|
|
// }];
|
|
// }else{
|
|
// self.liangBtn.hidden = YES;
|
|
// self.uid.hidden = NO;
|
|
// self.uid.text = NSStringFormat(@"ID: %@",model.uid);
|
|
// }
|
|
self.timeLabel.text = [NSString stringWithFormat:@"申请时间:%@",model.add_time];
|
|
|
|
if (model.special_uid.length>1) {
|
|
self.uid.hidden = YES;
|
|
self.liangView.hidden = NO;
|
|
CGSize size = [model.special_uid sizeWithFont:FONT_12 hiegth:20];
|
|
[self.liangView mas_updateConstraints:^(MASConstraintMaker *make) {
|
|
make.width.mas_equalTo(size.width+30);
|
|
}];
|
|
self.liangView.uid.text = model.special_uid;
|
|
}else{
|
|
self.liangView.hidden = YES;
|
|
self.uid.hidden = NO;
|
|
self.uid.text = NSStringFormat(@"ID: %@",model.uid);
|
|
// [self.uid setTitle:[NSString stringWithFormat:@"ID:%@",model.uid] forState:UIControlStateNormal];
|
|
// [self.uid setImage:nil forState:UIControlStateNormal];
|
|
// self.uid.ba_padding = 0;
|
|
}
|
|
|
|
//1房主 2管理 3主持 5普通用户
|
|
if (model.user_type == 1) {
|
|
self.typeImgV.image = ImageNamed(@"room_type_owner");
|
|
}else if (model.user_type == 2) {
|
|
self.typeImgV.image = ImageNamed(@"room_type_manager");
|
|
}else if (model.user_type == 3) {
|
|
self.typeImgV.image = ImageNamed(@"room_type_host");
|
|
}else {
|
|
self.typeImgV.image = nil;
|
|
}
|
|
}
|
|
|
|
|
|
- (void)addSomeViews{
|
|
|
|
[self.contentView addSubview:self.bgView];
|
|
[self.contentView addSubview:self.icon];
|
|
[self.contentView addSubview:self.nickName];
|
|
[self.contentView addSubview:self.uid];
|
|
[self.contentView addSubview:self.quDingButton];
|
|
[self.contentView addSubview:self.lineView];
|
|
[self.contentView addSubview:self.liangView];
|
|
[self.contentView addSubview:self.typeImgV];
|
|
|
|
UILabel *timeLab = [ControlCreator createLabel:nil rect:CGRectZero text:@"" font:FONT_12 color:COLOR_666666 backguoundColor:nil align:NSTextAlignmentLeft lines:1];
|
|
[self.contentView addSubview:timeLab];
|
|
[timeLab mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.left.equalTo(self.nickName);
|
|
make.bottom.equalTo(self.icon);
|
|
}];
|
|
|
|
self.timeLabel = timeLab;
|
|
|
|
|
|
[self.bgView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.top.mas_equalTo(self).offset(5);
|
|
make.bottom.mas_equalTo(self);
|
|
make.left.mas_equalTo(self).offset(12);
|
|
make.right.mas_equalTo(self).offset(-12);
|
|
}];
|
|
[self.icon mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.centerY.mas_equalTo(self.bgView.mas_centerY);
|
|
make.height.mas_equalTo(70);
|
|
make.left.mas_equalTo(self.bgView.mas_left).offset(10);
|
|
make.width.mas_equalTo(70);
|
|
}];
|
|
[self.nickName mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.left.mas_equalTo(self.icon.mas_right).offset(10);
|
|
make.top.mas_equalTo(self.icon).offset(12);
|
|
}];
|
|
[self.uid mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.left.mas_equalTo(self.icon.mas_right).offset(10);
|
|
make.top.mas_equalTo(self.nickName.mas_bottom).offset(15);
|
|
}];
|
|
[self.quDingButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.right.mas_equalTo(self).offset(-15);
|
|
make.centerY.mas_equalTo(self.bgView.mas_centerY);
|
|
make.height.mas_equalTo(30);
|
|
make.width.mas_equalTo(60);
|
|
}];
|
|
[self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.bottom.mas_equalTo(self);
|
|
make.left.mas_equalTo(self.bgView).offset(13);
|
|
make.right.mas_equalTo(self).offset(-13);
|
|
make.height.mas_equalTo(1);
|
|
}];
|
|
//靓号
|
|
self.liangView.hidden = YES;
|
|
[self.liangView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.left.equalTo(self.nickName);
|
|
make.centerY.equalTo(self.uid);
|
|
make.width.mas_equalTo(100);
|
|
make.height.mas_equalTo(20);
|
|
}];
|
|
[self.typeImgV mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.left.equalTo(self.nickName.mas_right).offset(5);
|
|
make.centerY.equalTo(self.nickName);
|
|
make.width.mas_equalTo(37);
|
|
make.height.mas_equalTo(18);
|
|
}];
|
|
}
|
|
|
|
|
|
- (UIView *)bgView{
|
|
if (!_bgView) {
|
|
_bgView = [ControlCreator createView:nil rect:CGRectZero backguoundColor:[UIColor whiteColor]];
|
|
_bgView.layer.cornerRadius = 7;
|
|
_bgView.layer.shadowOffset = CGSizeMake(0,1);
|
|
_bgView.layer.masksToBounds = NO;
|
|
_bgView.layer.shadowColor = mainQianColor.CGColor;
|
|
_bgView.layer.shadowOpacity = 0.5f;
|
|
_bgView.hidden = YES;
|
|
}
|
|
return _bgView;
|
|
}
|
|
|
|
- (UIImageView *)icon{
|
|
if (!_icon) {
|
|
_icon = [ControlCreator createImageView:self rect:CGRectMake(0, 0, 0, 0) imageName:@"default_userIcon" backguoundColor:MLControlsHuiColor];
|
|
_icon.layer.masksToBounds = YES;
|
|
_icon.layer.cornerRadius = 35;
|
|
}
|
|
return _icon;
|
|
}
|
|
- (UILabel *)nickName{
|
|
if (!_nickName) {
|
|
_nickName = [ControlCreator createLabel:self rect:CGRectZero text:@"" font:Font(14) color:mainViceColor backguoundColor:[UIColor clearColor] align:NSTextAlignmentLeft lines:1];
|
|
}
|
|
return _nickName;
|
|
}
|
|
- (UILabel *)uid{
|
|
if (!_uid) {
|
|
_uid = [ControlCreator createLabel:self rect:CGRectZero text:@"ID:" font:Font(12) color:mainQianColor backguoundColor:[UIColor clearColor] align:NSTextAlignmentLeft lines:1];
|
|
}
|
|
return _uid;
|
|
}
|
|
- (UIButton *)quDingButton{
|
|
if (!_quDingButton) {
|
|
_quDingButton = [ControlCreator createButton:self rect:CGRectZero text:@"" font:Font1(12) color:[UIColor whiteColor] backguoundColor:MLControlsColor imageName:@"" target:self action:@selector(quDingButtonClick:)];
|
|
_quDingButton.layer.masksToBounds = YES;
|
|
_quDingButton.layer.cornerRadius = 15;
|
|
}
|
|
return _quDingButton;
|
|
}
|
|
- (UIView *)lineView{
|
|
if (!_lineView) {
|
|
_lineView = [ControlCreator createView:nil rect:CGRectZero backguoundColor:MLControlsHuiColor];
|
|
}
|
|
return _lineView;
|
|
}
|
|
|
|
- (LiangView *)liangView{
|
|
if (!_liangView) {
|
|
_liangView = [[NSBundle mainBundle] loadNibNamed:@"LiangView" owner:nil options:nil].lastObject;
|
|
}
|
|
return _liangView;
|
|
}
|
|
|
|
- (UIImageView *)typeImgV {
|
|
if (!_typeImgV) {
|
|
_typeImgV = [ControlCreator createImageView:self rect:CGRectZero imageName:nil backguoundColor:nil];
|
|
}
|
|
return _typeImgV;
|
|
}
|
|
|
|
@end
|