Commit 975fd9efdcc7eb99b8b3419bfe079ca893d12eb8
1 parent
445f7233
暂时没复现 push不跳转问题
Showing
10 changed files
with
46 additions
and
9 deletions
metaCode/Classes/Extensions/NSObject+CNLiveExtensions.swift
| ... | ... | @@ -20,8 +20,11 @@ func currentViewController() -> (UIViewController?) { |
| 20 | 20 | } |
| 21 | 21 | } |
| 22 | 22 | } |
| 23 | - let vc = window?.rootViewController | |
| 24 | - return currentVC(vc) | |
| 23 | + let vc = window?.rootViewController | |
| 24 | + print("currentVC:\(currentVC(vc)!)") | |
| 25 | + print("currentVC.children:\((currentVC(vc)!).children)") | |
| 26 | + print("currentVC.navi:\((currentVC(vc)!).navigationController)") | |
| 27 | + return currentVC(vc) | |
| 25 | 28 | } |
| 26 | 29 | |
| 27 | 30 | private func currentVC(_ vc :UIViewController?) -> UIViewController? { | ... | ... |
metaCode/Classes/Main/HomePage/Controller/CNLiveShopConsoleController.swift
| ... | ... | @@ -102,6 +102,9 @@ class CNLiveShopConsoleController: CNLiveBaseViewController, UICollectionViewDel |
| 102 | 102 | //创建店铺分类 |
| 103 | 103 | let vc = CNLiveCreateShopClassifyViewController() |
| 104 | 104 | vc.classifyType = .oneLevelClassify |
| 105 | + if currentViewController()?.navigationController == nil{ | |
| 106 | + print("nil") | |
| 107 | + } | |
| 105 | 108 | currentViewController()?.navigationController?.pushViewController(vc, animated: true) |
| 106 | 109 | }else if itemModel.type == CNLiveShopConsoleType.ShopClassifyManager.rawValue{ |
| 107 | 110 | //店铺分类管理 | ... | ... |
metaCode/Classes/Main/HomePage/Controller/GoodsDetail/CNLiveShopGoodsDetailsViewController.swift
metaCode/Classes/Main/HomePage/Controller/GoodsManager/CNLiveGoodsCategoryController.swift
| ... | ... | @@ -483,7 +483,13 @@ class CNLiveGoodsCategoryController: CNLiveBaseViewController, UITableViewDataSo |
| 483 | 483 | vc.successCompleteBlock = { |
| 484 | 484 | self.postShopClassify() |
| 485 | 485 | } |
| 486 | - self.navigationController?.pushViewController(vc, animated: true) | |
| 486 | + if self.navigationController == nil{ | |
| 487 | + print("self nil") | |
| 488 | + } | |
| 489 | + if currentViewController()?.navigationController == nil{ | |
| 490 | + print("curr nil") | |
| 491 | + } | |
| 492 | + currentViewController()?.navigationController?.pushViewController(vc, animated: true) | |
| 487 | 493 | } |
| 488 | 494 | |
| 489 | 495 | // MARK: - 数据请求 | ... | ... |
metaCode/Classes/Main/HomePage/Controller/GoodsManager/CNLiveShopNewProductController.swift
| ... | ... | @@ -84,7 +84,7 @@ class CNLiveShopNewProductController:CNLiveBaseViewController{ |
| 84 | 84 | vc.secCategoryId = self.shopGoodsDetailsModel.category_id2 |
| 85 | 85 | } |
| 86 | 86 | vc.finishBlock = { |
| 87 | - var singleView = self.getShopClassifyView() | |
| 87 | + let singleView = self.getShopClassifyView() | |
| 88 | 88 | singleView?.contentTextField.text = "\(self.selectShopClassifyVC!.firCategoryName ?? "") \(self.selectShopClassifyVC!.secCategoryName ?? "")" |
| 89 | 89 | singleView?.layoutSubviews() |
| 90 | 90 | } |
| ... | ... | @@ -195,7 +195,7 @@ class CNLiveShopNewProductController:CNLiveBaseViewController{ |
| 195 | 195 | previewBtn.setTitleColor(HexColor("#3A3A3A"), for: .normal) |
| 196 | 196 | previewBtn.titleLabel?.font = Font_15 |
| 197 | 197 | previewBtn.addTarget(self, action: #selector(previewBtnClick), for: .touchUpInside) |
| 198 | - self.bottomNavView.addSubview(previewBtn) | |
| 198 | +// self.bottomNavView.addSubview(previewBtn) | |
| 199 | 199 | |
| 200 | 200 | let saveBtn = UIButton(type: .custom) |
| 201 | 201 | saveBtn.frame = CGRect(x: previewBtn.right, y: 0, width: self.view.width - previewBtn.right, height: KTabBarHeight) | ... | ... |
metaCode/Classes/Main/HomePage/View/CNDownSlideView.swift
| ... | ... | @@ -85,9 +85,18 @@ class CNDownSlideView:UIView{ |
| 85 | 85 | }else if(type == UpDownTypeShopDetail){ |
| 86 | 86 | |
| 87 | 87 | }else if(type == UpDownTypeShopControlConsole){ |
| 88 | - currentViewController()?.addChild(self.shopConsoleVC) | |
| 89 | - self.shopConsoleVC.didMove(toParent: currentViewController()) | |
| 88 | + var isContainVC = false | |
| 89 | + currentViewController()?.children.forEach({ vc in | |
| 90 | + if vc == self.shopConsoleVC{ | |
| 91 | + isContainVC = true | |
| 92 | + } | |
| 93 | + }) | |
| 94 | + if isContainVC == false{ | |
| 95 | + currentViewController()?.addChild(self.shopConsoleVC) | |
| 96 | + self.shopConsoleVC.didMove(toParent: currentViewController()) | |
| 97 | + } | |
| 90 | 98 | self.addSubview(self.shopConsoleVC.view) |
| 99 | + | |
| 91 | 100 | } |
| 92 | 101 | } |
| 93 | 102 | } | ... | ... |
metaCode/Classes/Main/HomePage/View/CNLiveShopDetailBtnsCell.swift
| ... | ... | @@ -74,9 +74,15 @@ class CNLiveShopDetailBtnsCell: UICollectionViewCell { |
| 74 | 74 | ///push VC |
| 75 | 75 | if tag == 100 { |
| 76 | 76 | //商品管理 |
| 77 | + if currentViewController()?.navigationController == nil{ | |
| 78 | + print("nil") | |
| 79 | + } | |
| 77 | 80 | currentViewController()?.navigationController?.pushViewController(CNLiveShopProductManagerController.init(), animated: true) |
| 78 | 81 | }else if tag == 101 { |
| 79 | 82 | //订单管理 |
| 83 | + if currentViewController()?.navigationController == nil{ | |
| 84 | + print("nil") | |
| 85 | + } | |
| 80 | 86 | currentViewController()?.navigationController?.pushViewController(CNLiveShopOrderViewController.init(), animated: true) |
| 81 | 87 | } |
| 82 | 88 | // if tag == 100 { | ... | ... |
metaCode/Classes/Main/HomePage/View/CNLiveShopDetailOrderAssetCell.swift
| ... | ... | @@ -125,6 +125,9 @@ class CNLiveShopDetailOrderAssetCell:UICollectionViewCell{ |
| 125 | 125 | @objc func navsubBtnAction(_ sender: UIButton){ |
| 126 | 126 | if self.displayType == .CNLiveShopDetailDisplayTypeOrder{ |
| 127 | 127 | //push订单VC |
| 128 | + if currentViewController()?.navigationController == nil{ | |
| 129 | + print("nil") | |
| 130 | + } | |
| 128 | 131 | currentViewController()?.navigationController?.pushViewController(CNLiveShopOrderViewController.init(), animated: true) |
| 129 | 132 | }else if self.displayType == .CNLiveShopDetailDisplayTypeAsset{ |
| 130 | 133 | //push余额VC | ... | ... |
metaCode/Classes/Main/HomePage/View/CNLliveShopDetailBannerCell.swift
| ... | ... | @@ -99,6 +99,9 @@ class CNLliveShopDetailBannerCell:UICollectionViewCell,FSPagerViewDataSource,FSP |
| 99 | 99 | let bannerMdl = self.shopDetailModel?.banner[index] |
| 100 | 100 | let webVC = CNWebViewController() |
| 101 | 101 | webVC.url = URL(string: bannerMdl?.url ?? "") |
| 102 | + if currentViewController()?.navigationController == nil{ | |
| 103 | + print("nil") | |
| 104 | + } | |
| 102 | 105 | currentViewController()?.navigationController?.pushViewController(webVC, animated: true) |
| 103 | 106 | } |
| 104 | 107 | } | ... | ... |
metaCode/Classes/Main/HomePage/View/CNMainView.swift
| ... | ... | @@ -204,10 +204,16 @@ class CNFrontMainView : UIView{ |
| 204 | 204 | CNLiveMineViewModel.requestApplyShopInfo { [weak self] result, respStatue in |
| 205 | 205 | |
| 206 | 206 | if respStatue == .success { |
| 207 | + if currentViewController()?.navigationController == nil{ | |
| 208 | + print("nil") | |
| 209 | + } | |
| 207 | 210 | currentViewController()?.navigationController?.pushViewController(CNLiveMineShopViewController.init(showType: .one, listModel: (self?.idModel)!, tempArray: []), animated: true) |
| 208 | 211 | } |
| 209 | 212 | } |
| 210 | 213 | }else{ |
| 214 | + if currentViewController()?.navigationController == nil{ | |
| 215 | + print("nil") | |
| 216 | + } | |
| 211 | 217 | currentViewController()?.navigationController?.pushViewController(CNLiveMineInputViewController.init(listModel: self._idModel!), animated: true) |
| 212 | 218 | } |
| 213 | 219 | ... | ... |