//
//  MyWalletRankTableCell.m
//  Open
//
//  Created by 雷俊博 on 2021/7/21.
//  Copyright © 2021 黄江涛 . All rights reserved.
//

#import "MyWalletRankTableCell.h"


@interface MyWalletRankTableCell ()


@end

@implementation MyWalletRankTableCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        [self setupUI];
    }
    return self;
}

- (void)setupUI
{
  
    
    UIImageView *userIcon = [UIImageView new];
    userIcon.layer.cornerRadius = 23 * WIDTHRADIU;
    userIcon.layer.masksToBounds = YES;
    [self.contentView addSubview:userIcon];
    [userIcon mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(55 * WIDTHRADIU);
        make.top.offset(15 * WIDTHRADIU);
        make.width.height.offset(46 * WIDTHRADIU);
    }];
    
    self.userIcon = userIcon;
    
    //top1
    UIImageView *top1Icon = [UIImageView new];
    top1Icon.image = [UIImage imageNamed:@"coin_TOP1"];
    [self.contentView addSubview:top1Icon];
    [top1Icon mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(userIcon.mas_bottom).offset(-6 * WIDTHRADIU);
        make.centerX.equalTo(userIcon);
        make.width.offset(30 * WIDTHRADIU);
        make.height.offset(12 * WIDTHRADIU);
    }];
    
    self.top1Icon = top1Icon;
    
    
    //Fireworks
    UIImageView *fireworksImg = [UIImageView new];
    
    fireworksImg.image = [UIImage imageNamed:@"coin_zhuangshi"];
    [self.contentView addSubview:fireworksImg];
    [fireworksImg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(userIcon);
        make.bottom.equalTo(userIcon);
        make.width.offset(57 * WIDTHRADIU);
        make.height.offset(18.5 * WIDTHRADIU);
    }];
    
    self.fireworksImg = fireworksImg;
    
    [self.contentView sendSubviewToBack:fireworksImg];
    
    
    
    
    
    UIImageView *rankIcon = [UIImageView new];
    [self.contentView addSubview:rankIcon];
    [rankIcon mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(15 * WIDTHRADIU);
        make.centerY.equalTo(userIcon);
        make.width.height.offset(24 * WIDTHRADIU);
    }];
    
    self.rankIcon = rankIcon;
    
    UILabel *lb_number = [UILabel new];
    lb_number.text = @"1";
    lb_number.textColor = [UIColor colorWithHex:0x808080];
    lb_number.font = [UIFont boldSystemFontOfSize:15 * WIDTHRADIU];
    [self.contentView addSubview:lb_number];
    [lb_number mas_makeConstraints:^(MASConstraintMaker *make) {
        make.center.equalTo(rankIcon);
    }];
    
    self.lb_rank = lb_number;
    
    
    
    //用户昵称
    UILabel *lb_nickName = [UILabel new];
    lb_nickName.text = @"--";
    lb_nickName.textColor = [UIColor colorWithHex:0x4c4c4c];
    lb_nickName.font = [UIFont boldSystemFontOfSize:16 * WIDTHRADIU];
    [self.contentView addSubview:lb_nickName];
    [lb_nickName mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(userIcon.mas_right).offset(10 * WIDTHRADIU);
        make.centerY.equalTo(rankIcon);
    }];
    
    self.lb_nickName = lb_nickName;
    
    //累计收益
    UILabel *lb_profitSum = [UILabel new];
    lb_profitSum.text = @"--元";
    lb_profitSum.textColor = [UIColor colorWithHex:0xf98505];
    lb_profitSum.font = [UIFont boldSystemFontOfSize:15 * WIDTHRADIU];
    [self.contentView addSubview:lb_profitSum];
    [lb_profitSum mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.offset(-15 * WIDTHRADIU);
        make.centerY.equalTo(rankIcon);
    }];
    self.lb_profitSum = lb_profitSum;
    
}
- (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
}

@end
