Browse Source

banner修改

南鑫林 6 years ago
parent
commit
4ec750002f

+ 1 - 5
RainbowPlanet/RainbowPlanet.xcodeproj/project.pbxproj

@@ -184,7 +184,6 @@
 		A7A98E41228046C5005306E9 /* ShoppingMallSepcialTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7A98E40228046C4005306E9 /* ShoppingMallSepcialTableViewCell.swift */; };
 		A7A98E41228046C5005306E9 /* ShoppingMallSepcialTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7A98E40228046C4005306E9 /* ShoppingMallSepcialTableViewCell.swift */; };
 		A7A98E4322804851005306E9 /* ShoppingMallSepcialFlowLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7A98E4222804851005306E9 /* ShoppingMallSepcialFlowLayout.swift */; };
 		A7A98E4322804851005306E9 /* ShoppingMallSepcialFlowLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7A98E4222804851005306E9 /* ShoppingMallSepcialFlowLayout.swift */; };
 		A7A98E4522804C63005306E9 /* ShoppingMallSepcialCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7A98E4422804C63005306E9 /* ShoppingMallSepcialCollectionViewCell.swift */; };
 		A7A98E4522804C63005306E9 /* ShoppingMallSepcialCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7A98E4422804C63005306E9 /* ShoppingMallSepcialCollectionViewCell.swift */; };
-		A7B4E71D22812DD70012914A /* ShoppingMallSlidingLeftRightTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7B4E71C22812DD70012914A /* ShoppingMallSlidingLeftRightTableViewCell.swift */; };
 		A7B4E71F228131720012914A /* ShoppingMallSlidingLeftRightCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7B4E71E228131720012914A /* ShoppingMallSlidingLeftRightCollectionViewCell.swift */; };
 		A7B4E71F228131720012914A /* ShoppingMallSlidingLeftRightCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7B4E71E228131720012914A /* ShoppingMallSlidingLeftRightCollectionViewCell.swift */; };
 		A7B4E721228151F40012914A /* ProductFloorTitleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7B4E720228151F40012914A /* ProductFloorTitleView.swift */; };
 		A7B4E721228151F40012914A /* ProductFloorTitleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7B4E720228151F40012914A /* ProductFloorTitleView.swift */; };
 		A7B4E723228154750012914A /* ProductFloorBannerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7B4E722228154750012914A /* ProductFloorBannerView.swift */; };
 		A7B4E723228154750012914A /* ProductFloorBannerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7B4E722228154750012914A /* ProductFloorBannerView.swift */; };
@@ -480,8 +479,6 @@
 		A7A98E40228046C4005306E9 /* ShoppingMallSepcialTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShoppingMallSepcialTableViewCell.swift; sourceTree = "<group>"; };
 		A7A98E40228046C4005306E9 /* ShoppingMallSepcialTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShoppingMallSepcialTableViewCell.swift; sourceTree = "<group>"; };
 		A7A98E4222804851005306E9 /* ShoppingMallSepcialFlowLayout.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShoppingMallSepcialFlowLayout.swift; sourceTree = "<group>"; };
 		A7A98E4222804851005306E9 /* ShoppingMallSepcialFlowLayout.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShoppingMallSepcialFlowLayout.swift; sourceTree = "<group>"; };
 		A7A98E4422804C63005306E9 /* ShoppingMallSepcialCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShoppingMallSepcialCollectionViewCell.swift; sourceTree = "<group>"; };
 		A7A98E4422804C63005306E9 /* ShoppingMallSepcialCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShoppingMallSepcialCollectionViewCell.swift; sourceTree = "<group>"; };
-		A7B4E71C22812DD70012914A /* ShoppingMallSlidingLeftRightTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShoppingMallSlidingLeftRightTableViewCell.swift; sourceTree = "<group>"; };
-		A7B4E71922811F770012914A /* ShoppingCarModoule.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = ShoppingCarModoule.xcassets; sourceTree = "<group>"; };
 		A7B4E71E228131720012914A /* ShoppingMallSlidingLeftRightCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShoppingMallSlidingLeftRightCollectionViewCell.swift; sourceTree = "<group>"; };
 		A7B4E71E228131720012914A /* ShoppingMallSlidingLeftRightCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShoppingMallSlidingLeftRightCollectionViewCell.swift; sourceTree = "<group>"; };
 		A7B4E720228151F40012914A /* ProductFloorTitleView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProductFloorTitleView.swift; sourceTree = "<group>"; };
 		A7B4E720228151F40012914A /* ProductFloorTitleView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProductFloorTitleView.swift; sourceTree = "<group>"; };
 		A7B4E722228154750012914A /* ProductFloorBannerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProductFloorBannerView.swift; sourceTree = "<group>"; };
 		A7B4E722228154750012914A /* ProductFloorBannerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProductFloorBannerView.swift; sourceTree = "<group>"; };
@@ -1873,8 +1870,8 @@
 			isa = PBXGroup;
 			isa = PBXGroup;
 			children = (
 			children = (
 				A7B4E720228151F40012914A /* ProductFloorTitleView.swift */,
 				A7B4E720228151F40012914A /* ProductFloorTitleView.swift */,
-				A7B4E722228154750012914A /* ProductFloorBannerView.swift */,
 				A7B4E72E2281773F0012914A /* ProductFloorCenterTitleView.swift */,
 				A7B4E72E2281773F0012914A /* ProductFloorCenterTitleView.swift */,
+				A7B4E722228154750012914A /* ProductFloorBannerView.swift */,
 				A70B2C032283D06B00B2449F /* ProductFloorFullLeftHeaderCollectionReusableView.swift */,
 				A70B2C032283D06B00B2449F /* ProductFloorFullLeftHeaderCollectionReusableView.swift */,
 				A7B4E7572282897B0012914A /* ProductFloorLeftHeaderCollectionReusableView.swift */,
 				A7B4E7572282897B0012914A /* ProductFloorLeftHeaderCollectionReusableView.swift */,
 				A7B4E759228289BB0012914A /* ProductFloorCenterHeaderCollectionReusableView.swift */,
 				A7B4E759228289BB0012914A /* ProductFloorCenterHeaderCollectionReusableView.swift */,
@@ -2594,7 +2591,6 @@
 				A77F2CCA223209F2001BD3F6 /* BaseTabbarViewController.swift in Sources */,
 				A77F2CCA223209F2001BD3F6 /* BaseTabbarViewController.swift in Sources */,
 				A7CC75332271ABB0003C4F38 /* AddressManagerViewController.swift in Sources */,
 				A7CC75332271ABB0003C4F38 /* AddressManagerViewController.swift in Sources */,
 				A7CC750D227157DA003C4F38 /* MessageDetailesView.swift in Sources */,
 				A7CC750D227157DA003C4F38 /* MessageDetailesView.swift in Sources */,
-				A7B4E72B2281752B0012914A /* ShoppingMallBarChartTableViewCell.swift in Sources */,
 				BD7AB83622841A8B0030646A /* ShoppingCartPayOrderItemCell.swift in Sources */,
 				BD7AB83622841A8B0030646A /* ShoppingCartPayOrderItemCell.swift in Sources */,
 				A71AA519227219D7008FF1A5 /* EditExpressAddressViewController.swift in Sources */,
 				A71AA519227219D7008FF1A5 /* EditExpressAddressViewController.swift in Sources */,
 				BD20F1CD2283C51300677D8E /* ShoppingCartFinishPayController.swift in Sources */,
 				BD20F1CD2283C51300677D8E /* ShoppingCartFinishPayController.swift in Sources */,

+ 3 - 1
RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ShoppingMall/View/ShoppingMallFloor/Floor/ShoppingMallFloorTableViewCell.swift

@@ -199,7 +199,7 @@ extension ShoppingMallFloorTableViewCell: UICollectionViewDelegateFlowLayout,UIC
             switch cmsRuleModel?.showType {
             switch cmsRuleModel?.showType {
             case 0: // 0:左图右字;
             case 0: // 0:左图右字;
                 let headerView = ProductFloorLeftHeaderCollectionReusableView.headerWith(collectionView: collectionView, kind:  UICollectionView.elementKindSectionHeader, indexPath: indexPath)
                 let headerView = ProductFloorLeftHeaderCollectionReusableView.headerWith(collectionView: collectionView, kind:  UICollectionView.elementKindSectionHeader, indexPath: indexPath)
-                
+                headerView.cmsRuleModel = cmsRuleModel
                 if !(productModelsArrays?.isEmpty ?? true) {
                 if !(productModelsArrays?.isEmpty ?? true) {
                     let productModels = productModelsArrays![indexPath.section]
                     let productModels = productModelsArrays![indexPath.section]
                     if productModels.isEmpty {
                     if productModels.isEmpty {
@@ -213,9 +213,11 @@ extension ShoppingMallFloorTableViewCell: UICollectionViewDelegateFlowLayout,UIC
                 return headerView
                 return headerView
             case 1: // 1:通栏大图
             case 1: // 1:通栏大图
                 let headerView = ProductFloorCenterHeaderCollectionReusableView.headerWith(collectionView: collectionView, kind:  UICollectionView.elementKindSectionHeader, indexPath: indexPath)
                 let headerView = ProductFloorCenterHeaderCollectionReusableView.headerWith(collectionView: collectionView, kind:  UICollectionView.elementKindSectionHeader, indexPath: indexPath)
+                headerView.cmsRuleModel = cmsRuleModel
                 return headerView
                 return headerView
             case 2: //  2:左右滑动
             case 2: //  2:左右滑动
                 let headerView = ProductFloorFullLeftHeaderCollectionReusableView.headerWith(collectionView: collectionView, kind:  UICollectionView.elementKindSectionHeader, indexPath: indexPath)
                 let headerView = ProductFloorFullLeftHeaderCollectionReusableView.headerWith(collectionView: collectionView, kind:  UICollectionView.elementKindSectionHeader, indexPath: indexPath)
+                headerView.cmsRuleModel = cmsRuleModel
                 return headerView
                 return headerView
             default:
             default:
                 return UICollectionReusableView()
                 return UICollectionReusableView()

+ 6 - 0
RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ShoppingMall/View/ShoppingMallFloor/ProductCollectionReusableView/ProductFloorBannerView.swift

@@ -28,5 +28,11 @@ class ProductFloorBannerView: BaseView {
         bannerButton.masksToBounds = true
         bannerButton.masksToBounds = true
         return bannerButton
         return bannerButton
     }()
     }()
+    
+    var cmsRuleModel: CMSRuleModel? {
+        didSet {
+            bannerButton.kf.setBackgroundImage(with: kURLImage(name: cmsRuleModel?.url ?? "pic_preload"), for: UIControl.State.normal, placeholder: kImage(name: "pic_preload"))
+        }
+    }
 
 
 }
 }

+ 84 - 1
RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ShoppingMall/View/ShoppingMallFloor/ProductCollectionReusableView/ProductFloorCenterHeaderCollectionReusableView.swift

@@ -9,7 +9,7 @@
 import UIKit
 import UIKit
 
 
 class ProductFloorCenterHeaderCollectionReusableView: UICollectionReusableView {
 class ProductFloorCenterHeaderCollectionReusableView: UICollectionReusableView {
-    class func headerWith(collectionView:UICollectionView,kind: String,indexPath: IndexPath) -> UICollectionReusableView {
+    class func headerWith(collectionView:UICollectionView,kind: String,indexPath: IndexPath) -> ProductFloorCenterHeaderCollectionReusableView {
         let ID = "ProductFloorCenterHeaderCollectionReusableView"
         let ID = "ProductFloorCenterHeaderCollectionReusableView"
         collectionView.register(ProductFloorCenterHeaderCollectionReusableView.self, forSupplementaryViewOfKind: kind, withReuseIdentifier: ID)
         collectionView.register(ProductFloorCenterHeaderCollectionReusableView.self, forSupplementaryViewOfKind: kind, withReuseIdentifier: ID)
         let headerView : ProductFloorCenterHeaderCollectionReusableView = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: ID, for: indexPath) as! ProductFloorCenterHeaderCollectionReusableView
         let headerView : ProductFloorCenterHeaderCollectionReusableView = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: ID, for: indexPath) as! ProductFloorCenterHeaderCollectionReusableView
@@ -76,5 +76,88 @@ class ProductFloorCenterHeaderCollectionReusableView: UICollectionReusableView {
         return bgView
         return bgView
     }()
     }()
     
     
+    var cmsRuleModel: CMSRuleModel? {
+        didSet {
+            floorLayout()
+            floorIsHidden()
+            floorTitleView.cmsRuleModel = cmsRuleModel?.rule
+        }
+    }
+    
+    private func floorLayout() {
+        if cmsRuleModel?.rule?.title == "" && cmsRuleModel?.rule?.url != "" {
+            floorTitleView.snp.remakeConstraints { (make) in
+                make.top.equalToSuperview()
+                make.height.equalTo(0)
+                make.right.equalTo(0)
+                make.left.equalTo(0)
+            }
+            
+            floorBannerView.snp.makeConstraints { (make) in
+                make.top.equalTo(0)
+                make.right.equalTo(0)
+                make.left.equalTo(0)
+                make.height.equalTo(90 * kScaleWidth)
+            }
+        } else if  cmsRuleModel?.rule?.title != "" && cmsRuleModel?.rule?.url == ""{
+            floorTitleView.snp.remakeConstraints { (make) in
+                make.top.equalToSuperview()
+                make.height.equalTo(63)
+                make.right.equalTo(0)
+                make.left.equalTo(0)
+            }
+            floorBannerView.snp.makeConstraints { (make) in
+                make.top.equalTo(0)
+                make.right.equalTo(0)
+                make.left.equalTo(0)
+                make.height.equalTo(0)
+            }
+        } else if cmsRuleModel?.rule?.url == "" && cmsRuleModel?.rule?.title == ""{
+            floorTitleView.snp.remakeConstraints { (make) in
+                make.top.equalTo(0)
+                make.height.equalTo(0)
+                make.right.equalTo(0)
+                make.left.equalTo(0)
+            }
+            floorBannerView.snp.makeConstraints { (make) in
+                make.top.equalTo(0)
+                make.right.equalTo(0)
+                make.left.equalTo(0)
+                make.height.equalTo(0)
+            }
+        }else {
+            floorTitleView.snp.remakeConstraints { (make) in
+                make.top.equalToSuperview()
+                make.height.equalTo(63)
+                make.right.equalTo(0)
+                make.left.equalTo(0)
+            }
+            
+            floorBannerView.snp.remakeConstraints { (make) in
+                make.top.equalTo(63)
+                make.right.equalTo(0)
+                make.left.equalTo(0)
+                make.height.equalTo(90 * kScaleWidth)
+            }
+        }
+    }
+    
+    private func floorIsHidden() {
+        
+        if cmsRuleModel?.rule?.title == "" && cmsRuleModel?.rule?.url != "" {
+            floorTitleView.isHidden = true
+            floorBannerView.isHidden = false
+        } else if  cmsRuleModel?.rule?.title != "" && cmsRuleModel?.rule?.url == ""{
+            floorTitleView.isHidden = false
+            floorBannerView.isHidden = true
+        } else if cmsRuleModel?.rule?.url == "" && cmsRuleModel?.rule?.title == ""{
+            floorTitleView.isHidden = true
+            floorBannerView.isHidden = true
+        }else {
+            floorTitleView.isHidden = false
+            floorBannerView.isHidden = false
+        }
+    }
+    
     
     
 }
 }

+ 6 - 0
RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ShoppingMall/View/ShoppingMallFloor/ProductCollectionReusableView/ProductFloorCenterTitleView.swift

@@ -28,4 +28,10 @@ class ProductFloorCenterTitleView: BaseView {
         titleLabel.text = "今日推荐"
         titleLabel.text = "今日推荐"
         return titleLabel
         return titleLabel
     }()
     }()
+    
+    var cmsRuleModel: CMSRuleModel? {
+        didSet {
+            titleLabel.text = cmsRuleModel?.title
+        }
+    }
 }
 }

+ 84 - 1
RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ShoppingMall/View/ShoppingMallFloor/ProductCollectionReusableView/ProductFloorFullLeftHeaderCollectionReusableView.swift

@@ -9,7 +9,7 @@
 import UIKit
 import UIKit
 
 
 class ProductFloorFullLeftHeaderCollectionReusableView: UICollectionReusableView {
 class ProductFloorFullLeftHeaderCollectionReusableView: UICollectionReusableView {
-    class func headerWith(collectionView:UICollectionView,kind: String,indexPath: IndexPath) -> UICollectionReusableView {
+    class func headerWith(collectionView:UICollectionView,kind: String,indexPath: IndexPath) -> ProductFloorFullLeftHeaderCollectionReusableView {
         let ID = "ProductFloorFullLeftHeaderCollectionReusableView"
         let ID = "ProductFloorFullLeftHeaderCollectionReusableView"
         collectionView.register(ProductFloorFullLeftHeaderCollectionReusableView.self, forSupplementaryViewOfKind: kind, withReuseIdentifier: ID)
         collectionView.register(ProductFloorFullLeftHeaderCollectionReusableView.self, forSupplementaryViewOfKind: kind, withReuseIdentifier: ID)
         let headerView : ProductFloorFullLeftHeaderCollectionReusableView = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: ID, for: indexPath) as! ProductFloorFullLeftHeaderCollectionReusableView
         let headerView : ProductFloorFullLeftHeaderCollectionReusableView = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: ID, for: indexPath) as! ProductFloorFullLeftHeaderCollectionReusableView
@@ -76,4 +76,87 @@ class ProductFloorFullLeftHeaderCollectionReusableView: UICollectionReusableView
         bgView.backgroundColor = UIColor.white
         bgView.backgroundColor = UIColor.white
         return bgView
         return bgView
     }()
     }()
+    
+    var cmsRuleModel: CMSRuleModel? {
+        didSet {
+            floorLayout()
+            floorIsHidden()
+            floorTitleView.cmsRuleModel = cmsRuleModel?.rule
+        }
+    }
+    
+    private func floorLayout() {
+        if cmsRuleModel?.rule?.title == "" && cmsRuleModel?.rule?.url != "" {
+            floorTitleView.snp.remakeConstraints { (make) in
+                make.top.equalToSuperview()
+                make.height.equalTo(0)
+                make.right.equalTo(0)
+                make.left.equalTo(0)
+            }
+            
+            floorBannerView.snp.makeConstraints { (make) in
+                make.top.equalTo(0)
+                make.right.equalTo(0)
+                make.left.equalTo(0)
+                make.height.equalTo(90 * kScaleWidth)
+            }
+        } else if  cmsRuleModel?.rule?.title != "" && cmsRuleModel?.rule?.url == ""{
+            floorTitleView.snp.remakeConstraints { (make) in
+                make.top.equalToSuperview()
+                make.height.equalTo(50)
+                make.right.equalTo(0)
+                make.left.equalTo(0)
+            }
+            floorBannerView.snp.makeConstraints { (make) in
+                make.top.equalTo(0)
+                make.right.equalTo(0)
+                make.left.equalTo(0)
+                make.height.equalTo(0)
+            }
+        } else if cmsRuleModel?.rule?.url == "" && cmsRuleModel?.rule?.title == ""{
+            floorTitleView.snp.remakeConstraints { (make) in
+                make.top.equalTo(0)
+                make.height.equalTo(0)
+                make.right.equalTo(0)
+                make.left.equalTo(0)
+            }
+            floorBannerView.snp.makeConstraints { (make) in
+                make.top.equalTo(0)
+                make.right.equalTo(0)
+                make.left.equalTo(0)
+                make.height.equalTo(0)
+            }
+        }else {
+            floorTitleView.snp.remakeConstraints { (make) in
+                make.top.equalToSuperview()
+                make.height.equalTo(50)
+                make.right.equalTo(0)
+                make.left.equalTo(0)
+            }
+            
+            floorBannerView.snp.remakeConstraints { (make) in
+                make.top.equalTo(50)
+                make.right.equalTo(0)
+                make.left.equalTo(0)
+                make.height.equalTo(90 * kScaleWidth)
+            }
+        }
+    }
+    
+    private func floorIsHidden() {
+        
+        if cmsRuleModel?.rule?.title == "" && cmsRuleModel?.rule?.url != "" {
+            floorTitleView.isHidden = true
+            floorBannerView.isHidden = false
+        } else if  cmsRuleModel?.rule?.title != "" && cmsRuleModel?.rule?.url == ""{
+            floorTitleView.isHidden = false
+            floorBannerView.isHidden = true
+        } else if cmsRuleModel?.rule?.url == "" && cmsRuleModel?.rule?.title == ""{
+            floorTitleView.isHidden = true
+            floorBannerView.isHidden = true
+        }else {
+            floorTitleView.isHidden = false
+            floorBannerView.isHidden = false
+        }
+    }
 }
 }

+ 83 - 0
RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ShoppingMall/View/ShoppingMallFloor/ProductCollectionReusableView/ProductFloorLeftHeaderCollectionReusableView.swift

@@ -83,4 +83,87 @@ class ProductFloorLeftHeaderCollectionReusableView: UICollectionReusableView {
         bgView.layer.mask = shapeLayer
         bgView.layer.mask = shapeLayer
         return bgView
         return bgView
     }()
     }()
+    
+    var cmsRuleModel: CMSRuleModel? {
+        didSet {
+            floorLayout()
+            floorIsHidden()
+            floorTitleView.cmsRuleModel = cmsRuleModel?.rule
+        }
+    }
+    
+    private func floorLayout() {
+        if cmsRuleModel?.rule?.title == "" && cmsRuleModel?.rule?.url != "" {
+            floorTitleView.snp.remakeConstraints { (make) in
+                make.top.equalToSuperview()
+                make.height.equalTo(0)
+                make.right.equalTo(0)
+                make.left.equalTo(0)
+            }
+            
+            floorBannerView.snp.makeConstraints { (make) in
+                make.top.equalTo(0)
+                make.right.equalTo(0)
+                make.left.equalTo(0)
+                make.height.equalTo(90 * kScaleWidth)
+            }
+        } else if  cmsRuleModel?.rule?.title != "" && cmsRuleModel?.rule?.url == ""{
+            floorTitleView.snp.remakeConstraints { (make) in
+                make.top.equalToSuperview()
+                make.height.equalTo(50)
+                make.right.equalTo(0)
+                make.left.equalTo(0)
+            }
+            floorBannerView.snp.makeConstraints { (make) in
+                make.top.equalTo(0)
+                make.right.equalTo(0)
+                make.left.equalTo(0)
+                make.height.equalTo(0)
+            }
+        } else if cmsRuleModel?.rule?.url == "" && cmsRuleModel?.rule?.title == ""{
+            floorTitleView.snp.remakeConstraints { (make) in
+                make.top.equalTo(0)
+                make.height.equalTo(0)
+                make.right.equalTo(0)
+                make.left.equalTo(0)
+            }
+            floorBannerView.snp.makeConstraints { (make) in
+                make.top.equalTo(0)
+                make.right.equalTo(0)
+                make.left.equalTo(0)
+                make.height.equalTo(0)
+            }
+        }else {
+            floorTitleView.snp.remakeConstraints { (make) in
+                make.top.equalToSuperview()
+                make.height.equalTo(50)
+                make.right.equalTo(0)
+                make.left.equalTo(0)
+            }
+            
+            floorBannerView.snp.remakeConstraints { (make) in
+                make.top.equalTo(50)
+                make.right.equalTo(0)
+                make.left.equalTo(0)
+                make.height.equalTo(90 * kScaleWidth)
+            }
+        }
+    }
+    
+    private func floorIsHidden() {
+
+        if cmsRuleModel?.rule?.title == "" && cmsRuleModel?.rule?.url != "" {
+            floorTitleView.isHidden = true
+            floorBannerView.isHidden = false
+        } else if  cmsRuleModel?.rule?.title != "" && cmsRuleModel?.rule?.url == ""{
+            floorTitleView.isHidden = false
+            floorBannerView.isHidden = true
+        } else if cmsRuleModel?.rule?.url == "" && cmsRuleModel?.rule?.title == ""{
+            floorTitleView.isHidden = true
+            floorBannerView.isHidden = true
+        }else {
+            floorTitleView.isHidden = false
+            floorBannerView.isHidden = false
+        }
+    }
 }
 }

+ 6 - 0
RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ShoppingMall/View/ShoppingMallFloor/ProductCollectionReusableView/ProductFloorTitleView.swift

@@ -45,4 +45,10 @@ class ProductFloorTitleView: BaseView {
         return titleLabel
         return titleLabel
     }()
     }()
     
     
+    var cmsRuleModel: CMSRuleModel? {
+        didSet {
+            titleLabel.text = cmsRuleModel?.title
+        }
+    }
+    
 }
 }

+ 22 - 195
RainbowPlanet/RainbowPlanet/Service/Model/ProductModel/ProductModel.swift

@@ -6,7 +6,7 @@ import Foundation
 import ObjectMapper
 import ObjectMapper
 
 
 
 
-class ProductModel : NSObject, NSCoding, Mappable{
+class ProductModel : NSObject, Mappable{
 
 
 	var attributeCategoryId : Int?
 	var attributeCategoryId : Int?
 	var bigImg : String?
 	var bigImg : String?
@@ -52,6 +52,18 @@ class ProductModel : NSObject, NSCoding, Mappable{
 	var updatedAt : String?
 	var updatedAt : String?
 	var video : String?
 	var video : String?
 	var wasteStatus : Int?
 	var wasteStatus : Int?
+    
+    
+    // 购物车
+    var cityName : String?
+    var amount : Int?
+    var isSelect : Int?
+    var productId : Int?
+    var productImg : String?
+    var productName : String?
+    var productPrice : Int?
+    var skuPrice : Int?
+    var uid : Int?
 
 
 
 
 	class func newInstance(map: Map) -> Mappable?{
 	class func newInstance(map: Map) -> Mappable?{
@@ -106,201 +118,16 @@ class ProductModel : NSObject, NSCoding, Mappable{
 		updatedAt <- map["updated_at"]
 		updatedAt <- map["updated_at"]
 		video <- map["video"]
 		video <- map["video"]
 		wasteStatus <- map["waste_status"]
 		wasteStatus <- map["waste_status"]
+        // 购物车
+        amount <- map["amount"]
+        isSelect <- map["is_select"]
+        productId <- map["product_id"]
+        productImg <- map["product_img"]
+        productName <- map["product_name"]
+        productPrice <- map["product_price"]
+        skuPrice <- map["sku_price"]
+        uid <- map["uid"]
 		
 		
 	}
 	}
 
 
-    /**
-    * NSCoding required initializer.
-    * Fills the data from the passed decoder
-    */
-    @objc required init(coder aDecoder: NSCoder)
-	{
-         attributeCategoryId = aDecoder.decodeObject(forKey: "attribute_category_id") as? Int
-         bigImg = aDecoder.decodeObject(forKey: "big_img") as? String
-         categoryId1 = aDecoder.decodeObject(forKey: "category_id1") as? Int
-         categoryId2 = aDecoder.decodeObject(forKey: "category_id2") as? Int
-         categoryId3 = aDecoder.decodeObject(forKey: "category_id3") as? Int
-         cityId = aDecoder.decodeObject(forKey: "city_id") as? Int
-         commentNumber = aDecoder.decodeObject(forKey: "comment_number") as? Int
-         commentScore = aDecoder.decodeObject(forKey: "comment_score") as? Int
-         commentStar = aDecoder.decodeObject(forKey: "comment_star") as? String
-         createdAt = aDecoder.decodeObject(forKey: "created_at") as? String
-         deletedAt = aDecoder.decodeObject(forKey: "deleted_at") as? String
-         deliverType = aDecoder.decodeObject(forKey: "deliver_type") as? Int
-         desc = aDecoder.decodeObject(forKey: "desc") as? String
-         id = aDecoder.decodeObject(forKey: "id") as? Int
-         img = aDecoder.decodeObject(forKey: "img") as? String
-         isConfirmSale = aDecoder.decodeObject(forKey: "is_confirm_sale") as? Int
-         isMain = aDecoder.decodeObject(forKey: "is_main") as? Int
-         limitNumber = aDecoder.decodeObject(forKey: "limit_number") as? Int
-         limitType = aDecoder.decodeObject(forKey: "limit_type") as? String
-         name = aDecoder.decodeObject(forKey: "name") as? String
-         originPrice = aDecoder.decodeObject(forKey: "origin_price") as? Int
-         otherCode = aDecoder.decodeObject(forKey: "other_code") as? String
-         price = aDecoder.decodeObject(forKey: "price") as? Int
-         receiveTime = aDecoder.decodeObject(forKey: "receive_time") as? String
-         receiveType = aDecoder.decodeObject(forKey: "receive_type") as? Int
-         saleName = aDecoder.decodeObject(forKey: "sale_name") as? String
-         saleStatus = aDecoder.decodeObject(forKey: "sale_status") as? Int
-         shopId = aDecoder.decodeObject(forKey: "shop_id") as? Int
-         shopName = aDecoder.decodeObject(forKey: "shop_name") as? String
-         skuCode = aDecoder.decodeObject(forKey: "sku_code") as? String
-         skuId = aDecoder.decodeObject(forKey: "sku_id") as? Int
-         skuName = aDecoder.decodeObject(forKey: "sku_name") as? String
-         sort = aDecoder.decodeObject(forKey: "sort") as? Int
-         spuCode = aDecoder.decodeObject(forKey: "spu_code") as? String
-         status = aDecoder.decodeObject(forKey: "status") as? Int
-         stock = aDecoder.decodeObject(forKey: "stock") as? Int
-         storeTypeIds = aDecoder.decodeObject(forKey: "store_type_ids") as? String
-         subtitle = aDecoder.decodeObject(forKey: "subtitle") as? String
-         totalCount = aDecoder.decodeObject(forKey: "total_count") as? Int
-         totalStock = aDecoder.decodeObject(forKey: "total_stock") as? Int
-         upStatus = aDecoder.decodeObject(forKey: "up_status") as? Int
-         updatedAt = aDecoder.decodeObject(forKey: "updated_at") as? String
-         video = aDecoder.decodeObject(forKey: "video") as? String
-         wasteStatus = aDecoder.decodeObject(forKey: "waste_status") as? Int
-
-	}
-
-    /**
-    * NSCoding required method.
-    * Encodes mode properties into the decoder
-    */
-    @objc func encode(with aCoder: NSCoder)
-	{
-		if attributeCategoryId != nil{
-			aCoder.encode(attributeCategoryId, forKey: "attribute_category_id")
-		}
-		if bigImg != nil{
-			aCoder.encode(bigImg, forKey: "big_img")
-		}
-		if categoryId1 != nil{
-			aCoder.encode(categoryId1, forKey: "category_id1")
-		}
-		if categoryId2 != nil{
-			aCoder.encode(categoryId2, forKey: "category_id2")
-		}
-		if categoryId3 != nil{
-			aCoder.encode(categoryId3, forKey: "category_id3")
-		}
-		if cityId != nil{
-			aCoder.encode(cityId, forKey: "city_id")
-		}
-		if commentNumber != nil{
-			aCoder.encode(commentNumber, forKey: "comment_number")
-		}
-		if commentScore != nil{
-			aCoder.encode(commentScore, forKey: "comment_score")
-		}
-		if commentStar != nil{
-			aCoder.encode(commentStar, forKey: "comment_star")
-		}
-		if createdAt != nil{
-			aCoder.encode(createdAt, forKey: "created_at")
-		}
-		if deletedAt != nil{
-			aCoder.encode(deletedAt, forKey: "deleted_at")
-		}
-		if deliverType != nil{
-			aCoder.encode(deliverType, forKey: "deliver_type")
-		}
-		if desc != nil{
-			aCoder.encode(desc, forKey: "desc")
-		}
-		if id != nil{
-			aCoder.encode(id, forKey: "id")
-		}
-		if img != nil{
-			aCoder.encode(img, forKey: "img")
-		}
-		if isConfirmSale != nil{
-			aCoder.encode(isConfirmSale, forKey: "is_confirm_sale")
-		}
-		if isMain != nil{
-			aCoder.encode(isMain, forKey: "is_main")
-		}
-		if limitNumber != nil{
-			aCoder.encode(limitNumber, forKey: "limit_number")
-		}
-		if limitType != nil{
-			aCoder.encode(limitType, forKey: "limit_type")
-		}
-		if name != nil{
-			aCoder.encode(name, forKey: "name")
-		}
-		if originPrice != nil{
-			aCoder.encode(originPrice, forKey: "origin_price")
-		}
-		if otherCode != nil{
-			aCoder.encode(otherCode, forKey: "other_code")
-		}
-		if price != nil{
-			aCoder.encode(price, forKey: "price")
-		}
-		if receiveTime != nil{
-			aCoder.encode(receiveTime, forKey: "receive_time")
-		}
-		if receiveType != nil{
-			aCoder.encode(receiveType, forKey: "receive_type")
-		}
-		if saleName != nil{
-			aCoder.encode(saleName, forKey: "sale_name")
-		}
-		if saleStatus != nil{
-			aCoder.encode(saleStatus, forKey: "sale_status")
-		}
-		if shopId != nil{
-			aCoder.encode(shopId, forKey: "shop_id")
-		}
-		if shopName != nil{
-			aCoder.encode(shopName, forKey: "shop_name")
-		}
-		if skuCode != nil{
-			aCoder.encode(skuCode, forKey: "sku_code")
-		}
-		if skuId != nil{
-			aCoder.encode(skuId, forKey: "sku_id")
-		}
-		if skuName != nil{
-			aCoder.encode(skuName, forKey: "sku_name")
-		}
-		if sort != nil{
-			aCoder.encode(sort, forKey: "sort")
-		}
-		if spuCode != nil{
-			aCoder.encode(spuCode, forKey: "spu_code")
-		}
-		if status != nil{
-			aCoder.encode(status, forKey: "status")
-		}
-		if stock != nil{
-			aCoder.encode(stock, forKey: "stock")
-		}
-		if storeTypeIds != nil{
-			aCoder.encode(storeTypeIds, forKey: "store_type_ids")
-		}
-		if subtitle != nil{
-			aCoder.encode(subtitle, forKey: "subtitle")
-		}
-		if totalCount != nil{
-			aCoder.encode(totalCount, forKey: "total_count")
-		}
-		if totalStock != nil{
-			aCoder.encode(totalStock, forKey: "total_stock")
-		}
-		if upStatus != nil{
-			aCoder.encode(upStatus, forKey: "up_status")
-		}
-		if updatedAt != nil{
-			aCoder.encode(updatedAt, forKey: "updated_at")
-		}
-		if video != nil{
-			aCoder.encode(video, forKey: "video")
-		}
-		if wasteStatus != nil{
-			aCoder.encode(wasteStatus, forKey: "waste_status")
-		}
-
-	}
-
 }
 }