196 lines
8.5 KiB
Objective-C
196 lines
8.5 KiB
Objective-C
//
|
|
// QXRankTopThreeView.m
|
|
// IsLandVoice
|
|
//
|
|
// Created by 启星 on 2025/3/4.
|
|
//
|
|
|
|
#import "QXRankTopThreeView.h"
|
|
#import "QXUserHomePageViewController.h"
|
|
@interface QXRankTopThreeView()
|
|
@property (nonatomic,strong)QXMyRankModel *firstModel;
|
|
@property (nonatomic,strong)QXMyRankModel *secondModel;
|
|
@property (nonatomic,strong)QXMyRankModel *thirdModel;
|
|
@end
|
|
@implementation QXRankTopThreeView
|
|
|
|
- (instancetype)initWithFrame:(CGRect)frame
|
|
{
|
|
self = [super initWithFrame:frame];
|
|
if (self) {
|
|
self = [[[NSBundle mainBundle]loadNibNamed:@"QXRankTopThreeView" owner:nil options:nil] lastObject];
|
|
MJWeakSelf
|
|
[self.firstHeaderImage addTapBlock:^(id _Nonnull obj) {
|
|
if ([self.firstModel.user_id isExist]) {
|
|
QXUserHomePageViewController *vc = [[QXUserHomePageViewController alloc] init];
|
|
vc.user_id = self.firstModel.user_id;
|
|
[weakSelf.navigationController pushViewController:vc animated:YES];
|
|
}
|
|
return;
|
|
}];
|
|
[self.secondHeaderImage addTapBlock:^(id _Nonnull obj) {
|
|
if ([self.secondModel.user_id isExist]) {
|
|
QXUserHomePageViewController *vc = [[QXUserHomePageViewController alloc] init];
|
|
vc.user_id = self.secondModel.user_id;
|
|
[weakSelf.navigationController pushViewController:vc animated:YES];
|
|
}
|
|
return;
|
|
}];
|
|
[self.thirdHeaderImage addTapBlock:^(id _Nonnull obj) {
|
|
if ([self.thirdModel.user_id isExist]) {
|
|
QXUserHomePageViewController *vc = [[QXUserHomePageViewController alloc] init];
|
|
vc.user_id = self.thirdModel.user_id;
|
|
[weakSelf.navigationController pushViewController:vc animated:YES];
|
|
}
|
|
return;
|
|
}];
|
|
self.frame = frame;
|
|
}
|
|
return self;
|
|
}
|
|
-(void)setList:(NSArray<QXMyRankModel *> *)list{
|
|
_list = list;
|
|
QXMyRankModel *firstModel;
|
|
QXMyRankModel *secondModel;
|
|
QXMyRankModel *thirdModel;
|
|
if (list.count >= 3) {
|
|
firstModel = list[0];
|
|
secondModel = list[1];
|
|
thirdModel = list[2];
|
|
}
|
|
if (list.count == 2) {
|
|
firstModel = list[0];
|
|
secondModel = list[1];
|
|
}
|
|
if (list.count == 1) {
|
|
firstModel = list[0];
|
|
}
|
|
|
|
if (firstModel) {
|
|
[self.firstHeaderImage sd_setImageWithURL:[NSURL URLWithString:firstModel.avatar] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]];
|
|
self.firstNameLabel.text = firstModel.nickname;
|
|
self.firstIDLabel.text = [NSString stringWithFormat:@"ID:%@",firstModel.user_code];
|
|
self.firstRankValueLabel.text = [NSString qx_showHotCountNum:firstModel.total.longLongValue];
|
|
self.firstRankValueLabel.adjustsFontSizeToFitWidth = YES;
|
|
}
|
|
|
|
if (secondModel) {
|
|
[self.secondHeaderImage sd_setImageWithURL:[NSURL URLWithString:secondModel.avatar] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]];
|
|
self.secondNameLabel.text = secondModel.nickname;
|
|
self.secondIDLabel.text = [NSString stringWithFormat:@"ID:%@",secondModel.user_code];
|
|
self.secondRankValueLabel.text = [NSString qx_showHotCountNum:secondModel.total.longLongValue];
|
|
self.secondRankValueLabel.adjustsFontSizeToFitWidth = YES;
|
|
}
|
|
|
|
if (thirdModel) {
|
|
[self.thirdHeaderImage sd_setImageWithURL:[NSURL URLWithString:thirdModel.avatar] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]];
|
|
self.thirdNameLabel.text = thirdModel.nickname;
|
|
self.thirdIDLabel.text = [NSString stringWithFormat:@"ID:%@",thirdModel.user_code];
|
|
self.thirdRankValueLabel.text = [NSString qx_showHotCountNum:thirdModel.total.longLongValue];
|
|
self.thirdRankValueLabel.adjustsFontSizeToFitWidth = YES;
|
|
}
|
|
self.firstModel = firstModel;
|
|
self.secondModel = secondModel;
|
|
self.thirdModel = thirdModel;
|
|
}
|
|
-(void)resetView{
|
|
self.firstHeaderImage.image = [UIImage imageNamed:@"user_header_placehoulder"];
|
|
self.secondHeaderImage.image = [UIImage imageNamed:@"user_header_placehoulder"];
|
|
self.thirdHeaderImage.image = [UIImage imageNamed:@"user_header_placehoulder"];
|
|
self.firstNameLabel.text = @"虚位以待";
|
|
self.secondNameLabel.text = @"虚位以待";
|
|
self.thirdNameLabel.text = @"虚位以待";
|
|
self.firstIDLabel.text = @"ID:";
|
|
self.secondIDLabel.text = @"ID:";
|
|
self.thirdIDLabel.text = @"ID:";
|
|
}
|
|
//
|
|
-(void)setRoomList:(NSArray<QXMyRankModel *> *)roomList{
|
|
_roomList = roomList;
|
|
QXMyRankModel *firstModel;
|
|
QXMyRankModel *secondModel;
|
|
QXMyRankModel *thirdModel;
|
|
if (roomList.count >= 3) {
|
|
firstModel = roomList[0];
|
|
secondModel = roomList[1];
|
|
thirdModel = roomList[2];
|
|
}
|
|
if (roomList.count == 2) {
|
|
firstModel = roomList[0];
|
|
secondModel = roomList[1];
|
|
}
|
|
if (roomList.count == 1) {
|
|
firstModel = roomList[0];
|
|
}
|
|
|
|
if (firstModel) {
|
|
[self.firstHeaderImage sd_setImageWithURL:[NSURL URLWithString:firstModel.room_cover] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]];
|
|
self.firstNameLabel.text = firstModel.room_name;
|
|
self.firstIDLabel.text = [NSString stringWithFormat:@"ID:%@",firstModel.room_number];
|
|
self.firstRankValueLabel.text = [NSString qx_showHotCountNum:firstModel.total.longLongValue];
|
|
self.firstRankValueLabel.adjustsFontSizeToFitWidth = YES;
|
|
}
|
|
|
|
if (secondModel) {
|
|
[self.secondHeaderImage sd_setImageWithURL:[NSURL URLWithString:secondModel.room_cover] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]];
|
|
self.secondNameLabel.text = secondModel.room_name;
|
|
self.secondIDLabel.text = [NSString stringWithFormat:@"ID:%@",secondModel.room_number];
|
|
self.secondRankValueLabel.text = [NSString qx_showHotCountNum:secondModel.total.longLongValue];
|
|
self.secondRankValueLabel.adjustsFontSizeToFitWidth = YES;
|
|
}
|
|
|
|
if (thirdModel) {
|
|
[self.thirdHeaderImage sd_setImageWithURL:[NSURL URLWithString:thirdModel.room_cover] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]];
|
|
self.thirdNameLabel.text = thirdModel.room_name;
|
|
self.thirdIDLabel.text = [NSString stringWithFormat:@"ID:%@",thirdModel.room_number];
|
|
self.thirdRankValueLabel.text = [NSString qx_showHotCountNum:thirdModel.total.longLongValue];
|
|
self.thirdRankValueLabel.adjustsFontSizeToFitWidth = YES;
|
|
}
|
|
self.firstModel = firstModel;
|
|
self.secondModel = secondModel;
|
|
self.thirdModel = thirdModel;
|
|
}
|
|
-(void)setGuildList:(NSArray<QXMyRankModel *> *)guildList{
|
|
_guildList = guildList;
|
|
QXMyRankModel *firstModel;
|
|
QXMyRankModel *secondModel;
|
|
QXMyRankModel *thirdModel;
|
|
if (guildList.count >= 3) {
|
|
firstModel = guildList[0];
|
|
secondModel = guildList[1];
|
|
thirdModel = guildList[2];
|
|
}
|
|
if (guildList.count == 2) {
|
|
firstModel = guildList[0];
|
|
secondModel = guildList[1];
|
|
}
|
|
if (guildList.count == 1) {
|
|
firstModel = guildList[0];
|
|
}
|
|
|
|
if (firstModel) {
|
|
[self.firstHeaderImage sd_setImageWithURL:[NSURL URLWithString:firstModel.cover] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]];
|
|
self.firstNameLabel.text = firstModel.guild_name;
|
|
self.firstIDLabel.text = [NSString stringWithFormat:@"ID:%@",firstModel.guild_special_id];
|
|
self.firstRankValueLabel.text = [NSString qx_showHotCountNum:firstModel.total.longLongValue];
|
|
self.firstRankValueLabel.adjustsFontSizeToFitWidth = YES;
|
|
}
|
|
|
|
if (secondModel) {
|
|
[self.secondHeaderImage sd_setImageWithURL:[NSURL URLWithString:secondModel.cover] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]];
|
|
self.secondNameLabel.text = secondModel.guild_name;
|
|
self.secondIDLabel.text = [NSString stringWithFormat:@"ID:%@",secondModel.guild_special_id];
|
|
self.secondRankValueLabel.text = [NSString qx_showHotCountNum:secondModel.total.longLongValue];
|
|
self.secondRankValueLabel.adjustsFontSizeToFitWidth = YES;
|
|
}
|
|
|
|
if (thirdModel) {
|
|
[self.thirdHeaderImage sd_setImageWithURL:[NSURL URLWithString:thirdModel.cover] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]];
|
|
self.thirdNameLabel.text = thirdModel.guild_name;
|
|
self.thirdIDLabel.text = [NSString stringWithFormat:@"ID:%@",thirdModel.guild_special_id];
|
|
self.thirdRankValueLabel.text = [NSString qx_showHotCountNum:thirdModel.total.longLongValue];
|
|
self.thirdRankValueLabel.adjustsFontSizeToFitWidth = YES;
|
|
}
|
|
}
|
|
@end
|