|
@@ -39,6 +39,11 @@ class ShoppingMallFloorTableViewCell: UITableViewCell {
|
|
|
collectionView.reloadData()
|
|
|
}
|
|
|
}
|
|
|
+ var productModelsArrays : Array<[ProductModel]>? {
|
|
|
+ didSet {
|
|
|
+ collectionView.reloadData()
|
|
|
+ }
|
|
|
+ }
|
|
|
//MRAK: - 设置View
|
|
|
private func setupViews() {
|
|
|
self.selectionStyle = .none
|
|
@@ -92,11 +97,20 @@ extension ShoppingMallFloorTableViewCell: UICollectionViewDelegateFlowLayout,UIC
|
|
|
|
|
|
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
|
|
|
let cmsRuleModel = cmsRuleModels?[section]
|
|
|
+
|
|
|
switch cmsRuleModel?.showType {
|
|
|
case 0: // 0:左图右字;
|
|
|
- return cmsRuleModel?.rule?.showNum ?? 0
|
|
|
+ if !(productModelsArrays?.isEmpty ?? true) {
|
|
|
+ let productModels = productModelsArrays![section]
|
|
|
+ return productModels.count
|
|
|
+ }
|
|
|
+ return 0
|
|
|
case 1: // 1:通栏大图
|
|
|
- return cmsRuleModel?.rule?.showNum ?? 0
|
|
|
+ if !(productModelsArrays?.isEmpty ?? true) {
|
|
|
+ let productModels = productModelsArrays![section]
|
|
|
+ return productModels.count
|
|
|
+ }
|
|
|
+ return 0
|
|
|
case 2: // 2:左右滑动
|
|
|
return 1
|
|
|
default:
|
|
@@ -107,12 +121,16 @@ extension ShoppingMallFloorTableViewCell: UICollectionViewDelegateFlowLayout,UIC
|
|
|
|
|
|
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
|
|
|
let cmsRuleModel = cmsRuleModels?[(indexPath.section)]
|
|
|
-
|
|
|
+
|
|
|
switch cmsRuleModel?.showType {
|
|
|
case 0: // 0:左图右字;
|
|
|
let cell = ShoppingMallRightSideleftPictureCollectionViewCell.cellWith(
|
|
|
collectionView: collectionView, indexPath: indexPath)
|
|
|
- if indexPath.row == 9 {
|
|
|
+ if !(productModelsArrays?.isEmpty ?? true) {
|
|
|
+ let productModels = productModelsArrays![indexPath.section]
|
|
|
+ cell.productModel = productModels[indexPath.row]
|
|
|
+ }
|
|
|
+ if indexPath.row == (cmsRuleModel?.rule!.showNum)! - 1 {
|
|
|
let shapeLayer = CAShapeLayer()
|
|
|
cell.layer.mask = nil
|
|
|
let bezierPath = UIBezierPath(roundedRect: cell.bounds,
|
|
@@ -125,9 +143,14 @@ extension ShoppingMallFloorTableViewCell: UICollectionViewDelegateFlowLayout,UIC
|
|
|
case 1: // 1:通栏大图
|
|
|
let cell = ShoppingMallBarChartCollectionViewCell.cellWith(
|
|
|
collectionView: collectionView, indexPath: indexPath)
|
|
|
+ if !(productModelsArrays?.isEmpty ?? true) {
|
|
|
+ let productModels = productModelsArrays![indexPath.section]
|
|
|
+ cell.productModel = productModels[indexPath.row]
|
|
|
+ }
|
|
|
return cell
|
|
|
case 2: // 2:左右滑动
|
|
|
let cell = ShoppingMallSlidingLeftRightBgCollectionViewCell.cellWith(collectionView: collectionView, indexPath: indexPath)
|
|
|
+// cell.productModels = productModels
|
|
|
return cell
|
|
|
default:
|
|
|
return UICollectionViewCell()
|
|
@@ -217,9 +240,6 @@ extension ShoppingMallFloorTableViewCell: UICollectionViewDelegateFlowLayout,UIC
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat {
|
|
|
- return 7
|
|
|
- }
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|