CNLiveVitaeCertificateAddInfoCell.swift 15.2 KB
//
//  CNLiveVitaeCertificateAddInfoCell.swift
//  metaCode
//
//  Created by zx on 2024/7/26.
//

import Foundation

class CNLiveVitaeCertificateAddInfoCell: UITableViewCell, UITextFieldDelegate{
    
    var tfReturnBlock:TFReturnBlock?
    
    var _uploadImage : UIImage?
    var uploadImage : UIImage? {
        get{
            _uploadImage
        }
        set{
            _uploadImage = newValue!
            self.uploadPhotoImgView.image = _uploadImage
        }
    }
    lazy var whiteBgView :UIView = {
        let whiteBgView = UIView()
        whiteBgView.backgroundColor = .white
        whiteBgView.layer.cornerRadius = 12
        whiteBgView.clipsToBounds = true
        return whiteBgView
    }()
    lazy var cerDetailTitleLabel: UILabel = {
        let titleLabel = UILabel()
        titleLabel.textColor = HexColor("#333333")
        titleLabel.textAlignment = .left
        titleLabel.text = "证书图片"
        titleLabel.font = BoldFont_15
        return titleLabel
    }()
    lazy var uploadPhotoImgView :UIImageView = {
        let iconImgView = UIImageView()
        iconImgView.backgroundColor = HexColor("#F7F8FA")
        iconImgView.contentMode = .scaleAspectFit
        iconImgView.layer.cornerRadius = 9
        iconImgView.clipsToBounds = true
        return iconImgView
    }()
    
    lazy var line1View :UIView = {
        let bottomNavView = UIView()
        bottomNavView.backgroundColor = HexColor("#EBEBEB")
        return bottomNavView
    }()
    lazy var cerNameXingImgView :UIImageView = {
        let iconImgView = UIImageView()
        iconImgView.image = UIImage(named: "mine_jianli_cer_xing")
        return iconImgView
    }()
    lazy var cerNameTitleLabel: UILabel = {
        let titleLabel = UILabel()
        titleLabel.textColor = HexColor("#333333")
        titleLabel.textAlignment = .left
        titleLabel.text = "证书名称"
        titleLabel.font = BoldFont_15
        return titleLabel
    }()
    lazy var cerNameTF :UITextField = {
        let searchTF = UITextField()
        searchTF.textAlignment = .right
        searchTF.clearButtonMode = .always
        searchTF.textColor = HexColor("#333333")
        searchTF.font = Font_15
        searchTF.placeholder = "证书名称"
        searchTF.delegate = self
        searchTF.returnKeyType = .done
        return searchTF
    }()
    
    lazy var lineNumberView :UIView = {
        let bottomNavView = UIView()
        bottomNavView.backgroundColor = HexColor("#EBEBEB")
        return bottomNavView
    }()
    lazy var cerNumberXingImgView :UIImageView = {
        let iconImgView = UIImageView()
        iconImgView.image = UIImage(named: "mine_jianli_cer_xing")
        return iconImgView
    }()
    lazy var cerNumberTitleLabel: UILabel = {
        let titleLabel = UILabel()
        titleLabel.textColor = HexColor("#333333")
        titleLabel.textAlignment = .left
        titleLabel.text = "资格证编号"
        titleLabel.font = BoldFont_15
        return titleLabel
    }()
    lazy var cerNumberTF :UITextField = {
        let searchTF = UITextField()
        searchTF.textAlignment = .right
        searchTF.clearButtonMode = .always
        searchTF.textColor = HexColor("#333333")
        searchTF.font = Font_15
        searchTF.placeholder = "填写可提高验证通过率"
        searchTF.delegate = self
        searchTF.returnKeyType = .done
        return searchTF
    }()
    
    lazy var lineLevelView :UIView = {
        let bottomNavView = UIView()
        bottomNavView.backgroundColor = HexColor("#EBEBEB")
        return bottomNavView
    }()
    lazy var cerLevelTitleLabel: UILabel = {
        let titleLabel = UILabel()
        titleLabel.textColor = HexColor("#333333")
        titleLabel.textAlignment = .left
        titleLabel.text = "证书级别"
        titleLabel.font = BoldFont_15
        return titleLabel
    }()
    lazy var cerLevelTF :UITextField = {
        let searchTF = UITextField()
        searchTF.textAlignment = .right
        searchTF.clearButtonMode = .always
        searchTF.textColor = HexColor("#333333")
        searchTF.font = Font_15
        searchTF.placeholder = "有等级时,填写证书等级"
        searchTF.delegate = self
        searchTF.returnKeyType = .done
        return searchTF
    }()
    
    lazy var lineTimeView :UIView = {
        let bottomNavView = UIView()
        bottomNavView.backgroundColor = HexColor("#EBEBEB")
        return bottomNavView
    }()
    lazy var cerTimeTitleLabel: UILabel = {
        let titleLabel = UILabel()
        titleLabel.textColor = HexColor("#333333")
        titleLabel.textAlignment = .left
        titleLabel.text = "发证时间"
        titleLabel.font = BoldFont_15
        return titleLabel
    }()
    lazy var cerTimeTF :UITextField = {
        let searchTF = UITextField()
        searchTF.textAlignment = .right
        searchTF.clearButtonMode = .always
        searchTF.textColor = HexColor("#333333")
        searchTF.font = Font_15
        searchTF.placeholder = "有发证时间,填写发证时间"
        searchTF.delegate = self
        searchTF.returnKeyType = .done
        return searchTF
    }()
    
    lazy var lineYouXiaoView :UIView = {
        let bottomNavView = UIView()
        bottomNavView.backgroundColor = HexColor("#EBEBEB")
        return bottomNavView
    }()
    lazy var cerYouXiaoTitleLabel: UILabel = {
        let titleLabel = UILabel()
        titleLabel.textColor = HexColor("#333333")
        titleLabel.textAlignment = .left
        titleLabel.text = "有效期至"
        titleLabel.font = BoldFont_15
        return titleLabel
    }()
    lazy var cerYouXiaoTF :UITextField = {
        let searchTF = UITextField()
        searchTF.textAlignment = .right
        searchTF.clearButtonMode = .always
        searchTF.textColor = HexColor("#333333")
        searchTF.font = Font_15
        searchTF.placeholder = "有效期至,填写有效期至"
        searchTF.delegate = self
        searchTF.returnKeyType = .done
        return searchTF
    }()
    
    lazy var lineJiGouView :UIView = {
        let bottomNavView = UIView()
        bottomNavView.backgroundColor = HexColor("#EBEBEB")
        return bottomNavView
    }()
    lazy var cerJiGouXingImgView :UIImageView = {
        let iconImgView = UIImageView()
        iconImgView.image = UIImage(named: "mine_jianli_cer_xing")
        return iconImgView
    }()
    lazy var cerJiGouTitleLabel: UILabel = {
        let titleLabel = UILabel()
        titleLabel.textColor = HexColor("#333333")
        titleLabel.textAlignment = .left
        titleLabel.text = "发证机构"
        titleLabel.font = BoldFont_15
        return titleLabel
    }()
    lazy var cerJiGouTF :UITextField = {
        let searchTF = UITextField()
        searchTF.textAlignment = .right
        searchTF.clearButtonMode = .always
        searchTF.textColor = HexColor("#333333")
        searchTF.font = Font_15
        searchTF.placeholder = "填写正确,提高验证通过率"
        searchTF.delegate = self
        searchTF.returnKeyType = .done
        return searchTF
    }()
    
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        self.selectionStyle = .none
        self.backgroundColor = .clear
        self.contentView.backgroundColor = .clear
        
        self.contentView.addSubview(self.whiteBgView)
        self.whiteBgView.snp.makeConstraints { make in
            make.top.equalTo(15)
            make.height.equalTo(700)
            make.left.equalTo(15)
            make.right.equalToSuperview().offset(-15)
        }
        self.whiteBgView.addSubview(self.cerDetailTitleLabel)
        self.cerDetailTitleLabel.snp.makeConstraints { make in
            make.top.equalTo(20)
            make.left.equalTo(15)
        }
        self.whiteBgView.addSubview(self.uploadPhotoImgView)
        self.uploadPhotoImgView.snp.makeConstraints { make in
            make.top.equalTo(self.cerDetailTitleLabel.snp.bottom).offset(10)
            make.left.equalTo(15)
            make.right.equalToSuperview().offset(-15)
            make.height.equalTo(180)
        }
        
        self.whiteBgView.addSubview(self.line1View)
        self.line1View.snp.makeConstraints { make in
            make.top.equalTo(self.uploadPhotoImgView.snp.bottom).offset(20)
            make.left.equalTo(15)
            make.right.equalToSuperview().offset(-15)
            make.height.equalTo(0.5)
        }
        self.whiteBgView.addSubview(self.cerNameXingImgView)
        self.cerNameXingImgView.snp.makeConstraints { make in
            make.width.height.equalTo(5)
            make.left.equalTo(6)
            make.top.equalTo(self.line1View.snp.bottom).offset(28)
        }
        self.whiteBgView.addSubview(self.cerNameTitleLabel)
        self.cerNameTitleLabel.snp.makeConstraints { make in
            make.top.equalTo(self.line1View.snp.bottom).offset(20)
            make.left.equalTo(self.cerNameXingImgView.snp.right).offset(5)
            make.width.equalTo(70)
            make.height.equalTo(21)
        }
        self.whiteBgView.addSubview(self.cerNameTF)
        self.cerNameTF.snp.makeConstraints { make in
            make.centerY.equalTo(self.cerNameTitleLabel.snp.centerY)
            make.left.greaterThanOrEqualTo(self.cerNameTitleLabel.snp.right).offset(10)
            make.right.equalToSuperview().offset(-15)
            make.height.equalTo(21)
        }
        
        self.whiteBgView.addSubview(self.lineNumberView)
        self.lineNumberView.snp.makeConstraints { make in
            make.top.equalTo(self.cerNameTitleLabel.snp.bottom).offset(20)
            make.left.equalTo(15)
            make.right.equalToSuperview().offset(-15)
            make.height.equalTo(0.5)
        }
        self.whiteBgView.addSubview(self.cerNumberXingImgView)
        self.cerNumberXingImgView.snp.makeConstraints { make in
            make.width.height.equalTo(5)
            make.left.equalTo(6)
            make.top.equalTo(self.lineNumberView.snp.bottom).offset(28)
        }
        self.whiteBgView.addSubview(self.cerNumberTitleLabel)
        self.cerNumberTitleLabel.snp.makeConstraints { make in
            make.top.equalTo(self.lineNumberView.snp.bottom).offset(20)
            make.left.equalTo(self.cerNumberXingImgView.snp.right).offset(5)
            make.width.equalTo(90)
            make.height.equalTo(21)
        }
        self.whiteBgView.addSubview(self.cerNumberTF)
        self.cerNumberTF.snp.makeConstraints { make in
            make.centerY.equalTo(self.cerNumberTitleLabel.snp.centerY)
            make.left.greaterThanOrEqualTo(self.cerNumberTitleLabel.snp.right).offset(10)
            make.right.equalToSuperview().offset(-15)
            make.height.equalTo(21)
        }
        
        self.whiteBgView.addSubview(self.lineLevelView)
        self.lineLevelView.snp.makeConstraints { make in
            make.top.equalTo(self.cerNumberTitleLabel.snp.bottom).offset(20)
            make.left.equalTo(15)
            make.right.equalToSuperview().offset(-15)
            make.height.equalTo(0.5)
        }
        self.whiteBgView.addSubview(self.cerLevelTitleLabel)
        self.cerLevelTitleLabel.snp.makeConstraints { make in
            make.top.equalTo(self.lineLevelView.snp.bottom).offset(20)
            make.left.equalTo(self.cerNameTitleLabel.snp.left)
            make.width.equalTo(70)
            make.height.equalTo(21)
        }
        self.whiteBgView.addSubview(self.cerLevelTF)
        self.cerLevelTF.snp.makeConstraints { make in
            make.centerY.equalTo(self.cerLevelTitleLabel.snp.centerY)
            make.left.greaterThanOrEqualTo(self.cerLevelTitleLabel.snp.right).offset(10)
            make.right.equalToSuperview().offset(-15)
            make.height.equalTo(21)
        }
        
        self.whiteBgView.addSubview(self.lineTimeView)
        self.lineTimeView.snp.makeConstraints { make in
            make.top.equalTo(self.cerLevelTitleLabel.snp.bottom).offset(20)
            make.left.equalTo(15)
            make.right.equalToSuperview().offset(-15)
            make.height.equalTo(0.5)
        }
        self.whiteBgView.addSubview(self.cerTimeTitleLabel)
        self.cerTimeTitleLabel.snp.makeConstraints { make in
            make.top.equalTo(self.lineTimeView.snp.bottom).offset(20)
            make.left.equalTo(self.cerNameTitleLabel.snp.left)
            make.width.equalTo(70)
            make.height.equalTo(21)
        }
        self.whiteBgView.addSubview(self.cerTimeTF)
        self.cerTimeTF.snp.makeConstraints { make in
            make.centerY.equalTo(self.cerTimeTitleLabel.snp.centerY)
            make.left.greaterThanOrEqualTo(self.cerTimeTitleLabel.snp.right).offset(10)
            make.right.equalToSuperview().offset(-15)
            make.height.equalTo(21)
        }
        
        self.whiteBgView.addSubview(self.lineYouXiaoView)
        self.lineYouXiaoView.snp.makeConstraints { make in
            make.top.equalTo(self.cerTimeTitleLabel.snp.bottom).offset(20)
            make.left.equalTo(15)
            make.right.equalToSuperview().offset(-15)
            make.height.equalTo(0.5)
        }
        self.whiteBgView.addSubview(self.cerYouXiaoTitleLabel)
        self.cerYouXiaoTitleLabel.snp.makeConstraints { make in
            make.top.equalTo(self.lineYouXiaoView.snp.bottom).offset(20)
            make.left.equalTo(self.cerNameTitleLabel.snp.left)
            make.width.equalTo(70)
            make.height.equalTo(21)
        }
        self.whiteBgView.addSubview(self.cerYouXiaoTF)
        self.cerYouXiaoTF.snp.makeConstraints { make in
            make.centerY.equalTo(self.cerYouXiaoTitleLabel.snp.centerY)
            make.left.greaterThanOrEqualTo(self.cerYouXiaoTitleLabel.snp.right).offset(10)
            make.right.equalToSuperview().offset(-15)
            make.height.equalTo(21)
        }
        
        self.whiteBgView.addSubview(self.lineJiGouView)
        self.lineJiGouView.snp.makeConstraints { make in
            make.top.equalTo(self.cerYouXiaoTitleLabel.snp.bottom).offset(20)
            make.left.equalTo(15)
            make.right.equalToSuperview().offset(-15)
            make.height.equalTo(0.5)
        }
        self.whiteBgView.addSubview(self.cerJiGouXingImgView)
        self.cerJiGouXingImgView.snp.makeConstraints { make in
            make.width.height.equalTo(5)
            make.left.equalTo(6)
            make.top.equalTo(self.lineJiGouView.snp.bottom).offset(28)
        }
        self.whiteBgView.addSubview(self.cerJiGouTitleLabel)
        self.cerJiGouTitleLabel.snp.makeConstraints { make in
            make.top.equalTo(self.lineJiGouView.snp.bottom).offset(20)
            make.left.equalTo(self.cerJiGouXingImgView.snp.right).offset(5)
            make.width.equalTo(70)
            make.height.equalTo(21)
        }
        self.whiteBgView.addSubview(self.cerJiGouTF)
        self.cerJiGouTF.snp.makeConstraints { make in
            make.centerY.equalTo(self.cerJiGouTitleLabel.snp.centerY)
            make.left.greaterThanOrEqualTo(self.cerJiGouTitleLabel.snp.right).offset(10)
            make.right.equalToSuperview().offset(-15)
            make.height.equalTo(21)
        }
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    func textFieldShouldReturn(_ textField: UITextField) -> Bool {
        self.tfReturnBlock?()
        return true
    }
}