CNLiveDigitalThreeCerCollectCell .swift 2.07 KB
//
//  CNLiveDigitalThreeCerCollectCell .swift
//  metaCode
//
//  Created by zx on 2024/8/7.
//  数字资产-其他证书-证书img列表Cell

import Foundation
import Kingfisher

class CNLiveDigitalThreeCerCollectCell: UICollectionViewCell {
        
    var _cerModel : CNLiveVitaeCertificatesModel?
    var cerModel : CNLiveVitaeCertificatesModel? {
        get{
            _cerModel
        }
        set{
            _cerModel = newValue!
            setupNewUI(model: _cerModel!)
        }
    }
    
    lazy var iconImgView :UIImageView = {
        let iconImgView = UIImageView(frame: CGRect(x: 18, y: 0, width: 85, height: 101))
        iconImgView.contentMode = .scaleAspectFill
        iconImgView.clipsToBounds = true
        iconImgView.layer.cornerRadius = 5
        return iconImgView
    }()
        
    lazy var titleLbl: UILabel = {
        let imgW:CGFloat = self.iconImgView.width
        let titleX:Float = Float(15.0*imgW/85)
        let titleY:Float = Float(19.0*imgW/85)
        let titleW:Float = Float(55.0*imgW/85)
        let titleH:Float = 30.0
        let titleLbl = UILabel()
        titleLbl.frame = CGRect(x: CGFloat(titleX), y: CGFloat(titleY), width: CGFloat(titleW), height: CGFloat(titleH))
        titleLbl.numberOfLines = 2
        titleLbl.font = BoldFont_11
        titleLbl.textColor = HexColor("#333333")
        titleLbl.textAlignment = .center
        return titleLbl
    }()

    override init(frame: CGRect) {
        super.init(frame: frame)
        self.contentView.addSubview(self.iconImgView)
        self.iconImgView.addSubview(self.titleLbl)
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    func setupNewUI(model:CNLiveVitaeCertificatesModel){
        if model.status == 1{
            self.iconImgView.image = UIImage(named: "mine_jianli_cerBg_authed")
        }else{
            self.iconImgView.image = UIImage(named: "mine_jianli_cerBg_unauthed")
        }
        
        self.titleLbl.text = model.title

//        self.iconImgView.kf.setImage(with: URL(string: model.img))
    }
}