Commit b39e46c4962c3a7ceff6941ef5df447928f1cb12
1 parent
975fd9ef
1.修改push 动画为false
2.店铺分类管理
Showing
27 changed files
with
692 additions
and
50 deletions
metaCode.xcodeproj/project.pbxproj
| ... | ... | @@ -48,6 +48,10 @@ |
| 48 | 48 | 1917332D2B15DB20007BCC04 /* CNLivePlayerKVOModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1917332C2B15DB20007BCC04 /* CNLivePlayerKVOModel.swift */; }; |
| 49 | 49 | 1917332F2B16C7C9007BCC04 /* CNLiveTimer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1917332E2B16C7C9007BCC04 /* CNLiveTimer.swift */; }; |
| 50 | 50 | 191733312B170537007BCC04 /* CNLiveCommonManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 191733302B170537007BCC04 /* CNLiveCommonManager.swift */; }; |
| 51 | + 191733362B27EFD4007BCC04 /* CNLiveShopClassilyManageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 191733352B27EFD3007BCC04 /* CNLiveShopClassilyManageViewController.swift */; }; | |
| 52 | + 191733382B27FD66007BCC04 /* CNLiveShopClassifySectionHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 191733372B27FD66007BCC04 /* CNLiveShopClassifySectionHeaderView.swift */; }; | |
| 53 | + 1917333A2B27FDF3007BCC04 /* CNLiveShopClassilyManageTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 191733392B27FDF3007BCC04 /* CNLiveShopClassilyManageTableViewCell.swift */; }; | |
| 54 | + 1917333C2B27FE75007BCC04 /* CNLiveShopClassilyManageHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1917333B2B27FE75007BCC04 /* CNLiveShopClassilyManageHeaderView.swift */; }; | |
| 51 | 55 | 192336EB2AD9224300D47CD4 /* CNUpSlideViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 192336EA2AD9224300D47CD4 /* CNUpSlideViewController.swift */; }; |
| 52 | 56 | 1926C28F2AE0D76C00C71DC3 /* CNLiveDownSlideViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1926C28E2AE0D76C00C71DC3 /* CNLiveDownSlideViewModel.swift */; }; |
| 53 | 57 | 1926C2912AE0FD4500C71DC3 /* CNLiveDownSlideModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1926C2902AE0FD4500C71DC3 /* CNLiveDownSlideModel.swift */; }; |
| ... | ... | @@ -259,6 +263,10 @@ |
| 259 | 263 | 1917332C2B15DB20007BCC04 /* CNLivePlayerKVOModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLivePlayerKVOModel.swift; sourceTree = "<group>"; }; |
| 260 | 264 | 1917332E2B16C7C9007BCC04 /* CNLiveTimer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveTimer.swift; sourceTree = "<group>"; }; |
| 261 | 265 | 191733302B170537007BCC04 /* CNLiveCommonManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveCommonManager.swift; sourceTree = "<group>"; }; |
| 266 | + 191733352B27EFD3007BCC04 /* CNLiveShopClassilyManageViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopClassilyManageViewController.swift; sourceTree = "<group>"; }; | |
| 267 | + 191733372B27FD66007BCC04 /* CNLiveShopClassifySectionHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopClassifySectionHeaderView.swift; sourceTree = "<group>"; }; | |
| 268 | + 191733392B27FDF3007BCC04 /* CNLiveShopClassilyManageTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopClassilyManageTableViewCell.swift; sourceTree = "<group>"; }; | |
| 269 | + 1917333B2B27FE75007BCC04 /* CNLiveShopClassilyManageHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopClassilyManageHeaderView.swift; sourceTree = "<group>"; }; | |
| 262 | 270 | 192336EA2AD9224300D47CD4 /* CNUpSlideViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNUpSlideViewController.swift; sourceTree = "<group>"; }; |
| 263 | 271 | 1926C28E2AE0D76C00C71DC3 /* CNLiveDownSlideViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveDownSlideViewModel.swift; sourceTree = "<group>"; }; |
| 264 | 272 | 1926C2902AE0FD4500C71DC3 /* CNLiveDownSlideModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveDownSlideModel.swift; sourceTree = "<group>"; }; |
| ... | ... | @@ -507,6 +515,7 @@ |
| 507 | 515 | 191732E42B05FFE8007BCC04 /* CNLiveModalPresentationViewController.swift */, |
| 508 | 516 | 1965FA412AFB79EA00F0F435 /* CNLiveGoodsCategoryController.swift */, |
| 509 | 517 | 191732EE2B075C3A007BCC04 /* CNLiveCreateShopClassifyViewController.swift */, |
| 518 | + 191733352B27EFD3007BCC04 /* CNLiveShopClassilyManageViewController.swift */, | |
| 510 | 519 | ); |
| 511 | 520 | path = GoodsManager; |
| 512 | 521 | sourceTree = "<group>"; |
| ... | ... | @@ -527,6 +536,9 @@ |
| 527 | 536 | 191732F02B084822007BCC04 /* CNLiveShopClassifyInputTableViewCell.swift */, |
| 528 | 537 | 191732F22B084DBC007BCC04 /* CNLiveShopClassifySwitchTableViewCell.swift */, |
| 529 | 538 | 191732F42B085BAE007BCC04 /* CNLiveShopClassilyIconTableViewCell.swift */, |
| 539 | + 191733372B27FD66007BCC04 /* CNLiveShopClassifySectionHeaderView.swift */, | |
| 540 | + 191733392B27FDF3007BCC04 /* CNLiveShopClassilyManageTableViewCell.swift */, | |
| 541 | + 1917333B2B27FE75007BCC04 /* CNLiveShopClassilyManageHeaderView.swift */, | |
| 530 | 542 | ); |
| 531 | 543 | path = GoodsManager; |
| 532 | 544 | sourceTree = "<group>"; |
| ... | ... | @@ -1336,6 +1348,7 @@ |
| 1336 | 1348 | 79282A3C2A2EDC2500B5F8CF /* NSString+CNLiveExtensions.swift in Sources */, |
| 1337 | 1349 | 19D2CE632AE8B65D00691757 /* CNLiveDownSlideTool.swift in Sources */, |
| 1338 | 1350 | 790B1FB82A41B6A60074CF00 /* CNLiveMineMessageViewController.swift in Sources */, |
| 1351 | + 1917333C2B27FE75007BCC04 /* CNLiveShopClassilyManageHeaderView.swift in Sources */, | |
| 1339 | 1352 | 191733252B146078007BCC04 /* CNLivePlayerSlider.swift in Sources */, |
| 1340 | 1353 | 19BB202B2AF382150094D962 /* CNLiveAdaptTool.swift in Sources */, |
| 1341 | 1354 | 79E672032AFDFA9C00F2F768 /* CNLiveMineSignOutViewController.swift in Sources */, |
| ... | ... | @@ -1421,6 +1434,7 @@ |
| 1421 | 1434 | 79F4B11A2A32F21400993C03 /* CNLiveMineNickViewController.swift in Sources */, |
| 1422 | 1435 | 191733112B109EDC007BCC04 /* CNLivePlayerControlView.swift in Sources */, |
| 1423 | 1436 | 1917331F2B10A1BE007BCC04 /* CNLivePlayerEnum.swift in Sources */, |
| 1437 | + 191733382B27FD66007BCC04 /* CNLiveShopClassifySectionHeaderView.swift in Sources */, | |
| 1424 | 1438 | 798A44FF2A30A0A800815935 /* CNLiveInputFeedBackViewController.swift in Sources */, |
| 1425 | 1439 | 79282A442A2F1C1E00B5F8CF /* CNLiveLoginAuthView.swift in Sources */, |
| 1426 | 1440 | 79BB96A62AF21E2800AEA4AC /* CNLiveShopOrderDetailViewController.swift in Sources */, |
| ... | ... | @@ -1433,6 +1447,7 @@ |
| 1433 | 1447 | 7C2703332A36CC660061EC50 /* CNLiveGlobalBlock.swift in Sources */, |
| 1434 | 1448 | 7987BF3D2A497644000A1ABC /* CNLiveMineQuestViewController.swift in Sources */, |
| 1435 | 1449 | 798A44EA2A30135D00815935 /* CNLiveMineBodyListView.swift in Sources */, |
| 1450 | + 191733362B27EFD4007BCC04 /* CNLiveShopClassilyManageViewController.swift in Sources */, | |
| 1436 | 1451 | 799172322AF08D1B00DC01A8 /* CNLiveShopOrderViewController.swift in Sources */, |
| 1437 | 1452 | 1917332D2B15DB20007BCC04 /* CNLivePlayerKVOModel.swift in Sources */, |
| 1438 | 1453 | 798A44F92A30835400815935 /* CNLiveHelpFeedBackViewController.swift in Sources */, |
| ... | ... | @@ -1490,6 +1505,7 @@ |
| 1490 | 1505 | 79282A462A2F457D00B5F8CF /* CNLiveMineViewController.swift in Sources */, |
| 1491 | 1506 | 7991723A2AF091E100DC01A8 /* CNLiveShopOrderListViewController.swift in Sources */, |
| 1492 | 1507 | 798A44F02A305BC200815935 /* UIButton+CNLiveExtensions.swift in Sources */, |
| 1508 | + 1917333A2B27FDF3007BCC04 /* CNLiveShopClassilyManageTableViewCell.swift in Sources */, | |
| 1493 | 1509 | ); |
| 1494 | 1510 | runOnlyForDeploymentPostprocessing = 0; |
| 1495 | 1511 | }; | ... | ... |
metaCode/Classes/Common/Base/CNLiveBaseNavigationController.swift
| ... | ... | @@ -7,7 +7,7 @@ |
| 7 | 7 | |
| 8 | 8 | import Foundation |
| 9 | 9 | |
| 10 | -class CNLiveBaseNavigationController : UINavigationController, UIGestureRecognizerDelegate { | |
| 10 | +class CNLiveBaseNavigationController : UINavigationController, UIGestureRecognizerDelegate,UINavigationControllerDelegate { | |
| 11 | 11 | |
| 12 | 12 | override func viewDidLoad() { |
| 13 | 13 | super.viewDidLoad() |
| ... | ... | @@ -20,15 +20,31 @@ class CNLiveBaseNavigationController : UINavigationController, UIGestureRecogniz |
| 20 | 20 | view.addGestureRecognizer(panges) |
| 21 | 21 | |
| 22 | 22 | self.interactivePopGestureRecognizer?.delegate = self //侧滑返回 |
| 23 | + self.delegate = self as UINavigationControllerDelegate | |
| 23 | 24 | } |
| 24 | 25 | |
| 25 | 26 | // MARK: - <UIGestureRecognizerDelegate> |
| 26 | 27 | // 什么时候调用:每次触发手势之前都会询问下代理,是否触发。 |
| 27 | 28 | // 作用:拦截手势触发,手势识别器对象会调用这个代理方法来决定手势是否有效 |
| 28 | 29 | func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool { |
| 30 | +// if (gestureRecognizer == self.navigationController?.interactivePopGestureRecognizer) && (self.navigationController?.visibleViewController == self.navigationController?.viewControllers.first) { | |
| 31 | +// return false | |
| 32 | +// } | |
| 33 | +// return true | |
| 29 | 34 | return viewControllers.count > 1 |
| 30 | 35 | } |
| 31 | 36 | |
| 37 | + func navigationController(_ navigationController: UINavigationController, willShow viewController: UIViewController, animated: Bool) { | |
| 38 | + | |
| 39 | + } | |
| 40 | + func navigationController(_ navigationController: UINavigationController, didShow viewController: UIViewController, animated: Bool) { | |
| 41 | + | |
| 42 | + if navigationController.viewControllers.count > 1 { | |
| 43 | + self.interactivePopGestureRecognizer?.isEnabled = true | |
| 44 | + }else { | |
| 45 | + self.interactivePopGestureRecognizer?.isEnabled = false | |
| 46 | + } | |
| 47 | + } | |
| 32 | 48 | |
| 33 | 49 | /// 重写push方法的目的 : 拦截所有push进来的子控制器 |
| 34 | 50 | override func pushViewController(_ viewController: UIViewController, animated: Bool) { | ... | ... |
metaCode/Classes/Extensions/NSObject+CNLiveExtensions.swift
| ... | ... | @@ -9,6 +9,16 @@ import Foundation |
| 9 | 9 | import MBProgressHUD |
| 10 | 10 | import HandyJSON |
| 11 | 11 | |
| 12 | +//func currentIfChildViewController() -> (UIViewController?){ | |
| 13 | +// let vc = currentViewController() | |
| 14 | +// if vc != nil && vc?.children.count ?? 0 > 0{ | |
| 15 | +// //有children , 用last | |
| 16 | +// return vc?.children.last | |
| 17 | +// }else{ | |
| 18 | +// return vc | |
| 19 | +// } | |
| 20 | +//} | |
| 21 | + | |
| 12 | 22 | func currentViewController() -> (UIViewController?) { |
| 13 | 23 | var window = UIApplication.shared.keyWindow |
| 14 | 24 | if window?.windowLevel != UIWindow.Level.normal{ | ... | ... |
metaCode/Classes/Main/HomePage/Controller/CNLiveDownShopDetailController.swift
| ... | ... | @@ -78,7 +78,7 @@ class CNLiveDownShopDetailController:CNLiveBaseViewController, UICollectionViewD |
| 78 | 78 | make.top.equalToSuperview().offset(KNavigationHeight) |
| 79 | 79 | make.left.bottom.right.equalToSuperview() |
| 80 | 80 | } |
| 81 | - self.view.addSubview(closeBtn) | |
| 81 | + self.view.addSubview(self.closeBtn) | |
| 82 | 82 | // self.view.addSubview(navView) |
| 83 | 83 | |
| 84 | 84 | } | ... | ... |
metaCode/Classes/Main/HomePage/Controller/CNLiveShopConsoleController.swift
| ... | ... | @@ -87,11 +87,11 @@ class CNLiveShopConsoleController: CNLiveBaseViewController, UICollectionViewDel |
| 87 | 87 | let itemModel = listMdl.list[indexPath.item] |
| 88 | 88 | if itemModel.type == CNLiveShopConsoleType.XZSP.rawValue{ |
| 89 | 89 | //商城新增商品 |
| 90 | - currentViewController()?.navigationController?.pushViewController(CNLiveShopNewProductController.init(), animated: true) | |
| 90 | + currentViewController()?.navigationController?.pushViewController(CNLiveShopNewProductController.init(), animated: false) | |
| 91 | 91 | |
| 92 | 92 | }else if itemModel.type == CNLiveShopConsoleType.SPGL.rawValue{ |
| 93 | 93 | //商城商品管理 |
| 94 | - currentViewController()?.navigationController?.pushViewController(CNLiveShopProductManagerController.init(), animated: true) | |
| 94 | + currentViewController()?.navigationController?.pushViewController(CNLiveShopProductManagerController.init(), animated: false) | |
| 95 | 95 | }else if itemModel.type == CNLiveShopConsoleType.XZYHQ.rawValue{ |
| 96 | 96 | //新增优惠券 |
| 97 | 97 | |
| ... | ... | @@ -102,13 +102,10 @@ 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 | - } | |
| 108 | - currentViewController()?.navigationController?.pushViewController(vc, animated: true) | |
| 105 | + currentViewController()?.navigationController?.pushViewController(vc, animated: false) | |
| 109 | 106 | }else if itemModel.type == CNLiveShopConsoleType.ShopClassifyManager.rawValue{ |
| 110 | 107 | //店铺分类管理 |
| 111 | - | |
| 108 | + currentViewController()?.navigationController?.pushViewController(CNLiveShopClassilyManageViewController.init(), animated: false) | |
| 112 | 109 | }else if itemModel.type == CNLiveShopConsoleType.FBDT.rawValue{ |
| 113 | 110 | //发布动态 |
| 114 | 111 | |
| ... | ... | @@ -117,7 +114,7 @@ class CNLiveShopConsoleController: CNLiveBaseViewController, UICollectionViewDel |
| 117 | 114 | |
| 118 | 115 | }else if itemModel.type == CNLiveShopConsoleType.DDGL.rawValue{ |
| 119 | 116 | //订单管理 |
| 120 | - currentViewController()?.navigationController?.pushViewController(CNLiveShopOrderViewController.init(), animated: true) | |
| 117 | + currentViewController()?.navigationController?.pushViewController(CNLiveShopOrderViewController.init(), animated: false) | |
| 121 | 118 | } |
| 122 | 119 | // else if itemModel.type == CNLiveShopConsoleType.SH.rawValue{ |
| 123 | 120 | // //退款/售后 |
| ... | ... | @@ -130,7 +127,7 @@ class CNLiveShopConsoleController: CNLiveBaseViewController, UICollectionViewDel |
| 130 | 127 | //直播管理 |
| 131 | 128 | let webVC = CNWebViewController() |
| 132 | 129 | webVC.url = URL(string: "http://wjjh5.cnlive.com/apkdownloadShop.php") |
| 133 | - currentViewController()?.navigationController?.pushViewController(webVC, animated: true) | |
| 130 | + currentViewController()?.navigationController?.pushViewController(webVC, animated: false) | |
| 134 | 131 | } |
| 135 | 132 | } |
| 136 | 133 | ... | ... |
metaCode/Classes/Main/HomePage/Controller/CNMetaCodeHomePageController.swift
| ... | ... | @@ -572,7 +572,7 @@ class CNMetaCodeHomePageController:CNLiveBaseViewController, NewPagedFlowViewDel |
| 572 | 572 | if(navigationAction.navigationType == .linkActivated){ |
| 573 | 573 | let webVC = CNWebViewController() |
| 574 | 574 | webVC.url = URL(string: url) |
| 575 | - currentViewController()?.navigationController?.pushViewController(webVC, animated: true) | |
| 575 | + currentViewController()?.navigationController?.pushViewController(webVC, animated: false) | |
| 576 | 576 | decisionHandler(.cancel, preferences) |
| 577 | 577 | return |
| 578 | 578 | }else if(navigationAction.navigationType == .other){ | ... | ... |
metaCode/Classes/Main/HomePage/Controller/GoodsManager/CNLiveGoodsCategoryController.swift
| ... | ... | @@ -486,10 +486,7 @@ class CNLiveGoodsCategoryController: CNLiveBaseViewController, UITableViewDataSo |
| 486 | 486 | if self.navigationController == nil{ |
| 487 | 487 | print("self nil") |
| 488 | 488 | } |
| 489 | - if currentViewController()?.navigationController == nil{ | |
| 490 | - print("curr nil") | |
| 491 | - } | |
| 492 | - currentViewController()?.navigationController?.pushViewController(vc, animated: true) | |
| 489 | + currentViewController()?.navigationController?.pushViewController(vc, animated: false) | |
| 493 | 490 | } |
| 494 | 491 | |
| 495 | 492 | // MARK: - 数据请求 | ... | ... |
metaCode/Classes/Main/HomePage/Controller/GoodsManager/CNLiveShopClassilyManageViewController.swift
0 → 100644
| 1 | +// | |
| 2 | +// CNLiveShopClassilyManageViewController.swift | |
| 3 | +// metaCode | |
| 4 | +// | |
| 5 | +// Created by zx on 2023/12/12. | |
| 6 | +// | |
| 7 | + | |
| 8 | +import Foundation | |
| 9 | + | |
| 10 | +///区头id | |
| 11 | +let kCNLiveShopClassifySectionHeaderViewID = "kCNLiveShopClassifySectionHeaderViewID" | |
| 12 | +///cell ID | |
| 13 | +let kCNLiveShopClassilyManageTableViewCellID = "kCNLiveShopClassilyManageTableViewCellID" | |
| 14 | + | |
| 15 | +class CNLiveShopClassilyManageViewController:CNLiveBaseViewController, UITableViewDataSource, UITableViewDelegate{ | |
| 16 | + | |
| 17 | + // MARK: - lazy | |
| 18 | + lazy var tableView : UITableView = { | |
| 19 | + let tableView = UITableView(frame: CGRect(x: 0, y: KNavigationHeight, width: KSreenWidth, height: KSreenHeight-KNavigationHeight-KTabBarHeight), style: .plain) | |
| 20 | + tableView.backgroundColor = HexColor("#F6F6F6") | |
| 21 | + tableView.dataSource = self | |
| 22 | + tableView.delegate = self | |
| 23 | + tableView.tableFooterView = UIView() | |
| 24 | + tableView.separatorStyle = .none | |
| 25 | + tableView.tableFooterView = UIView.init() | |
| 26 | + tableView.tableHeaderView = self.headerView | |
| 27 | + tableView.register(CNLiveShopClassifySectionHeaderView.self, forHeaderFooterViewReuseIdentifier: kCNLiveShopClassifySectionHeaderViewID) | |
| 28 | + | |
| 29 | + tableView.register(CNLiveShopClassilyManageTableViewCell.self, forCellReuseIdentifier:kCNLiveShopClassilyManageTableViewCellID ) | |
| 30 | + return tableView | |
| 31 | + }() | |
| 32 | + | |
| 33 | + ///表头 | |
| 34 | + lazy var headerView :CNLiveShopClassilyManageHeaderView = { | |
| 35 | + let headerView = CNLiveShopClassilyManageHeaderView(frame: CGRect(x: 0, y: 0, width: KSreenWidth, height: 114)) | |
| 36 | + return headerView | |
| 37 | + }() | |
| 38 | + | |
| 39 | + lazy var bottomNavView :UIView = { | |
| 40 | + let bottomNavView = UIView(frame: CGRect(x: 0, y: KSreenHeight-KTabBarHeight, width: KSreenWidth, height: KTabBarHeight)) | |
| 41 | + bottomNavView.backgroundColor = .white | |
| 42 | + return bottomNavView | |
| 43 | + }() | |
| 44 | + | |
| 45 | + | |
| 46 | + ///分类列表详情数据 | |
| 47 | + var classifyListModel:CNLiveShopClassifyListModel? | |
| 48 | + | |
| 49 | + ///一级分类数据源,一级分类里面包含了二级分类 | |
| 50 | + var listArray:[CNLiveShopClassifyModel]? | |
| 51 | + | |
| 52 | + override func viewDidLoad() { | |
| 53 | + super.viewDidLoad() | |
| 54 | + self.initUI() | |
| 55 | + self.loadData() | |
| 56 | + } | |
| 57 | + // MARK: - 初始化UI | |
| 58 | + func initUI(){ | |
| 59 | + self.view.addSubview(self.tableView) | |
| 60 | + self.initTopNav() | |
| 61 | + self.initBottomNav() | |
| 62 | + } | |
| 63 | + func initTopNav(){ | |
| 64 | + navigationBarHidden = false | |
| 65 | + titleName = "店铺分类管理" | |
| 66 | + } | |
| 67 | + func initBottomNav(){ | |
| 68 | + self.view.addSubview(self.bottomNavView) | |
| 69 | + | |
| 70 | + let createBtn = UIButton(type: .custom) | |
| 71 | + createBtn.frame = CGRect(x: 0, y: 0, width: KSreenWidth, height: KTabBar_UIHeight) | |
| 72 | + createBtn.setTitle("创建店铺分类", for: .normal) | |
| 73 | + createBtn.setImage(UIImage(named: "DS_WB_CJDP"), for: .normal) | |
| 74 | + createBtn.imageEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 8) | |
| 75 | + createBtn.setTitleColor(HexColor("#FD862E"), for: .normal) | |
| 76 | + createBtn.titleLabel?.font = Font_15 | |
| 77 | + createBtn.addTarget(self, action: #selector(createBtnClick), for: .touchUpInside) | |
| 78 | + self.bottomNavView.addSubview(createBtn) | |
| 79 | + | |
| 80 | + } | |
| 81 | + // MARK: - load data | |
| 82 | + func loadData(){ | |
| 83 | + showLoading(message: "") | |
| 84 | + CNLiveShopClassilyViewModel.getCateListWithShopId(shopId: DSUserInfoManager.shared.dsUserInfo.id!) { result, status in | |
| 85 | + hiddenLoading() | |
| 86 | + if status == .success{ | |
| 87 | + let model = result as! CNLiveShopClassifyListModel | |
| 88 | + self.listArray = Array(model.list) | |
| 89 | + self.headerView.classifyModel = model | |
| 90 | + self.tableView.reloadData() | |
| 91 | + }else{ | |
| 92 | + showMessage(message: "获取分类失败") | |
| 93 | + } | |
| 94 | + } | |
| 95 | + } | |
| 96 | + | |
| 97 | + // MARK: - UITableViewDelegate,UITableViewDataSource | |
| 98 | + func numberOfSections(in tableView: UITableView) -> Int { | |
| 99 | + return self.listArray?.count ?? 0 | |
| 100 | + } | |
| 101 | + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { | |
| 102 | + if self.listArray != nil{ | |
| 103 | + let model = self.listArray![section] | |
| 104 | + if model.showChild{ | |
| 105 | + return model.child.count | |
| 106 | + } | |
| 107 | + } | |
| 108 | + return 0 | |
| 109 | + } | |
| 110 | + | |
| 111 | + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { | |
| 112 | + guard let cell = tableView.dequeueReusableCell(withIdentifier: kCNLiveShopClassilyManageTableViewCellID, for: indexPath) as? CNLiveShopClassilyManageTableViewCell | |
| 113 | + else { | |
| 114 | + let cell = CNLiveShopClassilyManageTableViewCell() | |
| 115 | + return cell | |
| 116 | + } | |
| 117 | + let model = self.listArray![indexPath.section] | |
| 118 | + cell.classifyModel = model.child[indexPath.row] | |
| 119 | + cell.editBtnBlock = { [weak self] classifyModel in | |
| 120 | + self!.editBtnActionWithMModel(classifyModel: classifyModel, type: .twoLevelClassify) | |
| 121 | + } | |
| 122 | + return cell | |
| 123 | + } | |
| 124 | + func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { | |
| 125 | + let sectionHeaderView = tableView.dequeueReusableHeaderFooterView(withIdentifier: kCNLiveShopClassifySectionHeaderViewID) as! CNLiveShopClassifySectionHeaderView | |
| 126 | + sectionHeaderView.classifyModel = self.listArray![section] | |
| 127 | + sectionHeaderView.section = section | |
| 128 | + sectionHeaderView.showChildCalssifyBlock = { [weak self] section,classifyModel in | |
| 129 | + self?.showChildCalssifyAction(section: section, classifyModel: classifyModel) | |
| 130 | + } | |
| 131 | + sectionHeaderView.addSubClassifyBtnBlock = { [weak self] classifyModel in | |
| 132 | + self?.addSubClassifyBtnActionWithModel(classifyModel: classifyModel) | |
| 133 | + } | |
| 134 | + sectionHeaderView.editBtnBlock = { [weak self] classifyModel in | |
| 135 | + self?.editBtnActionWithMModel(classifyModel: classifyModel, type: .oneLevelClassify) | |
| 136 | + } | |
| 137 | + return sectionHeaderView | |
| 138 | + } | |
| 139 | + func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { | |
| 140 | + return 50 | |
| 141 | + } | |
| 142 | + func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { | |
| 143 | + return 50 | |
| 144 | + } | |
| 145 | + // MARK: - response method | |
| 146 | + @objc func createBtnClick(){ | |
| 147 | + let vc = CNLiveCreateShopClassifyViewController() | |
| 148 | + vc.classifyType = .oneLevelClassify | |
| 149 | + vc.successCompleteBlock = {[weak self] in | |
| 150 | + self!.loadData() | |
| 151 | + } | |
| 152 | + currentViewController()?.navigationController?.pushViewController(vc, animated: false) | |
| 153 | + } | |
| 154 | + ///显示/隐藏子分类 | |
| 155 | + func showChildCalssifyAction(section:Int,classifyModel:CNLiveShopClassifyModel){ | |
| 156 | + if classifyModel.child.count == 0{ | |
| 157 | + showMessage(message: "当前分类没有子分类") | |
| 158 | + return | |
| 159 | + } | |
| 160 | + classifyModel.showChild = !classifyModel.showChild | |
| 161 | + self.tableView.reloadSections([section], with: .fade) | |
| 162 | + } | |
| 163 | + ///添加子分类 | |
| 164 | + func addSubClassifyBtnActionWithModel(classifyModel:CNLiveShopClassifyModel){ | |
| 165 | + let vc = CNLiveCreateShopClassifyViewController() | |
| 166 | + vc.classifyType = .twoLevelClassify | |
| 167 | + vc.superClassifyId = classifyModel.id! | |
| 168 | + vc.successCompleteBlock = {[weak self] in | |
| 169 | + self!.loadData() | |
| 170 | + } | |
| 171 | + currentViewController()?.navigationController?.pushViewController(vc, animated: false) | |
| 172 | + } | |
| 173 | + func editBtnActionWithMModel(classifyModel:CNLiveShopClassifyModel,type:CNLiveCreateType){ | |
| 174 | + let data = modelToDictionary(classifyModel) | |
| 175 | + ///重新拷贝一个对象 | |
| 176 | + var copyClassifyModel = newDictionaryToModel(data, CNLiveShopClassifyModel.self) as! CNLiveShopClassifyModel | |
| 177 | + let vc = CNLiveCreateShopClassifyViewController(model: copyClassifyModel, isEdite: true) | |
| 178 | + vc.classifyType = type | |
| 179 | + vc.successCompleteBlock = {[weak self] in | |
| 180 | + self!.loadData() | |
| 181 | + } | |
| 182 | + currentViewController()?.navigationController?.pushViewController(vc, animated: true) | |
| 183 | + } | |
| 184 | +} | ... | ... |
metaCode/Classes/Main/HomePage/Controller/GoodsManager/CNLiveShopProductManagerController.swift
| ... | ... | @@ -293,7 +293,7 @@ class CNLiveShopProductManagerController:CNLiveBaseViewController, UITableViewDa |
| 293 | 293 | // MARK: - BtnAction |
| 294 | 294 | @objc func addBtnAction(){ |
| 295 | 295 | |
| 296 | - currentViewController()?.navigationController?.pushViewController(CNLiveShopNewProductController(), animated: true) | |
| 296 | + currentViewController()?.navigationController?.pushViewController(CNLiveShopNewProductController(), animated: false) | |
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | // MARK: - 商品编辑通知 | ... | ... |
metaCode/Classes/Main/HomePage/View/CNLiveShopDetailBtnsCell.swift
| ... | ... | @@ -73,17 +73,11 @@ class CNLiveShopDetailBtnsCell: UICollectionViewCell { |
| 73 | 73 | let tag = sender.tag |
| 74 | 74 | ///push VC |
| 75 | 75 | if tag == 100 { |
| 76 | - //商品管理 | |
| 77 | - if currentViewController()?.navigationController == nil{ | |
| 78 | - print("nil") | |
| 79 | - } | |
| 80 | - currentViewController()?.navigationController?.pushViewController(CNLiveShopProductManagerController.init(), animated: true) | |
| 76 | + //商品管理 | |
| 77 | + currentViewController()?.navigationController?.pushViewController(CNLiveShopProductManagerController.init(), animated: false) | |
| 81 | 78 | }else if tag == 101 { |
| 82 | 79 | //订单管理 |
| 83 | - if currentViewController()?.navigationController == nil{ | |
| 84 | - print("nil") | |
| 85 | - } | |
| 86 | - currentViewController()?.navigationController?.pushViewController(CNLiveShopOrderViewController.init(), animated: true) | |
| 80 | + currentViewController()?.navigationController?.pushViewController(CNLiveShopOrderViewController.init(), animated: false) | |
| 87 | 81 | } |
| 88 | 82 | // if tag == 100 { |
| 89 | 83 | // //发布动态 |
| ... | ... | @@ -91,7 +85,7 @@ class CNLiveShopDetailBtnsCell: UICollectionViewCell { |
| 91 | 85 | // //商品管理 |
| 92 | 86 | // let webVC = CNWebViewController() |
| 93 | 87 | // webVC.url = URL(string:"https://www.baidu.com") |
| 94 | -// currentViewController()?.navigationController?.pushViewController(webVC, animated: true) | |
| 88 | +// currentViewController()?.navigationController?.pushViewController(webVC, animated: false) | |
| 95 | 89 | // |
| 96 | 90 | // }else if tag == 102 { |
| 97 | 91 | // //订单管理 | ... | ... |
metaCode/Classes/Main/HomePage/View/CNLiveShopDetailOrderAssetCell.swift
| ... | ... | @@ -125,10 +125,7 @@ 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 | - } | |
| 131 | - currentViewController()?.navigationController?.pushViewController(CNLiveShopOrderViewController.init(), animated: true) | |
| 128 | + currentViewController()?.navigationController?.pushViewController(CNLiveShopOrderViewController.init(), animated: false) | |
| 132 | 129 | }else if self.displayType == .CNLiveShopDetailDisplayTypeAsset{ |
| 133 | 130 | //push余额VC |
| 134 | 131 | } | ... | ... |
metaCode/Classes/Main/HomePage/View/CNLliveShopDetailBannerCell.swift
| ... | ... | @@ -99,9 +99,6 @@ 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 | - } | |
| 105 | - currentViewController()?.navigationController?.pushViewController(webVC, animated: true) | |
| 102 | + currentViewController()?.navigationController?.pushViewController(webVC, animated: false) | |
| 106 | 103 | } |
| 107 | 104 | } | ... | ... |
metaCode/Classes/Main/HomePage/View/CNMainView.swift
| ... | ... | @@ -197,24 +197,18 @@ class CNFrontMainView : UIView{ |
| 197 | 197 | |
| 198 | 198 | @objc func addStandBtnAction() { |
| 199 | 199 | //跳转到添加身份页面 |
| 200 | -// currentViewController()?.navigationController?.pushViewController(CNLiveMineInputViewController.init(listModel: _idModel!), animated: true) | |
| 200 | +// currentViewController()?.navigationController?.pushViewController(CNLiveMineInputViewController.init(listModel: _idModel!), animated: false) | |
| 201 | 201 | // DispatchQueue.main.asyncAfter(deadline: .now()+0.25){ |
| 202 | 202 | if _idModel!.id == 9 { |
| 203 | 203 | showLoading(message: "") |
| 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 | - } | |
| 210 | - currentViewController()?.navigationController?.pushViewController(CNLiveMineShopViewController.init(showType: .one, listModel: (self?.idModel)!, tempArray: []), animated: true) | |
| 207 | + currentViewController()?.navigationController?.pushViewController(CNLiveMineShopViewController.init(showType: .one, listModel: (self?.idModel)!, tempArray: []), animated: false) | |
| 211 | 208 | } |
| 212 | 209 | } |
| 213 | 210 | }else{ |
| 214 | - if currentViewController()?.navigationController == nil{ | |
| 215 | - print("nil") | |
| 216 | - } | |
| 217 | - currentViewController()?.navigationController?.pushViewController(CNLiveMineInputViewController.init(listModel: self._idModel!), animated: true) | |
| 211 | + currentViewController()?.navigationController?.pushViewController(CNLiveMineInputViewController.init(listModel: self._idModel!), animated: false) | |
| 218 | 212 | } |
| 219 | 213 | |
| 220 | 214 | // } | ... | ... |
metaCode/Classes/Main/HomePage/View/GoodsManager/CNLiveShopClassifySectionHeaderView.swift
0 → 100644
| 1 | +// | |
| 2 | +// CNLiveShopClassifySectionHeaderView.swift | |
| 3 | +// metaCode | |
| 4 | +// | |
| 5 | +// Created by zx on 2023/12/12. | |
| 6 | +// | |
| 7 | + | |
| 8 | +import Foundation | |
| 9 | + | |
| 10 | + | |
| 11 | +typealias showChildCalssifyActionBlock = (_ section:Int ,_ classifyModel:CNLiveShopClassifyModel)->Void | |
| 12 | +typealias addSubClassifyBtnActionBlock = (_ classifyModel:CNLiveShopClassifyModel)->Void | |
| 13 | +typealias editBtnActionBlock = (_ classifyModel:CNLiveShopClassifyModel)->Void | |
| 14 | + | |
| 15 | +class CNLiveShopClassifySectionHeaderView:UITableViewHeaderFooterView{ | |
| 16 | + ///当前分区 | |
| 17 | + var section:Int = 0 | |
| 18 | + | |
| 19 | + /// 分类model | |
| 20 | + var _classifyModel:CNLiveShopClassifyModel? | |
| 21 | + var classifyModel:CNLiveShopClassifyModel?{ | |
| 22 | + get{ | |
| 23 | + _classifyModel | |
| 24 | + } | |
| 25 | + set{ | |
| 26 | + _classifyModel = newValue | |
| 27 | + self.classifyNameBtn.isSelected = _classifyModel!.showChild | |
| 28 | + self.classifyNameBtn.setTitle(_classifyModel!.title, for: .normal) | |
| 29 | + self.sortLab.text = _classifyModel!.ord | |
| 30 | + if Int(_classifyModel!.state ?? "") == 2{ | |
| 31 | + self.showSwitch.isOn = true | |
| 32 | + }else{ | |
| 33 | + self.showSwitch.isOn = false | |
| 34 | + } | |
| 35 | + } | |
| 36 | + } | |
| 37 | + | |
| 38 | + ///点击显示/隐藏 子分类事件回调 | |
| 39 | + var showChildCalssifyBlock:showChildCalssifyActionBlock? | |
| 40 | + | |
| 41 | + ///点击添加子分类事件回调 | |
| 42 | + var addSubClassifyBtnBlock:addSubClassifyBtnActionBlock? | |
| 43 | + | |
| 44 | + ///点击编辑事件回调 | |
| 45 | + var editBtnBlock:editBtnActionBlock? | |
| 46 | + | |
| 47 | + ///分类名称 | |
| 48 | + lazy var classifyNameBtn: UIButton = { | |
| 49 | + let classifyNameBtn = UIButton(type: .custom) | |
| 50 | + classifyNameBtn.frame = CGRect(x: 0, y: 0, width: KSreenWidth*0.3, height: 50) | |
| 51 | + classifyNameBtn.setImage(UIImage(named: "DS_shopclassily_down"), for: .normal) | |
| 52 | + classifyNameBtn.setImage(UIImage(named: "DS_shopclassily_up"), for: .selected) | |
| 53 | + classifyNameBtn.setTitleColor(HexColor("#333333"), for: .normal) | |
| 54 | + classifyNameBtn.setTitle("分类", for: .normal) | |
| 55 | + classifyNameBtn.setupButtonImageAndTitlePossitionWith(padding: 5, style: .right) | |
| 56 | + classifyNameBtn.titleLabel?.font = Font_14 | |
| 57 | + classifyNameBtn.addTarget(self, action: #selector(showChildCalssifyAction), for: .touchUpInside) | |
| 58 | + return classifyNameBtn | |
| 59 | + }() | |
| 60 | + | |
| 61 | + ///排序名称 | |
| 62 | + lazy var sortLab: UILabel = { | |
| 63 | + let sortLab = UILabel.init(frame: CGRectMake(self.classifyNameBtn.right, 0, KSreenWidth*0.2, 50)) | |
| 64 | + sortLab.text = "排序" | |
| 65 | + sortLab.textColor = HexColor("#333333") | |
| 66 | + sortLab.textAlignment = .center | |
| 67 | + sortLab.font = Font_14 | |
| 68 | + sortLab.adjustsFontSizeToFitWidth=true | |
| 69 | + return sortLab | |
| 70 | + }() | |
| 71 | + | |
| 72 | + ///是否显示 | |
| 73 | + lazy var showSwitch :UISwitch = { | |
| 74 | + let showSwitch = UISwitch(frame: CGRect(x: self.sortLab.right+10, y: 10, width: KSreenWidth*0.2, height: 50)) | |
| 75 | + showSwitch.isEnabled = false | |
| 76 | + return showSwitch | |
| 77 | + }() | |
| 78 | + | |
| 79 | + ///添加子分类 | |
| 80 | + lazy var addSubClassifyBtn: UIButton = { | |
| 81 | + let addSubClassifyBtn = UIButton(type: .custom) | |
| 82 | + addSubClassifyBtn.frame = CGRect(x: self.showSwitch.right, y: 0, width: KSreenWidth*0.21, height: 50) | |
| 83 | + addSubClassifyBtn.setTitle("添加子类", for: .normal) | |
| 84 | + addSubClassifyBtn.setTitleColor(HexColor("#0091FF"), for: .normal) | |
| 85 | + addSubClassifyBtn.titleLabel?.font = Font_14 | |
| 86 | + addSubClassifyBtn.addTarget(self, action: #selector(addSubClassifyBtnAction), for: .touchUpInside) | |
| 87 | + return addSubClassifyBtn | |
| 88 | + }() | |
| 89 | + | |
| 90 | + ///编辑 | |
| 91 | + lazy var editBtn: UIButton = { | |
| 92 | + let editBtn = UIButton(type: .custom) | |
| 93 | + editBtn.frame = CGRect(x: self.addSubClassifyBtn.right, y: 0, width: KSreenWidth*0.09, height: 50) | |
| 94 | + editBtn.setTitle("编辑", for: .normal) | |
| 95 | + editBtn.setTitleColor(HexColor("#0091FF"), for: .normal) | |
| 96 | + editBtn.titleLabel?.font = Font_14 | |
| 97 | + editBtn.addTarget(self, action: #selector(editBtnAction), for: .touchUpInside) | |
| 98 | + return editBtn | |
| 99 | + }() | |
| 100 | + | |
| 101 | + /// 底部线 | |
| 102 | + lazy var bottomLine: UILabel = { | |
| 103 | + let bottomLine = UILabel.init(frame: CGRectMake(0, 49, KSreenWidth, 1)) | |
| 104 | + bottomLine.backgroundColor = HexColor("#E4E4E4") | |
| 105 | + return bottomLine | |
| 106 | + }() | |
| 107 | + | |
| 108 | + override init(reuseIdentifier: String?) { | |
| 109 | + super.init(reuseIdentifier: reuseIdentifier) | |
| 110 | + self.initUI() | |
| 111 | + } | |
| 112 | + | |
| 113 | + required init?(coder: NSCoder) { | |
| 114 | + fatalError("init(coder:) has not been implemented") | |
| 115 | + } | |
| 116 | + | |
| 117 | + // MARK: - 初始化UI | |
| 118 | + func initUI(){ | |
| 119 | + self.contentView.backgroundColor = .white | |
| 120 | + self.contentView.addSubview(self.classifyNameBtn) | |
| 121 | + self.contentView.addSubview(self.sortLab) | |
| 122 | + self.contentView.addSubview(self.showSwitch) | |
| 123 | + self.contentView.addSubview(self.addSubClassifyBtn) | |
| 124 | + self.contentView.addSubview(self.editBtn) | |
| 125 | + self.contentView.addSubview(self.bottomLine) | |
| 126 | + } | |
| 127 | + // MARK: - response method | |
| 128 | + ///显示子分类 | |
| 129 | + @objc func showChildCalssifyAction(){ | |
| 130 | + self.showChildCalssifyBlock!(self.section, self.classifyModel!) | |
| 131 | + } | |
| 132 | + ///添加子分类 | |
| 133 | + @objc func addSubClassifyBtnAction(){ | |
| 134 | + self.addSubClassifyBtnBlock!(self.classifyModel!) | |
| 135 | + } | |
| 136 | + | |
| 137 | + /// 编辑 | |
| 138 | + @objc func editBtnAction(){ | |
| 139 | + self.editBtnBlock!(self.classifyModel!) | |
| 140 | + } | |
| 141 | +} | ... | ... |
metaCode/Classes/Main/HomePage/View/GoodsManager/CNLiveShopClassilyManageHeaderView.swift
0 → 100644
| 1 | +// | |
| 2 | +// CNLiveShopClassilyManageHeaderView.swift | |
| 3 | +// metaCode | |
| 4 | +// | |
| 5 | +// Created by zx on 2023/12/12. | |
| 6 | +// | |
| 7 | + | |
| 8 | +import Foundation | |
| 9 | + | |
| 10 | +class CNLiveShopClassilyManageHeaderView:UIView{ | |
| 11 | + /// 分类model | |
| 12 | + var _classifyModel:CNLiveShopClassifyListModel? | |
| 13 | + var classifyModel:CNLiveShopClassifyListModel?{ | |
| 14 | + get{ | |
| 15 | + _classifyModel | |
| 16 | + } | |
| 17 | + set{ | |
| 18 | + _classifyModel = newValue | |
| 19 | + | |
| 20 | + let oneLevelNumberAtt = NSMutableAttributedString(string: "\(_classifyModel!.cate1 ?? "")\n一级分类") | |
| 21 | + oneLevelNumberAtt.addAttribute(.font, value: UIFont.systemFont(ofSize: 19), range: NSMakeRange(0, _classifyModel!.cate1!.count)) | |
| 22 | + oneLevelNumberAtt.addAttribute(.foregroundColor, value: HexColor("#333333")!, range: NSMakeRange(0, classifyModel!.cate1!.count)) | |
| 23 | + self.oneLevelClassifyLab.attributedText = oneLevelNumberAtt | |
| 24 | + | |
| 25 | + let twoLevelNumberAtt = NSMutableAttributedString(string: "\(_classifyModel!.cate2 ?? "")\n二级分类") | |
| 26 | + twoLevelNumberAtt.addAttribute(.font, value: UIFont.systemFont(ofSize: 19), range: NSMakeRange(0, _classifyModel!.cate2!.count)) | |
| 27 | + twoLevelNumberAtt.addAttribute(.foregroundColor, value: HexColor("#333333")!, range: NSMakeRange(0, classifyModel!.cate2!.count)) | |
| 28 | + self.twoLevelClassifyLab.attributedText = twoLevelNumberAtt | |
| 29 | + | |
| 30 | + let goodsNumberAtt = NSMutableAttributedString(string: "\(_classifyModel!.goods ?? "")\n商品数量") | |
| 31 | + goodsNumberAtt.addAttribute(.font, value: UIFont.systemFont(ofSize: 19), range: NSMakeRange(0, _classifyModel!.goods!.count)) | |
| 32 | + goodsNumberAtt.addAttribute(.foregroundColor, value: HexColor("#333333")!, range: NSMakeRange(0, classifyModel!.goods!.count)) | |
| 33 | + self.goodsNumberLab.attributedText = goodsNumberAtt | |
| 34 | + } | |
| 35 | + } | |
| 36 | + // MARK: - Lazy | |
| 37 | + lazy var contentView :UIView = { | |
| 38 | + let contentView = UIView(frame: CGRect(x: 0, y: 0, width: KSreenWidth, height: 74)) | |
| 39 | + contentView.backgroundColor = .white | |
| 40 | + return contentView | |
| 41 | + }() | |
| 42 | + | |
| 43 | + ///一级分类 | |
| 44 | + lazy var oneLevelClassifyLab: UILabel = { | |
| 45 | + let oneLevelClassifyLab = UILabel.init(frame: CGRectMake(0, 0, KSreenWidth/3, self.contentView.height)) | |
| 46 | + oneLevelClassifyLab.numberOfLines = 0 | |
| 47 | + oneLevelClassifyLab.textColor = HexColor("#999999") | |
| 48 | + oneLevelClassifyLab.textAlignment = .center | |
| 49 | + oneLevelClassifyLab.font = Font_10 | |
| 50 | + oneLevelClassifyLab.text = "0\n一级分类" | |
| 51 | + return oneLevelClassifyLab | |
| 52 | + }() | |
| 53 | + | |
| 54 | + ///分割线1 | |
| 55 | + lazy var line1: UILabel = { | |
| 56 | + let line1 = UILabel.init(frame: CGRectMake(self.oneLevelClassifyLab.right, 24, 1, 25)) | |
| 57 | + line1.backgroundColor = HexColor("#E6E6E6") | |
| 58 | + return line1 | |
| 59 | + }() | |
| 60 | + | |
| 61 | + ///二级分类 | |
| 62 | + lazy var twoLevelClassifyLab: UILabel = { | |
| 63 | + let twoLevelClassifyLab = UILabel.init(frame: CGRectMake(self.oneLevelClassifyLab.right, 0, KSreenWidth/3, self.contentView.height)) | |
| 64 | + twoLevelClassifyLab.numberOfLines = 0 | |
| 65 | + twoLevelClassifyLab.textColor = HexColor("#999999") | |
| 66 | + twoLevelClassifyLab.textAlignment = .center | |
| 67 | + twoLevelClassifyLab.font = Font_10 | |
| 68 | + twoLevelClassifyLab.text = "0\n二级分类" | |
| 69 | + return twoLevelClassifyLab | |
| 70 | + }() | |
| 71 | + | |
| 72 | + ///分割线2 | |
| 73 | + lazy var line2: UILabel = { | |
| 74 | + let line2 = UILabel.init(frame: CGRectMake(self.twoLevelClassifyLab.right, 24, 1, 25)) | |
| 75 | + line2.backgroundColor = HexColor("#E6E6E6") | |
| 76 | + return line2 | |
| 77 | + }() | |
| 78 | + ///商品数量 | |
| 79 | + lazy var goodsNumberLab: UILabel = { | |
| 80 | + let goodsNumberLab = UILabel.init(frame: CGRectMake(self.twoLevelClassifyLab.right, 0, KSreenWidth/3, self.contentView.height)) | |
| 81 | + goodsNumberLab.numberOfLines = 0 | |
| 82 | + goodsNumberLab.textColor = HexColor("#999999") | |
| 83 | + goodsNumberLab.textAlignment = .center | |
| 84 | + goodsNumberLab.font = Font_10 | |
| 85 | + goodsNumberLab.text = "0\n商品数量" | |
| 86 | + return goodsNumberLab | |
| 87 | + }() | |
| 88 | + | |
| 89 | + override init(frame: CGRect) { | |
| 90 | + super.init(frame: frame) | |
| 91 | + self.initUI() | |
| 92 | + } | |
| 93 | + | |
| 94 | + required init?(coder: NSCoder) { | |
| 95 | + fatalError("init(coder:) has not been implemented") | |
| 96 | + } | |
| 97 | + // MARK: - 初始化UI | |
| 98 | + func initUI(){ | |
| 99 | + self.addSubview(self.contentView) | |
| 100 | + self.contentView.addSubview(self.oneLevelClassifyLab) | |
| 101 | + self.contentView.addSubview(self.line1) | |
| 102 | + self.contentView.addSubview(self.twoLevelClassifyLab) | |
| 103 | + self.contentView.addSubview(self.line2) | |
| 104 | + self.contentView.addSubview(self.goodsNumberLab) | |
| 105 | + | |
| 106 | + //分类名称 | |
| 107 | + let classifyNameLab = UILabel(frame: CGRect(x: 0, y: self.contentView.bottom, width: KSreenWidth*0.3, height: 40)) | |
| 108 | + classifyNameLab.text = "分类名称" | |
| 109 | + classifyNameLab.textColor = HexColor("#999999") | |
| 110 | + classifyNameLab.font = Font_14 | |
| 111 | + classifyNameLab.textAlignment = .center | |
| 112 | + self.addSubview(classifyNameLab) | |
| 113 | + | |
| 114 | + //排序 | |
| 115 | + let sortLab = UILabel(frame: CGRect(x: classifyNameLab.right, y: self.contentView.bottom, width: KSreenWidth*0.2, height: 40)) | |
| 116 | + sortLab.text = "排序" | |
| 117 | + sortLab.textColor = HexColor("#999999") | |
| 118 | + sortLab.font = Font_14 | |
| 119 | + sortLab.textAlignment = .center | |
| 120 | + self.addSubview(sortLab) | |
| 121 | + | |
| 122 | + //是否显示 | |
| 123 | + let hideLab = UILabel(frame: CGRect(x: sortLab.right, y: self.contentView.bottom, width: KSreenWidth*0.2, height: 40)) | |
| 124 | + hideLab.text = "是否显示" | |
| 125 | + hideLab.textColor = HexColor("#999999") | |
| 126 | + hideLab.font = Font_14 | |
| 127 | + hideLab.textAlignment = .center | |
| 128 | + self.addSubview(hideLab) | |
| 129 | + | |
| 130 | + //操作 | |
| 131 | + let handelLab = UILabel(frame: CGRect(x: hideLab.right, y: self.contentView.bottom, width: KSreenWidth*0.3, height: 40)) | |
| 132 | + handelLab.text = "操作" | |
| 133 | + handelLab.textColor = HexColor("#999999") | |
| 134 | + handelLab.font = Font_14 | |
| 135 | + handelLab.textAlignment = .center | |
| 136 | + self.addSubview(handelLab) | |
| 137 | + } | |
| 138 | +} | ... | ... |
metaCode/Classes/Main/HomePage/View/GoodsManager/CNLiveShopClassilyManageTableViewCell.swift
0 → 100644
| 1 | +// | |
| 2 | +// CNLiveShopClassilyManageTableViewCell.swift | |
| 3 | +// metaCode | |
| 4 | +// | |
| 5 | +// Created by zx on 2023/12/12. | |
| 6 | +// 二级分类cell | |
| 7 | + | |
| 8 | +import Foundation | |
| 9 | + | |
| 10 | +class CNLiveShopClassilyManageTableViewCell:UITableViewCell{ | |
| 11 | + | |
| 12 | + ///点击编辑事件回调 | |
| 13 | + var editBtnBlock:editBtnActionBlock? | |
| 14 | + /// 分类model | |
| 15 | + var _classifyModel:CNLiveShopClassifyModel? | |
| 16 | + var classifyModel:CNLiveShopClassifyModel?{ | |
| 17 | + get{ | |
| 18 | + _classifyModel | |
| 19 | + } | |
| 20 | + set{ | |
| 21 | + _classifyModel = newValue | |
| 22 | + self.classifyNameBtn.setTitle(_classifyModel!.title, for: .normal) | |
| 23 | + self.sortLab.text = _classifyModel!.ord | |
| 24 | + if Int(_classifyModel!.state ?? "") == 2{ | |
| 25 | + self.showSwitch.isOn = true | |
| 26 | + }else{ | |
| 27 | + self.showSwitch.isOn = false | |
| 28 | + } | |
| 29 | + } | |
| 30 | + } | |
| 31 | + ///分类名称 | |
| 32 | + lazy var classifyNameBtn: UIButton = { | |
| 33 | + let classifyNameBtn = UIButton(type: .custom) | |
| 34 | + classifyNameBtn.frame = CGRect(x: 0, y: 0, width: KSreenWidth*0.3, height: 50) | |
| 35 | + classifyNameBtn.setTitleColor(HexColor("#333333"), for: .normal) | |
| 36 | + classifyNameBtn.titleLabel?.font = Font_14 | |
| 37 | + return classifyNameBtn | |
| 38 | + }() | |
| 39 | + ///排序名称 | |
| 40 | + lazy var sortLab: UILabel = { | |
| 41 | + let sortLab = UILabel.init(frame: CGRectMake(self.classifyNameBtn.right, 0, KSreenWidth*0.2, 50)) | |
| 42 | + sortLab.text = "排序" | |
| 43 | + sortLab.textColor = HexColor("#333333") | |
| 44 | + sortLab.textAlignment = .center | |
| 45 | + sortLab.font = Font_14 | |
| 46 | + sortLab.adjustsFontSizeToFitWidth=true | |
| 47 | + return sortLab | |
| 48 | + }() | |
| 49 | + ///是否显示 | |
| 50 | + lazy var showSwitch :UISwitch = { | |
| 51 | + let showSwitch = UISwitch(frame: CGRect(x: self.sortLab.right+10, y: 10, width: KSreenWidth*0.2, height: 50)) | |
| 52 | + showSwitch.isEnabled = false | |
| 53 | + return showSwitch | |
| 54 | + }() | |
| 55 | + ///编辑 | |
| 56 | + lazy var editBtn: UIButton = { | |
| 57 | + let editBtn = UIButton(type: .custom) | |
| 58 | + editBtn.frame = CGRect(x: self.showSwitch.right, y: 0, width: KSreenWidth*0.3, height: 50) | |
| 59 | + editBtn.setTitle("编辑", for: .normal) | |
| 60 | + editBtn.setTitleColor(HexColor("#0091FF"), for: .normal) | |
| 61 | + editBtn.titleLabel?.font = Font_14 | |
| 62 | + editBtn.addTarget(self, action: #selector(editBtnAction), for: .touchUpInside) | |
| 63 | + return editBtn | |
| 64 | + }() | |
| 65 | + /// 底部线 | |
| 66 | + lazy var bottomLine: UILabel = { | |
| 67 | + let bottomLine = UILabel.init(frame: CGRectMake(0, 49, KSreenWidth, 1)) | |
| 68 | + bottomLine.backgroundColor = HexColor("#E4E4E4") | |
| 69 | + return bottomLine | |
| 70 | + }() | |
| 71 | + | |
| 72 | + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { | |
| 73 | + super.init(style: style, reuseIdentifier: reuseIdentifier) | |
| 74 | + self.initUI() | |
| 75 | + } | |
| 76 | + | |
| 77 | + required init?(coder: NSCoder) { | |
| 78 | + fatalError("init(coder:) has not been implemented") | |
| 79 | + } | |
| 80 | + // MARK: - 初始化UI | |
| 81 | + func initUI(){ | |
| 82 | + self.contentView.backgroundColor = HexColor("#F6F6F6") | |
| 83 | + self.contentView.addSubview(self.classifyNameBtn) | |
| 84 | + self.contentView.addSubview(self.sortLab) | |
| 85 | + self.contentView.addSubview(self.showSwitch) | |
| 86 | + self.contentView.addSubview(self.editBtn) | |
| 87 | + self.contentView.addSubview(self.bottomLine) | |
| 88 | + } | |
| 89 | + | |
| 90 | + // MARK: - response method | |
| 91 | + /// 编辑 | |
| 92 | + @objc func editBtnAction(){ | |
| 93 | + self.editBtnBlock!(self.classifyModel!) | |
| 94 | + } | |
| 95 | +} | ... | ... |
metaCode/Classes/Main/HomePage/ViewModel/ShopClassify/CNLiveShopClassilyViewModel.swift
| ... | ... | @@ -36,6 +36,28 @@ class CNLiveShopClassilyViewModel: BaseModel{ |
| 36 | 36 | } |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | + /// 获取分类列表 | |
| 40 | + /// @param shopId 店铺id | |
| 41 | + /// @param resultBlock 回调 | |
| 42 | + static func getCateListWithShopId(shopId:String,resultBlock: @escaping downSlideResultBlock){ | |
| 43 | + let param = NSMutableDictionary() | |
| 44 | + param.setValue(shopId, forKey: "shop_id") | |
| 45 | + | |
| 46 | + CNLiveNetworking.setAllowRequestDefaultArgument(true) | |
| 47 | + CNLiveNetworking.setupShowDataResult(false) | |
| 48 | + CNLiveNetworking.setupDSRequest(true) | |
| 49 | + CNLiveNetworking.requestNetwork(with: .GET, urlString: APPBaseWjjBUrl+"/api/v1/cateList", param: param as! [String : String], cacheType: .networkOnly) { task, result, error in | |
| 50 | + hiddenLoading() | |
| 51 | + if (error == nil) { | |
| 52 | + let res = (result as! Dictionary<String, Any>)["data"] as! Dictionary<String, Any> | |
| 53 | + let listModel = newDictionaryToModel(res, CNLiveShopClassifyListModel.self) | |
| 54 | + resultBlock(listModel as Any,.success) | |
| 55 | + }else{ | |
| 56 | + resultBlock(NSNull(),.failed) | |
| 57 | + } | |
| 58 | + } | |
| 59 | + } | |
| 60 | + | |
| 39 | 61 | /// 编辑分类接口 |
| 40 | 62 | /// @param model 分类数据 |
| 41 | 63 | /// @param resultBlock 请求完成回调 | ... | ... |
metaCode/Classes/Main/Model/GoodsManager/CNLiveShopClassifyListModel.swift
metaCode/Classes/Main/Util/CNLiveCommonManager.swift
| ... | ... | @@ -21,6 +21,6 @@ class CNLiveCommonManager: NSObject{ |
| 21 | 21 | let vc = CNLivePlayerViewController() |
| 22 | 22 | vc.setPlayUrl(playUrl: playURL, isLive: false) |
| 23 | 23 | vc.coverImageUrl = coverImageUrl |
| 24 | - currentViewController()?.navigationController?.pushViewController(vc, animated: true) | |
| 24 | + currentViewController()?.navigationController?.pushViewController(vc, animated: false) | |
| 25 | 25 | } |
| 26 | 26 | } | ... | ... |
metaCode/Classes/Main/Util/CNLiveDownSlideTool.swift
| ... | ... | @@ -19,12 +19,12 @@ class CNLiveDownSlideTool:NSObject{ |
| 19 | 19 | let regURL = urlComponents.url |
| 20 | 20 | let webVC = CNWebViewController() |
| 21 | 21 | webVC.url = regURL |
| 22 | - currentViewController()?.navigationController?.pushViewController(webVC, animated: true) | |
| 22 | + currentViewController()?.navigationController?.pushViewController(webVC, animated: false) | |
| 23 | 23 | |
| 24 | 24 | }else if (contentMdl.model == kCNDownSlideContentsModelModel3) || (contentMdl.model == kCNDownSlideContentsModelModel4){ |
| 25 | 25 | let webVC = CNWebViewController() |
| 26 | 26 | webVC.url = URL(string: (contentMdl.thirdUrl)!) |
| 27 | - currentViewController()?.navigationController?.pushViewController(webVC, animated: true) | |
| 27 | + currentViewController()?.navigationController?.pushViewController(webVC, animated: false) | |
| 28 | 28 | }else if (contentMdl.model == kCNDownSlideContentsModelModelAlbum) || (contentMdl.model == kCNDownSlideContentsModelModelAlbum_ugc) || (contentMdl.model == kCNDownSlideContentsModelModelAlbum_video){ |
| 29 | 29 | |
| 30 | 30 | let urlString = "http://wjjh5.cnlive.com/cnYmAlbumVideoList.html" |
| ... | ... | @@ -35,7 +35,7 @@ class CNLiveDownSlideTool:NSObject{ |
| 35 | 35 | let regURL = urlComponents?.url |
| 36 | 36 | let webVC = CNWebViewController() |
| 37 | 37 | webVC.url = regURL |
| 38 | - currentViewController()?.navigationController?.pushViewController(webVC, animated: true) | |
| 38 | + currentViewController()?.navigationController?.pushViewController(webVC, animated: false) | |
| 39 | 39 | }else{ |
| 40 | 40 | return |
| 41 | 41 | } | ... | ... |
metaCode/Classes/Main/Util/CNLivePlayer/CNLivePlayerView.swift
| ... | ... | @@ -101,7 +101,7 @@ class CNLivePlayerView:UIView,PLPlayerDelegate{ |
| 101 | 101 | self?.currentOrientation = .portrait |
| 102 | 102 | }else{ |
| 103 | 103 | self?.popCallBack!() |
| 104 | - currentViewController()?.navigationController?.popViewController(animated: true) | |
| 104 | + currentViewController()?.navigationController?.popViewController(animated: false) | |
| 105 | 105 | } |
| 106 | 106 | } |
| 107 | 107 | controlView.clickFrameBtnAction = {[weak self] in | ... | ... |
metaCode/Supporting Files/Assets.xcassets/Shop/DS_shopclassily_down.imageset/Contents.json
0 → 100644
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "scale" : "1x" | |
| 6 | + }, | |
| 7 | + { | |
| 8 | + "filename" : "DS_shopclassily_down@2x.png", | |
| 9 | + "idiom" : "universal", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "filename" : "DS_shopclassily_down@3x.png", | |
| 14 | + "idiom" : "universal", | |
| 15 | + "scale" : "3x" | |
| 16 | + } | |
| 17 | + ], | |
| 18 | + "info" : { | |
| 19 | + "author" : "xcode", | |
| 20 | + "version" : 1 | |
| 21 | + } | |
| 22 | +} | ... | ... |
metaCode/Supporting Files/Assets.xcassets/Shop/DS_shopclassily_down.imageset/DS_shopclassily_down@2x.png
0 → 100644
214 Bytes
metaCode/Supporting Files/Assets.xcassets/Shop/DS_shopclassily_down.imageset/DS_shopclassily_down@3x.png
0 → 100644
425 Bytes
metaCode/Supporting Files/Assets.xcassets/Shop/DS_shopclassily_up.imageset/Contents.json
0 → 100644
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "scale" : "1x" | |
| 6 | + }, | |
| 7 | + { | |
| 8 | + "filename" : "DS_shopclassily_up@2x.png", | |
| 9 | + "idiom" : "universal", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "filename" : "DS_shopclassily_up@3x.png", | |
| 14 | + "idiom" : "universal", | |
| 15 | + "scale" : "3x" | |
| 16 | + } | |
| 17 | + ], | |
| 18 | + "info" : { | |
| 19 | + "author" : "xcode", | |
| 20 | + "version" : 1 | |
| 21 | + } | |
| 22 | +} | ... | ... |
metaCode/Supporting Files/Assets.xcassets/Shop/DS_shopclassily_up.imageset/DS_shopclassily_up@2x.png
0 → 100644
231 Bytes
metaCode/Supporting Files/Assets.xcassets/Shop/DS_shopclassily_up.imageset/DS_shopclassily_up@3x.png
0 → 100644
438 Bytes