CNLiveMineSubBodyListView.swift 8.19 KB
//
//  CNLiveMineSubBodyListView.swift
//  metaCode
//
//  Created by open on 2023/6/7.
//

import Foundation

class MineInfoLListTableViewCell : UITableViewCell {
    
    lazy var mainView: UIImageView = {
        let mainView = UIImageView.init()
        mainView.contentMode = .scaleToFill
        mainView.backgroundColor = .clear
        mainView.isUserInteractionEnabled = true
        mainView.image = UIImage(named: "mine_sub_list_add_info")
        return mainView
    }()
    
    lazy var iconView : UIImageView = {
        let iconView = UIImageView.init()
        iconView.contentMode = .scaleToFill
        iconView.backgroundColor = .clear
        iconView.layer.masksToBounds = true
        iconView.layer.cornerRadius = 25
        return iconView
    }()
    
    lazy var titleLabel: UILabel = {
        let titleLabel = UILabel.init()
        titleLabel.backgroundColor = .clear
        titleLabel.textColor = .black
        titleLabel.font = BoldFont_18_Fit
        return titleLabel
    }()
    
    lazy var addBtn: UIButton = {
        let addBtn = UIButton.init(type: .custom)
        addBtn.setTitle("  去添加  ", for: .normal)
        addBtn.setTitleColor(.white, for: .normal)
        addBtn.backgroundColor = HexColor("#67C5FF")
        addBtn.titleLabel?.font = BoldFont_15
        addBtn.layer.cornerRadius = 15
        addBtn.layer.masksToBounds = true
        return addBtn
    }()
    
    public func setupWithDataSource(icon: String, name: String) {
        iconView.image = UIImage(named: icon)
        titleLabel.text = name
    }
    
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        self.selectionStyle = .none
        self.backgroundColor = .clear
        
        addSubview(mainView)
        mainView.addSubview(iconView)
        mainView.addSubview(titleLabel)
        mainView.addSubview(addBtn)
        
        setupConstraints()
    }
    
    func setupConstraints() {
        mainView.snp.makeConstraints { make in
            make.left.equalToSuperview().offset(15)
            make.right.equalToSuperview().offset(-15)
            make.top.equalToSuperview().offset(5)
            make.bottom.equalToSuperview().offset(-5)
        }
        iconView.snp.makeConstraints { make in
            make.centerY.equalToSuperview()
            make.left.equalToSuperview().offset(15)
            make.size.equalTo(50)
        }
        titleLabel.snp.makeConstraints { make in
            make.centerY.equalToSuperview()
            make.left.equalTo(iconView.snp.right).offset(10)
        }
        addBtn.snp.makeConstraints { make in
            make.centerY.equalToSuperview()
            make.right.equalToSuperview().offset(-15)
            make.width.equalTo(80)
            make.height.equalTo(30)
        }
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}

class MineStandInfoTableViewCell: UITableViewCell {
    
    lazy var mainView: UIImageView = {
        let mainView = UIImageView.init()
        mainView.contentMode = .scaleToFill
        mainView.backgroundColor = .white
        mainView.isUserInteractionEnabled = true
        mainView.layer.masksToBounds = true
        mainView.layer.cornerRadius = 8
        return mainView
    }()
    
    lazy var iconView : UIImageView = {
        let iconView = UIImageView.init()
        iconView.contentMode = .scaleToFill
        iconView.backgroundColor = .clear
        iconView.layer.masksToBounds = true
        iconView.layer.cornerRadius = 25
        return iconView
    }()
    
    lazy var titleLabel: UILabel = {
        let titleLabel = UILabel.init()
        titleLabel.backgroundColor = .clear
        titleLabel.textColor = .black
        titleLabel.font = BoldFont_18_Fit
        return titleLabel
    }()
    
    lazy var numberLabel: UILabel = {
        let numberLabel = UILabel.init()
        numberLabel.textColor = HexColor("#A2A7B8")
        numberLabel.font = Font_12_Fit
        numberLabel.backgroundColor = .clear
        return numberLabel
    }()
    
    lazy var timeLabel: UILabel = {
        let timeLabel = UILabel.init()
        timeLabel.textColor = HexColor("#A2A7B8")
        timeLabel.font = Font_12
        timeLabel.backgroundColor = .clear
        timeLabel.isHidden = true
        return timeLabel
    }()
    
    public func setupWithDataSource(icon: String, name: String,number: String) {
        iconView.image = UIImage(named: icon)
        titleLabel.text = name
        numberLabel.text = number
    }
    
    public func setupWithDataSource(icon: String, name: String,number: String, time: String) {
        iconView.image = UIImage(named: icon)
        titleLabel.text = name
        numberLabel.text = number
        timeLabel.text = time
        timeLabel.isHidden = false
    }
    
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        self.selectionStyle = .none
        self.backgroundColor = .clear
        
        addSubview(mainView)
        mainView.addSubview(iconView)
        mainView.addSubview(titleLabel)
        mainView.addSubview(numberLabel)
        mainView.addSubview(timeLabel)
        
        setupConstraints()
    }
    
    func setupConstraints() {
        mainView.snp.makeConstraints { make in
            make.left.equalToSuperview().offset(15)
            make.right.equalToSuperview().offset(-15)
            make.top.equalToSuperview().offset(5)
            make.bottom.equalToSuperview().offset(-5)
        }
        iconView.snp.makeConstraints { make in
            make.centerY.equalToSuperview()
            make.left.equalToSuperview().offset(15)
            make.size.equalTo(50)
        }
        titleLabel.snp.makeConstraints { make in
            make.centerY.equalToSuperview().offset(-15)
            make.left.equalTo(iconView.snp.right).offset(10)
        }
        numberLabel.snp.makeConstraints { make in
            make.centerY.equalToSuperview().offset(15)
            make.left.equalTo(iconView.snp.right).offset(10)
        }
        timeLabel.snp.makeConstraints { make in
            make.centerY.equalToSuperview()
            make.right.equalToSuperview().offset(-10)
        }
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}




class MineFeedBackListCollectViewCell : UICollectionViewCell {
    
    lazy var iconView: UIImageView = {
        let iconView = UIImageView.init()
        iconView.backgroundColor = .white
        iconView.contentMode = .scaleToFill
        return iconView
    }()
    
    lazy var titleLabel: UILabel = {
        let titleLabel = UILabel.init()
        titleLabel.font = BoldFont_16_Fit
        titleLabel.textColor = .black
        return titleLabel
    }()
    
    lazy var moreView: UIImageView = {
        let moreView = UIImageView.init()
        moreView.contentMode = .scaleToFill
        moreView.backgroundColor = .white
        moreView.image = UIImage(named: "mine_add_content_more_list")
        return moreView
    }()
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        self.backgroundColor = .white
        self.layer.masksToBounds = true
        self.layer.cornerRadius = 8
        
        addSubview(titleLabel)
        titleLabel.snp.makeConstraints { make in
            make.centerY.equalToSuperview()
            make.centerX.equalToSuperview().offset(10)
        }
        addSubview(iconView)
        iconView.snp.makeConstraints { make in
            make.centerY.equalToSuperview()
            make.right.equalTo(titleLabel.snp.left).offset(-10)
            make.size.equalTo(40)
        }
        addSubview(moreView)
        moreView.snp.makeConstraints { make in
            make.centerY.equalToSuperview()
            make.left.equalTo(titleLabel.snp.right).offset(5)
            make.size.equalTo(10)
        }
    }
    
    public func setupWithDataSource(dict: Dictionary<String, Any>) {
        iconView.image = UIImage(named: (dict["image"] as? String)!)
        titleLabel.text = dict["name"] as? String
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}