|
@@ -129,16 +129,17 @@ extension ShoppingMallFloorTableViewCell: UICollectionViewDelegateFlowLayout,UIC
|
|
|
if !(productModelsArrays?.isEmpty ?? true) {
|
|
|
let productModels = productModelsArrays![indexPath.section]
|
|
|
cell.productModel = productModels[indexPath.row]
|
|
|
+ if indexPath.row == productModels.count - 1 {
|
|
|
+ let shapeLayer = CAShapeLayer()
|
|
|
+ cell.layer.mask = nil
|
|
|
+ let bezierPath = UIBezierPath(roundedRect: cell.bounds,
|
|
|
+ byRoundingCorners: [.bottomLeft,.bottomRight],
|
|
|
+ cornerRadii: CGSize(width: 4,height: 4))
|
|
|
+ shapeLayer.path = bezierPath.cgPath
|
|
|
+ cell.layer.mask = shapeLayer
|
|
|
+ }
|
|
|
}
|
|
|
- if indexPath.row == (cmsRuleModel?.rule!.showNum)! - 1 {
|
|
|
- let shapeLayer = CAShapeLayer()
|
|
|
- cell.layer.mask = nil
|
|
|
- let bezierPath = UIBezierPath(roundedRect: cell.bounds,
|
|
|
- byRoundingCorners: [.bottomLeft,.bottomRight],
|
|
|
- cornerRadii: CGSize(width: 4,height: 4))
|
|
|
- shapeLayer.path = bezierPath.cgPath
|
|
|
- cell.layer.mask = shapeLayer
|
|
|
- }
|
|
|
+
|
|
|
return cell
|
|
|
case 1: // 1:通栏大图
|
|
|
let cell = ShoppingMallBarChartCollectionViewCell.cellWith(
|
|
@@ -150,7 +151,10 @@ extension ShoppingMallFloorTableViewCell: UICollectionViewDelegateFlowLayout,UIC
|
|
|
return cell
|
|
|
case 2: // 2:左右滑动
|
|
|
let cell = ShoppingMallSlidingLeftRightBgCollectionViewCell.cellWith(collectionView: collectionView, indexPath: indexPath)
|
|
|
-// cell.productModels = productModels
|
|
|
+ if !(productModelsArrays?.isEmpty ?? true) {
|
|
|
+ let productModels = productModelsArrays![indexPath.section]
|
|
|
+ cell.productModels = productModels
|
|
|
+ }
|
|
|
return cell
|
|
|
default:
|
|
|
return UICollectionViewCell()
|
|
@@ -195,6 +199,17 @@ extension ShoppingMallFloorTableViewCell: UICollectionViewDelegateFlowLayout,UIC
|
|
|
switch cmsRuleModel?.showType {
|
|
|
case 0: // 0:左图右字;
|
|
|
let headerView = ProductFloorLeftHeaderCollectionReusableView.headerWith(collectionView: collectionView, kind: UICollectionView.elementKindSectionHeader, indexPath: indexPath)
|
|
|
+
|
|
|
+ if !(productModelsArrays?.isEmpty ?? true) {
|
|
|
+ let productModels = productModelsArrays![indexPath.section]
|
|
|
+ if productModels.isEmpty {
|
|
|
+ let shapeLayer = CAShapeLayer()
|
|
|
+ headerView.bgView.layer.mask = nil
|
|
|
+ let bezierPath = UIBezierPath(roundedRect: headerView.bgView.bounds,byRoundingCorners: [.allCorners],cornerRadii: CGSize(width: 4,height: 4))
|
|
|
+ shapeLayer.path = bezierPath.cgPath
|
|
|
+ headerView.bgView.layer.mask = shapeLayer
|
|
|
+ }
|
|
|
+ }
|
|
|
return headerView
|
|
|
case 1: // 1:通栏大图
|
|
|
let headerView = ProductFloorCenterHeaderCollectionReusableView.headerWith(collectionView: collectionView, kind: UICollectionView.elementKindSectionHeader, indexPath: indexPath)
|
|
@@ -209,17 +224,52 @@ extension ShoppingMallFloorTableViewCell: UICollectionViewDelegateFlowLayout,UIC
|
|
|
return UICollectionReusableView()
|
|
|
}
|
|
|
|
|
|
-
|
|
|
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForHeaderInSection section: Int) -> CGSize {
|
|
|
|
|
|
let cmsRuleModel = cmsRuleModels?[section]
|
|
|
switch cmsRuleModel?.showType {
|
|
|
case 0: // 0:左图右字;
|
|
|
- return CGSize(width:347 * kScaleWidth, height: 50 + kScaleWidth * 90)
|
|
|
+ if cmsRuleModel?.rule?.title == "" {
|
|
|
+ return CGSize(width:347 * kScaleWidth, height:kScaleWidth * 90)
|
|
|
+ }
|
|
|
+
|
|
|
+ if cmsRuleModel?.rule?.url == "" {
|
|
|
+ return CGSize(width:347 * kScaleWidth, height:50)
|
|
|
+ }
|
|
|
+
|
|
|
+ if cmsRuleModel?.rule?.title == "" && cmsRuleModel?.rule?.url == "" {
|
|
|
+ return CGSize(width:0, height:0)
|
|
|
+ }
|
|
|
+
|
|
|
+ return CGSize(width:347 * kScaleWidth, height: 50 + kScaleWidth * 90)
|
|
|
case 1: // 1:通栏大图
|
|
|
+ if cmsRuleModel?.rule?.title?.isEmpty ?? true {
|
|
|
+ return CGSize(width:347 * kScaleWidth, height: 73 + (kScaleWidth * 90))
|
|
|
+ }
|
|
|
+
|
|
|
+ if cmsRuleModel?.rule?.url?.isEmpty ?? true {
|
|
|
+ return CGSize(width:347 * kScaleWidth, height: 10 + (kScaleWidth * 90))
|
|
|
+ }
|
|
|
+
|
|
|
+ if cmsRuleModel?.rule?.title?.isEmpty ?? true && cmsRuleModel?.rule?.url?.isEmpty ?? true {
|
|
|
+ return CGSize(width:0, height:0)
|
|
|
+ }
|
|
|
+
|
|
|
return CGSize(width:347 * kScaleWidth, height: 73 + (kScaleWidth * 90))
|
|
|
case 2: // 2:左右滑动
|
|
|
- return CGSize(width:kScreenWidth, height: 50 + kScaleWidth * 90)
|
|
|
+ if cmsRuleModel?.rule?.title?.isEmpty ?? true {
|
|
|
+ return CGSize(width:347 * kScaleWidth, height:kScaleWidth * 90)
|
|
|
+ }
|
|
|
+
|
|
|
+ if cmsRuleModel?.rule?.url?.isEmpty ?? true {
|
|
|
+ return CGSize(width:347 * kScaleWidth, height:50)
|
|
|
+ }
|
|
|
+
|
|
|
+ if cmsRuleModel?.rule?.title?.isEmpty ?? true && cmsRuleModel?.rule?.url?.isEmpty ?? true {
|
|
|
+ return CGSize(width:0, height:0)
|
|
|
+ }
|
|
|
+
|
|
|
+ return CGSize(width:347 * kScaleWidth, height: 50 + kScaleWidth * 90)
|
|
|
default:
|
|
|
return CGSize(width:0, height: 0)
|
|
|
}
|