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

// plan

parent 7c77d9d9
......@@ -255,6 +255,7 @@ class YHPlanViewController: YHBaseViewController {
v.addSubview(listView)
let button = YHLookPlanButton(frame: .zero)
button.addTarget(self, action: #selector(didBottomBtnClicked), for: .touchUpInside)
v.addSubview(button)
listView.snp.makeConstraints { make in
......@@ -291,6 +292,15 @@ class YHPlanViewController: YHBaseViewController {
self.navigationController?.pushViewController(vc)
}
@objc func didBottomBtnClicked() {
self.enterMakePlanPage()
}
func enterMakePlanPage() {
let vc = YHMakePlanViewController()
self.navigationController?.pushViewController(vc)
}
override func viewDidLoad() {
super.viewDidLoad()
......@@ -422,6 +432,10 @@ extension YHPlanViewController: UITableViewDelegate, UITableViewDataSource {
return UITableViewCell()
}
cell2.model = analyzeArr[indexPath.section-1]
cell2.clickBlock = { [weak self] model in
guard let self = self else { return }
self.enterMakePlanPage()
}
return cell2
} else if indexPath.section == 5 {
......
......@@ -63,6 +63,8 @@ class YHPlanAnalyzeInfoCell: UITableViewCell {
static let cellReuseIdentifier = "YHPlanAnalyzeInfoCell"
var clickBlock:((YHPlanProductModel)->())?
var model = YHPlanAnalyzeModel() {
didSet {
titleLabel.text = "\(model.getTitle())分析"
......@@ -152,6 +154,10 @@ class YHPlanAnalyzeInfoCell: UITableViewCell {
lazy var productListView: YHPlanProductListView = {
let v = YHPlanProductListView(frame: .zero)
v.clickBlock = { [weak self] model in
guard let self = self else { return }
self.clickBlock?(model)
}
v.isHidden = true
return v
}()
......
......@@ -10,6 +10,20 @@ import UIKit
class YHPlanProductItemView: UIView {
var clickBlock:((YHPlanProductModel)->())?
var product: YHPlanProductModel = YHPlanProductModel() {
didSet {
titleLabel.text = product.title
descLabel.text = product.description
if let url = URL(string: product.img_url) {
iconImgV.sd_setImage(with: url, placeholderImage: UIImage(named: "global_default_image"))
} else {
iconImgV.image = UIImage(named: "global_default_image")
}
}
}
lazy var iconImgV: UIImageView = {
let v = UIImageView()
v.backgroundColor = .red
......@@ -49,8 +63,16 @@ class YHPlanProductItemView: UIView {
fatalError("init(coder:) has not been implemented")
}
@objc func didItemViewClicked() {
clickBlock?(self.product)
}
func createUI() {
backgroundColor = .init(hex: 0xF8F9FB)
let tap = UITapGestureRecognizer(target: self, action: #selector(didItemViewClicked))
self.addGestureRecognizer(tap)
self.addSubview(iconImgV)
self.addSubview(titleLabel)
self.addSubview(descLabel)
......@@ -85,20 +107,16 @@ class YHPlanProductItemView: UIView {
class YHPlanProductListView: UIView {
var clickBlock:((YHPlanProductModel)->())?
var products: [YHPlanProductModel] = [] {
didSet {
listView.removeSubviews()
var lastItemView: YHPlanProductItemView?
for (index, item) in products.enumerated() {
let v = YHPlanProductItemView(frame: .zero)
v.titleLabel.text = item.title
v.descLabel.text = item.description
if let url = URL(string: item.img_url) {
v.iconImgV.sd_setImage(with: url, placeholderImage: UIImage(named: "global_default_image"))
} else {
v.iconImgV.image = UIImage(named: "global_default_image")
}
v.product = item
v.clickBlock = self.clickBlock
listView.addSubview(v)
v.snp.makeConstraints { make in
make.left.right.equalToSuperview()
......
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