Commit 43f328da authored by Steven杜宇's avatar Steven杜宇

// AI

parent 37f9405b
...@@ -17,9 +17,9 @@ class YHAIProductCell: UICollectionViewCell { ...@@ -17,9 +17,9 @@ class YHAIProductCell: UICollectionViewCell {
titleLabel.text = model.title titleLabel.text = model.title
subtitleLabel.text = model.description subtitleLabel.text = model.description
if !model.btnText.isEmpty { if !model.btnText.isEmpty {
blackButton.setTitle(model.btnText, for: .normal) blackTitleLabel.text = model.btnText
} else { } else {
blackButton.setTitle("去了解", for: .normal) blackTitleLabel.text = "去了解"
} }
bgImgView.sd_setImage(with: URL(string: model.cover), placeholderImage: UIImage(named: "ai_product_bg_default")) bgImgView.sd_setImage(with: URL(string: model.cover), placeholderImage: UIImage(named: "ai_product_bg_default"))
} }
...@@ -48,22 +48,29 @@ class YHAIProductCell: UICollectionViewCell { ...@@ -48,22 +48,29 @@ class YHAIProductCell: UICollectionViewCell {
return lable return lable
}() }()
lazy var blackButton: UIButton = { lazy var blackView: UIView = {
let btn = UIButton(type: .custom) let v = UIView()
btn.setTitle("去了解", for: .normal) v.backgroundColor = .black
btn.setTitleColor(.white, for: .normal) v.layer.cornerRadius = 13.0
btn.titleLabel?.font = .PFSC_M(ofSize: 11) v.clipsToBounds = true
btn.backgroundColor = .black
btn.addTarget(self, action: #selector(didSendButtonClicked), for: .touchUpInside) v.addSubview(blackTitleLabel)
btn.YH_clickEdgeInsets = UIEdgeInsets(top: 20, left: 20, bottom: 20, right: 20) blackTitleLabel.snp.makeConstraints { make in
btn.layer.cornerRadius = 13.0 make.left.equalTo(10)
btn.clipsToBounds = true make.right.equalTo(-10)
return btn make.top.bottom.equalToSuperview()
}
return v
}() }()
@objc func didSendButtonClicked() { lazy var blackTitleLabel: UILabel = {
let lable = UILabel()
} lable.textColor = UIColor.white
lable.textAlignment = .left
lable.font = UIFont.PFSC_M(ofSize: 11)
lable.text = "去了解"
return lable
}()
required init?(coder: NSCoder) { required init?(coder: NSCoder) {
super.init(coder: coder) super.init(coder: coder)
...@@ -82,7 +89,7 @@ class YHAIProductCell: UICollectionViewCell { ...@@ -82,7 +89,7 @@ class YHAIProductCell: UICollectionViewCell {
contentView.addSubview(bgImgView) contentView.addSubview(bgImgView)
bgImgView.addSubview(titleLabel) bgImgView.addSubview(titleLabel)
bgImgView.addSubview(subtitleLabel) bgImgView.addSubview(subtitleLabel)
bgImgView.addSubview(blackButton) bgImgView.addSubview(blackView)
bgImgView.snp.makeConstraints { make in bgImgView.snp.makeConstraints { make in
make.left.equalTo(0) make.left.equalTo(0)
...@@ -101,14 +108,14 @@ class YHAIProductCell: UICollectionViewCell { ...@@ -101,14 +108,14 @@ class YHAIProductCell: UICollectionViewCell {
subtitleLabel.snp.makeConstraints { make in subtitleLabel.snp.makeConstraints { make in
make.left.equalTo(22) make.left.equalTo(22)
make.right.equalTo(-22) make.right.equalTo(-22)
make.bottom.equalTo(blackButton.snp.top).offset(-12) make.bottom.equalTo(blackView.snp.top).offset(-12)
} }
blackButton.snp.makeConstraints { make in blackView.snp.makeConstraints { make in
make.left.equalTo(22) make.left.equalTo(22)
make.bottom.equalTo(-24) make.bottom.equalTo(-24)
make.height.equalTo(26) make.height.equalTo(26)
make.width.equalTo(54) make.right.lessThanOrEqualTo(-22)
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment