| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675 |
- //
- // MORankListCell.m
- // MiMoLive
- //
- // Created by SuperC on 2023/11/30.
- //
- #import "MORankListCell.h"
- @implementation MORankListCell
- - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
- {
- if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])
- {
- self.selectionStyle = UITableViewCellSelectionStyleNone;
- self.backgroundColor = [UIColor clearColor];
-
- [self setupUI];
- }
- return self;
- }
- - (void)setupUI{
-
- [self.contentView addSubview:self.bgView];
- [self.bgView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.edges.equalTo(self.contentView);
- }];
-
- UIView *superView = self.bgView;
-
- [superView addSubview:self.numLab];
- [self.numLab mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(superView).offset(8);
- make.centerY.equalTo(superView);
- make.height.equalTo(@30.0);
- make.width.equalTo(@30.0);
- make.width.greaterThanOrEqualTo(@13.0);
- }];
-
- [superView addSubview:self.numImgView];
- [self.numImgView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.edges.equalTo(self.numLab);
- }];
-
- [superView addSubview:self.iconImg];
- [self.iconImg mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerY.equalTo(superView);
- make.width.height.equalTo(@40.0);
- make.left.equalTo(superView).offset(52.0);
- }];
- self.iconImg.layer.cornerRadius = 40.0 / 2.0;
- self.iconImg.layer.masksToBounds = YES;
-
- [superView addSubview:self.headBgView];
- [self.headBgView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerX.equalTo(self.iconImg);
- make.centerY.equalTo(self.iconImg);
- make.width.height.equalTo(@40.0);
- }];
- self.headBgView.headImgWidth = 40.0;
-
- [superView addSubview:self.headBtn];
- [self.headBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.width.height.equalTo(@40.0);
- make.center.equalTo(self.iconImg);
- }];
-
- [superView addSubview:self.nameLab];
- [self.nameLab mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.iconImg.mas_right).offset(20.0);
- make.top.equalTo(self.iconImg.mas_top).offset(0.0);
- make.height.equalTo(@19.0);
- make.width.greaterThanOrEqualTo(@20.0);
- }];
-
- [superView addSubview:self.levelImgView];
- [self.levelImgView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.nameLab.mas_right).offset(4.0);
- make.centerY.equalTo(self.nameLab);
- make.width.equalTo(@(KLevelWidth));
- make.height.equalTo(@(MOLevelNormalHeight));
- }];
-
- [superView addSubview:self.vipImgView];
- [self.vipImgView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.levelImgView.mas_right).offset(2.0);
- make.centerY.equalTo(self.levelImgView.mas_centerY);
- make.width.equalTo(@(MOLevelNormalHeight));
- make.height.equalTo(@(MOLevelNormalHeight));
- }];
-
- [superView addSubview:self.genderImg];
- [self.genderImg mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerY.equalTo(self.nameLab.mas_centerY);
- make.left.equalTo(self.nameLab.mas_right).offset(10.0);
- make.width.height.equalTo(@15.0);
- }];
-
- [superView addSubview:self.contentLab];
- [self.contentLab mas_makeConstraints:^(MASConstraintMaker *make) {
- make.bottom.equalTo(self.iconImg.mas_bottom).offset(-3.0);
- make.left.equalTo(self.iconImg.mas_right).offset(20.0);
- make.width.equalTo(@35.0);
- }];
-
- [superView addSubview:self.goldNumBtn];
- [self.goldNumBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.left.equalTo(self.contentLab.mas_right).offset(0.0);
- make.left.equalTo(self.iconImg.mas_right).offset(16.0);
- make.width.equalTo(@90.0);
- make.height.equalTo(@18.0);
- make.bottom.equalTo(self.iconImg.mas_bottom);
- }];
-
- [superView addSubview:self.upImgView];
- [self.upImgView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerY.equalTo(self.contentLab.mas_centerY).offset(-1.0);
- make.left.equalTo(self.goldNumBtn.mas_right).offset(-5.0);
- make.width.equalTo(@10.0);
- make.height.equalTo(@12.0);
- }];
-
- [superView addSubview:self.followBtn];
- [self.followBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.equalTo(superView).offset(-23.0);
- make.width.equalTo(@60.0);
- make.height.equalTo(@20.0);
- make.centerY.equalTo(superView);
- }];
-
- // NSArray *colorArr = @[[MOTools colorWithHexString:@"#FF62EE" alpha:1.0],[MOTools colorWithHexString:@"#9923FF" alpha:1.0]];
- // UIImage *image = [MOTools createGradientRectImageWithBounds:CGRectMake(0, 0, 60.0, 24.0) Colors:colorArr GradientType:0];
- UIImage *image = [MOTools createImageWithColor:kBaseBtnBgColor];
- UIImage *grayImg = [MOTools createImageWithColor:[UIColor grayColor]];
- [self.followBtn setBackgroundImage:image forState:UIControlStateNormal];
- [self.followBtn setBackgroundImage:grayImg forState:UIControlStateSelected];
- self.followBtn.layer.cornerRadius = 20.0 / 2.0;
- self.followBtn.layer.masksToBounds = YES;
- }
- - (void)awakeFromNib {
- [super awakeFromNib];
- // Initialization code
- }
- - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
- [super setSelected:selected animated:animated];
- // Configure the view for the selected state
- }
- - (void)setCellModel:(MORanklist *)cellModel{
- _cellModel = cellModel;
-
- // CGFloat numWidth = [MOTools getWidthWithString:self.numLab.text font:[MOTextTools getTheFontWithSize:20.0 AndFontName:kNormalContentFontStr]];
- // CGFloat iconLeftSpac = numWidth + 22.0 * 2.0;
- //
- // [self.iconImg mas_updateConstraints:^(MASConstraintMaker *make) {
- // make.left.equalTo(self.bgView).offset(iconLeftSpac);
- // }];
-
- [self.iconImg sd_setImageWithURL:[NSURL URLWithString:cellModel.userBase.userProfile.avatar] placeholderImage:[UIImage imageNamed:@"icon_mine_placeHolder"]];
-
- if(cellModel.userBase.vipType == 0){
- ShimmerLabelConfig *config = [[ShimmerLabelConfig alloc] init];
- config.shimmerStyle = ShimmerStyleNone;
- self.nameLab.textColor = [MOTools colorWithHexString:@"#282828" alpha:1.0];
- [self.nameLab startShimmerWithConfig:config];
- }
- else{
- // if(cellModel.userBase.vipType == 1 || cellModel.userBase.vipType == 5 || cellModel.userBase.vipType == 6){
- // ShimmerLabelConfig *config = [[ShimmerLabelConfig alloc] init];
- // config.shimmerStyle = ShimmerStyleColorsFlow;
- // config.shimmerColorArray = VipNameColorArr_white_1;
- // config.shimmerSpeed = 20;
- // [self.nameLab startShimmerWithConfig:config];
- // }
- // else if (cellModel.userBase.vipType == 2){
- // ShimmerLabelConfig *config = [[ShimmerLabelConfig alloc] init];
- // config.shimmerStyle = ShimmerStyleColorsFlow;
- // config.shimmerColorArray = VipNameColorArr_white_2;
- // config.shimmerSpeed = 20;
- // [self.nameLab startShimmerWithConfig:config];
- // }
- // else if (cellModel.userBase.vipType == 3){
- // ShimmerLabelConfig *config = [[ShimmerLabelConfig alloc] init];
- // config.shimmerStyle = ShimmerStyleGradient;
- // config.shimmerColorArray = VipNameColorArr_3;
- // [self.nameLab startShimmerWithConfig:config];
- // }
- // else if (cellModel.userBase.vipType == 4){
- // ShimmerLabelConfig *config = [[ShimmerLabelConfig alloc] init];
- // config.shimmerStyle = ShimmerStyleNone;
- // self.nameLab.textColor = VipNameColor_White_4;
- // [self.nameLab startShimmerWithConfig:config];
- // }
- }
-
- NSString *goldNumStr = [MOTextTools numberToStringWith:cellModel.total];
- [self.goldNumBtn setTitle:goldNumStr forState:UIControlStateNormal];
-
- if(self.typeNum == 1 || self.typeNum == 2){//直播间贡献榜 or 总贡献榜
- [self.goldNumBtn setImage:[UIImage imageNamed:@"icon_rank_zuan"] forState:UIControlStateNormal];
- }
-
- CGFloat goldNumWidth = [MOTools getWidthWithString:goldNumStr font:[UIFont systemFontOfSize:12.0]] + 30.0;
- if(goldNumWidth > 150.0){
- goldNumWidth = 150.0;
- }
- if(goldNumWidth < 30.0){
- goldNumWidth = 30.0;
- }
- [self.goldNumBtn mas_updateConstraints:^(MASConstraintMaker *make) {
- make.width.equalTo(@(goldNumWidth));
- }];
-
- self.genderImg.hidden = YES;
- if(cellModel.userBase.userProfile.gender == 1){
- [self.genderImg setImage:[UIImage imageNamed:@"icon_contact_man"]];
- }
- else if (cellModel.userBase.userProfile.gender == 2){
- [self.genderImg setImage:[UIImage imageNamed:@"icon_contact_woman"]];
- }
- else{
- self.genderImg.hidden = YES;
- }
-
- self.followBtn.selected = cellModel.userBase.follow;
-
- self.headBgView.hidden = YES;
- if(self.isShowLiving){
-
- //是否展示直播中
- if(cellModel.userBase.liveRoomId.length != 0){
- self.headBgView.hidden = NO;
-
- self.headBgView.isLiving = YES;
- [self.headBgView updataViewStatus];
- self.headBgView.imgUrlStr = @"";
- }
- // else{
- // if(cellModel.userBase.userProfile.adornment.headgearRes.length > 0){
- // self.headBgView.hidden = NO;
- // self.headBgView.isLiving = NO;
- // self.headBgView.effectType = cellModel.userBase.userProfile.adornment.headgearType;
- // self.headBgView.imgUrlStr = cellModel.userBase.userProfile.adornment.headgearRes;
- // }
- // else{
- // self.headBgView.hidden = YES;
- // }
- // }
- }
- // else{
- // //不展示直播中, 仅展示头像框逻辑
- // if(cellModel.userBase.userProfile.adornment.headgearRes.length > 0){
- // self.headBgView.hidden = NO;
- // self.headBgView.isLiving = NO;
- // self.headBgView.effectType = cellModel.userBase.userProfile.adornment.headgearType;
- // self.headBgView.imgUrlStr = cellModel.userBase.userProfile.adornment.headgearRes;
- // }
- // else{
- // self.headBgView.hidden = YES;
- // }
- // }
-
- self.levelImgView.levelNum = cellModel.userBase.level;
- if(cellModel.userBase.level >= 100){
- [self.levelImgView mas_updateConstraints:^(MASConstraintMaker *make) {
- make.width.equalTo(@(MOLevelMaxWidth));
- }];
- }
- else{
- [self.levelImgView mas_updateConstraints:^(MASConstraintMaker *make) {
- make.width.equalTo(@(MOLevelNormalWidth));
- }];
- }
-
- MOBaseVips *vipObject = [[MOSvgaSourceManage shareManager] toGetTheVipObjectWith:cellModel.userBase.vipType];
- if(vipObject.thumbnail.length > 0){
- [self.vipImgView sd_setImageWithURL:[NSURL URLWithString:vipObject.thumbnail] placeholderImage:nil];
-
- if(cellModel.userBase.remark.length > 0){
- self.nameLab.text = [self handleRankNameLabel:cellModel.userBase.remark vip:YES];
- }
- else{
- self.nameLab.text = [self handleRankNameLabel:cellModel.userBase.userProfile.nickname vip:YES];
- }
- }
- else{
- [self.vipImgView setImage:nil];
-
- if(cellModel.userBase.remark.length > 0){
- self.nameLab.text = [self handleRankNameLabel:cellModel.userBase.remark vip:NO];
- }
- else{
- self.nameLab.text = [self handleRankNameLabel:cellModel.userBase.userProfile.nickname vip:NO];
- }
- }
- }
- //设置热度数据
- - (void)setHeatModel:(MOHeatRankItem *)heatModel {
- _heatModel = heatModel;
-
- // CGFloat numWidth = [MOTools getWidthWithString:self.numLab.text font:[MOTextTools getTheFontWithSize:20.0 AndFontName:kNormalContentFontStr]];
- // CGFloat iconLeftSpac = numWidth + 22.0 * 2.0;
- //
- // [self.iconImg mas_updateConstraints:^(MASConstraintMaker *make) {
- // make.left.equalTo(self.bgView).offset(iconLeftSpac);
- // }];
-
- [self.iconImg sd_setImageWithURL:[NSURL URLWithString:heatModel.user.userProfile.avatar] placeholderImage:[UIImage imageNamed:@"icon_mine_placeHolder"]];
-
- if(heatModel.user.vipType == 0){
- ShimmerLabelConfig *config = [[ShimmerLabelConfig alloc] init];
- config.shimmerStyle = ShimmerStyleNone;
- self.nameLab.textColor = [MOTools colorWithHexString:@"#282828" alpha:1.0];
- [self.nameLab startShimmerWithConfig:config];
- }
- else{
- // if(cellModel.userBase.vipType == 1 || cellModel.userBase.vipType == 5 || cellModel.userBase.vipType == 6){
- // ShimmerLabelConfig *config = [[ShimmerLabelConfig alloc] init];
- // config.shimmerStyle = ShimmerStyleColorsFlow;
- // config.shimmerColorArray = VipNameColorArr_white_1;
- // config.shimmerSpeed = 20;
- // [self.nameLab startShimmerWithConfig:config];
- // }
- // else if (cellModel.userBase.vipType == 2){
- // ShimmerLabelConfig *config = [[ShimmerLabelConfig alloc] init];
- // config.shimmerStyle = ShimmerStyleColorsFlow;
- // config.shimmerColorArray = VipNameColorArr_white_2;
- // config.shimmerSpeed = 20;
- // [self.nameLab startShimmerWithConfig:config];
- // }
- // else if (cellModel.userBase.vipType == 3){
- // ShimmerLabelConfig *config = [[ShimmerLabelConfig alloc] init];
- // config.shimmerStyle = ShimmerStyleGradient;
- // config.shimmerColorArray = VipNameColorArr_3;
- // [self.nameLab startShimmerWithConfig:config];
- // }
- // else if (cellModel.userBase.vipType == 4){
- // ShimmerLabelConfig *config = [[ShimmerLabelConfig alloc] init];
- // config.shimmerStyle = ShimmerStyleNone;
- // self.nameLab.textColor = VipNameColor_White_4;
- // [self.nameLab startShimmerWithConfig:config];
- // }
- }
-
- NSString *goldNumStr = [MOTextTools numberToStringAboutTwoWith:heatModel.heat];
- [self.goldNumBtn setTitle:goldNumStr forState:UIControlStateNormal];
- [self.goldNumBtn setImage:[UIImage imageNamed:@"icon_rank_heat"] forState:UIControlStateNormal];
-
- CGFloat goldNumWidth = [MOTools getWidthWithString:goldNumStr font:[UIFont systemFontOfSize:12.0]] + 30.0;
- if(goldNumWidth > 150.0){
- goldNumWidth = 150.0;
- }
- if(goldNumWidth < 30.0){
- goldNumWidth = 30.0;
- }
- [self.goldNumBtn mas_updateConstraints:^(MASConstraintMaker *make) {
- make.width.equalTo(@(goldNumWidth));
- }];
-
- self.genderImg.hidden = YES;
- if(heatModel.user.userProfile.gender == 1){
- [self.genderImg setImage:[UIImage imageNamed:@"icon_contact_man"]];
- }
- else if (heatModel.user.userProfile.gender == 2){
- [self.genderImg setImage:[UIImage imageNamed:@"icon_contact_woman"]];
- }
- else{
- self.genderImg.hidden = YES;
- }
-
- self.followBtn.selected = heatModel.user.follow;
-
- self.headBgView.hidden = YES;
- if(self.isShowLiving){
-
- //是否展示直播中
- if(heatModel.user.liveRoomId.length != 0){
- self.headBgView.hidden = NO;
-
- self.headBgView.isLiving = YES;
- [self.headBgView updataViewStatus];
- self.headBgView.imgUrlStr = @"";
- }
- // else{
- // if(heatModel.user.userProfile.adornment.headgearRes.length > 0){
- // self.headBgView.hidden = NO;
- // self.headBgView.isLiving = NO;
- // self.headBgView.effectType = heatModel.user.userProfile.adornment.headgearType;
- // self.headBgView.imgUrlStr = heatModel.user.userProfile.adornment.headgearRes;
- // }
- // else{
- // self.headBgView.hidden = YES;
- // }
- // }
- }
- // else{
- // //不展示直播中, 仅展示头像框逻辑
- // if(heatModel.user.userProfile.adornment.headgearRes.length > 0){
- // self.headBgView.hidden = NO;
- // self.headBgView.isLiving = NO;
- // self.headBgView.effectType = heatModel.user.userProfile.adornment.headgearType;
- // self.headBgView.imgUrlStr = heatModel.user.userProfile.adornment.headgearRes;
- // }
- // else{
- // self.headBgView.hidden = YES;
- // }
- // }
-
- self.levelImgView.levelNum = heatModel.user.level;
- if(heatModel.user.level >= 100){
- [self.levelImgView mas_updateConstraints:^(MASConstraintMaker *make) {
- make.width.equalTo(@(MOLevelMaxWidth));
- }];
- }
- else{
- [self.levelImgView mas_updateConstraints:^(MASConstraintMaker *make) {
- make.width.equalTo(@(MOLevelNormalWidth));
- }];
- }
-
- MOBaseVips *vipObject = [[MOSvgaSourceManage shareManager] toGetTheVipObjectWith:heatModel.user.vipType];
- if(vipObject.thumbnail.length > 0){
- [self.vipImgView sd_setImageWithURL:[NSURL URLWithString:vipObject.thumbnail] placeholderImage:nil];
-
- if(heatModel.user.remark.length > 0){
- self.nameLab.text = [self handleRankNameLabel:heatModel.user.remark vip:YES];
- }
- else{
- self.nameLab.text = [self handleRankNameLabel:heatModel.user.userProfile.nickname vip:YES];
- }
- }
- else{
- [self.vipImgView setImage:nil];
-
- if(heatModel.user.remark.length > 0){
- self.nameLab.text = [self handleRankNameLabel:heatModel.user.remark vip:NO];
- }
- else{
- self.nameLab.text = [self handleRankNameLabel:heatModel.user.userProfile.nickname vip:NO];
- }
- }
- }
- - (NSString *)handleRankNameLabel:(NSString *)name vip:(BOOL)vip {
- if (SCREENWIDTH < 400.0 || vip) {
- return [MOTools trimString:name maxLength:12];
- } else {
- return [MOTools trimString:name maxLength:13];
- }
- }
- #pragma mark - Lazy
- - (UIView *)bgView{
- if(!_bgView){
- _bgView = [[UIView alloc] init];
- _bgView.backgroundColor = [MOTools colorWithHexString:@"#FFFFFF" alpha:1.0];
- }
- return _bgView;
- }
- - (UIImageView *)iconImg{
- if (!_iconImg)
- {
- _iconImg = [[UIImageView alloc] init];
- _iconImg.clipsToBounds = YES;
- _iconImg.userInteractionEnabled = NO;
- _iconImg.contentMode = UIViewContentModeScaleAspectFill;
- [_iconImg setImage:[UIImage imageNamed:@"icon_mine_placeHolder"]];
- }
- return _iconImg;
- }
- - (UILabel *)numLab{
- if (!_numLab)
- {
- _numLab = [[UILabel alloc] init];
- _numLab.text = @"0";
- _numLab.font = [MOTextTools poppinsBoldFont:15];
- _numLab.textColor = [MOTools colorWithHexString:@"#CDCFD9"];
- _numLab.textAlignment = NSTextAlignmentCenter;
- _numLab.numberOfLines = 1;
-
- }
- return _numLab;
- }
- - (UIImageView *)numImgView {
- if (!_numImgView) {
- _numImgView = [[UIImageView alloc] init];
- _numImgView.hidden = YES;
- }
- return _numImgView;
- }
- - (MOShimmerLabel *)nameLab{
- if (!_nameLab)
- {
- _nameLab = [[MOShimmerLabel alloc] init];
- _nameLab.text = @"MiMo LiveWe";
- _nameLab.font = [MOTextTools poppinsMediumFont:16];
- _nameLab.textColor = kBaseTextColor_1;
- _nameLab.textAlignment = NSTextAlignmentLeft;
- _nameLab.numberOfLines = 1;
-
- }
- return _nameLab;
- }
- - (UILabel *)contentLab{
- if (!_contentLab)
- {
- _contentLab = [[UILabel alloc] init];
- _contentLab.text = @"NEED";
- _contentLab.font = [MOTextTools getTheFontWithSize:12.0 AndFontName:kNormalContentFontStr];
- _contentLab.textColor = [MOTools colorWithHexString:@"#ABABAB" alpha:1.0];
- _contentLab.textAlignment = NSTextAlignmentLeft;
- _contentLab.numberOfLines = 1;
- _contentLab.hidden = YES;
-
- }
- return _contentLab;
- }
- - (UIImageView *)genderImg{
- if (!_genderImg)
- {
- _genderImg = [[UIImageView alloc] init];
- _genderImg.clipsToBounds = YES;
- _genderImg.userInteractionEnabled = NO;
- _genderImg.contentMode = UIViewContentModeScaleAspectFill;
- _genderImg.hidden = YES;
- }
- return _genderImg;
- }
- - (UIImageView *)upImgView{
- if (!_upImgView)
- {
- _upImgView = [[UIImageView alloc] init];
- _upImgView.clipsToBounds = YES;
- _upImgView.userInteractionEnabled = NO;
- [_upImgView setImage:[UIImage imageNamed:@"icon_live_center_lv_up"]];
- _upImgView.contentMode = UIViewContentModeScaleAspectFit;
- _upImgView.hidden = YES;
- }
- return _upImgView;
- }
- - (BigBtn *)followBtn{
- if (!_followBtn)
- {
- _followBtn = [BigBtn buttonWithType:UIButtonTypeCustom];
- [_followBtn setTitle:NSLocalString(@"mimo_room_user_info_follow") forState:UIControlStateNormal];
- [_followBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
- _followBtn.titleLabel.font = [MOTextTools getTheFontWithSize:12.0 AndFontName:kNormalContentFontStr];
- [_followBtn addTarget:self action:@selector(followBtnClick) forControlEvents:UIControlEventTouchUpInside];
- _followBtn.hidden = YES;
- }
- return _followBtn;
- }
- - (UIButton *)goldNumBtn{
- if (!_goldNumBtn)
- {
- _goldNumBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- _goldNumBtn.backgroundColor = [UIColor clearColor];
- [_goldNumBtn setImage:[UIImage imageNamed:@"icon_rank_gold_bean"] forState:UIControlStateNormal];
- [_goldNumBtn setTitle:@"0" forState:UIControlStateNormal];
- _goldNumBtn.titleLabel.font = [MOTextTools mediumFont:12];
- _goldNumBtn.titleEdgeInsets = UIEdgeInsetsMake(0, 3.0, 0, 0);
- [_goldNumBtn setTitleColor:[MOTools colorWithHexString:@"#5C5E66"] forState:UIControlStateNormal];
- _goldNumBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
- }
- return _goldNumBtn;
- }
- - (void)followBtnClick{
- if(self.followBtn.selected){
- return;
- }
- else{
- [self followSomeOneWith:self.cellModel.userBase.userProfile.id];
- }
- }
- - (void)followSomeOneWith:(NSString *)targetId{
- WEAKSELF
-
- if(targetId.length == 0){
- return;
- }
-
- if([targetId isEqualToString:GetUserId]){
- [MBProgressHUD showTipMessageInWindow:NSLocalString(@"mimo_common_cannot_to_yourself")];
- return;
- }
-
- NSArray *targetArr = @[targetId];
-
- NSDictionary *dict;
-
- if(self.roomId.length > 0){
- dict = @{@"type":@"1",
- @"target":targetArr,
- @"roomId":self.roomId};
- }
- else{
- dict = @{@"type":@"1",
- @"target":targetArr};
- }
-
- [kHttpManager toSubmitForFollowWithParams:dict andBlock:^(id _Nonnull data, NSError * _Nonnull error) {
- if(kCode_Success){
-
- [MBProgressHUD showTipMessageInWindow:NSLocalString(@"mimo_Tip_Follow_Success")];
-
- weakSelf.followBtnBlock ? weakSelf.followBtnBlock(weakSelf.cellModel,weakSelf.cellIndexPath) : nil;
- }
- else{
- kShowNetError(data)
- }
- }];
- }
- - (MOHeadCustomView *)headBgView{
- if(!_headBgView){
- _headBgView = [[MOHeadCustomView alloc] init];
- }
- return _headBgView;
- }
- - (UIButton *)headBtn{
- if(!_headBtn){
- _headBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- _headBtn.backgroundColor = [UIColor clearColor];
- [_headBtn setTitle:@"" forState:UIControlStateNormal];
- [_headBtn addTarget:self action:@selector(headBtnClick) forControlEvents:UIControlEventTouchUpInside];
- }
- return _headBtn;
- }
- - (void)headBtnClick{
- if (self.cellModel) {
- self.headBtnBlock ? self.headBtnBlock(self.cellModel) : nil;
- }
-
- if (self.heatModel) {
- self.heatRankHeadBtnBlock ? self.heatRankHeadBtnBlock(self.heatModel) : nil;
- }
- }
- - (UIImageView *)vipImgView{
- if(!_vipImgView){
- _vipImgView = [[UIImageView alloc] init];
- _vipImgView.contentMode = UIViewContentModeScaleAspectFit;
- }
- return _vipImgView;
- }
- - (MOBaseLevelView *)levelImgView{
- if(!_levelImgView){
- _levelImgView = [[MOBaseLevelView alloc] init];
- }
- return _levelImgView;
- }
- @end
|