//
//  HeadlinesMoreTableViewCell.swift
//  MobilePortal
//
//  Created by xiejiangbo on 2019/3/13.
//  Copyright © 2019 yin chen. All rights reserved.
//

import UIKit

class HeadlinesMoreTableViewCell: BaseTableViewCell {
    @IBOutlet weak var titleImage: UIImageView!
    
    @IBOutlet weak var moreImage: UIImageView!
    
    var xinfo = HeadlinesMoreTableViewCellModel()
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
        self.backgroundColor = UIColor.clear
        self.separatorInset=UIEdgeInsetsMake(0, 0, 0, 0)
    }
    override func configurateTheCell(_ info: BaseCellModel) {
        xinfo = info as! HeadlinesMoreTableViewCellModel
        
        titleImage.sd_setImage(with: URL(string: judgmentStrNil(str: xinfo.titleImageUrl)), placeholderImage: UIImage.init(named: "center_image"), completed: { (image, error, SDImageCacheTypeNone, url) in
            if (error != nil) {print(error ?? Error.self)}
        })
        moreImage.sd_setImage(with: URL(string: judgmentStrNil(str: xinfo.moreImageUrl)), placeholderImage: UIImage.init(named: "center_image"), completed: { (image, error, SDImageCacheTypeNone, url) in
            if (error != nil) {print(error ?? Error.self)}
        })
    }
    
    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)
        if selected {
            if xinfo.block != nil && xinfo.pageUrl != nil {
                xinfo.block()
            }
        }
        
        
    }

}
class HeadlinesMoreTableViewCellModel: BaseCellModel {
    
    var moreImageUrl:String?
    var titleImageUrl:String?
    var pageUrl:String?
    var block:selectBlock!
}
