浏览代码

1.我的页面播放

wenweiwei 3 年之前
父节点
当前提交
644e3e241a

+ 4 - 0
MusicVideoPlus.xcodeproj/project.pbxproj

@@ -17,6 +17,7 @@
 		2D9630DE268206F300AE6FFE /* MVMineProductController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D9630DD268206F300AE6FFE /* MVMineProductController.swift */; };
 		2D9630E12682096900AE6FFE /* PQCollectionViewFlowlayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D9630E02682096900AE6FFE /* PQCollectionViewFlowlayout.swift */; };
 		2D9630E326820B1900AE6FFE /* MVMineProductCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D9630E226820B1900AE6FFE /* MVMineProductCell.swift */; };
+		2D9630E52682D14500AE6FFE /* MVMineHeadInfoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D9630E42682D14500AE6FFE /* MVMineHeadInfoView.swift */; };
 		4112DD832669BFA600A5AFD9 /* MVBanner.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4112DD822669BFA600A5AFD9 /* MVBanner.swift */; };
 		4112DD862669BFFA00A5AFD9 /* MVBannerFlowLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4112DD852669BFFA00A5AFD9 /* MVBannerFlowLayout.swift */; };
 		4112DD912669C11C00A5AFD9 /* MVBannerCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4112DD902669C11C00A5AFD9 /* MVBannerCell.swift */; };
@@ -47,6 +48,7 @@
 		2D9630DD268206F300AE6FFE /* MVMineProductController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MVMineProductController.swift; sourceTree = "<group>"; };
 		2D9630E02682096900AE6FFE /* PQCollectionViewFlowlayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PQCollectionViewFlowlayout.swift; sourceTree = "<group>"; };
 		2D9630E226820B1900AE6FFE /* MVMineProductCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MVMineProductCell.swift; sourceTree = "<group>"; };
+		2D9630E42682D14500AE6FFE /* MVMineHeadInfoView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MVMineHeadInfoView.swift; sourceTree = "<group>"; };
 		3FA19A38D145C54301B3CD85 /* Pods_MusicVideoPlus.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_MusicVideoPlus.framework; sourceTree = BUILT_PRODUCTS_DIR; };
 		4112DCF02668C45B00A5AFD9 /* MusicVideoPlus.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = MusicVideoPlus.entitlements; sourceTree = "<group>"; };
 		4112DD492668D6A600A5AFD9 /* MusicVideoPlus-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "MusicVideoPlus-Bridging-Header.h"; sourceTree = "<group>"; };
@@ -114,6 +116,7 @@
 			isa = PBXGroup;
 			children = (
 				2D9630E226820B1900AE6FFE /* MVMineProductCell.swift */,
+				2D9630E42682D14500AE6FFE /* MVMineHeadInfoView.swift */,
 			);
 			path = Views;
 			sourceTree = "<group>";
@@ -603,6 +606,7 @@
 				2D076756266DF8E300E64472 /* PQServerProtocalView.swift in Sources */,
 				4144BE31266F128E00ABBDFA /* PQBandingPhoneController.swift in Sources */,
 				41CA6E69266788C000874B19 /* MVLoginController.swift in Sources */,
+				2D9630E52682D14500AE6FFE /* MVMineHeadInfoView.swift in Sources */,
 				2D9630DC2681C8AB00AE6FFE /* MVMineViewModel.swift in Sources */,
 				41CA6F4B26689F4400874B19 /* PQMineViewModel.swift in Sources */,
 				417D868C266A2E8400DA2444 /* MVHomeViewModel.swift in Sources */,

+ 1 - 1
MusicVideoPlus/Classes/Modules/Home/Views/MVPlayControlViewCell.swift

@@ -193,7 +193,7 @@ class MVPlayControlViewCell: UICollectionViewCell {
     func addData() {
         pauseBtn.isSelected = false
         let coverImg = (videoData?.videoCoverSnapshotPath != nil && (videoData?.videoCoverSnapshotPath?.count ?? 0) > 0) ? videoData?.videoCoverSnapshotPath ?? "" : videoData?.coverImg?["coverImgPath"] as! String
-        netImage(url: coverImg, mainView: coverImageView)
+        coverImageView.setNetImage(url: coverImg)
         if videoData?.shareCountFriend != nil, videoData?.shareCountFriend ?? 0 > 0 {
             wechatLab.text = (videoData?.shareCountFriend ?? 0).changeUnit()
         } else {

+ 73 - 7
MusicVideoPlus/Classes/Modules/Mine/Controllers/MVMineProductController.swift

@@ -11,19 +11,27 @@ import UIKit
 class MVMineProductController: PQBaseViewController {
     var itemsList: [PQVideoListModel] = Array<PQVideoListModel>.init()
     var pageNum: Int = 1
+    let margin: CGFloat = 14
+    let headH: CGFloat = cDefaultMargin * 9
+
+    lazy var headInfoView: MVMineHeadInfoView = {
+        let headInfoView = MVMineHeadInfoView(frame: CGRect(x: 0, y: 0, width: view.frame.width, height: headH), margin: 0)
+        return headInfoView
+    }()
+
     lazy var flowLayout: PQCollectionViewFlowlayout = {
         let flowLayout = PQCollectionViewFlowlayout()
         flowLayout.columnCount = 2
         flowLayout.sectionInset = .zero
-        flowLayout.minimumLineSpacing = cDefaultMargin
-        flowLayout.minimumInteritemSpacing = cDefaultMargin
-        flowLayout.headerH = 0
+        flowLayout.minimumLineSpacing = cDefaultMargin / 2
+        flowLayout.minimumInteritemSpacing = cDefaultMargin / 2
+        flowLayout.headerH = headH
         return flowLayout
     }()
 
     lazy var collectionView: UICollectionView = {
         let width = (cScreenWidth - 30) / 2
-        let proCollectView = UICollectionView(frame: CGRect(x: cDefaultMargin, y: cDevice_iPhoneNavBarAndStatusBarHei, width: cScreenWidth - cDefaultMargin * 2, height: view.frame.height - cDevice_iPhoneNavBarAndStatusBarHei - cSafeAreaHeight), collectionViewLayout: flowLayout)
+        let proCollectView = UICollectionView(frame: CGRect(x: margin, y: cDevice_iPhoneNavBarAndStatusBarHei, width: cScreenWidth - margin * 2, height: view.frame.height - cDevice_iPhoneNavBarAndStatusBarHei - cSafeAreaHeight), collectionViewLayout: flowLayout)
         proCollectView.register(MVMineProductCell.self, forCellWithReuseIdentifier: String(describing: MVMineProductCell.self))
         proCollectView.showsVerticalScrollIndicator = false
         proCollectView.delegate = self
@@ -38,8 +46,10 @@ class MVMineProductController: PQBaseViewController {
     override func viewDidLoad() {
         super.viewDidLoad()
         view.addSubview(collectionView)
+        collectionView.addSubview(headInfoView)
         leftBackButton()
         loadRequestData()
+        setTitle(title: BFLoginUserInfo.shared.nickName, color: UIColor(white: 0, alpha: 0))
     }
 
     /// 请求网络数据
@@ -78,11 +88,67 @@ extension MVMineProductController: UICollectionViewDelegate, UICollectionViewDat
         let itemData = itemsList[indexPath.item]
         let cell = MVMineProductCell.productCell(collectionView: collectionView, indexPath: indexPath)
         cell.videoData = itemData
-        cell.btnClickHandle = { [weak self] _, _ in
-//            self?.btnClickHandle(sender: sender, videoData: videoData)
+        cell.btnClickHandle = { [weak self] sender, videoData in
+            self?.btnClickHandle(sender: sender, videoData: videoData)
         }
         return cell
     }
 
-    func collectionView(_: UICollectionView, didSelectItemAt _: IndexPath) {}
+    private func collectionView(collectionView _: UICollectionView, didSelectItemAt indexPath: IndexPath) {
+        if itemsList[indexPath.item].auditStatus != 5 || itemsList[indexPath.item].transcodeStatus != 3 {
+            return
+        }
+        let playVC = MVPlayViewController()
+        playVC.itemsList = itemsList
+        playVC.currentIndex = indexPath
+        playVC.pageNum = pageNum
+        navigationController?.pushViewController(playVC, animated: true)
+    }
+
+    func scrollViewDidScroll(_ scrollView: UIScrollView) {
+        BFLog(message: "scrollView.contentOffset.y = \(scrollView.contentOffset.y)")
+        if scrollView.contentOffset.y <= 0 {
+            navTitleLabel?.textColor = UIColor(white: 0, alpha: 0)
+        } else if scrollView.contentOffset.y >= headH {
+            navTitleLabel?.textColor = UIColor(white: 0, alpha: 1)
+        } else {
+            var alpha: CGFloat = (scrollView.contentOffset.y / headH)
+            if alpha < 0 {
+                alpha = 0
+            }
+            if alpha > 1 {
+                alpha = 1
+            }
+            navTitleLabel?.textColor = UIColor(white: 0, alpha: alpha)
+        }
+    }
+
+    /// 处理按钮点击事件
+    /// - Parameters:
+    ///   - sender: <#sender description#>
+    ///   - videoData: <#videoData description#>
+    func btnClickHandle(sender _: UIButton, videoData: PQVideoListModel?) {
+        let seleView = PQSelectedOprationView.showSelectedOprationView(itemList: ["删除视频"]) { sender in
+            if sender.tag == 1 {
+                PQBaseViewModel.deleteVideo(videoId: Int(videoData?.uniqueId ?? "0") ?? 0) { [weak self] isSuccess, videoId, _ in
+                    if isSuccess {
+                        self?.itemsList.removeAll(where: { tempVideo in
+                            tempVideo.uniqueId == "\(videoId)"
+                        })
+                        self?.flowLayout.findList = self?.itemsList as! [PQVideoListModel]
+                        self?.collectionView.reloadData()
+                    }
+                }
+            }
+        }
+        seleView.contentView.backgroundColor = UIColor.hexColor(hexadecimal: "#F2F2F2")
+        seleView.cancelBtn.backgroundColor = UIColor.white
+        seleView.cancelBtn.setTitleColor(UIColor.black, for: .normal)
+        seleView.cancelBtn.titleLabel?.font = UIFont.systemFont(ofSize: 18, weight: .semibold)
+        let firstBtn: UIButton? = seleView.contentView.subviews[1] as? UIButton
+        firstBtn?.backgroundColor = UIColor.white
+        firstBtn?.setTitleColor(UIColor.hexColor(hexadecimal: "#FF0000"), for: .normal)
+        firstBtn?.titleLabel?.font = UIFont.systemFont(ofSize: 18, weight: .semibold)
+        seleView.contentView.subviews[2].backgroundColor = UIColor.hexColor(hexadecimal: "#F2F2F2")
+    }
 }

+ 82 - 0
MusicVideoPlus/Classes/Modules/Mine/Views/MVMineHeadInfoView.swift

@@ -0,0 +1,82 @@
+//
+//  MVMineHeadInfoView.swift
+//  MusicVideoPlus
+//
+//  Created by SanW on 2021/6/23.
+//
+
+import BFFramework
+import UIKit
+
+class MVMineHeadInfoView: UIView {
+    private var leftMargin: CGFloat = 0
+    lazy var iconImageView: UIImageView = {
+        let iconImageView = UIImageView()
+        iconImageView.contentMode = .scaleAspectFill
+        iconImageView.clipsToBounds = true
+        iconImageView.backgroundColor = UIColor.white
+        return iconImageView
+    }()
+
+    lazy var nickNameLab: UILabel = {
+        let nickNameLab = UILabel()
+        nickNameLab.textColor = .black
+        nickNameLab.numberOfLines = 1
+        nickNameLab.lineBreakMode = .byCharWrapping
+        nickNameLab.font = UIFont.systemFont(ofSize: 24, weight: .bold)
+        return nickNameLab
+    }()
+
+    lazy var productsLabel: UILabel = {
+        let productsLabel = UILabel()
+        productsLabel.textColor = UIColor(white: 0, alpha: 0.5)
+        productsLabel.numberOfLines = 1
+        productsLabel.lineBreakMode = .byCharWrapping
+        productsLabel.font = UIFont.systemFont(ofSize: 14, weight: .semibold)
+        return productsLabel
+    }()
+
+    init(frame: CGRect, margin: CGFloat = 16) {
+        super.init(frame: frame)
+        leftMargin = margin
+        addSubview(iconImageView)
+        addSubview(nickNameLab)
+        addSubview(productsLabel)
+    }
+
+    required init?(coder _: NSCoder) {
+        fatalError("init(coder:) has not been implemented")
+    }
+
+    override func layoutSubviews() {
+        super.layoutSubviews()
+        addData()
+        addLayout()
+    }
+
+    func addData() {
+        iconImageView.setNetImage(url: BFLoginUserInfo.shared.avatarUrl, placeholder: UIImage(named: "wode")!)
+        nickNameLab.text = BFLoginUserInfo.shared.nickName
+        productsLabel.text = "\(Int(BFLoginUserInfo.shared.videos)?.changeUnit() ?? "0") 作品"
+    }
+
+    func addLayout() {
+        let iconH: CGFloat = cDefaultMargin * 7
+        let margin: CGFloat = 12
+        iconImageView.addCorner(corner: iconH / 2)
+        iconImageView.snp.makeConstraints { make in
+            make.width.height.equalTo(iconH)
+            make.top.equalToSuperview().offset(cDefaultMargin / 2)
+            make.left.equalToSuperview().offset(leftMargin)
+        }
+        nickNameLab.snp.makeConstraints { make in
+            make.left.equalTo(iconImageView.snp_right).offset(margin)
+            make.right.equalToSuperview().offset(-leftMargin)
+            make.centerY.equalTo(iconImageView).offset(-margin)
+        }
+        productsLabel.snp.makeConstraints { make in
+            make.left.right.equalTo(nickNameLab)
+            make.centerY.equalTo(iconImageView).offset(margin)
+        }
+    }
+}

+ 23 - 10
MusicVideoPlus/Classes/Modules/Mine/Views/MVMineProductCell.swift

@@ -13,18 +13,27 @@ class MVMineProductCell: UICollectionViewCell {
 
     lazy var coverImageView: UIImageView = {
         let coverImageView = UIImageView()
-        coverImageView.contentMode = .scaleAspectFill
-        coverImageView.clipsToBounds = true
-        coverImageView.isUserInteractionEnabled = true
-        coverImageView.tag = cCellTag
+//        coverImageView.contentMode = .scaleAspectFill
+//        coverImageView.clipsToBounds = true
+        coverImageView.isUserInteractionEnabled = false
+//        coverImageView.tag = cCellTag
         coverImageView.backgroundColor = UIColor.white
+        coverImageView.addCorner(corner: 6)
         return coverImageView
     }()
 
+    lazy var marksView: UIImageView = {
+        let marksView = UIImageView(image: UIImage(named: "home_marks"))
+//        marksView.contentMode = .scaleAspectFill
+//        marksView.clipsToBounds = true
+        marksView.isUserInteractionEnabled = false
+        return marksView
+    }()
+
     lazy var moreBtn: UIButton = {
         let moreBtn = UIButton(type: .custom)
-        moreBtn.setImage(UIImage(named: "video_pause"), for: .selected)
-        moreBtn.setImage(nil, for: .normal)
+        let image: UIImage = UIImage(named: "icon_video_point")!
+        moreBtn.setImage(UIImage(cgImage: image.cgImage!, scale: image.scale, orientation: .left), for: .normal)
         moreBtn.tag = 1
         moreBtn.addTarget(self, action: #selector(btnClick(sender:)), for: .touchUpInside)
         return moreBtn
@@ -43,6 +52,7 @@ class MVMineProductCell: UICollectionViewCell {
     override init(frame: CGRect) {
         super.init(frame: frame)
         contentView.addSubview(coverImageView)
+        coverImageView.addSubview(marksView)
         contentView.addSubview(moreBtn)
         contentView.addSubview(titleLabel)
     }
@@ -65,28 +75,31 @@ class MVMineProductCell: UICollectionViewCell {
 
     func addData() {
         let coverImg = (videoData?.videoCoverSnapshotPath != nil && (videoData?.videoCoverSnapshotPath?.count ?? 0) > 0) ? videoData?.videoCoverSnapshotPath ?? "" : videoData?.coverImg?["coverImgPath"] as! String
-        netImage(url: coverImg, mainView: coverImageView)
+        coverImageView.setNetImage(url: coverImg)
         titleLabel.text = videoData?.title ?? ""
     }
 
     func addLayout() {
         let margin: CGFloat = 12
-        let moreH: CGFloat = 56
+        let moreH: CGFloat = 40
 
         coverImageView.snp.remakeConstraints { make in
             make.size.equalToSuperview()
         }
 
+        marksView.snp.remakeConstraints { make in
+            make.width.left.bottom.equalToSuperview()
+        }
+
         moreBtn.snp.remakeConstraints { make in
             make.width.height.equalTo(moreH)
             make.bottom.right.equalToSuperview()
         }
 
         titleLabel.snp.remakeConstraints { make in
-            make.width.height.equalTo(moreH)
             make.centerY.equalTo(moreBtn)
             make.left.equalToSuperview().offset(margin)
-            make.right.equalTo(moreBtn.snp_left).offset(-margin)
+            make.right.equalTo(moreBtn.snp_left)
         }
     }
 

+ 2 - 2
Podfile

@@ -5,10 +5,10 @@ target 'MusicVideoPlus' do
   use_frameworks!
   source 'https://github.com/CocoaPods/Specs.git'
   #pod "BFFramework" ,:git => 'https://git.yishihui.com/iOS/BFFramework.git' , :tag => '0.1.1'
-   pod "BFFramework" ,:git => 'https://git.yishihui.com/iOS/BFFramework.git' 
+#   pod "BFFramework" ,:git => 'https://git.yishihui.com/iOS/BFFramework.git'
   # 使用本地路径
   #pod 'BFFramework', :path => '/Users/ak/Desktop/BFFramework/'
-#  pod 'BFFramework', :path => '/Users/sanw/Desktop/BytesFlow/Projects/BFFramework/'
+  pod 'BFFramework', :path => '/Users/sanw/Desktop/BytesFlow/Projects/BFFramework/'
 
   pod 'JWTDecode','2.6.0' # Apple登陆校验库
   pod 'TYAttributedLabel','2.6.9' #  富文本