Commit 81cce419220f7d568c890663d3c68bb8394b2486

Authored by liushiyu
1 parent fa6dc868

视频播放

Showing 46 changed files with 2183 additions and 8 deletions
@@ -45,7 +45,17 @@ target 'metaCode' do @@ -45,7 +45,17 @@ target 'metaCode' do
45 #轮播图 45 #轮播图
46 pod 'FSPagerView', '0.8.3' 46 pod 'FSPagerView', '0.8.3'
47 #pod 'SDCycleScrollView', '~> 1.82' 47 #pod 'SDCycleScrollView', '~> 1.82'
48 - 48 +
  49 + #播放器
  50 + pod 'ZFPlayer', :git => 'https://gitee.com/mirrors/ZFPlayer.git'
  51 + pod 'ZFPlayer/ControlView', :git => 'https://gitee.com/mirrors/ZFPlayer.git'
  52 +# pod 'ZFPlayer/AVPlayer', :git => 'https://gitee.com/mirrors/ZFPlayer.git'
  53 + pod 'ZFPlayer/ijkplayer', :git => 'https://gitee.com/mirrors/ZFPlayer.git'
  54 + #支付
  55 + #pod 'CNLivePayCostModule'
  56 + #分享
  57 + #pod 'CNLiveShareToolKit'
  58 +
49 target 'metaCodeTests' do 59 target 'metaCodeTests' do
50 inherit! :search_paths 60 inherit! :search_paths
51 # Pods for testing 61 # Pods for testing
metaCode.xcodeproj/project.pbxproj
@@ -75,11 +75,18 @@ @@ -75,11 +75,18 @@
75 792E57DB2A3AE9F4005834DB /* CNLiveCommonQiniuTool.swift in Sources */ = {isa = PBXBuildFile; fileRef = 792E57DA2A3AE9F4005834DB /* CNLiveCommonQiniuTool.swift */; }; 75 792E57DB2A3AE9F4005834DB /* CNLiveCommonQiniuTool.swift in Sources */ = {isa = PBXBuildFile; fileRef = 792E57DA2A3AE9F4005834DB /* CNLiveCommonQiniuTool.swift */; };
76 79396EED2A319F220053E1AF /* NSObject+CNLiveExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79396EEC2A319F220053E1AF /* NSObject+CNLiveExtensions.swift */; }; 76 79396EED2A319F220053E1AF /* NSObject+CNLiveExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79396EEC2A319F220053E1AF /* NSObject+CNLiveExtensions.swift */; };
77 79396EF12A31C21B0053E1AF /* CNLiveInfoShowViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79396EF02A31C21B0053E1AF /* CNLiveInfoShowViewController.swift */; }; 77 79396EF12A31C21B0053E1AF /* CNLiveInfoShowViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79396EF02A31C21B0053E1AF /* CNLiveInfoShowViewController.swift */; };
  78 + 7939B0732B47F12F005AE981 /* CNLiveShortVideoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7939B0722B47F12F005AE981 /* CNLiveShortVideoViewController.swift */; };
  79 + 7939B0752B47F1B9005AE981 /* CNLiveShortVideoListTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7939B0742B47F1B9005AE981 /* CNLiveShortVideoListTableViewCell.swift */; };
  80 + 7939B0772B47F88A005AE981 /* CNLiveShortVideoControlView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7939B0762B47F88A005AE981 /* CNLiveShortVideoControlView.swift */; };
  81 + 7939B0792B47FC33005AE981 /* CNLiveShortVideoCustomControlView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7939B0782B47FC33005AE981 /* CNLiveShortVideoCustomControlView.swift */; };
78 793CAF522A58FCA200882EF4 /* CNLiveMineExchangeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 793CAF512A58FCA200882EF4 /* CNLiveMineExchangeViewController.swift */; }; 82 793CAF522A58FCA200882EF4 /* CNLiveMineExchangeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 793CAF512A58FCA200882EF4 /* CNLiveMineExchangeViewController.swift */; };
  83 + 794294A72B4D18EC008AAFA0 /* CNLiveShortVideoContentListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 794294A62B4D18EC008AAFA0 /* CNLiveShortVideoContentListView.swift */; };
79 794BC1652AF9E70D00A68C74 /* CNLiveShopOrderSendViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 794BC1642AF9E70D00A68C74 /* CNLiveShopOrderSendViewController.swift */; }; 84 794BC1652AF9E70D00A68C74 /* CNLiveShopOrderSendViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 794BC1642AF9E70D00A68C74 /* CNLiveShopOrderSendViewController.swift */; };
80 794FF1052B01FC8800385E85 /* CNLiveShopOrderSearchViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 794FF1042B01FC8800385E85 /* CNLiveShopOrderSearchViewController.swift */; }; 85 794FF1052B01FC8800385E85 /* CNLiveShopOrderSearchViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 794FF1042B01FC8800385E85 /* CNLiveShopOrderSearchViewController.swift */; };
81 794FF1072B01FC9800385E85 /* CNLiveShopOrderSearchListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 794FF1062B01FC9800385E85 /* CNLiveShopOrderSearchListViewController.swift */; }; 86 794FF1072B01FC9800385E85 /* CNLiveShopOrderSearchListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 794FF1062B01FC9800385E85 /* CNLiveShopOrderSearchListViewController.swift */; };
82 794FF1092B02131300385E85 /* CNLiveSaveSearchDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = 794FF1082B02131300385E85 /* CNLiveSaveSearchDB.swift */; }; 87 794FF1092B02131300385E85 /* CNLiveSaveSearchDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = 794FF1082B02131300385E85 /* CNLiveSaveSearchDB.swift */; };
  88 + 796308732B4B8EB80090D22A /* CNLiveShortVideoViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 796308722B4B8EB80090D22A /* CNLiveShortVideoViewModel.swift */; };
  89 + 796308752B4B90700090D22A /* CNLiveShortVideoHomeModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 796308742B4B90700090D22A /* CNLiveShortVideoHomeModel.swift */; };
83 796398942A260C0100D045EB /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7963988D2A260C0100D045EB /* AppDelegate.swift */; }; 90 796398942A260C0100D045EB /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7963988D2A260C0100D045EB /* AppDelegate.swift */; };
84 7963989D2A260E6200D045EB /* CNLiveBaseViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7963989C2A260E6200D045EB /* CNLiveBaseViewController.swift */; }; 91 7963989D2A260E6200D045EB /* CNLiveBaseViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7963989C2A260E6200D045EB /* CNLiveBaseViewController.swift */; };
85 79656E382AAEBA8E00119A61 /* CNLiveMineInputViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79656E372AAEBA8E00119A61 /* CNLiveMineInputViewController.swift */; }; 92 79656E382AAEBA8E00119A61 /* CNLiveMineInputViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79656E372AAEBA8E00119A61 /* CNLiveMineInputViewController.swift */; };
@@ -109,6 +116,8 @@ @@ -109,6 +116,8 @@
109 799172362AF08D4500DC01A8 /* CNLiveShopBaseModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 799172352AF08D4500DC01A8 /* CNLiveShopBaseModel.swift */; }; 116 799172362AF08D4500DC01A8 /* CNLiveShopBaseModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 799172352AF08D4500DC01A8 /* CNLiveShopBaseModel.swift */; };
110 799172382AF090CD00DC01A8 /* CNLiveShopBodyListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 799172372AF090CD00DC01A8 /* CNLiveShopBodyListView.swift */; }; 117 799172382AF090CD00DC01A8 /* CNLiveShopBodyListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 799172372AF090CD00DC01A8 /* CNLiveShopBodyListView.swift */; };
111 7991723A2AF091E100DC01A8 /* CNLiveShopOrderListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 799172392AF091E100DC01A8 /* CNLiveShopOrderListViewController.swift */; }; 118 7991723A2AF091E100DC01A8 /* CNLiveShopOrderListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 799172392AF091E100DC01A8 /* CNLiveShopOrderListViewController.swift */; };
  119 + 79A212C02B0B5C5400BFA8E3 /* CNLiveShopCouponManagerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79A212BF2B0B5C5400BFA8E3 /* CNLiveShopCouponManagerViewController.swift */; };
  120 + 79A212C22B0B5D0700BFA8E3 /* CNLiveShopBodyCouponManagerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79A212C12B0B5D0700BFA8E3 /* CNLiveShopBodyCouponManagerView.swift */; };
112 79A267832AF8D7BC0088D9F6 /* CNLiveShopBodyCustomView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79A267822AF8D7BC0088D9F6 /* CNLiveShopBodyCustomView.swift */; }; 121 79A267832AF8D7BC0088D9F6 /* CNLiveShopBodyCustomView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79A267822AF8D7BC0088D9F6 /* CNLiveShopBodyCustomView.swift */; };
113 79A68C4A2A26E6CE00DC3B43 /* (null) in Sources */ = {isa = PBXBuildFile; }; 122 79A68C4A2A26E6CE00DC3B43 /* (null) in Sources */ = {isa = PBXBuildFile; };
114 79A68C4C2A26EA6000DC3B43 /* (null) in Sources */ = {isa = PBXBuildFile; }; 123 79A68C4C2A26EA6000DC3B43 /* (null) in Sources */ = {isa = PBXBuildFile; };
@@ -250,11 +259,18 @@ @@ -250,11 +259,18 @@
250 792E57DA2A3AE9F4005834DB /* CNLiveCommonQiniuTool.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveCommonQiniuTool.swift; sourceTree = "<group>"; }; 259 792E57DA2A3AE9F4005834DB /* CNLiveCommonQiniuTool.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveCommonQiniuTool.swift; sourceTree = "<group>"; };
251 79396EEC2A319F220053E1AF /* NSObject+CNLiveExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSObject+CNLiveExtensions.swift"; sourceTree = "<group>"; }; 260 79396EEC2A319F220053E1AF /* NSObject+CNLiveExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSObject+CNLiveExtensions.swift"; sourceTree = "<group>"; };
252 79396EF02A31C21B0053E1AF /* CNLiveInfoShowViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveInfoShowViewController.swift; sourceTree = "<group>"; }; 261 79396EF02A31C21B0053E1AF /* CNLiveInfoShowViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveInfoShowViewController.swift; sourceTree = "<group>"; };
  262 + 7939B0722B47F12F005AE981 /* CNLiveShortVideoViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShortVideoViewController.swift; sourceTree = "<group>"; };
  263 + 7939B0742B47F1B9005AE981 /* CNLiveShortVideoListTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShortVideoListTableViewCell.swift; sourceTree = "<group>"; };
  264 + 7939B0762B47F88A005AE981 /* CNLiveShortVideoControlView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShortVideoControlView.swift; sourceTree = "<group>"; };
  265 + 7939B0782B47FC33005AE981 /* CNLiveShortVideoCustomControlView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShortVideoCustomControlView.swift; sourceTree = "<group>"; };
253 793CAF512A58FCA200882EF4 /* CNLiveMineExchangeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineExchangeViewController.swift; sourceTree = "<group>"; }; 266 793CAF512A58FCA200882EF4 /* CNLiveMineExchangeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineExchangeViewController.swift; sourceTree = "<group>"; };
  267 + 794294A62B4D18EC008AAFA0 /* CNLiveShortVideoContentListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShortVideoContentListView.swift; sourceTree = "<group>"; };
254 794BC1642AF9E70D00A68C74 /* CNLiveShopOrderSendViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopOrderSendViewController.swift; sourceTree = "<group>"; }; 268 794BC1642AF9E70D00A68C74 /* CNLiveShopOrderSendViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopOrderSendViewController.swift; sourceTree = "<group>"; };
255 794FF1042B01FC8800385E85 /* CNLiveShopOrderSearchViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopOrderSearchViewController.swift; sourceTree = "<group>"; }; 269 794FF1042B01FC8800385E85 /* CNLiveShopOrderSearchViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopOrderSearchViewController.swift; sourceTree = "<group>"; };
256 794FF1062B01FC9800385E85 /* CNLiveShopOrderSearchListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopOrderSearchListViewController.swift; sourceTree = "<group>"; }; 270 794FF1062B01FC9800385E85 /* CNLiveShopOrderSearchListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopOrderSearchListViewController.swift; sourceTree = "<group>"; };
257 794FF1082B02131300385E85 /* CNLiveSaveSearchDB.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveSaveSearchDB.swift; sourceTree = "<group>"; }; 271 794FF1082B02131300385E85 /* CNLiveSaveSearchDB.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveSaveSearchDB.swift; sourceTree = "<group>"; };
  272 + 796308722B4B8EB80090D22A /* CNLiveShortVideoViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShortVideoViewModel.swift; sourceTree = "<group>"; };
  273 + 796308742B4B90700090D22A /* CNLiveShortVideoHomeModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShortVideoHomeModel.swift; sourceTree = "<group>"; };
258 7963988D2A260C0100D045EB /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; }; 274 7963988D2A260C0100D045EB /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
259 7963989C2A260E6200D045EB /* CNLiveBaseViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CNLiveBaseViewController.swift; sourceTree = "<group>"; }; 275 7963989C2A260E6200D045EB /* CNLiveBaseViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CNLiveBaseViewController.swift; sourceTree = "<group>"; };
260 79656E372AAEBA8E00119A61 /* CNLiveMineInputViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineInputViewController.swift; sourceTree = "<group>"; }; 276 79656E372AAEBA8E00119A61 /* CNLiveMineInputViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineInputViewController.swift; sourceTree = "<group>"; };
@@ -284,6 +300,8 @@ @@ -284,6 +300,8 @@
284 799172352AF08D4500DC01A8 /* CNLiveShopBaseModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopBaseModel.swift; sourceTree = "<group>"; }; 300 799172352AF08D4500DC01A8 /* CNLiveShopBaseModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopBaseModel.swift; sourceTree = "<group>"; };
285 799172372AF090CD00DC01A8 /* CNLiveShopBodyListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopBodyListView.swift; sourceTree = "<group>"; }; 301 799172372AF090CD00DC01A8 /* CNLiveShopBodyListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopBodyListView.swift; sourceTree = "<group>"; };
286 799172392AF091E100DC01A8 /* CNLiveShopOrderListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopOrderListViewController.swift; sourceTree = "<group>"; }; 302 799172392AF091E100DC01A8 /* CNLiveShopOrderListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopOrderListViewController.swift; sourceTree = "<group>"; };
  303 + 79A212BF2B0B5C5400BFA8E3 /* CNLiveShopCouponManagerViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopCouponManagerViewController.swift; sourceTree = "<group>"; };
  304 + 79A212C12B0B5D0700BFA8E3 /* CNLiveShopBodyCouponManagerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopBodyCouponManagerView.swift; sourceTree = "<group>"; };
287 79A267822AF8D7BC0088D9F6 /* CNLiveShopBodyCustomView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopBodyCustomView.swift; sourceTree = "<group>"; }; 305 79A267822AF8D7BC0088D9F6 /* CNLiveShopBodyCustomView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopBodyCustomView.swift; sourceTree = "<group>"; };
288 79A68C512A26F59C00DC3B43 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = metaCode/Info.plist; sourceTree = "<group>"; }; 306 79A68C512A26F59C00DC3B43 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = metaCode/Info.plist; sourceTree = "<group>"; };
289 79B2E35F2AF39191002A8524 /* NSObject+CNLiveConfigModuleInline.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSObject+CNLiveConfigModuleInline.swift"; sourceTree = "<group>"; }; 307 79B2E35F2AF39191002A8524 /* NSObject+CNLiveConfigModuleInline.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSObject+CNLiveConfigModuleInline.swift"; sourceTree = "<group>"; };
@@ -551,6 +569,52 @@ @@ -551,6 +569,52 @@
551 path = Util; 569 path = Util;
552 sourceTree = "<group>"; 570 sourceTree = "<group>";
553 }; 571 };
  572 + 7939B06D2B47EB46005AE981 /* VideoPage */ = {
  573 + isa = PBXGroup;
  574 + children = (
  575 + 7939B06E2B47EB46005AE981 /* ViewModel */,
  576 + 7939B06F2B47EB46005AE981 /* Controller */,
  577 + 7939B0702B47EB46005AE981 /* Model */,
  578 + 7939B0712B47EB46005AE981 /* View */,
  579 + );
  580 + path = VideoPage;
  581 + sourceTree = "<group>";
  582 + };
  583 + 7939B06E2B47EB46005AE981 /* ViewModel */ = {
  584 + isa = PBXGroup;
  585 + children = (
  586 + 796308722B4B8EB80090D22A /* CNLiveShortVideoViewModel.swift */,
  587 + );
  588 + path = ViewModel;
  589 + sourceTree = "<group>";
  590 + };
  591 + 7939B06F2B47EB46005AE981 /* Controller */ = {
  592 + isa = PBXGroup;
  593 + children = (
  594 + 7939B0722B47F12F005AE981 /* CNLiveShortVideoViewController.swift */,
  595 + );
  596 + path = Controller;
  597 + sourceTree = "<group>";
  598 + };
  599 + 7939B0702B47EB46005AE981 /* Model */ = {
  600 + isa = PBXGroup;
  601 + children = (
  602 + 796308742B4B90700090D22A /* CNLiveShortVideoHomeModel.swift */,
  603 + );
  604 + path = Model;
  605 + sourceTree = "<group>";
  606 + };
  607 + 7939B0712B47EB46005AE981 /* View */ = {
  608 + isa = PBXGroup;
  609 + children = (
  610 + 7939B0742B47F1B9005AE981 /* CNLiveShortVideoListTableViewCell.swift */,
  611 + 7939B0762B47F88A005AE981 /* CNLiveShortVideoControlView.swift */,
  612 + 7939B0782B47FC33005AE981 /* CNLiveShortVideoCustomControlView.swift */,
  613 + 794294A62B4D18EC008AAFA0 /* CNLiveShortVideoContentListView.swift */,
  614 + );
  615 + path = View;
  616 + sourceTree = "<group>";
  617 + };
554 79579CAA2AAAE905006E5B38 /* Database */ = { 618 79579CAA2AAAE905006E5B38 /* Database */ = {
555 isa = PBXGroup; 619 isa = PBXGroup;
556 children = ( 620 children = (
@@ -616,6 +680,7 @@ @@ -616,6 +680,7 @@
616 796398902A260C0100D045EB /* Main */ = { 680 796398902A260C0100D045EB /* Main */ = {
617 isa = PBXGroup; 681 isa = PBXGroup;
618 children = ( 682 children = (
  683 + 7939B06D2B47EB46005AE981 /* VideoPage */,
619 7991722C2AF08CF100DC01A8 /* ShopPage */, 684 7991722C2AF08CF100DC01A8 /* ShopPage */,
620 790D01972A2DCAE400C5978D /* MinePage */, 685 790D01972A2DCAE400C5978D /* MinePage */,
621 790D018C2A2D8C9A00C5978D /* LoginPage */, 686 790D018C2A2D8C9A00C5978D /* LoginPage */,
@@ -734,6 +799,7 @@ @@ -734,6 +799,7 @@
734 798916EC2B048E8200D08302 /* CNLiveShopTransViewController.swift */, 799 798916EC2B048E8200D08302 /* CNLiveShopTransViewController.swift */,
735 798916EE2B048EC800D08302 /* CNLiveShopTransListViewController.swift */, 800 798916EE2B048EC800D08302 /* CNLiveShopTransListViewController.swift */,
736 79BB1C132B05C51900C5720C /* CNLiveShopCouponViewController.swift */, 801 79BB1C132B05C51900C5720C /* CNLiveShopCouponViewController.swift */,
  802 + 79A212BF2B0B5C5400BFA8E3 /* CNLiveShopCouponManagerViewController.swift */,
737 ); 803 );
738 path = Controller; 804 path = Controller;
739 sourceTree = "<group>"; 805 sourceTree = "<group>";
@@ -756,6 +822,7 @@ @@ -756,6 +822,7 @@
756 798916F02B0491A400D08302 /* CNLiveShopBodyTransListView.swift */, 822 798916F02B0491A400D08302 /* CNLiveShopBodyTransListView.swift */,
757 79BB1C152B05C62900C5720C /* CNLiveShopBodyCouponView.swift */, 823 79BB1C152B05C62900C5720C /* CNLiveShopBodyCouponView.swift */,
758 79D094DB2B0765DD008CB1F3 /* CNLiveShopBodyCouponGoodsListView.swift */, 824 79D094DB2B0765DD008CB1F3 /* CNLiveShopBodyCouponGoodsListView.swift */,
  825 + 79A212C12B0B5D0700BFA8E3 /* CNLiveShopBodyCouponManagerView.swift */,
759 ); 826 );
760 path = View; 827 path = View;
761 sourceTree = "<group>"; 828 sourceTree = "<group>";
@@ -923,6 +990,7 @@ @@ -923,6 +990,7 @@
923 818163B52A25CFCC00579C86 /* Frameworks */, 990 818163B52A25CFCC00579C86 /* Frameworks */,
924 818163B62A25CFCC00579C86 /* Resources */, 991 818163B62A25CFCC00579C86 /* Resources */,
925 E0FAE2296315BED785FA507E /* [CP] Embed Pods Frameworks */, 992 E0FAE2296315BED785FA507E /* [CP] Embed Pods Frameworks */,
  993 + 43270B0E3FD1AFD4E05616D0 /* [CP] Copy Pods Resources */,
926 ); 994 );
927 buildRules = ( 995 buildRules = (
928 ); 996 );
@@ -961,6 +1029,7 @@ @@ -961,6 +1029,7 @@
961 818163D52A25CFCF00579C86 /* Frameworks */, 1029 818163D52A25CFCF00579C86 /* Frameworks */,
962 818163D62A25CFCF00579C86 /* Resources */, 1030 818163D62A25CFCF00579C86 /* Resources */,
963 035341748B563C741D14CD83 /* [CP] Embed Pods Frameworks */, 1031 035341748B563C741D14CD83 /* [CP] Embed Pods Frameworks */,
  1032 + 51DB2DC03E9B32399B70EEC8 /* [CP] Copy Pods Resources */,
964 ); 1033 );
965 buildRules = ( 1034 buildRules = (
966 ); 1035 );
@@ -1086,6 +1155,40 @@ @@ -1086,6 +1155,40 @@
1086 shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 1155 shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
1087 showEnvVarsInLog = 0; 1156 showEnvVarsInLog = 0;
1088 }; 1157 };
  1158 + 43270B0E3FD1AFD4E05616D0 /* [CP] Copy Pods Resources */ = {
  1159 + isa = PBXShellScriptBuildPhase;
  1160 + buildActionMask = 2147483647;
  1161 + files = (
  1162 + );
  1163 + inputFileListPaths = (
  1164 + "${PODS_ROOT}/Target Support Files/Pods-metaCode/Pods-metaCode-resources-${CONFIGURATION}-input-files.xcfilelist",
  1165 + );
  1166 + name = "[CP] Copy Pods Resources";
  1167 + outputFileListPaths = (
  1168 + "${PODS_ROOT}/Target Support Files/Pods-metaCode/Pods-metaCode-resources-${CONFIGURATION}-output-files.xcfilelist",
  1169 + );
  1170 + runOnlyForDeploymentPostprocessing = 0;
  1171 + shellPath = /bin/sh;
  1172 + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-metaCode/Pods-metaCode-resources.sh\"\n";
  1173 + showEnvVarsInLog = 0;
  1174 + };
  1175 + 51DB2DC03E9B32399B70EEC8 /* [CP] Copy Pods Resources */ = {
  1176 + isa = PBXShellScriptBuildPhase;
  1177 + buildActionMask = 2147483647;
  1178 + files = (
  1179 + );
  1180 + inputFileListPaths = (
  1181 + "${PODS_ROOT}/Target Support Files/Pods-metaCode-metaCodeUITests/Pods-metaCode-metaCodeUITests-resources-${CONFIGURATION}-input-files.xcfilelist",
  1182 + );
  1183 + name = "[CP] Copy Pods Resources";
  1184 + outputFileListPaths = (
  1185 + "${PODS_ROOT}/Target Support Files/Pods-metaCode-metaCodeUITests/Pods-metaCode-metaCodeUITests-resources-${CONFIGURATION}-output-files.xcfilelist",
  1186 + );
  1187 + runOnlyForDeploymentPostprocessing = 0;
  1188 + shellPath = /bin/sh;
  1189 + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-metaCode-metaCodeUITests/Pods-metaCode-metaCodeUITests-resources.sh\"\n";
  1190 + showEnvVarsInLog = 0;
  1191 + };
1089 53AB1F83C55845CC654163DE /* [CP] Check Pods Manifest.lock */ = { 1192 53AB1F83C55845CC654163DE /* [CP] Check Pods Manifest.lock */ = {
1090 isa = PBXShellScriptBuildPhase; 1193 isa = PBXShellScriptBuildPhase;
1091 buildActionMask = 2147483647; 1194 buildActionMask = 2147483647;
@@ -1163,6 +1266,7 @@ @@ -1163,6 +1266,7 @@
1163 79BB96A82AF223FB00AEA4AC /* CNLiveConfigAlertManager.swift in Sources */, 1266 79BB96A82AF223FB00AEA4AC /* CNLiveConfigAlertManager.swift in Sources */,
1164 19BB1FF02AF0E5B30094D962 /* CNLiveShopDetailModel.swift in Sources */, 1267 19BB1FF02AF0E5B30094D962 /* CNLiveShopDetailModel.swift in Sources */,
1165 796398942A260C0100D045EB /* AppDelegate.swift in Sources */, 1268 796398942A260C0100D045EB /* AppDelegate.swift in Sources */,
  1269 + 7939B0792B47FC33005AE981 /* CNLiveShortVideoCustomControlView.swift in Sources */,
1166 7989B5C72A4BDC7200A19B10 /* CNLiveMineEarnListViewController.swift in Sources */, 1270 7989B5C72A4BDC7200A19B10 /* CNLiveMineEarnListViewController.swift in Sources */,
1167 792B53282AFCD7640009AB49 /* CNLiveShopOrderExpressDetailViewController.swift in Sources */, 1271 792B53282AFCD7640009AB49 /* CNLiveShopOrderExpressDetailViewController.swift in Sources */,
1168 79396EF12A31C21B0053E1AF /* CNLiveInfoShowViewController.swift in Sources */, 1272 79396EF12A31C21B0053E1AF /* CNLiveInfoShowViewController.swift in Sources */,
@@ -1194,6 +1298,7 @@ @@ -1194,6 +1298,7 @@
1194 19CC4D4F2ADD0FC200308E2A /* CNUpSlideDetailScrollView.swift in Sources */, 1298 19CC4D4F2ADD0FC200308E2A /* CNUpSlideDetailScrollView.swift in Sources */,
1195 79EABB892AB4497700F3A4E2 /* CNLiveSaveStandDB.swift in Sources */, 1299 79EABB892AB4497700F3A4E2 /* CNLiveSaveStandDB.swift in Sources */,
1196 790B1FB62A41938F0074CF00 /* UIImage+CNLiveExtensions.swift in Sources */, 1300 790B1FB62A41938F0074CF00 /* UIImage+CNLiveExtensions.swift in Sources */,
  1301 + 7939B0732B47F12F005AE981 /* CNLiveShortVideoViewController.swift in Sources */,
1197 19BB1FEA2AEF7B4A0094D962 /* CNLiveShopConsoleCell.swift in Sources */, 1302 19BB1FEA2AEF7B4A0094D962 /* CNLiveShopConsoleCell.swift in Sources */,
1198 790D019D2A2DCBD000C5978D /* UIView+CNLiveExtensions.swift in Sources */, 1303 790D019D2A2DCBD000C5978D /* UIView+CNLiveExtensions.swift in Sources */,
1199 790B1FB62A41938F0074CF00 /* UIImage+CNLiveExtensions.swift in Sources */, 1304 790B1FB62A41938F0074CF00 /* UIImage+CNLiveExtensions.swift in Sources */,
@@ -1231,6 +1336,7 @@ @@ -1231,6 +1336,7 @@
1231 7CD6753E2A2740B0008354C1 /* CNUpSlideView.swift in Sources */, 1336 7CD6753E2A2740B0008354C1 /* CNUpSlideView.swift in Sources */,
1232 7CD675402A2740B0008354C1 /* CNDownSlideView.swift in Sources */, 1337 7CD675402A2740B0008354C1 /* CNDownSlideView.swift in Sources */,
1233 79B2E3602AF39191002A8524 /* NSObject+CNLiveConfigModuleInline.swift in Sources */, 1338 79B2E3602AF39191002A8524 /* NSObject+CNLiveConfigModuleInline.swift in Sources */,
  1339 + 79A212C02B0B5C5400BFA8E3 /* CNLiveShopCouponManagerViewController.swift in Sources */,
1234 7C2703362A3AFD3A0061EC50 /* CNLiveEnvironment.swift in Sources */, 1340 7C2703362A3AFD3A0061EC50 /* CNLiveEnvironment.swift in Sources */,
1235 798A44FD2A309EBA00815935 /* CNLiveTypeFeedBackViewController.swift in Sources */, 1341 798A44FD2A309EBA00815935 /* CNLiveTypeFeedBackViewController.swift in Sources */,
1236 79656E382AAEBA8E00119A61 /* CNLiveMineInputViewController.swift in Sources */, 1342 79656E382AAEBA8E00119A61 /* CNLiveMineInputViewController.swift in Sources */,
@@ -1247,10 +1353,14 @@ @@ -1247,10 +1353,14 @@
1247 79282A442A2F1C1E00B5F8CF /* CNLiveLoginAuthView.swift in Sources */, 1353 79282A442A2F1C1E00B5F8CF /* CNLiveLoginAuthView.swift in Sources */,
1248 79BB96A62AF21E2800AEA4AC /* CNLiveShopOrderDetailViewController.swift in Sources */, 1354 79BB96A62AF21E2800AEA4AC /* CNLiveShopOrderDetailViewController.swift in Sources */,
1249 7C2703302A36CBE30061EC50 /* CNCertificationView.swift in Sources */, 1355 7C2703302A36CBE30061EC50 /* CNCertificationView.swift in Sources */,
  1356 + 796308752B4B90700090D22A /* CNLiveShortVideoHomeModel.swift in Sources */,
1250 19CC4D542ADD163D00308E2A /* CNUpSlideCardPresentationController.swift in Sources */, 1357 19CC4D542ADD163D00308E2A /* CNUpSlideCardPresentationController.swift in Sources */,
1251 790D01A32A2DDBA300C5978D /* CNLiveConfigManager.swift in Sources */, 1358 790D01A32A2DDBA300C5978D /* CNLiveConfigManager.swift in Sources */,
  1359 + 7939B0752B47F1B9005AE981 /* CNLiveShortVideoListTableViewCell.swift in Sources */,
  1360 + 794294A72B4D18EC008AAFA0 /* CNLiveShortVideoContentListView.swift in Sources */,
1252 19565EC52AF8AD1F007D6727 /* CNLiveShopProductManagerController.swift in Sources */, 1361 19565EC52AF8AD1F007D6727 /* CNLiveShopProductManagerController.swift in Sources */,
1253 19CC4D492ADD06C500308E2A /* UITableView+Extension.swift in Sources */, 1362 19CC4D492ADD06C500308E2A /* UITableView+Extension.swift in Sources */,
  1363 + 796308732B4B8EB80090D22A /* CNLiveShortVideoViewModel.swift in Sources */,
1254 7C2703332A36CC660061EC50 /* CNLiveGlobalBlock.swift in Sources */, 1364 7C2703332A36CC660061EC50 /* CNLiveGlobalBlock.swift in Sources */,
1255 7987BF3D2A497644000A1ABC /* CNLiveMineQuestViewController.swift in Sources */, 1365 7987BF3D2A497644000A1ABC /* CNLiveMineQuestViewController.swift in Sources */,
1256 798A44EA2A30135D00815935 /* CNLiveMineBodyListView.swift in Sources */, 1366 798A44EA2A30135D00815935 /* CNLiveMineBodyListView.swift in Sources */,
@@ -1287,9 +1397,11 @@ @@ -1287,9 +1397,11 @@
1287 19565ECF2AF8D8F6007D6727 /* CNLiveShopGoodsListCell.swift in Sources */, 1397 19565ECF2AF8D8F6007D6727 /* CNLiveShopGoodsListCell.swift in Sources */,
1288 1965FA3E2AFB176E00F0F435 /* CNLiveShopAddGoodsSingleView.swift in Sources */, 1398 1965FA3E2AFB176E00F0F435 /* CNLiveShopAddGoodsSingleView.swift in Sources */,
1289 7CD6753C2A2740B0008354C1 /* CNUpSlideViewRemindView.swift in Sources */, 1399 7CD6753C2A2740B0008354C1 /* CNUpSlideViewRemindView.swift in Sources */,
  1400 + 7939B0772B47F88A005AE981 /* CNLiveShortVideoControlView.swift in Sources */,
1290 79BB1C142B05C51900C5720C /* CNLiveShopCouponViewController.swift in Sources */, 1401 79BB1C142B05C51900C5720C /* CNLiveShopCouponViewController.swift in Sources */,
1291 798916ED2B048E8200D08302 /* CNLiveShopTransViewController.swift in Sources */, 1402 798916ED2B048E8200D08302 /* CNLiveShopTransViewController.swift in Sources */,
1292 19BB1FEC2AF0AB8E0094D962 /* CNLiveDownShopDetailController.swift in Sources */, 1403 19BB1FEC2AF0AB8E0094D962 /* CNLiveDownShopDetailController.swift in Sources */,
  1404 + 79A212C22B0B5D0700BFA8E3 /* CNLiveShopBodyCouponManagerView.swift in Sources */,
1293 794FF1072B01FC9800385E85 /* CNLiveShopOrderSearchListViewController.swift in Sources */, 1405 794FF1072B01FC9800385E85 /* CNLiveShopOrderSearchListViewController.swift in Sources */,
1294 798A44E82A30134400815935 /* CNLiveMineHeaderView.swift in Sources */, 1406 798A44E82A30134400815935 /* CNLiveMineHeaderView.swift in Sources */,
1295 7C49312D2A2DB9FA000E44B4 /* UITabBar+CNLiveExtensions.swift in Sources */, 1407 7C49312D2A2DB9FA000E44B4 /* UITabBar+CNLiveExtensions.swift in Sources */,
metaCode/Classes/Environment/CNLiveEnvironment.swift
@@ -33,6 +33,8 @@ let APPBaseWjjBUrl: String = CNLiveEnvironmentManager.shared.base_wjj_b_url @@ -33,6 +33,8 @@ let APPBaseWjjBUrl: String = CNLiveEnvironmentManager.shared.base_wjj_b_url
33 let APPBaseWjjShopUrl: String = CNLiveEnvironmentManager.shared.base_mjj_shop_url 33 let APPBaseWjjShopUrl: String = CNLiveEnvironmentManager.shared.base_mjj_shop_url
34 /// cms接口 34 /// cms接口
35 let APPBaseCMSUrl: String = CNLiveEnvironmentManager.shared.base_cms_url 35 let APPBaseCMSUrl: String = CNLiveEnvironmentManager.shared.base_cms_url
  36 +/// cms_api接口
  37 +let APPBaseCMSClassUrl: String = CNLiveEnvironmentManager.shared.base_cms_class_url
36 ///当前APP的环境 38 ///当前APP的环境
37 let APPCurrentEnvironment: CNLiveEnvironment = CNLiveEnvironmentManager.shared.currentEnvironment 39 let APPCurrentEnvironment: CNLiveEnvironment = CNLiveEnvironmentManager.shared.currentEnvironment
38 40
@@ -82,6 +84,8 @@ class CNLiveEnvironmentManager: NSObject{ @@ -82,6 +84,8 @@ class CNLiveEnvironmentManager: NSObject{
82 var base_web_UA: String = "yuanma" 84 var base_web_UA: String = "yuanma"
83 /// cms域名请求 85 /// cms域名请求
84 var base_cms_url: String 86 var base_cms_url: String
  87 + /// UGC视频请求地址
  88 + var base_cms_class_url: String
85 89
86 ///当前环境 90 ///当前环境
87 var currentEnvironment: CNLiveEnvironment 91 var currentEnvironment: CNLiveEnvironment
@@ -102,6 +106,7 @@ class CNLiveEnvironmentManager: NSObject{ @@ -102,6 +106,7 @@ class CNLiveEnvironmentManager: NSObject{
102 self.base_wjj_b_url = "" 106 self.base_wjj_b_url = ""
103 self.base_mjj_shop_url = "" 107 self.base_mjj_shop_url = ""
104 self.base_cms_url = "" 108 self.base_cms_url = ""
  109 + self.base_cms_class_url = ""
105 self.currentEnvironment = .development 110 self.currentEnvironment = .development
106 } 111 }
107 //重新copy 和 mutableCopy 方法 112 //重新copy 和 mutableCopy 方法
@@ -144,6 +149,7 @@ class CNLiveEnvironmentManager: NSObject{ @@ -144,6 +149,7 @@ class CNLiveEnvironmentManager: NSObject{
144 self.base_wjj_url = "https://apiwjj.cnlive.com" 149 self.base_wjj_url = "https://apiwjj.cnlive.com"
145 self.base_mjj_shop_url = "https://manageshop.cnlive.com" 150 self.base_mjj_shop_url = "https://manageshop.cnlive.com"
146 self.base_cms_url = "https://cmsapi.cnlive.com" 151 self.base_cms_url = "https://cmsapi.cnlive.com"
  152 + self.base_cms_class_url = "https://cmstest.cnlive.com"
147 } 153 }
148 //testFlight 环境配置 154 //testFlight 环境配置
149 func testFlightEnvironment(){ 155 func testFlightEnvironment(){
@@ -161,6 +167,7 @@ class CNLiveEnvironmentManager: NSObject{ @@ -161,6 +167,7 @@ class CNLiveEnvironmentManager: NSObject{
161 self.base_wjj_url = "https://apiwjj.cnlive.com" 167 self.base_wjj_url = "https://apiwjj.cnlive.com"
162 self.base_mjj_shop_url = "https://manageshop.cnlive.com" 168 self.base_mjj_shop_url = "https://manageshop.cnlive.com"
163 self.base_cms_url = "https://cmsapi.cnlive.com" 169 self.base_cms_url = "https://cmsapi.cnlive.com"
  170 + self.base_cms_class_url = "https://cms.cnlive.com/api"
164 } 171 }
165 //production 生产环境配置 172 //production 生产环境配置
166 func productionEnvironment(){ 173 func productionEnvironment(){
@@ -178,6 +185,7 @@ class CNLiveEnvironmentManager: NSObject{ @@ -178,6 +185,7 @@ class CNLiveEnvironmentManager: NSObject{
178 self.base_wjj_url = "https://apiwjj.cnlive.com" 185 self.base_wjj_url = "https://apiwjj.cnlive.com"
179 self.base_mjj_shop_url = "https://manageshop.cnlive.com" 186 self.base_mjj_shop_url = "https://manageshop.cnlive.com"
180 self.base_cms_url = "https://cmsapi.cnlive.com" 187 self.base_cms_url = "https://cmsapi.cnlive.com"
  188 + self.base_cms_class_url = "https://cms.cnlive.com/api"
181 } 189 }
182 190
183 } 191 }
metaCode/Classes/Extensions/NSString+CNLiveExtensions.swift
@@ -74,7 +74,10 @@ extension NSString { @@ -74,7 +74,10 @@ extension NSString {
74 }else{ 74 }else{
75 format.dateFormat = dateFormat 75 format.dateFormat = dateFormat
76 } 76 }
77 - return format.date(from: self as String)! as NSDate 77 +
  78 + let date = format.date(from: self as String)!
  79 +
  80 + return date as NSDate
78 } 81 }
79 82
80 /// 保留2位小数 83 /// 保留2位小数
metaCode/Classes/Main/MinePage/Controller/CNLiveMineViewController.swift
@@ -45,11 +45,12 @@ class CNLiveMineViewController : CNLiveBaseViewController, UITableViewDelegate, @@ -45,11 +45,12 @@ class CNLiveMineViewController : CNLiveBaseViewController, UITableViewDelegate,
45 ["name":"更多设置","icon":"mine_list_icon_set_more"]] 45 ["name":"更多设置","icon":"mine_list_icon_set_more"]]
46 dataArray.add(array03) 46 dataArray.add(array03)
47 47
48 -// let array04 : [Dictionary] = [["name":"订单列表","icon":"mine_list_icon_help_feedback"],  
49 -// ["name":"交易记录","icon":"mine_list_icon_help_feedback"],  
50 -// ["name":"新增优惠券","icon":"mine_list_icon_help_feedback"],  
51 -// ["name":"优惠券管理","icon":"mine_list_icon_help_feedback"]]  
52 -// dataArray.add(array04) 48 + let array04 : [Dictionary] = [["name":"订单列表","icon":"mine_list_icon_help_feedback"],
  49 + ["name":"交易记录","icon":"mine_list_icon_help_feedback"],
  50 + ["name":"新增优惠券","icon":"mine_list_icon_help_feedback"],
  51 + ["name":"优惠券管理","icon":"mine_list_icon_help_feedback"],
  52 + ["name":"抖音短视频","icon":"mine_list_icon_help_feedback"]]
  53 + dataArray.add(array04)
53 54
54 return dataArray 55 return dataArray
55 }() 56 }()
@@ -188,6 +189,12 @@ extension CNLiveMineViewController { @@ -188,6 +189,12 @@ extension CNLiveMineViewController {
188 if indexPath.row == 2 { 189 if indexPath.row == 2 {
189 self.navigationController?.pushViewController(CNLiveShopCouponViewController.init(), animated: true) 190 self.navigationController?.pushViewController(CNLiveShopCouponViewController.init(), animated: true)
190 } 191 }
  192 + if indexPath.row == 3 {
  193 + self.navigationController?.pushViewController(CNLiveShopCouponManagerViewController.init(), animated: true)
  194 + }
  195 + if indexPath.row == 4 {
  196 + self.navigationController?.pushViewController(CNLiveShortVideoViewController.init(), animated: true)
  197 + }
191 } 198 }
192 199
193 } 200 }
metaCode/Classes/Main/ShopPage/Controller/CNLiveShopCouponManagerViewController.swift 0 → 100644
  1 +//
  2 +// CNLiveShopCouponManagerViewController.swift
  3 +// metaCode
  4 +//
  5 +// Created by open on 2023/11/20.
  6 +//
  7 +
  8 +import Foundation
  9 +import EmptyDataSet_Swift
  10 +
  11 +class CNLiveShopCouponManagerViewController: CNLiveBaseViewController, UITableViewDelegate, UITableViewDataSource, EmptyDataSetSource, EmptyDataSetDelegate {
  12 +
  13 + let kShopBodyCouponManagerTableViewIdentifier = "kShopBodyCouponManagerTableViewIdentifier"
  14 + lazy var tableView : UITableView = {
  15 + let tableView = UITableView(frame: .zero, style: .plain)
  16 + tableView.dataSource = self
  17 + tableView.delegate = self
  18 + tableView.emptyDataSetSource = self
  19 + tableView.emptyDataSetDelegate = self
  20 + tableView.backgroundColor = HexColor("#f1f2f6")
  21 + tableView.tableFooterView = UIView.init()
  22 + tableView.separatorStyle = .none
  23 + tableView.register(ShopBodyCouponManagerTableView.self, forCellReuseIdentifier: kShopBodyCouponManagerTableViewIdentifier)
  24 + return tableView
  25 + }()
  26 +
  27 + lazy var delectButton: UIButton = {
  28 + let delectButton = UIButton.init(type: .custom)
  29 + delectButton.frame = CGRect(x: KSreenWidth - 70, y: (get_system_nav_height() - (get_system_statusBar_height() + 25))/2 + get_system_statusBar_height(), width: 60, height: 25)
  30 + delectButton.setTitle("删除", for: .normal)
  31 + delectButton.titleLabel?.font = semibold_adapt_font(pointSize: 15)
  32 + delectButton.setTitleColor(HexColor("#F5A623"), for: .normal)
  33 + delectButton.backgroundColor = .clear
  34 + delectButton.layer.masksToBounds = true
  35 + delectButton.layer.cornerRadius = 5
  36 + delectButton.addTarget(self, action: #selector(delectBtnClick), for: .touchUpInside)
  37 + delectButton.tag = 1000
  38 + return delectButton
  39 + }()
  40 +
  41 + lazy var dataArray: NSMutableArray = {
  42 + let dataArray = NSMutableArray.init()
  43 + return dataArray
  44 + }()
  45 +
  46 +
  47 + var network_type: CNLiveMineResponseType!
  48 + var completerBlock: CNLiveShopOrderExpressFirmCompleterBlock!
  49 + override func viewDidLoad() {
  50 + super.viewDidLoad()
  51 + navigationBarHidden = false
  52 + titleName = "优惠券"
  53 + topNavView.addSubview(delectButton)
  54 +
  55 + loadDataSourceAction()
  56 +
  57 + view.addSubview(tableView)
  58 + tableView.snp.makeConstraints { make in
  59 + make.top.equalTo(KNavigationHeight)
  60 + make.left.right.equalToSuperview()
  61 + make.bottom.equalToSuperview().offset(get_system_tabbar_height() - get_system_tabbar_ui_height())
  62 + }
  63 + }
  64 +
  65 + func loadDataSourceAction() {
  66 + CNLiveShopViewModel.requestCouponList { [weak self] result, respStatue in
  67 + if respStatue == .success {
  68 + self!.dataArray.addObjects(from: (result as! NSMutableArray) as! [ShopOrderCouponListModel])
  69 + self!.tableView.reloadData()
  70 + }else if (respStatue == .noNetwork) {
  71 + self!.network_type = .noNetwork
  72 + self!.tableView.reloadEmptyDataSet()
  73 + } else {
  74 + self!.network_type = .failed
  75 + self!.tableView.reloadEmptyDataSet()
  76 + }
  77 + }
  78 + }
  79 +
  80 + @objc func delectBtnClick() {
  81 +
  82 + }
  83 +
  84 +}
  85 +extension CNLiveShopCouponManagerViewController {
  86 +
  87 + func numberOfSections(in tableView: UITableView) -> Int {
  88 + return 1
  89 + }
  90 + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
  91 + return self.dataArray.count
  92 + }
  93 + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
  94 + guard let cell = tableView.dequeueReusableCell(withIdentifier: kShopBodyCouponManagerTableViewIdentifier) as? ShopBodyCouponManagerTableView else {
  95 + return ShopBodyCouponManagerTableView()
  96 + }
  97 + cell.setupWithDataSource(listModel: dataArray[indexPath.row] as! ShopOrderCouponListModel)
  98 + return cell
  99 + }
  100 + func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
  101 + return adapt_length(length: 70)
  102 + }
  103 + func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
  104 +
  105 + }
  106 +}
  107 +
  108 +extension CNLiveShopCouponManagerViewController {
  109 +
  110 + func image(forEmptyDataSet scrollView: UIScrollView) -> UIImage? {
  111 + if network_type == .failed || network_type == .unkonw {
  112 + return UIImage(named: "mine_list_source_unusual_failed")
  113 + }
  114 + if dataArray.count == 0 {
  115 + return UIImage(named: "mine_list_source_unusual_empty")
  116 + }
  117 + if network_type == .noNetwork {
  118 + return UIImage(named: "mine_list_source_unusual_noNet")
  119 + }
  120 + return UIImage(named: "mine_list_source_unusual_empty")
  121 + }
  122 +
  123 + func title(forEmptyDataSet scrollView: UIScrollView) -> NSAttributedString? {
  124 + var defult_string = ""
  125 + if network_type == .failed || network_type == .unkonw {
  126 + defult_string = "接口请求错误,刷新试试~"
  127 + }
  128 + if network_type == .noNetwork {
  129 + defult_string = "网络开小差了,刷新试试~"
  130 + }
  131 + if dataArray.count == 0 {
  132 + defult_string = "暂时没有数据~"
  133 + }
  134 + return NSAttributedString(string: defult_string, attributes: [.font: Font_17,.foregroundColor: HexColor("#666666")!])
  135 + }
  136 +
  137 + func buttonTitle(forEmptyDataSet scrollView: UIScrollView, for state: UIControl.State) -> NSAttributedString? {
  138 + if network_type == .failed || network_type == .noNetwork {
  139 + let attributes = [NSAttributedString.Key.font:Font_16_Fit,
  140 + NSAttributedString.Key.foregroundColor: HexColor("#609BFF")]
  141 + return NSAttributedString(string: "刷一刷", attributes: attributes as [NSAttributedString.Key : Any])
  142 + }
  143 + return nil
  144 + }
  145 +
  146 + func emptyDataSet(_ scrollView: UIScrollView, didTapView view: UIView) {
  147 + if network_type == .failed || network_type == .noNetwork {
  148 + loadDataSourceAction()
  149 + }
  150 + }
  151 +}
metaCode/Classes/Main/ShopPage/View/CNLiveShopBodyCouponManagerView.swift 0 → 100644
  1 +//
  2 +// CNLiveShopBodyCouponManagerView.swift
  3 +// metaCode
  4 +//
  5 +// Created by open on 2023/11/20.
  6 +//
  7 +
  8 +import Foundation
  9 +
  10 +typealias clickCouponListActionCallBack = (_ index: NSInteger,_ listModel: ShopOrderCouponListModel) -> Void
  11 +typealias clickCouponListEditCallBack = (_ select: Bool,_ couponId: NSString) -> Void
  12 +class ShopBodyCouponManagerTableView: UITableViewCell {
  13 +
  14 + lazy var selectBtn: UIButton = {
  15 + let selectBtn = UIButton.init(type: .custom)
  16 + selectBtn.isHidden = true
  17 + selectBtn.setImage(UIImage(named: "DS_coupon_unSelect"), for: .normal)
  18 + selectBtn.setImage(UIImage(named: "DS_coupon_edit_se"), for: .selected)
  19 + selectBtn.addTarget(self, action: #selector(editBtnClick), for: .touchUpInside)
  20 + return selectBtn
  21 + }()
  22 +
  23 + lazy var bgWhiteView: UIView = {
  24 + let bgWhiteView = UIView.init()
  25 + bgWhiteView.backgroundColor = .white
  26 + bgWhiteView.layer.cornerRadius = adapt_length(length: 7)
  27 + bgWhiteView.clipsToBounds = true
  28 + return bgWhiteView
  29 + }()
  30 +
  31 + lazy var leftBgView: UIView = {
  32 + let leftBgView = UIView.init()
  33 + leftBgView.backgroundColor = HexColor("#fba2a2")
  34 + return leftBgView
  35 + }()
  36 +
  37 + lazy var lessMoneyLabel: UILabel = {
  38 + let lessMoneyLabel = UILabel.init()
  39 + lessMoneyLabel.textColor = .white
  40 + lessMoneyLabel.font = regular_adapt_font(pointSize: 38)
  41 + lessMoneyLabel.textAlignment = .center
  42 + return lessMoneyLabel
  43 + }()
  44 +
  45 + lazy var maxMoneyLabel: UILabel = {
  46 + let maxMoneyLabel = UILabel.init()
  47 + maxMoneyLabel.textColor = .white
  48 + maxMoneyLabel.font = regular_adapt_font(pointSize: 12.5)
  49 + maxMoneyLabel.textAlignment = .center
  50 + return maxMoneyLabel
  51 + }()
  52 +
  53 + lazy var titleLabel: UILabel = {
  54 + let titleLabel = UILabel.init()
  55 + titleLabel.textColor = HexColor("#444444")
  56 + titleLabel.font = medium_adapt_font(pointSize: 15)
  57 + titleLabel.textAlignment = .left
  58 + return titleLabel
  59 + }()
  60 +
  61 + lazy var idLabel: UILabel = {
  62 + let idLabel = UILabel.init()
  63 + idLabel.textColor = HexColor("#bebebe")
  64 + idLabel.font = regular_adapt_font(pointSize: 12)
  65 + idLabel.textAlignment = .left
  66 + return idLabel
  67 + }()
  68 +
  69 + lazy var typeLabel: UILabel = {
  70 + let typeLabel = UILabel.init()
  71 + typeLabel.textColor = HexColor("#999999")
  72 + typeLabel.font = regular_adapt_font(pointSize: 12)
  73 + typeLabel.textAlignment = .left
  74 + return typeLabel
  75 + }()
  76 +
  77 + lazy var totalLabel: UILabel = {
  78 + let totalLabel = UILabel.init()
  79 + totalLabel.textColor = HexColor("#bebebe")
  80 + totalLabel.font = regular_adapt_font(pointSize: 12)
  81 + totalLabel.textAlignment = .left
  82 + return totalLabel
  83 + }()
  84 +
  85 + lazy var lineView: UILabel = {
  86 + let lineView = UILabel.init()
  87 + lineView.backgroundColor = HexColor("#e6e6e6")
  88 + return totalLabel
  89 + }()
  90 +
  91 + lazy var showMessageLabel: UILabel = {
  92 + let showMessageLabel = UILabel.init()
  93 + showMessageLabel.textColor = HexColor("#999999")
  94 + showMessageLabel.text = "是否显示"
  95 + showMessageLabel.font = regular_adapt_font(pointSize: 12)
  96 + showMessageLabel.textAlignment = .left
  97 + return showMessageLabel
  98 + }()
  99 +
  100 + lazy var shareBtn: UIButton = {
  101 + let shareBtn = UIButton.init(type: .custom)
  102 + shareBtn.tag = 1001
  103 + shareBtn.setTitle("分享", for: .normal)
  104 + shareBtn.titleLabel?.font = regular_adapt_font(pointSize: 13)
  105 + shareBtn.setTitleColor(HexColor("#fd862e"), for: .normal)
  106 + shareBtn.addTarget(self, action: #selector(actionClick), for: .touchUpInside)
  107 + return shareBtn
  108 + }()
  109 +
  110 + lazy var editBtn: UIButton = {
  111 + let editBtn = UIButton.init(type: .custom)
  112 + editBtn.tag = 1002
  113 + editBtn.setTitle("编辑", for: .normal)
  114 + editBtn.titleLabel?.font = regular_adapt_font(pointSize: 13)
  115 + editBtn.setTitleColor(HexColor("#fd862e"), for: .normal)
  116 + editBtn.addTarget(self, action: #selector(actionClick), for: .touchUpInside)
  117 + return editBtn
  118 + }()
  119 +
  120 + lazy var showSwitch: UISwitch = {
  121 + let showSwitch = UISwitch.init()
  122 + showSwitch.addTarget(self, action: #selector(switchChangesd), for: .touchUpInside)
  123 + showSwitch.transform = CGAffineTransformMakeScale(0.7, 0.7)
  124 + return showSwitch
  125 + }()
  126 +
  127 + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
  128 + super.init(style: style, reuseIdentifier: reuseIdentifier)
  129 + contentView.backgroundColor = .clear
  130 + selectionStyle = .none
  131 + isUserInteractionEnabled = true
  132 +
  133 + addSubview(selectBtn)
  134 + selectBtn.snp.makeConstraints { make in
  135 + make.left.equalToSuperview().offset(adapt_length(length: 15))
  136 + make.centerY.equalToSuperview()
  137 + make.size.equalTo(adapt_length(length: 30))
  138 + }
  139 +
  140 + contentView.addSubview(bgWhiteView)
  141 + bgWhiteView.snp.makeConstraints { make in
  142 + make.left.equalTo(contentView).offset(adapt_length(length: 15))
  143 + make.right.equalToSuperview().offset(-adapt_length(length: 15))
  144 + make.top.bottom.equalToSuperview()
  145 + }
  146 +
  147 + bgWhiteView.addSubview(leftBgView)
  148 + leftBgView.snp.makeConstraints { make in
  149 + make.left.top.right.equalTo(bgWhiteView)
  150 + make.width.equalTo(adapt_length(length: 110))
  151 + }
  152 +
  153 + leftBgView.addSubview(lessMoneyLabel)
  154 + lessMoneyLabel.snp.makeConstraints { make in
  155 + make.top.equalTo(leftBgView).offset(adapt_length(length: 23))
  156 + make.left.right.equalTo(leftBgView)
  157 + }
  158 +
  159 + leftBgView.addSubview(maxMoneyLabel)
  160 + maxMoneyLabel.snp.makeConstraints { make in
  161 + make.top.equalTo(lessMoneyLabel.snp.bottom)
  162 + make.left.right.equalTo(leftBgView)
  163 + }
  164 +
  165 + bgWhiteView.addSubview(titleLabel)
  166 + titleLabel.snp.makeConstraints { make in
  167 + make.center.equalToSuperview()
  168 + }
  169 +
  170 + bgWhiteView.addSubview(idLabel)
  171 + idLabel.snp.makeConstraints { make in
  172 + make.right.equalTo(shareBtn.snp.left)
  173 + make.left.equalTo(titleLabel.snp.right).offset(adapt_length(length: 10))
  174 + make.centerY.equalTo(titleLabel)
  175 + }
  176 +
  177 + bgWhiteView.addSubview(typeLabel)
  178 + typeLabel.snp.makeConstraints { make in
  179 + make.left.equalTo(titleLabel)
  180 + make.top.equalTo(titleLabel.snp.bottom).offset(adapt_length(length: 5))
  181 + }
  182 +
  183 + bgWhiteView.addSubview(totalLabel)
  184 + totalLabel.snp.makeConstraints { make in
  185 + make.left.equalTo(titleLabel)
  186 + make.top.equalTo(typeLabel.snp.bottom).offset(adapt_length(length: 1))
  187 + make.right.equalTo(editBtn.snp.left)
  188 + }
  189 +
  190 + bgWhiteView.addSubview(lineView)
  191 + lineView.snp.makeConstraints { make in
  192 + make.left.equalTo(titleLabel)
  193 + make.top.equalTo(totalLabel.snp.bottom).offset(adapt_length(length: 10))
  194 + make.right.equalTo(bgWhiteView).offset(-adapt_length(length: 15))
  195 + make.height.equalTo(adapt_length(length: 0.5))
  196 + }
  197 +
  198 + bgWhiteView.addSubview(showMessageLabel)
  199 + showMessageLabel.snp.makeConstraints { make in
  200 + make.left.equalTo(titleLabel)
  201 + make.bottom.equalTo(bgWhiteView).offset(-adapt_length(length: 15))
  202 + }
  203 +
  204 + bgWhiteView.addSubview(shareBtn)
  205 + shareBtn.snp.makeConstraints { make in
  206 + make.right.equalTo(lineView)
  207 + make.centerY.equalTo(titleLabel)
  208 + make.width.equalTo(adapt_length(length: 30))
  209 + make.height.equalTo(adapt_length(length: 18.5))
  210 + }
  211 +
  212 + bgWhiteView.addSubview(editBtn)
  213 + editBtn.snp.makeConstraints { make in
  214 + make.right.equalTo(lineView)
  215 + make.centerY.equalTo(totalLabel)
  216 + make.width.equalTo(adapt_length(length: 45))
  217 + make.height.equalTo(adapt_length(length: 18.5))
  218 + }
  219 +
  220 + bgWhiteView.addSubview(showSwitch)
  221 + showSwitch.snp.makeConstraints { make in
  222 + make.centerY.equalTo(showMessageLabel)
  223 + make.right.equalTo(lineView)
  224 + }
  225 + }
  226 +
  227 + override func setEditing(_ editing: Bool, animated: Bool) {
  228 + if editing {
  229 + selectBtn.isHidden = false
  230 + bgWhiteView.snp.remakeConstraints { make in
  231 + make.left.equalTo(contentView).offset(adapt_length(length: 55))
  232 + }
  233 + } else {
  234 + selectBtn.isSelected = false
  235 + selectBtn.isHidden = true
  236 + bgWhiteView.snp.makeConstraints { make in
  237 + make.left.equalTo(contentView).offset(adapt_length(length: 15))
  238 + }
  239 + }
  240 + }
  241 +
  242 + var _listModel: ShopOrderCouponListModel!
  243 + func setupWithDataSource(listModel: ShopOrderCouponListModel) {
  244 + _listModel = listModel
  245 + }
  246 +
  247 + func dealDiscountAndFilledNumber(count: NSInteger) -> NSString {
  248 + var afterCount: NSString = ""
  249 + if (count >= 0 && count < 10000) {
  250 + afterCount = "\(count)" as NSString
  251 + } else if (count > 10000 && count < 10000000) {
  252 + if (count%10000 != 0) {
  253 + afterCount = "\(count/10000)万" as NSString
  254 + } else {
  255 +
  256 + }
  257 + }
  258 + return afterCount
  259 + }
  260 +
  261 + @objc func switchChangesd(sender: UISwitch) {
  262 +
  263 + }
  264 +
  265 + var actionCallBack: clickCouponListActionCallBack!
  266 + @objc func actionClick(sender: UISwitch) {
  267 + if (actionCallBack != nil) {
  268 + actionCallBack(sender.tag - 1001, _listModel)
  269 + }
  270 + }
  271 +
  272 + var editCallBack: clickCouponListEditCallBack!
  273 + @objc func editBtnClick(sender: UIButton) {
  274 + sender.isSelected = !sender.isSelected
  275 + if (editCallBack != nil) {
  276 + editCallBack(sender.isSelected, _listModel.id! as NSString)
  277 + }
  278 + }
  279 +
  280 + required init?(coder: NSCoder) {
  281 + fatalError("init(coder:) has not been implemented")
  282 + }
  283 +}
metaCode/Classes/Main/ShopPage/ViewModel/CNLiveShopViewModel.swift
@@ -943,6 +943,44 @@ class CNLiveShopViewModel: NSObject { @@ -943,6 +943,44 @@ class CNLiveShopViewModel: NSObject {
943 } 943 }
944 } 944 }
945 945
946 - 946 + /// 获取优惠券列表数据
  947 + /// - Parameter resultBlock: 返回
  948 + static func requestCouponList(resultBlock: @escaping resultShopBlock) {
  949 + let param = NSMutableDictionary()
  950 + param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "uid")
  951 + let custom_param = NSMutableDictionary()
  952 + custom_param.setValue(APPId_wjj, forKey: "appId")
  953 + custom_param.setValue(APPKey_wjj, forKey: "appKey")
  954 + CNLiveNetworking.setAllowRequestDefaultArgument(true)
  955 + CNLiveNetworking.setupShowDataResult(false)
  956 + CNLiveNetworking.setupDSRequest(true)
  957 + CNLiveNetworking.setupCustomParam(custom_param as? [String : String])
  958 + CNLiveNetworking.requestNetwork(with: .GET, urlString: APPBaseWjjBUrl+"/api/v1/shopCouponList", param: param as! [String : String], cacheType: .networkOnly) { task, result, error in
  959 + hiddenLoading()
  960 + if (error == nil) {
  961 + let resp = result as! NSDictionary
  962 + let errorCode = "\(resp["code"] ?? "0")"
  963 + if (errorCode == "200") {
  964 + if resp["data"] is NSNull {
  965 + resultBlock(Array<ShopOrderCouponListModel>(),.failed)
  966 + } else {
  967 + let model = dictionaryToModel(resp as! [String : Any], ShopOrderCouponDataListModel.self,"data") as! ShopOrderCouponDataListModel
  968 + resultBlock(model.list,.success)
  969 + }
  970 + } else {
  971 + showMessage(message: resp["message"] as! String)
  972 + resultBlock(NSNull(),.failed)
  973 + }
  974 + } else {
  975 + if CNLiveNetworking.isNetworking() {
  976 + showMessage(message: "请求失败")
  977 + resultBlock(NSNull(),.failed)
  978 + } else {
  979 + showMessage(message: "似乎与网络断开链接")
  980 + resultBlock(NSNull(),.noNetwork)
  981 + }
  982 + }
  983 + }
  984 + }
947 985
948 } 986 }
metaCode/Classes/Main/VideoPage/Controller/CNLiveShortVideoViewController.swift 0 → 100644
  1 +//
  2 +// CNLiveVideoViewController.swift
  3 +// metaCode
  4 +//
  5 +// Created by open on 2024/1/5.
  6 +//
  7 +
  8 +import Foundation
  9 +import ZFPlayer
  10 +import APButton
  11 +class CNLiveShortVideoViewController : CNLiveBaseViewController, UITableViewDelegate, UITableViewDataSource, CNLiveShortVideoListTableViewCellDelegate {
  12 +
  13 + var player: ZFPlayerController!
  14 + let kVideoBodyListViewCellIdentifier = "kVideoBodyListViewCellIdentifier"
  15 + lazy var tableView : UITableView = {
  16 + let tableView = UITableView(frame: .zero, style: .plain)
  17 + tableView.dataSource = self
  18 + tableView.delegate = self
  19 + tableView.isPagingEnabled = true
  20 + tableView.estimatedRowHeight = 0
  21 + tableView.estimatedSectionFooterHeight = 0
  22 + tableView.estimatedSectionHeaderHeight = 0
  23 + tableView.frame = view.bounds
  24 + tableView.rowHeight = tableView.frame.size.height
  25 + tableView.backgroundColor = .black
  26 + tableView.tableFooterView = UIView.init()
  27 + tableView.separatorStyle = .none
  28 + tableView.scrollsToTop = false
  29 + tableView.contentInsetAdjustmentBehavior = .never;
  30 + tableView.register(CNLiveShortVideoListTableViewCell.self, forCellReuseIdentifier: kVideoBodyListViewCellIdentifier)
  31 + return tableView
  32 + }()
  33 +
  34 + lazy var backBtn: UIButton = {
  35 + let button = UIButton(type: .custom)
  36 + button.setImage(UIImage(named: "short_video_close"), for: .normal)
  37 + button.addTarget(self, action: #selector(backClick(_:)), for: .touchUpInside)
  38 + return button
  39 + }()
  40 +
  41 + lazy var controlView: CNLiveShortVideoControlView = {
  42 + let controlView = CNLiveShortVideoControlView.init(frame: CGRectZero)
  43 + return controlView
  44 + }()
  45 +
  46 + lazy var dataArray: NSMutableArray = {
  47 + let dataArray = NSMutableArray.init()
  48 + return dataArray
  49 + }()
  50 + lazy var dataURLArray: NSMutableArray = {
  51 + let dataArray = NSMutableArray.init()
  52 + return dataArray
  53 + }()
  54 +
  55 + var playerManager = ZFIJKPlayerManager.init()
  56 +// var playerManager = ZFAVPlayerManager.init()
  57 +
  58 + override func viewDidLoad() {
  59 + super.viewDidLoad()
  60 + view.backgroundColor = .black
  61 + view.addSubview(tableView)
  62 + view.addSubview(backBtn)
  63 + requestData()
  64 +
  65 + player = ZFPlayerController(scrollView: tableView, playerManager: playerManager, containerViewTag: 100)
  66 + player.disableGestureTypes = [.pan, .pinch]
  67 + player.controlView = controlView
  68 + player.allowOrentitaionRotation = false
  69 + player.isWWANAutoPlay = true
  70 + player.playerDisapperaPercent = 1.0
  71 + player.playerDidToEnd = { [weak self] asset in
  72 + guard let self = self else { return }
  73 + self.player.currentPlayerManager.replay()
  74 + }
  75 + player.playerPrepareToPlay = {[weak self] asset, assetURL in
  76 + guard let self = self else { return }
  77 + let index = self.dataURLArray.index(of: assetURL.absoluteString)
  78 + let homeModel = self.dataArray[index] as! ShortVideoHomeTestModel
  79 + if (homeModel.isMoney!) {
  80 + let indexPath = IndexPath(row: index, section: 0)
  81 + let cell: CNLiveShortVideoListTableViewCell = self.tableView.cellForRow(at: indexPath) as! CNLiveShortVideoListTableViewCell
  82 + cell.hiddenView(isHidden: true)
  83 + self.player.stopCurrentPlayingCell()
  84 + } else {
  85 + let indexPath = IndexPath(row: index, section: 0)
  86 + let cell: CNLiveShortVideoListTableViewCell = self.tableView.cellForRow(at: indexPath) as! CNLiveShortVideoListTableViewCell
  87 + cell.hiddenView(isHidden: false)
  88 + }
  89 + }
  90 + // 更新另一个控制层的时间
  91 + player.playerPlayTimeChanged = { [weak self] asset, currentTime, duration in
  92 + guard let self = self else { return }
  93 + self.controlView.videoPlayer((self.player)!, currentTime: currentTime, totalTime: duration)
  94 + }
  95 + // 更新另一个控制层的缓冲时间
  96 + player.playerBufferTimeChanged = { [weak self] asset, bufferTime in
  97 + guard let self = self else { return }
  98 + self.controlView.videoPlayer((self.player)!, bufferTime: bufferTime)
  99 + }
  100 + // 停止的时候找出最合适的播放
  101 + player.zf_scrollViewDidEndScrollingCallback = { [weak self] indexPath in
  102 + guard let self = self else { return }
  103 + if self.player.playingIndexPath != nil {
  104 + return
  105 + }
  106 + if indexPath.row == (self.dataArray.count) - 1 {
  107 + // 加载下一页数据
  108 + self.requestData()
  109 + self.tableView.reloadData()
  110 + }
  111 + self.playVideo(at: indexPath)
  112 + }
  113 + }
  114 +
  115 + override func viewWillLayoutSubviews() {
  116 + super.viewWillLayoutSubviews()
  117 + self.backBtn.frame = CGRectMake(15, CGRectGetMaxY(UIApplication.shared.statusBarFrame), 45, 45)
  118 + }
  119 +
  120 + func loadRequest() {
  121 + dataArray.removeAllObjects()
  122 + DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) { [weak self] in
  123 + guard let strongSelf = self else { return }
  124 + // 下拉时一定要停止当前播放,以防有新数据,播放位置会错位
  125 + strongSelf.player.stopCurrentPlayingCell()
  126 + strongSelf.requestData()
  127 + strongSelf.tableView.reloadData()
  128 + strongSelf.player.zf_filterShouldPlayCellWhileScrolled { [weak self] indexPath in
  129 + guard let strongSelf = self else { return }
  130 + strongSelf.playVideo(at: indexPath)
  131 + }
  132 + }
  133 + }
  134 +
  135 + func requestData() {
  136 + CNLiveShortVideoViewModel.requstWithShortVideo { [weak self] result, respStatue in
  137 + guard let self = self else { return }
  138 + self.dataArray.addObjects(from: (result as! [Any]).first as! [Any])
  139 + self.dataURLArray.addObjects(from: (result as! [Any]).last as! [Any])
  140 + self.tableView.reloadData()
  141 + self.playTheIndex(index: 0)
  142 + }
  143 + }
  144 +
  145 + open func playTheIndex(index: NSInteger) {
  146 + // 指定到某一行播放
  147 + let indexPath = IndexPath(row: index, section: 0)
  148 + tableView.scrollToRow(at: indexPath, at: .none, animated: false)
  149 +
  150 + // 使用zf_filterShouldPlayCellWhileScrolled过滤播放
  151 + self.player.zf_filterShouldPlayCellWhileScrolled { [weak self] indexPath in
  152 + guard let self = self else { return }
  153 + self.playVideo(at: indexPath)
  154 + }
  155 + // 如果是最后一行,去请求新数据
  156 + if index == dataArray.count - 1 {
  157 + // 加载下一页数据
  158 + requestData()
  159 + tableView.reloadData()
  160 + }
  161 + }
  162 +
  163 + override var shouldAutorotate: Bool {
  164 + return false
  165 + }
  166 +
  167 + override var preferredStatusBarStyle: UIStatusBarStyle {
  168 + return .lightContent
  169 + }
  170 +
  171 + override var prefersStatusBarHidden: Bool {
  172 + return false
  173 + }
  174 +
  175 + override var supportedInterfaceOrientations: UIInterfaceOrientationMask {
  176 + return .portrait
  177 + }
  178 +
  179 + @objc func backClick(_ sender: UIButton) {
  180 + self.navigationController?.popViewController(animated: true)
  181 + }
  182 +
  183 + func playVideo(at indexPath: IndexPath) {
  184 + let data: ShortVideoHomeTestModel = dataArray[indexPath.row] as! ShortVideoHomeTestModel
  185 + self.player.playTheIndexPath(indexPath, assetURL: URL(string: data.videoUrl!)!)
  186 + controlView.resetControlView()
  187 + controlView.showCoverView(withUrl: data.poster!)
  188 + }
  189 +
  190 + deinit {
  191 + tableView.delegate = nil
  192 + tableView.dataSource = nil
  193 + controlView.removeFromSuperview()
  194 + player.stopCurrentPlayingCell()
  195 + if (playerManager.player != nil) {
  196 + playerManager.player.stop()
  197 + }
  198 + print("销毁了")
  199 + }
  200 +}
  201 +extension CNLiveShortVideoViewController {
  202 +
  203 + func likeActionMethod(viewcell: CNLiveShortVideoListTableViewCell, button: UIButton) {
  204 + button.isSelected = !button.isSelected
  205 + }
  206 + func commentActionMethod(viewcell: CNLiveShortVideoListTableViewCell, button: UIButton) {
  207 +
  208 + }
  209 + func shareActionMethod(viewcell: CNLiveShortVideoListTableViewCell, button: UIButton) {
  210 +
  211 + }
  212 + func iconActionMethod(viewcell: CNLiveShortVideoListTableViewCell, button: UIButton) {
  213 +
  214 + }
  215 + func faviActionMethod(viewcell: CNLiveShortVideoListTableViewCell, button: UIButton) {
  216 +
  217 + }
  218 + func listActionMethod(viewcell: CNLiveShortVideoListTableViewCell, button: UIButton) {
  219 + CNLiveShortVideoContentListView.showVideoContentListView(result: { videoId in
  220 +
  221 + })
  222 + }
  223 + func payActionMethod(viewcell: CNLiveShortVideoListTableViewCell, button: UIButton) {
  224 + let payButton = button as! APButton
  225 + payButton.startAnimating()
  226 + DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) { [weak self] in
  227 + guard let self = self else { return }
  228 + payButton.stopAnimating()
  229 + for item in self.dataArray {
  230 + let homeModel = item as! ShortVideoHomeTestModel
  231 + homeModel.isMoney = false
  232 + self.tableView.reloadData()
  233 + }
  234 + let index = self.dataArray.index(of: viewcell.homeModel as Any)
  235 + self.playTheIndex(index: index)
  236 + }
  237 +
  238 + }
  239 +}
  240 +
  241 +extension CNLiveShortVideoViewController {
  242 +
  243 + func numberOfSections(in tableView: UITableView) -> Int {
  244 + return 1
  245 + }
  246 +
  247 + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
  248 + return dataArray.count
  249 + }
  250 +
  251 + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
  252 + guard let cell = tableView.dequeueReusableCell(withIdentifier: kVideoBodyListViewCellIdentifier) as? CNLiveShortVideoListTableViewCell else {
  253 + return CNLiveShortVideoListTableViewCell()
  254 + }
  255 + cell.setupWithData(model: dataArray[indexPath.row] as! ShortVideoHomeTestModel)
  256 + cell.delegate = self
  257 + return cell
  258 + }
  259 +
  260 + func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
  261 + self.playVideo(at: indexPath)
  262 + }
  263 +
  264 + func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
  265 + scrollView.zf_scrollViewDidEndDecelerating()
  266 + }
  267 +
  268 + func scrollViewDidEndDragging(_ scrollView: UIScrollView, willDecelerate decelerate: Bool) {
  269 + scrollView.zf_scrollViewDidEndDraggingWillDecelerate(decelerate)
  270 + }
  271 +
  272 + func scrollViewDidScrollToTop(_ scrollView: UIScrollView) {
  273 + scrollView.zf_scrollViewDidScrollToTop()
  274 + }
  275 +
  276 + func scrollViewDidScroll(_ scrollView: UIScrollView) {
  277 + scrollView.zf_scrollViewDidScroll()
  278 + }
  279 +
  280 + func scrollViewWillBeginDragging(_ scrollView: UIScrollView) {
  281 + scrollView.zf_scrollViewWillBeginDragging()
  282 + }
  283 +
  284 + func zf_playTheVideo(at indexPath: IndexPath) {
  285 + self.playVideo(at: indexPath)
  286 + }
  287 +}
metaCode/Classes/Main/VideoPage/Model/CNLiveShortVideoHomeModel.swift 0 → 100644
  1 +//
  2 +// CNLiveShortVideoHomeModel.swift
  3 +// metaCode
  4 +//
  5 +// Created by open on 2024/1/8.
  6 +//
  7 +
  8 +import Foundation
  9 +
  10 +class ShortVideoHomeTestModel: BaseModel {
  11 + var activityEndTime: String? = ""
  12 + var address: String? = ""
  13 + var colours: String? = ""
  14 + var contentId: String? = ""
  15 + var coordinate: String? = ""
  16 + var duration: String? = ""
  17 + var h5Url: String? = ""
  18 + var shortTitle: String? = ""
  19 + var height: Int? = 0
  20 + var isMoney: Bool? = false
  21 + var identity: Int? = 0
  22 + var isHorizontalScreen: Int? = 0
  23 + var model: String? = ""
  24 + var number: String? = ""
  25 + var pid: String? = ""
  26 + var poster: String? = ""
  27 + var productId: String? = ""
  28 + var productType: String? = ""
  29 + var shareUrl: String? = ""
  30 + var source: Int? = 0
  31 + var sourceDescribe: String? = ""
  32 + var sourceName: String? = ""
  33 + var subTitle: String? = ""
  34 + var supervision: String? = ""
  35 + var tagId: String? = ""
  36 + var tagName: String? = ""
  37 + var thirdUrl: String? = ""
  38 + var time: Int? = 0
  39 + var timeString: String? = ""
  40 + var title: String? = ""
  41 + var videoType: Int? = 0
  42 + var videoUrl: String? = ""
  43 + var width: Int? = 0
  44 + var showStatue: Int? = 0
  45 + var witnessId: String? = ""
  46 + var statue: String? = ""
  47 + var pids: [String]? = []
  48 + var icon = ShortVideoHomeTestIconModel()
  49 +}
  50 +
  51 +class ShortVideoHomeTestIconModel: BaseModel {
  52 + var face: String? = ""
  53 + var focused: Bool? = false
  54 + var idField: String? = ""
  55 + var name: String? = ""
  56 + var type: String? = ""
  57 +}
metaCode/Classes/Main/VideoPage/View/CNLiveShortVideoContentListView.swift 0 → 100644
  1 +//
  2 +// CNLiveShortVideoContentListView.swift
  3 +// metaCode
  4 +//
  5 +// Created by open on 2024/1/9.
  6 +//
  7 +
  8 +import Foundation
  9 +
  10 +typealias CloseVideoListResultBlock = (_ videoId: Any) ->Void
  11 +class CNLiveShortVideoContentListView: UIView, UITableViewDelegate, UITableViewDataSource {
  12 +
  13 + lazy var closeButton: UIButton = {
  14 + let button = UIButton(type: .custom)
  15 + button.setImage(UIImage(named: "short_video_close"), for: .normal)
  16 + button.backgroundColor = .clear
  17 + button.addTarget(self, action: #selector(closeMethod), for: .touchUpInside)
  18 + return button
  19 + }()
  20 +
  21 + lazy var titleLabel: UILabel = {
  22 + let label = UILabel()
  23 + label.textColor = UIColor.white
  24 + label.font = semibold_adapt_font(pointSize: 19)
  25 + label.textAlignment = .left
  26 + label.numberOfLines = 1
  27 + label.lineBreakMode = .byTruncatingTail
  28 + label.text = "爱得供养"
  29 + return label
  30 + }()
  31 +
  32 + lazy var lineLabel: UILabel = {
  33 + let lineLabel = UILabel.init()
  34 + lineLabel.backgroundColor = HexColor("#686868")
  35 + return lineLabel
  36 + }()
  37 +
  38 + let kVideoContentListViewCellIdentifier = "kVideoContentListViewCellIdentifier"
  39 + lazy var tableView : UITableView = {
  40 + let tableView = UITableView(frame: .zero, style: .plain)
  41 + tableView.dataSource = self
  42 + tableView.delegate = self
  43 + tableView.rowHeight = 90
  44 + tableView.estimatedRowHeight = 0
  45 + tableView.estimatedSectionFooterHeight = 0
  46 + tableView.estimatedSectionHeaderHeight = 0
  47 + tableView.backgroundColor = HexColor("#010101")
  48 + tableView.tableFooterView = UIView.init()
  49 + tableView.separatorStyle = .none
  50 + tableView.scrollsToTop = false
  51 + tableView.contentInset = UIEdgeInsets(top: 0, left: 0, bottom: get_system_tabbar_ui_offsetHeight(), right: 0)
  52 + tableView.contentInsetAdjustmentBehavior = .never;
  53 + tableView.register(CNLiveShortVideoContentListTableViewCell.self, forCellReuseIdentifier: kVideoContentListViewCellIdentifier)
  54 + return tableView
  55 + }()
  56 +
  57 + override init(frame: CGRect) {
  58 + super.init(frame: frame)
  59 +
  60 + addSubview(closeButton)
  61 + closeButton.snp.makeConstraints { make in
  62 + make.right.equalToSuperview().offset(-15)
  63 + make.top.equalToSuperview().offset(15)
  64 + make.size.equalTo(30)
  65 + }
  66 + addSubview(titleLabel)
  67 + titleLabel.snp.makeConstraints { make in
  68 + make.top.left.equalToSuperview().offset(20)
  69 + make.right.equalTo(closeButton.snp.left).offset(-10)
  70 + }
  71 + addSubview(lineLabel)
  72 + lineLabel.snp.makeConstraints { make in
  73 + make.top.equalTo(closeButton.snp.bottom).offset(15)
  74 + make.centerX.equalToSuperview()
  75 + make.left.equalToSuperview().offset(10)
  76 + make.right.equalToSuperview().offset(-10)
  77 + make.height.equalTo(1)
  78 + }
  79 + addSubview(tableView)
  80 + tableView.snp.makeConstraints { make in
  81 + make.bottom.left.right.equalToSuperview()
  82 + make.top.equalTo(lineLabel.snp.bottom).offset(10)
  83 + }
  84 + }
  85 +
  86 + required init?(coder: NSCoder) {
  87 + fatalError("init(coder:) has not been implemented")
  88 + }
  89 +
  90 +
  91 + @objc func closeMethod() {
  92 + removeFromSuperview()
  93 + }
  94 +
  95 + static public func showVideoContentListView(result: @escaping CloseVideoListResultBlock) {
  96 +
  97 + let pickerView = CNLiveShortVideoContentListView.init(frame: CGRect.zero)
  98 + pickerView.backgroundColor = HexColor("#010101")
  99 +
  100 + let delegate = UIApplication.shared.delegate as! AppDelegate
  101 + delegate.window?.addSubview(pickerView)
  102 + pickerView.snp.makeConstraints { make in
  103 + make.top.equalTo(250)
  104 + make.right.left.bottom.equalToSuperview()
  105 + }
  106 + delegate.window?.layoutIfNeeded()
  107 + pickerView.alpha = 0
  108 + UIView.animate(withDuration: 0.1) {
  109 + pickerView.alpha = 1
  110 + } completion: { _ in}
  111 + }
  112 +
  113 +}
  114 +
  115 +extension CNLiveShortVideoContentListView {
  116 + func numberOfSections(in tableView: UITableView) -> Int {
  117 + return 1
  118 + }
  119 + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
  120 + return 20
  121 + }
  122 + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
  123 + guard let cell = tableView.dequeueReusableCell(withIdentifier: kVideoContentListViewCellIdentifier) as? CNLiveShortVideoContentListTableViewCell else {
  124 + return CNLiveShortVideoContentListTableViewCell()
  125 + }
  126 + return cell
  127 + }
  128 +
  129 +}
  130 +
  131 +class CNLiveShortVideoContentListTableViewCell: UITableViewCell {
  132 +
  133 + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
  134 + super.init(style: style, reuseIdentifier: reuseIdentifier)
  135 + contentView.backgroundColor = .clear
  136 + backgroundColor = .clear
  137 + selectionStyle = .none
  138 +
  139 + let imageView = UIImageView.init()
  140 + imageView.image = UIImage(named: "mine_auth_result_header_failer")
  141 + imageView.contentMode = .scaleAspectFill
  142 + imageView.layer.cornerRadius = 5
  143 + imageView.layer.masksToBounds = true
  144 + imageView.clipsToBounds = true
  145 + contentView.addSubview(imageView)
  146 + imageView.snp.makeConstraints { make in
  147 + make.left.top.equalToSuperview().offset(20)
  148 + make.width.equalTo(50)
  149 + make.height.equalTo(70)
  150 + }
  151 +
  152 + let paragraphStyle = NSMutableParagraphStyle()
  153 + paragraphStyle.lineSpacing = 6
  154 + let titleLabel = UILabel.init()
  155 + titleLabel.attributedText = NSAttributedString(string: "第四集 我们都不知道,所做的哪一个选择会让命运的齿轮开始转动", attributes: [NSAttributedString.Key.paragraphStyle: paragraphStyle])
  156 + titleLabel.textColor = .white
  157 + titleLabel.lineBreakMode = .byTruncatingTail
  158 + titleLabel.numberOfLines = 2
  159 + titleLabel.font = medium_adapt_font(pointSize: 12)
  160 + contentView.addSubview(titleLabel)
  161 + titleLabel.snp.makeConstraints { make in
  162 + make.left.equalTo(imageView.snp.right).offset(10)
  163 + make.top.equalToSuperview().offset(20)
  164 + make.right.equalToSuperview().offset(-20)
  165 + }
  166 +
  167 + let timeLabel = UILabel.init()
  168 + timeLabel.text = "04:45"
  169 + timeLabel.textColor = .white
  170 + timeLabel.font = light_adapt_font(pointSize: 13)
  171 + contentView.addSubview(timeLabel)
  172 + timeLabel.snp.makeConstraints { make in
  173 + make.left.equalTo(imageView.snp.right).offset(10)
  174 + make.bottom.equalTo(imageView.snp.bottom)
  175 + make.right.equalToSuperview().offset(-20)
  176 + }
  177 + }
  178 +
  179 + required init?(coder: NSCoder) {
  180 + fatalError("init(coder:) has not been implemented")
  181 + }
  182 +}
metaCode/Classes/Main/VideoPage/View/CNLiveShortVideoControlView.swift 0 → 100644
  1 +//
  2 +// CNLiveShortVideoControlView.swift
  3 +// metaCode
  4 +//
  5 +// Created by open on 2024/1/5.
  6 +//
  7 +
  8 +import Foundation
  9 +import ZFPlayer
  10 +import Kingfisher
  11 +class CNLiveShortVideoControlView: UIView, ZFPlayerMediaControl {
  12 +
  13 + weak var player: ZFPlayerController?
  14 +
  15 + lazy var playBtn: UIButton = {
  16 + let button = UIButton(type: .custom)
  17 + button.isUserInteractionEnabled = false
  18 + button.setImage(UIImage(named: "short_video_play"), for: .normal)
  19 + return button
  20 + }()
  21 +
  22 + lazy var sliderView: ZFSliderView = {
  23 + let sliderView = ZFSliderView()
  24 + sliderView.maximumTrackTintColor = UIColor(red: 1, green: 1, blue: 1, alpha: 0.2)
  25 + sliderView.minimumTrackTintColor = UIColor.white
  26 + sliderView.bufferTrackTintColor = UIColor.lightGray
  27 + sliderView.sliderHeight = 1
  28 + sliderView.isHideSliderBlock = false
  29 + return sliderView
  30 + }()
  31 +
  32 +
  33 + override init(frame: CGRect) {
  34 + super.init(frame: frame)
  35 + addSubview(playBtn)
  36 + addSubview(sliderView)
  37 + }
  38 +
  39 + deinit {
  40 + print("控制界面销毁了")
  41 + }
  42 +
  43 + override func layoutSubviews() {
  44 + super.layoutSubviews()
  45 + var min_x: CGFloat = 0
  46 + var min_y: CGFloat = 0
  47 + var min_w: CGFloat = 0
  48 + var min_h: CGFloat = 0
  49 + let min_view_w = self.zf_width
  50 + let min_view_h = self.zf_height
  51 +
  52 + min_w = 100
  53 + min_h = 100
  54 + self.playBtn.frame = CGRect(x: min_x, y: min_y, width: min_w, height: min_h)
  55 + self.playBtn.center = self.center
  56 +
  57 + min_x = 20
  58 + min_y = min_view_h - (60 + get_system_tabbar_ui_offsetHeight())
  59 + min_w = min_view_w - 40
  60 + min_h = 1
  61 + self.sliderView.frame = CGRect(x: min_x, y: min_y, width: min_w, height: min_h)
  62 + }
  63 +
  64 + public func resetControlView() {
  65 + self.playBtn.isHidden = true
  66 + self.sliderView.value = 0
  67 + self.sliderView.bufferValue = 0
  68 + }
  69 +
  70 + required init?(coder: NSCoder) {
  71 + fatalError("init(coder:) has not been implemented")
  72 + }
  73 +
  74 + func videoPlayer(_ videoPlayer: ZFPlayerController, loadStateChanged state: ZFPlayerLoadState) {
  75 + if (state == .stalled || state == .prepare) && videoPlayer.currentPlayerManager.isPlaying {
  76 + self.sliderView.startAnimating()
  77 + } else {
  78 + self.sliderView.stopAnimating()
  79 + }
  80 + }
  81 +
  82 + func videoPlayer(_ videoPlayer: ZFPlayerController, currentTime: TimeInterval, totalTime: TimeInterval) {
  83 + self.sliderView.value = videoPlayer.progress
  84 + }
  85 +
  86 + func videoPlayer(_ videoPlayer: ZFPlayerController, bufferTime: TimeInterval) {
  87 + self.sliderView.bufferValue = videoPlayer.bufferProgress
  88 + }
  89 +
  90 + func gestureSingleTapped(_ gestureControl: ZFPlayerGestureControl) {
  91 + if (self.player?.currentPlayerManager.isPlaying == true) {
  92 + self.player?.currentPlayerManager.pause()
  93 + self.playBtn.isHidden = false
  94 + self.playBtn.transform = CGAffineTransform(scaleX: 1.5, y: 1.5)
  95 + UIView.animate(withDuration: 0.2, delay: 0, options: .curveEaseIn, animations: { [weak self] in
  96 + guard let self = self else { return }
  97 + self.playBtn.transform = .identity
  98 + }, completion: nil)
  99 + } else {
  100 + self.player?.currentPlayerManager.play()
  101 + self.playBtn.isHidden = true
  102 + }
  103 + }
  104 +
  105 + func showCoverView(withUrl coverUrl: String) {
  106 + self.player?.currentPlayerManager.view.coverImageView.kf.setImage(with: URL(string: coverUrl), placeholder: UIImage.imageWithColor(color: UIColor.black, size: UIScreen.main.bounds.size))
  107 + }
  108 +}
metaCode/Classes/Main/VideoPage/View/CNLiveShortVideoCustomControlView.swift 0 → 100644
  1 +//
  2 +// CNLiveShortVideoCustomControlView.swift
  3 +// metaCode
  4 +//
  5 +// Created by open on 2024/1/5.
  6 +//
  7 +
  8 +import Foundation
  9 +import ZFPlayer
  10 +
  11 +class CNLiveShortVideoCustomControlView: UIView, ZFPlayerMediaControl, ZFSliderViewDelegate {
  12 +
  13 + var player: ZFPlayerController?
  14 +
  15 + var topToolView: UIView = {
  16 + let view = UIView()
  17 + let image = UIImage(named: "ZFPlayer_top_shadow")
  18 + view.layer.contents = image?.cgImage
  19 + return view
  20 + }()
  21 +
  22 + var titleLabel: UILabel = {
  23 + let label = UILabel()
  24 + label.textColor = .white
  25 + label.font = UIFont.systemFont(ofSize: 15.0)
  26 + return label
  27 + }()
  28 +
  29 + var bottomToolView: UIView = {
  30 + let view = UIView()
  31 + let image = UIImage(named: "ZFPlayer_bottom_shadow")
  32 + view.layer.contents = image?.cgImage
  33 + return view
  34 + }()
  35 +
  36 + var playOrPauseBtn: UIButton = {
  37 + let button = UIButton(type: .custom)
  38 + button.setImage(UIImage(named: "new_allPlay_44x44_"), for: .normal)
  39 + button.setImage(UIImage(named: "new_allPause_44x44_"), for: .selected)
  40 + return button
  41 + }()
  42 +
  43 + var currentTimeLabel: UILabel = {
  44 + let label = UILabel()
  45 + label.textColor = .white
  46 + label.font = UIFont.systemFont(ofSize: 14.0)
  47 + label.textAlignment = .center
  48 + return label
  49 + }()
  50 +
  51 + var slider: ZFSliderView = {
  52 + let slider = ZFSliderView()
  53 + slider.maximumTrackTintColor = UIColor(red: 0.5, green: 0.5, blue: 0.5, alpha: 0.8)
  54 + slider.bufferTrackTintColor = UIColor(red: 1, green: 1, blue: 1, alpha: 0.5)
  55 + slider.minimumTrackTintColor = .white
  56 + slider.setThumbImage(UIImage(named: "ZFPlayer_slider"), for: .normal)
  57 + slider.sliderHeight = 2
  58 + return slider
  59 + }()
  60 +
  61 + var totalTimeLabel: UILabel = {
  62 + let label = UILabel()
  63 + label.textColor = .white
  64 + label.font = UIFont.systemFont(ofSize: 14.0)
  65 + label.textAlignment = .center
  66 + return label
  67 + }()
  68 +
  69 + var fullScreenBtn: UIButton = {
  70 + let button = UIButton(type: .custom)
  71 + button.setImage(UIImage(named: "ZFPlayer_fullscreen"), for: .normal)
  72 + return button
  73 + }()
  74 +
  75 + var coverImageView: UIImageView = {
  76 + let imageView = UIImageView()
  77 + imageView.isUserInteractionEnabled = true
  78 + imageView.contentMode = .scaleAspectFit
  79 + return imageView
  80 + }()
  81 +
  82 + var bottomPgrogress: ZFSliderView = {
  83 + let slider = ZFSliderView()
  84 + slider.maximumTrackTintColor = .clear
  85 + slider.minimumTrackTintColor = .white
  86 + slider.bufferTrackTintColor = UIColor(red: 1, green: 1, blue: 1, alpha: 0.5)
  87 + slider.sliderHeight = 1
  88 + slider.isHideSliderBlock = false
  89 + return slider
  90 + }()
  91 +
  92 + override init(frame: CGRect) {
  93 + super.init(frame: frame)
  94 + addSubview(topToolView)
  95 + addSubview(bottomToolView)
  96 + addSubview(playOrPauseBtn)
  97 + topToolView.addSubview(titleLabel)
  98 + bottomToolView.addSubview(currentTimeLabel)
  99 + bottomToolView.addSubview(slider)
  100 + bottomToolView.addSubview(totalTimeLabel)
  101 + bottomToolView.addSubview(fullScreenBtn)
  102 + addSubview(bottomPgrogress)
  103 +// addSubview(activity)
  104 +
  105 +// autoFadeTimeInterval = 0.2
  106 +// autoHiddenTimeInterval = 2.5
  107 +
  108 + // 设置子控件的响应事件
  109 + makeSubViewsAction()
  110 +
  111 +// resetControlView()
  112 + clipsToBounds = true
  113 + }
  114 +
  115 + func makeSubViewsAction() {
  116 + playOrPauseBtn.addTarget(self, action: #selector(playPauseButtonClickAction), for: .touchUpInside)
  117 + fullScreenBtn.addTarget(self, action: #selector(fullScreenButtonClickAction), for: .touchUpInside)
  118 + }
  119 +
  120 +
  121 +
  122 + /////////////// ZFSliderViewDelegate
  123 + func sliderTouchBegan(_ value: Float) {
  124 + slider.isdragging = true
  125 + }
  126 +
  127 + func sliderTouchEnded(_ value: Float) {
  128 + guard player?.totalTime ?? 0.0 > 0 else {
  129 + slider.isdragging = false
  130 + return
  131 + }
  132 +
  133 + player?.seek(toTime: (player?.totalTime ?? 0.0) * TimeInterval(value), completionHandler: {[weak self] finished in
  134 + guard let self = self else { return }
  135 + if finished {
  136 + self.slider.isdragging = false
  137 + }
  138 + })
  139 + }
  140 +
  141 + func sliderValueChanged(_ value: Float) {
  142 + guard player?.totalTime ?? 0.0 > 0 else {
  143 + slider.value = 0
  144 + return
  145 + }
  146 +
  147 + slider.isdragging = true
  148 + let currentTimeString = ZFUtilities.convertTimeSecond(Int((player?.totalTime ?? 0.0) * TimeInterval(value)))
  149 + currentTimeLabel.text = currentTimeString
  150 + }
  151 +
  152 + func sliderTapped(_ value: Float) {
  153 + guard player?.totalTime ?? 0.0 > 0 else {
  154 + slider.isdragging = false
  155 + slider.value = 0
  156 + return
  157 + }
  158 +
  159 + slider.isdragging = true
  160 + player?.seek(toTime: (player?.totalTime ?? 0.0) * TimeInterval(value), completionHandler: { [weak self] finished in
  161 + guard let self = self else { return }
  162 + if finished {
  163 + slider.isdragging = false
  164 + player?.currentPlayerManager.play()
  165 + }
  166 + })
  167 + }
  168 +
  169 + ////////////action
  170 + @objc func playPauseButtonClickAction(_ sender: UIButton) {
  171 + playOrPause()
  172 + }
  173 +
  174 + @objc func fullScreenButtonClickAction(_ sender: UIButton) {
  175 + self.player?.enterFullScreen(!self.player!.isFullScreen, animated: true)
  176 + }
  177 +
  178 + private func playOrPause() {
  179 + self.playOrPauseBtn.isSelected = !self.playOrPauseBtn.isSelected
  180 + self.playOrPauseBtn.isSelected ? self.player?.currentPlayerManager.play(): self.player?.currentPlayerManager.pause()
  181 + }
  182 +
  183 + private func playBtnSelectedState(selected: Bool) {
  184 + self.playOrPauseBtn.isSelected = selected
  185 + }
  186 +
  187 +
  188 + ///////private
  189 + func resetControlView() {
  190 + self.bottomToolView.alpha = 1
  191 + self.slider.value = 0
  192 + self.slider.bufferValue = 0
  193 + self.currentTimeLabel.text = "00:00"
  194 + self.totalTimeLabel.text = "00:00"
  195 + self.backgroundColor = .clear
  196 + self.playOrPauseBtn.isSelected = true
  197 + self.titleLabel.text = ""
  198 + }
  199 +
  200 +// func showControlView() {
  201 +// self.topToolView.alpha = 1
  202 +// self.bottomToolView.alpha = 1
  203 +// self.isShow = true
  204 +// self.topToolView.zf_y = 0
  205 +// self.bottomToolView.zf_y = self.zf_height - self.bottomToolView.zf_height
  206 +// self.playOrPauseBtn.alpha = 1
  207 +// self.player.statusBarHidden = false
  208 +// }
  209 +
  210 + required init?(coder: NSCoder) {
  211 + super.init(coder: coder)
  212 + // Initialization code...
  213 + }
  214 +}
metaCode/Classes/Main/VideoPage/View/CNLiveShortVideoListTableViewCell.swift 0 → 100644
  1 +//
  2 +// CNLiveShortVideoListTableViewCell.swift
  3 +// metaCode
  4 +//
  5 +// Created by open on 2024/1/5.
  6 +//
  7 +
  8 +import Foundation
  9 +import ZFPlayer
  10 +import Kingfisher
  11 +import APButton
  12 +
  13 +protocol CNLiveShortVideoListTableViewCellDelegate : AnyObject {
  14 + func likeActionMethod(viewcell: CNLiveShortVideoListTableViewCell, button: UIButton)
  15 + func commentActionMethod(viewcell: CNLiveShortVideoListTableViewCell, button: UIButton)
  16 + func shareActionMethod(viewcell: CNLiveShortVideoListTableViewCell, button: UIButton)
  17 + func iconActionMethod(viewcell: CNLiveShortVideoListTableViewCell, button: UIButton)
  18 + func faviActionMethod(viewcell: CNLiveShortVideoListTableViewCell, button: UIButton)
  19 + func listActionMethod(viewcell: CNLiveShortVideoListTableViewCell, button: UIButton)
  20 + func payActionMethod(viewcell: CNLiveShortVideoListTableViewCell, button: UIButton)
  21 +}
  22 +
  23 +class CNLiveShortVideoListTableViewCell: UITableViewCell {
  24 +
  25 + lazy var titleLabel: UILabel = {
  26 + let label = UILabel()
  27 + label.textColor = UIColor.white
  28 + label.font = semibold_adapt_font(pointSize: 19)
  29 + label.textAlignment = .left
  30 + label.numberOfLines = 1
  31 + label.lineBreakMode = .byTruncatingTail
  32 + label.text = "爱得供养"
  33 + return label
  34 + }()
  35 +
  36 + lazy var descLabel: UILabel = {
  37 + let label = UILabel()
  38 + label.textColor = UIColor.white
  39 + label.font = regular_adapt_font(pointSize: 15)
  40 + label.textAlignment = .left
  41 + label.numberOfLines = 3
  42 + label.lineBreakMode = .byTruncatingTail
  43 + label.text = "在 Swift 中,CGRect 的属性和方法名通常是小写字母开头的驼峰命名法。确保在 Swift 中使用正确的命名规范和语法。这段 Swift 代码与原始的 Objective-C 代码逻辑相同,只是在语法和命名上进行了一些调整。"
  44 + return label
  45 + }()
  46 +
  47 + lazy var tipsLabel: UILabel = {
  48 + let label = UILabel()
  49 + label.textColor = UIColor.white
  50 + label.font = semibold_adapt_font(pointSize: 15)
  51 + label.textAlignment = .center
  52 + label.numberOfLines = 0
  53 + label.text = "当前内容需付费观看"
  54 + label.isHidden = true
  55 + return label
  56 + }()
  57 +
  58 + lazy var listBtn: UIButton = {
  59 + let button = UIButton(type: .custom)
  60 + button.setTitle("爱的供养·45集", for: .normal)
  61 + button.setTitleColor(.white, for: .normal)
  62 + button.contentHorizontalAlignment = .left
  63 + button.contentEdgeInsets = UIEdgeInsets(top: 0, left: 20, bottom: 0, right: 0)
  64 + button.titleLabel?.textAlignment = .left
  65 + button.titleLabel?.lineBreakMode = .byTruncatingTail
  66 + button.titleLabel?.font = semibold_adapt_font(pointSize: 15)
  67 + button.addTarget(self, action: #selector(likeMothod), for: .touchUpInside)
  68 + button.layer.cornerRadius = 10
  69 + button.layer.masksToBounds = true
  70 + button.backgroundColor = HexColor("#414141")
  71 + button.addTarget(self, action: #selector(listMethod), for: .touchUpInside)
  72 + return button
  73 + }()
  74 +
  75 + lazy var iconBtn: UIButton = {
  76 + let button = UIButton(type: .custom)
  77 + button.setImage(UIImage(named: "mine_sub_about_app_logo"), for: .normal)
  78 + button.layer.cornerRadius = 25
  79 + button.layer.masksToBounds = true
  80 + button.layer.borderColor = UIColor.white.cgColor
  81 + button.layer.borderWidth = 1
  82 + button.backgroundColor = .clear
  83 + button.addTarget(self, action: #selector(iconMothod), for: .touchUpInside)
  84 + return button
  85 + }()
  86 +
  87 + lazy var faviBtn: APButton = {
  88 + let button = APButton()
  89 + button.setImage(UIImage(named: "short_video_guan_zhu"), for: .normal)
  90 + button.layer.cornerRadius = 10
  91 + button.layer.masksToBounds = true
  92 + button.backgroundColor = .clear
  93 + button.activityIndicator.color = .white
  94 + button.addTarget(self, action: #selector(faviMothod), for: .touchUpInside)
  95 + return button
  96 + }()
  97 +
  98 + lazy var topBtn: UIButton = {
  99 + let button = UIButton(type: .custom)
  100 + button.setImage(UIImage(named: "short_video_to_top"), for: .normal)
  101 + button.backgroundColor = .clear
  102 + button.isUserInteractionEnabled = false
  103 + return button
  104 + }()
  105 +
  106 + lazy var likeBtn: ImageButton = {
  107 + let button = ImageButton(type: .custom)
  108 + button.setImage(UIImage(named: "short_video_zan_nomal"), for: .normal)
  109 + button.setImage(UIImage(named: "short_video_zan_select"), for: .selected)
  110 + button.setTitle("22.8w", for: .normal)
  111 + button.setTitleColor(.white, for: .normal)
  112 + button.titleLabel?.font = light_adapt_font(pointSize: 15)
  113 + button.addTarget(self, action: #selector(likeMothod), for: .touchUpInside)
  114 + return button
  115 + }()
  116 +
  117 + lazy var commentBtn: ImageButton = {
  118 + let button = ImageButton(type: .custom)
  119 + button.setImage(UIImage(named: "short_video_comment"), for: .normal)
  120 + button.setTitle("232.8w", for: .normal)
  121 + button.setTitleColor(.white, for: .normal)
  122 + button.titleLabel?.font = light_adapt_font(pointSize: 15)
  123 + button.addTarget(self, action: #selector(commentMothod), for: .touchUpInside)
  124 + return button
  125 + }()
  126 +
  127 + lazy var shareBtn: ImageButton = {
  128 + let button = ImageButton(type: .custom)
  129 + button.setImage(UIImage(named: "short_video_share"), for: .normal)
  130 + button.setTitle("0.8w", for: .normal)
  131 + button.setTitleColor(.white, for: .normal)
  132 + button.titleLabel?.font = light_adapt_font(pointSize: 15)
  133 + button.addTarget(self, action: #selector(shareMothod), for: .touchUpInside)
  134 + return button
  135 + }()
  136 +
  137 + lazy var payView: UIView = {
  138 + let payView = setupWithPayView()
  139 + payView.isHidden = true
  140 + return payView
  141 + }()
  142 +
  143 + //控制器承载图
  144 + lazy var coverImageView: UIImageView = {
  145 + let coverImageView = UIImageView()
  146 + coverImageView.isUserInteractionEnabled = true
  147 + coverImageView.tag = 100
  148 + coverImageView.contentMode = .scaleAspectFit
  149 + return coverImageView
  150 + }()
  151 +
  152 + var homeModel: ShortVideoHomeTestModel!
  153 + weak var delegate: CNLiveShortVideoListTableViewCellDelegate!
  154 +
  155 + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
  156 + super.init(style: style, reuseIdentifier: reuseIdentifier)
  157 + contentView.backgroundColor = .clear
  158 + backgroundColor = .clear
  159 + selectionStyle = .none
  160 +
  161 + contentView.addSubview(coverImageView)
  162 + contentView.addSubview(shareBtn)
  163 + contentView.addSubview(commentBtn)
  164 + contentView.addSubview(likeBtn)
  165 + contentView.addSubview(iconBtn)
  166 + contentView.addSubview(faviBtn)
  167 + contentView.addSubview(descLabel)
  168 + contentView.addSubview(titleLabel)
  169 + contentView.addSubview(listBtn)
  170 + listBtn.addSubview(topBtn)
  171 + contentView.addSubview(tipsLabel)
  172 + contentView.addSubview(payView)
  173 + }
  174 +
  175 + func setupWithData(model: ShortVideoHomeTestModel) {
  176 + homeModel = model
  177 + coverImageView.kf.indicatorType = .activity
  178 + coverImageView.kf.setImage(with: URL(string: model.icon.face!), placeholder: UIImage(named: "short_video_default"))
  179 + }
  180 +
  181 + override func layoutSubviews() {
  182 + super.layoutSubviews()
  183 + coverImageView.frame = contentView.bounds
  184 + shareBtn.snp.makeConstraints { [weak self] make in
  185 + guard let self = self else { return }
  186 + make.bottom.equalTo(self.snp.bottom).offset(-(70 + get_system_tabbar_ui_offsetHeight()))
  187 + make.right.equalTo(self.snp.right).offset(-20)
  188 + make.width.equalTo(55)
  189 + make.height.equalTo(50)
  190 + }
  191 + commentBtn.snp.makeConstraints { [weak self] make in
  192 + guard let self = self else { return }
  193 + make.bottom.equalTo(shareBtn.snp.top).offset(-20)
  194 + make.right.equalTo(self.snp.right).offset(-20)
  195 + make.width.equalTo(55)
  196 + make.height.equalTo(50)
  197 + }
  198 + likeBtn.snp.makeConstraints { [weak self] make in
  199 + guard let self = self else { return }
  200 + make.bottom.equalTo(commentBtn.snp.top).offset(-20)
  201 + make.right.equalTo(self.snp.right).offset(-20)
  202 + make.width.equalTo(55)
  203 + make.height.equalTo(50)
  204 + }
  205 + iconBtn.snp.makeConstraints { [weak self] make in
  206 + guard let self = self else { return }
  207 + make.bottom.equalTo(likeBtn.snp.top).offset(-20)
  208 + make.right.equalTo(self.snp.right).offset(-20)
  209 + make.width.height.equalTo(50)
  210 + }
  211 + faviBtn.snp.makeConstraints { [weak self] make in
  212 + guard let self = self else { return }
  213 + make.centerX.equalTo(self.iconBtn)
  214 + make.bottom.equalTo(self.iconBtn).offset(10)
  215 + make.height.width.equalTo(20)
  216 + }
  217 + descLabel.snp.makeConstraints {[weak self] make in
  218 + guard let self = self else { return }
  219 + make.bottom.equalTo(self.snp.bottom).offset(-(70 + get_system_tabbar_ui_offsetHeight()))
  220 + make.left.equalTo(self.snp.left).offset(20)
  221 + make.right.equalTo(shareBtn.snp.left).offset(-10)
  222 + }
  223 + titleLabel.snp.makeConstraints { [weak self] make in
  224 + guard let self = self else { return }
  225 + make.bottom.equalTo(descLabel.snp.top).offset(-10)
  226 + make.left.equalTo(self.snp.left).offset(20)
  227 + make.right.equalTo(shareBtn.snp.left).offset(-10)
  228 + }
  229 + listBtn.snp.makeConstraints { make in
  230 + make.centerX.equalToSuperview()
  231 + make.top.equalTo(descLabel.snp.bottom).offset(20)
  232 + make.left.equalToSuperview().offset(20)
  233 + make.right.equalToSuperview().offset(-20)
  234 + make.bottom.equalToSuperview().offset(-get_system_tabbar_ui_offsetHeight())
  235 + }
  236 + topBtn.snp.makeConstraints { make in
  237 + make.centerY.equalToSuperview()
  238 + make.right.equalToSuperview().offset(-15)
  239 + }
  240 + tipsLabel.snp.makeConstraints { make in
  241 + make.centerX.equalToSuperview()
  242 + make.centerY.equalToSuperview().offset(-30)
  243 + }
  244 + payView.snp.makeConstraints { make in
  245 + make.centerX.equalToSuperview()
  246 + make.left.equalToSuperview().offset(20)
  247 + make.right.equalToSuperview().offset(-20)
  248 + make.bottom.equalTo(listBtn.snp.top).offset(-10)
  249 + make.height.equalTo(165)
  250 + }
  251 + }
  252 +
  253 + open func hiddenView(isHidden: Bool) {
  254 + if (isHidden) {
  255 + self.commentBtn.isHidden = true
  256 + self.faviBtn.isHidden = true
  257 + self.shareBtn.isHidden = true
  258 + self.likeBtn.isHidden = true
  259 + self.iconBtn.isHidden = true
  260 + self.titleLabel.isHidden = true
  261 + self.descLabel.isHidden = true
  262 + self.tipsLabel.isHidden = false
  263 + self.payView.isHidden = false
  264 + } else {
  265 + self.commentBtn.isHidden = false
  266 + self.faviBtn.isHidden = false
  267 + self.shareBtn.isHidden = false
  268 + self.likeBtn.isHidden = false
  269 + self.iconBtn.isHidden = false
  270 + self.titleLabel.isHidden = false
  271 + self.descLabel.isHidden = false
  272 + self.tipsLabel.isHidden = true
  273 + self.payView.isHidden = true
  274 + }
  275 + }
  276 +
  277 + @objc func likeMothod(button: UIButton) {
  278 + self.delegate.likeActionMethod(viewcell: self, button: button)
  279 + }
  280 +
  281 + @objc func commentMothod(button: UIButton) {
  282 + self.delegate.commentActionMethod(viewcell: self, button: button)
  283 + }
  284 +
  285 + @objc func shareMothod(button: UIButton) {
  286 + self.delegate.shareActionMethod(viewcell: self, button: button)
  287 + }
  288 +
  289 + @objc func iconMothod(button: UIButton) {
  290 + self.delegate.iconActionMethod(viewcell: self, button: button)
  291 + }
  292 +
  293 + @objc func faviMothod(button: UIButton) {
  294 + self.delegate.faviActionMethod(viewcell: self, button: button)
  295 + }
  296 +
  297 + @objc func listMethod(button: UIButton) {
  298 + self.delegate.listActionMethod(viewcell: self, button: button)
  299 + }
  300 +
  301 + @objc func payMethod(button: UIButton) {
  302 + self.delegate.payActionMethod(viewcell: self, button: button)
  303 + }
  304 +
  305 + required init?(coder: NSCoder) {
  306 + fatalError("init(coder:) has not been implemented")
  307 + }
  308 +
  309 + deinit {
  310 + print("cell界面销毁了")
  311 + }
  312 +
  313 +}
  314 +
  315 +extension CNLiveShortVideoListTableViewCell {
  316 +
  317 + private func setupWithPayView() -> UIView {
  318 + let view = UIView.init()
  319 + view.backgroundColor = HexColor("#414141")
  320 + view.layer.cornerRadius = 10
  321 + view.layer.masksToBounds = true
  322 +
  323 + let imageView = UIImageView.init()
  324 + imageView.image = UIImage(named: "mine_auth_result_header_failer")
  325 + imageView.contentMode = .scaleAspectFill
  326 + imageView.layer.cornerRadius = 5
  327 + imageView.layer.masksToBounds = true
  328 + imageView.clipsToBounds = true
  329 + imageView.viewWithTag(1000)
  330 + view.addSubview(imageView)
  331 + imageView.snp.makeConstraints { make in
  332 + make.left.top.equalToSuperview().offset(20)
  333 + make.width.equalTo(50)
  334 + make.height.equalTo(70)
  335 + }
  336 +
  337 + let paragraphStyle = NSMutableParagraphStyle()
  338 + paragraphStyle.lineSpacing = 6
  339 + let titleLabel = UILabel.init()
  340 + titleLabel.attributedText = NSAttributedString(string: "第四集 我们都不知道,所做的哪一个选择会让命运的齿轮开始转动", attributes: [NSAttributedString.Key.paragraphStyle: paragraphStyle])
  341 + titleLabel.textColor = .white
  342 + titleLabel.lineBreakMode = .byTruncatingTail
  343 + titleLabel.numberOfLines = 2
  344 + titleLabel.viewWithTag(1001)
  345 + titleLabel.font = medium_adapt_font(pointSize: 12)
  346 + view.addSubview(titleLabel)
  347 + titleLabel.snp.makeConstraints { make in
  348 + make.left.equalTo(imageView.snp.right).offset(10)
  349 + make.top.equalToSuperview().offset(20)
  350 + make.right.equalToSuperview().offset(-20)
  351 + }
  352 +
  353 + let timeLabel = UILabel.init()
  354 + timeLabel.text = "04:45"
  355 + timeLabel.textColor = .white
  356 + timeLabel.viewWithTag(1002)
  357 + timeLabel.font = light_adapt_font(pointSize: 13)
  358 + view.addSubview(timeLabel)
  359 + timeLabel.snp.makeConstraints { make in
  360 + make.left.equalTo(imageView.snp.right).offset(10)
  361 + make.bottom.equalTo(imageView.snp.bottom)
  362 + make.right.equalToSuperview().offset(-20)
  363 + }
  364 +
  365 + let lineLabel = UILabel.init()
  366 + lineLabel.backgroundColor = HexColor("#686868")
  367 + view.addSubview(lineLabel)
  368 + lineLabel.snp.makeConstraints { make in
  369 + make.left.equalToSuperview().offset(20)
  370 + make.height.equalTo(1)
  371 + make.top.equalTo(imageView.snp.bottom).offset(10)
  372 + make.right.equalToSuperview().offset(-20)
  373 + }
  374 +
  375 + let payButton = APButton()
  376 + payButton.setTitle("840积分解锁全42集", for: .normal)
  377 + payButton.setTitleColor(.white, for: .normal)
  378 + payButton.layer.cornerRadius = 20
  379 + payButton.activityIndicator.color = .white
  380 + payButton.layer.masksToBounds = true
  381 + payButton.viewWithTag(1003)
  382 + payButton.backgroundColor = HexColor("#67C5FF")
  383 + payButton.titleLabel?.font = medium_adapt_font(pointSize: 15)
  384 + payButton.addTarget(self, action: #selector(payMethod), for: .touchUpInside)
  385 + view.addSubview(payButton)
  386 + payButton.snp.makeConstraints { make in
  387 + make.centerX.equalToSuperview()
  388 + make.width.equalTo(200)
  389 + make.height.equalTo(40)
  390 + make.top.equalTo(lineLabel.snp.bottom).offset(10)
  391 + }
  392 + payButton.setGradient(colors: [UIColor(red: 103/255.0, green: 197/255.0, blue: 255/255.0, alpha: 0.3),UIColor(red: 96/255.0, green: 154/255.0, blue: 255/255.0, alpha: 0.3)], startPoint: CGPoint(x: 0, y: 0.5), endPoint: CGPoint(x: 1, y: 0.5))
  393 + return view
  394 + }
  395 +}
  396 +
  397 +class ImageButton: UIButton {
  398 + override func layoutSubviews() {
  399 + super.layoutSubviews()
  400 +
  401 + guard let imageView = self.imageView, let titleLabel = self.titleLabel else {
  402 + return
  403 + }
  404 + let imageRect = CGRect(x: (self.bounds.width - imageView.bounds.width) / 2, y: 0, width: imageView.bounds.width, height: imageView.bounds.height)
  405 + imageView.frame = imageRect
  406 + let titleRect = CGRect(x: 0, y: imageRect.maxY + 3.0, width: self.bounds.width, height: titleLabel.bounds.height)
  407 + titleLabel.frame = titleRect
  408 + titleLabel.textAlignment = .center
  409 + }
  410 + override func setTitle(_ title: String?, for state: UIControl.State) {
  411 + super.setTitle(title, for: state)
  412 + setNeedsLayout()
  413 + }
  414 + override func setImage(_ image: UIImage?, for state: UIControl.State) {
  415 + super.setImage(image, for: state)
  416 + setNeedsLayout()
  417 + }
  418 +}
metaCode/Classes/Main/VideoPage/ViewModel/CNLiveShortVideoViewModel.swift 0 → 100644
  1 +//
  2 +// CNLiveShortVideoViewModel.swift
  3 +// metaCode
  4 +//
  5 +// Created by open on 2024/1/8.
  6 +//
  7 +
  8 +import Foundation
  9 +import CNLiveRequestBastKit
  10 +
  11 +typealias resultShortVideoBlock = (_ result: Any,_ respStatue :CNLiveMineResponseType) -> Void
  12 +class CNLiveShortVideoViewModel: NSObject {
  13 +
  14 + /// 这是测试请求短视频数据
  15 + static func requstWithShortVideo(reultShortVideoBlock: @escaping resultShortVideoBlock) {
  16 +
  17 + let param = NSMutableDictionary()
  18 + param.setValue("10511059", forKey: "creatorId")
  19 + param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "userId")
  20 + param.setValue("3", forKey: "type")
  21 + param.setValue("1", forKey: "page")
  22 + param.setValue("10", forKey: "pageSize")
  23 + let custom_param = NSMutableDictionary()
  24 + custom_param.setValue(APPId_wjj, forKey: "appId")
  25 + custom_param.setValue(APPKey_wjj, forKey: "appKey")
  26 + CNLiveNetworking.setAllowRequestDefaultArgument(true)
  27 + CNLiveNetworking.setupShowDataResult(false)
  28 + CNLiveNetworking.setupDSRequest(true)
  29 + CNLiveNetworking.setupCustomParam(custom_param as? [String : String])
  30 + CNLiveNetworking.requestNetwork(with: .GET, urlString: APPBaseCMSClassUrl+"/ugcApi/ugcVideoList", param: param as! [String : String], cacheType: .networkOnly) { task, result, error in
  31 + hiddenLoading()
  32 + if (error == nil) {
  33 + let resp = result as! NSDictionary
  34 + let errorCode = "\(resp["errorCode"] ?? "0")"
  35 + if (errorCode == "0") {
  36 + if resp["data"] is NSNull {
  37 + reultShortVideoBlock(NSNull(), .failed)
  38 + } else {
  39 + let resp_dict = resp["data"] as! NSDictionary
  40 + let array = resp_dict["list"] as! NSArray
  41 + let tempArray = NSMutableArray()
  42 + let tempUrlArray = NSMutableArray()
  43 + var index = 0
  44 + for item in array {
  45 + let listModel = dictionaryToModel(item as! [String : Any], ShortVideoHomeTestModel.self,"") as! ShortVideoHomeTestModel
  46 + if (index > 2) {
  47 + listModel.isMoney = true
  48 + }
  49 + tempArray.add(listModel)
  50 + tempUrlArray.add(listModel.videoUrl! as String)
  51 + index += 1
  52 + }
  53 + reultShortVideoBlock([tempArray, tempUrlArray], .success)
  54 + }
  55 + } else {
  56 + showMessage(message: resp["errorMessage"] as! String)
  57 + reultShortVideoBlock(NSNull(),.failed)
  58 + }
  59 + } else {
  60 + if CNLiveNetworking.isNetworking() {
  61 + showMessage(message: "请求失败")
  62 + reultShortVideoBlock(NSNull(),.failed)
  63 + } else {
  64 + showMessage(message: "似乎与网络断开链接")
  65 + reultShortVideoBlock(NSNull(),.noNetwork)
  66 + }
  67 + }
  68 + }
  69 + }
  70 +
  71 +}
metaCode/Supporting Files/Assets.xcassets/Shop/DS_coupon_edit_se.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "scale" : "1x"
  6 + },
  7 + {
  8 + "filename" : "选中@2x.png",
  9 + "idiom" : "universal",
  10 + "scale" : "2x"
  11 + },
  12 + {
  13 + "filename" : "选中@3x.png",
  14 + "idiom" : "universal",
  15 + "scale" : "3x"
  16 + }
  17 + ],
  18 + "info" : {
  19 + "author" : "xcode",
  20 + "version" : 1
  21 + }
  22 +}
metaCode/Supporting Files/Assets.xcassets/Shop/DS_coupon_edit_se.imageset/选中@2x.png 0 → 100644

1.26 KB

metaCode/Supporting Files/Assets.xcassets/Shop/DS_coupon_edit_se.imageset/选中@3x.png 0 → 100644

1.96 KB

metaCode/Supporting Files/Assets.xcassets/Video/Contents.json 0 → 100644
  1 +{
  2 + "info" : {
  3 + "author" : "xcode",
  4 + "version" : 1
  5 + }
  6 +}
metaCode/Supporting Files/Assets.xcassets/Video/short_video_close.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "scale" : "1x"
  6 + },
  7 + {
  8 + "filename" : "short_video_close@2x.png",
  9 + "idiom" : "universal",
  10 + "scale" : "2x"
  11 + },
  12 + {
  13 + "filename" : "short_video_close@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/Video/short_video_close.imageset/short_video_close@2x.png 0 → 100644

1.14 KB

metaCode/Supporting Files/Assets.xcassets/Video/short_video_close.imageset/short_video_close@3x.png 0 → 100644

2.1 KB

metaCode/Supporting Files/Assets.xcassets/Video/short_video_comment.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "scale" : "1x"
  6 + },
  7 + {
  8 + "filename" : "short_video_comment@2x.png",
  9 + "idiom" : "universal",
  10 + "scale" : "2x"
  11 + },
  12 + {
  13 + "filename" : "short_video_comment@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/Video/short_video_comment.imageset/short_video_comment@2x.png 0 → 100644

1.08 KB

metaCode/Supporting Files/Assets.xcassets/Video/short_video_comment.imageset/short_video_comment@3x.png 0 → 100644

1.9 KB

metaCode/Supporting Files/Assets.xcassets/Video/short_video_default.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "scale" : "1x"
  6 + },
  7 + {
  8 + "filename" : "short_video_default@2x.png",
  9 + "idiom" : "universal",
  10 + "scale" : "2x"
  11 + },
  12 + {
  13 + "filename" : "short_video_default@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/Video/short_video_default.imageset/short_video_default@2x.png 0 → 100644

13.6 KB

metaCode/Supporting Files/Assets.xcassets/Video/short_video_default.imageset/short_video_default@3x.png 0 → 100644

25.6 KB

metaCode/Supporting Files/Assets.xcassets/Video/short_video_guan_zhu.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "scale" : "1x"
  6 + },
  7 + {
  8 + "filename" : "short_video_guan_zhu@2x.png",
  9 + "idiom" : "universal",
  10 + "scale" : "2x"
  11 + },
  12 + {
  13 + "filename" : "short_video_guan_zhu@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/Video/short_video_guan_zhu.imageset/short_video_guan_zhu@2x.png 0 → 100644

670 Bytes

metaCode/Supporting Files/Assets.xcassets/Video/short_video_guan_zhu.imageset/short_video_guan_zhu@3x.png 0 → 100644

1.11 KB

metaCode/Supporting Files/Assets.xcassets/Video/short_video_play.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "scale" : "1x"
  6 + },
  7 + {
  8 + "filename" : "short_video_play@2x.png",
  9 + "idiom" : "universal",
  10 + "scale" : "2x"
  11 + },
  12 + {
  13 + "filename" : "short_video_play@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/Video/short_video_play.imageset/short_video_play@2x.png 0 → 100644

4.58 KB

metaCode/Supporting Files/Assets.xcassets/Video/short_video_play.imageset/short_video_play@3x.png 0 → 100644

9.68 KB

metaCode/Supporting Files/Assets.xcassets/Video/short_video_share.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "scale" : "1x"
  6 + },
  7 + {
  8 + "filename" : "short_video_share@2x.png",
  9 + "idiom" : "universal",
  10 + "scale" : "2x"
  11 + },
  12 + {
  13 + "filename" : "short_video_share@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/Video/short_video_share.imageset/short_video_share@2x.png 0 → 100644

1.25 KB

metaCode/Supporting Files/Assets.xcassets/Video/short_video_share.imageset/short_video_share@3x.png 0 → 100644

2.32 KB

metaCode/Supporting Files/Assets.xcassets/Video/short_video_to_top.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "scale" : "1x"
  6 + },
  7 + {
  8 + "filename" : "short_video_to_top@2x.png",
  9 + "idiom" : "universal",
  10 + "scale" : "2x"
  11 + },
  12 + {
  13 + "filename" : "short_video_to_top@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/Video/short_video_to_top.imageset/short_video_to_top@2x.png 0 → 100644

270 Bytes

metaCode/Supporting Files/Assets.xcassets/Video/short_video_to_top.imageset/short_video_to_top@3x.png 0 → 100644

489 Bytes

metaCode/Supporting Files/Assets.xcassets/Video/short_video_zan_nomal.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "scale" : "1x"
  6 + },
  7 + {
  8 + "filename" : "short_video_zan_nomal@2x.png",
  9 + "idiom" : "universal",
  10 + "scale" : "2x"
  11 + },
  12 + {
  13 + "filename" : "short_video_zan_nomal@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/Video/short_video_zan_nomal.imageset/short_video_zan_nomal@2x.png 0 → 100644

1.2 KB

metaCode/Supporting Files/Assets.xcassets/Video/short_video_zan_nomal.imageset/short_video_zan_nomal@3x.png 0 → 100644

2.15 KB

metaCode/Supporting Files/Assets.xcassets/Video/short_video_zan_select.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "scale" : "1x"
  6 + },
  7 + {
  8 + "filename" : "short_video_zan_select@2x.png",
  9 + "idiom" : "universal",
  10 + "scale" : "2x"
  11 + },
  12 + {
  13 + "filename" : "short_video_zan_select@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/Video/short_video_zan_select.imageset/short_video_zan_select@2x.png 0 → 100644

1.51 KB

metaCode/Supporting Files/Assets.xcassets/Video/short_video_zan_select.imageset/short_video_zan_select@3x.png 0 → 100644

2.7 KB