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

import UIKit

class CustomerTableViewCell: BaseTableViewCell {
    
    var xinfo = CustomerTableViewCellModel()
    
    lazy var subImageView: UIImageView = {
        let subImageView = UIImageView.init()
        //subImageView.contentMode = .scaleToFill
        subImageView.contentMode = .scaleAspectFill
        subImageView.image = UIImage.init(named: "q_image")
        self.addSubview(subImageView)
        return subImageView
    }()
    lazy var titleLabel: UILabel = {
        let titleLabel = UILabel.init()
        titleLabel.textAlignment = .left
        titleLabel.font = UIFont.test_systemFont(ofSize: 14)
        titleLabel.numberOfLines = 0
        //        titleLabel.textColor = blackTitleColor
        titleLabel.textColor = UIColorFromRGB(rgbValue: 0x1E202C)
        //        titleLabel.backgroundColor = UIColor.yellow
        self.addSubview(titleLabel)
        return titleLabel
    }()
    override func awakeFromNib() {
        super.awakeFromNib()
        self.separatorInset=UIEdgeInsetsMake(0, 15, 0, 15)
        // Initialization code
    }

    override func configurateTheCell(_ info: BaseCellModel) {
        xinfo = info as! CustomerTableViewCellModel
        subImageView.frame = CGRect(x:15.33, y: 0, width:12 , height:16 )
        subImageView.centerY = self.height/2
        let titleLabelW = SCREEN_WHIDTH()-(subImageView.originX+subImageView.width+26.67)
        titleLabel.frame = CGRect(x:subImageView.originX+subImageView.width+11.67, y: 0, width:titleLabelW , height:self.height )
        titleLabel.centerY = subImageView.centerY
        titleLabel.text = xinfo.titleStr
    }
    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)
        if selected {
            self.xinfo.block()
        }
        // Configure the view for the selected state
    }

}
class CustomerTableViewCellModel: BaseCellModel {
    var titleStr:String?
    var imageUrl:String?
    var timeStr:String?
    var block:selectBlock!
}
