//
//  UpcomingDetailsTableViewCell.swift
//  MobilePortal
//
//  Created by caiyang on 2020/4/23.
//  Copyright © 2020 yin chen. All rights reserved.
//

import UIKit

class UpcomingDetailsTableViewCell: BaseTableViewCell {

    lazy var titleLabel: UILabel = {
        let titleLabel = UILabel.init()
        titleLabel.textAlignment = .left
        titleLabel.numberOfLines = 0
//        titleLabel.font = UIFont.systemFont(ofSize: 21.33)
        titleLabel.font = UIFont.test_boldSystemFont(21.33)
        titleLabel.font = UIFont.test_font(withName: 21.33)
        titleLabel.textColor = UIColorFromRGB(rgbValue: 0x1E202C)
        self.addSubview(titleLabel)
        return titleLabel
    }()
    lazy var biaojiView: UIView = {
        let biaojiView = UIView.init()
        biaojiView.backgroundColor = UIColorFromRGB(rgbValue: 0xE96625)
        //设置遮罩
        biaojiView.layer.masksToBounds = true
        //设置圆角半径(宽度的一半)，显示成圆形。
        biaojiView.layer.cornerRadius = 5
        self.addSubview(biaojiView)
        return biaojiView
    }()
    lazy var webLabel: UILabel = {
        let webLabel = UILabel.init()
        webLabel.textAlignment = .left
        webLabel.numberOfLines = 0
        webLabel.font = UIFont.test_systemFont(ofSize: 11.67)
        webLabel.textColor = UIColorFromRGB(rgbValue: 0x8792A4)
        self.addSubview(webLabel)
        return webLabel
    }()
    lazy var subImageView: UIImageView = {
        let subImageView = UIImageView.init()
        //subImageView.contentMode = .scaleToFill
        subImageView.contentMode = .scaleAspectFill
        //        subImageView.backgroundColor = UIColor.yellow
        subImageView.image = UIImage.init(named: "bigQ_image")
        self.addSubview(subImageView)
        return subImageView
    }()
    var xinfo = UpcomingDetailsTableViewCellModel()
    
    override func awakeFromNib() {
        super.awakeFromNib()
        //        self.addSubview(titleView)
        self.separatorInset=UIEdgeInsetsMake(0, 0, 0, 0)
        // Initialization code
    }
    override func configurateTheCell(_ info: BaseCellModel) {
        xinfo = info as! UpcomingDetailsTableViewCellModel
        //        titleView.text = xinfo.titleStr
        self.subImageView.frame = CGRect(x:26.66, y: 27, width:46.67 , height:64.67 )
        titleLabel.frame = CGRect(x:31.67, y: subImageView.originY+30, width:self.width-40 , height:getTextHeigh(textStr: xinfo.titleStr!, font: UIFont.test_systemFont(ofSize: 21.33), width: self.width-20) )
        titleLabel.text = xinfo.titleStr
        biaojiView.frame = CGRect(x:subImageView.originX, y: self.height-30, width:10 , height:10 )
        webLabel.frame = CGRect(x:biaojiView.originX+biaojiView.width+10, y: self.height-30, width:SCREEN_WHIDTH() , height:20 )
        webLabel.centerY = biaojiView.centerY
        if self.xinfo.upcomingType == .DoneType {
            webLabel.text = "待办处理时间：2020-01-23  22:31"
            biaojiView.backgroundColor = UIColorFromRGB(rgbValue: 0x3AC189)
        }else {
            biaojiView.backgroundColor = UIColorFromRGB(rgbValue: 0xE96625)
            webLabel.text = "待办生成时间：2020-01-23  22:31"
        }
        
    }
    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)
        
        // Configure the view for the selected state
    }
    
}
class UpcomingDetailsTableViewCellModel: BaseCellModel {
    var titleStr:String?
    var content:String?
    var upcomingType:BusinessType = .UpcomingType
    var block:selectBlock!
    var h = CGFloat()
    
}

