Commit ca6ffdebb2e9e9277b60671326b99281c818456c

Authored by “张旭”
1 parent 9b149f21

修复认证-上滑页、下滑页左右两侧边缘点击没有反应的问题 , 上滑页下滑页左右角遮盖的视图宽高设为0

metaCode.xcodeproj/project.pbxproj
... ... @@ -134,6 +134,7 @@
134 134 19CC4D542ADD163D00308E2A /* CNUpSlideCardPresentationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19CC4D532ADD163D00308E2A /* CNUpSlideCardPresentationController.swift */; };
135 135 19CC4D562ADD19C200308E2A /* String+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19CC4D552ADD19C200308E2A /* String+Extension.swift */; };
136 136 19D2CE632AE8B65D00691757 /* CNLiveDownSlideTool.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19D2CE622AE8B65D00691757 /* CNLiveDownSlideTool.swift */; };
  137 + 19E302672BC8FEBC00F6B8BD /* CNLliveShopDetailCloseCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19E302662BC8FEBC00F6B8BD /* CNLliveShopDetailCloseCell.swift */; };
137 138 19E9D1602B3A98C200D0FB30 /* CNLiveShopAssociatedGoodsTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19E9D15F2B3A98C200D0FB30 /* CNLiveShopAssociatedGoodsTableViewCell.swift */; };
138 139 19E9D1622B3BBB2E00D0FB30 /* CNLiveFileManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19E9D1612B3BBB2E00D0FB30 /* CNLiveFileManager.swift */; };
139 140 19F1C2332AB5728B0083D06C /* CNIDCardView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19F1C2322AB5728B0083D06C /* CNIDCardView.swift */; };
... ... @@ -408,6 +409,7 @@
408 409 19CC4D532ADD163D00308E2A /* CNUpSlideCardPresentationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNUpSlideCardPresentationController.swift; sourceTree = "<group>"; };
409 410 19CC4D552ADD19C200308E2A /* String+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "String+Extension.swift"; sourceTree = "<group>"; };
410 411 19D2CE622AE8B65D00691757 /* CNLiveDownSlideTool.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveDownSlideTool.swift; sourceTree = "<group>"; };
  412 + 19E302662BC8FEBC00F6B8BD /* CNLliveShopDetailCloseCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLliveShopDetailCloseCell.swift; sourceTree = "<group>"; };
411 413 19E9D15F2B3A98C200D0FB30 /* CNLiveShopAssociatedGoodsTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopAssociatedGoodsTableViewCell.swift; sourceTree = "<group>"; };
412 414 19E9D1612B3BBB2E00D0FB30 /* CNLiveFileManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveFileManager.swift; sourceTree = "<group>"; };
413 415 19F1C2322AB5728B0083D06C /* CNIDCardView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNIDCardView.swift; sourceTree = "<group>"; };
... ... @@ -877,6 +879,7 @@
877 879 1938BD4D2B512F4600390A34 /* ShopDetail */ = {
878 880 isa = PBXGroup;
879 881 children = (
  882 + 19E302662BC8FEBC00F6B8BD /* CNLliveShopDetailCloseCell.swift */,
880 883 19BB1FF12AF21A950094D962 /* CNLliveShopDetailBannerCell.swift */,
881 884 19565EBF2AF4DE0E007D6727 /* CNLiveShopDetailBtnsCell.swift */,
882 885 19565EC12AF616CA007D6727 /* CNLiveShopDetailOrderAssetCell.swift */,
... ... @@ -1786,6 +1789,7 @@
1786 1789 19BB202B2AF382150094D962 /* CNLiveAdaptTool.swift in Sources */,
1787 1790 79E672032AFDFA9C00F2F768 /* CNLiveMineSignOutViewController.swift in Sources */,
1788 1791 19565ECD2AF8D256007D6727 /* CNLiveShopGoodsListClassifyView.swift in Sources */,
  1792 + 19E302672BC8FEBC00F6B8BD /* CNLliveShopDetailCloseCell.swift in Sources */,
1789 1793 1938BD322B4B8F0400390A34 /* CNLiveHomePageModel.swift in Sources */,
1790 1794 191732EF2B075C3A007BCC04 /* CNLiveCreateShopClassifyViewController.swift in Sources */,
1791 1795 1938BD302B4B8A3500390A34 /* CNLiveHomePageViewModel.swift in Sources */,
... ...
metaCode/Classes/Main/HomePage/Controller/AuthMainController/CNMetaCodeHomePageController.swift
... ... @@ -245,6 +245,7 @@ class CNMetaCodeHomePageController:CNLiveBaseViewController, NewPagedFlowViewDel
245 245 super.viewWillAppear(animated)
246 246 self.view.height = KSreenHeight
247 247 self.topNavView.isHidden = true
  248 + self.hiddenLeftRightView()
248 249 // print("22222222currentPageIndex:\(self.pageFlowView.currentPageIndex)")
249 250 switch vNumPage {
250 251 case .VNumPageMain://中间主页
... ... @@ -602,6 +603,9 @@ class CNMetaCodeHomePageController:CNLiveBaseViewController, NewPagedFlowViewDel
602 603 vNumPage = .VNumPageUp
603 604 }
604 605  
  606 + //左右上角遮盖的视图 宽高设为0
  607 + self.hiddenLeftRightView()
  608 +
605 609 if scrollView.contentOffset.y == KSreenHeight {
606 610 self.view.height = self.tabBarY
607 611  
... ... @@ -617,6 +621,42 @@ class CNMetaCodeHomePageController:CNLiveBaseViewController, NewPagedFlowViewDel
617 621 // }
618 622 }
619 623 }
  624 + // MARK: - 左右上角遮盖的视图 宽高设为0
  625 + func hiddenLeftRightView(){
  626 + let toIndex:Int = self.pageFlowView.currentPageIndex
  627 + if dataArray.count > toIndex{
  628 + if let identityModel = dataArray[toIndex] as? StandListModel{
  629 + if let toBannerView = self.pageFlowView.cells[toIndex] as? CNCustomIndexView{
  630 + self.pageFlowView.scrollView.bringSubviewToFront(toBannerView)
  631 + UIView.animate(withDuration: 0.2) {
  632 + toBannerView.downSlideView.frame = CGRectMake(-LeftGap, 0, KSreenWidth, KSreenHeight)
  633 + toBannerView.downSlideView.upSlideVC.view.height = KSreenHeight-DownSlideBottomViewHeight
  634 + if identityModel.id == 9{
  635 + toBannerView.downSlideView.shopConsoleVC.view.height = KSreenHeight-DownSlideBottomViewHeight
  636 + }
  637 + toBannerView.upSlideView.frame = CGRectMake(-LeftGap, KSreenHeight*2,KSreenWidth, KSreenHeight)
  638 + }
  639 +
  640 + }
  641 + }
  642 + }
  643 + if toIndex-1 >= 0{
  644 + if let toBannerViewLeftView = self.pageFlowView.cells[toIndex-1] as? CNCustomIndexView{
  645 + UIView.animate(withDuration: 0.2) {
  646 + toBannerViewLeftView.downSlideView.frame = CGRectMake(-LeftGap, 0, 0, 0)
  647 + toBannerViewLeftView.upSlideView.frame = CGRectMake(-LeftGap, KSreenHeight*2,0, 0)
  648 + }
  649 + }
  650 + }
  651 + if toIndex+1 < self.pageFlowView.cells.count{
  652 + if let toBannerViewRightView = self.pageFlowView.cells[toIndex+1] as? CNCustomIndexView{
  653 + UIView.animate(withDuration: 0.2) {
  654 + toBannerViewRightView.downSlideView.frame = CGRectMake(-LeftGap, 0, 0, 0)
  655 + toBannerViewRightView.upSlideView.frame = CGRectMake(-LeftGap, KSreenHeight*2,0, 0)
  656 + }
  657 + }
  658 + }
  659 + }
620 660  
621 661 //MARK: - 网络请求获取身份列表
622 662 func getUserIdentityApi()
... ...
metaCode/Classes/Main/HomePage/Controller/ShopUpDetail/CNLiveDownShopDetailController.swift
... ... @@ -13,6 +13,7 @@ class CNLiveDownShopDetailController:CNLiveBaseViewController, UICollectionViewD
13 13 let kCNLiveShopDetailDefaultCellID = "kCNLiveShopDetailDefaultCellID"
14 14 let kCNLiveShopDetailHeaderViewID = "kCNLiveShopDetailHeaderViewID"
15 15  
  16 + let kCNLiveShopDetailCloseCellID = "kCNLiveShopDetailCloseCellID"
16 17 let kCNLiveShopDetailBannerCellID = "kCNLiveShopDetailBannerCellID"
17 18 let kCNLiveShopDetailBtnsCellID = "kCNLiveShopDetailBtnsCellID"
18 19 let kCNLiveShopDetailOrderAssetCellID = "kCNLiveShopDetailOrderAssetCellID"
... ... @@ -22,56 +23,21 @@ class CNLiveDownShopDetailController:CNLiveBaseViewController, UICollectionViewD
22 23 let shopDetailModel = CNLiveShopDetailModel()
23 24 return shopDetailModel
24 25 }()
25   - override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
26   - let upSlideView = self.view.superview as! CNUpSlideView
27   - let scrollView = upSlideView.superview as! UIScrollView
28   - scrollView.setContentOffset(CGPoint(x: 0, y: scrollView.height), animated: true)
29   -
30   - let result:Dictionary = ["AuthVNumPage":2]
31   - NotificationCenter.default.post(name: Notification.Name.AuthVNumPageManage.kAuthVNumPageChangedNotification, object: nil, userInfo: result)
32   -
33   - currentViewController()?.tabBarController?.tabBar.isHidden = false
34   -
35   - let metaVC = currentViewController() as! CNMetaCodeHomePageController
36   - let index = metaVC.pageFlowView.currentPageIndex
37   - let customIndexView = metaVC.pageFlowView.viewWithTag(100+index) as! CNCustomIndexView
38   - customIndexView.superScrollView?.isScrollEnabled = true
39   - }
40   -// lazy var closeBtn: UIButton = {
41   -// let closeBtn = UIButton(type: .custom)
42   -// closeBtn.frame = CGRect(x: KSreenWidth-50, y: KStatusBarHeight, width: 50, height: KNavigationHeight-KStatusBarHeight)
43   -// closeBtn.setImage(UIImage(named: "mine_header_icon_close"), for: .normal)
44   -// closeBtn.addTarget(self, action: #selector(closeBtnAction), for: .touchUpInside)
45   -// closeBtn.isUserInteractionEnabled = false
46   -// return closeBtn
47   -// }()
48   -
49   -// lazy var navView: UIView = {
50   -// let closeBtn = UIView(frame: CGRect(x: 0, y: KStatusBarHeight, width: KSreenWidth-50, height: KNavigationHeight-KStatusBarHeight))
51   -// closeBtn.backgroundColor = .yellow
52   -// return closeBtn
53   -// }()
54   - lazy var closeBtn: UIImageView = {
55   - let closeBtn = UIImageView(frame: CGRect(x: KSreenWidth-35, y: KStatusBarHeight+(KNavigationHeight-KStatusBarHeight-20)*0.5, width: 20, height: 20))
56   - closeBtn.image = UIImage(named: "mine_header_icon_close")
57   -// closeBtn.isUserInteractionEnabled = true
58   -// let tap = UITapGestureRecognizer.init(target: self, action: #selector(closeBtnAction))
59   -// closeBtn.addGestureRecognizer(tap)
60   - return closeBtn
61   - }()
62   -
63 26 lazy var collectionView: UICollectionView = {
64 27 let layout = UICollectionViewFlowLayout.init()
65 28 let collectionView = UICollectionView(frame: .zero, collectionViewLayout: layout)
66 29 collectionView.delegate = self
67 30 collectionView.dataSource = self
68 31 collectionView.backgroundColor = .white
69   -// collectionView.register(CNLiveShopConsoleHeaderView.self, forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier: kCNLiveShopConsoleCollectionReusableHeaderViewID)
  32 +
  33 + collectionView.register(CNLliveShopDetailCloseCell.self, forCellWithReuseIdentifier: kCNLiveShopDetailCloseCellID)
  34 +
70 35 collectionView.register(CNLliveShopDetailBannerCell.self, forCellWithReuseIdentifier: kCNLiveShopDetailBannerCellID)
71 36 collectionView.register(UICollectionViewCell.self, forCellWithReuseIdentifier: kCNLiveShopDetailDefaultCellID)
72 37 collectionView.register(CNLiveShopDetailBtnsCell.self, forCellWithReuseIdentifier: kCNLiveShopDetailBtnsCellID)
73 38 collectionView.register(CNLiveShopDetailOrderAssetCell.self, forCellWithReuseIdentifier: kCNLiveShopDetailOrderAssetCellID)
74 39  
  40 +
75 41 return collectionView
76 42 }()
77 43  
... ... @@ -80,12 +46,8 @@ class CNLiveDownShopDetailController:CNLiveBaseViewController, UICollectionViewD
80 46 self.getShopDetailApi()
81 47 self.view.addSubview(collectionView)
82 48 collectionView.snp.makeConstraints { make in
83   - make.top.equalToSuperview().offset(KNavigationHeight)
84   - make.left.bottom.right.equalToSuperview()
  49 + make.top.left.bottom.right.equalToSuperview()
85 50 }
86   - self.view.addSubview(self.closeBtn)
87   -// self.view.addSubview(navView)
88   -
89 51 }
90 52  
91 53 // MARK: BtnAction
... ... @@ -102,15 +64,13 @@ class CNLiveDownShopDetailController:CNLiveBaseViewController, UICollectionViewD
102 64 let index = metaVC.pageFlowView.currentPageIndex
103 65 let customIndexView = metaVC.pageFlowView.viewWithTag(100+index) as! CNCustomIndexView
104 66 customIndexView.superScrollView?.isScrollEnabled = true
105   -// customIndexView.baseScrollView.setContentOffset(CGPoint(x: 0, y: customIndexView.baseScrollView.height), animated: true)
106   -// currentViewController()?.tabBarController?.tabBar.isHidden = false
107 67 }
108   -
  68 +
109 69 // MARK: - UICollectionViewDelegate
110 70 func numberOfSections(in collectionView: UICollectionView) -> Int {
111 71 if self.shopDetailModel.is_seller != nil{
112 72 if self.shopDetailModel.is_seller == true{
113   - return 5
  73 + return 6
114 74 }else{//非商家,不处理
115 75 return 3
116 76 }
... ... @@ -121,7 +81,7 @@ class CNLiveDownShopDetailController:CNLiveBaseViewController, UICollectionViewD
121 81 func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
122 82 if self.shopDetailModel.is_seller != nil {
123 83 if (self.shopDetailModel.is_seller == true) {
124   - if (section == 4) {
  84 + if (section == 5) {
125 85 let count = self.shopDetailModel.dynamic.count
126 86 return count == 0 ? 1 : count
127 87 }else {
... ... @@ -144,12 +104,15 @@ class CNLiveDownShopDetailController:CNLiveBaseViewController, UICollectionViewD
144 104 // }
145 105 func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
146 106 switch indexPath.section {
147   - case 0://banner轮播图
  107 + case 0://close关闭
  108 + let cell = collectionView.dequeueReusableCell(withReuseIdentifier: kCNLiveShopDetailCloseCellID, for: indexPath) as! CNLliveShopDetailCloseCell
  109 + return cell
  110 + case 1://banner轮播图
148 111 let cell = collectionView.dequeueReusableCell(withReuseIdentifier: kCNLiveShopDetailBannerCellID, for: indexPath) as! CNLliveShopDetailBannerCell
149 112  
150 113 cell.shopDetailModel = self.shopDetailModel
151 114 return cell
152   - case 1://btn
  115 + case 2://btn
153 116 if (self.shopDetailModel.is_seller != nil && self.shopDetailModel.is_seller == true) {
154 117 let cell = collectionView.dequeueReusableCell(withReuseIdentifier: kCNLiveShopDetailBtnsCellID, for: indexPath) as! CNLiveShopDetailBtnsCell
155 118 cell.shopDetailModel = self.shopDetailModel
... ... @@ -158,7 +121,7 @@ class CNLiveDownShopDetailController:CNLiveBaseViewController, UICollectionViewD
158 121 let cell = collectionView.dequeueReusableCell(withReuseIdentifier: kCNLiveShopDetailDefaultCellID, for: indexPath)
159 122 return cell
160 123 }
161   - case 2://我的订单
  124 + case 3://我的订单
162 125 if (self.shopDetailModel.is_seller != nil && self.shopDetailModel.is_seller == true) {
163 126 let cell = collectionView.dequeueReusableCell(withReuseIdentifier: kCNLiveShopDetailOrderAssetCellID, for: indexPath) as! CNLiveShopDetailOrderAssetCell
164 127 cell.displayType = .CNLiveShopDetailDisplayTypeOrder
... ... @@ -168,7 +131,7 @@ class CNLiveDownShopDetailController:CNLiveBaseViewController, UICollectionViewD
168 131 let cell = collectionView.dequeueReusableCell(withReuseIdentifier: kCNLiveShopDetailDefaultCellID, for: indexPath)
169 132 return cell
170 133 }
171   - case 3://我的资产
  134 + case 4://我的资产
172 135 if (self.shopDetailModel.is_seller != nil && self.shopDetailModel.is_seller == true) {
173 136 let cell = collectionView.dequeueReusableCell(withReuseIdentifier: kCNLiveShopDetailOrderAssetCellID, for: indexPath) as! CNLiveShopDetailOrderAssetCell
174 137 cell.displayType = .CNLiveShopDetailDisplayTypeAsset
... ... @@ -178,7 +141,6 @@ class CNLiveDownShopDetailController:CNLiveBaseViewController, UICollectionViewD
178 141 let cell = collectionView.dequeueReusableCell(withReuseIdentifier: kCNLiveShopDetailDefaultCellID, for: indexPath)
179 142 return cell
180 143 }
181   -// case 4:
182 144 default:
183 145 let cell = collectionView.dequeueReusableCell(withReuseIdentifier: kCNLiveShopDetailDefaultCellID, for: indexPath)
184 146 return cell
... ... @@ -186,19 +148,27 @@ class CNLiveDownShopDetailController:CNLiveBaseViewController, UICollectionViewD
186 148  
187 149 }
188 150  
  151 + func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
  152 + if indexPath.section == 0{
  153 + self.closeBtnAction()
  154 + }
  155 + }
  156 +
189 157 // MARK: - UICollectionViewDelegateFlowLayout
190 158 func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
191 159 if (self.shopDetailModel.is_seller != nil && self.shopDetailModel.is_seller == true) {
192 160 switch (indexPath.section) {
193   - case 0://banner
  161 + case 0://close
  162 + return CGSize(width: KSreenWidth, height: KNavigationHeight)
  163 + case 1://banner
194 164 return CGSize(width: KSreenWidth, height: CNLiveAdaptTool.adaptLength(length: 210))
195   - case 1://btn
  165 + case 2://btn
196 166 return CGSize(width: KSreenWidth, height: 10+45+5+17+15)
197   - case 2://我的订单
  167 + case 3://我的订单
198 168 return CGSize(width: KSreenWidth, height: 10+25+15+CNLiveAdaptTool.adaptLength(length: tempOrderZiChanHeight)+15)
199   - case 3://我的资产
  169 + case 4://我的资产
200 170 return CGSize(width: KSreenWidth, height: 10+25+15+CNLiveAdaptTool.adaptLength(length: tempOrderZiChanHeight)+15)
201   - case 4://
  171 + case 5://
202 172 return CGSize(width: KSreenWidth, height: 50)
203 173 default:
204 174 return CGSizeZero
... ...
metaCode/Classes/Main/HomePage/View/Shop/ShopDetail/CNLliveShopDetailCloseCell.swift 0 → 100644
  1 +//
  2 +// CNLliveShopDetailCloseCell.swift
  3 +// metaCode
  4 +//
  5 +// Created by zx on 2024/4/12.
  6 +// 电商上滑页-close cell
  7 +
  8 +import Foundation
  9 +
  10 +class CNLliveShopDetailCloseCell: UICollectionViewCell {
  11 + lazy var closeBtn: UIImageView = {
  12 + let closeBtn = UIImageView(frame: CGRect(x: KSreenWidth-35, y: KStatusBarHeight+(KNavigationHeight-KStatusBarHeight-20)*0.5, width: 20, height: 20))
  13 + closeBtn.image = UIImage(named: "mine_header_icon_close")
  14 + return closeBtn
  15 + }()
  16 +
  17 + override init(frame: CGRect) {
  18 + super.init(frame: frame)
  19 + self.setUI()
  20 + }
  21 +
  22 + required init?(coder: NSCoder) {
  23 + fatalError("init(coder:) has not been implemented")
  24 + }
  25 +
  26 + func setUI(){
  27 + self.backgroundColor = .white
  28 + self.contentView.addSubview(self.closeBtn)
  29 + }
  30 +
  31 +}
... ...
metaCode/Classes/Vendors/NewPagedFlowView.m
... ... @@ -557,6 +557,22 @@ static NSString *subviewClassName;
557 557 newPoint.y = point.y - _scrollView.frame.origin.y + _scrollView.contentOffset.y;
558 558 if ([_scrollView pointInside:newPoint withEvent:event]) {
559 559 return [_scrollView hitTest:newPoint withEvent:event];
  560 + }else{
  561 + //24年4-12,多层的子视图超过了父视图,如果有子视图内点击,传递给子视图点击事件
  562 + PGIndexBannerSubiew *cell = [_cells objectAtIndex:self.currentPageIndex];
  563 + for (UIView *view in cell.subviews) {
  564 + if ([view isKindOfClass:[UIScrollView class]]){
  565 + UIScrollView *scrollView = (UIScrollView *)view;
  566 + for (UIView *subView in [scrollView subviews]) {
  567 + // 将父类point点转换成子类坐标系下的点
  568 + CGPoint convertedPoint = [subView convertPoint:point fromView:self];
  569 + UIView *targetView = [subView hitTest:convertedPoint withEvent:event];
  570 + if (targetView != nil) {
  571 + return targetView;
  572 + }
  573 + }
  574 + }
  575 + }
560 576 }
561 577  
562 578 return _scrollView;
... ...