Commit 43cc113daee20a13824cab41ef6875962c33ca36

Authored by 张旭
1 parent 36950533

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

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