Commit cfa0dbf4 authored by Steven杜宇's avatar Steven杜宇

// AI

parent 6142a608
...@@ -144,9 +144,9 @@ class YHProductListModel: SmartCodable { ...@@ -144,9 +144,9 @@ class YHProductListModel: SmartCodable {
var icon: String = "" var icon: String = ""
var title: String = "" var title: String = ""
var description: String = "" var description: String = ""
var btnText: String = "" var btn_text: String = ""
var redirectMode: Int = 0 var redirect_mode: Int = 0
var redirectPath: String = "" var redirect_path: String = ""
var list: [YHProductItemModel] = [] var list: [YHProductItemModel] = []
required init() { required init() {
...@@ -158,11 +158,11 @@ class YHProductItemModel: SmartCodable { ...@@ -158,11 +158,11 @@ class YHProductItemModel: SmartCodable {
var title: String = "" var title: String = ""
var cover: String = "" var cover: String = ""
var redirectMode: Int = 0 var redirect_mode: Int = 0
var redirectPath: String = "" var redirect_path: String = ""
var tags: [YHProductTag] = [] var tags: [YHProductTag] = []
var originalPrice: Int = 0 var original_price: Int = 0
var discountPrice: Int = 0 var discount_price: Int = 0
required init() { required init() {
......
...@@ -80,7 +80,7 @@ class YHAIMessageCell: UITableViewCell { ...@@ -80,7 +80,7 @@ class YHAIMessageCell: UITableViewCell {
make.left.equalTo(20) make.left.equalTo(20)
make.right.lessThanOrEqualTo(-20) make.right.lessThanOrEqualTo(-20)
make.top.equalTo(20) make.top.equalTo(20)
make.bottom.equalTo(-20) make.bottom.equalTo(0)
} }
messageLabel.snp.makeConstraints { make in messageLabel.snp.makeConstraints { make in
......
...@@ -16,8 +16,8 @@ class YHProductItemView: UIView { ...@@ -16,8 +16,8 @@ class YHProductItemView: UIView {
iconImgView.sd_setImage(with: URL(string: productModel.cover), placeholderImage: UIImage(named: "global_default_image")) iconImgView.sd_setImage(with: URL(string: productModel.cover), placeholderImage: UIImage(named: "global_default_image"))
titleLabel.text = productModel.title titleLabel.text = productModel.title
let aa: ASAttributedString = .init("¥", .font(UIFont(name: "DINAlternate-Bold", size: 14)!),.foreground(UIColor.mainTextColor)) let aa: ASAttributedString = .init("¥", .font(UIFont(name: "DINAlternate-Bold", size: 14)!),.foreground(UIColor.mainTextColor))
let bb: ASAttributedString = .init("\(productModel.discountPrice)", .font(UIFont(name: "DINAlternate-Bold", size: 20)!),.foreground(UIColor.mainTextColor)) let bb: ASAttributedString = .init("\(productModel.discount_price)", .font(UIFont(name: "DINAlternate-Bold", size: 20)!),.foreground(UIColor.mainTextColor))
let cc: ASAttributedString = .init("¥\(productModel.originalPrice)", .font(UIFont(name: "DINAlternate-Bold", size: 14)!),.foreground(UIColor.init(hex: 0xB9C1CC)), .strikethrough(.single)) let cc: ASAttributedString = .init("¥\(productModel.original_price)", .font(UIFont(name: "DINAlternate-Bold", size: 14)!),.foreground(UIColor.init(hex: 0xB9C1CC)), .strikethrough(.single))
priceLabel.attributed.text = aa+bb+cc priceLabel.attributed.text = aa+bb+cc
tagContentView.removeSubviews() tagContentView.removeSubviews()
...@@ -70,8 +70,8 @@ class YHProductItemView: UIView { ...@@ -70,8 +70,8 @@ class YHProductItemView: UIView {
let label = UILabel() let label = UILabel()
label.numberOfLines = 0 label.numberOfLines = 0
let aa: ASAttributedString = .init("¥", .font(UIFont(name: "DINAlternate-Bold", size: 14)!),.foreground(UIColor.mainTextColor)) let aa: ASAttributedString = .init("¥", .font(UIFont(name: "DINAlternate-Bold", size: 14)!),.foreground(UIColor.mainTextColor))
let bb: ASAttributedString = .init("61000", .font(UIFont(name: "DINAlternate-Bold", size: 20)!),.foreground(UIColor.mainTextColor)) let bb: ASAttributedString = .init("0", .font(UIFont(name: "DINAlternate-Bold", size: 20)!),.foreground(UIColor.mainTextColor))
let cc: ASAttributedString = .init("¥61000", .font(UIFont(name: "DINAlternate-Bold", size: 14)!),.foreground(UIColor.mainTextColor), .strikethrough(.single)) let cc: ASAttributedString = .init(" ¥0", .font(UIFont(name: "DINAlternate-Bold", size: 14)!),.foreground(UIColor.init(hex: 0xB9C1CC)), .strikethrough(.single))
label.attributed.text = aa+bb+cc label.attributed.text = aa+bb+cc
return label return label
}() }()
...@@ -86,10 +86,10 @@ class YHProductItemView: UIView { ...@@ -86,10 +86,10 @@ class YHProductItemView: UIView {
} }
@objc func didClickProductItem() { @objc func didClickProductItem() {
if !productModel.redirectPath.isEmpty { if !productModel.redirect_path.isEmpty {
let vc = YHH5WebViewVC() let vc = YHH5WebViewVC()
vc.isFullScreenFlag = false vc.isFullScreenFlag = false
vc.url = productModel.redirectPath vc.url = productModel.redirect_path
UIViewController.current?.navigationController?.pushViewController(vc) UIViewController.current?.navigationController?.pushViewController(vc)
} }
} }
......
...@@ -19,7 +19,7 @@ class YHProductListMessageCell: UITableViewCell { ...@@ -19,7 +19,7 @@ class YHProductListMessageCell: UITableViewCell {
subtitleLabel.text = listModel.description subtitleLabel.text = listModel.description
listView.removeSubviews() listView.removeSubviews()
var lastItemView:YHProductItemView? = nil var lastItemView:YHProductItemView? = nil
for (index, item) in listModel.list.enumerated() { for (_, item) in listModel.list.enumerated() {
let productView = YHProductItemView() let productView = YHProductItemView()
productView.productModel = item productView.productModel = item
listView.addSubview(productView) listView.addSubview(productView)
...@@ -31,13 +31,21 @@ class YHProductListMessageCell: UITableViewCell { ...@@ -31,13 +31,21 @@ class YHProductListMessageCell: UITableViewCell {
} else { } else {
make.top.equalTo(0) make.top.equalTo(0)
} }
if index == listModel.list.count-1 {
make.bottom.equalTo(0)
}
} }
lastItemView = productView lastItemView = productView
} }
if listModel.list.count > 0 {
if let lastItemView = lastItemView {
listView.addSubview(moreBtn)
moreBtn.snp.remakeConstraints { make in
make.left.right.bottom.equalToSuperview()
make.top.equalTo(lastItemView.snp.bottom)
make.height.equalTo(40)
}
moreBtn.iconInRight(with: 0)
}
}
self.setNeedsLayout() self.setNeedsLayout()
self.layoutIfNeeded() self.layoutIfNeeded()
} }
...@@ -85,6 +93,26 @@ class YHProductListMessageCell: UITableViewCell { ...@@ -85,6 +93,26 @@ class YHProductListMessageCell: UITableViewCell {
return v return v
}() }()
lazy var moreBtn: UIButton = {
let btn = UIButton()
btn.setTitle("查看更多", for: .normal)
btn.setTitleColor(UIColor.init(hex: 0xB9C1CC), for: .normal)
btn.setImage(UIImage(named: "my_doc_right_arrow"), for: .normal)
btn.titleLabel?.font = .PFSC_R(ofSize: 12)
btn.addTarget(self, action: #selector(didMoreButtonClicked), for: .touchUpInside)
return btn
}()
@objc func didMoreButtonClicked() {
if !listModel.redirect_path.isEmpty {
let vc = YHH5WebViewVC()
vc.isFullScreenFlag = false
vc.url = listModel.redirect_path
UIViewController.current?.navigationController?.pushViewController(vc)
}
}
required init?(coder: NSCoder) { required init?(coder: NSCoder) {
super.init(coder: coder) super.init(coder: coder)
} }
...@@ -110,7 +138,7 @@ class YHProductListMessageCell: UITableViewCell { ...@@ -110,7 +138,7 @@ class YHProductListMessageCell: UITableViewCell {
make.left.equalTo(20) make.left.equalTo(20)
make.right.equalTo(-20) make.right.equalTo(-20)
make.top.equalTo(16) make.top.equalTo(16)
make.bottom.equalTo(-16) make.bottom.equalTo(0)
} }
iconImgView.snp.makeConstraints { make in iconImgView.snp.makeConstraints { make in
......
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