Commit 0ad2729f authored by Steven杜宇's avatar Steven杜宇

// fix

parent 8050d6ac
...@@ -30,6 +30,9 @@ class YHNewProductCell: UITableViewCell { ...@@ -30,6 +30,9 @@ class YHNewProductCell: UITableViewCell {
func updateModel(_ model: YHSelectGoodsModel) { func updateModel(_ model: YHSelectGoodsModel) {
self.imgView.sd_setImage(with: URL(string: model.image), placeholderImage: UIImage(named: "global_default_image")) self.imgView.sd_setImage(with: URL(string: model.image), placeholderImage: UIImage(named: "global_default_image"))
self.imgView.snp.updateConstraints { make in
make.height.equalTo(model.ratio * (KScreenWidth-20.0*2))
}
} }
func setupUI() { func setupUI() {
......
...@@ -127,6 +127,7 @@ extension YHSelectViewController { ...@@ -127,6 +127,7 @@ extension YHSelectViewController {
head.block = { index in head.block = { index in
self.selectItem = index self.selectItem = index
self.buttonItem = 0 self.buttonItem = 0
self.tableView.reloadData()
self.updataData() self.updataData()
} }
head.buttonBlock = { index in head.buttonBlock = { index in
...@@ -208,7 +209,7 @@ extension YHSelectViewController: UITableViewDelegate, UITableViewDataSource { ...@@ -208,7 +209,7 @@ extension YHSelectViewController: UITableViewDelegate, UITableViewDataSource {
let model = self.viewModel.goodsArray[indexPath.row] let model = self.viewModel.goodsArray[indexPath.row]
if model.goodsCategoryType == 1 { // 新品商品 if model.goodsCategoryType == 1 { // 新品商品
return 160 return UITableView.automaticDimension
} }
if indexPath.row == 0 { if indexPath.row == 0 {
...@@ -218,6 +219,9 @@ extension YHSelectViewController: UITableViewDelegate, UITableViewDataSource { ...@@ -218,6 +219,9 @@ extension YHSelectViewController: UITableViewDelegate, UITableViewDataSource {
} }
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
if selectItem == 0 {
return 46
}
return 66 return 66
} }
...@@ -227,6 +231,7 @@ extension YHSelectViewController: UITableViewDelegate, UITableViewDataSource { ...@@ -227,6 +231,7 @@ extension YHSelectViewController: UITableViewDelegate, UITableViewDataSource {
// headView.itemButton.setTitle(model.name, for: .normal) // headView.itemButton.setTitle(model.name, for: .normal)
// headView.itemButton.iconInRight(with: 0.5) // headView.itemButton.iconInRight(with: 0.5)
// } // }
return headView return headView
} }
......
...@@ -21,6 +21,7 @@ class YHSelectLookHeadView: UIView { ...@@ -21,6 +21,7 @@ class YHSelectLookHeadView: UIView {
normalButton.isSelected = true normalButton.isSelected = true
hotButton.isSelected = false hotButton.isSelected = false
priceButton.isSelected = false priceButton.isSelected = false
} else if buttonIndex == 1 { } else if buttonIndex == 1 {
normalButton.isSelected = false normalButton.isSelected = false
hotButton.isSelected = true hotButton.isSelected = true
...@@ -99,6 +100,7 @@ class YHSelectLookHeadView: UIView { ...@@ -99,6 +100,7 @@ class YHSelectLookHeadView: UIView {
// button.setImage(UIImage(named: "home_select_icon_select"), for: .selected) // button.setImage(UIImage(named: "home_select_icon_select"), for: .selected)
button.addTarget(self, action: #selector(normalClick), for: .touchUpInside) button.addTarget(self, action: #selector(normalClick), for: .touchUpInside)
button.isSelected = true button.isSelected = true
button.isHidden = true
return button return button
}() }()
addSubview(normalButton) addSubview(normalButton)
...@@ -118,6 +120,7 @@ class YHSelectLookHeadView: UIView { ...@@ -118,6 +120,7 @@ class YHSelectLookHeadView: UIView {
button.setTitleColor(UIColor.brandMainColor, for: .selected) button.setTitleColor(UIColor.brandMainColor, for: .selected)
// button.setImage(UIImage(named: "home_select_icon_select"), for: .selected) // button.setImage(UIImage(named: "home_select_icon_select"), for: .selected)
button.addTarget(self, action: #selector(hotClick), for: .touchUpInside) button.addTarget(self, action: #selector(hotClick), for: .touchUpInside)
button.isHidden = true
return button return button
}() }()
addSubview(hotButton) addSubview(hotButton)
...@@ -137,6 +140,7 @@ class YHSelectLookHeadView: UIView { ...@@ -137,6 +140,7 @@ class YHSelectLookHeadView: UIView {
button.setTitleColor(UIColor.brandMainColor, for: .selected) button.setTitleColor(UIColor.brandMainColor, for: .selected)
button.setImage(UIImage(named: "home_select_icon_select"), for: .selected) button.setImage(UIImage(named: "home_select_icon_select"), for: .selected)
button.addTarget(self, action: #selector(priceClick), for: .touchUpInside) button.addTarget(self, action: #selector(priceClick), for: .touchUpInside)
button.isHidden = true
return button return button
}() }()
addSubview(priceButton) addSubview(priceButton)
...@@ -213,6 +217,14 @@ extension YHSelectLookHeadView: UICollectionViewDelegate, UICollectionViewDataSo ...@@ -213,6 +217,14 @@ extension YHSelectLookHeadView: UICollectionViewDelegate, UICollectionViewDataSo
collectionView.reloadData() collectionView.reloadData()
if let block = block { if let block = block {
block(indexPath.row) block(indexPath.row)
normalButton.isHidden = false
hotButton.isHidden = false
priceButton.isHidden = false
if indexPath.row == 0 {
normalButton.isHidden = true
hotButton.isHidden = true
priceButton.isHidden = true
}
} }
collectionView.scrollToItem(at: indexPath, at: .centeredHorizontally, animated: true) collectionView.scrollToItem(at: indexPath, at: .centeredHorizontally, animated: true)
} }
......
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