Commit 55ab9eaa6cee08f24f7c64fa8b49b1cd1f659760

Authored by 张旭
1 parent 0008e462

下滑页支持原生页面以及详情页面

Showing 29 changed files with 1114 additions and 202 deletions
metaCode.xcodeproj/project.pbxproj
... ... @@ -10,14 +10,21 @@
10 10 0D39E93D7229931C86EB1161 /* Pods_metaCode_metaCodeUITests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 63D879B49B1E42F1584DD75E /* Pods_metaCode_metaCodeUITests.framework */; };
11 11 19123FC12ABC11170075C883 /* CNWebViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19123FC02ABC11170075C883 /* CNWebViewController.swift */; };
12 12 192336EB2AD9224300D47CD4 /* CNUpSlideViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 192336EA2AD9224300D47CD4 /* CNUpSlideViewController.swift */; };
13   - 19CC4D472ADD006600308E2A /* CNDownSlideCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19CC4D462ADD006600308E2A /* CNDownSlideCell.swift */; };
  13 + 1926C28F2AE0D76C00C71DC3 /* CNLiveDownSlideViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1926C28E2AE0D76C00C71DC3 /* CNLiveDownSlideViewModel.swift */; };
  14 + 1926C2912AE0FD4500C71DC3 /* CNLiveDownSlideModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1926C2902AE0FD4500C71DC3 /* CNLiveDownSlideModel.swift */; };
  15 + 19BB1FDF2AEA3A450094D962 /* CNSlideBaseNavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19BB1FDE2AEA3A450094D962 /* CNSlideBaseNavigationController.swift */; };
  16 + 19CC4D472ADD006600308E2A /* CNDownSlideSingleCourseCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19CC4D462ADD006600308E2A /* CNDownSlideSingleCourseCell.swift */; };
14 17 19CC4D492ADD06C500308E2A /* UITableView+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19CC4D482ADD06C500308E2A /* UITableView+Extension.swift */; };
15 18 19CC4D4B2ADD086F00308E2A /* CNUpSlideDetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19CC4D4A2ADD086F00308E2A /* CNUpSlideDetailViewController.swift */; };
16 19 19CC4D4F2ADD0FC200308E2A /* CNUpSlideDetailScrollView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19CC4D4E2ADD0FC200308E2A /* CNUpSlideDetailScrollView.swift */; };
17 20 19CC4D522ADD129800308E2A /* CNUpSlideAnimationTransition.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19CC4D512ADD129800308E2A /* CNUpSlideAnimationTransition.swift */; };
18 21 19CC4D542ADD163D00308E2A /* CNUpSlideCardPresentationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19CC4D532ADD163D00308E2A /* CNUpSlideCardPresentationController.swift */; };
19 22 19CC4D562ADD19C200308E2A /* String+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19CC4D552ADD19C200308E2A /* String+Extension.swift */; };
  23 + 19D2CE632AE8B65D00691757 /* CNLiveDownSlideTool.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19D2CE622AE8B65D00691757 /* CNLiveDownSlideTool.swift */; };
20 24 19F1C2332AB5728B0083D06C /* CNIDCardView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19F1C2322AB5728B0083D06C /* CNIDCardView.swift */; };
  25 + 19FA20172AE22D3C001F7186 /* CNLiveDownSlideRecommendCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19FA20162AE22D3C001F7186 /* CNLiveDownSlideRecommendCell.swift */; };
  26 + 19FA20192AE22D98001F7186 /* CNLiveDownSlideTodayRecommendCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19FA20182AE22D98001F7186 /* CNLiveDownSlideTodayRecommendCell.swift */; };
  27 + 19FA201B2AE60423001F7186 /* CNLiveDownSlideModelLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19FA201A2AE60423001F7186 /* CNLiveDownSlideModelLayout.swift */; };
21 28 1DD2808DF02C120276F99F4D /* Pods_metaCode.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F1C55A719CFEE073C06D37CE /* Pods_metaCode.framework */; };
22 29 7905BB492AB0588B0089BC50 /* CNLiveMineAuthResultViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7905BB482AB0588B0089BC50 /* CNLiveMineAuthResultViewController.swift */; };
23 30 790B1FB42A4153E90074CF00 /* CNLiveMineBaseModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 790B1FB32A4153E90074CF00 /* CNLiveMineBaseModel.swift */; };
... ... @@ -125,14 +132,21 @@
125 132 170BC5D0622EA2969D110A3B /* Pods-metaCode.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-metaCode.release.xcconfig"; path = "Target Support Files/Pods-metaCode/Pods-metaCode.release.xcconfig"; sourceTree = "<group>"; };
126 133 19123FC02ABC11170075C883 /* CNWebViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNWebViewController.swift; sourceTree = "<group>"; };
127 134 192336EA2AD9224300D47CD4 /* CNUpSlideViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNUpSlideViewController.swift; sourceTree = "<group>"; };
128   - 19CC4D462ADD006600308E2A /* CNDownSlideCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNDownSlideCell.swift; sourceTree = "<group>"; };
  135 + 1926C28E2AE0D76C00C71DC3 /* CNLiveDownSlideViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveDownSlideViewModel.swift; sourceTree = "<group>"; };
  136 + 1926C2902AE0FD4500C71DC3 /* CNLiveDownSlideModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveDownSlideModel.swift; sourceTree = "<group>"; };
  137 + 19BB1FDE2AEA3A450094D962 /* CNSlideBaseNavigationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNSlideBaseNavigationController.swift; sourceTree = "<group>"; };
  138 + 19CC4D462ADD006600308E2A /* CNDownSlideSingleCourseCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNDownSlideSingleCourseCell.swift; sourceTree = "<group>"; };
129 139 19CC4D482ADD06C500308E2A /* UITableView+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UITableView+Extension.swift"; sourceTree = "<group>"; };
130 140 19CC4D4A2ADD086F00308E2A /* CNUpSlideDetailViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNUpSlideDetailViewController.swift; sourceTree = "<group>"; };
131 141 19CC4D4E2ADD0FC200308E2A /* CNUpSlideDetailScrollView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNUpSlideDetailScrollView.swift; sourceTree = "<group>"; };
132 142 19CC4D512ADD129800308E2A /* CNUpSlideAnimationTransition.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNUpSlideAnimationTransition.swift; sourceTree = "<group>"; };
133 143 19CC4D532ADD163D00308E2A /* CNUpSlideCardPresentationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNUpSlideCardPresentationController.swift; sourceTree = "<group>"; };
134 144 19CC4D552ADD19C200308E2A /* String+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "String+Extension.swift"; sourceTree = "<group>"; };
  145 + 19D2CE622AE8B65D00691757 /* CNLiveDownSlideTool.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveDownSlideTool.swift; sourceTree = "<group>"; };
135 146 19F1C2322AB5728B0083D06C /* CNIDCardView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNIDCardView.swift; sourceTree = "<group>"; };
  147 + 19FA20162AE22D3C001F7186 /* CNLiveDownSlideRecommendCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveDownSlideRecommendCell.swift; sourceTree = "<group>"; };
  148 + 19FA20182AE22D98001F7186 /* CNLiveDownSlideTodayRecommendCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveDownSlideTodayRecommendCell.swift; sourceTree = "<group>"; };
  149 + 19FA201A2AE60423001F7186 /* CNLiveDownSlideModelLayout.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveDownSlideModelLayout.swift; sourceTree = "<group>"; };
136 150 54E09C540E13D78166D71395 /* Pods_metaCodeTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_metaCodeTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
137 151 63D879B49B1E42F1584DD75E /* Pods_metaCode_metaCodeUITests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_metaCode_metaCodeUITests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
138 152 67F8190701D1AB7F7724E8BA /* Pods-metaCodeTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-metaCodeTests.release.xcconfig"; path = "Target Support Files/Pods-metaCodeTests/Pods-metaCodeTests.release.xcconfig"; sourceTree = "<group>"; };
... ... @@ -261,6 +275,8 @@
261 275 isa = PBXGroup;
262 276 children = (
263 277 19CC4D512ADD129800308E2A /* CNUpSlideAnimationTransition.swift */,
  278 + 19FA201A2AE60423001F7186 /* CNLiveDownSlideModelLayout.swift */,
  279 + 19D2CE622AE8B65D00691757 /* CNLiveDownSlideTool.swift */,
264 280 );
265 281 path = Util;
266 282 sourceTree = "<group>";
... ... @@ -552,6 +568,8 @@
552 568 isa = PBXGroup;
553 569 children = (
554 570 7C83B43D2A52B8BA004BF4A4 /* CNHomePageViewModel.swift */,
  571 + 1926C28E2AE0D76C00C71DC3 /* CNLiveDownSlideViewModel.swift */,
  572 + 1926C2902AE0FD4500C71DC3 /* CNLiveDownSlideModel.swift */,
555 573 );
556 574 name = ViewModel;
557 575 path = HomePage/ViewModel;
... ... @@ -581,7 +599,9 @@
581 599 7C4931372A307BDB000E44B4 /* CNHomePageGuideView.swift */,
582 600 7C27032F2A36CBE30061EC50 /* CNCertificationView.swift */,
583 601 19F1C2322AB5728B0083D06C /* CNIDCardView.swift */,
584   - 19CC4D462ADD006600308E2A /* CNDownSlideCell.swift */,
  602 + 19FA20162AE22D3C001F7186 /* CNLiveDownSlideRecommendCell.swift */,
  603 + 19FA20182AE22D98001F7186 /* CNLiveDownSlideTodayRecommendCell.swift */,
  604 + 19CC4D462ADD006600308E2A /* CNDownSlideSingleCourseCell.swift */,
585 605 19CC4D4E2ADD0FC200308E2A /* CNUpSlideDetailScrollView.swift */,
586 606 );
587 607 name = View;
... ... @@ -591,6 +611,7 @@
591 611 7CD6754D2A2840B9008354C1 /* Controller */ = {
592 612 isa = PBXGroup;
593 613 children = (
  614 + 19BB1FDE2AEA3A450094D962 /* CNSlideBaseNavigationController.swift */,
594 615 7CD6754E2A2840B9008354C1 /* CNMetaCodeHomePageController.swift */,
595 616 19123FC02ABC11170075C883 /* CNWebViewController.swift */,
596 617 192336EA2AD9224300D47CD4 /* CNUpSlideViewController.swift */,
... ... @@ -915,6 +936,7 @@
915 936 790D01A52A2DF65E00C5978D /* CNLiveLoginPickerView.swift in Sources */,
916 937 79BA085D2AB18E8300D01875 /* CNLiveSaveAuthDB.swift in Sources */,
917 938 79282A3C2A2EDC2500B5F8CF /* NSString+CNLiveExtensions.swift in Sources */,
  939 + 19D2CE632AE8B65D00691757 /* CNLiveDownSlideTool.swift in Sources */,
918 940 790B1FB82A41B6A60074CF00 /* CNLiveMineMessageViewController.swift in Sources */,
919 941 798A44F22A30674200815935 /* CNLiveMineSubBodyListView.swift in Sources */,
920 942 790D01822A2D88FC00C5978D /* CNLiveConfigMacro.swift in Sources */,
... ... @@ -923,19 +945,22 @@
923 945 7C83B4442A541F36004BF4A4 /* NSDate+CNLiveExtensions.swift in Sources */,
924 946 7CD675482A274167008354C1 /* PGIndexBannerSubiew.m in Sources */,
925 947 790D019F2A2DD66E00C5978D /* CNLiveLoginViewModel.swift in Sources */,
  948 + 1926C2912AE0FD4500C71DC3 /* CNLiveDownSlideModel.swift in Sources */,
926 949 7C7C62F62A4D72E9007A912E /* CNLiveIdentityDB.swift in Sources */,
927 950 19CC4D4F2ADD0FC200308E2A /* CNUpSlideDetailScrollView.swift in Sources */,
928 951 79EABB892AB4497700F3A4E2 /* CNLiveSaveStandDB.swift in Sources */,
929 952 790B1FB62A41938F0074CF00 /* UIImage+CNLiveExtensions.swift in Sources */,
930 953 790D019D2A2DCBD000C5978D /* UIView+CNLiveExtensions.swift in Sources */,
931 954 790B1FB62A41938F0074CF00 /* UIImage+CNLiveExtensions.swift in Sources */,
  955 + 19FA20172AE22D3C001F7186 /* CNLiveDownSlideRecommendCell.swift in Sources */,
932 956 19123FC12ABC11170075C883 /* CNWebViewController.swift in Sources */,
  957 + 1926C28F2AE0D76C00C71DC3 /* CNLiveDownSlideViewModel.swift in Sources */,
933 958 790D019D2A2DCBD000C5978D /* UIView+CNLiveExtensions.swift in Sources */,
934 959 7C7C62F62A4D72E9007A912E /* CNLiveIdentityDB.swift in Sources */,
935 960 790B1FB62A41938F0074CF00 /* UIImage+CNLiveExtensions.swift in Sources */,
936 961 790D019D2A2DCBD000C5978D /* UIView+CNLiveExtensions.swift in Sources */,
937 962 79E496E82AB9674300127BF8 /* NSMutableAttributedString+CNLiveExtensions.swift in Sources */,
938   - 19CC4D472ADD006600308E2A /* CNDownSlideCell.swift in Sources */,
  963 + 19CC4D472ADD006600308E2A /* CNDownSlideSingleCourseCell.swift in Sources */,
939 964 79E496E32AB9357000127BF8 /* UITableViewCell+CNLiveExtension.swift in Sources */,
940 965 7C83B4422A541EBF004BF4A4 /* CALayer+CNLiveExtensions.swift in Sources */,
941 966 798A44F72A3077ED00815935 /* CNLiveHotButton.swift in Sources */,
... ... @@ -944,6 +969,7 @@
944 969 7CD675522A29C04B008354C1 /* CNLiveConfigstant.swift in Sources */,
945 970 79282A402A2F055100B5F8CF /* CNLiveConfigUserInfo.swift in Sources */,
946 971 7C83B43E2A52B8BA004BF4A4 /* CNHomePageViewModel.swift in Sources */,
  972 + 19BB1FDF2AEA3A450094D962 /* CNSlideBaseNavigationController.swift in Sources */,
947 973 7C4931382A307BDB000E44B4 /* CNHomePageGuideView.swift in Sources */,
948 974 7CD6753E2A2740B0008354C1 /* CNUpSlideView.swift in Sources */,
949 975 7CD675402A2740B0008354C1 /* CNDownSlideView.swift in Sources */,
... ... @@ -972,6 +998,7 @@
972 998 79A68C4A2A26E6CE00DC3B43 /* (null) in Sources */,
973 999 790D01852A2D89E100C5978D /* UIColor+CNLiveExtensions.swift in Sources */,
974 1000 79396EED2A319F220053E1AF /* NSObject+CNLiveExtensions.swift in Sources */,
  1001 + 19FA201B2AE60423001F7186 /* CNLiveDownSlideModelLayout.swift in Sources */,
975 1002 7C4931312A2F142F000E44B4 /* CNHomePageBackgroupView.swift in Sources */,
976 1003 790D018B2A2D8B3300C5978D /* CNLiveLoginViewController.swift in Sources */,
977 1004 19CC4D562ADD19C200308E2A /* String+Extension.swift in Sources */,
... ... @@ -980,6 +1007,7 @@
980 1007 7CD675422A2740F8008354C1 /* CNCustomIndexView.swift in Sources */,
981 1008 790D01912A2DAC5E00C5978D /* CNLiveConfigFontMacro.swift in Sources */,
982 1009 790D01852A2D89E100C5978D /* UIColor+CNLiveExtensions.swift in Sources */,
  1010 + 19FA20192AE22D98001F7186 /* CNLiveDownSlideTodayRecommendCell.swift in Sources */,
983 1011 790B1FB42A4153E90074CF00 /* CNLiveMineBaseModel.swift in Sources */,
984 1012 7978A8432A396632007C86B8 /* CNLiveMineViewModel.swift in Sources */,
985 1013 798A44EE2A305AAC00815935 /* CNLiveBaseNavigationController.swift in Sources */,
... ...
metaCode/Classes/Common/Base/CNLiveBaseNavigationController.swift
... ... @@ -11,7 +11,6 @@ class CNLiveBaseNavigationController : UINavigationController, UIGestureRecogniz
11 11  
12 12 override func viewDidLoad() {
13 13 super.viewDidLoad()
14   -
15 14 guard let targets = interactivePopGestureRecognizer?.value(forKey: "_targets") as? [NSObject] else {return}
16 15 let targetObjc = targets[0]
17 16 let target = targetObjc.value(forKey: "target")
... ...
metaCode/Classes/Common/Base/CNLiveBaseViewController.swift
... ... @@ -8,7 +8,7 @@
8 8 import UIKit
9 9 import Foundation
10 10  
11   -class CNLiveBaseViewController: UIViewController {
  11 +class CNLiveBaseViewController: UIViewController {
12 12  
13 13 static let kTopNavLeftRightOffset = 6.0
14 14 /// topNavView的高度 默认高度为 get_system_nav_height()
... ... @@ -215,12 +215,23 @@ class CNLiveBaseViewController: UIViewController {
215 215 leftBtnWhite = false
216 216 }
217 217  
  218 +
218 219 @objc func ClickBackBtn() {
219   - if (self.presentingViewController != nil) {
220   - self.dismiss(animated: true)
  220 + let viewControllers = self.navigationController?.viewControllers
  221 + if viewControllers!.count > 1 {
  222 + if viewControllers?.last == self {
  223 + self.navigationController!.popViewController(animated: true)
  224 + }
221 225 }else{
222   - self.navigationController!.popViewController(animated: true)
  226 + if (self.presentingViewController != nil) {
  227 + self.dismiss(animated: true)
  228 + }
223 229 }
  230 +// if (self.presentingViewController != nil) {
  231 +// self.dismiss(animated: true)
  232 +// }else{
  233 +// self.navigationController!.popViewController(animated: true)
  234 +// }
224 235 }
225 236  
226 237 @objc func topNavViewTap() {
... ...
metaCode/Classes/Config/CNLiveConfigFontMacro.swift
... ... @@ -61,6 +61,7 @@ let Font_17 = Font(17)
61 61 let Font_18 = Font(18)
62 62 let Font_19 = Font(19)
63 63 let Font_20 = Font(20)
  64 +let Font_21 = Font(21)
64 65 let Font_25 = Font(25)
65 66 let Font_30 = Font(30)
66 67  
... ... @@ -77,6 +78,7 @@ let Font_17_Fit = Font(17 * FontFit)
77 78 let Font_18_Fit = Font(18 * FontFit)
78 79 let Font_19_Fit = Font(19 * FontFit)
79 80 let Font_20_Fit = Font(20 * FontFit)
  81 +let Font_21_Fit = Font(21 * FontFit)
80 82 let Font_25_Fit = Font(25 * FontFit)
81 83 let Font_30_Fit = Font(30 * FontFit)
82 84  
... ... @@ -93,6 +95,7 @@ let BoldFont_17 = BoldFont(17)
93 95 let BoldFont_18 = BoldFont(18)
94 96 let BoldFont_19 = BoldFont(19)
95 97 let BoldFont_20 = BoldFont(20)
  98 +let BoldFont_21 = BoldFont(21)
96 99 let BoldFont_25 = BoldFont(25)
97 100 let BoldFont_30 = BoldFont(30)
98 101  
... ...
metaCode/Classes/Environment/CNLiveEnvironment.swift
... ... @@ -25,6 +25,8 @@ let APPBaseMCUrl: String = CNLiveEnvironmentManager.shared.base_mc_url
25 25 let APPBaseWjjUrl: String = CNLiveEnvironmentManager.shared.base_wjj_url
26 26 /// 网家家内电商接口
27 27 let APPBaseWjjShopUrl: String = CNLiveEnvironmentManager.shared.base_mjj_shop_url
  28 +/// cms接口
  29 +let APPBaseCMSUrl: String = CNLiveEnvironmentManager.shared.base_cms_url
28 30  
29 31 ///当前APP的环境
30 32 let APPCurrentEnvironment: CNLiveEnvironment = CNLiveEnvironmentManager.shared.currentEnvironment
... ... @@ -69,6 +71,8 @@ class CNLiveEnvironmentManager: NSObject{
69 71 var base_mjj_shop_url: String
70 72 /// 元码webViewUA设置
71 73 var base_web_UA: String = "yuanma"
  74 + /// cms域名请求
  75 + var base_cms_url: String
72 76  
73 77 ///当前环境
74 78 var currentEnvironment: CNLiveEnvironment
... ... @@ -85,6 +89,7 @@ class CNLiveEnvironmentManager: NSObject{
85 89 self.img_token_url = ""
86 90 self.base_wjj_url = ""
87 91 self.base_mjj_shop_url = ""
  92 + self.base_cms_url = ""
88 93 self.currentEnvironment = .development
89 94 }
90 95 //重新copy 和 mutableCopy 方法
... ... @@ -123,6 +128,7 @@ class CNLiveEnvironmentManager: NSObject{
123 128 self.base_mc_url = "https://metacode.cnlive.com/api"
124 129 self.base_wjj_url = "https://apiwjj.cnlive.com"
125 130 self.base_mjj_shop_url = "https://manageshop.cnlive.com"
  131 + self.base_cms_url = "https://cmsapi.cnlive.com"
126 132 }
127 133 //testFlight 环境配置
128 134 func testFlightEnvironment(){
... ... @@ -136,6 +142,7 @@ class CNLiveEnvironmentManager: NSObject{
136 142 self.base_mc_url = "https://metacode.cnlive.com/api"
137 143 self.base_wjj_url = "https://apiwjj.cnlive.com"
138 144 self.base_mjj_shop_url = "https://manageshop.cnlive.com"
  145 + self.base_cms_url = "https://cmsapi.cnlive.com"
139 146 }
140 147 //production 生产环境配置
141 148 func productionEnvironment(){
... ... @@ -149,6 +156,7 @@ class CNLiveEnvironmentManager: NSObject{
149 156 self.base_mc_url = "https://metacode.cnlive.com/api"
150 157 self.base_wjj_url = "https://apiwjj.cnlive.com"
151 158 self.base_mjj_shop_url = "https://manageshop.cnlive.com"
  159 + self.base_cms_url = "https://cmsapi.cnlive.com"
152 160 }
153 161  
154 162 }
... ...
metaCode/Classes/Extensions/NSObject+CNLiveExtensions.swift
... ... @@ -45,7 +45,6 @@ private func currentVC(_ vc :UIViewController?) -&gt; UIViewController? {
45 45 }
46 46 }
47 47  
48   -
49 48 /// 弹框提示
50 49 /// - Parameter message: 内容提示
51 50 func showMessage(message: String) {
... ... @@ -138,7 +137,7 @@ func jsonToModel(_ jsonStr:String,_ modelType:HandyJSON.Type) -&gt; BaseModel {
138 137 /**
139 138 * Json转数组对象
140 139 */
141   -func jsonArrayToModel(_ jsonArrayStr:String, _ modelType:HandyJSON.Type,_ path: String) ->[BaseModel] {
  140 +func jsonArrayToModel(_ jsonArrayStr:String, _ modelType:HandyJSON.Type) ->[BaseModel] {
142 141 if jsonArrayStr == "" || jsonArrayStr.count == 0 {
143 142 #if DEBUG
144 143 print("jsonToModelArray:字符串为空")
... ... @@ -149,12 +148,24 @@ func jsonArrayToModel(_ jsonArrayStr:String, _ modelType:HandyJSON.Type,_ path:
149 148 let data = jsonArrayStr.data(using: String.Encoding.utf8)
150 149 let peoplesArray = try! JSONSerialization.jsonObject(with:data!, options: JSONSerialization.ReadingOptions()) as? [AnyObject]
151 150 for people in peoplesArray! {
152   - modelArray.append(dictionaryToModel(people as! [String : Any], modelType,path))
  151 + modelArray.append(newDictionaryToModel(people as! [String : Any], modelType))
153 152 }
154 153 return modelArray
155 154  
156 155 }
157 156 /**
  157 + * (新)字典转对象
  158 + */
  159 +func newDictionaryToModel(_ dictionStr:[String:Any],_ modelType:HandyJSON.Type) -> BaseModel {
  160 + if dictionStr.count == 0 {
  161 + #if DEBUG
  162 + print("dictionaryToModel:字符串为空")
  163 + #endif
  164 + return BaseModel()
  165 + }
  166 + return modelType.deserialize(from: dictionStr) as! BaseModel
  167 +}
  168 +/**
158 169 * 字典转对象
159 170 */
160 171 func dictionaryToModel(_ dictionStr:[String:Any],_ modelType:HandyJSON.Type,_ path: String) -> BaseModel {
... ...
metaCode/Classes/Main/HomePage/Controller/CNMetaCodeHomePageController.swift
... ... @@ -19,7 +19,7 @@ let LeftGap: CGFloat = UIScreen.main.bounds.size.width &lt;= 375 ? 23 : 40
19 19 ///主窗口宽度
20 20 let MainViewW: CGFloat = Width-LeftGap*2//Width-50
21 21 ///下滑页底部工具条高度
22   -let DownSllideBottomViewHeight: CGFloat = 74
  22 +let DownSlideBottomViewHeight: CGFloat = 74
23 23  
24 24 ///存储是否第一次显示首页上滑引导
25 25 let CNKeyIsFirstAppearUpSlideHomeGuide: String = "isFirstAppearUpSlideHomeGuideKey"
... ... @@ -559,7 +559,7 @@ class CNMetaCodeHomePageController:CNLiveBaseViewController, NewPagedFlowViewDel
559 559 print(url)
560 560 if(navigationAction.navigationType == .linkActivated){
561 561 let webVC = CNWebViewController()
562   - webVC.url = url
  562 + webVC.url = URL(string: url)
563 563 currentViewController()?.navigationController?.pushViewController(webVC, animated: true)
564 564 decisionHandler(.cancel, preferences)
565 565 return
... ...
metaCode/Classes/Main/HomePage/Controller/CNSlideBaseNavigationController.swift 0 → 100644
  1 +//
  2 +// CNSlideBaseNavigationController.swift
  3 +// metaCode
  4 +//
  5 +// Created by zx on 2023/10/26.
  6 +//
  7 +
  8 +import Foundation
  9 +
  10 +class CNSlideBaseNavigationController: UINavigationController
  11 + ,UIViewControllerTransitioningDelegate {
  12 + var dismissClosure: (()->())?
  13 + override func viewDidLoad() {
  14 + super.viewDidLoad()
  15 + modalPresentationStyle = .custom
  16 + transitioningDelegate = self
  17 + }
  18 +
  19 + func animationController(forPresented presented: UIViewController, presenting: UIViewController, source: UIViewController) -> UIViewControllerAnimatedTransitioning? {
  20 + return CNUpSlideAnimationTransition(animationType: .present)
  21 + }
  22 +
  23 + func animationController(forDismissed dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? {
  24 + return CNUpSlideAnimationTransition(animationType: .dismiss)
  25 + }
  26 +
  27 + func presentationController(forPresented presented: UIViewController, presenting: UIViewController?, source: UIViewController) -> UIPresentationController? {
  28 + return CNUpSlideCardPresentationController(presentedViewController: presented, presenting: presenting)
  29 + }
  30 +}
... ...
metaCode/Classes/Main/HomePage/Controller/CNUpSlideDetailViewController.swift
... ... @@ -7,10 +7,17 @@
7 7  
8 8 import Foundation
9 9  
10   -class CNUpSlideDetailViewController: UIViewController {
  10 +class CNUpSlideDetailViewController: CNLiveBaseViewController {
11 11  
12   - override var prefersStatusBarHidden: Bool {
13   - return true
  12 + //slideModel
  13 + var _slideModel : CNLiveDownSlideModel?
  14 + var slideModel : CNLiveDownSlideModel? {
  15 + get{
  16 + _slideModel
  17 + }
  18 + set{
  19 + _slideModel = newValue!
  20 + }
14 21 }
15 22  
16 23 var dismissClosure: (()->())?
... ... @@ -19,7 +26,7 @@ class CNUpSlideDetailViewController: UIViewController {
19 26  
20 27 var draggingDownToDismiss = false
21 28  
22   - let cell: CNDownSlideCell!
  29 + let cell: CNDownSlideSingleCourseCell!
23 30  
24 31 private lazy var dismissPanGesture: UIPanGestureRecognizer = {
25 32 let ges = UIPanGestureRecognizer()
... ... @@ -32,6 +39,9 @@ class CNUpSlideDetailViewController: UIViewController {
32 39 lazy var scrollView: CNUpSlideDetailScrollView = {
33 40 let frame = self.view.bounds
34 41 let view = CNUpSlideDetailScrollView(frame: frame)
  42 + view.callBack = {(contentMdl:CNLiveDownSlideContentsModel)->Void in
  43 + CNLiveDownSlideTool.detailPushWebVCWithContentsMdl(contentMdl: contentMdl, viewController: self)
  44 + }
35 45 view.delegate = self
36 46 return view
37 47 }()
... ... @@ -44,14 +54,12 @@ class CNUpSlideDetailViewController: UIViewController {
44 54 return btn
45 55 }()
46 56  
47   - init(cell: CNDownSlideCell) {
  57 + init(cell: CNDownSlideSingleCourseCell,slideModel:CNLiveDownSlideModel) {
48 58 self.cell = cell
49 59 super.init(nibName: nil, bundle: nil)
  60 + self.slideModel = slideModel
50 61 self.setupTranstion()
51   - }
52   -
53   - override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
54   - print("DetailtouchesBegan")
  62 + setNeedsStatusBarAppearanceUpdate()
55 63 }
56 64  
57 65 private func setupTranstion() {
... ... @@ -70,9 +78,9 @@ class CNUpSlideDetailViewController: UIViewController {
70 78 }
71 79  
72 80 private func setupUI() {
73   - self.view.backgroundColor = .white
74 81 self.view.layer.masksToBounds = true
75 82 view.addSubview(scrollView)
  83 + scrollView.slideModel = _slideModel
76 84 view.addSubview(closeBtn)
77 85 view.addGestureRecognizer(dismissPanGesture)
78 86  
... ... @@ -89,7 +97,8 @@ class CNUpSlideDetailViewController: UIViewController {
89 97  
90 98 @objc private func closeAction() {
91 99 dismiss(animated: true, completion: nil)
92   - dismissClosure?()
  100 + let nav = self.navigationController as! CNSlideBaseNavigationController
  101 + nav.dismissClosure?()
93 102 }
94 103  
95 104 @objc private func handleDismissPan(gesture: UIPanGestureRecognizer) {
... ... @@ -117,7 +126,9 @@ class CNUpSlideDetailViewController: UIViewController {
117 126  
118 127 if progress >= 1.0 {
119 128 dismiss(animated: true, completion: nil)
120   - dismissClosure?()
  129 + let nav = self.navigationController as! CNSlideBaseNavigationController
  130 + nav.dismissClosure?()
  131 +// dismissClosure?()
121 132 stopDismissPanGesture(gesture)
122 133 return
123 134 }
... ...
metaCode/Classes/Main/HomePage/Controller/CNUpSlideViewController.swift
... ... @@ -8,11 +8,24 @@
8 8 import Foundation
9 9 import UIKit
10 10  
11   -class CNUpSlideViewController: CNLiveBaseViewController,UITableViewDelegate,UITableViewDataSource{//UITableViewController {
  11 +//下滑tableview背景颜色
  12 +let kCNDownSlideBackgroundColorHex: String = "#F7F8FA"
  13 +
  14 +///CNliveDownSlideModel Type
  15 +let SlideModelTypeRecommend4: String = "4"//4一排两个 推荐课程&推荐活动
  16 +let SlideModelTypeTodayRecommend74: String = "74"//74今日推荐
  17 +let SlideModelTypeAllCourse12: String = "12"//12列表全部课程
  18 +let SlideModelTypeOneCourse75: String = "75"//75单课程大图
  19 +
  20 +class CNUpSlideViewController: CNLiveBaseViewController,UITableViewDelegate,UITableViewDataSource{
12 21  
13 22 let kCNLiveDownSlideCellIdentifier = "kCNLiveDownSlideCellIdentifier"
  23 + let kCNLiveDownSlideRecommendCellIdentifier = "kCNLiveDownSlideRecommendCellIdentifier"
  24 + let kCNLiveDownSlideTodayRecommendCellIdentifier = "kCNLiveDownSlideTodayRecommendCellIdentifier"
14 25  
15   - var selectedCell: CNDownSlideCell?
  26 + var totolNum = 0//一共显示多少行cell
  27 +
  28 + var selectedCell: CNDownSlideSingleCourseCell?
16 29  
17 30 var statusBarShouldBeHidden = false
18 31 //we need to set `View controller-based status bar appearance = YES` in info.plist.
... ... @@ -24,28 +37,44 @@ class CNUpSlideViewController: CNLiveBaseViewController,UITableViewDelegate,UITa
24 37 override var preferredStatusBarUpdateAnimation: UIStatusBarAnimation {
25 38 return .slide
26 39 }
27   -
28   - override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
29   - print("slidetouchesBegan")
  40 +
  41 + var _downPath:String?
  42 + var downPath:String? {
  43 + get{
  44 + return _downPath
  45 + }
  46 + set{
  47 + _downPath = newValue!
  48 + self.getPageApi()
  49 + }
30 50 }
31 51  
  52 + // MARK: - 懒加载
  53 + ///数据源
  54 + lazy var dataArray: NSMutableArray = {
  55 + var dataArray = NSMutableArray()
  56 + return dataArray
  57 + }()
  58 +
  59 + override func viewWillAppear(_ animated: Bool) {
  60 + super.viewWillAppear(animated)
  61 + self.updateStatusBarAndTabbarFrame(visible: true)
  62 + }
32 63  
33 64 override func viewDidLoad() {
34 65 super.viewDidLoad()
35   -
  66 + self.view.backgroundColor = HexColor(kCNDownSlideBackgroundColorHex)
36 67 view.addSubview(tableView)
37   - tableView.snp.makeConstraints { make in
38   - make.edges.equalToSuperview()
39   - }
  68 + tableView.frame = CGRect(x: 0, y: KStatusBarHeight, width: KSreenWidth, height: KSreenHeight-DownSlideBottomViewHeight-KStatusBarHeight)
40 69 }
41 70  
42 71 lazy var tableView : UITableView = {
43   - let tableView = UITableView(frame: .zero, style: .grouped)
  72 + let tableView = UITableView(frame: .zero, style: .plain)
44 73 tableView.dataSource = self
45 74 tableView.delegate = self
46 75 tableView.separatorStyle = .none
47   - tableView.register(CNDownSlideCell.self, forCellReuseIdentifier: kCNLiveDownSlideCellIdentifier)
48   - tableView.rowHeight = GlobalConstants.toDayCardRowH
  76 + tableView.register(CNDownSlideSingleCourseCell.self, forCellReuseIdentifier: kCNLiveDownSlideCellIdentifier)
  77 + tableView.backgroundColor = HexColor(kCNDownSlideBackgroundColorHex)
49 78 return tableView
50 79 }()
51 80  
... ... @@ -56,49 +85,146 @@ class CNUpSlideViewController: CNLiveBaseViewController,UITableViewDelegate,UITa
56 85 }
57 86 }
58 87  
  88 + // MARK: - UITableViewDelegate
59 89 func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
60   - return 2
  90 +
  91 + self.dataArray.count
61 92 }
62 93  
63 94 func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
64   - let cell = tableView.dequeueReusableCell(withIdentifier: kCNLiveDownSlideCellIdentifier) as! CNDownSlideCell
65   - cell.selectionStyle = .none
66   - cell.bgImageView.backgroundColor = .red
67   - cell.bgImageView.kf.setImage(with: URL(string: "https://wjj.ys2.cnliveimg.com/769/img_new/1697162534497.jpg"))
68   -
69   - return cell
  95 +
  96 + let slideModel = self.dataArray[indexPath.row] as! CNLiveDownSlideModel
  97 +
  98 + //type=4一排两个 推荐课程&推荐活动; 74今日推荐; 12列表全部课程; 75单课程大图
  99 + if slideModel.type == SlideModelTypeRecommend4{
  100 + guard let cell = tableView.dequeueReusableCell(withIdentifier: kCNLiveDownSlideRecommendCellIdentifier) as? CNLiveDownSlideRecommendCell
  101 + else {
  102 + let cell = CNLiveDownSlideRecommendCell()
  103 + cell.slideModel = slideModel
  104 + return cell
  105 + }
  106 + cell.slideModel = slideModel
  107 + return cell
  108 + }else if slideModel.type == SlideModelTypeTodayRecommend74{
  109 + guard let cell = tableView.dequeueReusableCell(withIdentifier: kCNLiveDownSlideTodayRecommendCellIdentifier) as? CNLiveDownSlideTodayRecommendCell
  110 + else {
  111 + let cell = CNLiveDownSlideTodayRecommendCell()
  112 + cell.slideModel = slideModel
  113 + return cell
  114 + }
  115 + cell.slideModel = slideModel
  116 + return cell
  117 + }else if slideModel.type == SlideModelTypeAllCourse12{
  118 + guard let cell = tableView.dequeueReusableCell(withIdentifier: kCNLiveDownSlideCellIdentifier) as? CNDownSlideSingleCourseCell
  119 + else {
  120 + let cell = CNDownSlideSingleCourseCell()
  121 + cell.slideModel = slideModel
  122 + return cell
  123 + }
  124 + cell.slideModel = slideModel
  125 + return cell
  126 + }else if slideModel.type == SlideModelTypeOneCourse75{
  127 + guard let cell = tableView.dequeueReusableCell(withIdentifier: kCNLiveDownSlideCellIdentifier) as? CNDownSlideSingleCourseCell
  128 + else {
  129 + let cell = CNDownSlideSingleCourseCell()
  130 + cell.slideModel = slideModel
  131 + return cell
  132 + }
  133 + cell.slideModel = slideModel
  134 + return cell
  135 + }else{
  136 + return UITableViewCell()
  137 + }
70 138 }
71 139  
72 140  
73 141 func tableView(_ tableView: UITableView, didHighlightRowAt indexPath: IndexPath) {
74   - guard let row = tableView.cellForRow(at: indexPath) as? CNDownSlideCell else { return }
  142 + guard let row = tableView.cellForRow(at: indexPath) as? CNDownSlideSingleCourseCell else { return }
75 143 UIView.animate(withDuration: 0.1) {
76 144 row.bgBackView.transform = CGAffineTransform(scaleX: 0.95, y: 0.95)
77 145 }
78 146 }
79 147  
80 148 func tableView(_ tableView: UITableView, didUnhighlightRowAt indexPath: IndexPath) {
81   - guard let row = tableView.cellForRow(at: indexPath) as? CNDownSlideCell else { return }
  149 + guard let row = tableView.cellForRow(at: indexPath) as? CNDownSlideSingleCourseCell else { return }
82 150 UIView.animate(withDuration: 0.3) {
83 151 row.bgBackView.transform = CGAffineTransform(scaleX: 1.0, y: 1.0)
84 152 }
85 153 }
86 154  
87 155 func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
88   - print("点击了cell")
89   - guard let cell = tableView.cellForRow(at: indexPath) as? CNDownSlideCell else { return }
90   - selectedCell = cell
91   -
92   - let detailVC = CNUpSlideDetailViewController(cell: cell)
93 156  
94   - detailVC.dismissClosure = { [weak self] in
95   - guard let StrongSelf = self else { return }
96   - StrongSelf.updateStatusBarAndTabbarFrame(visible: true)
  157 + let slideModel = self.dataArray[indexPath.row] as! CNLiveDownSlideModel
  158 + //type=4一排两个 推荐课程&推荐活动; 74今日推荐; 12列表全部课程; 75单课程大图
  159 + if slideModel.type == SlideModelTypeRecommend4{
  160 +
  161 + }else if slideModel.type == SlideModelTypeTodayRecommend74{
  162 +
  163 + }else if slideModel.type == SlideModelTypeAllCourse12{
  164 + guard let cell = tableView.cellForRow(at: indexPath) as? CNDownSlideSingleCourseCell else { return }
  165 + selectedCell = cell
  166 + let detailVC = CNSlideBaseNavigationController(rootViewController: CNUpSlideDetailViewController(cell: cell,slideModel: slideModel))
  167 + detailVC.dismissClosure = { [weak self] in
  168 + guard let StrongSelf = self else { return }
  169 + StrongSelf.updateStatusBarAndTabbarFrame(visible: true)
  170 + }
  171 + updateStatusBarAndTabbarFrame(visible: false)
  172 +
  173 + present(detailVC, animated: true, completion: nil)
  174 + }else if slideModel.type == SlideModelTypeOneCourse75{
  175 + guard let cell = tableView.cellForRow(at: indexPath) as? CNDownSlideSingleCourseCell else { return }
  176 + selectedCell = cell
  177 +
  178 + let detailVC = CNSlideBaseNavigationController(rootViewController: CNUpSlideDetailViewController(cell: cell,slideModel: slideModel))
  179 +
  180 + detailVC.dismissClosure = { [weak self] in
  181 + guard let StrongSelf = self else { return }
  182 + StrongSelf.updateStatusBarAndTabbarFrame(visible: true)
  183 + }
  184 + updateStatusBarAndTabbarFrame(visible: false)
  185 + present(detailVC, animated: true, completion: nil)
97 186 }
98   -
99   - updateStatusBarAndTabbarFrame(visible: false)
100   -
101   - present(detailVC, animated: true, completion: nil)
102   -
  187 + }
  188 +
  189 + func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
  190 + let slideModel = self.dataArray[indexPath.row] as! CNLiveDownSlideModel
  191 + return CGFloat(slideModel.cellH)
  192 + }
  193 +
  194 + func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
  195 + return 0
  196 + }
  197 + func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
  198 + return 0
  199 + }
  200 + //MARK: - 网络请求获取详情页
  201 + func getPageApi()
  202 + {
  203 + showLoading(message: "")
  204 + CNLiveDownSlideViewModel.requestGetPage(pageId: _downPath! as NSString) { result, status in
  205 + hiddenLoading()
  206 +
  207 + if status == .success{
  208 + self.dataArray.addObjects(from: result as! [Any])
  209 + let newDataArray = NSMutableArray()
  210 + for slideModel in self.dataArray {
  211 + if let model = slideModel as? CNLiveDownSlideModel{
  212 +
  213 + let layout = CNLiveDownSlideModelLayout.init(model: model)
  214 + newDataArray.addObjects(from: [layout.getCellHModel()])
  215 + }
  216 + }
  217 + self.dataArray.removeAllObjects()
  218 + self.dataArray.addObjects(from: newDataArray as! [Any])
  219 +
  220 + self.tableView.reloadData()
  221 + }else if (status == .failed){
  222 +// self.NetApiStatus = .apiError
  223 + }else if (status == .noNetwork){
  224 +
  225 +// self.NetApiStatus = .notNetwork
  226 + }
  227 + }
  228 +//
103 229 }
104 230 }
... ...
metaCode/Classes/Main/HomePage/Controller/CNWebViewController.swift
... ... @@ -18,15 +18,15 @@ class CNWebViewController:CNLiveBaseViewController ,WKNavigationDelegate{
18 18 return webView
19 19 }()
20 20  
21   - var _url:String?
22   - var url:String? {
  21 + var _url:URL?
  22 + var url:URL? {
23 23 get{
24 24 return _url
25 25 }
26 26 set{
27 27 _url = newValue!
28   - if (_url != ""){
29   - let webUrl: URL! = URL.init(string: _url!)
  28 + if (_url != nil){
  29 + let webUrl: URL! = _url!
30 30 webView.evaluateJavaScript("navigator.userAgent") { [self] result, error in
31 31 let userAgent = result as! String
32 32 if error == nil && userAgent.count > 0 {
... ...
metaCode/Classes/Main/HomePage/View/CNCustomIndexView.swift
... ... @@ -118,11 +118,11 @@ class CNCustomIndexView:PGIndexBannerSubiew, UIScrollViewDelegate, WJColorChange
118 118 set{
119 119 self.mainView.idModel = newValue!
120 120 _idModel = newValue
121   - self.upSlideView.type = _idModel?.upType
122   - self.upSlideView.url = _idModel?.upPath
  121 + self.upSlideView.type = _idModel?.downType
  122 + self.upSlideView.url = _idModel?.downPath
123 123  
124   - self.downSlideView.type = _idModel?.downType
125   - self.downSlideView.url = _idModel?.downPath
  124 + self.downSlideView.type = _idModel?.upType
  125 + self.downSlideView.downPath = _idModel?.upPath
126 126  
127 127 self.topNavView.setTitleString(title:(_idModel?.name)!)
128 128 }
... ... @@ -184,6 +184,7 @@ class CNCustomIndexView:PGIndexBannerSubiew, UIScrollViewDelegate, WJColorChange
184 184  
185 185 ///下滑显示的VIew
186 186 lazy var downSlideView: CNDownSlideView = {
  187 +
187 188 let collectionView = CNDownSlideView.init(frame: CGRectMake(-LeftGap, 0, self.frame.size.width+LeftGap*2, self.frame.size.height))
188 189 collectionView.backgroundColor = .clear
189 190 collectionView.backAction = {[weak self] in
... ... @@ -384,12 +385,16 @@ class CNCustomIndexView:PGIndexBannerSubiew, UIScrollViewDelegate, WJColorChange
384 385 else{
385 386 self.topNavView.alpha = 0
386 387 }
387   -
388 388 //隐藏downSlideView的bottomView
389 389 if scrollView.contentOffset.y > 10{
390 390 self.downSlideView.bottomView.isHidden = true
391 391 self.downSlideView.contentView.backgroundColor = .clear
392 392 }
  393 + if scrollView.contentOffset.y == 0{
  394 + //滚动到第一页,显示downSlideView的底部view
  395 + self.downSlideView.bottomView.isHidden = false
  396 + self.downSlideView.contentView.backgroundColor = KVCBackgroupColor
  397 + }
393 398  
394 399 delegate?.customIndexViewDidScroll(scrollView: self.baseScrollView)
395 400  
... ... @@ -412,14 +417,12 @@ class CNCustomIndexView:PGIndexBannerSubiew, UIScrollViewDelegate, WJColorChange
412 417 self.superScrollView?.isScrollEnabled = false
413 418 }
414 419  
415   -
416 420 if scrollView.contentOffset.y == 0{
417 421 //滚动到第一页,显示downSlideView的底部view
418 422 self.downSlideView.bottomView.isHidden = false
419 423 self.downSlideView.contentView.backgroundColor = KVCBackgroupColor
420 424 }
421 425  
422   -
423 426 //滑动结束 把topNavView 放到scrollView的上层
424 427 self.bringSubviewToFront(self.topNavView)
425 428  
... ...
metaCode/Classes/Main/HomePage/View/CNDownSlideCell.swift deleted 100644 → 0
1   -//
2   -// CNDownSlideCell.swift
3   -// metaCode
4   -//
5   -// Created by zx on 2023/10/16.
6   -//
7   -
8   -import Foundation
9   -import UIKit
10   -
11   -enum GlobalConstants {
12   - static let leftMargin: CGFloat = 20
13   -
14   - static let toDayCardRowH: CGFloat = 440
15   - static let toDayCardCornerRadius: CGFloat = 15.0
16   - static let todayCardSize: CGSize = CGSize(width: KSreenWidth - 2 * 20, height: 410)
17   - static let cardDetailTopImageH: CGFloat = 500
18   -
19   - static let iconBorderColor: CGColor = UIColor(red: 239/255.0, green: 240/255.0, blue: 241/255.0, alpha: 1).cgColor
20   - static let iconBorderWidth: CGFloat = 0.8
21   - static let iconCornerRadius: CGFloat = 17.5
22   -
23   - static let textBlueColor = UIColor(red: 0/255.0, green: 122/255.0, blue: 255/255.0, alpha: 1.0) //007AFF
24   - static let speratorLineColor = UIColor(red: 224/255.0, green: 224/255.0, blue: 224/255.0, alpha: 1)
25   -
26   -}
27   -
28   -class CNDownSlideCell: UITableViewCell {
29   -
30   - let bgBackView = UIView()
31   - let bgImageView = UIImageView()
32   - let emptyView = UIView()
33   -
34   - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
35   - super.init(style: style, reuseIdentifier: reuseIdentifier)
36   - setupUI()
37   - }
38   -
39   - required init?(coder aDecoder: NSCoder) {
40   - fatalError("init(coder:) has not been implemented")
41   - }
42   -
43   - private func setupUI() {
44   -
45   - contentView.addSubview(bgBackView)
46   - bgBackView.addSubview(bgImageView)
47   - contentView.addSubview(emptyView)
48   -
49   - bgBackView.frame = CGRect(x: GlobalConstants.leftMargin, y: 0, width: GlobalConstants.todayCardSize.width, height: GlobalConstants.todayCardSize.height)
50   - bgBackView.layer.shadowColor = UIColor.black.cgColor
51   - bgBackView.layer.shadowOpacity = 0.4
52   - bgBackView.layer.shadowOffset = CGSize(width: 0, height: 1)
53   -
54   - bgImageView.frame = bgBackView.bounds
55   - bgImageView.contentMode = .scaleAspectFill
56   - bgImageView.layer.cornerRadius = GlobalConstants.toDayCardCornerRadius
57   - bgImageView.layer.masksToBounds = true
58   -
59   - emptyView.backgroundColor = UIColor.white.withAlphaComponent(0)
60   - emptyView.frame = CGRect(x: 0, y: bgImageView.frame.size.height, width: GlobalConstants.todayCardSize.width, height: GlobalConstants.toDayCardRowH - GlobalConstants.todayCardSize.height)
61   - }
62   -
63   -}
metaCode/Classes/Main/HomePage/View/CNDownSlideSingleCourseCell.swift 0 → 100644
  1 +//
  2 +// CNDownSlideSingleCourseCell.swift
  3 +// metaCode
  4 +//
  5 +// Created by zx on 2023/10/16.
  6 +// 单课程大图专辑
  7 +
  8 +
  9 +import Foundation
  10 +import UIKit
  11 +
  12 +enum GlobalConstants {
  13 + static let leftMargin: CGFloat = 20
  14 +
  15 + static let toDayCardRowH: CGFloat = 440
  16 + static let toDayCardCornerRadius: CGFloat = 12.0
  17 + static let todayCardSize: CGSize = CGSize(width: KSreenWidth - 2 * 15, height: DownSlideSingleCourseImgH)
  18 + static let cardDetailTopImageH: CGFloat = 500
  19 +
  20 + static let iconBorderColor: CGColor = UIColor(red: 239/255.0, green: 240/255.0, blue: 241/255.0, alpha: 1).cgColor
  21 + static let iconBorderWidth: CGFloat = 0.8
  22 + static let iconCornerRadius: CGFloat = 17.5
  23 +
  24 + static let textBlueColor = UIColor(red: 0/255.0, green: 122/255.0, blue: 255/255.0, alpha: 1.0) //007AFF
  25 + static let speratorLineColor = UIColor(red: 224/255.0, green: 224/255.0, blue: 224/255.0, alpha: 1)
  26 +
  27 +}
  28 +
  29 +///全部课程 标题高度
  30 +let DownSlideAllCourseTitleH: CGFloat = 55
  31 +//全部课程 每row_topY间距
  32 +let DownSlideAllCourseRowTopYGap: CGFloat = 10
  33 +//全部课程 每row_topY间距
  34 +let DownSlideAllCourseRowBottomYGap: CGFloat = 20
  35 +//全部课程 每row_img宽高
  36 +let DownSlideAllCourseRowImageWH: CGFloat = 45
  37 +
  38 +///全部课程 每row高度
  39 +let DownSlideAllCourseRowH: CGFloat = DownSlideAllCourseRowTopYGap+DownSlideAllCourseRowBottomYGap + DownSlideAllCourseRowImageWH
  40 +///全部课程 宽度
  41 +let DownSlideAllCourseW: CGFloat = KSreenWidth - DownSlideRecommendLeftGap*2
  42 +
  43 +///单节课程 大图高度
  44 +let DownSlideSingleCourseImgH: CGFloat = 345
  45 +///单节课程 更多课程高度
  46 +let DownSlideSingleCourseMoreH: CGFloat = 60
  47 +///单节课程 宽度
  48 +let DownSlideSingleCourseW: CGFloat = KSreenWidth - DownSlideRecommendLeftGap*2
  49 +
  50 +class CNDownSlideSingleCourseCell: UITableViewCell {
  51 +
  52 + let bgBackView = UIView()
  53 + let bgImageView = UIImageView()
  54 +
  55 + //slideModel
  56 + var _slideModel : CNLiveDownSlideModel?
  57 + var slideModel : CNLiveDownSlideModel? {
  58 + get{
  59 + _slideModel
  60 + }
  61 + set{
  62 + _slideModel = newValue!
  63 + self.setupNewUI(model: _slideModel!)
  64 + }
  65 + }
  66 +
  67 + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
  68 + super.init(style: style, reuseIdentifier: reuseIdentifier)
  69 + self.selectionStyle = .none
  70 + setupUI()
  71 + }
  72 +
  73 + required init?(coder aDecoder: NSCoder) {
  74 + fatalError("init(coder:) has not been implemented")
  75 + }
  76 +
  77 + private func setupUI() {
  78 + contentView.backgroundColor = HexColor(kCNDownSlideBackgroundColorHex)
  79 + }
  80 +
  81 + func setupNewUI(model:CNLiveDownSlideModel){
  82 + if model.type == SlideModelTypeAllCourse12 {
  83 + //全部课程列表
  84 + contentView.addSubview(bgBackView)
  85 +
  86 + bgBackView.frame = CGRect(x: DownSlideRecommendLeftGap, y: 0,width:DownSlideSingleCourseW , height:model.cellH-DownSlideRecommendLeftGap)
  87 + bgBackView.layer.shadowColor = HexColor("#000000")?.cgColor
  88 + bgBackView.layer.shadowRadius = 12
  89 + bgBackView.layer.shadowOpacity = 1
  90 + bgBackView.layer.shadowOffset = CGSize(width: 0, height: 0)
  91 + bgBackView.layer.cornerRadius = 12
  92 + bgBackView.clipsToBounds = true
  93 + bgBackView.backgroundColor = HexColor("#FFFFFF")
  94 +
  95 + let titleLbl = UILabel(frame: CGRect(x: DownSlideRecommendLeftGap, y: DownSlideRecommendLeftGap, width: DownSlideSingleCourseW-DownSlideRecommendLeftGap*2, height: 30))
  96 + titleLbl.text = model.blockName ?? "全部课程"
  97 + titleLbl.font = BoldFont_21
  98 + titleLbl.textColor = HexColor("#333333")
  99 + bgBackView.addSubview(titleLbl)
  100 +
  101 + //总块数
  102 + let contentsNum = model.contents.count
  103 + //model行数
  104 + let row = model.rowNum
  105 + //总显示块数
  106 + var totalNum = (contentsNum >= row) ? row : contentsNum
  107 + if row == 0{//row为0 , contents全部显示
  108 + totalNum = contentsNum
  109 + }
  110 + for i in 0..<totalNum{//i是第几行
  111 + let contentMdl = model.contents[i]
  112 +
  113 + //小icon
  114 + let imageView = UIImageView(frame: CGRectMake(DownSlideRecommendLeftGap, titleLbl.bottom+DownSlideRecommendLeftGap+CGFloat(i)*(DownSlideAllCourseRowTopYGap+DownSlideAllCourseRowImageWH+DownSlideAllCourseRowBottomYGap), CGFloat(DownSlideAllCourseRowImageWH), CGFloat(DownSlideAllCourseRowImageWH)))
  115 + imageView.kf.setImage(with: URL(string:contentMdl.poster!))
  116 + bgBackView.addSubview(imageView)
  117 +
  118 + let titleLbl = UILabel(frame: CGRect(x: imageView.right+DownSlideRecommendLeftGap, y: imageView.top, width: DownSlideSingleCourseW-90-imageView.right, height: 21))
  119 + titleLbl.text = contentMdl.title ?? "婴儿课程"
  120 + titleLbl.font = Font_15
  121 + titleLbl.textColor = HexColor("#333333")
  122 + bgBackView.addSubview(titleLbl)
  123 +
  124 + let subTitleLbl = UILabel(frame: CGRect(x: titleLbl.left, y:titleLbl.bottom+3 , width: titleLbl.width, height: 17))
  125 + subTitleLbl.text = contentMdl.subTitle ?? "适应3-6岁"
  126 + subTitleLbl.font = Font_12
  127 + subTitleLbl.textColor = HexColor("#999999")
  128 + bgBackView.addSubview(subTitleLbl)
  129 +
  130 + let enterBtn = UIButton(type: .custom)
  131 + enterBtn.frame = CGRect(x: bgBackView.right-25-65, y: 0, width: 65, height: 30)
  132 + enterBtn.centerY = imageView.centerY
  133 + enterBtn.setBackgroundImage(UIImage(named: "homepage_down_enter"), for: .normal)
  134 + enterBtn.setTitle("进入", for: .normal)
  135 + enterBtn.titleLabel?.font = BoldFont_13
  136 + enterBtn.setTitleColor(HexColor("#FFFFFF"), for: .normal)
  137 + enterBtn.addTarget(self, action: #selector(enterBtnAction(_:)), for: .touchUpInside)
  138 + enterBtn.tag = i
  139 + bgBackView.addSubview(enterBtn)
  140 + }
  141 + }else if model.type == SlideModelTypeOneCourse75 {
  142 + //单图课程
  143 + contentView.addSubview(bgBackView)
  144 + bgBackView.addSubview(bgImageView)
  145 +
  146 + bgBackView.frame = CGRect(x: DownSlideRecommendLeftGap, y: 0,width:DownSlideSingleCourseW , height:DownSlideSingleCourseMoreH+DownSlideSingleCourseImgH)
  147 + bgBackView.layer.shadowColor = UIColor.black.cgColor
  148 + bgBackView.layer.shadowOpacity = 0.4
  149 + bgBackView.layer.shadowOffset = CGSize(width: 0, height: 1)
  150 +
  151 + bgImageView.frame = CGRect(x: 0, y: 0,width:DownSlideSingleCourseW , height:DownSlideSingleCourseImgH)
  152 + bgImageView.contentMode = .scaleAspectFill
  153 + bgImageView.layer.cornerRadius = GlobalConstants.toDayCardCornerRadius
  154 + bgImageView.layer.maskedCorners = [.layerMinXMinYCorner, .layerMaxXMinYCorner]
  155 + bgImageView.layer.masksToBounds = true
  156 + bgImageView.kf.setImage(with: URL(string: model.contents[0].poster ?? ""))
  157 +
  158 + let titleLbl = UILabel(frame: CGRect(x: DownSlideRecommendLeftGap, y: DownSlideRecommendLeftGap, width: DownSlideSingleCourseW-DownSlideRecommendLeftGap*2, height: 30))
  159 + titleLbl.text = model.contents[0].title ?? "婴儿课程"
  160 + titleLbl.font = BoldFont_21
  161 + titleLbl.textColor = HexColor("#FFFFFF")
  162 + bgImageView.addSubview(titleLbl)
  163 +
  164 + let subTitleLbl = UILabel(frame: CGRect(x: DownSlideRecommendLeftGap, y:titleLbl.bottom , width: DownSlideSingleCourseW-DownSlideRecommendLeftGap*2, height: 30))
  165 + subTitleLbl.text = model.contents[0].subTitle ?? "适应3-6岁"
  166 + subTitleLbl.font = Font_12
  167 + subTitleLbl.textColor = HexColor("#FFFFFF")
  168 + bgImageView.addSubview(subTitleLbl)
  169 +
  170 + //单节底部视图
  171 + let singleCourseBottomView = UIView(frame: CGRect(x: 0, y: DownSlideSingleCourseImgH, width: DownSlideSingleCourseW, height: DownSlideSingleCourseMoreH))
  172 + singleCourseBottomView.layer.cornerRadius = 12
  173 + singleCourseBottomView.layer.maskedCorners = [.layerMinXMaxYCorner, .layerMaxXMaxYCorner]
  174 + singleCourseBottomView.backgroundColor = .white
  175 + singleCourseBottomView.isUserInteractionEnabled = true
  176 + bgBackView.addSubview(singleCourseBottomView)
  177 +
  178 + let moreLabel = UILabel(frame: CGRect(x: DownSlideRecommendLeftGap, y: 15, width: DownSlideSingleCourseW - 50 - DownSlideRecommendLeftGap , height: 30))
  179 + moreLabel.text = model.blockName ?? "更多"
  180 + moreLabel.font = Font_15
  181 + moreLabel.textColor = HexColor("#333333")
  182 + singleCourseBottomView.addSubview(moreLabel)
  183 +
  184 + let moreImgView = UIImageView(image: UIImage(named: "homepage_down_more"))
  185 + moreImgView.left = moreLabel.right
  186 + moreImgView.centerY = moreLabel.centerY
  187 + singleCourseBottomView.addSubview(moreImgView)
  188 + }
  189 + }
  190 +
  191 + //MARK: - 事件
  192 + @objc func enterBtnAction(_ sender: UIButton){
  193 + let tag = sender.tag
  194 + let contentMdl = self.slideModel?.contents[tag]
  195 + CNLiveDownSlideTool.pushWebVCWithContentsMdl(contentMdl: contentMdl!)
  196 + }
  197 +}
... ...
metaCode/Classes/Main/HomePage/View/CNDownSlideView.swift
... ... @@ -20,7 +20,7 @@ class CNDownSlideView:UIView{
20 20 //MARK: - 懒加载
21 21 lazy var contentView:UIView = {
22 22  
23   - let contentView = UIView.init(frame: CGRect(x: 0, y: 0, width: self.width, height: self.height-KTabBarHeight))
  23 + let contentView = UIView.init(frame: CGRect(x: 0, y: 0, width: self.width, height: self.height))
24 24 contentView.backgroundColor = UIColor.clear
25 25  
26 26 // let path:UIBezierPath = UIBezierPath.init(roundedRect: contentView.bounds, byRoundingCorners: [.bottomLeft, .bottomRight], cornerRadii: CGSize.init(width: 20, height: 20))
... ... @@ -48,53 +48,32 @@ class CNDownSlideView:UIView{
48 48 return webView
49 49 }()
50 50  
51   -// var upSlideVCView:UIView = {
52   -//// let upSlideVCView = CNUpSlideViewController.init().view
53   -// let upSlideVCView:UIView = UIView.init(frame: CGRect(x: 0, y: 0, width: KSreenWidth/2.0, height: KSreenHeight/2.0))
54   -// upSlideVCView.backgroundColor = .red
55   -//// upSlideVCView?.width = KSreenWidth
56   -//// upSlideVCView?.height = KSreenHeight
57   -// return upSlideVCView
58   -// }()
59   -
60   - override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
61   - let view = super.hitTest(point, with: event)
62   - guard view == self else {
63   - return view
64   - }
65   - guard let superView = view?.superview else {
66   - return view
67   - }
68   - print(String(format: "self:%p, view:%p", self, view!))
69   - return view
70   - }
71   -
72 51 var upSlideVCView:CNUpSlideViewController = {
73 52 let upSlideVCView = CNUpSlideViewController.init()
74 53 upSlideVCView.view.width = KSreenWidth
75   - upSlideVCView.view.height = KSreenHeight-DownSllideBottomViewHeight
  54 + upSlideVCView.view.height = KSreenHeight-DownSlideBottomViewHeight
76 55 return upSlideVCView
77 56 }()
78 57  
79 58 var type:Int?
80 59  
81   - var _url:String?
82   - var url:String? {
  60 + var _downPath:String?
  61 + var downPath:String? {
83 62 get{
84   - return _url
  63 + return _downPath
85 64 }
86 65 set{
87   - _url = newValue!
  66 + _downPath = newValue!
88 67  
89 68 if(type == UpDownTypeH5){
90   - if (_url != ""){
91   - let webUrl: URL! = URL.init(string: _url!)
  69 + if (_downPath != ""){
  70 + let webUrl: URL! = URL.init(string: _downPath!)
92 71 webView.load(URLRequest.init(url:webUrl))
93 72 }
94 73 }else if(type == UpDownTypePage){
95 74 print("UpDownTypePage")
96 75 self.webView.isHidden = true
97   -// self.upSlideVC.isHidden = false
  76 + self.upSlideVCView.downPath = _downPath
98 77  
99 78 }else if(type == UpDownTypeShopDetail){
100 79  
... ... @@ -113,19 +92,21 @@ class CNDownSlideView:UIView{
113 92  
114 93 lazy var bottomView:UIView = {
115 94  
116   - let bottomView = UIView(frame: CGRect(x:0, y:self.height - KTabBarHeight, width: self.width, height: KTabBarHeight))
117   - bottomView.backgroundColor = .white
  95 + let bottomView = UIView(frame: CGRect(x:0, y:self.height - DownSlideBottomViewHeight, width: self.width, height: DownSlideBottomViewHeight))
  96 + bottomView.backgroundColor = HexColor("#FFFFFF")
118 97 bottomView.isHidden = true
119 98  
120   - let path:UIBezierPath = UIBezierPath.init(roundedRect: bottomView.bounds, byRoundingCorners: [.topLeft, .topRight], cornerRadii: CGSize.init(width: 20, height: 20))
121   -
  99 + let path:UIBezierPath = UIBezierPath.init(roundedRect: bottomView.bounds, byRoundingCorners: [.topLeft, .topRight], cornerRadii: CGSize.init(width: 50, height: 50))
122 100 let maskLayer:CAShapeLayer = CAShapeLayer()
123 101 maskLayer.frame = bottomView.bounds
124 102 maskLayer.path = path.cgPath
125 103 bottomView.layer.mask = maskLayer
  104 + bottomView.clipsToBounds = true
  105 +// bottomView.layer.cornerRadius = 50
  106 +// bottomView.layer.maskedCorners = [.layerMinXMinYCorner, .layerMaxXMinYCorner]
126 107  
127 108 let backBtn: UIButton = UIButton(type: .custom)
128   - backBtn.frame = CGRectMake(0, 0, 100, 30)
  109 + backBtn.frame = CGRectMake(0, 0, 100, DownSlideBottomViewHeight)
129 110 backBtn.centerX = bottomView.width/2
130 111 backBtn.centerY = bottomView.height/2
131 112 backBtn.setImage(UIImage(named: "homePage_backhome_icon"), for: .normal)
... ... @@ -161,8 +142,8 @@ class CNDownSlideView:UIView{
161 142 self.addSubview(self.contentView)
162 143 self.contentView.addSubview(self.webView)
163 144 // self.addSubview(self.topView)
164   - self.addSubview(self.bottomView)
165 145 self.addSubview(self.upSlideVCView.view)
  146 + self.addSubview(self.bottomView)
166 147  
167 148 }
168 149  
... ...
metaCode/Classes/Main/HomePage/View/CNLiveDownSlideRecommendCell.swift 0 → 100644
  1 +//
  2 +// CNLiveDownSlideRecommendCell.swift
  3 +// metaCode
  4 +//
  5 +// Created by zx on 2023/10/20.
  6 +// type:4 推荐课程 推荐活动
  7 +
  8 +import Foundation
  9 +
  10 +///推荐课程左间距
  11 +let DownSlideRecommendLeftGap: CGFloat = 15
  12 +///推荐课程宽高
  13 +let DownSlideRecommendWH: CGFloat = (KSreenWidth-DownSlideRecommendLeftGap*3)*0.5
  14 +
  15 +
  16 +class CNLiveDownSlideRecommendCell: UITableViewCell {
  17 +
  18 + //slideModel
  19 + var _slideModel : CNLiveDownSlideModel?
  20 + var slideModel : CNLiveDownSlideModel? {
  21 + get{
  22 + _slideModel
  23 + }
  24 + set{
  25 + _slideModel = newValue!
  26 + setupNewUI(model: _slideModel!)
  27 + }
  28 + }
  29 +
  30 + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
  31 + super.init(style: style, reuseIdentifier: reuseIdentifier)
  32 + self.selectionStyle = .none
  33 + contentView.backgroundColor = HexColor(kCNDownSlideBackgroundColorHex)
  34 + }
  35 +
  36 + required init?(coder: NSCoder) {
  37 + fatalError("init(coder:) has not been implemented")
  38 + }
  39 +
  40 +
  41 + func setupNewUI(model:CNLiveDownSlideModel){
  42 + //总块数
  43 + let contentsNum = model.contents.count
  44 + //model行数
  45 + let row = model.rowNum
  46 + //总显示块数/循环数
  47 + var totalNum = (contentsNum >= row*2) ? row*2 : contentsNum
  48 + if row == 0{//row为0 , contents全部显示
  49 + totalNum = contentsNum
  50 + }
  51 + //lieIndex 当前是contents的第0列还是第1列
  52 + var lieIndex = 0
  53 + //hangIndex 当前是第几行,1...n
  54 + var hangIndex = 1
  55 + for i in 0..<totalNum{//i是第几行
  56 + if lieIndex == 0{
  57 + //显示左边的块
  58 + let contentMdl = model.contents[(hangIndex-1)*2+(lieIndex)]
  59 + let imageView = UIImageView(frame: CGRectMake(DownSlideRecommendLeftGap, CGFloat(hangIndex-1)*DownSlideRecommendWH+DownSlideRecommendLeftGap*CGFloat(hangIndex-1), CGFloat(DownSlideRecommendWH), CGFloat(DownSlideRecommendWH)))
  60 + imageView.kf.setImage(with: URL(string:contentMdl.poster!))
  61 + imageView.tag = i
  62 + imageView.isUserInteractionEnabled = true
  63 + imageView.addGestureRecognizer(UITapGestureRecognizer.init(target: self, action: #selector(pushWebAction)))
  64 + contentView.addSubview(imageView)
  65 + lieIndex = 1
  66 + }else{
  67 + //lieIndex==1显示右边的块
  68 + let contentMdl = model.contents[(hangIndex-1)*2+(lieIndex)]
  69 + let imageView = UIImageView(frame: CGRectMake(CGFloat(DownSlideRecommendLeftGap*2)+CGFloat(DownSlideRecommendWH), CGFloat(hangIndex-1)*DownSlideRecommendWH+DownSlideRecommendLeftGap*CGFloat(hangIndex-1), CGFloat(DownSlideRecommendWH), CGFloat(DownSlideRecommendWH)))
  70 + imageView.kf.setImage(with: URL(string:contentMdl.poster!))
  71 + imageView.tag = i
  72 + imageView.isUserInteractionEnabled = true
  73 + imageView.addGestureRecognizer(UITapGestureRecognizer.init(target: self, action: #selector(pushWebAction)))
  74 + contentView.addSubview(imageView)
  75 + lieIndex = 0
  76 + hangIndex += 1
  77 + }
  78 + }
  79 + }
  80 +
  81 + @objc func pushWebAction(ges: UITapGestureRecognizer){
  82 + let imageView = ges.view as! UIImageView
  83 + let i = imageView.tag
  84 + let contentMdl = (self.slideModel?.contents[i])!
  85 + CNLiveDownSlideTool.pushWebVCWithContentsMdl(contentMdl: contentMdl)
  86 + }
  87 +
  88 +}
... ...
metaCode/Classes/Main/HomePage/View/CNLiveDownSlideTodayRecommendCell.swift 0 → 100644
  1 +//
  2 +// CNLiveDownSlideTodayRecommendCell.swift
  3 +// metaCode
  4 +//
  5 +// Created by zx on 2023/10/20.
  6 +// type:74 今日推荐
  7 +
  8 +import Foundation
  9 +
  10 +///今日推荐高度
  11 +let DownSlideTodayRecommendH: CGFloat = 105
  12 +///今日推荐宽度
  13 +let DownSlideTodayRecommendW: CGFloat = KSreenWidth-DownSlideRecommendLeftGap*2
  14 +
  15 +class CNLiveDownSlideTodayRecommendCell: UITableViewCell {
  16 + //slideModel
  17 + var _slideModel : CNLiveDownSlideModel?
  18 + var slideModel : CNLiveDownSlideModel? {
  19 + get{
  20 + _slideModel
  21 + }
  22 + set{
  23 + _slideModel = newValue!
  24 + self.setupNewUI(model: _slideModel!)
  25 + }
  26 + }
  27 + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
  28 + super.init(style: style, reuseIdentifier: reuseIdentifier)
  29 + self.selectionStyle = .none
  30 + contentView.backgroundColor = HexColor(kCNDownSlideBackgroundColorHex)
  31 + }
  32 +
  33 + required init?(coder: NSCoder) {
  34 + fatalError("init(coder:) has not been implemented")
  35 + }
  36 +
  37 + func setupNewUI(model:CNLiveDownSlideModel){
  38 + //总块数
  39 + let contentsNum = model.contents.count
  40 + //model行数
  41 + let row = model.rowNum
  42 + //总显示块数
  43 + var totalNum = (contentsNum >= row) ? row : contentsNum
  44 + if row == 0{//row为0 , contents全部显示
  45 + totalNum = contentsNum
  46 + }
  47 + for i in 0..<totalNum{//i是第几行
  48 + let contentMdl = model.contents[i]
  49 + let imageView = UIImageView(frame: CGRectMake(DownSlideRecommendLeftGap, CGFloat(i)*(DownSlideTodayRecommendH+DownSlideRecommendLeftGap), CGFloat(DownSlideTodayRecommendW), CGFloat(DownSlideTodayRecommendH)))
  50 + imageView.kf.setImage(with: URL(string:contentMdl.poster!))
  51 + imageView.tag = i
  52 + imageView.layer.cornerRadius = 12
  53 + imageView.clipsToBounds = true
  54 + imageView.isUserInteractionEnabled = true
  55 + imageView.addGestureRecognizer(UITapGestureRecognizer.init(target: self, action: #selector(pushWebAction)))
  56 + contentView.addSubview(imageView)
  57 + }
  58 + }
  59 +
  60 + @objc func pushWebAction(ges: UITapGestureRecognizer){
  61 + let imageView = ges.view as! UIImageView
  62 + let i = imageView.tag
  63 + let contentMdl = self.slideModel?.contents[i]
  64 + CNLiveDownSlideTool.pushWebVCWithContentsMdl(contentMdl: contentMdl!)
  65 + }
  66 +}
... ...
metaCode/Classes/Main/HomePage/View/CNUpSlideDetailScrollView.swift
... ... @@ -7,48 +7,171 @@
7 7  
8 8 import UIKit
9 9  
  10 +typealias enterBlock = (_ contentsMdl:CNLiveDownSlideContentsModel)->Void
  11 +
10 12 class CNUpSlideDetailScrollView: UIScrollView {
  13 + //返回首页
  14 + var callBack : enterBlock?
11 15  
12 16 let bgBackView = UIView()
13 17 let imageView = UIImageView()
14   - let textView = UITextView()
15 18  
  19 + //slideModel
  20 + var _slideModel : CNLiveDownSlideModel?
  21 + var slideModel : CNLiveDownSlideModel? {
  22 + get{
  23 + _slideModel
  24 + }
  25 + set{
  26 + _slideModel = newValue!
  27 + self.setupNewUI(model: _slideModel!)
  28 + }
  29 + }
  30 +
16 31 override init(frame: CGRect) {
17 32 super.init(frame: frame)
  33 +
18 34 setupUI()
19 35 }
20   -
  36 +
21 37 required init?(coder aDecoder: NSCoder) {
22 38 fatalError("init(coder:) has not been implemented")
23 39 }
24 40  
25 41 private func setupUI() {
26   - bgBackView.frame = CGRect(x: 0, y: 0, width: KSreenWidth, height: GlobalConstants.cardDetailTopImageH)
27   - bgBackView.layer.masksToBounds = true
28   -
29   - imageView.frame = bgBackView.bounds
30   - imageView.isUserInteractionEnabled = true
  42 + bgBackView.frame = CGRect(x: DownSlideRecommendLeftGap, y: 0,width:KSreenWidth , height:KSreenHeight)
  43 + imageView.frame = CGRect(x: 0,y: 0,width:KSreenWidth , height: KSreenWidth*DownSlideSingleCourseImgH/DownSlideSingleCourseW)
31 44 imageView.contentMode = .scaleAspectFill
32   -
33   - let textViewWidth = KSreenWidth - 2 * textViewLeftMargin
34   - let font = UIFont.boldSystemFont(ofSize: 15)
35   - let textHeight = textViewText.calculateHeightWith(width: textViewWidth, font: font)
36   - textView.frame = CGRect(x: textViewLeftMargin, y: bgBackView.frame.height + textViewTopMargin, width: textViewWidth, height: textHeight + textViewBottomMargin)
37   - textView.text = textViewText
38   - textView.font = font
39   - textView.textColor = .gray
40   -
  45 +
41 46 bgBackView.addSubview(imageView)
42 47 addSubview(bgBackView)
43   - addSubview(textView)
  48 +
  49 + contentSize = CGSize(width: KSreenWidth, height: bgBackView.height)
  50 + }
44 51  
45   - contentSize = CGSize(width: KSreenWidth, height: bgBackView.frame.height + textViewTopMargin + textView.frame.height + textViewBottomMargin)
  52 + func setupNewUI(model:CNLiveDownSlideModel){
  53 + if model.type == SlideModelTypeAllCourse12 {
  54 + //全部课程列表
  55 + let topTitleLbl = UILabel(frame: CGRect(x: DownSlideRecommendLeftGap, y: KStatusBarHeight+DownSlideRecommendLeftGap, width: DownSlideSingleCourseW-DownSlideRecommendLeftGap*2, height: 30))
  56 + topTitleLbl.text = model.blockName ?? "全部课程"
  57 + topTitleLbl.font = BoldFont_21
  58 + topTitleLbl.textColor = HexColor("#333333")
  59 + bgBackView.addSubview(topTitleLbl)
  60 +
  61 + //总块数
  62 + let contentsNum = model.contents.count
  63 + //model行数
  64 + let row = model.rowNum
  65 + //总显示块数
  66 + var totalNum = (contentsNum >= row) ? row : contentsNum
  67 + if row == 0{//row为0 , contents全部显示
  68 + totalNum = contentsNum
  69 + }
  70 + for i in 0..<totalNum{//i是第几行
  71 + let contentMdl = model.contents[i]
  72 +
  73 + //小icon
  74 + let imageView = UIImageView(frame: CGRectMake(DownSlideRecommendLeftGap, topTitleLbl.bottom+DownSlideRecommendLeftGap+CGFloat(i)*(DownSlideAllCourseRowTopYGap+DownSlideAllCourseRowImageWH+DownSlideAllCourseRowBottomYGap), CGFloat(DownSlideAllCourseRowImageWH), CGFloat(DownSlideAllCourseRowImageWH)))
  75 + imageView.kf.setImage(with: URL(string:contentMdl.poster ?? ""))
  76 + bgBackView.addSubview(imageView)
  77 +
  78 + let titleLbl = UILabel(frame: CGRect(x: imageView.right+DownSlideRecommendLeftGap, y: imageView.top, width: DownSlideSingleCourseW-90-imageView.right, height: 21))
  79 + titleLbl.text = contentMdl.title ?? "婴儿课程"
  80 + titleLbl.font = Font_15
  81 + titleLbl.textColor = HexColor("#333333")
  82 + bgBackView.addSubview(titleLbl)
  83 +
  84 + let subTitleLbl = UILabel(frame: CGRect(x: titleLbl.left, y:titleLbl.bottom+3 , width: titleLbl.width, height: 17))
  85 + subTitleLbl.text = contentMdl.subTitle ?? "适应3-6岁"
  86 + subTitleLbl.font = Font_12
  87 + subTitleLbl.textColor = HexColor("#999999")
  88 + bgBackView.addSubview(subTitleLbl)
  89 +
  90 + let enterBtn = UIButton(type: .custom)
  91 + enterBtn.frame = CGRect(x: subTitleLbl.right+10, y: 0, width: 65, height: 30)
  92 + enterBtn.centerY = imageView.centerY
  93 + enterBtn.setBackgroundImage(UIImage(named: "homepage_down_enter"), for: .normal)
  94 + enterBtn.setTitle("进入", for: .normal)
  95 + enterBtn.titleLabel?.font = BoldFont_13
  96 + enterBtn.setTitleColor(HexColor("#FFFFFF"), for: .normal)
  97 + enterBtn.addTarget(self, action: #selector(enterBtnAction(_:)), for: .touchUpInside)
  98 + enterBtn.tag = i
  99 + bgBackView.addSubview(enterBtn)
  100 + }
  101 + }else if model.type == SlideModelTypeOneCourse75 {
  102 + //单图课程
  103 +
  104 + let topTitleLbl = UILabel(frame: CGRect(x: 0, y: KStatusBarHeight+DownSlideRecommendLeftGap, width:bgBackView.width - 50 , height: 30))
  105 + topTitleLbl.text = model.contents[0].title ?? "婴儿课程"
  106 + topTitleLbl.font = BoldFont_21
  107 + topTitleLbl.textColor = HexColor("#FFFFFF")
  108 + imageView.addSubview(topTitleLbl)
  109 +
  110 + let topSubTitleLbl = UILabel(frame: CGRect(x: topTitleLbl.left, y:topTitleLbl.bottom , width: topTitleLbl.width, height: 30))
  111 + topSubTitleLbl.text = model.contents[0].subTitle ?? "适应3-6岁"
  112 + topSubTitleLbl.font = Font_12
  113 + topSubTitleLbl.textColor = HexColor("#FFFFFF")
  114 + imageView.addSubview(topSubTitleLbl)
  115 +
  116 + //总块数
  117 + let contentsNum = model.contents.count
  118 + //model行数
  119 + let row = model.rowNum
  120 + //总显示块数
  121 + var totalNum = (contentsNum >= row) ? row : contentsNum
  122 + if row == 0{//row为0 , contents全部显示
  123 + totalNum = contentsNum
  124 + }
  125 + for i in 0..<totalNum{//i是第几行
  126 + let contentMdl = model.contents[i]
  127 +
  128 + //小icon
  129 + let imgView = UIImageView(frame: CGRectMake(0, imageView.height+DownSlideRecommendLeftGap+CGFloat(i)*(DownSlideAllCourseRowTopYGap+DownSlideAllCourseRowImageWH+DownSlideAllCourseRowBottomYGap), CGFloat(DownSlideAllCourseRowImageWH), CGFloat(DownSlideAllCourseRowImageWH)))
  130 + imgView.kf.setImage(with: URL(string:contentMdl.poster ?? ""))
  131 + bgBackView.addSubview(imgView)
  132 +
  133 + let titleLbl = UILabel(frame: CGRect(x: imgView.right+DownSlideRecommendLeftGap, y: imgView.top, width: DownSlideSingleCourseW-90-imgView.right, height: 21))
  134 + titleLbl.text = contentMdl.title ?? "婴儿课程"
  135 + titleLbl.font = Font_15
  136 + titleLbl.textColor = HexColor("#333333")
  137 + bgBackView.addSubview(titleLbl)
  138 +
  139 + let subTitleLbl = UILabel(frame: CGRect(x: titleLbl.left, y:titleLbl.bottom+3 , width: titleLbl.width, height: 17))
  140 + subTitleLbl.text = contentMdl.subTitle ?? "适应3-6岁"
  141 + subTitleLbl.font = Font_12
  142 + subTitleLbl.textColor = HexColor("#999999")
  143 + bgBackView.addSubview(subTitleLbl)
  144 +
  145 + let enterBtn = UIButton(type: .custom)
  146 + enterBtn.frame = CGRect(x: subTitleLbl.right+10, y: 0, width: 65, height: 30)
  147 + enterBtn.centerY = imgView.centerY-5
  148 + enterBtn.setBackgroundImage(UIImage(named: "homepage_down_enter"), for: .normal)
  149 + enterBtn.setTitle("进入", for: .normal)
  150 + enterBtn.titleLabel?.font = BoldFont_13
  151 + enterBtn.setTitleColor(HexColor("#FFFFFF"), for: .normal)
  152 + enterBtn.addTarget(self, action: #selector(enterBtnAction(_:)), for: .touchUpInside)
  153 + enterBtn.tag = i
  154 + bgBackView.addSubview(enterBtn)
  155 + }
  156 + }
  157 + }
  158 +
  159 + //闭包:函数参数
  160 +// func callBackBlock(_ block: @escaping enterBlock) {
  161 +// block(_:)
  162 +// }
  163 +// func useBlock(){
  164 +// if callBack != nil {
  165 +// callBack!("闭包传值2")
  166 +// }
  167 +// }
  168 + //MARK: - 事件
  169 + @objc func enterBtnAction(_ sender: UIButton){
  170 + let tag = sender.tag
  171 + let contentMdl = (self.slideModel?.contents[tag])!
  172 + if callBack != nil {
  173 + let contentMdl1 = contentMdl
  174 + callBack!(contentMdl1)
  175 + }
46 176 }
47   -
48 177 }
49   -
50   -
51   -fileprivate let textViewLeftMargin: CGFloat = 20
52   -fileprivate let textViewTopMargin: CGFloat = 40
53   -fileprivate let textViewBottomMargin: CGFloat = 50
54   -fileprivate let textViewText = "Thank you. I'm honored to be with you today for your commencement from one of the finest universities in the world. Truth be told, i never graduated from college and this is the closest I've ever gotten to a college gradution. \n\nToday i want to tell you three stories from my life. That's it. No big deal. Just three stories. The first story is about connecting the dots. \n\ndropped out of Reed College after the first 6 months, but then stayed around as a drop-in for another 18 months or so before I really quit. So why did I drop out? \n\nIt started before I was born. My biological mother was a young,unwed college graduate student, and she decided to put me up for adoption. She felt very strongly that I should be adopted by college graduates, so everything was all set for me to be adopted at birth by a lawyer and his wife. Except that when I popped out they decided at the last minute that they really wanted a girl. So my parents, who were on a waiting list, got a call in the middle of the night asking: 'We got an unexpected baby boy; do you want him?' They said: 'Of course.' My biological mother found out later that my mother had never graduated from college and my father had never graduated from high school. She refused to sign the final adoption papers. She only relented a few months later when my parents promised that I would go to college."
... ...
metaCode/Classes/Main/HomePage/View/CNUpSlideView.swift
... ... @@ -45,7 +45,6 @@ class CNUpSlideView:UIView{
45 45 }
46 46 }
47 47 else if(type == UpDownTypePage){
48   - print("UpDownTypePage")
49 48 self.webView.isHidden = true
50 49 self.upSlideVC.view.isHidden = false
51 50 }else if(type == UpDownTypeShopDetail){
... ...
metaCode/Classes/Main/HomePage/ViewModel/CNLiveDownSlideModel.swift 0 → 100644
  1 +//
  2 +// CNLiveDownSlideModel.swift
  3 +// metaCode
  4 +//
  5 +// Created by zx on 2023/10/19.
  6 +//
  7 +
  8 +import Foundation
  9 +
  10 +// !!!: /contentApi/getPage 接口数据
  11 +class CNLiveDownSlideModel: BaseModel {
  12 + ///大块标题id
  13 + var blockId: String?
  14 + ///大块标题
  15 + var blockName: String?
  16 + ///类型 type=4一排两个 74今日推荐 12列表全部课程 75单课程大图/
  17 + var type: String?
  18 + ///显示几行
  19 + var rowNum: Int = 0
  20 + ///具体内容 title subTitle poster thirdUrl或者shareUrl
  21 + var contents = [CNLiveDownSlideContentsModel]()
  22 + ///cell高度
  23 + var cellH: CGFloat = 0
  24 +}
  25 +
  26 +//下滑tableview背景颜色
  27 +let kCNDownSlideContentsModelModel1: String = "1"
  28 +let kCNDownSlideContentsModelModel2: String = "2"
  29 +let kCNDownSlideContentsModelModel3: String = "3"
  30 +let kCNDownSlideContentsModelModel4: String = "4"
  31 +let kCNDownSlideContentsModelModelAlbum: String = "album"
  32 +let kCNDownSlideContentsModelModelAlbum_video: String = "album_video"
  33 +let kCNDownSlideContentsModelModelAlbum_ugc: String = "album_ugc"
  34 +
  35 +class CNLiveDownSlideContentsModel: BaseModel {
  36 + ///内容id
  37 + var contentId: String?
  38 + ///主标题
  39 + var title: String?
  40 + ///副标题
  41 + var subTitle: String?
  42 + ///头像/
  43 + var poster: String?
  44 + ///videoId
  45 + var pid: String?
  46 + ///model
  47 + ///1,2时跳转:sharelUrl后面拼接 ?contentId=contentId&videoId=pid
  48 + ///3,4时跳转:thirdUrl
  49 + ///“album”,“album_video”,“album_ugc” -> http://wjjh5.cnlive.com/cnYmAlbumVideoList.html?aid=contentId&title=titlle
  50 + /// aid:专辑id,title:专辑名称(需要encode)
  51 + var model: String?
  52 + ///model为1,2时
  53 + var shareUrl: String?
  54 + ///model为3,4时跳转url
  55 + var thirdUrl: String?
  56 +}
... ...
metaCode/Classes/Main/HomePage/ViewModel/CNLiveDownSlideViewModel.swift 0 → 100644
  1 +//
  2 +// CNLiveDownSlideViewModel.swift
  3 +// metaCode
  4 +//
  5 +// Created by zx on 2023/10/19.
  6 +//
  7 +
  8 +import Foundation
  9 +import CNLiveRequestBastKit
  10 +
  11 +enum CNLiveDownSlideResponseType {
  12 + case success
  13 + case failed
  14 + case noNetwork
  15 + case unkonw
  16 +}
  17 +typealias downSlideResultBlock = (_ result: Any,_ status:CNLiveDownSlideResponseType) -> Void
  18 +
  19 +class CNLiveDownSlideViewModel:NSObject{
  20 +
  21 + /// 获取下滑页原生页面数据
  22 + /// - Parameters:
  23 + /// - userId: 用户ID
  24 + /// - pageId: 页面ID
  25 + static func requestGetPage(pageId:NSString, resultBlock: @escaping downSlideResultBlock) {
  26 + let param = NSMutableDictionary()
  27 + param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "userId")
  28 + param.setValue(pageId, forKey: "pageId")
  29 + CNLiveNetworking.setAllowRequestDefaultArgument(true)
  30 + CNLiveNetworking.setupShowDataResult(false)
  31 + CNLiveNetworking.requestNetwork(with: .GET, urlString: APPBaseCMSUrl+"/contentApi/getPage", param: param as! [String : String], cacheType: .networkOnly) { task, result, error in
  32 + hiddenLoading()
  33 + if (error == nil) {
  34 + let resp = result as! NSDictionary
  35 + let errorCode = "\(resp["errorCode"] ?? "0")"
  36 + if (errorCode == "0") {
  37 + let downSlideModelArr = resp["data"] as! NSArray
  38 + var modelArray:[BaseModel] = []
  39 + for downSlideDic in downSlideModelArr {
  40 + let downSlideModel = newDictionaryToModel(downSlideDic as! [String : Any], CNLiveDownSlideModel.self)
  41 + modelArray.append(downSlideModel)
  42 + }
  43 + resultBlock(modelArray,.success)
  44 + }
  45 + else{
  46 + resultBlock(NSNull(),.failed)
  47 + }
  48 + }
  49 + }
  50 + }
  51 +
  52 +}
... ...
metaCode/Classes/Main/MinePage/ViewModel/CNLiveMineBaseModel.swift
... ... @@ -151,7 +151,7 @@ final class StandListModel: BaseModel, TableCodable {
151 151 var upPath: String = ""//顶部h5 或原生页面pageId
152 152 var upType: Int = 0//下滑类型1:h5 2:原生页面
153 153 var downType: Int = 0//上滑类型1:h5 2:原生页面
154   - var downPath: String = ""//底部h5 或原生页面pageId
  154 + var downPath: String = ""//底部h5url 或原生页面pageId
155 155 var auth: Bool = false//身份是否验证
156 156  
157 157 var createTimeString: String = ""
... ...
metaCode/Classes/Main/Util/CNLiveDownSlideModelLayout.swift 0 → 100644
  1 +//
  2 +// CNLiveDownSlideModelLayout.swift
  3 +// metaCode
  4 +//
  5 +// Created by zx on 2023/10/23.
  6 +//
  7 +
  8 +import Foundation
  9 +
  10 +
  11 +class CNLiveDownSlideModelLayout:NSObject{
  12 +
  13 + ///cell高度
  14 + var cellH:CGFloat = 0.0
  15 +
  16 + //slideModel
  17 + var _slideModel : CNLiveDownSlideModel?
  18 + var slideModel : CNLiveDownSlideModel? {
  19 + get{
  20 + _slideModel
  21 + }
  22 + set{
  23 + _slideModel = newValue
  24 + }
  25 + }
  26 +
  27 + init(model:CNLiveDownSlideModel){
  28 + super.init()
  29 + self.slideModel = model
  30 + //总块数
  31 + let contentsNum = model.contents.count
  32 + //model行数
  33 + let row = model.rowNum
  34 + if(_slideModel?.type == SlideModelTypeRecommend4){//推荐活动,推荐课程
  35 +
  36 + //总显示块数/循环数
  37 + var totalNum = (contentsNum >= row*2) ? row*2 : contentsNum
  38 + if row == 0{//row为0 , contents全部显示
  39 + totalNum = contentsNum
  40 + }
  41 + _slideModel?.cellH = ceil(CGFloat(totalNum)*0.5)*(DownSlideRecommendWH + DownSlideRecommendLeftGap)
  42 + }else if(_slideModel?.type == SlideModelTypeTodayRecommend74){//今日推荐
  43 + //总显示块数/循环数
  44 + var totalNum = (contentsNum >= row) ? row : contentsNum
  45 + if row == 0{//row为0 , contents全部显示
  46 + totalNum = contentsNum
  47 + }
  48 + _slideModel?.cellH = CGFloat(totalNum)*(DownSlideTodayRecommendH + DownSlideRecommendLeftGap)
  49 + }else if(_slideModel?.type == SlideModelTypeAllCourse12){//全部课程
  50 +
  51 + _slideModel?.cellH = DownSlideAllCourseTitleH + DownSlideAllCourseRowH * CGFloat(_slideModel!.rowNum)+DownSlideRecommendLeftGap
  52 +
  53 + }else if(_slideModel?.type == SlideModelTypeOneCourse75){//单节课程
  54 +
  55 + _slideModel?.cellH = DownSlideSingleCourseImgH + DownSlideSingleCourseMoreH+DownSlideRecommendLeftGap
  56 + }else{
  57 + _slideModel?.cellH = 0
  58 + }
  59 + }
  60 + func getCellHModel()->CNLiveDownSlideModel{
  61 + return _slideModel!
  62 + }
  63 +
  64 +}
... ...
metaCode/Classes/Main/Util/CNLiveDownSlideTool.swift 0 → 100644
  1 +//
  2 +// CNLiveDownSlideTool.swift
  3 +// metaCode
  4 +//
  5 +// Created by zx on 2023/10/25.
  6 +//
  7 +
  8 +import Foundation
  9 +
  10 +class CNLiveDownSlideTool:NSObject{
  11 + class func pushWebVCWithContentsMdl(contentMdl:CNLiveDownSlideContentsModel){
  12 +
  13 + if (contentMdl.model == kCNDownSlideContentsModelModel1) || (contentMdl.model == kCNDownSlideContentsModelModel2){
  14 +
  15 + let queryItem = URLQueryItem(name: "contentId", value: contentMdl.contentId)
  16 + let queryItem1 = URLQueryItem(name: "videoId", value: contentMdl.pid)
  17 + let urlComponents = NSURLComponents(string: (contentMdl.shareUrl)!)!
  18 + urlComponents.queryItems = [queryItem, queryItem1]
  19 + let regURL = urlComponents.url
  20 + let webVC = CNWebViewController()
  21 + webVC.url = regURL
  22 + currentViewController()?.navigationController?.pushViewController(webVC, animated: true)
  23 +
  24 + }else if (contentMdl.model == kCNDownSlideContentsModelModel3) || (contentMdl.model == kCNDownSlideContentsModelModel4){
  25 + let webVC = CNWebViewController()
  26 + webVC.url = URL(string: (contentMdl.thirdUrl)!)
  27 + currentViewController()?.navigationController?.pushViewController(webVC, animated: true)
  28 + }else if (contentMdl.model == kCNDownSlideContentsModelModelAlbum) || (contentMdl.model == kCNDownSlideContentsModelModelAlbum_ugc) || (contentMdl.model == kCNDownSlideContentsModelModelAlbum_video){
  29 +
  30 + let urlString = "http://wjjh5.cnlive.com/cnYmAlbumVideoList.html"
  31 + let queryItem = URLQueryItem(name: "aid", value: contentMdl.contentId)
  32 + let queryItem1 = URLQueryItem(name: "title", value: contentMdl.title)
  33 + let urlComponents = NSURLComponents(string: urlString)
  34 + urlComponents!.queryItems = [queryItem, queryItem1]
  35 + let regURL = urlComponents?.url
  36 + let webVC = CNWebViewController()
  37 + webVC.url = regURL
  38 + currentViewController()?.navigationController?.pushViewController(webVC, animated: true)
  39 + }else{
  40 + return
  41 + }
  42 + }
  43 +
  44 + class func detailPushWebVCWithContentsMdl(contentMdl:CNLiveDownSlideContentsModel,viewController:UIViewController){
  45 +
  46 + if (contentMdl.model == kCNDownSlideContentsModelModel1) || (contentMdl.model == kCNDownSlideContentsModelModel2){
  47 +
  48 + let queryItem = URLQueryItem(name: "contentId", value: contentMdl.contentId)
  49 + let queryItem1 = URLQueryItem(name: "videoId", value: contentMdl.pid)
  50 + let urlComponents = NSURLComponents(string: (contentMdl.shareUrl)!)!
  51 + urlComponents.queryItems = [queryItem, queryItem1]
  52 + let regURL = urlComponents.url
  53 + let webVC = CNWebViewController()
  54 + webVC.url = regURL
  55 + viewController.navigationController?.pushViewController(webVC, animated: true)
  56 +
  57 + }else if (contentMdl.model == kCNDownSlideContentsModelModel3) || (contentMdl.model == kCNDownSlideContentsModelModel4){
  58 + let webVC = CNWebViewController()
  59 + webVC.url = URL(string: (contentMdl.thirdUrl)!)
  60 + viewController.navigationController?.pushViewController(webVC, animated: true)
  61 + }else if (contentMdl.model == kCNDownSlideContentsModelModelAlbum) || (contentMdl.model == kCNDownSlideContentsModelModelAlbum_ugc) || (contentMdl.model == kCNDownSlideContentsModelModelAlbum_video){
  62 +
  63 + let urlString = "http://wjjh5.cnlive.com/cnYmAlbumVideoList.html"
  64 + let queryItem = URLQueryItem(name: "aid", value: contentMdl.contentId)
  65 + let queryItem1 = URLQueryItem(name: "title", value: contentMdl.title)
  66 + let urlComponents = NSURLComponents(string: urlString)
  67 + urlComponents!.queryItems = [queryItem, queryItem1]
  68 + let regURL = urlComponents?.url
  69 + let webVC = CNWebViewController()
  70 + webVC.url = regURL
  71 + viewController.navigationController?.pushViewController(webVC, animated: true)
  72 + }else{
  73 + return
  74 + }
  75 + }
  76 +}
... ...
metaCode/Classes/Main/Util/CNUpSlideAnimationTransition.swift
... ... @@ -41,22 +41,22 @@ extension CNUpSlideAnimationTransition: UIViewControllerAnimatedTransitioning {
41 41 let containerView = transitionContext.containerView
42 42 //1.Get fromVC and toVC
43 43 guard let fromVC = transitionContext.viewController(forKey: .from) as? CNUpSlideViewController else { return }
44   - guard let toVC = transitionContext.viewController(forKey: .to) as? CNUpSlideDetailViewController else { return }
  44 + guard let toNaviVC = transitionContext.viewController(forKey: .to) as? CNSlideBaseNavigationController else { return }
45 45 guard let selectedCell = fromVC.selectedCell else { return }
46   -
  46 + let toVC = toNaviVC.topViewController as! CNUpSlideDetailViewController
47 47 let frame = selectedCell.convert(selectedCell.bgBackView.frame, to: fromVC.view)
48 48 //2.Set presentation original size.
49 49 toVC.view.frame = frame
50 50 toVC.scrollView.imageView.frame.size.width = GlobalConstants.todayCardSize.width
51 51 toVC.scrollView.imageView.frame.size.height = GlobalConstants.todayCardSize.height
52 52  
53   - containerView.addSubview(toVC.view)
  53 + containerView.addSubview(toNaviVC.view)
54 54  
55 55 //3.Change original size to final size with animation.
56 56 UIView.animate(withDuration: transitonDuration, delay: 0, usingSpringWithDamping: 0.5, initialSpringVelocity: 0, options: [], animations: {
57 57 toVC.view.frame = UIScreen.main.bounds
58 58 toVC.scrollView.imageView.frame.size.width = KSreenWidth
59   - toVC.scrollView.imageView.frame.size.height = GlobalConstants.cardDetailTopImageH
  59 + toVC.scrollView.imageView.frame.size.height = KSreenWidth*DownSlideSingleCourseImgH/DownSlideSingleCourseW
60 60 toVC.closeBtn.alpha = 1
61 61  
62 62 }) { (completed) in
... ... @@ -65,9 +65,10 @@ extension CNUpSlideAnimationTransition: UIViewControllerAnimatedTransitioning {
65 65 }
66 66  
67 67 func animationForDismiss(using transitionContext: UIViewControllerContextTransitioning) {
68   - guard let fromVC = transitionContext.viewController(forKey: .from) as? CNUpSlideDetailViewController else { return }
  68 + guard let fromNaviVC = transitionContext.viewController(forKey: .from) as? CNSlideBaseNavigationController else { return }
69 69 guard let toVC = transitionContext.viewController(forKey: .to) as? CNUpSlideViewController else { return }
70 70 guard let selectedCell = toVC.selectedCell else { return }
  71 + let fromVC = fromNaviVC.topViewController as! CNUpSlideDetailViewController
71 72  
72 73 UIView.animate(withDuration: transitonDuration - 0.3, delay: 0, usingSpringWithDamping: 0.8, initialSpringVelocity: 0, options: [], animations: {
73 74 let frame = selectedCell.convert(selectedCell.bgBackView.frame, to: toVC.view)
... ...
metaCode/Supporting Files/Assets.xcassets/Home/homepage_down_enter.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "scale" : "1x"
  6 + },
  7 + {
  8 + "filename" : "homepage_down_enter@2x.png",
  9 + "idiom" : "universal",
  10 + "scale" : "2x"
  11 + },
  12 + {
  13 + "idiom" : "universal",
  14 + "scale" : "3x"
  15 + }
  16 + ],
  17 + "info" : {
  18 + "author" : "xcode",
  19 + "version" : 1
  20 + }
  21 +}
... ...
metaCode/Supporting Files/Assets.xcassets/Home/homepage_down_enter.imageset/homepage_down_enter@2x.png 0 → 100644

2.18 KB

metaCode/Supporting Files/Assets.xcassets/Home/homepage_down_more.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "scale" : "1x"
  6 + },
  7 + {
  8 + "filename" : "homepage_down_more@2x.png",
  9 + "idiom" : "universal",
  10 + "scale" : "2x"
  11 + },
  12 + {
  13 + "idiom" : "universal",
  14 + "scale" : "3x"
  15 + }
  16 + ],
  17 + "info" : {
  18 + "author" : "xcode",
  19 + "version" : 1
  20 + }
  21 +}
... ...
metaCode/Supporting Files/Assets.xcassets/Home/homepage_down_more.imageset/homepage_down_more@2x.png 0 → 100644

1.66 KB