Commit 81b032f817340f0b09064d41e41821bed9224efe
1 parent
66900eda
商家上滑逻辑 , 未认证禁止左右滑
Showing
10 changed files
with
359 additions
and
90 deletions
Podfile
| @@ -42,10 +42,10 @@ target 'metaCode' do | @@ -42,10 +42,10 @@ target 'metaCode' do | ||
| 42 | #分类滚动切换视图 | 42 | #分类滚动切换视图 |
| 43 | pod 'JXSegmentedView', :git => 'https://gitee.com/mirrors/JXSegmentedView.git' | 43 | pod 'JXSegmentedView', :git => 'https://gitee.com/mirrors/JXSegmentedView.git' |
| 44 | pod 'JXPagingView/Paging' | 44 | pod 'JXPagingView/Paging' |
| 45 | - | ||
| 46 | - | 45 | + #轮播图 |
| 46 | + pod 'FSPagerView', '~> 0.8.3' | ||
| 47 | #应用调试工具 | 47 | #应用调试工具 |
| 48 | - pod 'FWDebug', :configurations => ['Debug'] | 48 | +# pod 'FWDebug', :configurations => ['Debug'] |
| 49 | 49 | ||
| 50 | target 'metaCodeTests' do | 50 | target 'metaCodeTests' do |
| 51 | inherit! :search_paths | 51 | inherit! :search_paths |
metaCode.xcodeproj/project.pbxproj
| @@ -21,6 +21,8 @@ | @@ -21,6 +21,8 @@ | ||
| 21 | 19BB1FEC2AF0AB8E0094D962 /* CNLiveDownShopDetailController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19BB1FEB2AF0AB8E0094D962 /* CNLiveDownShopDetailController.swift */; }; | 21 | 19BB1FEC2AF0AB8E0094D962 /* CNLiveDownShopDetailController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19BB1FEB2AF0AB8E0094D962 /* CNLiveDownShopDetailController.swift */; }; |
| 22 | 19BB1FEE2AF0E1EC0094D962 /* CNLiveShopDetailViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19BB1FED2AF0E1EC0094D962 /* CNLiveShopDetailViewModel.swift */; }; | 22 | 19BB1FEE2AF0E1EC0094D962 /* CNLiveShopDetailViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19BB1FED2AF0E1EC0094D962 /* CNLiveShopDetailViewModel.swift */; }; |
| 23 | 19BB1FF02AF0E5B30094D962 /* CNLiveShopDetailModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19BB1FEF2AF0E5B30094D962 /* CNLiveShopDetailModel.swift */; }; | 23 | 19BB1FF02AF0E5B30094D962 /* CNLiveShopDetailModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19BB1FEF2AF0E5B30094D962 /* CNLiveShopDetailModel.swift */; }; |
| 24 | + 19BB1FF22AF21A950094D962 /* CNLliveShopDetailBannerCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19BB1FF12AF21A950094D962 /* CNLliveShopDetailBannerCell.swift */; }; | ||
| 25 | + 19BB202B2AF382150094D962 /* CNLiveAdaptTool.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19BB202A2AF382150094D962 /* CNLiveAdaptTool.swift */; }; | ||
| 24 | 19CC4D472ADD006600308E2A /* CNDownSlideSingleCourseCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19CC4D462ADD006600308E2A /* CNDownSlideSingleCourseCell.swift */; }; | 26 | 19CC4D472ADD006600308E2A /* CNDownSlideSingleCourseCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19CC4D462ADD006600308E2A /* CNDownSlideSingleCourseCell.swift */; }; |
| 25 | 19CC4D492ADD06C500308E2A /* UITableView+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19CC4D482ADD06C500308E2A /* UITableView+Extension.swift */; }; | 27 | 19CC4D492ADD06C500308E2A /* UITableView+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19CC4D482ADD06C500308E2A /* UITableView+Extension.swift */; }; |
| 26 | 19CC4D4B2ADD086F00308E2A /* CNUpSlideDetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19CC4D4A2ADD086F00308E2A /* CNUpSlideDetailViewController.swift */; }; | 28 | 19CC4D4B2ADD086F00308E2A /* CNUpSlideDetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19CC4D4A2ADD086F00308E2A /* CNUpSlideDetailViewController.swift */; }; |
| @@ -153,6 +155,8 @@ | @@ -153,6 +155,8 @@ | ||
| 153 | 19BB1FEB2AF0AB8E0094D962 /* CNLiveDownShopDetailController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveDownShopDetailController.swift; sourceTree = "<group>"; }; | 155 | 19BB1FEB2AF0AB8E0094D962 /* CNLiveDownShopDetailController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveDownShopDetailController.swift; sourceTree = "<group>"; }; |
| 154 | 19BB1FED2AF0E1EC0094D962 /* CNLiveShopDetailViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopDetailViewModel.swift; sourceTree = "<group>"; }; | 156 | 19BB1FED2AF0E1EC0094D962 /* CNLiveShopDetailViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopDetailViewModel.swift; sourceTree = "<group>"; }; |
| 155 | 19BB1FEF2AF0E5B30094D962 /* CNLiveShopDetailModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopDetailModel.swift; sourceTree = "<group>"; }; | 157 | 19BB1FEF2AF0E5B30094D962 /* CNLiveShopDetailModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopDetailModel.swift; sourceTree = "<group>"; }; |
| 158 | + 19BB1FF12AF21A950094D962 /* CNLliveShopDetailBannerCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLliveShopDetailBannerCell.swift; sourceTree = "<group>"; }; | ||
| 159 | + 19BB202A2AF382150094D962 /* CNLiveAdaptTool.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveAdaptTool.swift; sourceTree = "<group>"; }; | ||
| 156 | 19CC4D462ADD006600308E2A /* CNDownSlideSingleCourseCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNDownSlideSingleCourseCell.swift; sourceTree = "<group>"; }; | 160 | 19CC4D462ADD006600308E2A /* CNDownSlideSingleCourseCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNDownSlideSingleCourseCell.swift; sourceTree = "<group>"; }; |
| 157 | 19CC4D482ADD06C500308E2A /* UITableView+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UITableView+Extension.swift"; sourceTree = "<group>"; }; | 161 | 19CC4D482ADD06C500308E2A /* UITableView+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UITableView+Extension.swift"; sourceTree = "<group>"; }; |
| 158 | 19CC4D4A2ADD086F00308E2A /* CNUpSlideDetailViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNUpSlideDetailViewController.swift; sourceTree = "<group>"; }; | 162 | 19CC4D4A2ADD086F00308E2A /* CNUpSlideDetailViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNUpSlideDetailViewController.swift; sourceTree = "<group>"; }; |
| @@ -308,6 +312,7 @@ | @@ -308,6 +312,7 @@ | ||
| 308 | 19CC4D512ADD129800308E2A /* CNUpSlideAnimationTransition.swift */, | 312 | 19CC4D512ADD129800308E2A /* CNUpSlideAnimationTransition.swift */, |
| 309 | 19FA201A2AE60423001F7186 /* CNLiveDownSlideModelLayout.swift */, | 313 | 19FA201A2AE60423001F7186 /* CNLiveDownSlideModelLayout.swift */, |
| 310 | 19D2CE622AE8B65D00691757 /* CNLiveDownSlideTool.swift */, | 314 | 19D2CE622AE8B65D00691757 /* CNLiveDownSlideTool.swift */, |
| 315 | + 19BB202A2AF382150094D962 /* CNLiveAdaptTool.swift */, | ||
| 311 | ); | 316 | ); |
| 312 | path = Util; | 317 | path = Util; |
| 313 | sourceTree = "<group>"; | 318 | sourceTree = "<group>"; |
| @@ -639,6 +644,7 @@ | @@ -639,6 +644,7 @@ | ||
| 639 | 19CC4D462ADD006600308E2A /* CNDownSlideSingleCourseCell.swift */, | 644 | 19CC4D462ADD006600308E2A /* CNDownSlideSingleCourseCell.swift */, |
| 640 | 19CC4D4E2ADD0FC200308E2A /* CNUpSlideDetailScrollView.swift */, | 645 | 19CC4D4E2ADD0FC200308E2A /* CNUpSlideDetailScrollView.swift */, |
| 641 | 19BB1FE92AEF7B4A0094D962 /* CNLiveShopConsoleCell.swift */, | 646 | 19BB1FE92AEF7B4A0094D962 /* CNLiveShopConsoleCell.swift */, |
| 647 | + 19BB1FF12AF21A950094D962 /* CNLliveShopDetailBannerCell.swift */, | ||
| 642 | ); | 648 | ); |
| 643 | name = View; | 649 | name = View; |
| 644 | path = HomePage/View; | 650 | path = HomePage/View; |
| @@ -979,6 +985,7 @@ | @@ -979,6 +985,7 @@ | ||
| 979 | 79282A3C2A2EDC2500B5F8CF /* NSString+CNLiveExtensions.swift in Sources */, | 985 | 79282A3C2A2EDC2500B5F8CF /* NSString+CNLiveExtensions.swift in Sources */, |
| 980 | 19D2CE632AE8B65D00691757 /* CNLiveDownSlideTool.swift in Sources */, | 986 | 19D2CE632AE8B65D00691757 /* CNLiveDownSlideTool.swift in Sources */, |
| 981 | 790B1FB82A41B6A60074CF00 /* CNLiveMineMessageViewController.swift in Sources */, | 987 | 790B1FB82A41B6A60074CF00 /* CNLiveMineMessageViewController.swift in Sources */, |
| 988 | + 19BB202B2AF382150094D962 /* CNLiveAdaptTool.swift in Sources */, | ||
| 982 | 798A44F22A30674200815935 /* CNLiveMineSubBodyListView.swift in Sources */, | 989 | 798A44F22A30674200815935 /* CNLiveMineSubBodyListView.swift in Sources */, |
| 983 | 790D01822A2D88FC00C5978D /* CNLiveConfigMacro.swift in Sources */, | 990 | 790D01822A2D88FC00C5978D /* CNLiveConfigMacro.swift in Sources */, |
| 984 | 19CC4D4B2ADD086F00308E2A /* CNUpSlideDetailViewController.swift in Sources */, | 991 | 19CC4D4B2ADD086F00308E2A /* CNUpSlideDetailViewController.swift in Sources */, |
| @@ -1045,6 +1052,7 @@ | @@ -1045,6 +1052,7 @@ | ||
| 1045 | 79396EED2A319F220053E1AF /* NSObject+CNLiveExtensions.swift in Sources */, | 1052 | 79396EED2A319F220053E1AF /* NSObject+CNLiveExtensions.swift in Sources */, |
| 1046 | 19FA201B2AE60423001F7186 /* CNLiveDownSlideModelLayout.swift in Sources */, | 1053 | 19FA201B2AE60423001F7186 /* CNLiveDownSlideModelLayout.swift in Sources */, |
| 1047 | 7C4931312A2F142F000E44B4 /* CNHomePageBackgroupView.swift in Sources */, | 1054 | 7C4931312A2F142F000E44B4 /* CNHomePageBackgroupView.swift in Sources */, |
| 1055 | + 19BB1FF22AF21A950094D962 /* CNLliveShopDetailBannerCell.swift in Sources */, | ||
| 1048 | 790D018B2A2D8B3300C5978D /* CNLiveLoginViewController.swift in Sources */, | 1056 | 790D018B2A2D8B3300C5978D /* CNLiveLoginViewController.swift in Sources */, |
| 1049 | 19CC4D562ADD19C200308E2A /* String+Extension.swift in Sources */, | 1057 | 19CC4D562ADD19C200308E2A /* String+Extension.swift in Sources */, |
| 1050 | 7905BB492AB0588B0089BC50 /* CNLiveMineAuthResultViewController.swift in Sources */, | 1058 | 7905BB492AB0588B0089BC50 /* CNLiveMineAuthResultViewController.swift in Sources */, |
metaCode/Classes/Main/HomePage/Controller/CNLiveDownShopDetailController.swift
| @@ -7,12 +7,153 @@ | @@ -7,12 +7,153 @@ | ||
| 7 | 7 | ||
| 8 | import Foundation | 8 | import Foundation |
| 9 | 9 | ||
| 10 | -class CNLiveDownShopDetailController:CNLiveBaseViewController{ | 10 | +class CNLiveDownShopDetailController:CNLiveBaseViewController, UICollectionViewDelegate, UICollectionViewDataSource,UICollectionViewDelegateFlowLayout{ |
| 11 | + | ||
| 12 | + let kCNLiveShopDetailDefaultCellID = "kCNLiveShopDetailDefaultCellID" | ||
| 13 | + let kCNLiveShopDetailHeaderViewID = "kCNLiveShopDetailHeaderViewID" | ||
| 14 | + | ||
| 15 | + let kCNLiveShopDetailBannerCellID = "kCNLiveShopDetailBannerCellID" | ||
| 16 | + | ||
| 17 | + | ||
| 18 | + lazy var shopDetailModel: CNLiveShopDetailModel = { | ||
| 19 | + let shopDetailModel = CNLiveShopDetailModel() | ||
| 20 | + return shopDetailModel | ||
| 21 | + }() | ||
| 22 | + | ||
| 23 | + lazy var collectionView: UICollectionView = { | ||
| 24 | + let layout = UICollectionViewFlowLayout.init() | ||
| 25 | + let collectionView = UICollectionView(frame: .zero, collectionViewLayout: layout) | ||
| 26 | + collectionView.delegate = self | ||
| 27 | + collectionView.dataSource = self | ||
| 28 | + collectionView.backgroundColor = .white | ||
| 29 | +// collectionView.register(CNLiveShopConsoleHeaderView.self, forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier: kCNLiveShopConsoleCollectionReusableHeaderViewID) | ||
| 30 | + collectionView.register(CNLliveShopDetailBannerCell.self, forCellWithReuseIdentifier: kCNLiveShopDetailBannerCellID) | ||
| 31 | + collectionView.register(UICollectionViewCell.self, forCellWithReuseIdentifier: kCNLiveShopDetailDefaultCellID) | ||
| 32 | + | ||
| 33 | + return collectionView | ||
| 34 | + }() | ||
| 35 | + | ||
| 11 | override func viewDidLoad() { | 36 | override func viewDidLoad() { |
| 12 | super.viewDidLoad() | 37 | super.viewDidLoad() |
| 13 | self.getShopDetailApi() | 38 | self.getShopDetailApi() |
| 39 | + | ||
| 40 | + self.view.addSubview(collectionView) | ||
| 41 | + collectionView.snp.makeConstraints { make in | ||
| 42 | + make.top.equalToSuperview().offset(KNavigationHeight) | ||
| 43 | + make.left.bottom.right.equalToSuperview() | ||
| 44 | + } | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + // MARK: - UICollectionViewDelegate | ||
| 48 | + func numberOfSections(in collectionView: UICollectionView) -> Int { | ||
| 49 | + if self.shopDetailModel.is_seller != nil{ | ||
| 50 | + if self.shopDetailModel.is_seller == true{ | ||
| 51 | + return 5 | ||
| 52 | + }else{//非商家,不处理 | ||
| 53 | + return 3 | ||
| 54 | + } | ||
| 55 | + }else{ | ||
| 56 | + return 1 | ||
| 57 | + } | ||
| 58 | + } | ||
| 59 | + func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { | ||
| 60 | + if self.shopDetailModel.is_seller != nil { | ||
| 61 | + if (self.shopDetailModel.is_seller == true) { | ||
| 62 | + if (section == 4) { | ||
| 63 | + let count = self.shopDetailModel.dynamic.count | ||
| 64 | + return count == 0 ? 1 : count | ||
| 65 | + }else { | ||
| 66 | + return 1 | ||
| 67 | + } | ||
| 68 | + }else { | ||
| 69 | + return 1 | ||
| 70 | + } | ||
| 71 | + }else{ | ||
| 72 | + return 1 | ||
| 73 | + } | ||
| 74 | + } | ||
| 75 | +// func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView { | ||
| 76 | +// if (kind == UICollectionView.elementKindSectionHeader){ | ||
| 77 | +// let headerView:CNLiveShopConsoleHeaderView = collectionView .dequeueReusableSupplementaryView(ofKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier: kCNLiveShopDetailHeaderViewID, for: indexPath) as! CNLiveShopConsoleHeaderView | ||
| 78 | +// | ||
| 79 | +// return headerView | ||
| 80 | +// }else{ | ||
| 81 | +// return | ||
| 82 | +// } | ||
| 83 | + func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { | ||
| 84 | + switch indexPath.section { | ||
| 85 | + case 0: | ||
| 86 | + let cell = collectionView.dequeueReusableCell(withReuseIdentifier: kCNLiveShopDetailBannerCellID, for: indexPath) as! CNLliveShopDetailBannerCell | ||
| 87 | + | ||
| 88 | + cell.shopDetailModel = self.shopDetailModel | ||
| 89 | + return cell | ||
| 90 | +// case 1: | ||
| 91 | +// | ||
| 92 | +// case 2: | ||
| 93 | +// case 3: | ||
| 94 | +// case 4: | ||
| 95 | + default: | ||
| 96 | + let cell = collectionView.dequeueReusableCell(withReuseIdentifier: kCNLiveShopDetailDefaultCellID, for: indexPath) | ||
| 97 | + return cell | ||
| 98 | + } | ||
| 99 | + | ||
| 14 | } | 100 | } |
| 15 | 101 | ||
| 102 | + // MARK: - UICollectionViewDelegateFlowLayout | ||
| 103 | + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { | ||
| 104 | + if (self.shopDetailModel.is_seller != nil && self.shopDetailModel.is_seller == true) { | ||
| 105 | + switch (indexPath.section) { | ||
| 106 | + case 0: | ||
| 107 | + return CGSize(width: KSreenWidth, height: CNLiveAdaptTool.adaptLength(length: 210)) | ||
| 108 | + case 1: | ||
| 109 | + return CGSize(width: KSreenWidth, height: 50) | ||
| 110 | + case 2: | ||
| 111 | + return CGSize(width: KSreenWidth, height: 50) | ||
| 112 | + case 3: | ||
| 113 | + return CGSize(width: KSreenWidth, height: 50) | ||
| 114 | + case 4: | ||
| 115 | + return CGSize(width: KSreenWidth, height: 50) | ||
| 116 | + default: | ||
| 117 | + return CGSizeZero | ||
| 118 | + } | ||
| 119 | + }else { | ||
| 120 | + return CGSizeZero | ||
| 121 | +// switch (indexPath.section) { | ||
| 122 | +// case 0: | ||
| 123 | +// { | ||
| 124 | +// if (self.mainHPModel.is_show_btn) { | ||
| 125 | +// return CGSizeMake(self.view.width, DS_adapt_length(262)); | ||
| 126 | +// }else { | ||
| 127 | +// return CGSizeMake(self.view.width, DS_adapt_length(262) - DS_adapt_length(50)); | ||
| 128 | +// } | ||
| 129 | +// } | ||
| 130 | +// break; | ||
| 131 | +// case 1: | ||
| 132 | +// { | ||
| 133 | +// if (self.mainHPModel.is_show_btn) { | ||
| 134 | +// return CGSizeMake(self.view.width, DS_adapt_length(145)); | ||
| 135 | +// }else { | ||
| 136 | +// return CGSizeMake(self.view.width, 0.000001); | ||
| 137 | +// } | ||
| 138 | +// } | ||
| 139 | +// break; | ||
| 140 | +// case 2: | ||
| 141 | +// { | ||
| 142 | +// if (self.mainHPModel.is_show_user) { | ||
| 143 | +// return CGSizeMake(self.view.width, DS_adapt_length(191)); | ||
| 144 | +// }else { | ||
| 145 | +// return CGSizeMake(self.view.width, 0.000001); | ||
| 146 | +// } | ||
| 147 | +// } | ||
| 148 | +// break; | ||
| 149 | +// default: | ||
| 150 | +// { | ||
| 151 | +// return CGSizeZero; | ||
| 152 | +// } | ||
| 153 | +// break; | ||
| 154 | +// } | ||
| 155 | + } | ||
| 156 | + } | ||
| 16 | 157 | ||
| 17 | //MARK: - 网络请求获取店铺详情 | 158 | //MARK: - 网络请求获取店铺详情 |
| 18 | func getShopDetailApi() | 159 | func getShopDetailApi() |
| @@ -21,14 +162,9 @@ class CNLiveDownShopDetailController:CNLiveBaseViewController{ | @@ -21,14 +162,9 @@ class CNLiveDownShopDetailController:CNLiveBaseViewController{ | ||
| 21 | CNLiveShopDetailViewModel.requestShopDetailInfo(storeId: "") { result, status in | 162 | CNLiveShopDetailViewModel.requestShopDetailInfo(storeId: "") { result, status in |
| 22 | hiddenLoading() | 163 | hiddenLoading() |
| 23 | if status == .success{ | 164 | if status == .success{ |
| 24 | - let shopDetailModel = result as! CNLiveShopDetailModel | ||
| 25 | -// if shopUserModel.type != "3"{ | ||
| 26 | -// //type 1商家或者8达人 | ||
| 27 | -// let shopConsoleModel = CNLiveShopConsoleModel() | ||
| 28 | -// shopConsoleModel.initDataSource() | ||
| 29 | -// self.dataModel = shopConsoleModel | ||
| 30 | -// self.collectionView.reloadData() | ||
| 31 | -// } | 165 | + let model = result as! CNLiveShopDetailModel |
| 166 | + self.shopDetailModel = model | ||
| 167 | + self.collectionView.reloadData() | ||
| 32 | }else if (status == .failed){ | 168 | }else if (status == .failed){ |
| 33 | // self.NetApiStatus = .apiError | 169 | // self.NetApiStatus = .apiError |
| 34 | }else if (status == .noNetwork){ | 170 | }else if (status == .noNetwork){ |
metaCode/Classes/Main/HomePage/Controller/CNMetaCodeHomePageController.swift
| @@ -385,13 +385,24 @@ class CNMetaCodeHomePageController:CNLiveBaseViewController, NewPagedFlowViewDel | @@ -385,13 +385,24 @@ class CNMetaCodeHomePageController:CNLiveBaseViewController, NewPagedFlowViewDel | ||
| 385 | bannerView?.layer.cornerRadius = 4 | 385 | bannerView?.layer.cornerRadius = 4 |
| 386 | bannerView?.layer.masksToBounds = false | 386 | bannerView?.layer.masksToBounds = false |
| 387 | } | 387 | } |
| 388 | + let identityModel = dataArray[index] as! StandListModel | ||
| 389 | + bannerView?.idModel = identityModel | ||
| 390 | + if (identityModel.auth == true){ | ||
| 391 | + bannerView?.baseScrollView.isScrollEnabled = true | ||
| 392 | + }else{ | ||
| 393 | + if (identityModel.downType == 3 || identityModel.downType == 4 || identityModel.upType == 3 || identityModel.upType == 4) | ||
| 394 | + { | ||
| 395 | +// bannerView?.baseScrollView.isScrollEnabled = false | ||
| 396 | + }else{ | ||
| 397 | + bannerView?.baseScrollView.isScrollEnabled = true | ||
| 398 | + } | ||
| 399 | + } | ||
| 400 | + | ||
| 388 | bannerView?.superScrollView = flowView.scrollView | 401 | bannerView?.superScrollView = flowView.scrollView |
| 389 | bannerView?.associatedVCView = self.view | 402 | bannerView?.associatedVCView = self.view |
| 390 | bannerView?.delegate = self | 403 | bannerView?.delegate = self |
| 391 | bannerView?.upSlideView.webView.navigationDelegate = self | 404 | bannerView?.upSlideView.webView.navigationDelegate = self |
| 392 | bannerView?.downSlideView.webView.navigationDelegate = self | 405 | bannerView?.downSlideView.webView.navigationDelegate = self |
| 393 | - let identityModel = dataArray[index] as! StandListModel | ||
| 394 | - bannerView?.idModel = identityModel | ||
| 395 | return bannerView | 406 | return bannerView |
| 396 | } | 407 | } |
| 397 | 408 |
metaCode/Classes/Main/HomePage/View/CNCustomIndexView.swift
| @@ -13,7 +13,6 @@ class CNCustomIndexTopView : UIView{ | @@ -13,7 +13,6 @@ class CNCustomIndexTopView : UIView{ | ||
| 13 | ///关闭按钮事件回调 | 13 | ///关闭按钮事件回调 |
| 14 | var closeAction: closeBlock? | 14 | var closeAction: closeBlock? |
| 15 | 15 | ||
| 16 | - | ||
| 17 | //MARK: - 懒加载 | 16 | //MARK: - 懒加载 |
| 18 | ///标题 | 17 | ///标题 |
| 19 | lazy var titleLabel: UILabel = { | 18 | lazy var titleLabel: UILabel = { |
| @@ -125,6 +124,8 @@ class CNCustomIndexView:PGIndexBannerSubiew, UIScrollViewDelegate, WJColorChange | @@ -125,6 +124,8 @@ class CNCustomIndexView:PGIndexBannerSubiew, UIScrollViewDelegate, WJColorChange | ||
| 125 | self.downSlideView.downPath = _idModel?.upPath | 124 | self.downSlideView.downPath = _idModel?.upPath |
| 126 | 125 | ||
| 127 | self.topNavView.setTitleString(title:(_idModel?.name)!) | 126 | self.topNavView.setTitleString(title:(_idModel?.name)!) |
| 127 | + | ||
| 128 | + self.colorDataArr = NSMutableArray(array: NSArray(objects: UIColor.white,KVCBackgroupColor!,HexColor(_idModel!.backgroundColor)!)) | ||
| 128 | } | 129 | } |
| 129 | 130 | ||
| 130 | } | 131 | } |
| @@ -147,7 +148,7 @@ class CNCustomIndexView:PGIndexBannerSubiew, UIScrollViewDelegate, WJColorChange | @@ -147,7 +148,7 @@ class CNCustomIndexView:PGIndexBannerSubiew, UIScrollViewDelegate, WJColorChange | ||
| 147 | 148 | ||
| 148 | ///颜色数据 | 149 | ///颜色数据 |
| 149 | lazy var colorDataArr: NSMutableArray = { | 150 | lazy var colorDataArr: NSMutableArray = { |
| 150 | - let colorDataArr = NSMutableArray(array: NSArray(objects: UIColor.white,KVCBackgroupColor!,UIColor("#004FE0")!)) | 151 | + let colorDataArr = NSMutableArray(array: NSArray(objects: UIColor.white,KVCBackgroupColor!,UIColor.yellow))//UIColor("#004FE0")! |
| 151 | 152 | ||
| 152 | return colorDataArr | 153 | return colorDataArr |
| 153 | }() | 154 | }() |
| @@ -420,8 +421,21 @@ class CNCustomIndexView:PGIndexBannerSubiew, UIScrollViewDelegate, WJColorChange | @@ -420,8 +421,21 @@ class CNCustomIndexView:PGIndexBannerSubiew, UIScrollViewDelegate, WJColorChange | ||
| 420 | } | 421 | } |
| 421 | 422 | ||
| 422 | //滑动结束 网页类型downType=1时把topNavView 放到scrollView的上层 | 423 | //滑动结束 网页类型downType=1时把topNavView 放到scrollView的上层 |
| 423 | - if (scrollView.contentOffset.y == ceil(defaultOffset*2)) && self.idModel?.downType == 1{ | ||
| 424 | - self.bringSubviewToFront(self.topNavView) | 424 | + if scrollView.contentOffset.y == ceil(defaultOffset*2) { |
| 425 | + if self.idModel?.downType == 1 { | ||
| 426 | + self.bringSubviewToFront(self.topNavView) | ||
| 427 | + self.topNavView.isHidden = false | ||
| 428 | + }else if self.idModel?.downType == 0{ | ||
| 429 | + self.topNavView.isHidden = false | ||
| 430 | + self.bringSubviewToFront(self.topNavView) | ||
| 431 | + }else{ | ||
| 432 | + self.topNavView.isHidden = true | ||
| 433 | + } | ||
| 434 | + }else{ | ||
| 435 | + self.topNavView.isHidden = true | ||
| 436 | + } | ||
| 437 | + if scrollView.contentOffset.y == ceil(defaultOffset*2){ | ||
| 438 | + | ||
| 425 | } | 439 | } |
| 426 | 440 | ||
| 427 | //下滑提醒View回到初始位置 | 441 | //下滑提醒View回到初始位置 |
metaCode/Classes/Main/HomePage/View/CNLliveShopDetailBannerCell.swift
0 → 100644
| 1 | +// | ||
| 2 | +// CNLliveShopDetailBannerCell.swift | ||
| 3 | +// metaCode | ||
| 4 | +// | ||
| 5 | +// Created by zx on 2023/11/1. | ||
| 6 | +// | ||
| 7 | + | ||
| 8 | +import Foundation | ||
| 9 | +import FSPagerView | ||
| 10 | + | ||
| 11 | +class CNLliveShopDetailBannerCell:UICollectionViewCell,FSPagerViewDataSource,FSPagerViewDelegate{ | ||
| 12 | + | ||
| 13 | + let kCNLliveShopDetailBannerCellID = "kCNLliveShopDetailBannerCellID" | ||
| 14 | + | ||
| 15 | + lazy var viewPager: FSPagerView = { | ||
| 16 | + let viewPager = FSPagerView() | ||
| 17 | + viewPager.frame = CGRect(x: 10, y: 10, width: self.contentView.width-20, height: self.contentView.height-20) | ||
| 18 | + viewPager.dataSource = self | ||
| 19 | + viewPager.delegate = self | ||
| 20 | + viewPager.register(FSPagerViewCell.self, forCellWithReuseIdentifier: kCNLliveShopDetailBannerCellID) | ||
| 21 | + //设置自动翻页事件间隔,默认值为0 (不自动翻页) | ||
| 22 | + viewPager.automaticSlidingInterval = 1.0 | ||
| 23 | + //设置页面之间的间隔距离 | ||
| 24 | + viewPager.interitemSpacing = 8.0 | ||
| 25 | + //设置可以无限翻页,默认值为false,false时从尾部向前滚动到头部再继续循环滚动,true时可以无限滚动 | ||
| 26 | + viewPager.isInfinite = true | ||
| 27 | + //设置转场的模式 | ||
| 28 | + viewPager.transformer = FSPagerViewTransformer(type: FSPagerViewTransformerType.depth) | ||
| 29 | + return viewPager | ||
| 30 | + }() | ||
| 31 | + | ||
| 32 | + //shopDetailModel | ||
| 33 | + var _shopDetailModel : CNLiveShopDetailModel? | ||
| 34 | + var shopDetailModel : CNLiveShopDetailModel? { | ||
| 35 | + get{ | ||
| 36 | + _shopDetailModel | ||
| 37 | + } | ||
| 38 | + set{ | ||
| 39 | + _shopDetailModel = newValue! | ||
| 40 | + | ||
| 41 | + } | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + override init(frame: CGRect) { | ||
| 45 | + super.init(frame: frame) | ||
| 46 | + self.backgroundColor = .clear | ||
| 47 | + self.setUI() | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + required init?(coder: NSCoder) { | ||
| 51 | + fatalError("init(coder:) has not been implemented") | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | + func setUI(){ | ||
| 55 | + self.backgroundColor = .red | ||
| 56 | + self.contentView.addSubview(self.viewPager) | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + // MARK: - FSPagerViewDataSource | ||
| 60 | + func numberOfItems(in pagerView: FSPagerView) -> Int { | ||
| 61 | + return (self.shopDetailModel?.banner.count)! | ||
| 62 | + } | ||
| 63 | + func pagerView(_ pagerView: FSPagerView, cellForItemAt index: Int) -> FSPagerViewCell { | ||
| 64 | + let cell = pagerView.dequeueReusableCell(withReuseIdentifier: kCNLliveShopDetailBannerCellID, at: index) | ||
| 65 | + let imgUrl = self.shopDetailModel?.banner[index].simg! | ||
| 66 | + cell.imageView?.kf.setImage(with: URL(string: imgUrl!)) | ||
| 67 | + return cell | ||
| 68 | + } | ||
| 69 | +} |
metaCode/Classes/Main/HomePage/View/CNUpSlideView.swift
| @@ -27,7 +27,7 @@ class CNUpSlideView:UIView{ | @@ -27,7 +27,7 @@ class CNUpSlideView:UIView{ | ||
| 27 | return webView | 27 | return webView |
| 28 | }() | 28 | }() |
| 29 | 29 | ||
| 30 | - var upSlideVC: CNLiveDownShopDetailController = { | 30 | + lazy var upSlideVC: CNLiveDownShopDetailController = { |
| 31 | let upSlideVC = CNLiveDownShopDetailController.init() | 31 | let upSlideVC = CNLiveDownShopDetailController.init() |
| 32 | upSlideVC.view.width = KSreenWidth | 32 | upSlideVC.view.width = KSreenWidth |
| 33 | upSlideVC.view.height = KSreenHeight | 33 | upSlideVC.view.height = KSreenHeight |
metaCode/Classes/Main/Model/CNLiveShopDetailModel.swift
| @@ -93,79 +93,93 @@ class CNLiveShopDetailDynamicModel:BaseModel{ | @@ -93,79 +93,93 @@ class CNLiveShopDetailDynamicModel:BaseModel{ | ||
| 93 | ///用户id | 93 | ///用户id |
| 94 | var uid: String? | 94 | var uid: String? |
| 95 | ///发布时间 | 95 | ///发布时间 |
| 96 | - var total_money: String? | ||
| 97 | - ///总余额 | ||
| 98 | - var total_money: String? | ||
| 99 | - ///总余额 | ||
| 100 | - var total_money: String? | ||
| 101 | - /** | ||
| 102 | - | ||
| 103 | - */ | ||
| 104 | - @property (nonatomic,assign) NSTimeInterval addtime; | ||
| 105 | - /** | ||
| 106 | - 经度 | ||
| 107 | - */ | ||
| 108 | - @property (nonatomic,copy) NSString * longitude; | ||
| 109 | - /** | ||
| 110 | - 纬度 | ||
| 111 | - */ | ||
| 112 | - @property (nonatomic,copy) NSString * latitude; | ||
| 113 | - /** | ||
| 114 | - 浏览数 | ||
| 115 | - */ | ||
| 116 | - @property (nonatomic,assign) NSUInteger pv; | ||
| 117 | - /** | ||
| 118 | - 点赞数 | ||
| 119 | - */ | ||
| 120 | - @property (nonatomic,assign) NSUInteger upper; | ||
| 121 | - /** | ||
| 122 | - 评论数 | ||
| 123 | - */ | ||
| 124 | - @property (nonatomic,assign) NSUInteger comment; | ||
| 125 | - /** | ||
| 126 | - 定位 | ||
| 127 | - */ | ||
| 128 | - @property (nonatomic,copy) NSString * location; | ||
| 129 | - /** | ||
| 130 | - 视频 | ||
| 131 | - */ | ||
| 132 | - @property (nonatomic,copy) NSString * video; | ||
| 133 | - /** | ||
| 134 | - 是否点赞 1点赞 0没点 | ||
| 135 | - */ | ||
| 136 | - @property (nonatomic,assign) BOOL is_upper; | ||
| 137 | - /** | ||
| 138 | - 是否显示 1显示 0隐藏 | ||
| 139 | - */ | ||
| 140 | - @property (nonatomic,assign) BOOL state; | ||
| 141 | - /** | ||
| 142 | - 商品id | ||
| 143 | - */ | ||
| 144 | - @property (nonatomic,copy) NSString * goods_id; | ||
| 145 | - /** | ||
| 146 | - 视频封面图 | ||
| 147 | - */ | ||
| 148 | - @property (nonatomic,copy) NSString * video_img; | ||
| 149 | - /** | ||
| 150 | - 封面图数组 | ||
| 151 | - */ | ||
| 152 | - @property (nonatomic,copy) NSArray<NSString*> * img; | ||
| 153 | - /** | ||
| 154 | - 达人信息 | ||
| 155 | - */ | ||
| 156 | - @property (nonatomic,strong) CNDSMainHPDarenDynamicShopUserModel * shop_user; | ||
| 157 | - /** | ||
| 158 | - 热门评论 | ||
| 159 | - */ | ||
| 160 | - @property (nonatomic,strong) CNDSMainHPDarenDynamicCommentModel * comment_content; | ||
| 161 | - /** | ||
| 162 | - 商品 | ||
| 163 | - */ | ||
| 164 | - @property (nonatomic,strong) CNDSMainHPDarenDynamicGoodsModel * goods; | 96 | + var addtime: Double? |
| 97 | + ///经度 | ||
| 98 | + var longitude: String? | ||
| 99 | + ///纬度 | ||
| 100 | + var latitude: String? | ||
| 101 | + ///浏览数 | ||
| 102 | + var pv: Int = 0 | ||
| 103 | + ///点赞数 | ||
| 104 | + var upper: Int = 0 | ||
| 105 | + ///评论数 | ||
| 106 | + var comment: Int = 0 | ||
| 107 | + ///定位 | ||
| 108 | + var location: String? | ||
| 109 | + ///视频 | ||
| 110 | + var video: String? | ||
| 111 | + ///是否点赞 1点赞 0没点 | ||
| 112 | + var is_upper: Bool? | ||
| 113 | + ///是否显示 1显示 0隐藏 | ||
| 114 | + var state: Bool? | ||
| 115 | + ///商品id | ||
| 116 | + var goods_id: String? | ||
| 117 | + ///视频封面图 | ||
| 118 | + var video_img: String? | ||
| 119 | + ///封面图数组 | ||
| 120 | + var img = [Array<String>]() | ||
| 121 | + ///达人信息 | ||
| 122 | + var shop_user: CNLiveShopDetailDynamicShopUserModel? | ||
| 123 | + ///热门评论 | ||
| 124 | + var comment_content: CNLiveShopDetailDynamicCommentModel? | ||
| 125 | + ///商品 | ||
| 126 | + var goods: CNLiveShopDetailDynamicGoodsModel? | ||
| 127 | +} | ||
| 128 | + | ||
| 129 | +// MARK: - 达人数据 | ||
| 130 | +class CNLiveShopDetailDynamicShopUserModel:BaseModel{ | ||
| 131 | + ///店铺id | ||
| 132 | + var id: String? | ||
| 133 | + ///达人名称 | ||
| 134 | + var title: String? | ||
| 135 | + ///达人头像 | ||
| 136 | + var logo: String? | ||
| 137 | + ///达人id | ||
| 138 | + var uid: String? | ||
| 139 | +} | ||
| 140 | + | ||
| 141 | +// MARK: - 热门评论 | ||
| 142 | +class CNLiveShopDetailDynamicCommentModel:BaseModel{ | ||
| 143 | + ///评论id | ||
| 144 | + var id: String? | ||
| 145 | + ///用户id | ||
| 146 | + var uid: String? | ||
| 147 | + ///评论内容 | ||
| 148 | + var content: String? | ||
| 149 | + ///评论时间 | ||
| 150 | + var addtime: Double? | ||
| 151 | + ///点赞数 | ||
| 152 | + var upper: Int = 0 | ||
| 153 | +} | ||
| 154 | + | ||
| 155 | +// MARK: - 商品 | ||
| 156 | +class CNLiveShopDetailDynamicGoodsModel:BaseModel{ | ||
| 157 | + ///商品id | ||
| 158 | + var id: String? | ||
| 159 | + ///商品标题 | ||
| 160 | + var title: String? | ||
| 161 | + ///1普通商品 2文创商品 | ||
| 162 | + var shop_type: String? | ||
| 163 | + /// | ||
| 164 | + var type: String? | ||
| 165 | + /// | ||
| 166 | + var to: String? | ||
| 167 | + ///现价 | ||
| 168 | + var price: String? | ||
| 169 | + ///原价 | ||
| 170 | + var prices: String? | ||
| 171 | + ///广告语 | ||
| 172 | + var ads: String? | ||
| 173 | + ///商品封面 | ||
| 174 | + var simg: String? | ||
| 165 | } | 175 | } |
| 166 | 176 | ||
| 177 | +// MARK: - 餐厅店铺信息 | ||
| 167 | class CNLiveShopDetailFoodsShopModel:BaseModel{ | 178 | class CNLiveShopDetailFoodsShopModel:BaseModel{ |
| 168 | - | 179 | + ///店铺名称 |
| 180 | + var title: String? | ||
| 181 | + ///店铺id | ||
| 182 | + var id: String? | ||
| 169 | } | 183 | } |
| 170 | 184 | ||
| 171 | 185 |
metaCode/Classes/Main/Util/CNLiveAdaptTool.swift
0 → 100644
| 1 | +// | ||
| 2 | +// CNLiveAdaptTool.swift | ||
| 3 | +// metaCode | ||
| 4 | +// | ||
| 5 | +// Created by zx on 2023/11/2. | ||
| 6 | +// | ||
| 7 | + | ||
| 8 | +import Foundation | ||
| 9 | + | ||
| 10 | +class CNLiveAdaptTool:NSObject{ | ||
| 11 | + class func adaptLength(length:CGFloat) -> CGFloat{ | ||
| 12 | + | ||
| 13 | + let multiple = KSreenWidth / 375.0 | ||
| 14 | + let f_adapt_length = floor(length * multiple) | ||
| 15 | + return f_adapt_length | ||
| 16 | + } | ||
| 17 | +} |
metaCode/Classes/Other/AppDelegate.swift
| @@ -69,7 +69,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { | @@ -69,7 +69,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { | ||
| 69 | let p : Dictionary = ["platform_id":kAppBundleID,"uuid":uuid,"plat":"i","ver":ver,"appId":APPId,"timestamp":String(NSNumber(floatLiteral: Date().timeIntervalSince1970).intValue),"clientPlat":"i","frmId":"ios"] | 69 | let p : Dictionary = ["platform_id":kAppBundleID,"uuid":uuid,"plat":"i","ver":ver,"appId":APPId,"timestamp":String(NSNumber(floatLiteral: Date().timeIntervalSince1970).intValue),"clientPlat":"i","frmId":"ios"] |
| 70 | CNLiveNetworking.setupDefaultParam(p) | 70 | CNLiveNetworking.setupDefaultParam(p) |
| 71 | 71 | ||
| 72 | - let shop_dic : Dictionary = ["Phone-Model":"iPhone","Uid":UserInfoManager.shared.userInfo.uid ?? "","CFBundleShortVersionString":ver,"Shop-Version":"0.6.2"] | 72 | + let shop_dic : Dictionary = ["Phone-Model":"iPhone","Uid":"","CFBundleShortVersionString":ver,"Shop-Version":"0.6.2"] |
| 73 | CNLiveNetworking.setupDSShopParam(shop_dic) | 73 | CNLiveNetworking.setupDSShopParam(shop_dic) |
| 74 | 74 | ||
| 75 | CNLiveNetworking.setupShowDataResult(false) | 75 | CNLiveNetworking.setupShowDataResult(false) |