CNLiveMineBodyListView.swift 5.86 KB
//
//  CNLiveMineBodyListView.swift
//  metaCode
//
//  Created by open on 2023/6/7.
//

import Foundation


class MineBodyOneListViewCell : UITableViewCell {
    
    lazy var nameLabel: UILabel = {
        let nameLabel = UILabel.init()
        nameLabel.textColor = .black
        nameLabel.font = BoldFont_16_Fit
        nameLabel.backgroundColor = .clear
        nameLabel.text = "我的身份"
        return nameLabel
    }()
    
    lazy var headerView: UIImageView = {
        let headerView = UIImageView.init()
        headerView.image = UIImage(named: "mine_header_icon_identity")
        headerView.backgroundColor = .clear
        headerView.contentMode = .scaleToFill
        return headerView
    }()
    
    lazy var mainView: UIView = {
        let mainView = UIView.init()
        mainView.backgroundColor = .white
        mainView.layer.cornerRadius = 8
        mainView.layer.masksToBounds = true
        return mainView
    }()
    
    lazy var lookBtn: UIButton = {
        let lookBtn = UIButton.init(type: .custom)
        lookBtn.setTitle("  去看看  ", for: .normal)
        lookBtn.setTitleColor(.white, for: .normal)
        lookBtn.titleLabel?.font = BoldFont_14
        lookBtn.layer.masksToBounds = true
        lookBtn.layer.cornerRadius = 15
        return lookBtn
    }()
    
    lazy var tipLabel: UILabel = {
        let tipLabel = UILabel.init()
        tipLabel.textColor = HexColor("#999999")
        tipLabel.text = "您暂未进行身份认证"
        tipLabel.font = Font_13
        return tipLabel
    }()
    
    
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        self.selectionStyle = .none
        self.backgroundColor = .clear
        
        addSubview(mainView)
        mainView.addSubview(headerView)
        headerView.addSubview(nameLabel)
        mainView.addSubview(tipLabel)
        mainView.addSubview(lookBtn)
        
        setupConstraints()
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    private func setupConstraints() {
        mainView.snp.makeConstraints { make in
            make.centerX.equalToSuperview()
            make.left.equalToSuperview().offset(15)
            make.right.equalToSuperview().offset(-15)
            make.top.bottom.equalToSuperview()
        }
        headerView.snp.makeConstraints { make in
            make.centerX.equalToSuperview()
            make.top.left.right.equalToSuperview()
            make.height.equalTo(40)
        }
        nameLabel.snp.makeConstraints { make in
            make.centerY.equalToSuperview()
            make.left.equalToSuperview().offset(15)
        }
        tipLabel.snp.makeConstraints { make in
            make.centerY.equalToSuperview().offset(20)
            make.left.equalToSuperview().offset(15)
        }
        lookBtn.snp.makeConstraints { make in
            make.centerY.equalToSuperview().offset(20)
            make.right.equalToSuperview().offset(-15)
            make.width.equalTo(80)
            make.height.equalTo(30)
        }
        lookBtn.setGradient(colors: [UIColor(red: 103/255.0, green: 197/255.0, blue: 255/255.0, alpha: 1),UIColor(red: 96/255.0, green: 154/255.0, blue: 255/255.0, alpha: 1)], startPoint: CGPoint(x: 0, y: 0.5), endPoint: CGPoint(x: 1, y: 0.5))
    }
}

class MineBodyTwoListViewCell : UITableViewCell {
    
    lazy var mainView: UIView = {
        let mainView = UIView.init()
        mainView.backgroundColor = .white
        mainView.layer.cornerRadius = 8
        mainView.layer.masksToBounds = true
        return mainView
    }()
    lazy var nameLabel: UILabel = {
        let nameLabel = UILabel.init()
        nameLabel.textColor = .black
        nameLabel.font = BoldFont_16_Fit
        nameLabel.backgroundColor = .clear
        return nameLabel
    }()
    lazy var headerView: UIImageView = {
        let headerView = UIImageView.init()
        headerView.backgroundColor = .clear
        headerView.contentMode = .scaleToFill
        return headerView
    }()
    lazy var moreBtn: UIButton = {
        let moreBtn = UIButton.init(type: .custom)
        moreBtn.setImage(UIImage(named: "mine_list_icon_right_more"), for: .normal)
        moreBtn.layer.masksToBounds = true
        moreBtn.layer.cornerRadius = 15
        return moreBtn
    }()
    
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        self.selectionStyle = .none
        self.backgroundColor = .clear
        
        addSubview(mainView)
        mainView.addSubview(headerView)
        headerView.addSubview(nameLabel)
        mainView.addSubview(moreBtn)
        
        setupConstraints()
        
    }
    
    private func setupConstraints() {
        mainView.snp.makeConstraints { make in
            make.centerX.equalToSuperview()
            make.left.equalToSuperview().offset(15)
            make.right.equalToSuperview().offset(-15)
            make.top.bottom.equalToSuperview()
        }
        headerView.snp.makeConstraints { make in
            make.centerY.equalToSuperview()
            make.left.equalTo(15)
            make.size.equalTo(20)
        }
        nameLabel.snp.makeConstraints { make in
            make.centerY.equalToSuperview()
            make.left.equalTo(headerView.snp.right).offset(7)
        }
        moreBtn.snp.makeConstraints { make in
            make.centerY.equalToSuperview()
            make.right.equalToSuperview().offset(-15)
            make.size.equalTo(30)
        }
    }
    
    public func setupWithDataSource(dict : Dictionary<String, Any>) {
        headerView.image = UIImage(named: dict["icon"] as! String)
        nameLabel.text = "\(dict["name"] ?? "")"
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}