wenweiwei 4 éve
szülő
commit
6e7c3a294b

BIN
MusicVideoPlus/Assets.xcassets/Mine/icon_video_point.imageset/icon_video_point@2x.png


BIN
MusicVideoPlus/Assets.xcassets/Mine/icon_video_point.imageset/icon_video_point@3x.png


+ 22 - 0
MusicVideoPlus/Assets.xcassets/Mine/play_mask.imageset/Contents.json

@@ -0,0 +1,22 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "filename" : "play_mask@2x.png",
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "filename" : "play_mask@3x.png",
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

BIN
MusicVideoPlus/Assets.xcassets/Mine/play_mask.imageset/play_mask@2x.png


BIN
MusicVideoPlus/Assets.xcassets/Mine/play_mask.imageset/play_mask@3x.png


+ 5 - 5
MusicVideoPlus/Classes/Modules/Mine/Controllers/PQCollectionViewFlowlayout.swift

@@ -47,13 +47,13 @@ class PQCollectionViewFlowlayout: UICollectionViewFlowLayout {
         // 遍历数据计算每个item的属性并布局
         var index = 0
         for data in findList {
-            var itemHeight: CGFloat = 0
+            var scale: CGFloat = 0
             if data is PQVideoListModel {
-                itemHeight = (data as! PQVideoListModel).itemHeight
+                scale = (data as! PQVideoListModel).height / (data as! PQVideoListModel).width
             } else if data is PQEditVisionTrackMaterialsModel {
-                itemHeight = CGFloat((data as! PQEditVisionTrackMaterialsModel).itemHeight)
+                scale = CGFloat((data as! PQEditVisionTrackMaterialsModel).itemHeight / (data as! PQEditVisionTrackMaterialsModel).itemWidth)
             } else {
-                itemHeight = 0
+                scale = 0
             }
             let indexPath = IndexPath(item: index, section: 0)
             let attributes = UICollectionViewLayoutAttributes(forCellWith: indexPath)
@@ -65,7 +65,7 @@ class PQCollectionViewFlowlayout: UICollectionViewFlowLayout {
             let itemX = (itemWidth + minimumInteritemSpacing) * CGFloat(column!) + sectionInset.left
             let itemY = minHeight
             // 等比例缩放 计算item的高度
-            let itemH = itemHeight.isNaN ? 0 : Int(itemHeight)
+            let itemH = Int(itemWidth * scale)
             // 设置frame
             attributes.frame = CGRect(x: itemX, y: CGFloat(itemY), width: itemWidth, height: CGFloat(itemH))
 

+ 2 - 4
MusicVideoPlus/Classes/Modules/Mine/Views/MVMineProductCell.swift

@@ -32,8 +32,7 @@ class MVMineProductCell: UICollectionViewCell {
 
     lazy var moreBtn: UIButton = {
         let moreBtn = UIButton(type: .custom)
-        let image: UIImage = UIImage(named: "icon_video_point")!
-        moreBtn.setImage(UIImage(cgImage: image.cgImage!, scale: image.scale, orientation: .left), for: .normal)
+        moreBtn.setImage(UIImage(named: "icon_video_point"), for: .normal)
         moreBtn.tag = 1
         moreBtn.addTarget(self, action: #selector(btnClick(sender:)), for: .touchUpInside)
         return moreBtn
@@ -113,8 +112,7 @@ class MVMineProductCell: UICollectionViewCell {
 
         moreBtn.snp.remakeConstraints { make in
             make.width.height.equalTo(moreH)
-            make.right.equalToSuperview()
-            make.bottom.equalToSuperview().offset(-cDefaultMargin)
+            make.right.bottom.equalToSuperview()
         }
 
         titleLabel.snp.remakeConstraints { make in

+ 12 - 1
MusicVideoPlus/Classes/Modules/Mine/Views/MVPlayControlViewCell.swift

@@ -14,7 +14,7 @@ class MVPlayControlViewCell: UICollectionViewCell {
     lazy var coverImageView: UIImageView = {
         let coverImageView = UIImageView()
         coverImageView.contentMode = .scaleAspectFit
-        coverImageView.clipsToBounds = true
+//        coverImageView.clipsToBounds = true
         coverImageView.isUserInteractionEnabled = true
         coverImageView.tag = cCellTag
         coverImageView.backgroundColor = UIColor.black
@@ -23,6 +23,12 @@ class MVPlayControlViewCell: UICollectionViewCell {
         return coverImageView
     }()
 
+    lazy var maskImageView: UIImageView = {
+        let maskImageView = UIImageView(image: UIImage(named: "play_mask"))
+        maskImageView.contentMode = .scaleAspectFill
+        return maskImageView
+    }()
+
     lazy var pauseBtn: UIButton = {
         let pauseBtn = UIButton(type: .custom)
         pauseBtn.setImage(UIImage(named: "video_pause"), for: .selected)
@@ -155,6 +161,7 @@ class MVPlayControlViewCell: UICollectionViewCell {
     override init(frame: CGRect) {
         super.init(frame: frame)
         contentView.addSubview(coverImageView)
+        contentView.addSubview(maskImageView)
         contentView.addSubview(pauseBtn)
         contentView.addSubview(watchCountLab)
         contentView.addSubview(nickNameBtn)
@@ -234,6 +241,10 @@ class MVPlayControlViewCell: UICollectionViewCell {
             make.size.equalToSuperview()
         }
 
+        maskImageView.snp.remakeConstraints { make in
+            make.size.equalToSuperview()
+        }
+
         pauseBtn.snp.remakeConstraints { make in
             make.width.height.equalTo(shareW)
             make.centerX.equalToSuperview()