1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- //
- // MealHeadView.swift
- // ADHTuanCan
- //
- // Created by 敖德亨 on 2023/10/26.
- //
- import UIKit
- class MealHeadView: UIView {
-
- ///优惠图标
- @IBOutlet weak var saleImg: UIImageView!
-
-
- @IBOutlet weak var foodImg: UIImageView!
-
- @IBOutlet weak var nameLab: UILabel!
-
- @IBOutlet weak var describLab: UILabel!
-
- @IBOutlet weak var sellDetailLab: UILabel!
-
- @IBOutlet weak var scoreLab: UILabel!
-
- var evaluateActionBlock : (()->Void)?
-
- var lookBigPicBlock : (()->Void)?
-
- override func awakeFromNib() {
- super.awakeFromNib()
- // topConstraint.constant = kStatuBarHeight + 25
- }
-
- func configModel(model : SetMealDetailModel){
- self.foodImg.sd_setImage(url: URL.init(string: model.link ?? "") ,placeHolderImage: UIImage.init(named: "placeHolderImage"))
- self.nameLab.text = "\(model.name ?? "")"
- self.describLab.text = "\(model.sellingPoints ?? "")"
- self.sellDetailLab.text = "\(model.specialty ?? "")"
- self.scoreLab.text = "\(model.score ?? "")"
-
- let labHeight : CGFloat = (self.describLab.frame.size.height)
-
- if self.describLab.text.isNotEmptyStr{
- self.setFrameSize(CGSize.init(width: kSCREEN_WIDTH, height:476 ))
- }else{
- self.setFrameSize(CGSize.init(width: kSCREEN_WIDTH, height:476 - 15 + labHeight ))
- }
-
- if model.disType === 1 || model.disType === 2 || model.disType === 3{
- self.saleImg.isHidden = false
- }else{
- self.saleImg.isHidden = true
- }
-
- if model.disType === 1{
- self.saleImg.image = UIImage(named: "优惠ICON")
- }
- if model.disType === 2{
- self.saleImg.image = UIImage(named: "折扣ICON")
- }
- if model.disType === 3{
- self.saleImg.image = UIImage(named: "活动ICON")
- }
- }
-
- @IBAction func evaluateAction(_ sender: UIButton) {
- if self.evaluateActionBlock != nil{
- self.evaluateActionBlock!()
- }
- }
-
- @IBAction func checkBigPic(_ sender: UIButton) {
- if self.lookBigPicBlock != nil{
- self.lookBigPicBlock!()
- }
- }
-
- }
|