Forráskód Böngészése

支持不可以状态

jsonwang 3 éve
szülő
commit
a9bbc424e0

+ 40 - 8
BFFramework/Classes/Stuckpoint/View/PQSpeedSettingView.swift

@@ -101,14 +101,19 @@ class PQSpeedSettingView: UIView {
     required init?(coder _: NSCoder) {
         fatalError("init(coder:) has not been implemented")
     }
-    
- 
-    
     //设置默认选择的
-    ///
-    /// - Parameter index: 第几位 从0 开始
-    func setSelectItem(index:Int,isSettingPlayer:Bool = true) {
+    /// - Parameters:
+    ///   - index: index: 第几位 从0 开始
+    ///   - isSettingPlayer: 是否重启播放器
+    ///   - setEnable: 设置不可用状态
+    func setSelectItem(index:Int,isSettingPlayer:Bool = true,setDisable:Bool = false) {
        BFLog(message: "setSelectItem is \(index)")
+        //设置不可用状态
+        if(setDisable){
+            for (i,model) in datas.enumerated() {
+                model.isDisable = i == index ? false: true
+            }
+        }
         lastSelectModel?.isSelected = false
         if(viewType == 3){
             if(index > 4 && datas.count < 7){
@@ -153,7 +158,26 @@ extension PQSpeedSettingView: UICollectionViewDelegate, UICollectionViewDataSour
 
     func collectionView(_: UICollectionView, didSelectItemAt indexPath: IndexPath) {
         BFLog(message: "选择了 \(String(describing: datas[indexPath.row]))")
+        if(datas[indexPath.row].isDisable){
+            BFLog(message: "不可用速度")
+            cShowHUB(superView: nil, msg: "素材时长需要大于6秒\n   才可选择其他档位")
+            return
+        }
         setSelectItem(index: indexPath.row)
+        if(viewType == 2){
+            if(lastSelectModel?.title == "自定义"){
+                PQEventTrackViewModel.baseReportUpload(businessType: .bt_buttonClick, objectType: .ot_shanyinApp_musicVideoPreview_selectRatio, pageSource: .sp_stuck_previewSyncedUp, extParams:nil, remindmsg: "")
+            }else{
+                PQEventTrackViewModel.baseReportUpload(businessType: .bt_buttonClick, objectType: .ot_shanyinApp_musicVideoPreview_customizeRatio, pageSource: .sp_stuck_previewSyncedUp, extParams:nil, remindmsg: "")
+            }
+     
+        }else if(viewType == 3){
+            if(lastSelectModel?.title == "自定义"){
+                PQEventTrackViewModel.baseReportUpload(businessType: .bt_buttonClick, objectType: .ot_shanyinApp_musicVideoPreview_customizeRepeatTimes, pageSource: .sp_stuck_previewSyncedUp, extParams:nil, remindmsg: "")
+            }else{
+                PQEventTrackViewModel.baseReportUpload(businessType: .bt_buttonClick, objectType: .ot_shanyinApp_musicVideoPreview_selectRepeatTimes, pageSource: .sp_stuck_previewSyncedUp, extParams:nil, remindmsg: "")
+            }
+        }
  
     }
 
@@ -182,6 +206,8 @@ class PQSpeedTitleModel: NSObject {
     // 最大、最小速度
     var maxSpeed: Float = 0.0
     var minSpeed: Float = 0.0
+    //是否可用
+    var isDisable:Bool = false
     public override init() {
         super.init()
     }
@@ -232,8 +258,14 @@ class PQSpeedTitleCell: UICollectionViewCell {
                 titleLab.textColor = UIColor.hexColor(hexadecimal: PQBFConfig.shared.styleColor.rawValue)
 
             } else {
-                titleLab.backgroundColor = UIColor.hexColor(hexadecimal: "#F9F9F9")
-                titleLab.textColor = UIColor.hexColor(hexadecimal: "#959595")
+                if(titleModel?.isDisable ?? false){
+                    titleLab.backgroundColor = .clear
+                    titleLab.textColor = UIColor.hexColor(hexadecimal: "#DFDFDF")
+                }else{
+                    titleLab.backgroundColor = UIColor.hexColor(hexadecimal: "#F9F9F9")
+                    titleLab.textColor = UIColor.hexColor(hexadecimal: "#959595")
+                }
+              
             }
         }
     }