123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223 |
- //
- // YOUPAILZChatRoomUpSeatApplyCell.m
- // VQU
- //
- // Created by CY on 2021/11/6.
- // Copyright © 2021 MS. All rights reserved.
- //
- #import "YOUPAILZChatRoomUpSeatApplyCell.h"
- #import "YOUPAILZAvatarView.h"
- #import "YOUPAILZLevelView.h"
- @interface YOUPAILZChatRoomUpSeatApplyCell ()
- @property (nonatomic, weak) UILabel *youpaiprankL; /// 排名
- @property (nonatomic, weak) YOUPAILZAvatarView *youpaipavatarView; // 头像
- @property (nonatomic, weak) UILabel *youpaipnicknameL; // 昵称
- //@property (nonatomic, weak) UIImageView *youpaipvipImgV; // 贵族
- //@property (nonatomic, weak) UIImageView *youpaipboardImgV; // 榜单
- //@property (nonatomic, weak) YOUPAILZLevelView *youpaiplevelView; // 等级
- @property (nonatomic, weak) UILabel *youpaipcontributionL; // 贡献值
- @property (nonatomic, weak) UIButton *youpaipupseatBtn; // 抱上麦
- @property (nonatomic, weak) UIButton *youpaipignoreBtn; // 忽略
- @property (nonatomic, strong) YOUPAILZChatRoomMemberModel *youpaipmodel;
- @property (nonatomic, assign) NSInteger youpaipindex;
- @end
- @implementation YOUPAILZChatRoomUpSeatApplyCell
- - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
- if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
- self.selectionStyle = UITableViewCellSelectionStyleNone;
- self.backgroundColor = [UIColor clearColor];
- [self youpaifinitUI];
- }
- return self;
- }
- - (void)youpaifinitUI{
- UILabel *youpaiprankL = [[UILabel alloc] init];
- youpaiprankL.textColor = HexColorFromRGB(0x9F9DA5);
- youpaiprankL.textAlignment = NSTextAlignmentCenter;
- youpaiprankL.font = LCBoldFont(12.0f);
- [self.contentView addSubview:youpaiprankL];
- self.youpaiprankL = youpaiprankL;
- [youpaiprankL mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.offset(7.0f);
- make.centerY.equalTo(self.centerY);
- make.size.mas_offset(CGSizeMake(38.0f, 28.0f));
- }];
-
- YOUPAILZAvatarView *youpaipavatarView = [YOUPAILZAvatarView youpaifavatarViewWithFrame:CGRectMake(0, 0, 40, 40) avatarURL:nil personalityBoxURL:nil];
- [self.contentView addSubview:youpaipavatarView];
- self.youpaipavatarView = youpaipavatarView;
- [youpaipavatarView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.offset(52.0f);
- make.centerY.equalTo(self.contentView.mas_centerY);
- make.size.mas_offset(CGSizeMake(40.0f, 40.0f));
- }];
-
- UILabel *youpaipnicknameL = [[UILabel alloc] init];
- youpaipnicknameL.font = LCBoldFont(14.0f);
- youpaipnicknameL.textColor = [UIColor whiteColor];
- [self.contentView addSubview:youpaipnicknameL];
- self.youpaipnicknameL = youpaipnicknameL;
- [youpaipnicknameL mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(youpaipavatarView.mas_right).offset(8.0f);
- make.top.offset(15.0f);
- }];
-
- // UIImageView *youpaipvipImgV = [[UIImageView alloc] init];
- // [self.contentView addSubview:youpaipvipImgV];
- // self.youpaipvipImgV = youpaipvipImgV;
- // [youpaipvipImgV mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.left.equalTo(youpaipnicknameL.mas_right).offset(3.0f);
- // make.centerY.equalTo(youpaipnicknameL);
- // }];
- //
- // UIImageView *youpaipboardImgV = [[UIImageView alloc] init];
- // [self.contentView addSubview:youpaipboardImgV];
- // self.youpaipboardImgV = youpaipboardImgV;
- // [youpaipboardImgV mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.left.equalTo(youpaipnicknameL.mas_right).offset(3.0f);
- // make.centerY.equalTo(youpaipnicknameL);
- // }];
- //
- // YOUPAILZLevelView *youpaiplevelView = [[YOUPAILZLevelView alloc] init];
- // [self.contentView addSubview:youpaiplevelView];
- // self.youpaiplevelView = youpaiplevelView;
- // [youpaiplevelView mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.left.equalTo(youpaipnicknameL.mas_right).offset(3.0f);
- // make.centerY.equalTo(youpaipnicknameL);
- // }];
-
- UILabel *youpaipcontributionL = [[UILabel alloc] init];
- youpaipcontributionL.font = LCFont(10.0f);
- youpaipcontributionL.textColor = [UIColor whiteColor];
- [self.contentView addSubview:youpaipcontributionL];
- self.youpaipcontributionL = youpaipcontributionL;
- [youpaipcontributionL mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(youpaipavatarView.mas_right).offset(8.0f);
- make.top.equalTo(youpaipnicknameL.mas_bottom).offset(5.0f);
- }];
-
- UIButton *youpaipignoreBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- youpaipignoreBtn.layer.cornerRadius = 11.0f;
- youpaipignoreBtn.clipsToBounds = YES;
- [youpaipignoreBtn setTitle:@"忽略" forState:UIControlStateNormal];
- [youpaipignoreBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
- [youpaipignoreBtn setBackgroundImage:[LCTools ColorImage:CGSizeMake(56.0f, 22.0f) FromColors:@[HexColorFromRGB(0x4F4B5B),HexColorFromRGB(0x4F4B5B)] ByGradientType:GradientLeftToRight] forState:UIControlStateNormal];
- youpaipignoreBtn.titleLabel.font = LCFont12;
- [youpaipignoreBtn addTarget:self action:@selector(youpaifignoreBtnClick) forControlEvents:UIControlEventTouchUpInside];
- [self.contentView addSubview:youpaipignoreBtn];
- self.youpaipignoreBtn = youpaipignoreBtn;
- [youpaipignoreBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerY.equalTo(self.contentView);
- make.right.offset(-14.0f);
- make.size.mas_offset(CGSizeMake(56.0f, 22.0f));
- }];
-
- UIButton *youpaipupseatBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- youpaipupseatBtn.layer.cornerRadius = 11.0f;
- youpaipupseatBtn.clipsToBounds = YES;
- [youpaipupseatBtn setTitle:@"抱上麦" forState:UIControlStateNormal];
- [youpaipupseatBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
- [youpaipupseatBtn setBackgroundImage:[LCTools ColorImage:CGSizeMake(56.0f, 22.0f) FromColors:@[HexColorFromRGB(0xFFC551),HexColorFromRGB(0xFF4004)] ByGradientType:GradientLeftToRight] forState:UIControlStateNormal];
- youpaipupseatBtn.titleLabel.font = LCFont12;
- [youpaipupseatBtn addTarget:self action:@selector(youpaifupseatBtnClick) forControlEvents:UIControlEventTouchUpInside];
- [self.contentView addSubview:youpaipupseatBtn];
- self.youpaipupseatBtn = youpaipupseatBtn;
- [youpaipupseatBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerY.equalTo(self.contentView);
- make.right.equalTo(youpaipignoreBtn.mas_left).offset(-10.0f);
- make.size.mas_offset(CGSizeMake(56.0f, 22.0f));
- }];
-
-
- }
- - (void)youpaifreloadWithModel:(YOUPAILZChatRoomMemberModel *)model index:(NSInteger)index playType:(NSInteger)playType{
- self.youpaipmodel = model;
- self.youpaipindex = index;
-
- self.youpaiprankL.text = [NSString stringWithFormat:@"%@",@(index + 1)];
-
- self.youpaipavatarView.youpaipavatarURL = [LCTools getImageUrlWithAddress:model.youpaipavatar];
- self.youpaipavatarView.youpaippersonalityBoxURL = [LCTools getImageUrlWithAddress:model.youpaipavatar_frame];
-
- self.youpaipnicknameL.text = model.youpaipnickname;
-
- if (playType == 2) {
- [self.youpaipupseatBtn setBackgroundImage:[LCTools ColorImage:CGSizeMake(56.0f, 22.0f) FromColors:@[HexColorFromRGB(0xFF7FDA),HexColorFromRGB(0xFF48B3)] ByGradientType:GradientLeftToRight] forState:UIControlStateNormal];
- }else{
- [self.youpaipupseatBtn setBackgroundImage:[LCTools ColorImage:CGSizeMake(56.0f, 22.0f) FromColors:@[HexColorFromRGB(0xFFC551),HexColorFromRGB(0xFF4004)] ByGradientType:GradientLeftToRight] forState:UIControlStateNormal];
- }
-
- // self.youpaipvipImgV.hidden = YES;
- // self.youpaipboardImgV.hidden = YES;
- // self.youpaiplevelView.hidden = YES;
- //
- // UIView *frontV;
- //
- // if (model.vip_icon.length != 0) {
- // self.youpaipvipImgV.hidden = NO;
- // [self.youpaipvipImgV sd_setImageWithURL:[LCTools getImageUrlWithAddress:model.vip_icon]];
- // [self.youpaipvipImgV mas_remakeConstraints:^(MASConstraintMaker *make) {
- // if (frontV == nil) {
- // make.left.equalTo(self.youpaipnicknameL.mas_right).offset(3.0f);
- // }else{
- // make.left.equalTo(frontV.mas_right).offset(3.0f);
- // }
- // make.centerY.equalTo(self.youpaipnicknameL);
- // make.size.mas_offset(CGSizeMake(30.0f, 19.0f));
- // }];
- // frontV = self.youpaipvipImgV;
- // }
- //
- // if (model.rankInfo.img.length != 0) {
- // self.youpaipboardImgV.hidden = NO;
- // [self.youpaipboardImgV sd_setImageWithURL:[LCTools getImageUrlWithAddress:model.rankInfo.img]];
- // [self.youpaipboardImgV mas_remakeConstraints:^(MASConstraintMaker *make) {
- // if (frontV == nil) {
- // make.left.equalTo(self.youpaipnicknameL.mas_right).offset(3.0f);
- // }else{
- // make.left.equalTo(frontV.mas_right).offset(3.0f);
- // }
- // make.centerY.equalTo(self.youpaipnicknameL);
- // make.size.mas_offset(CGSizeMake(21.0f, 18.0f));
- // }];
- // frontV = self.youpaipboardImgV;
- // }
- //
- // self.youpaiplevelView.hidden = NO;
- // [self.youpaiplevelView youpaifreloadWithIcon:model.grade.img1 iconWidth:model.grade.icon_width bgImg:model.grade.img2 bgImgWidth:model.grade.icon1_width levelName:model.grade.grade_name level:model.grade.grade];
- // [self.youpaiplevelView mas_remakeConstraints:^(MASConstraintMaker *make) {
- // if (frontV == nil) {
- // make.left.equalTo(self.youpaipnicknameL.mas_right).offset(3.0f);
- // }else{
- // make.left.equalTo(frontV.mas_right).offset(3.0f);
- // }
- // make.centerY.equalTo(self.youpaipnicknameL);
- // make.size.mas_offset(self.youpaiplevelView.mj_size);
- // }];
-
- self.youpaipcontributionL.attributedText = [LCTools setRichTextWithTitle:@"贡献值:" subTitle:[NSString stringWithFormat:@"%@",model.youpaipscore] titleColor:[UIColor whiteColor] subTitleColor:HexColorFromRGB(0xFFDD8D) titleFontSize:10.0f subTitleFontSize:10.0f];
-
- }
- - (void)youpaifignoreBtnClick{
- if (self.youpaipignoreBtnClickBlock != nil) {
- self.youpaipignoreBtnClickBlock(self.youpaipmodel,self.youpaipindex);
- }
- }
- - (void)youpaifupseatBtnClick{
- if (self.youpaipupseatBtnClickBlock != nil) {
- self.youpaipupseatBtnClickBlock(self.youpaipmodel,self.youpaipindex);
- }
- }
- @end
|