CNLiveVitaeCertificateAddInfoCell.swift 16.5 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425
//
//  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 :UILabel = {
        let searchTF = UILabel()
        searchTF.textAlignment = .right
        searchTF.textColor = HexColor("#B3B3B3")//HexColor("#333333")
        searchTF.font = Font_15
        searchTF.text = "有发证时间,填写发证时间"
        searchTF.isUserInteractionEnabled = true
        searchTF.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(cerTFAction)))
        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 :UILabel = {
        let searchTF = UILabel()
        searchTF.textAlignment = .right
        searchTF.textColor = HexColor("#B3B3B3")//HexColor("#333333")
        searchTF.font = Font_15
        searchTF.text = "有效期至,填写有效期至"
        searchTF.isUserInteractionEnabled = true
        searchTF.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(cerYouXiaoTFAction)))
        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.bottom.equalToSuperview()
            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()
            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()
            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()
            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(-25)
            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(-25)
            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()
            make.height.equalTo(21)
        }
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    @objc func cerTFAction(){
        self.tfReturnBlock?()
        MineInfoAlertView.showSelectView(showType: .selectDay) { [weak self] text in
            print("刷新之后的数据是=>\(text)")//"2024.06.18"
            if (text as! String).count > 0{
                let textStr = text as! String
                self?.cerTimeTF.text = textStr
                self?.cerTimeTF.textColor = HexColor("#333333")
            }else{
                self?.cerTimeTF.text = "有发证时间,填写发证时间"
                self?.cerTimeTF.textColor = HexColor("#B3B3B3")
            }
        }
    }
    @objc func cerYouXiaoTFAction(){
        self.tfReturnBlock?()
        MineInfoAlertView.showSelectView(showType: .selectDay) { [weak self] text in
            print("刷新之后的数据是=>\(text)")//"2024.06.18"
            if (text as! String).count > 0{
                let textStr = text as! String
                self?.cerYouXiaoTF.text = textStr
                self?.cerYouXiaoTF.textColor = HexColor("#333333")
            }else{
                self?.cerYouXiaoTF.text = "有效期至,填写有效期至"
                self?.cerYouXiaoTF.textColor = HexColor("#B3B3B3")
            }
        }
    }
    func textFieldShouldReturn(_ textField: UITextField) -> Bool {
        self.tfReturnBlock?()
        return true
    }

}