Commit 2e0c48e60008acc5d7a90b028df01f01741e92f4
1 parent
9a46072b
首页-在追短剧+全部短剧及详情页的UI调整
Showing
19 changed files
with
781 additions
and
234 deletions
metaCode.xcodeproj/project.pbxproj
| @@ -90,6 +90,8 @@ | @@ -90,6 +90,8 @@ | ||
| 90 | 1938BD3D2B4BDD4B00390A34 /* CNLiveAlbumCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1938BD3C2B4BDD4B00390A34 /* CNLiveAlbumCell.swift */; }; | 90 | 1938BD3D2B4BDD4B00390A34 /* CNLiveAlbumCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1938BD3C2B4BDD4B00390A34 /* CNLiveAlbumCell.swift */; }; |
| 91 | 1938BD3F2B4BE7C500390A34 /* CNLiveAlbumMsgModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1938BD3E2B4BE7C500390A34 /* CNLiveAlbumMsgModel.swift */; }; | 91 | 1938BD3F2B4BE7C500390A34 /* CNLiveAlbumMsgModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1938BD3E2B4BE7C500390A34 /* CNLiveAlbumMsgModel.swift */; }; |
| 92 | 1938BD412B4BEC6900390A34 /* CNLiveAlbumListModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1938BD402B4BEC6900390A34 /* CNLiveAlbumListModel.swift */; }; | 92 | 1938BD412B4BEC6900390A34 /* CNLiveAlbumListModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1938BD402B4BEC6900390A34 /* CNLiveAlbumListModel.swift */; }; |
| 93 | + 1938BD432B4E34B200390A34 /* CNHomepageDuanJuDetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1938BD422B4E34B200390A34 /* CNHomepageDuanJuDetailViewController.swift */; }; | ||
| 94 | + 1938BD452B4E49CA00390A34 /* CNLiveDuanjuTitleCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1938BD442B4E49CA00390A34 /* CNLiveDuanjuTitleCell.swift */; }; | ||
| 93 | 19565EC02AF4DE0E007D6727 /* CNLiveShopDetailBtnsCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19565EBF2AF4DE0E007D6727 /* CNLiveShopDetailBtnsCell.swift */; }; | 95 | 19565EC02AF4DE0E007D6727 /* CNLiveShopDetailBtnsCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19565EBF2AF4DE0E007D6727 /* CNLiveShopDetailBtnsCell.swift */; }; |
| 94 | 19565EC22AF616CA007D6727 /* CNLiveShopDetailOrderAssetCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19565EC12AF616CA007D6727 /* CNLiveShopDetailOrderAssetCell.swift */; }; | 96 | 19565EC22AF616CA007D6727 /* CNLiveShopDetailOrderAssetCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19565EC12AF616CA007D6727 /* CNLiveShopDetailOrderAssetCell.swift */; }; |
| 95 | 19565EC52AF8AD1F007D6727 /* CNLiveShopProductManagerController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19565EC42AF8AD1F007D6727 /* CNLiveShopProductManagerController.swift */; }; | 97 | 19565EC52AF8AD1F007D6727 /* CNLiveShopProductManagerController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19565EC42AF8AD1F007D6727 /* CNLiveShopProductManagerController.swift */; }; |
| @@ -342,6 +344,8 @@ | @@ -342,6 +344,8 @@ | ||
| 342 | 1938BD3C2B4BDD4B00390A34 /* CNLiveAlbumCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveAlbumCell.swift; sourceTree = "<group>"; }; | 344 | 1938BD3C2B4BDD4B00390A34 /* CNLiveAlbumCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveAlbumCell.swift; sourceTree = "<group>"; }; |
| 343 | 1938BD3E2B4BE7C500390A34 /* CNLiveAlbumMsgModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveAlbumMsgModel.swift; sourceTree = "<group>"; }; | 345 | 1938BD3E2B4BE7C500390A34 /* CNLiveAlbumMsgModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveAlbumMsgModel.swift; sourceTree = "<group>"; }; |
| 344 | 1938BD402B4BEC6900390A34 /* CNLiveAlbumListModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveAlbumListModel.swift; sourceTree = "<group>"; }; | 346 | 1938BD402B4BEC6900390A34 /* CNLiveAlbumListModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveAlbumListModel.swift; sourceTree = "<group>"; }; |
| 347 | + 1938BD422B4E34B200390A34 /* CNHomepageDuanJuDetailViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNHomepageDuanJuDetailViewController.swift; sourceTree = "<group>"; }; | ||
| 348 | + 1938BD442B4E49CA00390A34 /* CNLiveDuanjuTitleCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveDuanjuTitleCell.swift; sourceTree = "<group>"; }; | ||
| 345 | 19565EBF2AF4DE0E007D6727 /* CNLiveShopDetailBtnsCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopDetailBtnsCell.swift; sourceTree = "<group>"; }; | 349 | 19565EBF2AF4DE0E007D6727 /* CNLiveShopDetailBtnsCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopDetailBtnsCell.swift; sourceTree = "<group>"; }; |
| 346 | 19565EC12AF616CA007D6727 /* CNLiveShopDetailOrderAssetCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopDetailOrderAssetCell.swift; sourceTree = "<group>"; }; | 350 | 19565EC12AF616CA007D6727 /* CNLiveShopDetailOrderAssetCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopDetailOrderAssetCell.swift; sourceTree = "<group>"; }; |
| 347 | 19565EC42AF8AD1F007D6727 /* CNLiveShopProductManagerController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopProductManagerController.swift; sourceTree = "<group>"; }; | 351 | 19565EC42AF8AD1F007D6727 /* CNLiveShopProductManagerController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopProductManagerController.swift; sourceTree = "<group>"; }; |
| @@ -739,6 +743,7 @@ | @@ -739,6 +743,7 @@ | ||
| 739 | isa = PBXGroup; | 743 | isa = PBXGroup; |
| 740 | children = ( | 744 | children = ( |
| 741 | 1938BD292B48014E00390A34 /* CNHomepageDetailViewController.swift */, | 745 | 1938BD292B48014E00390A34 /* CNHomepageDetailViewController.swift */, |
| 746 | + 1938BD422B4E34B200390A34 /* CNHomepageDuanJuDetailViewController.swift */, | ||
| 742 | 1938BD2B2B4801A700390A34 /* CNHomePageAnimationTransition.swift */, | 747 | 1938BD2B2B4801A700390A34 /* CNHomePageAnimationTransition.swift */, |
| 743 | 1938BD2D2B48021E00390A34 /* CNHomePageBaseNavigationController.swift */, | 748 | 1938BD2D2B48021E00390A34 /* CNHomePageBaseNavigationController.swift */, |
| 744 | ); | 749 | ); |
| @@ -748,6 +753,7 @@ | @@ -748,6 +753,7 @@ | ||
| 748 | 1938BD392B4BDC2900390A34 /* HomepageDetail */ = { | 753 | 1938BD392B4BDC2900390A34 /* HomepageDetail */ = { |
| 749 | isa = PBXGroup; | 754 | isa = PBXGroup; |
| 750 | children = ( | 755 | children = ( |
| 756 | + 1938BD442B4E49CA00390A34 /* CNLiveDuanjuTitleCell.swift */, | ||
| 751 | 1938BD372B4BDC2500390A34 /* CNLiveAlbumImageCell.swift */, | 757 | 1938BD372B4BDC2500390A34 /* CNLiveAlbumImageCell.swift */, |
| 752 | 1938BD3C2B4BDD4B00390A34 /* CNLiveAlbumCell.swift */, | 758 | 1938BD3C2B4BDD4B00390A34 /* CNLiveAlbumCell.swift */, |
| 753 | ); | 759 | ); |
| @@ -1648,6 +1654,7 @@ | @@ -1648,6 +1654,7 @@ | ||
| 1648 | 191733562B2FE855007BCC04 /* CNLivePickerReusingModel.swift in Sources */, | 1654 | 191733562B2FE855007BCC04 /* CNLivePickerReusingModel.swift in Sources */, |
| 1649 | 790D019F2A2DD66E00C5978D /* CNLiveLoginViewModel.swift in Sources */, | 1655 | 790D019F2A2DD66E00C5978D /* CNLiveLoginViewModel.swift in Sources */, |
| 1650 | 1926C2912AE0FD4500C71DC3 /* CNLiveDownSlideModel.swift in Sources */, | 1656 | 1926C2912AE0FD4500C71DC3 /* CNLiveDownSlideModel.swift in Sources */, |
| 1657 | + 1938BD452B4E49CA00390A34 /* CNLiveDuanjuTitleCell.swift in Sources */, | ||
| 1651 | 7C7C62F62A4D72E9007A912E /* CNLiveIdentityDB.swift in Sources */, | 1658 | 7C7C62F62A4D72E9007A912E /* CNLiveIdentityDB.swift in Sources */, |
| 1652 | 19CC4D4F2ADD0FC200308E2A /* CNUpSlideDetailScrollView.swift in Sources */, | 1659 | 19CC4D4F2ADD0FC200308E2A /* CNUpSlideDetailScrollView.swift in Sources */, |
| 1653 | 191733642B392011007BCC04 /* CNLiveShopGoodsSearchViewController.swift in Sources */, | 1660 | 191733642B392011007BCC04 /* CNLiveShopGoodsSearchViewController.swift in Sources */, |
| @@ -1762,6 +1769,7 @@ | @@ -1762,6 +1769,7 @@ | ||
| 1762 | 19FA201B2AE60423001F7186 /* CNLiveDownSlideModelLayout.swift in Sources */, | 1769 | 19FA201B2AE60423001F7186 /* CNLiveDownSlideModelLayout.swift in Sources */, |
| 1763 | 7C4931312A2F142F000E44B4 /* CNHomePageBackgroupView.swift in Sources */, | 1770 | 7C4931312A2F142F000E44B4 /* CNHomePageBackgroupView.swift in Sources */, |
| 1764 | 19BB1FF22AF21A950094D962 /* CNLliveShopDetailBannerCell.swift in Sources */, | 1771 | 19BB1FF22AF21A950094D962 /* CNLliveShopDetailBannerCell.swift in Sources */, |
| 1772 | + 1938BD432B4E34B200390A34 /* CNHomepageDuanJuDetailViewController.swift in Sources */, | ||
| 1765 | 790D018B2A2D8B3300C5978D /* CNLiveLoginViewController.swift in Sources */, | 1773 | 790D018B2A2D8B3300C5978D /* CNLiveLoginViewController.swift in Sources */, |
| 1766 | 19CC4D562ADD19C200308E2A /* String+Extension.swift in Sources */, | 1774 | 19CC4D562ADD19C200308E2A /* String+Extension.swift in Sources */, |
| 1767 | 7905BB492AB0588B0089BC50 /* CNLiveMineAuthResultViewController.swift in Sources */, | 1775 | 7905BB492AB0588B0089BC50 /* CNLiveMineAuthResultViewController.swift in Sources */, |
metaCode/Classes/Common/Base/CNLiveBaseTabBarViewController.swift
| @@ -64,7 +64,7 @@ class CNLiveBaseTabBarViewController: UITabBarController | @@ -64,7 +64,7 @@ class CNLiveBaseTabBarViewController: UITabBarController | ||
| 64 | 64 | ||
| 65 | creatTabbarView(viewController: homeVC, image: "tabbar_hoem_icon_default", selectImage: "tabbar_hoem_icon_selected", title: "首页") | 65 | creatTabbarView(viewController: homeVC, image: "tabbar_hoem_icon_default", selectImage: "tabbar_hoem_icon_selected", title: "首页") |
| 66 | 66 | ||
| 67 | - creatTabbarView(viewController: authVC, image: "tabbar_hoem_icon_default", selectImage: "tabbar_hoem_icon_selected", title: "认证") | 67 | + creatTabbarView(viewController: authVC, image: "tabbar_authentication_unSelect", selectImage: "tabbar_authentication", title: "认证") |
| 68 | 68 | ||
| 69 | creatTabbarView(viewController: mineVC, image: "tabbar_mine_icon_default", selectImage: "tabbar_mine_icon_selected", title: "我的") | 69 | creatTabbarView(viewController: mineVC, image: "tabbar_mine_icon_default", selectImage: "tabbar_mine_icon_selected", title: "我的") |
| 70 | 70 |
metaCode/Classes/Main/HomePages/Controller/AuthController/CNLiveAuthViewController.swift
| @@ -28,7 +28,8 @@ class CNLiveAuthViewController:CNLiveBaseViewController,UITableViewDelegate,UITa | @@ -28,7 +28,8 @@ class CNLiveAuthViewController:CNLiveBaseViewController,UITableViewDelegate,UITa | ||
| 28 | var totolNum = 0//一共显示多少行cell | 28 | var totolNum = 0//一共显示多少行cell |
| 29 | 29 | ||
| 30 | var selectedCell: CNDownSlideSingleCourseCell? | 30 | var selectedCell: CNDownSlideSingleCourseCell? |
| 31 | - | 31 | + var selectedDuanjuCell: CNLiveHomePageDuanJuCell? |
| 32 | + | ||
| 32 | var statusBarShouldBeHidden = false | 33 | var statusBarShouldBeHidden = false |
| 33 | //we need to set `View controller-based status bar appearance = YES` in info.plist. | 34 | //we need to set `View controller-based status bar appearance = YES` in info.plist. |
| 34 | //so we can be able to hide statusBar. | 35 | //so we can be able to hide statusBar. |
| @@ -40,16 +41,6 @@ class CNLiveAuthViewController:CNLiveBaseViewController,UITableViewDelegate,UITa | @@ -40,16 +41,6 @@ class CNLiveAuthViewController:CNLiveBaseViewController,UITableViewDelegate,UITa | ||
| 40 | return .slide | 41 | return .slide |
| 41 | } | 42 | } |
| 42 | 43 | ||
| 43 | - var _downPath:String? | ||
| 44 | - var downPath:String? { | ||
| 45 | - get{ | ||
| 46 | - return _downPath | ||
| 47 | - } | ||
| 48 | - set{ | ||
| 49 | - _downPath = newValue! | ||
| 50 | - } | ||
| 51 | - } | ||
| 52 | - | ||
| 53 | // MARK: - 懒加载 | 44 | // MARK: - 懒加载 |
| 54 | ///数据源 | 45 | ///数据源 |
| 55 | lazy var dataArray: NSMutableArray = { | 46 | lazy var dataArray: NSMutableArray = { |
| @@ -57,6 +48,12 @@ class CNLiveAuthViewController:CNLiveBaseViewController,UITableViewDelegate,UITa | @@ -57,6 +48,12 @@ class CNLiveAuthViewController:CNLiveBaseViewController,UITableViewDelegate,UITa | ||
| 57 | return dataArray | 48 | return dataArray |
| 58 | }() | 49 | }() |
| 59 | 50 | ||
| 51 | + //短剧的数据源 | ||
| 52 | + lazy var duanjuDataArray: NSMutableArray = { | ||
| 53 | + var dataArray = NSMutableArray() | ||
| 54 | + return dataArray | ||
| 55 | + }() | ||
| 56 | + | ||
| 60 | override func viewWillAppear(_ animated: Bool) { | 57 | override func viewWillAppear(_ animated: Bool) { |
| 61 | super.viewWillAppear(animated) | 58 | super.viewWillAppear(animated) |
| 62 | self.updateStatusBarAndTabbarFrame(visible: true) | 59 | self.updateStatusBarAndTabbarFrame(visible: true) |
| @@ -115,6 +112,20 @@ class CNLiveAuthViewController:CNLiveBaseViewController,UITableViewDelegate,UITa | @@ -115,6 +112,20 @@ class CNLiveAuthViewController:CNLiveBaseViewController,UITableViewDelegate,UITa | ||
| 115 | else { | 112 | else { |
| 116 | return CNLiveHomePageDuanJuCell() | 113 | return CNLiveHomePageDuanJuCell() |
| 117 | } | 114 | } |
| 115 | + cell.setModelArr(modelArr: self.duanjuDataArray) | ||
| 116 | + cell.DuanJUCellSelectedCallBack = { | ||
| 117 | + duanJuCell in | ||
| 118 | + self.selectedDuanjuCell = duanJuCell | ||
| 119 | + | ||
| 120 | + let detailVC = CNHomePageBaseNavigationController(rootViewController:CNHomepageDuanJuDetailViewController(cell: duanJuCell)) | ||
| 121 | + | ||
| 122 | + detailVC.dismissClosure = { [weak self] in | ||
| 123 | + guard let StrongSelf = self else { return } | ||
| 124 | + StrongSelf.updateStatusBarAndTabbarFrame(visible: true) | ||
| 125 | + } | ||
| 126 | + self.updateStatusBarAndTabbarFrame(visible: false) | ||
| 127 | + self.present(detailVC, animated: true, completion: nil) | ||
| 128 | + } | ||
| 118 | return cell | 129 | return cell |
| 119 | }else{ | 130 | }else{ |
| 120 | let slideModel = self.dataArray[indexPath.row] as! CNLiveDownSlideModel | 131 | let slideModel = self.dataArray[indexPath.row] as! CNLiveDownSlideModel |
| @@ -189,6 +200,18 @@ class CNLiveAuthViewController:CNLiveBaseViewController,UITableViewDelegate,UITa | @@ -189,6 +200,18 @@ class CNLiveAuthViewController:CNLiveBaseViewController,UITableViewDelegate,UITa | ||
| 189 | 200 | ||
| 190 | func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { | 201 | func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { |
| 191 | if self.isHaveDuanJU && indexPath.section == 0{ | 202 | if self.isHaveDuanJU && indexPath.section == 0{ |
| 203 | + //点击在追短剧 | ||
| 204 | + guard let cell = tableView.cellForRow(at: indexPath) as? CNLiveHomePageDuanJuCell else { return } | ||
| 205 | + selectedDuanjuCell = cell | ||
| 206 | + | ||
| 207 | + let detailVC = CNHomePageBaseNavigationController(rootViewController:CNHomepageDuanJuDetailViewController(cell: selectedDuanjuCell!)) | ||
| 208 | + | ||
| 209 | + detailVC.dismissClosure = { [weak self] in | ||
| 210 | + guard let StrongSelf = self else { return } | ||
| 211 | + StrongSelf.updateStatusBarAndTabbarFrame(visible: true) | ||
| 212 | + } | ||
| 213 | + updateStatusBarAndTabbarFrame(visible: false) | ||
| 214 | + present(detailVC, animated: true, completion: nil) | ||
| 192 | 215 | ||
| 193 | }else{ | 216 | }else{ |
| 194 | 217 | ||
| @@ -201,7 +224,7 @@ class CNLiveAuthViewController:CNLiveBaseViewController,UITableViewDelegate,UITa | @@ -201,7 +224,7 @@ class CNLiveAuthViewController:CNLiveBaseViewController,UITableViewDelegate,UITa | ||
| 201 | }else if slideModel.type == SlideModelTypeAllCourse12{ | 224 | }else if slideModel.type == SlideModelTypeAllCourse12{ |
| 202 | guard let cell = tableView.cellForRow(at: indexPath) as? CNDownSlideSingleCourseCell else { return } | 225 | guard let cell = tableView.cellForRow(at: indexPath) as? CNDownSlideSingleCourseCell else { return } |
| 203 | selectedCell = cell | 226 | selectedCell = cell |
| 204 | - let detailVC = CNSlideBaseNavigationController(rootViewController: CNUpSlideDetailViewController(cell: cell,slideModel: slideModel)) | 227 | + let detailVC = CNHomePageBaseNavigationController(rootViewController: CNHomepageDetailViewController(cell: cell,slideModel: slideModel)) |
| 205 | detailVC.dismissClosure = { [weak self] in | 228 | detailVC.dismissClosure = { [weak self] in |
| 206 | guard let StrongSelf = self else { return } | 229 | guard let StrongSelf = self else { return } |
| 207 | StrongSelf.updateStatusBarAndTabbarFrame(visible: true) | 230 | StrongSelf.updateStatusBarAndTabbarFrame(visible: true) |
| @@ -227,7 +250,8 @@ class CNLiveAuthViewController:CNLiveBaseViewController,UITableViewDelegate,UITa | @@ -227,7 +250,8 @@ class CNLiveAuthViewController:CNLiveBaseViewController,UITableViewDelegate,UITa | ||
| 227 | 250 | ||
| 228 | func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { | 251 | func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { |
| 229 | if self.isHaveDuanJU && indexPath.section == 0{ | 252 | if self.isHaveDuanJU && indexPath.section == 0{ |
| 230 | - return 300 | 253 | + //标题55+n个cell*(45+15*2)+首尾15 |
| 254 | + return CGFloat(self.duanjuDataArray.count)*(45+15*2)+CGFloat(55)+15+15 | ||
| 231 | }else{ | 255 | }else{ |
| 232 | let slideModel = self.dataArray[indexPath.row] as! CNLiveDownSlideModel | 256 | let slideModel = self.dataArray[indexPath.row] as! CNLiveDownSlideModel |
| 233 | return CGFloat(slideModel.cellH) | 257 | return CGFloat(slideModel.cellH) |
| @@ -250,23 +274,33 @@ class CNLiveAuthViewController:CNLiveBaseViewController,UITableViewDelegate,UITa | @@ -250,23 +274,33 @@ class CNLiveAuthViewController:CNLiveBaseViewController,UITableViewDelegate,UITa | ||
| 250 | for listModel in homePageListMdls { | 274 | for listModel in homePageListMdls { |
| 251 | if listModel.type == 3{ | 275 | if listModel.type == 3{ |
| 252 | //在追短剧 | 276 | //在追短剧 |
| 253 | - self.isHaveDuanJU = true | 277 | + self.getMyAlbumCollection(page: 1) |
| 254 | }else if listModel.type == 1{ | 278 | }else if listModel.type == 1{ |
| 255 | //页面 | 279 | //页面 |
| 256 | self.getPageApi(pageID: listModel.content) | 280 | self.getPageApi(pageID: listModel.content) |
| 257 | } | 281 | } |
| 258 | } | 282 | } |
| 259 | }else{ | 283 | }else{ |
| 260 | - | 284 | + self.getHomePageConfigListApi() |
| 261 | } | 285 | } |
| 262 | } | 286 | } |
| 263 | } | 287 | } |
| 264 | 288 | ||
| 265 | //我的专辑收藏--在追短剧 | 289 | //我的专辑收藏--在追短剧 |
| 266 | - func getMyAlbumCollection(){ | ||
| 267 | - CNLiveHomePageViewModel.requestGetHomePage { result, status in | 290 | + func getMyAlbumCollection(page:NSInteger){ |
| 291 | + CNLiveHomePageViewModel.requestGetHomePageMyAlbum(page: page){ result, status in | ||
| 268 | if status == .success{ | 292 | if status == .success{ |
| 269 | - | 293 | + let arr = result as! Array<CNLiveAlbumMsgModel> |
| 294 | + if arr.count>0{ | ||
| 295 | + //显示在追短剧cell | ||
| 296 | + self.isHaveDuanJU = true | ||
| 297 | + self.duanjuDataArray = NSMutableArray(array: arr) | ||
| 298 | + }else{ | ||
| 299 | + //隐藏在追短剧cell | ||
| 300 | + self.isHaveDuanJU = false | ||
| 301 | + } | ||
| 302 | + self.tableView.reloadData() | ||
| 303 | + | ||
| 270 | }else{ | 304 | }else{ |
| 271 | 305 | ||
| 272 | } | 306 | } |
metaCode/Classes/Main/HomePages/Controller/AuthController/push相关/CNHomePageAnimationTransition.swift
| @@ -39,26 +39,47 @@ extension CNHomePageAnimationTransition: UIViewControllerAnimatedTransitioning { | @@ -39,26 +39,47 @@ extension CNHomePageAnimationTransition: UIViewControllerAnimatedTransitioning { | ||
| 39 | let fromNavi = fromVCtemp.viewControllers![0] as! CNLiveBaseNavigationController | 39 | let fromNavi = fromVCtemp.viewControllers![0] as! CNLiveBaseNavigationController |
| 40 | let fromVC = fromNavi.viewControllers.first as! CNLiveAuthViewController | 40 | let fromVC = fromNavi.viewControllers.first as! CNLiveAuthViewController |
| 41 | guard let toNaviVC = transitionContext.viewController(forKey: .to) as? CNHomePageBaseNavigationController else { return } | 41 | guard let toNaviVC = transitionContext.viewController(forKey: .to) as? CNHomePageBaseNavigationController else { return } |
| 42 | - guard let selectedCell = fromVC.selectedCell else { return } | ||
| 43 | - let toVC = toNaviVC.topViewController as! CNHomepageDetailViewController | ||
| 44 | - let frame = selectedCell.convert(selectedCell.bgBackView.frame, to: fromVC.view) | ||
| 45 | - //2.Set presentation original size. | ||
| 46 | - toVC.view.frame = frame | ||
| 47 | - toVC.scrollView.imageView.frame.size.width = GlobalConstants.todayCardSize.width | ||
| 48 | - toVC.scrollView.imageView.frame.size.height = GlobalConstants.todayCardSize.height | ||
| 49 | - | ||
| 50 | - containerView.addSubview(toNaviVC.view) | ||
| 51 | - | ||
| 52 | - //3.Change original size to final size with animation. | ||
| 53 | - UIView.animate(withDuration: transitonDuration, delay: 0, usingSpringWithDamping: 0.5, initialSpringVelocity: 0, options: [], animations: { | ||
| 54 | - toVC.view.frame = UIScreen.main.bounds | ||
| 55 | - toVC.scrollView.imageView.frame.size.width = KSreenWidth | ||
| 56 | - toVC.scrollView.imageView.frame.size.height = KSreenWidth*DownSlideSingleCourseImgH/DownSlideSingleCourseW | ||
| 57 | - toVC.closeBtn.alpha = 1 | 42 | + if toNaviVC.topViewController is CNHomepageDetailViewController{ |
| 43 | + guard let selectedCell = fromVC.selectedCell else { return } | ||
| 44 | + let toVC = toNaviVC.topViewController as! CNHomepageDetailViewController | ||
| 45 | + let frame = selectedCell.convert(selectedCell.bgBackView.frame, to: fromVC.view) | ||
| 46 | + //2.Set presentation original size. | ||
| 47 | + toVC.view.frame = frame | ||
| 48 | + toVC.scrollView.imageView.frame.size.width = GlobalConstants.todayCardSize.width | ||
| 49 | + toVC.scrollView.imageView.frame.size.height = GlobalConstants.todayCardSize.height | ||
| 50 | + | ||
| 51 | + containerView.addSubview(toNaviVC.view) | ||
| 52 | + | ||
| 53 | + //3.Change original size to final size with animation. | ||
| 54 | + UIView.animate(withDuration: transitonDuration, delay: 0, usingSpringWithDamping: 0.5, initialSpringVelocity: 0, options: [], animations: { | ||
| 55 | + toVC.view.frame = UIScreen.main.bounds | ||
| 56 | + toVC.scrollView.imageView.frame.size.width = KSreenWidth | ||
| 57 | + toVC.scrollView.imageView.frame.size.height = KSreenWidth*DownSlideSingleCourseImgH/DownSlideSingleCourseW | ||
| 58 | + toVC.closeBtn.alpha = 1 | ||
| 59 | + | ||
| 60 | + }) { (completed) in | ||
| 61 | + transitionContext.completeTransition(completed) | ||
| 62 | + } | ||
| 63 | + }else if toNaviVC.topViewController is CNHomepageDuanJuDetailViewController{ | ||
| 64 | + guard let selectedCell = fromVC.selectedDuanjuCell else { return } | ||
| 65 | + let toVC = toNaviVC.topViewController as! CNHomepageDuanJuDetailViewController | ||
| 66 | + let frame = selectedCell.convert(selectedCell.totalView.frame, to: fromVC.view) | ||
| 67 | + //2.Set presentation original size. | ||
| 68 | + toVC.view.frame = frame | ||
| 69 | + containerView.addSubview(toNaviVC.view) | ||
| 58 | 70 | ||
| 59 | - }) { (completed) in | ||
| 60 | - transitionContext.completeTransition(completed) | 71 | + //3.Change original size to final size with animation. |
| 72 | + UIView.animate(withDuration: transitonDuration, delay: 0, usingSpringWithDamping: 0.5, initialSpringVelocity: 0, options: [], animations: { | ||
| 73 | + toVC.view.frame = UIScreen.main.bounds | ||
| 74 | + toVC.closeBtn.alpha = 1 | ||
| 75 | + | ||
| 76 | + }) { (completed) in | ||
| 77 | + transitionContext.completeTransition(completed) | ||
| 78 | + } | ||
| 79 | + }else{ | ||
| 80 | + return | ||
| 61 | } | 81 | } |
| 82 | + | ||
| 62 | } | 83 | } |
| 63 | 84 | ||
| 64 | func animationForDismiss(using transitionContext: UIViewControllerContextTransitioning) { | 85 | func animationForDismiss(using transitionContext: UIViewControllerContextTransitioning) { |
| @@ -66,19 +87,36 @@ extension CNHomePageAnimationTransition: UIViewControllerAnimatedTransitioning { | @@ -66,19 +87,36 @@ extension CNHomePageAnimationTransition: UIViewControllerAnimatedTransitioning { | ||
| 66 | guard let toVCTabbar = transitionContext.viewController(forKey: .to) as? CNLiveBaseTabBarViewController else { return } | 87 | guard let toVCTabbar = transitionContext.viewController(forKey: .to) as? CNLiveBaseTabBarViewController else { return } |
| 67 | let toVCNav = toVCTabbar.viewControllers?.first as! CNLiveBaseNavigationController | 88 | let toVCNav = toVCTabbar.viewControllers?.first as! CNLiveBaseNavigationController |
| 68 | let toVC = toVCNav.viewControllers.first as! CNLiveAuthViewController | 89 | let toVC = toVCNav.viewControllers.first as! CNLiveAuthViewController |
| 69 | - guard let selectedCell = toVC.selectedCell else { return } | ||
| 70 | - let fromVC = fromNaviVC.topViewController as! CNHomepageDetailViewController | ||
| 71 | - | ||
| 72 | - UIView.animate(withDuration: transitonDuration - 0.3, delay: 0, usingSpringWithDamping: 0.8, initialSpringVelocity: 0, options: [], animations: { | ||
| 73 | - let frame = selectedCell.convert(selectedCell.bgBackView.frame, to: toVC.view) | ||
| 74 | - fromVC.view.frame = frame | ||
| 75 | - fromVC.view.layer.cornerRadius = GlobalConstants.toDayCardCornerRadius | ||
| 76 | - fromVC.scrollView.imageView.frame.size.width = GlobalConstants.todayCardSize.width | ||
| 77 | - fromVC.scrollView.imageView.frame.size.height = GlobalConstants.todayCardSize.height | ||
| 78 | - fromVC.closeBtn.alpha = 0 | 90 | + if fromNaviVC.topViewController is CNHomepageDetailViewController{ |
| 91 | + guard let selectedCell = toVC.selectedCell else { return } | ||
| 92 | + let fromVC = fromNaviVC.topViewController as! CNHomepageDetailViewController | ||
| 79 | 93 | ||
| 80 | - }) { (completed) in | ||
| 81 | - transitionContext.completeTransition(completed) | 94 | + UIView.animate(withDuration: transitonDuration - 0.3, delay: 0, usingSpringWithDamping: 0.8, initialSpringVelocity: 0, options: [], animations: { |
| 95 | + let frame = selectedCell.convert(selectedCell.bgBackView.frame, to: toVC.view) | ||
| 96 | + fromVC.view.frame = frame | ||
| 97 | + fromVC.view.layer.cornerRadius = GlobalConstants.toDayCardCornerRadius | ||
| 98 | + fromVC.scrollView.imageView.frame.size.width = GlobalConstants.todayCardSize.width | ||
| 99 | + fromVC.scrollView.imageView.frame.size.height = GlobalConstants.todayCardSize.height | ||
| 100 | + fromVC.closeBtn.alpha = 0 | ||
| 101 | + | ||
| 102 | + }) { (completed) in | ||
| 103 | + transitionContext.completeTransition(completed) | ||
| 104 | + } | ||
| 105 | + }else if fromNaviVC.topViewController is CNHomepageDuanJuDetailViewController{ | ||
| 106 | + guard let selectedCell = toVC.selectedDuanjuCell else { return } | ||
| 107 | + let fromVC = fromNaviVC.topViewController as! CNHomepageDuanJuDetailViewController | ||
| 108 | + UIView.animate(withDuration: transitonDuration - 0.3, delay: 0, usingSpringWithDamping: 0.8, initialSpringVelocity: 0, options: [], animations: { | ||
| 109 | + let frame = selectedCell.convert(selectedCell.totalView.frame, to: toVC.view) | ||
| 110 | + fromVC.view.frame = frame | ||
| 111 | + fromVC.view.layer.cornerRadius = GlobalConstants.toDayCardCornerRadius | ||
| 112 | + fromVC.closeBtn.alpha = 0 | ||
| 113 | + | ||
| 114 | + }) { (completed) in | ||
| 115 | + transitionContext.completeTransition(completed) | ||
| 116 | + } | ||
| 117 | + | ||
| 118 | + }else{ | ||
| 119 | + return | ||
| 82 | } | 120 | } |
| 83 | } | 121 | } |
| 84 | 122 |
metaCode/Classes/Main/HomePages/Controller/AuthController/push相关/CNHomepageDetailViewController.swift
| @@ -6,12 +6,16 @@ | @@ -6,12 +6,16 @@ | ||
| 6 | // 首页短剧--大图点击详情页 | 6 | // 首页短剧--大图点击详情页 |
| 7 | 7 | ||
| 8 | import Foundation | 8 | import Foundation |
| 9 | +import MJRefresh | ||
| 10 | +import EmptyDataSet_Swift | ||
| 9 | 11 | ||
| 10 | -class CNHomepageDetailViewController: CNLiveBaseViewController ,UITableViewDataSource, UITableViewDelegate{ | 12 | +class CNHomepageDetailViewController: CNLiveBaseViewController ,UITableViewDataSource, UITableViewDelegate,EmptyDataSetSource, EmptyDataSetDelegate{ |
| 11 | 13 | ||
| 12 | let kCNLiveAlbumImageCellIdentifier = "kCNLiveAlbumImageCellIdentifier" | 14 | let kCNLiveAlbumImageCellIdentifier = "kCNLiveAlbumImageCellIdentifier" |
| 13 | let kCNLiveAlbumCellIdentifier = "kCNLiveAlbumCellIdentifier" | 15 | let kCNLiveAlbumCellIdentifier = "kCNLiveAlbumCellIdentifier" |
| 14 | 16 | ||
| 17 | + var pageNum: NSInteger | ||
| 18 | + var network_type: CNLiveMineResponseType! | ||
| 15 | // MARK: - 懒加载 | 19 | // MARK: - 懒加载 |
| 16 | ///数据源 | 20 | ///数据源 |
| 17 | lazy var dataArray: NSMutableArray = { | 21 | lazy var dataArray: NSMutableArray = { |
| @@ -22,6 +26,8 @@ class CNHomepageDetailViewController: CNLiveBaseViewController ,UITableViewData | @@ -22,6 +26,8 @@ class CNHomepageDetailViewController: CNLiveBaseViewController ,UITableViewData | ||
| 22 | let tableView = UITableView(frame: .zero, style: .plain) | 26 | let tableView = UITableView(frame: .zero, style: .plain) |
| 23 | tableView.dataSource = self | 27 | tableView.dataSource = self |
| 24 | tableView.delegate = self | 28 | tableView.delegate = self |
| 29 | + tableView.emptyDataSetSource = self | ||
| 30 | + tableView.emptyDataSetDelegate = self | ||
| 25 | tableView.separatorStyle = .none | 31 | tableView.separatorStyle = .none |
| 26 | tableView.tableFooterView = UIView.init() | 32 | tableView.tableFooterView = UIView.init() |
| 27 | tableView.register(CNLiveAlbumCell.self, forCellReuseIdentifier: kCNLiveAlbumCellIdentifier) | 33 | tableView.register(CNLiveAlbumCell.self, forCellReuseIdentifier: kCNLiveAlbumCellIdentifier) |
| @@ -75,11 +81,13 @@ class CNHomepageDetailViewController: CNLiveBaseViewController ,UITableViewData | @@ -75,11 +81,13 @@ class CNHomepageDetailViewController: CNLiveBaseViewController ,UITableViewData | ||
| 75 | }() | 81 | }() |
| 76 | 82 | ||
| 77 | init(cell: CNDownSlideSingleCourseCell,slideModel:CNLiveDownSlideModel) { | 83 | init(cell: CNDownSlideSingleCourseCell,slideModel:CNLiveDownSlideModel) { |
| 84 | + self.pageNum = 1 | ||
| 78 | self.cell = cell | 85 | self.cell = cell |
| 79 | super.init(nibName: nil, bundle: nil) | 86 | super.init(nibName: nil, bundle: nil) |
| 80 | self.slideModel = slideModel | 87 | self.slideModel = slideModel |
| 81 | self.setupTranstion() | 88 | self.setupTranstion() |
| 82 | setNeedsStatusBarAppearanceUpdate() | 89 | setNeedsStatusBarAppearanceUpdate() |
| 90 | + | ||
| 83 | } | 91 | } |
| 84 | 92 | ||
| 85 | private func setupTranstion() { | 93 | private func setupTranstion() { |
| @@ -95,7 +103,7 @@ class CNHomepageDetailViewController: CNLiveBaseViewController ,UITableViewData | @@ -95,7 +103,7 @@ class CNHomepageDetailViewController: CNLiveBaseViewController ,UITableViewData | ||
| 95 | super.viewDidLoad() | 103 | super.viewDidLoad() |
| 96 | setupUI() | 104 | setupUI() |
| 97 | getImageFromCell() | 105 | getImageFromCell() |
| 98 | - self.getBlockContents() | 106 | + self.getBlockContents(page: 1) |
| 99 | } | 107 | } |
| 100 | 108 | ||
| 101 | private func setupUI() { | 109 | private func setupUI() { |
| @@ -137,7 +145,6 @@ class CNHomepageDetailViewController: CNLiveBaseViewController ,UITableViewData | @@ -137,7 +145,6 @@ class CNHomepageDetailViewController: CNLiveBaseViewController ,UITableViewData | ||
| 137 | 145 | ||
| 138 | func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { | 146 | func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { |
| 139 | 147 | ||
| 140 | -// let goodsModel = self.dataArray[indexPath.row] as! CNLiveShopGoodsListModel | ||
| 141 | if indexPath.section == 0{ | 148 | if indexPath.section == 0{ |
| 142 | guard let cell = tableView.dequeueReusableCell(withIdentifier: kCNLiveAlbumImageCellIdentifier) as? CNLiveAlbumImageCell | 149 | guard let cell = tableView.dequeueReusableCell(withIdentifier: kCNLiveAlbumImageCellIdentifier) as? CNLiveAlbumImageCell |
| 143 | else { | 150 | else { |
| @@ -167,17 +174,50 @@ class CNHomepageDetailViewController: CNLiveBaseViewController ,UITableViewData | @@ -167,17 +174,50 @@ class CNHomepageDetailViewController: CNLiveBaseViewController ,UITableViewData | ||
| 167 | } | 174 | } |
| 168 | 175 | ||
| 169 | // MARK: - 获取全部专辑列表 | 176 | // MARK: - 获取全部专辑列表 |
| 170 | - func getBlockContents(){ | ||
| 171 | - CNLiveHomePageViewModel.getBlockContents(blockId: self.slideModel!.blockId ?? "") { result, status in | 177 | + func getBlockContents(page:NSInteger){ |
| 178 | + CNLiveHomePageViewModel.getBlockContents(blockId: self.slideModel!.blockId ?? "", page: page) {[weak self] result, status in | ||
| 172 | if status == .success{ | 179 | if status == .success{ |
| 173 | - let albumArr = result as! Array<CNLiveAlbumModel> | ||
| 174 | - self.dataArray = NSMutableArray(array: albumArr) | ||
| 175 | - self.tableView.reloadData() | ||
| 176 | - }else{ | 180 | + if self!.pageNum > 1 { |
| 181 | + self!.dataArray.addObjects(from: result as! [CNLiveAlbumModel]) | ||
| 182 | + } | ||
| 183 | + if self!.pageNum == 1 { | ||
| 184 | + self!.dataArray.removeAllObjects() | ||
| 185 | + self!.dataArray.addObjects(from: result as! [CNLiveAlbumModel]) | ||
| 186 | + if self!.dataArray.count > 0 && self!.tableView.mj_header == nil && self!.tableView.mj_footer == nil { | ||
| 187 | + self!.addRefreshView() | ||
| 188 | + self!.pageNum = self!.pageNum + 1 | ||
| 189 | + self!.getBlockContents(page: self!.pageNum) | ||
| 190 | + } | ||
| 191 | + } | ||
| 177 | 192 | ||
| 193 | + self!.tableView.mj_header?.endRefreshing() | ||
| 194 | + self!.tableView.mj_footer?.endRefreshing() | ||
| 195 | + self!.tableView.reloadData() | ||
| 196 | + if (result as! Array<Any>).count == 0 { | ||
| 197 | + self!.tableView.mj_footer?.endRefreshingWithNoMoreData() | ||
| 198 | + self!.tableView.reloadData() | ||
| 199 | + } | ||
| 200 | + | ||
| 201 | + }else if (status == .noNetwork) { | ||
| 202 | + self!.network_type = .noNetwork | ||
| 203 | + self!.tableView.reloadEmptyDataSet() | ||
| 204 | + } else { | ||
| 205 | + self!.network_type = .failed | ||
| 206 | + self!.tableView.reloadEmptyDataSet() | ||
| 178 | } | 207 | } |
| 179 | } | 208 | } |
| 180 | } | 209 | } |
| 210 | + func addRefreshView() { | ||
| 211 | + tableView.mj_header = MJRefreshNormalHeader.init(refreshingBlock: {[weak self] in | ||
| 212 | + self!.pageNum = 1 | ||
| 213 | + self!.getBlockContents(page: 1) | ||
| 214 | + }) | ||
| 215 | + | ||
| 216 | + tableView.mj_footer = MJRefreshAutoNormalFooter.init(refreshingBlock: {[weak self] in | ||
| 217 | + self!.pageNum = self!.pageNum + 1 | ||
| 218 | + self!.getBlockContents(page: self!.pageNum) | ||
| 219 | + }) | ||
| 220 | + } | ||
| 181 | 221 | ||
| 182 | @objc private func handleDismissPan(gesture: UIPanGestureRecognizer) { | 222 | @objc private func handleDismissPan(gesture: UIPanGestureRecognizer) { |
| 183 | if !draggingDownToDismiss { | 223 | if !draggingDownToDismiss { |
| @@ -271,3 +311,48 @@ extension CNHomepageDetailViewController: UIGestureRecognizerDelegate { | @@ -271,3 +311,48 @@ extension CNHomepageDetailViewController: UIGestureRecognizerDelegate { | ||
| 271 | return true | 311 | return true |
| 272 | } | 312 | } |
| 273 | } | 313 | } |
| 314 | + | ||
| 315 | +extension CNHomepageDetailViewController { | ||
| 316 | + | ||
| 317 | + func image(forEmptyDataSet scrollView: UIScrollView) -> UIImage? { | ||
| 318 | + if network_type == .failed || network_type == .unkonw { | ||
| 319 | + return UIImage(named: "mine_list_source_unusual_failed") | ||
| 320 | + } | ||
| 321 | + if dataArray.count == 0 { | ||
| 322 | + return UIImage(named: "mine_list_source_unusual_empty") | ||
| 323 | + } | ||
| 324 | + if network_type == .noNetwork { | ||
| 325 | + return UIImage(named: "mine_list_source_unusual_noNet") | ||
| 326 | + } | ||
| 327 | + return UIImage(named: "mine_list_source_unusual_empty") | ||
| 328 | + } | ||
| 329 | + | ||
| 330 | + func title(forEmptyDataSet scrollView: UIScrollView) -> NSAttributedString? { | ||
| 331 | + var defult_string = "" | ||
| 332 | + if network_type == .failed || network_type == .unkonw { | ||
| 333 | + defult_string = "接口请求错误,刷新试试~" | ||
| 334 | + } | ||
| 335 | + if network_type == .noNetwork { | ||
| 336 | + defult_string = "网络开小差了,刷新试试~" | ||
| 337 | + } | ||
| 338 | + if dataArray.count == 0 { | ||
| 339 | + defult_string = "暂时没有数据~" | ||
| 340 | + } | ||
| 341 | + return NSAttributedString(string: defult_string, attributes: [.font: Font_17,.foregroundColor: HexColor("#666666")!]) | ||
| 342 | + } | ||
| 343 | + | ||
| 344 | + func buttonTitle(forEmptyDataSet scrollView: UIScrollView, for state: UIControl.State) -> NSAttributedString? { | ||
| 345 | + if network_type == .failed || network_type == .noNetwork { | ||
| 346 | + let attributes = [NSAttributedString.Key.font:Font_16_Fit, | ||
| 347 | + NSAttributedString.Key.foregroundColor: HexColor("#609BFF")] | ||
| 348 | + return NSAttributedString(string: "刷一刷", attributes: attributes as [NSAttributedString.Key : Any]) | ||
| 349 | + } | ||
| 350 | + return nil | ||
| 351 | + } | ||
| 352 | + | ||
| 353 | + func emptyDataSet(_ scrollView: UIScrollView, didTapView view: UIView) { | ||
| 354 | + if network_type == .failed || network_type == .noNetwork { | ||
| 355 | + getBlockContents(page: 1) | ||
| 356 | + } | ||
| 357 | + } | ||
| 358 | +} |
metaCode/Classes/Main/HomePages/Controller/AuthController/push相关/CNHomepageDuanJuDetailViewController.swift
0 → 100644
| 1 | +// | ||
| 2 | +// CNHomepageDuanJuDetailViewController.swift | ||
| 3 | +// metaCode | ||
| 4 | +// | ||
| 5 | +// Created by zx on 2024/1/5. | ||
| 6 | +// 首页短剧--在追短剧点击详情页 | ||
| 7 | + | ||
| 8 | +import Foundation | ||
| 9 | +import MJRefresh | ||
| 10 | +import EmptyDataSet_Swift | ||
| 11 | + | ||
| 12 | +class CNHomepageDuanJuDetailViewController: CNLiveBaseViewController ,UITableViewDataSource, UITableViewDelegate,EmptyDataSetSource, EmptyDataSetDelegate{ | ||
| 13 | + | ||
| 14 | + let kCNLiveDuanjuTitleCellIdentifier = "kCNLiveDuanjuTitleCellIdentifier" | ||
| 15 | + let kCNLiveAlbumCellIdentifier = "kCNLiveAlbumCellIdentifier" | ||
| 16 | + | ||
| 17 | + var pageNum: NSInteger | ||
| 18 | + var network_type: CNLiveMineResponseType! | ||
| 19 | + // MARK: - 懒加载 | ||
| 20 | + ///数据源 | ||
| 21 | + lazy var dataArray: NSMutableArray = { | ||
| 22 | + var dataArray = NSMutableArray() | ||
| 23 | + return dataArray | ||
| 24 | + }() | ||
| 25 | + lazy var tableView : UITableView = { | ||
| 26 | + let tableView = UITableView(frame: .zero, style: .plain) | ||
| 27 | + tableView.dataSource = self | ||
| 28 | + tableView.delegate = self | ||
| 29 | + tableView.emptyDataSetSource = self | ||
| 30 | + tableView.emptyDataSetDelegate = self | ||
| 31 | + tableView.separatorStyle = .none | ||
| 32 | + tableView.tableFooterView = UIView.init() | ||
| 33 | + tableView.register(CNLiveAlbumCell.self, forCellReuseIdentifier: kCNLiveAlbumCellIdentifier) | ||
| 34 | + tableView.register(CNLiveDuanjuTitleCell.self, forCellReuseIdentifier: kCNLiveDuanjuTitleCellIdentifier) | ||
| 35 | + return tableView | ||
| 36 | + }() | ||
| 37 | + | ||
| 38 | + var dismissClosure: (()->())? | ||
| 39 | + //the point when start to interactive | ||
| 40 | + var interactiveStartingPoint: CGPoint? = nil | ||
| 41 | + | ||
| 42 | + var draggingDownToDismiss = false | ||
| 43 | + | ||
| 44 | + let cell: CNLiveHomePageDuanJuCell! | ||
| 45 | + | ||
| 46 | + private lazy var dismissPanGesture: UIPanGestureRecognizer = { | ||
| 47 | + let ges = UIPanGestureRecognizer() | ||
| 48 | + ges.maximumNumberOfTouches = 1 | ||
| 49 | + ges.addTarget(self, action: #selector(handleDismissPan(gesture:))) | ||
| 50 | + ges.delegate = self | ||
| 51 | + return ges | ||
| 52 | + }() | ||
| 53 | + | ||
| 54 | + lazy var closeBtn: UIButton = { | ||
| 55 | + let btn = UIButton() | ||
| 56 | + btn.frame = CGRect(x: KSreenWidth - 20 - 30, y: KStatusBarHeight+20, width: 30, height: 30) | ||
| 57 | + btn.setImage(#imageLiteral(resourceName: "close_button"), for: .normal) | ||
| 58 | + btn.addTarget(self, action: #selector(closeAction), for: .touchUpInside) | ||
| 59 | + return btn | ||
| 60 | + }() | ||
| 61 | + | ||
| 62 | + init(cell:CNLiveHomePageDuanJuCell) { | ||
| 63 | + self.pageNum = 1 | ||
| 64 | + self.cell = cell | ||
| 65 | + super.init(nibName: nil, bundle: nil) | ||
| 66 | + self.setupTranstion() | ||
| 67 | + setNeedsStatusBarAppearanceUpdate() | ||
| 68 | + | ||
| 69 | + } | ||
| 70 | + | ||
| 71 | + private func setupTranstion() { | ||
| 72 | + modalPresentationStyle = .custom | ||
| 73 | + transitioningDelegate = self | ||
| 74 | + } | ||
| 75 | + | ||
| 76 | + required init?(coder aDecoder: NSCoder) { | ||
| 77 | + fatalError("init(coder:) has not been implemented") | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + override func viewDidLoad() { | ||
| 81 | + super.viewDidLoad() | ||
| 82 | + setupUI() | ||
| 83 | + self.getMyAlbum(page: 1) | ||
| 84 | + self.view.backgroundColor = .white | ||
| 85 | + } | ||
| 86 | + | ||
| 87 | + private func setupUI() { | ||
| 88 | + self.view.layer.masksToBounds = true | ||
| 89 | + self.view.addSubview(self.tableView) | ||
| 90 | + self.tableView.frame = CGRect(x: 0, y: KStatusBarHeight, width: KSreenWidth, height: KSreenHeight-KStatusBarHeight) | ||
| 91 | + view.addSubview(closeBtn) | ||
| 92 | + view.addGestureRecognizer(dismissPanGesture) | ||
| 93 | + | ||
| 94 | + if #available(iOS 11.0, *) { | ||
| 95 | + } else { | ||
| 96 | + automaticallyAdjustsScrollViewInsets = false | ||
| 97 | + } | ||
| 98 | + } | ||
| 99 | + | ||
| 100 | + @objc private func closeAction() { | ||
| 101 | + dismiss(animated: true, completion: nil) | ||
| 102 | + let nav = self.navigationController as! CNHomePageBaseNavigationController | ||
| 103 | + nav.dismissClosure?() | ||
| 104 | + } | ||
| 105 | + | ||
| 106 | + func numberOfSections(in tableView: UITableView) -> Int { | ||
| 107 | + 2 | ||
| 108 | + } | ||
| 109 | + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { | ||
| 110 | + if section == 0{ | ||
| 111 | + return 1 | ||
| 112 | + }else{ | ||
| 113 | + return self.dataArray.count | ||
| 114 | + } | ||
| 115 | + } | ||
| 116 | + | ||
| 117 | + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { | ||
| 118 | + if indexPath.section == 0{ | ||
| 119 | + guard let cell = tableView.dequeueReusableCell(withIdentifier: kCNLiveDuanjuTitleCellIdentifier) as? CNLiveDuanjuTitleCell | ||
| 120 | + else { | ||
| 121 | + let cell = CNLiveDuanjuTitleCell() | ||
| 122 | + return cell | ||
| 123 | + } | ||
| 124 | + return cell | ||
| 125 | + }else{ | ||
| 126 | + let albumModel = self.dataArray[indexPath.row] as! CNLiveAlbumMsgModel | ||
| 127 | + | ||
| 128 | + guard let cell = tableView.dequeueReusableCell(withIdentifier: kCNLiveAlbumCellIdentifier) as? CNLiveAlbumCell | ||
| 129 | + else { | ||
| 130 | + let cell = CNLiveAlbumCell() | ||
| 131 | + return cell | ||
| 132 | + } | ||
| 133 | + cell.albumMsgModel = albumModel | ||
| 134 | + return cell | ||
| 135 | + } | ||
| 136 | + } | ||
| 137 | + func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { | ||
| 138 | + if indexPath.section == 0{ | ||
| 139 | + return 45//10+30+5 | ||
| 140 | + }else{ | ||
| 141 | + return 75 | ||
| 142 | + } | ||
| 143 | + } | ||
| 144 | + | ||
| 145 | + // MARK: - 获取我的在追短剧列表 | ||
| 146 | + func getMyAlbum(page:NSInteger){ | ||
| 147 | + CNLiveHomePageViewModel.requestGetHomePageMyAlbum(page: page){[weak self] result, status in | ||
| 148 | + if status == .success{ | ||
| 149 | + if self!.pageNum > 1 { | ||
| 150 | + self!.dataArray.addObjects(from: result as! [CNLiveAlbumMsgModel]) | ||
| 151 | + } | ||
| 152 | + if self!.pageNum == 1 { | ||
| 153 | + self!.dataArray.removeAllObjects() | ||
| 154 | + self!.dataArray.addObjects(from: result as! [CNLiveAlbumMsgModel]) | ||
| 155 | + if self!.dataArray.count > 0 && self!.tableView.mj_header == nil && self!.tableView.mj_footer == nil { | ||
| 156 | + self!.addRefreshView() | ||
| 157 | + self!.pageNum = self!.pageNum + 1 | ||
| 158 | + self!.getMyAlbum(page: self!.pageNum) | ||
| 159 | + | ||
| 160 | + } | ||
| 161 | + } | ||
| 162 | + | ||
| 163 | + self!.tableView.mj_header?.endRefreshing() | ||
| 164 | + self!.tableView.mj_footer?.endRefreshing() | ||
| 165 | + self!.tableView.reloadData() | ||
| 166 | + if (result as! Array<Any>).count == 0 { | ||
| 167 | + self!.tableView.mj_footer?.endRefreshingWithNoMoreData() | ||
| 168 | + self!.tableView.reloadData() | ||
| 169 | + } | ||
| 170 | + | ||
| 171 | + }else if (status == .noNetwork) { | ||
| 172 | + self!.network_type = .noNetwork | ||
| 173 | + self!.tableView.reloadEmptyDataSet() | ||
| 174 | + } else { | ||
| 175 | + self!.network_type = .failed | ||
| 176 | + self!.tableView.reloadEmptyDataSet() | ||
| 177 | + } | ||
| 178 | + } | ||
| 179 | + } | ||
| 180 | + func addRefreshView() { | ||
| 181 | + tableView.mj_header = MJRefreshNormalHeader.init(refreshingBlock: {[weak self] in | ||
| 182 | + self!.pageNum = 1 | ||
| 183 | + self!.getMyAlbum(page: 1) | ||
| 184 | + }) | ||
| 185 | + | ||
| 186 | + tableView.mj_footer = MJRefreshAutoNormalFooter.init(refreshingBlock: {[weak self] in | ||
| 187 | + self!.pageNum = self!.pageNum + 1 | ||
| 188 | + self!.getMyAlbum(page: self!.pageNum) | ||
| 189 | + }) | ||
| 190 | + } | ||
| 191 | + | ||
| 192 | + @objc private func handleDismissPan(gesture: UIPanGestureRecognizer) { | ||
| 193 | + if !draggingDownToDismiss { | ||
| 194 | + return | ||
| 195 | + } | ||
| 196 | + | ||
| 197 | + let startingPoint: CGPoint | ||
| 198 | + | ||
| 199 | + if let p = interactiveStartingPoint { | ||
| 200 | + startingPoint = p | ||
| 201 | + } else { | ||
| 202 | + startingPoint = gesture.location(in: nil) | ||
| 203 | + interactiveStartingPoint = startingPoint | ||
| 204 | + } | ||
| 205 | + | ||
| 206 | + let currentLocation = gesture.location(in: nil) | ||
| 207 | + | ||
| 208 | + var progress = (currentLocation.y - startingPoint.y) / 100 | ||
| 209 | + | ||
| 210 | + //prevent viewController bigger when scrolling up | ||
| 211 | + if currentLocation.y <= startingPoint.y { | ||
| 212 | + progress = 0 | ||
| 213 | + } | ||
| 214 | + | ||
| 215 | + if progress >= 1.0 { | ||
| 216 | + dismiss(animated: true, completion: nil) | ||
| 217 | + let nav = self.navigationController as! CNHomePageBaseNavigationController | ||
| 218 | + nav.dismissClosure?() | ||
| 219 | +// dismissClosure?() | ||
| 220 | + stopDismissPanGesture(gesture) | ||
| 221 | + return | ||
| 222 | + } | ||
| 223 | + | ||
| 224 | + let targetShrinkScale: CGFloat = 0.86 | ||
| 225 | + let currentScale: CGFloat = 1 - (1 - targetShrinkScale) * progress | ||
| 226 | + | ||
| 227 | + switch gesture.state { | ||
| 228 | + case .began,.changed: | ||
| 229 | + gesture.view?.transform = CGAffineTransform(scaleX: currentScale, y: currentScale) | ||
| 230 | + gesture.view?.layer.cornerRadius = GlobalConstants.toDayCardCornerRadius * (progress) | ||
| 231 | + case .cancelled,.ended: | ||
| 232 | + stopDismissPanGesture(gesture) | ||
| 233 | + default: | ||
| 234 | + break | ||
| 235 | + } | ||
| 236 | + } | ||
| 237 | + | ||
| 238 | + //当下拉Offset超过100或取消下拉手势时,执行此方法 | ||
| 239 | + private func stopDismissPanGesture(_ gesture: UIPanGestureRecognizer) { | ||
| 240 | + draggingDownToDismiss = false | ||
| 241 | + interactiveStartingPoint = nil | ||
| 242 | + UIView.animate(withDuration: 0.2) { | ||
| 243 | + gesture.view?.transform = CGAffineTransform.identity | ||
| 244 | + } | ||
| 245 | + } | ||
| 246 | + | ||
| 247 | +} | ||
| 248 | + | ||
| 249 | +extension CNHomepageDuanJuDetailViewController: UIViewControllerTransitioningDelegate { | ||
| 250 | + | ||
| 251 | + func animationController(forPresented presented: UIViewController, presenting: UIViewController, source: UIViewController) -> UIViewControllerAnimatedTransitioning? { | ||
| 252 | + return CNHomePageAnimationTransition(animationType: .present) | ||
| 253 | + } | ||
| 254 | + | ||
| 255 | + func animationController(forDismissed dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? { | ||
| 256 | + return CNHomePageAnimationTransition(animationType: .dismiss) | ||
| 257 | + } | ||
| 258 | + | ||
| 259 | + func presentationController(forPresented presented: UIViewController, presenting: UIViewController?, source: UIViewController) -> UIPresentationController? { | ||
| 260 | + return CNUpSlideCardPresentationController(presentedViewController: presented, presenting: presenting) | ||
| 261 | + } | ||
| 262 | +} | ||
| 263 | + | ||
| 264 | +extension CNHomepageDuanJuDetailViewController: UIScrollViewDelegate { | ||
| 265 | + func scrollViewDidScroll(_ scrollView: UIScrollView) { | ||
| 266 | + | ||
| 267 | + if scrollView.contentOffset.y < 0 { | ||
| 268 | + scrollView.contentOffset = .zero | ||
| 269 | + draggingDownToDismiss = true | ||
| 270 | + } | ||
| 271 | + } | ||
| 272 | +} | ||
| 273 | + | ||
| 274 | +extension CNHomepageDuanJuDetailViewController: UIGestureRecognizerDelegate { | ||
| 275 | + func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool { | ||
| 276 | + return true | ||
| 277 | + } | ||
| 278 | +} | ||
| 279 | + | ||
| 280 | +extension CNHomepageDuanJuDetailViewController { | ||
| 281 | + | ||
| 282 | + func image(forEmptyDataSet scrollView: UIScrollView) -> UIImage? { | ||
| 283 | + if network_type == .failed || network_type == .unkonw { | ||
| 284 | + return UIImage(named: "mine_list_source_unusual_failed") | ||
| 285 | + } | ||
| 286 | + if dataArray.count == 0 { | ||
| 287 | + return UIImage(named: "mine_list_source_unusual_empty") | ||
| 288 | + } | ||
| 289 | + if network_type == .noNetwork { | ||
| 290 | + return UIImage(named: "mine_list_source_unusual_noNet") | ||
| 291 | + } | ||
| 292 | + return UIImage(named: "mine_list_source_unusual_empty") | ||
| 293 | + } | ||
| 294 | + | ||
| 295 | + func title(forEmptyDataSet scrollView: UIScrollView) -> NSAttributedString? { | ||
| 296 | + var defult_string = "" | ||
| 297 | + if network_type == .failed || network_type == .unkonw { | ||
| 298 | + defult_string = "接口请求错误,刷新试试~" | ||
| 299 | + } | ||
| 300 | + if network_type == .noNetwork { | ||
| 301 | + defult_string = "网络开小差了,刷新试试~" | ||
| 302 | + } | ||
| 303 | + if dataArray.count == 0 { | ||
| 304 | + defult_string = "暂时没有数据~" | ||
| 305 | + } | ||
| 306 | + return NSAttributedString(string: defult_string, attributes: [.font: Font_17,.foregroundColor: HexColor("#666666")!]) | ||
| 307 | + } | ||
| 308 | + | ||
| 309 | + func buttonTitle(forEmptyDataSet scrollView: UIScrollView, for state: UIControl.State) -> NSAttributedString? { | ||
| 310 | + if network_type == .failed || network_type == .noNetwork { | ||
| 311 | + let attributes = [NSAttributedString.Key.font:Font_16_Fit, | ||
| 312 | + NSAttributedString.Key.foregroundColor: HexColor("#609BFF")] | ||
| 313 | + return NSAttributedString(string: "刷一刷", attributes: attributes as [NSAttributedString.Key : Any]) | ||
| 314 | + } | ||
| 315 | + return nil | ||
| 316 | + } | ||
| 317 | + | ||
| 318 | + func emptyDataSet(_ scrollView: UIScrollView, didTapView view: UIView) { | ||
| 319 | + if network_type == .failed || network_type == .noNetwork { | ||
| 320 | + getMyAlbum(page: 1) | ||
| 321 | + } | ||
| 322 | + } | ||
| 323 | +} |
metaCode/Classes/Main/HomePages/Controller/PlayletHomePage/CNLivePlayletHomePageController.swift
| @@ -50,7 +50,6 @@ class CNLivePlayletHomePageController:CNLiveBaseViewController, UITableViewDataS | @@ -50,7 +50,6 @@ class CNLivePlayletHomePageController:CNLiveBaseViewController, UITableViewDataS | ||
| 50 | 50 | ||
| 51 | func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { | 51 | func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { |
| 52 | 52 | ||
| 53 | -// let goodsModel = self.dataArray[indexPath.row] as! CNLiveShopGoodsListModel | ||
| 54 | if indexPath.section == 0{ | 53 | if indexPath.section == 0{ |
| 55 | guard let cell = tableView.dequeueReusableCell(withIdentifier: kCNLivePlayletHeaderCellIdentifier) as? CNLivePlayletHomePageHeaderCell | 54 | guard let cell = tableView.dequeueReusableCell(withIdentifier: kCNLivePlayletHeaderCellIdentifier) as? CNLivePlayletHomePageHeaderCell |
| 56 | else { | 55 | else { |
metaCode/Classes/Main/HomePages/View/HomePage/CNLiveHomePageDuanJuCell.swift
| @@ -6,64 +6,83 @@ | @@ -6,64 +6,83 @@ | ||
| 6 | // 首页-在追短剧cell | 6 | // 首页-在追短剧cell |
| 7 | 7 | ||
| 8 | import Foundation | 8 | import Foundation |
| 9 | -//enum GlobalConstants { | ||
| 10 | -// static let leftMargin: CGFloat = 20 | ||
| 11 | -// | ||
| 12 | -// static let toDayCardRowH: CGFloat = 440 | ||
| 13 | -// static let toDayCardCornerRadius: CGFloat = 12.0 | ||
| 14 | -// static let todayCardSize: CGSize = CGSize(width: KSreenWidth - 2 * 15, height: DownSlideSingleCourseImgH) | ||
| 15 | -// static let cardDetailTopImageH: CGFloat = 500 | ||
| 16 | -// | ||
| 17 | -// static let iconBorderColor: CGColor = UIColor(red: 239/255.0, green: 240/255.0, blue: 241/255.0, alpha: 1).cgColor | ||
| 18 | -// static let iconBorderWidth: CGFloat = 0.8 | ||
| 19 | -// static let iconCornerRadius: CGFloat = 17.5 | ||
| 20 | -// | ||
| 21 | -// static let textBlueColor = UIColor(red: 0/255.0, green: 122/255.0, blue: 255/255.0, alpha: 1.0) //007AFF | ||
| 22 | -// static let speratorLineColor = UIColor(red: 224/255.0, green: 224/255.0, blue: 224/255.0, alpha: 1) | ||
| 23 | -// | ||
| 24 | -//} | ||
| 25 | -// | ||
| 26 | -/////全部课程 标题高度 | ||
| 27 | -//let DownSlideAllCourseTitleH: CGFloat = 55 | ||
| 28 | -////全部课程 每row_topY间距 | ||
| 29 | -//let DownSlideAllCourseRowTopYGap: CGFloat = 10 | ||
| 30 | -////全部课程 每row_topY间距 | ||
| 31 | -//let DownSlideAllCourseRowBottomYGap: CGFloat = 20 | ||
| 32 | -////全部课程 每row_img宽高 | ||
| 33 | -//let DownSlideAllCourseRowImageWH: CGFloat = 45 | ||
| 34 | -// | ||
| 35 | -/////全部课程 每row高度 | ||
| 36 | -//let DownSlideAllCourseRowH: CGFloat = DownSlideAllCourseRowTopYGap+DownSlideAllCourseRowBottomYGap + DownSlideAllCourseRowImageWH | ||
| 37 | -/////全部课程 宽度 | ||
| 38 | -//let DownSlideAllCourseW: CGFloat = KSreenWidth - DownSlideRecommendLeftGap*2 | ||
| 39 | -// | ||
| 40 | -/////单节课程 大图高度 | ||
| 41 | -//let DownSlideSingleCourseImgH: CGFloat = 345 | ||
| 42 | -/////单节课程 更多课程高度 | ||
| 43 | -//let DownSlideSingleCourseMoreH: CGFloat = 60 | ||
| 44 | -/////单节课程 宽度 | ||
| 45 | -//let DownSlideSingleCourseW: CGFloat = KSreenWidth - DownSlideRecommendLeftGap*2 | 9 | +import QMUIKit |
| 10 | + | ||
| 11 | +typealias DuanJUCellSelectedCallBackBlock = (_ cell: CNLiveHomePageDuanJuCell) -> Void | ||
| 12 | + | ||
| 13 | +class CNLiveHomePageDuanJuCell:UITableViewCell,UITableViewDelegate,UITableViewDataSource{ | ||
| 14 | + let kCNLiveAlbumCellIdentifier = "kCNLiveAlbumCellIdentifier" | ||
| 15 | +// let bgBackView = UIView() | ||
| 46 | 16 | ||
| 47 | -class CNLiveHomePageDuanJuCell:UITableViewCell{ | 17 | + var DuanJUCellSelectedCallBack:DuanJUCellSelectedCallBackBlock? |
| 18 | + lazy var modelArr: NSMutableArray = { | ||
| 19 | + var dataArray = NSMutableArray() | ||
| 20 | + return dataArray | ||
| 21 | + }() | ||
| 22 | + func setModelArr(modelArr:NSMutableArray){ | ||
| 23 | + self.modelArr = NSMutableArray(array: modelArr) | ||
| 48 | 24 | ||
| 49 | - let bgBackView = UIView() | ||
| 50 | - let bgImageView = UIImageView() | 25 | + self.tableView.height = CGFloat(self.modelArr.count)*(45+15*2) |
| 26 | + self.totalView.height = CGFloat(self.modelArr.count)*(45+15*2) + 55 | ||
| 27 | + self.tableView.reloadData() | ||
| 28 | + | ||
| 29 | +// //定义view的阴影颜色 | ||
| 30 | +// self.totalView.layer.shadowColor = UIColor.black.cgColor | ||
| 31 | +// //阴影偏移量 | ||
| 32 | +// self.totalView.layer.shadowOffset=CGSize(width:1, height:1) | ||
| 33 | +// //定义view的阴影宽度,模糊计算的半径 | ||
| 34 | +// self.totalView.layer.shadowRadius = 12 | ||
| 35 | +// //定义view的阴影透明度,注意:如果view没有设置背景色阴影也是不会显示的 | ||
| 36 | +// self.totalView.layer.shadowOpacity = 0.4 | ||
| 51 | 37 | ||
| 52 | - //slideModel | ||
| 53 | - var _slideModel : CNLiveDownSlideModel? | ||
| 54 | - var slideModel : CNLiveDownSlideModel? { | ||
| 55 | - get{ | ||
| 56 | - _slideModel | ||
| 57 | - } | ||
| 58 | - set{ | ||
| 59 | - _slideModel = newValue! | ||
| 60 | - self.setupNewUI(model: _slideModel!) | ||
| 61 | - } | ||
| 62 | } | 38 | } |
| 39 | + //MARK: - 懒加载 | ||
| 40 | + ///区块标题 | ||
| 41 | + lazy var blockTitleLabl: UILabel = { | ||
| 42 | + let titleLbl = UILabel(frame: CGRect(x: DownSlideRecommendLeftGap, y: DownSlideRecommendLeftGap+5, width: DownSlideSingleCourseW-DownSlideRecommendLeftGap*2, height: 30)) | ||
| 43 | + titleLbl.text = "在追短剧" | ||
| 44 | + titleLbl.font = BoldFont_21 | ||
| 45 | + titleLbl.textColor = HexColor("#333333") | ||
| 46 | + return titleLbl | ||
| 47 | + }() | ||
| 48 | + lazy var totalView : UIView = { | ||
| 49 | + let totalView = UIView(frame: CGRect(x: 15, y: 15, width: KSreenWidth-30, height: 100)) | ||
| 50 | + return totalView | ||
| 51 | + }() | ||
| 52 | + | ||
| 53 | + lazy var tableView : UITableView = { | ||
| 54 | + let tableView = UITableView(frame: CGRect(x: 0, y: self.blockTitleLabl.bottom+5, width: KSreenWidth-30, height: 50), style: .plain) | ||
| 55 | + tableView.dataSource = self | ||
| 56 | + tableView.delegate = self | ||
| 57 | + tableView.separatorStyle = .none | ||
| 58 | + tableView.tableFooterView = UIView.init() | ||
| 59 | + tableView.backgroundColor = .clear | ||
| 60 | + tableView.register(CNLiveAlbumCell.self, forCellReuseIdentifier: kCNLiveAlbumCellIdentifier) | ||
| 61 | + return tableView | ||
| 62 | + }() | ||
| 63 | 63 | ||
| 64 | override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { | 64 | override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { |
| 65 | super.init(style: style, reuseIdentifier: reuseIdentifier) | 65 | super.init(style: style, reuseIdentifier: reuseIdentifier) |
| 66 | self.selectionStyle = .none | 66 | self.selectionStyle = .none |
| 67 | + | ||
| 68 | + self.contentView.addSubview(self.totalView) | ||
| 69 | + | ||
| 70 | + self.totalView.addSubview(self.blockTitleLabl) | ||
| 71 | + self.totalView.addSubview(self.tableView) | ||
| 72 | + self.tableView.backgroundColor = .white | ||
| 73 | + self.totalView.layer.cornerRadius = 12 | ||
| 74 | + self.totalView.clipsToBounds = true | ||
| 75 | + self.totalView.backgroundColor = .white | ||
| 76 | + | ||
| 77 | + //定义view的阴影颜色 | ||
| 78 | + self.totalView.layer.shadowColor = UIColor.black.cgColor | ||
| 79 | + //阴影偏移量 | ||
| 80 | + self.totalView.layer.shadowOffset=CGSize(width:1, height:1) | ||
| 81 | + //定义view的阴影宽度,模糊计算的半径 | ||
| 82 | + self.totalView.layer.shadowRadius = 12 | ||
| 83 | + //定义view的阴影透明度,注意:如果view没有设置背景色阴影也是不会显示的 | ||
| 84 | + self.totalView.layer.shadowOpacity = 0.4 | ||
| 85 | + | ||
| 67 | setupUI() | 86 | setupUI() |
| 68 | } | 87 | } |
| 69 | 88 | ||
| @@ -72,123 +91,33 @@ class CNLiveHomePageDuanJuCell:UITableViewCell{ | @@ -72,123 +91,33 @@ class CNLiveHomePageDuanJuCell:UITableViewCell{ | ||
| 72 | } | 91 | } |
| 73 | 92 | ||
| 74 | private func setupUI() { | 93 | private func setupUI() { |
| 75 | - contentView.backgroundColor = HexColor(kCNDownSlideBackgroundColorHex) | 94 | + contentView.backgroundColor = HexColor(kCNDownSlideBackgroundColorHex) |
| 76 | } | 95 | } |
| 77 | 96 | ||
| 78 | - func setupNewUI(model:CNLiveDownSlideModel){ | ||
| 79 | - if model.type == SlideModelTypeAllCourse12 { | ||
| 80 | - //全部课程列表 | ||
| 81 | - contentView.addSubview(bgBackView) | ||
| 82 | - | ||
| 83 | - bgBackView.frame = CGRect(x: DownSlideRecommendLeftGap, y: 0,width:DownSlideSingleCourseW , height:model.cellH-DownSlideRecommendLeftGap) | ||
| 84 | - bgBackView.layer.shadowColor = HexColor("#000000")?.cgColor | ||
| 85 | - bgBackView.layer.shadowRadius = 12 | ||
| 86 | - bgBackView.layer.shadowOpacity = 1 | ||
| 87 | - bgBackView.layer.shadowOffset = CGSize(width: 0, height: 0) | ||
| 88 | - bgBackView.layer.cornerRadius = 12 | ||
| 89 | - bgBackView.clipsToBounds = true | ||
| 90 | - bgBackView.backgroundColor = HexColor("#FFFFFF") | ||
| 91 | - | ||
| 92 | - let titleLbl = UILabel(frame: CGRect(x: DownSlideRecommendLeftGap, y: DownSlideRecommendLeftGap, width: DownSlideSingleCourseW-DownSlideRecommendLeftGap*2, height: 30)) | ||
| 93 | - titleLbl.text = model.blockName ?? "全部课程" | ||
| 94 | - titleLbl.font = BoldFont_21 | ||
| 95 | - titleLbl.textColor = HexColor("#333333") | ||
| 96 | - bgBackView.addSubview(titleLbl) | ||
| 97 | - | ||
| 98 | - //总块数 | ||
| 99 | - let contentsNum = model.contents.count | ||
| 100 | - //model行数 | ||
| 101 | - let row = model.rowNum | ||
| 102 | - //总显示块数 | ||
| 103 | - var totalNum = (contentsNum >= row) ? row : contentsNum | ||
| 104 | - if row == 0{//row为0 , contents全部显示 | ||
| 105 | - totalNum = contentsNum | ||
| 106 | - } | ||
| 107 | - for i in 0..<totalNum{//i是第几行 | ||
| 108 | - let contentMdl = model.contents[i] | ||
| 109 | - | ||
| 110 | - //小icon | ||
| 111 | - let imageView = UIImageView(frame: CGRectMake(DownSlideRecommendLeftGap, titleLbl.bottom+DownSlideRecommendLeftGap+CGFloat(i)*(DownSlideAllCourseRowTopYGap+DownSlideAllCourseRowImageWH+DownSlideAllCourseRowBottomYGap), CGFloat(DownSlideAllCourseRowImageWH), CGFloat(DownSlideAllCourseRowImageWH))) | ||
| 112 | - imageView.kf.setImage(with: URL(string:contentMdl.poster!)) | ||
| 113 | - bgBackView.addSubview(imageView) | ||
| 114 | - | ||
| 115 | - let titleLbl = UILabel(frame: CGRect(x: imageView.right+DownSlideRecommendLeftGap, y: imageView.top, width: DownSlideSingleCourseW-90-imageView.right, height: 21)) | ||
| 116 | - titleLbl.text = contentMdl.title ?? "婴儿课程" | ||
| 117 | - titleLbl.font = Font_15 | ||
| 118 | - titleLbl.textColor = HexColor("#333333") | ||
| 119 | - bgBackView.addSubview(titleLbl) | ||
| 120 | - | ||
| 121 | - let subTitleLbl = UILabel(frame: CGRect(x: titleLbl.left, y:titleLbl.bottom+3 , width: titleLbl.width, height: 17)) | ||
| 122 | - subTitleLbl.text = contentMdl.subTitle ?? "适应3-6岁" | ||
| 123 | - subTitleLbl.font = Font_12 | ||
| 124 | - subTitleLbl.textColor = HexColor("#999999") | ||
| 125 | - bgBackView.addSubview(subTitleLbl) | ||
| 126 | - | ||
| 127 | - let enterBtn = UIButton(type: .custom) | ||
| 128 | - enterBtn.frame = CGRect(x: bgBackView.right-25-65, y: 0, width: 65, height: 30) | ||
| 129 | - enterBtn.centerY = imageView.centerY | ||
| 130 | - enterBtn.setBackgroundImage(UIImage(named: "homepage_down_enter"), for: .normal) | ||
| 131 | - enterBtn.setTitle("进入", for: .normal) | ||
| 132 | - enterBtn.titleLabel?.font = BoldFont_13 | ||
| 133 | - enterBtn.setTitleColor(HexColor("#FFFFFF"), for: .normal) | ||
| 134 | - enterBtn.addTarget(self, action: #selector(enterBtnAction(_:)), for: .touchUpInside) | ||
| 135 | - enterBtn.tag = i | ||
| 136 | - bgBackView.addSubview(enterBtn) | ||
| 137 | - } | ||
| 138 | - }else if model.type == SlideModelTypeOneCourse75 { | ||
| 139 | - //单图课程 | ||
| 140 | - contentView.addSubview(bgBackView) | ||
| 141 | - bgBackView.addSubview(bgImageView) | ||
| 142 | - | ||
| 143 | - bgBackView.frame = CGRect(x: DownSlideRecommendLeftGap, y: 0,width:DownSlideSingleCourseW , height:DownSlideSingleCourseMoreH+DownSlideSingleCourseImgH) | ||
| 144 | - bgBackView.layer.shadowColor = UIColor.black.cgColor | ||
| 145 | - bgBackView.layer.shadowOpacity = 0.4 | ||
| 146 | - bgBackView.layer.shadowOffset = CGSize(width: 0, height: 1) | ||
| 147 | - | ||
| 148 | - bgImageView.frame = CGRect(x: 0, y: 0,width:DownSlideSingleCourseW , height:DownSlideSingleCourseImgH) | ||
| 149 | - bgImageView.contentMode = .scaleAspectFill | ||
| 150 | - bgImageView.layer.cornerRadius = GlobalConstants.toDayCardCornerRadius | ||
| 151 | - bgImageView.layer.maskedCorners = [.layerMinXMinYCorner, .layerMaxXMinYCorner] | ||
| 152 | - bgImageView.layer.masksToBounds = true | ||
| 153 | - bgImageView.kf.setImage(with: URL(string: model.contents[0].poster ?? "")) | ||
| 154 | - | ||
| 155 | - let titleLbl = UILabel(frame: CGRect(x: DownSlideRecommendLeftGap, y: DownSlideRecommendLeftGap, width: DownSlideSingleCourseW-DownSlideRecommendLeftGap*2, height: 30)) | ||
| 156 | - titleLbl.text = model.contents[0].title ?? "婴儿课程" | ||
| 157 | - titleLbl.font = BoldFont_21 | ||
| 158 | - titleLbl.textColor = HexColor("#FFFFFF") | ||
| 159 | - bgImageView.addSubview(titleLbl) | ||
| 160 | - | ||
| 161 | - let subTitleLbl = UILabel(frame: CGRect(x: DownSlideRecommendLeftGap, y:titleLbl.bottom , width: DownSlideSingleCourseW-DownSlideRecommendLeftGap*2, height: 30)) | ||
| 162 | - subTitleLbl.text = model.contents[0].subTitle ?? "适应3-6岁" | ||
| 163 | - subTitleLbl.font = Font_12 | ||
| 164 | - subTitleLbl.textColor = HexColor("#FFFFFF") | ||
| 165 | - bgImageView.addSubview(subTitleLbl) | ||
| 166 | - | ||
| 167 | - //单节底部视图 | ||
| 168 | - let singleCourseBottomView = UIView(frame: CGRect(x: 0, y: DownSlideSingleCourseImgH, width: DownSlideSingleCourseW, height: DownSlideSingleCourseMoreH)) | ||
| 169 | - singleCourseBottomView.layer.cornerRadius = 12 | ||
| 170 | - singleCourseBottomView.layer.maskedCorners = [.layerMinXMaxYCorner, .layerMaxXMaxYCorner] | ||
| 171 | - singleCourseBottomView.backgroundColor = .white | ||
| 172 | - singleCourseBottomView.isUserInteractionEnabled = true | ||
| 173 | - bgBackView.addSubview(singleCourseBottomView) | ||
| 174 | - | ||
| 175 | - let moreLabel = UILabel(frame: CGRect(x: DownSlideRecommendLeftGap, y: 15, width: DownSlideSingleCourseW - 50 - DownSlideRecommendLeftGap , height: 30)) | ||
| 176 | - moreLabel.text = model.blockName ?? "更多" | ||
| 177 | - moreLabel.font = Font_15 | ||
| 178 | - moreLabel.textColor = HexColor("#333333") | ||
| 179 | - singleCourseBottomView.addSubview(moreLabel) | ||
| 180 | - | ||
| 181 | - let moreImgView = UIImageView(image: UIImage(named: "homepage_down_more")) | ||
| 182 | - moreImgView.left = moreLabel.right | ||
| 183 | - moreImgView.centerY = moreLabel.centerY | ||
| 184 | - singleCourseBottomView.addSubview(moreImgView) | ||
| 185 | - } | 97 | + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { |
| 98 | + self.modelArr.count | ||
| 186 | } | 99 | } |
| 187 | 100 | ||
| 101 | + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { | ||
| 102 | + let model = self.modelArr[indexPath.row] as! CNLiveAlbumMsgModel | ||
| 103 | + guard let cell = tableView.dequeueReusableCell(withIdentifier: kCNLiveAlbumCellIdentifier) as? CNLiveAlbumCell | ||
| 104 | + else { | ||
| 105 | + let cell = CNLiveAlbumCell() | ||
| 106 | + return cell | ||
| 107 | + } | ||
| 108 | + cell.albumMsgModel = model | ||
| 109 | + | ||
| 110 | + return cell | ||
| 111 | + } | ||
| 112 | + func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { | ||
| 113 | + self.DuanJUCellSelectedCallBack!(self) | ||
| 114 | + } | ||
| 115 | + func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { | ||
| 116 | + return 45+15*2 | ||
| 117 | + } | ||
| 188 | //MARK: - 事件 | 118 | //MARK: - 事件 |
| 189 | - @objc func enterBtnAction(_ sender: UIButton){ | ||
| 190 | - let tag = sender.tag | ||
| 191 | - let contentMdl = self.slideModel?.contents[tag] | ||
| 192 | - CNLiveDownSlideTool.pushWebVCWithContentsMdl(contentMdl: contentMdl!) | 119 | + @objc func playBtnAction(){ |
| 120 | + showLoading(message: "") | ||
| 121 | +// self.getAlbumList() | ||
| 193 | } | 122 | } |
| 194 | } | 123 | } |
metaCode/Classes/Main/HomePages/View/HomepageDetail/CNLiveAlbumCell.swift
| @@ -10,6 +10,19 @@ import QMUIKit | @@ -10,6 +10,19 @@ import QMUIKit | ||
| 10 | class CNLiveAlbumCell:UITableViewCell{ | 10 | class CNLiveAlbumCell:UITableViewCell{ |
| 11 | 11 | ||
| 12 | var albumModelArr:Array<CNLiveAlbumListModel>? | 12 | var albumModelArr:Array<CNLiveAlbumListModel>? |
| 13 | + | ||
| 14 | + var _albumMsgModel : CNLiveAlbumMsgModel? | ||
| 15 | + var albumMsgModel : CNLiveAlbumMsgModel? { | ||
| 16 | + get{ | ||
| 17 | + _albumMsgModel | ||
| 18 | + } | ||
| 19 | + set{ | ||
| 20 | + _albumMsgModel = newValue! | ||
| 21 | + | ||
| 22 | + self.setupNewUIMsgModel(model: _albumMsgModel!) | ||
| 23 | + } | ||
| 24 | + } | ||
| 25 | + | ||
| 13 | //AlbumModel | 26 | //AlbumModel |
| 14 | var _albumModel : CNLiveAlbumModel? | 27 | var _albumModel : CNLiveAlbumModel? |
| 15 | var albumModel : CNLiveAlbumModel? { | 28 | var albumModel : CNLiveAlbumModel? { |
| @@ -76,6 +89,15 @@ class CNLiveAlbumCell:UITableViewCell{ | @@ -76,6 +89,15 @@ class CNLiveAlbumCell:UITableViewCell{ | ||
| 76 | self.titleLabl.text = model.title | 89 | self.titleLabl.text = model.title |
| 77 | self.subTitleLabel.text = model.subTitle | 90 | self.subTitleLabel.text = model.subTitle |
| 78 | self.iconImgView.kf.setImage(with: URL(string: model.poster)) | 91 | self.iconImgView.kf.setImage(with: URL(string: model.poster)) |
| 92 | + self.titleLabl.width = KSreenWidth-(self.iconImgView.right+15)-80 | ||
| 93 | + self.playBtn.left = KSreenWidth-80 | ||
| 94 | + } | ||
| 95 | + func setupNewUIMsgModel(model:CNLiveAlbumMsgModel){ | ||
| 96 | + self.titleLabl.text = model.albumName | ||
| 97 | + self.subTitleLabel.text = model.subTitle | ||
| 98 | + self.iconImgView.kf.setImage(with: URL(string: model.albumImg)) | ||
| 99 | + self.titleLabl.width = KSreenWidth-(self.iconImgView.right+15)-80-30 | ||
| 100 | + self.playBtn.left = KSreenWidth-80-30 | ||
| 79 | } | 101 | } |
| 80 | @objc func playBtnAction(){ | 102 | @objc func playBtnAction(){ |
| 81 | showLoading(message: "") | 103 | showLoading(message: "") |
| @@ -84,7 +106,15 @@ class CNLiveAlbumCell:UITableViewCell{ | @@ -84,7 +106,15 @@ class CNLiveAlbumCell:UITableViewCell{ | ||
| 84 | 106 | ||
| 85 | //获取专辑详情(简介等) | 107 | //获取专辑详情(简介等) |
| 86 | func getAlbumMsg(){ | 108 | func getAlbumMsg(){ |
| 87 | - CNLiveHomePageViewModel.getAlbumMsg(aid: self.albumModel!.contentId) { result, status in | 109 | + var aid = "" |
| 110 | + if self.albumModel != nil{ | ||
| 111 | + aid = self.albumModel!.contentId | ||
| 112 | + }else if self.albumMsgModel != nil{ | ||
| 113 | + aid = self.albumMsgModel!.albumId | ||
| 114 | + }else{ | ||
| 115 | + aid = "" | ||
| 116 | + } | ||
| 117 | + CNLiveHomePageViewModel.getAlbumMsg(aid: aid) { result, status in | ||
| 88 | hiddenLoading() | 118 | hiddenLoading() |
| 89 | if status == .success{ | 119 | if status == .success{ |
| 90 | let model = result as! CNLiveAlbumMsgModel | 120 | let model = result as! CNLiveAlbumMsgModel |
| @@ -100,7 +130,15 @@ class CNLiveAlbumCell:UITableViewCell{ | @@ -100,7 +130,15 @@ class CNLiveAlbumCell:UITableViewCell{ | ||
| 100 | //获取专辑视频列表详情(播放地址 ,点赞数等信息) | 130 | //获取专辑视频列表详情(播放地址 ,点赞数等信息) |
| 101 | func getAlbumList(){ | 131 | func getAlbumList(){ |
| 102 | showLoading(message: "") | 132 | showLoading(message: "") |
| 103 | - CNLiveHomePageViewModel.getAlbumList(aid: self.albumModel!.contentId){ result, status in | 133 | + var aid = "" |
| 134 | + if self.albumModel != nil{ | ||
| 135 | + aid = self.albumModel!.contentId | ||
| 136 | + }else if self.albumMsgModel != nil{ | ||
| 137 | + aid = self.albumMsgModel!.albumId | ||
| 138 | + }else{ | ||
| 139 | + aid = "" | ||
| 140 | + } | ||
| 141 | + CNLiveHomePageViewModel.getAlbumList(aid: aid){ result, status in | ||
| 104 | hiddenLoading() | 142 | hiddenLoading() |
| 105 | if status == .success{ | 143 | if status == .success{ |
| 106 | let arr = result as! Array<CNLiveAlbumListModel> | 144 | let arr = result as! Array<CNLiveAlbumListModel> |
metaCode/Classes/Main/HomePages/View/HomepageDetail/CNLiveDuanjuTitleCell.swift
0 → 100644
| 1 | +// | ||
| 2 | +// CNLiveDuanjuTitleCell.swift | ||
| 3 | +// metaCode | ||
| 4 | +// | ||
| 5 | +// Created by zx on 2024/1/10. | ||
| 6 | +// 在追短剧详情页-title cell | ||
| 7 | + | ||
| 8 | +import Foundation | ||
| 9 | + | ||
| 10 | +class CNLiveDuanjuTitleCell:UITableViewCell{ | ||
| 11 | + | ||
| 12 | + //MARK: - 懒加载 | ||
| 13 | + ///区块标题 | ||
| 14 | + lazy var blockTitleLabl: UILabel = { | ||
| 15 | + let titleLbl = UILabel(frame: CGRect(x: DownSlideRecommendLeftGap, y: 10, width: DownSlideSingleCourseW-DownSlideRecommendLeftGap*2, height: 30)) | ||
| 16 | + titleLbl.text = "在追短剧" | ||
| 17 | + titleLbl.font = BoldFont_21 | ||
| 18 | + titleLbl.textColor = HexColor("#333333") | ||
| 19 | + return titleLbl | ||
| 20 | + }() | ||
| 21 | + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { | ||
| 22 | + super.init(style: style, reuseIdentifier: reuseIdentifier) | ||
| 23 | + self.selectionStyle = .none | ||
| 24 | + | ||
| 25 | + setupUI() | ||
| 26 | + } | ||
| 27 | + | ||
| 28 | + required init?(coder aDecoder: NSCoder) { | ||
| 29 | + fatalError("init(coder:) has not been implemented") | ||
| 30 | + } | ||
| 31 | + | ||
| 32 | + private func setupUI() { | ||
| 33 | + contentView.backgroundColor = .white | ||
| 34 | + self.contentView.addSubview(self.blockTitleLabl) | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | + | ||
| 38 | +} |
metaCode/Classes/Main/HomePages/View/PlayletHomePage/CNLivePlayletHomePageHeaderCell.swift
| @@ -12,15 +12,15 @@ import SnapKit | @@ -12,15 +12,15 @@ import SnapKit | ||
| 12 | class CNLivePlayletHomePageHeaderCell:UITableViewCell{ | 12 | class CNLivePlayletHomePageHeaderCell:UITableViewCell{ |
| 13 | //MARK: - 懒加载 | 13 | //MARK: - 懒加载 |
| 14 | lazy var iconImgView :UIImageView = { | 14 | lazy var iconImgView :UIImageView = { |
| 15 | - let iconImgView = UIImageView(frame: CGRect(x: 20, y: 20, width: 100, height: 100)) | 15 | + let iconImgView = UIImageView(frame: CGRect(x: 20, y: 20, width: 112, height: 147)) |
| 16 | return iconImgView | 16 | return iconImgView |
| 17 | }() | 17 | }() |
| 18 | ///标题 | 18 | ///标题 |
| 19 | lazy var titleLabl: UILabel = { | 19 | lazy var titleLabl: UILabel = { |
| 20 | - let titleLabel = UILabel.init(frame: CGRectMake(self.iconImgView.right+10, self.iconImgView.top+20, KSreenWidth-(self.iconImgView.right+15)-10, 21)) | 20 | + let titleLabel = UILabel.init(frame: CGRectMake(self.iconImgView.right+15, self.iconImgView.top, KSreenWidth-(self.iconImgView.right+15)-10, 21)) |
| 21 | titleLabel.textColor = HexColor("#333333") | 21 | titleLabel.textColor = HexColor("#333333") |
| 22 | titleLabel.textAlignment = .left | 22 | titleLabel.textAlignment = .left |
| 23 | - titleLabel.font = Font_20 | 23 | + titleLabel.font = Font_15 |
| 24 | titleLabel.text = "啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊" | 24 | titleLabel.text = "啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊" |
| 25 | let height = titleLabel.qmui_lineHeight | 25 | let height = titleLabel.qmui_lineHeight |
| 26 | titleLabel.height = height | 26 | titleLabel.height = height |
metaCode/Classes/Main/HomePages/ViewModel/CNLiveHomePageViewModel.swift
| @@ -33,11 +33,10 @@ class CNLiveHomePageViewModel:NSObject{ | @@ -33,11 +33,10 @@ class CNLiveHomePageViewModel:NSObject{ | ||
| 33 | } | 33 | } |
| 34 | } | 34 | } |
| 35 | /// 获取首页我的专辑收藏数据 | 35 | /// 获取首页我的专辑收藏数据 |
| 36 | - static func requestGetHomePage(resultBlock: @escaping downSlideResultBlock) { | 36 | + static func requestGetHomePageMyAlbum(page:NSInteger,resultBlock: @escaping downSlideResultBlock) { |
| 37 | let param = NSMutableDictionary() | 37 | let param = NSMutableDictionary() |
| 38 | param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "sid") | 38 | param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "sid") |
| 39 | - param.setValue("1", forKey: "page") | ||
| 40 | - param.setValue("50", forKey: "pageSize") | 39 | + param.setValue("\(page)", forKey: "page") |
| 41 | 40 | ||
| 42 | CNLiveNetworking.setAllowRequestDefaultArgument(true) | 41 | CNLiveNetworking.setAllowRequestDefaultArgument(true) |
| 43 | CNLiveNetworking.setupShowDataResult(false) | 42 | CNLiveNetworking.setupShowDataResult(false) |
| @@ -47,10 +46,19 @@ class CNLiveHomePageViewModel:NSObject{ | @@ -47,10 +46,19 @@ class CNLiveHomePageViewModel:NSObject{ | ||
| 47 | let resp = result as! NSDictionary | 46 | let resp = result as! NSDictionary |
| 48 | let errorCode = "\(resp["errorCode"] ?? "0")" | 47 | let errorCode = "\(resp["errorCode"] ?? "0")" |
| 49 | if (errorCode == "0") { | 48 | if (errorCode == "0") { |
| 50 | - let dataDic = resp["data"] as! Dictionary<String, Any> | ||
| 51 | - let dataMdl = newDictionaryToModel(dataDic, CNLiveHomePageModel.self) | 49 | + let dataArr = resp["data"] as! Array<Any> |
| 50 | + var resArr = [] | ||
| 51 | + if dataArr.count > 0{ | ||
| 52 | + //有在追短剧 | ||
| 53 | + for dataDic in dataArr { | ||
| 54 | + let dataMdl = newDictionaryToModel(dataDic as! [String : Any], CNLiveAlbumMsgModel.self) | ||
| 55 | + resArr.append(dataMdl) | ||
| 56 | + } | ||
| 57 | + }else{ | ||
| 58 | + //没有在追短剧 | ||
| 59 | + } | ||
| 52 | 60 | ||
| 53 | - resultBlock(dataMdl,.success) | 61 | + resultBlock(resArr,.success) |
| 54 | } | 62 | } |
| 55 | else{ | 63 | else{ |
| 56 | resultBlock(NSNull(),.failed) | 64 | resultBlock(NSNull(),.failed) |
| @@ -59,9 +67,11 @@ class CNLiveHomePageViewModel:NSObject{ | @@ -59,9 +67,11 @@ class CNLiveHomePageViewModel:NSObject{ | ||
| 59 | } | 67 | } |
| 60 | } | 68 | } |
| 61 | /// 获取首页-全部专辑列表 | 69 | /// 获取首页-全部专辑列表 |
| 62 | - static func getBlockContents(blockId:String,resultBlock: @escaping downSlideResultBlock) { | 70 | + static func getBlockContents(blockId:String,page:NSInteger,resultBlock: @escaping downSlideResultBlock) { |
| 63 | let param = NSMutableDictionary() | 71 | let param = NSMutableDictionary() |
| 64 | param.setValue(blockId, forKey: "blockId") | 72 | param.setValue(blockId, forKey: "blockId") |
| 73 | + param.setValue("\(page)", forKey: "page") | ||
| 74 | +// param.setValue("10", forKey: "pageSize") | ||
| 65 | CNLiveNetworking.setAllowRequestDefaultArgument(true) | 75 | CNLiveNetworking.setAllowRequestDefaultArgument(true) |
| 66 | CNLiveNetworking.setupShowDataResult(false) | 76 | CNLiveNetworking.setupShowDataResult(false) |
| 67 | CNLiveNetworking.requestNetwork(with: .GET, urlString: APPBaseCMSUrl+"/contentApi/getBlockContents", param: param as! [String : String], cacheType: .networkOnly) { task, result, error in | 77 | CNLiveNetworking.requestNetwork(with: .GET, urlString: APPBaseCMSUrl+"/contentApi/getBlockContents", param: param as! [String : String], cacheType: .networkOnly) { task, result, error in |
metaCode/Classes/Main/ShopPage/Controller/CNLiveShopOrderListViewController.swift
| @@ -49,6 +49,7 @@ class CNLiveShopOrderListViewController: CNLiveBaseViewController, UITableViewDe | @@ -49,6 +49,7 @@ class CNLiveShopOrderListViewController: CNLiveBaseViewController, UITableViewDe | ||
| 49 | 49 | ||
| 50 | var pageNum: NSInteger | 50 | var pageNum: NSInteger |
| 51 | var network_type: CNLiveMineResponseType! | 51 | var network_type: CNLiveMineResponseType! |
| 52 | + | ||
| 52 | var _show_type:CNLiveShopOrderListShowType! | 53 | var _show_type:CNLiveShopOrderListShowType! |
| 53 | init(show_type:CNLiveShopOrderListShowType) { | 54 | init(show_type:CNLiveShopOrderListShowType) { |
| 54 | self.pageNum = 1 | 55 | self.pageNum = 1 |
metaCode/Supporting Files/Assets.xcassets/TabBar/tabbar_authentication.imageset/Contents.json
0 → 100644
| 1 | +{ | ||
| 2 | + "images" : [ | ||
| 3 | + { | ||
| 4 | + "idiom" : "universal", | ||
| 5 | + "scale" : "1x" | ||
| 6 | + }, | ||
| 7 | + { | ||
| 8 | + "filename" : "authentication@2x.png", | ||
| 9 | + "idiom" : "universal", | ||
| 10 | + "scale" : "2x" | ||
| 11 | + }, | ||
| 12 | + { | ||
| 13 | + "filename" : "authentication@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/TabBar/tabbar_authentication.imageset/authentication@2x.png
0 → 100644
1.4 KB
metaCode/Supporting Files/Assets.xcassets/TabBar/tabbar_authentication.imageset/authentication@3x.png
0 → 100644
2.52 KB
metaCode/Supporting Files/Assets.xcassets/TabBar/tabbar_authentication_unSelect.imageset/Contents.json
0 → 100644
| 1 | +{ | ||
| 2 | + "images" : [ | ||
| 3 | + { | ||
| 4 | + "idiom" : "universal", | ||
| 5 | + "scale" : "1x" | ||
| 6 | + }, | ||
| 7 | + { | ||
| 8 | + "filename" : "authentication_unSelect@2x.png", | ||
| 9 | + "idiom" : "universal", | ||
| 10 | + "scale" : "2x" | ||
| 11 | + }, | ||
| 12 | + { | ||
| 13 | + "filename" : "authentication_unSelect@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/TabBar/tabbar_authentication_unSelect.imageset/authentication_unSelect@2x.png
0 → 100644
1.32 KB
metaCode/Supporting Files/Assets.xcassets/TabBar/tabbar_authentication_unSelect.imageset/authentication_unSelect@3x.png
0 → 100644
2.34 KB