CNLiveVitaeCerAddPhotoController.swift 7.13 KB
//
//  CNLiveVitaeCerAddPhotoController.swift
//  metaCode
//
//  Created by zx on 2024/7/27.
//  数字简历-添加证书示例页面

import Foundation
import SnapKit

class CNLiveVitaeCerAddPhotoController:CNLiveBaseViewController{
    
    var isYuanJian = true//原件 or 截图
    lazy var cerYuanJianBtn: UIButton = {
        let  closeBtn = UIButton(type: .custom)
        closeBtn.setTitle("证书原件拍照", for: .normal)
        closeBtn.setTitleColor(HexColor("#1961FE"), for: .normal)
        closeBtn.addTarget(self, action: #selector(cerYuanJianBtnAction), for: .touchUpInside)
        return closeBtn
    }()
    lazy var cerZhengMingBtn: UIButton = {
        let  closeBtn = UIButton(type: .custom)
        closeBtn.setTitle("证书证明截图", for: .normal)
        closeBtn.setTitleColor(HexColor("#333333"), for: .normal)
        closeBtn.addTarget(self, action: #selector(cerZhengMingBtnAction), for: .touchUpInside)
        return closeBtn
    }()
    lazy var lineView :UIView = {
        let bottomNavView = UIView()
        bottomNavView.backgroundColor = HexColor("#1961FE")
        bottomNavView.layer.cornerRadius = 2
        bottomNavView.clipsToBounds = true
        return bottomNavView
    }()
    lazy var whiteBgView :UIView = {
        let bottomNavView = UIView()
        bottomNavView.backgroundColor = HexColor("#FFFFFF")
        bottomNavView.layer.cornerRadius = 9
        bottomNavView.clipsToBounds = true
        return bottomNavView
    }()
    lazy var uploadTitleLabel: UILabel = {
        let titleLabel = UILabel()
        titleLabel.textColor = HexColor("#333333")
        titleLabel.textAlignment = .left
        titleLabel.text = "证书原件拍照上传"
        titleLabel.font = BoldFont_15
        return titleLabel
    }()
    
    lazy var uploadRealBgView :UIView = {
        let bottomNavView = UIView()
        bottomNavView.backgroundColor = HexColor("#F7F8FA")
        return bottomNavView
    }()

    lazy var uploadRealTitleLabel: UILabel = {
        let titleLabel = UILabel()
        titleLabel.textColor = HexColor("#999999")
        titleLabel.textAlignment = .left
        titleLabel.numberOfLines = 3
        titleLabel.text = "·证书图片需包含证书名称、证书编号、发证机构等字段信息\n·拍摄保持全面清晰完整\n·上传图片时请保持文字方向朝上"
        titleLabel.font = Font_11
        return titleLabel
    }()
    lazy var cerYuanJianImgView :UIImageView = {
        let iconImgView = UIImageView()
        iconImgView.image = UIImage(named: "mine_jianli_cerYuanJian")
        return iconImgView
    }()
    
    

    override func viewDidLoad() {
        super.viewDidLoad()
        titleName = "证书上传正确示例"
        navigationBarHidden = false
        self.initUI()
    }
    
    deinit {}
    func initUI(){
        self.view.backgroundColor = HexColor("#F6F7FB")
        
        self.view.addSubview(self.cerYuanJianBtn)
        self.cerYuanJianBtn.snp.makeConstraints { make in
            make.left.equalTo(0)
            make.top.equalTo(KNavigationHeight+15)
            make.height.equalTo(21)
            make.width.equalTo(KSreenWidth/2)
        }
        self.view.addSubview(self.cerZhengMingBtn)
        self.cerZhengMingBtn.snp.makeConstraints { make in
            make.top.equalTo(KNavigationHeight+15)
            make.height.equalTo(21)
            make.width.equalTo(KSreenWidth/2)
            make.right.equalToSuperview()
        }
        self.view.addSubview(self.lineView)
        self.lineView.snp.makeConstraints { make in
            make.top.equalTo(self.cerYuanJianBtn.snp.bottom).offset(5)
            make.height.equalTo(4)
            make.width.equalTo(25)
            make.centerX.equalTo(self.cerYuanJianBtn.snp.centerX)
        }
        
        self.view.addSubview(self.whiteBgView)
        self.whiteBgView.snp.makeConstraints { make in
            make.top.equalTo(self.lineView.snp.bottom).offset(15)
            make.height.equalTo(322)
            make.left.equalTo(15)
            make.right.equalToSuperview().offset(-15)
        }
        
        self.whiteBgView.addSubview(self.uploadTitleLabel)
        self.uploadTitleLabel.snp.makeConstraints { make in
            make.top.equalTo(15)
            make.left.equalTo(15)
        }
        
        self.whiteBgView.addSubview(self.uploadRealBgView)
        self.uploadRealBgView.snp.makeConstraints { make in
            make.top.equalTo(self.uploadTitleLabel.snp.bottom).offset(10)
            make.left.equalTo(15)
            make.height.equalTo(65)
            make.right.equalToSuperview().offset(-15)
        }
        
        self.uploadRealBgView.addSubview(self.uploadRealTitleLabel)
        self.uploadRealTitleLabel.snp.makeConstraints { make in
            make.left.equalTo(10)
            make.right.equalToSuperview().offset(-10)
            make.centerY.equalToSuperview()
        }

        self.whiteBgView.addSubview(self.cerYuanJianImgView)
        self.cerYuanJianImgView.snp.makeConstraints { make in
            make.top.equalTo(self.uploadRealBgView.snp.bottom).offset(15)
            make.left.equalTo(15)
            make.right.equalToSuperview().offset(-15)
            make.bottom.equalToSuperview().offset(-15)
        }

    }
    
    @objc func cerYuanJianBtnAction(){
        self.isYuanJian = true
        self.updateUI()
    }
    
    @objc func cerZhengMingBtnAction(){
        self.isYuanJian = false
        self.updateUI()
    }
    func updateUI(){
        if self.isYuanJian == true{
            self.cerYuanJianBtn.setTitleColor(HexColor("#1961FE"), for: .normal)
            self.cerZhengMingBtn.setTitleColor(HexColor("#333333"), for: .normal)
            self.lineView.snp.remakeConstraints { make in
                make.top.equalTo(self.cerYuanJianBtn.snp.bottom).offset(5)
                make.height.equalTo(4)
                make.width.equalTo(25)
                make.centerX.equalTo(self.cerYuanJianBtn.snp.centerX)
            }
            self.uploadTitleLabel.text = "证书原件拍照上传"
            self.uploadRealTitleLabel.text = "·证书图片需包含证书名称、证书编号、发证机构等字段信息\n·拍摄保持全面清晰完整\n·上传图片时请保持文字方向朝上"
            self.uploadRealTitleLabel.numberOfLines = 3
            self.cerYuanJianImgView.image = UIImage(named: "mine_jianli_cerYuanJian")
        }else{
            self.cerYuanJianBtn.setTitleColor(HexColor("#333333"), for: .normal)
            self.cerZhengMingBtn.setTitleColor(HexColor("#1961FE"), for: .normal)
            self.lineView.snp.remakeConstraints { make in
                make.top.equalTo(self.cerYuanJianBtn.snp.bottom).offset(5)
                make.height.equalTo(4)
                make.width.equalTo(25)
                make.centerX.equalTo(self.cerZhengMingBtn.snp.centerX)
            }
            self.uploadTitleLabel.text = "截图/拍照证书信息上传"
            self.uploadRealTitleLabel.text = "·拍照上传支持截图、纸条等\n ·包含字段需要带有证书名、身份证号、姓名等"
            self.uploadRealTitleLabel.numberOfLines = 2
            self.cerYuanJianImgView.image = UIImage(named: "mine_jianli_cerJieTu")
        }
    }
}