Commit 43cc113daee20a13824cab41ef6875962c33ca36

Authored by 张旭
1 parent 36950533

新增商品-点击商品分类,店铺分类有遮挡问题

metaCode/Classes/Common/Base/CNLiveBaseViewController.swift
@@ -144,7 +144,7 @@ class CNLiveBaseViewController: UIViewController { @@ -144,7 +144,7 @@ class CNLiveBaseViewController: UIViewController {
144 144
145 override func viewWillLayoutSubviews() { 145 override func viewWillLayoutSubviews() {
146 super.viewWillLayoutSubviews() 146 super.viewWillLayoutSubviews()
147 - topNavView.frame = CGRect(x: 0, y: 0, width: view.width, height: topNavViewHeight + get_system_statusBar_height()) 147 + topNavView.frame = CGRect(x: 0, y: 0, width: view.width, height:topNavViewHeight)// topNavViewHeight + get_system_statusBar_height())
148 let lrSpace = leftNavSpace > rightNavSpace ? leftNavSpace : rightNavSpace 148 let lrSpace = leftNavSpace > rightNavSpace ? leftNavSpace : rightNavSpace
149 titleLabel.frame = CGRect(x: CGFloat(Int(lrSpace)) , y: topNavViewHeight - get_system_nav_ui_height() - topNavViewSubUIContentOffsetY, width: topNavView.width - (lrSpace * 2), height: get_system_nav_ui_height()) 149 titleLabel.frame = CGRect(x: CGFloat(Int(lrSpace)) , y: topNavViewHeight - get_system_nav_ui_height() - topNavViewSubUIContentOffsetY, width: topNavView.width - (lrSpace * 2), height: get_system_nav_ui_height())
150 leftNavBtns.forEach { currentBtn in 150 leftNavBtns.forEach { currentBtn in
@@ -223,7 +223,7 @@ class CNLiveBaseViewController: UIViewController { @@ -223,7 +223,7 @@ class CNLiveBaseViewController: UIViewController {
223 223
224 @objc func ClickBackBtn() { 224 @objc func ClickBackBtn() {
225 let viewControllers = self.navigationController?.viewControllers 225 let viewControllers = self.navigationController?.viewControllers
226 - if viewControllers!.count > 1 { 226 + if viewControllers?.count ?? 0 > 1 {
227 if viewControllers?.last == self { 227 if viewControllers?.last == self {
228 self.navigationController!.popViewController(animated: true) 228 self.navigationController!.popViewController(animated: true)
229 }else{ 229 }else{
metaCode/Classes/Main/HomePage/Controller/GoodsManager/CNLiveGoodsCategoryController.swift
@@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
6 // 商品分类/店铺分类 6 // 商品分类/店铺分类
7 7
8 import Foundation 8 import Foundation
9 - 9 +import QMUIKit
10 ///分类类型 10 ///分类类型
11 enum CNLiveGoodsCategoryType:Int { 11 enum CNLiveGoodsCategoryType:Int {
12 ///商品分类 12 ///商品分类
@@ -207,7 +207,7 @@ class CNLiveGoodsCategoryController: CNLiveBaseViewController, UITableViewDataSo @@ -207,7 +207,7 @@ class CNLiveGoodsCategoryController: CNLiveBaseViewController, UITableViewDataSo
207 207
208 // MARK: - initUI 208 // MARK: - initUI
209 func initUI(){ 209 func initUI(){
210 - self.shadowView = UIView(frame: CGRect(x: 0, y: KNavigationHeight, width: self.view.width, height: self.view.height - KNavigationHeight)) 210 + self.shadowView = UIView(frame: CGRect(x: 0, y: self.topNavView.height, width: self.view.width, height: self.view.height - self.topNavView.height))
211 self.shadowView?.backgroundColor = UIColor(white: 0, alpha: 0.26) 211 self.shadowView?.backgroundColor = UIColor(white: 0, alpha: 0.26)
212 self.shadowView?.isHidden = true 212 self.shadowView?.isHidden = true
213 self.view.addSubview(self.shadowView!) 213 self.view.addSubview(self.shadowView!)
@@ -279,7 +279,10 @@ class CNLiveGoodsCategoryController: CNLiveBaseViewController, UITableViewDataSo @@ -279,7 +279,10 @@ class CNLiveGoodsCategoryController: CNLiveBaseViewController, UITableViewDataSo
279 279
280 self.contentView?.addSubview(self.tableView) 280 self.contentView?.addSubview(self.tableView)
281 } 281 }
282 - 282 + deinit {
  283 + print("CNLiveGoodsCategoryController销毁")
  284 + }
  285 +
283 // MARK: - 显示/隐藏方法 286 // MARK: - 显示/隐藏方法
284 public func display(){ 287 public func display(){
285 288
@@ -290,9 +293,16 @@ class CNLiveGoodsCategoryController: CNLiveBaseViewController, UITableViewDataSo @@ -290,9 +293,16 @@ class CNLiveGoodsCategoryController: CNLiveBaseViewController, UITableViewDataSo
290 } 293 }
291 } 294 }
292 public func hide(){ 295 public func hide(){
  296 + let vc = self.view.superview?.qmui_viewController?.qmui_visibleViewControllerIfExist() as! CNLiveShopNewProductController
  297 + if self.categoryType == .goods{
  298 + vc.isShowGoodsCategory = false
  299 + }else{
  300 + vc.isShowShopCategory = false
  301 + }
293 UIView.animate(withDuration: 0.2) { 302 UIView.animate(withDuration: 0.2) {
294 self.shadowView?.isHidden = true 303 self.shadowView?.isHidden = true
295 self.contentView!.top = self.view.height 304 self.contentView!.top = self.view.height
  305 + self.view.removeFromSuperview()
296 }completion: { finished in 306 }completion: { finished in
297 self.view.isUserInteractionEnabled = false 307 self.view.isUserInteractionEnabled = false
298 } 308 }
metaCode/Classes/Main/HomePage/Controller/GoodsManager/CNLiveShopNewProductController.swift
@@ -26,7 +26,7 @@ class CNLiveShopNewProductController:CNLiveBaseViewController{ @@ -26,7 +26,7 @@ class CNLiveShopNewProductController:CNLiveBaseViewController{
26 var isRequestAdd:Bool = false 26 var isRequestAdd:Bool = false
27 27
28 lazy var bgScrollView :UIScrollView = { 28 lazy var bgScrollView :UIScrollView = {
29 - let bgScrollView = UIScrollView(frame: CGRect(x: 0, y: KNavigationHeight, width: KSreenWidth, height: KSreenHeight-KNavigationHeight-KTabBarHeight)) 29 + let bgScrollView = UIScrollView(frame: CGRect(x: 0, y: self.topNavView.height, width: KSreenWidth, height: KSreenHeight-self.topNavView.height-KTabBarHeight))
30 bgScrollView.showsVerticalScrollIndicator = false 30 bgScrollView.showsVerticalScrollIndicator = false
31 return bgScrollView 31 return bgScrollView
32 }() 32 }()
@@ -58,11 +58,14 @@ class CNLiveShopNewProductController:CNLiveBaseViewController{ @@ -58,11 +58,14 @@ class CNLiveShopNewProductController:CNLiveBaseViewController{
58 singleView1.layoutSubviews() 58 singleView1.layoutSubviews()
59 } 59 }
60 self.addChild(vc) 60 self.addChild(vc)
61 - vc.view.frame = CGRect(x: 0, y: KNavigationHeight, width: self.view.width, height: self.view.height-KNavigationHeight) 61 + vc.view.frame = CGRect(x: 0, y: 0, width: self.view.width, height: self.view.height)
62 vc.didMove(toParent: self) 62 vc.didMove(toParent: self)
63 self.view.addSubview(vc.view) 63 self.view.addSubview(vc.view)
64 _selectCategoryVC = vc 64 _selectCategoryVC = vc
65 } 65 }
  66 + if _selectCategoryVC!.view.superview == nil && self.isShowGoodsCategory == true{
  67 + self.view.addSubview(_selectCategoryVC!.view)
  68 + }
66 return _selectCategoryVC 69 return _selectCategoryVC
67 } 70 }
68 set{ 71 set{
@@ -94,6 +97,14 @@ class CNLiveShopNewProductController:CNLiveBaseViewController{ @@ -94,6 +97,14 @@ class CNLiveShopNewProductController:CNLiveBaseViewController{
94 vc.didMove(toParent: self) 97 vc.didMove(toParent: self)
95 _selectShopClassifyVC = vc 98 _selectShopClassifyVC = vc
96 _selectShopClassifyVC!.hideView() 99 _selectShopClassifyVC!.hideView()
  100 + if (self.type == .add) {
  101 + _selectShopClassifyVC!.initTitleName(name: "新增商品")
  102 + }else {
  103 + _selectShopClassifyVC!.initTitleName(name: "编辑商品")
  104 + }
  105 + }
  106 + if _selectShopClassifyVC!.view.superview == nil && self.isShowShopCategory == true{
  107 + self.view.addSubview(_selectShopClassifyVC!.view)
97 } 108 }
98 return _selectShopClassifyVC 109 return _selectShopClassifyVC
99 } 110 }
@@ -133,8 +144,12 @@ class CNLiveShopNewProductController:CNLiveBaseViewController{ @@ -133,8 +144,12 @@ class CNLiveShopNewProductController:CNLiveBaseViewController{
133 return bottomNavView 144 return bottomNavView
134 }() 145 }()
135 146
  147 + var isShowGoodsCategory = false
  148 + var isShowShopCategory = false
  149 +
136 override func viewDidLoad() { 150 override func viewDidLoad() {
137 super.viewDidLoad() 151 super.viewDidLoad()
  152 + navigationBarHidden = false
138 self.setUI() 153 self.setUI()
139 self.bgScrollView.backgroundColor = .white 154 self.bgScrollView.backgroundColor = .white
140 self.view.addSubview(self.bgScrollView) 155 self.view.addSubview(self.bgScrollView)
@@ -326,6 +341,7 @@ class CNLiveShopNewProductController:CNLiveBaseViewController{ @@ -326,6 +341,7 @@ class CNLiveShopNewProductController:CNLiveBaseViewController{
326 341
327 // MARK: - 显示选取分类界面 342 // MARK: - 显示选取分类界面
328 func displaySelectCategoryVC(){ 343 func displaySelectCategoryVC(){
  344 + self.isShowGoodsCategory = true
329 self.view.bringSubviewToFront(self.selectCategoryVC!.view) 345 self.view.bringSubviewToFront(self.selectCategoryVC!.view)
330 self.selectCategoryVC!.display() 346 self.selectCategoryVC!.display()
331 } 347 }
@@ -344,6 +360,7 @@ class CNLiveShopNewProductController:CNLiveBaseViewController{ @@ -344,6 +360,7 @@ class CNLiveShopNewProductController:CNLiveBaseViewController{
344 } 360 }
345 // MARK: - 显示选取店铺分类界面 361 // MARK: - 显示选取店铺分类界面
346 func displaySelectShopClassifyVC(){ 362 func displaySelectShopClassifyVC(){
  363 + self.isShowShopCategory = true
347 self.selectShopClassifyVC!.display() 364 self.selectShopClassifyVC!.display()
348 } 365 }
349 366