Parcourir la source

1.修改status

wenweiwei il y a 4 ans
Parent
commit
74114848af

+ 0 - 20
MusicVideoPlus/MusicVideoPlus.xcodeproj/project.pbxproj

@@ -10,9 +10,6 @@
 		2D1EC138266B4F4900CBACE4 /* MVUMApiUtil.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D1EC137266B4F4900CBACE4 /* MVUMApiUtil.swift */; };
 		4112DD832669BFA600A5AFD9 /* MVBanner.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4112DD822669BFA600A5AFD9 /* MVBanner.swift */; };
 		4112DD862669BFFA00A5AFD9 /* MVBannerFlowLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4112DD852669BFFA00A5AFD9 /* MVBannerFlowLayout.swift */; };
-		4112DD8C2669C0F500A5AFD9 /* banner2.jpeg in Resources */ = {isa = PBXBuildFile; fileRef = 4112DD892669C0F500A5AFD9 /* banner2.jpeg */; };
-		4112DD8D2669C0F500A5AFD9 /* banner1.jpeg in Resources */ = {isa = PBXBuildFile; fileRef = 4112DD8A2669C0F500A5AFD9 /* banner1.jpeg */; };
-		4112DD8E2669C0F500A5AFD9 /* banner0.jpeg in Resources */ = {isa = PBXBuildFile; fileRef = 4112DD8B2669C0F500A5AFD9 /* banner0.jpeg */; };
 		4112DD912669C11C00A5AFD9 /* MVBannerCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4112DD902669C11C00A5AFD9 /* MVBannerCell.swift */; };
 		4149C8932669FE6F0055CAA2 /* MVTagsCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4149C8922669FE6F0055CAA2 /* MVTagsCell.swift */; };
 		417D868C266A2E8400DA2444 /* MVHomeViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 417D868B266A2E8400DA2444 /* MVHomeViewModel.swift */; };
@@ -38,9 +35,6 @@
 		4112DD492668D6A600A5AFD9 /* MusicVideoPlus-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "MusicVideoPlus-Bridging-Header.h"; sourceTree = "<group>"; };
 		4112DD822669BFA600A5AFD9 /* MVBanner.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MVBanner.swift; sourceTree = "<group>"; };
 		4112DD852669BFFA00A5AFD9 /* MVBannerFlowLayout.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MVBannerFlowLayout.swift; sourceTree = "<group>"; };
-		4112DD892669C0F500A5AFD9 /* banner2.jpeg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = banner2.jpeg; sourceTree = "<group>"; };
-		4112DD8A2669C0F500A5AFD9 /* banner1.jpeg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = banner1.jpeg; sourceTree = "<group>"; };
-		4112DD8B2669C0F500A5AFD9 /* banner0.jpeg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = banner0.jpeg; sourceTree = "<group>"; };
 		4112DD902669C11C00A5AFD9 /* MVBannerCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MVBannerCell.swift; sourceTree = "<group>"; };
 		4149C8922669FE6F0055CAA2 /* MVTagsCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MVTagsCell.swift; sourceTree = "<group>"; };
 		417D868B266A2E8400DA2444 /* MVHomeViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MVHomeViewModel.swift; sourceTree = "<group>"; };
@@ -86,23 +80,12 @@
 		4112DD812669BF8900A5AFD9 /* Banner */ = {
 			isa = PBXGroup;
 			children = (
-				4112DD882669C0F500A5AFD9 /* images */,
 				4112DD822669BFA600A5AFD9 /* MVBanner.swift */,
 				4112DD852669BFFA00A5AFD9 /* MVBannerFlowLayout.swift */,
 			);
 			path = Banner;
 			sourceTree = "<group>";
 		};
-		4112DD882669C0F500A5AFD9 /* images */ = {
-			isa = PBXGroup;
-			children = (
-				4112DD892669C0F500A5AFD9 /* banner2.jpeg */,
-				4112DD8A2669C0F500A5AFD9 /* banner1.jpeg */,
-				4112DD8B2669C0F500A5AFD9 /* banner0.jpeg */,
-			);
-			path = images;
-			sourceTree = "<group>";
-		};
 		418532232665342100DCA2C1 = {
 			isa = PBXGroup;
 			children = (
@@ -506,9 +489,6 @@
 			buildActionMask = 2147483647;
 			files = (
 				417D86A4266A375D00DA2444 /* PQConfig.plist in Resources */,
-				4112DD8C2669C0F500A5AFD9 /* banner2.jpeg in Resources */,
-				4112DD8D2669C0F500A5AFD9 /* banner1.jpeg in Resources */,
-				4112DD8E2669C0F500A5AFD9 /* banner0.jpeg in Resources */,
 				418532392665342200DCA2C1 /* Assets.xcassets in Resources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;

+ 112 - 28
MusicVideoPlus/MusicVideoPlus/Classes/Modules/Home/MVHomeController.swift

@@ -7,8 +7,8 @@
 
 import BFFramework
 class MVHomeController: MVBaseController {
-    // 当前选择的位置
-    var lastIndexPath: IndexPath = IndexPath(row: 0, section: 0)
+
+
     private var banner: MVBanner = {
         let banner = MVBanner(frame: .zero, margin: 30, lineSpacing: 12, minScale: MVBanner.Scale(scale: 1))
         banner.backgroundColor = UIColor.white
@@ -78,6 +78,18 @@ class MVHomeController: MVBaseController {
     var mVideos:Array = Array<MVHotVideoModel>.init()
     
     var mAllVideos:Array = Array<PQVideoListModel>.init()
+    
+    var lastBnnerSelectIndex:IndexPath = IndexPath.init()
+    
+    
+    override func viewWillDisappear(_ animated: Bool) {
+        super.viewWillDisappear(animated)
+
+        //停止播放
+        let cell: MVBannerCell?  =  banner.collectionView.cellForItem(at: lastBnnerSelectIndex) as? MVBannerCell
+        cell?.pauseView.isHidden = false
+        PQSingletoVideoPlayer.shared.stopPlayer(isRemove: false)
+    }
 
     override func viewDidLoad() {
         super.viewDidLoad()
@@ -111,22 +123,23 @@ class MVHomeController: MVBaseController {
             }
             
             self?.banner.reloadData()
-        
-            
-            
+
         }
-        
-        
-     
-        
+  
         PQSingletoVideoPlayer.shared.progressBloc = { [weak self] loadProgress, playProgress, duration in
         
             BFLog(message: "loadProgress \(loadProgress) playProgress\(playProgress) \(duration)")
+            let cell: MVBannerCell?  =  self?.banner.collectionView.cellForItem(at: self?.lastBnnerSelectIndex ?? IndexPath.init()) as? MVBannerCell
+            
+            cell?.progressView.progress = playProgress / loadProgress
+//            cell?.progressView.progress = 0.5
+            
  
         }
         PQSingletoVideoPlayer.shared.playStatusBloc = { [weak self] status in
 
             if(status == .PQVIDEO_PLAY_STATUS_END){
+                PQSingletoVideoPlayer.shared.playVideoData!.playProgress = 0
                 PQSingletoVideoPlayer.shared.resetPlayer()
             }
         }
@@ -194,6 +207,45 @@ class MVHomeController: MVBaseController {
             break
         }
     }
+    
+    //再创作视频
+    func createVideo(indexPath: IndexPath) {
+        // 无网
+        if !isNetConnected() {
+        
+            let remindData:PQBaseModel = PQBaseModel()
+            remindData.title = "似乎已断开与互联网的连接"
+            
+            let remindView = PQRemindView(frame: CGRect(x: 0, y: 0, width: cScreenWidth, height: cScreenHeigth))
+            UIApplication.shared.keyWindow?.addSubview(remindView)
+            remindView.remindData = remindData
+            remindView.remindBlock = { [weak self] sender, _ in
+                if sender.tag == 2 {
+                    openAppSetting()
+                }
+            }
+            return
+            
+            
+        }
+        
+        
+        
+        if !BFLoginUserInfo.shared.isLogin() {
+            let vc = MVLoginController()
+            vc.modalPresentationStyle = .fullScreen
+            present(vc, animated: true, completion: nil)
+             
+        }else{
+            PQStuckPointViewModel.stuckPointProjectMusicInfo(projectId: mAllVideos[indexPath.row].reCreateVideoData?.projectId ?? "") { musicData, _ in
+                if musicData != nil{
+                    let vc = PQStuckPointMaterialController.init()
+                    vc.reCreateMusicData = musicData
+                    self.navigationController?.pushViewController(vc, animated: true)
+                }
+            }
+        }
+    }
 }
 
 // MARK: - MVBannerDataSource
@@ -212,17 +264,16 @@ extension MVHomeController: MVBannerDataSource, MVBannerDelegate {
         cell.videoData = mAllVideos[indexPath.row]
         cell.reCreateBtnClicHandle = { [weak self] _, _ in
             BFLog(message: "点击了创同款")
-            PQSingletoVideoPlayer.shared.stopPlayer(isRemove: false)
+            self?.createVideo(indexPath: indexPath)
+       
         }
  
 
         return cell
     }
-
-    // MARK: - GXBannerDelegate
-
-    func banner(_: MVBanner, didSelectItemAt indexPath: IndexPath) {
-        NSLog("didSelectItemAt %d", indexPath.row)
+    
+    func changePlayerStatus(indexPath: IndexPath){
+         
         
         let cell: MVBannerCell?  =  banner.collectionView.cellForItem(at: indexPath) as? MVBannerCell
         
@@ -234,6 +285,16 @@ extension MVHomeController: MVBannerDataSource, MVBannerDelegate {
             PQSingletoVideoPlayer.shared.resetPlayer()
             cell?.pauseView.isHidden = true
         }
+    }
+
+    // MARK: - GXBannerDelegate
+
+    func banner(_: MVBanner, didSelectItemAt indexPath: IndexPath) {
+        NSLog("didSelectItemAt %d", indexPath.row)
+        lastBnnerSelectIndex = indexPath
+        
+        changePlayerStatus(indexPath: indexPath)
+      
 
     }
     
@@ -245,16 +306,27 @@ extension MVHomeController: MVBannerDataSource, MVBannerDelegate {
        
         if (mVideos.count > 0  && cell != nil) {
             cell?.pauseView.isHidden = true
-            PQSingletoVideoPlayer.shared.configPlyer(videoData:  mAllVideos[page], controllerView: cell!.iconIView)
+            PQSingletoVideoPlayer.shared.configPlyer(videoData:  mAllVideos[page], controllerView: cell!.converView)
+            
+            let hotVides = mVideos.first(where: { (items) -> Bool in
+                items.categoryName ==  mAllVideos[page].categoryName
+            })
+            for hot in mVideos {
+                hot.isSelected = false
+            }
+            
+            mVideos[(hotVides?.categoryId ?? 0) - 1].isSelected = true
+            collectionView.reloadData()
+            
+            lastBnnerSelectIndex = IndexPath.init(row: page, section: 0)
         }
-        
     
     }
 }
 
-// MARK: - 卡点音乐相关代理
+// MARK: - 划动分类相关代理
 
-/// 卡点音乐相关代理
+///  
 extension MVHomeController: UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout, UIScrollViewDelegate {
     func collectionView(_: UICollectionView, numberOfItemsInSection _: Int) -> Int {
         return mVideos.count
@@ -276,17 +348,29 @@ extension MVHomeController: UICollectionViewDelegate, UICollectionViewDataSource
   
 
     func collectionView(_: UICollectionView, didSelectItemAt indexPath: IndexPath) {
-        let itemData: MVHotVideoModel = mVideos[lastIndexPath.item]
-        itemData.isSelected = false
-        lastIndexPath = indexPath
-        let itemDataNew: MVHotVideoModel = mVideos[lastIndexPath.item]
+     
+        for hot in mVideos {
+            hot.isSelected = false
+        }
+        
+        let itemDataNew: MVHotVideoModel = mVideos[indexPath.item]
         itemDataNew.isSelected = true
         collectionView.reloadData()
+        
+        //找出当前选择分类之前的视频数量和
+        var videosCount:Int = 0
+        if(indexPath.row != 0){
+      
+            for i in 0...indexPath.row - 1 {
+                videosCount = videosCount + mVideos[i].videos.count
+            }
+            BFLog(message: "indexPath 选择\(indexPath.item) 之前的视频合\(videosCount)")
+         
+        }
+        banner.scrollToItem(at: videosCount, animated: true)
+        
+        
+       
     }
-
  
-
-    func collectionView(_: UICollectionView, willDisplay _: UICollectionViewCell, forItemAt indexPath: IndexPath) {
-        let itemData: Any = mVideos[indexPath.item]
-    }
 }

+ 5 - 2
MusicVideoPlus/MusicVideoPlus/Classes/Modules/Home/Views/Banner/MVBanner.swift

@@ -86,7 +86,7 @@ public class MVBanner: UIView {
         self.collectionView.delegate = self
         self.addSubview(self.collectionView)
 
-        self.addSubview(self.pageControl)
+//        self.addSubview(self.pageControl)
 
     }
 }
@@ -250,7 +250,10 @@ extension MVBanner: UIScrollViewDelegate {
     }
     public func scrollViewWillBeginDecelerating(_ scrollView: UIScrollView) {
         scrollView.isPagingEnabled = false
-        self.scrollToItem(at: self.currentIndex, animated: true)
+        if(self.currentIndex >= 0 && self.currentIndex <  self.dataSource?.numberOfItems() ?? 0){
+            self.scrollToItem(at: self.currentIndex, animated: true)
+        }
+
     }
     public func scrollViewDidEndScrollingAnimation(_ scrollView: UIScrollView) {
         scrollView.isPagingEnabled = false

BIN
MusicVideoPlus/MusicVideoPlus/Classes/Modules/Home/Views/Banner/images/banner0.jpeg


BIN
MusicVideoPlus/MusicVideoPlus/Classes/Modules/Home/Views/Banner/images/banner1.jpeg


BIN
MusicVideoPlus/MusicVideoPlus/Classes/Modules/Home/Views/Banner/images/banner2.jpeg


+ 32 - 5
MusicVideoPlus/MusicVideoPlus/Classes/Modules/Home/Views/MVBannerCell.swift

@@ -11,18 +11,38 @@ import BFFramework
 
 class MVBannerCell: UICollectionViewCell {
     
-    lazy var iconIView: UIImageView = {
+    //封面
+    lazy var converView: UIImageView = {
         let iv = UIImageView()
+//        iv.image = UIImage.init(named: "1024x1024px")
+        iv.frame = CGRect.init(x: 0, y: 0, width: self.bounds.size.width, height: self.bounds.size.height-4)
+//      iv.frame = CGRect.init(x: 4, y: 4, width: 100, height: 100)
+        iv.backgroundColor = .white
         iv.contentMode = .scaleAspectFill
+        iv.layer.masksToBounds = false
+        iv.layer.shadowColor = UIColor.black.cgColor
+        iv.layer.shadowOpacity = 0.3;//设置阴影的透明度
+        iv.layer.shadowOffset = CGSize.init(width: 0, height: 4)//设置阴影的偏移量
+ 
         return iv
     }()
     
+    lazy var progressView:UIProgressView = {
+
+        let progressView = UIProgressView(progressViewStyle: .default)
+        progressView.progressTintColor = .white
+        return progressView
+
+    }()
+    
+
+    //下面 marks view
     lazy var bottmMaskView: UIImageView = {
         let bottmMaskView = UIImageView.init(image: UIImage.init(named: "home_marks"))
         
         return bottmMaskView
     }()
-    
+    //暂停view
     lazy var pauseView: UIImageView = {
         let pauseView = UIImageView.init(image: UIImage.init(named: "video_pause"))
         pauseView.isHidden = false
@@ -100,7 +120,7 @@ class MVBannerCell: UICollectionViewCell {
     
     override func layoutSubviews() {
         super.layoutSubviews()
-        self.iconIView.frame = CGRect.init(x: 0, y: 0, width: self.bounds.size.width, height: self.bounds.size.height)
+      
 
         
         self.typeLabe.snp.remakeConstraints { make in
@@ -129,16 +149,23 @@ class MVBannerCell: UICollectionViewCell {
             make.height.equalTo(82)
             make.center.equalToSuperview()
         }
+        
+        self.progressView.snp.remakeConstraints { make in
+            make.width.equalTo(self.bounds.size.width)
+            make.height.equalTo(2)
+            make.bottom.equalToSuperview().offset(-1)
+        }
     }
     
     override init(frame: CGRect) {
         super.init(frame: frame)
-        self.contentView.addSubview(self.iconIView)
+        self.contentView.addSubview(self.converView)
         self.contentView.addSubview(self.bottmMaskView)
         self.contentView.addSubview(self.typeLabe)
         self.contentView.addSubview(self.musicNameView)
         self.contentView.addSubview(self.reCreateBtn)
         self.contentView.addSubview(self.pauseView)
+        self.contentView.addSubview(self.progressView)
     
     }
     
@@ -151,7 +178,7 @@ class MVBannerCell: UICollectionViewCell {
 
         let coverImg = (videoData?.videoCoverSnapshotPath != nil && (videoData?.videoCoverSnapshotPath?.count ?? 0) > 0) ? videoData?.videoCoverSnapshotPath ?? "" : (videoData?.coverImg?["coverImgPath"] as? String ?? "")
         BFLog(message: "coverImg url is \(coverImg)")
-        netImage(url: coverImg, mainView: iconIView)
+        netImage(url: coverImg, mainView: converView)
     }
     
     @objc func btnClick(sender: UIButton) {