Parcourir la source

推荐音乐页面

Chris il y a 5 ans
Parent
commit
c3d5da8b62

+ 12 - 0
RainbowPlanet/RainbowPlanet.xcodeproj/project.pbxproj

@@ -617,6 +617,9 @@
 		BDAF83B022B3B63B0004BCC3 /* RecommendCommentHeader.swift in Sources */ = {isa = PBXBuildFile; fileRef = BDAF83AF22B3B63B0004BCC3 /* RecommendCommentHeader.swift */; };
 		BDAF83B222B3B67D0004BCC3 /* RecommendCommentFooter.swift in Sources */ = {isa = PBXBuildFile; fileRef = BDAF83B122B3B67D0004BCC3 /* RecommendCommentFooter.swift */; };
 		BDAF83B422B3B6DF0004BCC3 /* RecommendMajorCommentCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = BDAF83B322B3B6DF0004BCC3 /* RecommendMajorCommentCell.swift */; };
+		BDBC0AF222DDD7E800CA788E /* PublishMusicChooseView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BDBC0AF122DDD7E800CA788E /* PublishMusicChooseView.swift */; };
+		BDBC0AF422DDE9BC00CA788E /* PublishRouterModuleType.swift in Sources */ = {isa = PBXBuildFile; fileRef = BDBC0AF322DDE9BC00CA788E /* PublishRouterModuleType.swift */; };
+		BDBC0AF622DDEA4E00CA788E /* PublishRecommendMusicController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BDBC0AF522DDEA4E00CA788E /* PublishRecommendMusicController.swift */; };
 		BDD22F0B228FAA5B00D43BFB /* ImageUrlModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BDD22F0A228FAA5B00D43BFB /* ImageUrlModel.swift */; };
 		BDD4FB1222840597006FE833 /* ShoppingCartPayOrderController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BDD4FB1122840597006FE833 /* ShoppingCartPayOrderController.swift */; };
 		BDD4FB1422840954006FE833 /* ShoppingCartOrderPayView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BDD4FB1322840954006FE833 /* ShoppingCartOrderPayView.swift */; };
@@ -1380,6 +1383,9 @@
 		BDAF83AF22B3B63B0004BCC3 /* RecommendCommentHeader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RecommendCommentHeader.swift; sourceTree = "<group>"; };
 		BDAF83B122B3B67D0004BCC3 /* RecommendCommentFooter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RecommendCommentFooter.swift; sourceTree = "<group>"; };
 		BDAF83B322B3B6DF0004BCC3 /* RecommendMajorCommentCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RecommendMajorCommentCell.swift; sourceTree = "<group>"; };
+		BDBC0AF122DDD7E800CA788E /* PublishMusicChooseView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PublishMusicChooseView.swift; sourceTree = "<group>"; };
+		BDBC0AF322DDE9BC00CA788E /* PublishRouterModuleType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PublishRouterModuleType.swift; sourceTree = "<group>"; };
+		BDBC0AF522DDEA4E00CA788E /* PublishRecommendMusicController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PublishRecommendMusicController.swift; sourceTree = "<group>"; };
 		BDD22F0A228FAA5B00D43BFB /* ImageUrlModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageUrlModel.swift; sourceTree = "<group>"; };
 		BDD4FB1122840597006FE833 /* ShoppingCartPayOrderController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShoppingCartPayOrderController.swift; sourceTree = "<group>"; };
 		BDD4FB1322840954006FE833 /* ShoppingCartOrderPayView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShoppingCartOrderPayView.swift; sourceTree = "<group>"; };
@@ -3500,6 +3506,7 @@
 				A7DAB33422D8D3AC005B964E /* RegisterLoginRouterModuleType.swift */,
 				A7DAB33822DC2B83005B964E /* ShareRouterModuleType.swift */,
 				A73A56D422DC5E34004920FE /* UMPushRouterModuleType.swift */,
+				BDBC0AF322DDE9BC00CA788E /* PublishRouterModuleType.swift */,
 			);
 			path = Router;
 			sourceTree = "<group>";
@@ -4952,7 +4959,9 @@
 		BD5CA89022DD719000364A67 /* PublishMusicAbout */ = {
 			isa = PBXGroup;
 			children = (
+				BDBC0AF122DDD7E800CA788E /* PublishMusicChooseView.swift */,
 				BD5CA89122DD73A500364A67 /* PublishMusicVolumnView.swift */,
+				BDBC0AF522DDEA4E00CA788E /* PublishRecommendMusicController.swift */,
 			);
 			path = PublishMusicAbout;
 			sourceTree = "<group>";
@@ -6199,8 +6208,10 @@
 				BDF862A1228E41CC000DEF84 /* OrderLogisticsController.swift in Sources */,
 				A72A73162232481600B21995 /* WeChatpayManager.swift in Sources */,
 				A7931E1822AFC1DF00297D0A /* CommunityFollowViewController.swift in Sources */,
+				BDBC0AF422DDE9BC00CA788E /* PublishRouterModuleType.swift in Sources */,
 				A7D5F25022BC7B3700F8E9AF /* WebViewJavascriptBridgeManager.swift in Sources */,
 				A7F2D6D922B250EF0093000B /* CardContentPicVideoTableViewCell.swift in Sources */,
+				BDBC0AF622DDEA4E00CA788E /* PublishRecommendMusicController.swift in Sources */,
 				A7C2568022CD9D8E00420828 /* RecommendSimilarHeaderView.swift in Sources */,
 				A7B4E72D228176060012914A /* ProductMallBarChartCollectionViewCell.swift in Sources */,
 				A70B2C4E22884AE800B2449F /* ProductDetailDescriptionTableViewCell.swift in Sources */,
@@ -6242,6 +6253,7 @@
 				A74322A022B8D1F30017C367 /* MyFollowAndFanViewController.swift in Sources */,
 				BD2FCBE622B2586C0006D974 /* CommunityTagCollectionCell.swift in Sources */,
 				A743229422B88ED30017C367 /* EnumMacro.swift in Sources */,
+				BDBC0AF222DDD7E800CA788E /* PublishMusicChooseView.swift in Sources */,
 				BD1DC6C9228D005000B89C57 /* OrderCreateParameterModel.swift in Sources */,
 				A7BF203422B47E8600396DB3 /* CardContentActionTableViewCell.swift in Sources */,
 				A71AA52622732068008FF1A5 /* SwiftMoyaServiceConfigApi.swift in Sources */,

+ 6 - 2
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/VideoEdit/Controller/AliyunEditViewController.m

@@ -109,8 +109,10 @@ AliyunIExporterCallback, AliyunIPlayerCallback, AliyunMusicPickViewControllerDel
 @property(nonatomic, strong) AliyunMusicPickModel *music; //之前应用的音乐
 @property(nonatomic, assign) NSInteger tab; //之前应用的音乐的所属
 
-// 配乐/音量のView
+// 音量のView
 @property (nonatomic, strong) PublishMusicVolumnView *volumnView;
+// 配乐のView
+@property (nonatomic, strong) PublishMusicChooseView *musicView;
 
 /**
  当前控制器是否可见
@@ -1146,7 +1148,9 @@ AliyunIExporterCallback, AliyunIPlayerCallback, AliyunMusicPickViewControllerDel
 //    vc.delegate = self;
 //    [self.navigationController pushViewController:vc animated:YES];
     
-    self.volumnView = [PublishMusicVolumnView publishMusicVolumnView];
+//    self.volumnView = [PublishMusicVolumnView publishMusicVolumnView];
+    self.musicView = [PublishMusicChooseView publishMusicChooseView];
+    
 }
 
 //时间特效

+ 186 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/PublishMusicAbout/PublishMusicChooseView.swift

@@ -0,0 +1,186 @@
+//
+//  PublishMusicChooseView.swift
+//  RainbowPlanet
+//
+//  Created by Christopher on 2019/7/16.
+//  Copyright © 2019 RainbowPlanet. All rights reserved.
+//  选择音乐のView
+
+import UIKit
+import FWPopupView
+import RxSwift
+import SwiftyMediator
+
+class PublishMusicChooseView: FWPopupView {
+    
+    let disposeBag = DisposeBag()
+    
+    typealias RecommendClosure = () -> Void
+    var recommendClosure : RecommendClosure?
+    
+    override init(frame: CGRect) {
+        super.init(frame: frame)
+        setupViews()
+        setupLayouts()
+    }
+    
+    required init?(coder aDecoder: NSCoder) {
+        fatalError("init(coder:) has not been implemented")
+    }
+    
+    func setupViews() {
+        frame = CGRect(x: 0, y: 0, width: kScreenWidth, height: kScreenHeight - kSafeTabBarHeight - kSafeStatusBarHeight - 22)
+        backgroundColor = UIColor(hexString: "000000", alpha: 0.5)
+        configRectCorner(corner: [.topLeft,.topRight], radii: CGSize(width: 8, height: 8))
+        
+        addSubview(cancelButton)
+        
+        addSubview(recommendLabel)
+        addSubview(recommendButton)
+        
+        addSubview(sepLineView)
+        addSubview(musicButton)
+        addSubview(volumnButton)
+        addSubview(v_lineLabel)
+    }
+    
+    func setupLayouts() {
+        
+        cancelButton.snp.makeConstraints { (make) in
+            make.top.equalTo(2)
+            make.left.equalTo(3)
+            make.size.equalTo(44)
+        }
+        
+        // 底部分割线
+        sepLineView.snp.makeConstraints { (make) in
+            make.left.right.equalToSuperview()
+            make.bottom.equalTo(-48-kSafeStatusBarHeight)
+            make.height.equalTo(0.5)
+        }
+        
+        recommendLabel.snp.makeConstraints { (make) in
+            make.centerX.equalTo(kScreenWidth*0.5-20)
+            make.bottom.equalTo(sepLineView.snp_top).offset(-20)
+            make.height.equalTo(20)
+        }
+        recommendButton.snp.makeConstraints { (make) in
+            make.left.equalTo(recommendLabel.snp_right)
+            make.height.equalTo(30)
+            make.centerY.equalTo(recommendLabel.snp_centerY)
+            make.width.equalTo(60)
+        }
+        
+        musicButton.snp.makeConstraints { (make) in
+            make.centerX.equalTo(kScreenWidth*0.25)
+            make.bottom.equalTo(-17-kSafeStatusBarHeight)
+            make.width.equalTo(40)
+            make.height.equalTo(21)
+        }
+        volumnButton.snp.makeConstraints { (make) in
+            make.centerX.equalTo(kScreenWidth*0.75)
+            make.bottom.equalTo(-17-kSafeStatusBarHeight)
+            make.width.equalTo(40)
+            make.height.equalTo(21)
+        }
+        v_lineLabel.snp.makeConstraints { (make) in
+            make.centerX.equalTo(volumnButton.snp_centerX)
+            make.width.equalTo(20)
+            make.height.equalTo(3)
+            make.bottom.equalTo(-11-kSafeStatusBarHeight)
+        }
+        
+    }
+    
+    lazy var cancelButton: UIButton = {
+        let cancelButton = UIButton(type: UIButton.ButtonType.custom)
+        cancelButton.setImage(kImage(name: "video_btn_close_white"), for: .normal)
+        return cancelButton
+    }()
+    
+    lazy var recommendLabel: UILabel = {
+        let recommendLabel = UILabel()
+        recommendLabel.text = "没有找到想要的音乐?"
+        recommendLabel.textColor = k999999Color
+        recommendLabel.font = kRegularFont14
+        return recommendLabel
+    }()
+    
+    lazy var recommendButton: UIButton = {
+        let recommendButton = UIButton(type: UIButton.ButtonType.custom)
+        recommendButton.setTitle("点击推荐", for: UIControl.State.normal)
+        recommendButton.setTitleColor(kffffffColor, for: UIControl.State.normal)
+        recommendButton.titleLabel?.font = kMediumFont14
+        return recommendButton
+    }()
+    
+    lazy var sepLineView: UIView = {
+        let sepLineView = UIView()
+        sepLineView.backgroundColor = k999999Color
+        return sepLineView
+    }()
+    
+    lazy var musicButton: UIButton = {
+        let musicButton = UIButton(type: UIButton.ButtonType.custom)
+        musicButton.setTitle("配乐", for: UIControl.State.normal)
+        musicButton.setTitleColor(k999999Color, for: UIControl.State.normal)
+        musicButton.titleLabel?.font = kRegularFont16
+        return musicButton
+    }()
+    
+    lazy var volumnButton: UIButton = {
+        let volumnButton = UIButton(type: UIButton.ButtonType.custom)
+        volumnButton.setTitle("音量", for: UIControl.State.normal)
+        volumnButton.setTitleColor(kffffffColor, for: UIControl.State.normal)
+        volumnButton.titleLabel?.font = kMediumFont17
+        return volumnButton
+    }()
+    
+    lazy var v_lineLabel: UILabel = {
+        let v_lineLabel = UILabel()
+        v_lineLabel.backgroundColor = kffffffColor
+        v_lineLabel.cornerRadius = 1
+        return v_lineLabel
+    }()
+    
+    
+    /// 初始化View
+    @objc class func publishMusicChooseView() -> PublishMusicChooseView {
+        let view = PublishMusicChooseView()
+        let vProperty = FWPopupViewProperty()
+        vProperty.popupCustomAlignment = .bottomCenter
+        vProperty.popupViewEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
+        vProperty.popupAnimationType = .scale
+        vProperty.maskViewColor = UIColor(white: 0, alpha: 0.2)
+        vProperty.touchWildToHide = "1"
+        view.vProperty = vProperty
+        view.show()
+        
+        view.cancelButton.rx.tap.subscribe(onNext: { (data) in
+            print("----点击了-取消")
+            view.hide()
+            
+        }).disposed(by: view.disposeBag)
+        
+        
+        view.recommendButton.rx.tap.subscribe(onNext: {
+            [weak view] (data) in
+            view?.hide()
+            Mediator.push(PublishRouterModuleType.push)
+            
+        }).disposed(by: view.disposeBag)
+        
+        view.musicButton.rx.tap.subscribe(onNext: { (data) in
+            print("----点击了-配乐")
+            
+        }).disposed(by: view.disposeBag)
+        
+        view.volumnButton.rx.tap.subscribe(onNext: { (data) in
+            print("----点击了-音量")
+            
+        }).disposed(by: view.disposeBag)
+        
+        return view
+    }
+    
+}

+ 11 - 11
RainbowPlanet/RainbowPlanet/Modules/PublishModule/PublishMusicAbout/PublishMusicVolumnView.swift

@@ -4,7 +4,7 @@
 //
 //  Created by Christopher on 2019/7/16.
 //  Copyright © 2019 RainbowPlanet. All rights reserved.
-//
+//  音量调节のView
 
 import UIKit
 import FWPopupView
@@ -28,7 +28,7 @@ class PublishMusicVolumnView: FWPopupView {
     }
     
     func setupViews() {
-        frame = CGRect(x: 0, y: 0, width: kScreenWidth, height: 177)
+        frame = CGRect(x: 0, y: 0, width: kScreenWidth, height: 177 + kSafeStatusBarHeight)
         backgroundColor = UIColor(hexString: "000000", alpha: 0.5)
         configRectCorner(corner: [.topLeft,.topRight], radii: CGSize(width: 8, height: 8))
         
@@ -85,13 +85,13 @@ class PublishMusicVolumnView: FWPopupView {
         
         musicButton.snp.makeConstraints { (make) in
             make.centerX.equalTo(kScreenWidth*0.25)
-            make.bottom.equalTo(-17)
+            make.bottom.equalTo(-17-kSafeStatusBarHeight)
             make.width.equalTo(40)
             make.height.equalTo(21)
         }
         volumnButton.snp.makeConstraints { (make) in
             make.centerX.equalTo(kScreenWidth*0.75)
-            make.bottom.equalTo(-17)
+            make.bottom.equalTo(-17-kSafeStatusBarHeight)
             make.width.equalTo(40)
             make.height.equalTo(21)
         }
@@ -99,7 +99,7 @@ class PublishMusicVolumnView: FWPopupView {
             make.centerX.equalTo(volumnButton.snp_centerX)
             make.width.equalTo(20)
             make.height.equalTo(3)
-            make.bottom.equalTo(-11)
+            make.bottom.equalTo(-11-kSafeStatusBarHeight)
         }
     }
     
@@ -109,6 +109,12 @@ class PublishMusicVolumnView: FWPopupView {
         return cancelButton
     }()
     
+    lazy var applyButton: UIButton = {
+        let applyButton = UIButton(type: UIButton.ButtonType.custom)
+        applyButton.setImage(kImage(name: "nav_finish_white"), for: .normal)
+        return applyButton
+    }()
+    
     lazy var originLabel: UILabel = {
         let originLabel = UILabel()
         originLabel.text = "原声"
@@ -153,12 +159,6 @@ class PublishMusicVolumnView: FWPopupView {
         return backLabel
     }()
     
-    lazy var applyButton: UIButton = {
-        let applyButton = UIButton(type: UIButton.ButtonType.custom)
-        applyButton.setImage(kImage(name: "nav_finish_white"), for: .normal)
-        return applyButton
-    }()
-    
     lazy var musicButton: UIButton = {
         let musicButton = UIButton(type: UIButton.ButtonType.custom)
         musicButton.setTitle("配乐", for: UIControl.State.normal)

+ 131 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/PublishMusicAbout/PublishRecommendMusicController.swift

@@ -0,0 +1,131 @@
+//
+//  PublishRecommendMusicController.swift
+//  RainbowPlanet
+//
+//  Created by Christopher on 2019/7/16.
+//  Copyright © 2019 RainbowPlanet. All rights reserved.
+//  推荐音乐
+
+import UIKit
+import IQKeyboardManagerSwift
+
+class PublishRecommendMusicController: BaseViewController {
+    
+    override func viewDidLoad() {
+        
+        super.viewDidLoad()
+        setupViews()
+        setupLayouts()
+        setupData()
+    }
+    
+    override func setupViews() {
+        statusBarStyle = .lightContent
+        navigationBar.barBackgroundColor = UIColor.black
+        navigationBar.title = "推荐音乐"
+        navigationBar.titleLabelColor = kffffffColor
+        navigationBar.wr_setLeftButton(image: kImage(name: "navbar_back_white")!)
+        self.view.backgroundColor = UIColor.black
+        
+        navigationBar.wr_setRightButton(title: "提交", titleColor: kffffffColor)
+        navigationBar.rightButton.titleLabel!.font = kRegularFont14
+        navigationBar.onClickRightButton = {
+            [weak self] in
+            print("----点击了-提交")
+            
+        }
+        
+        view.addSubview(cardBackView)
+        cardBackView.addSubview(sepLineView)
+        cardBackView.addSubview(nameTextView)
+        cardBackView.addSubview(linkTextView)
+    }
+    
+    override func setupLayouts() {
+        cardBackView.snp.makeConstraints { (make) in
+            make.top.equalTo(kSafeStatusBarHeight + 44 + 20)
+            make.left.equalTo(14)
+            make.right.equalTo(-14)
+            make.height.equalTo(160)
+        }
+        sepLineView.snp.makeConstraints { (make) in
+            make.top.equalTo(80)
+            make.left.equalTo(15)
+            make.right.equalTo(-15)
+            make.height.equalTo(0.5)
+        }
+        nameTextView.snp.makeConstraints { (make) in
+            make.top.equalTo(20)
+            make.left.equalTo(15)
+            make.right.equalTo(-15)
+            make.height.equalTo(40)
+        }
+        linkTextView.snp.makeConstraints { (make) in
+            make.bottom.equalTo(-20)
+            make.left.equalTo(15)
+            make.right.equalTo(-15)
+            make.height.equalTo(40)
+        }
+    }
+    
+    override func setupData() {
+        
+        
+    }
+    
+    lazy var cardBackView: UIView = {
+        let cardBackView = UIView()
+        cardBackView.backgroundColor = kffffffColor
+        cardBackView.cornerRadius = 8
+        cardBackView.masksToBounds = true
+        return cardBackView
+    }()
+    
+    lazy var sepLineView: UIView = {
+        let sepLineView = UIView()
+        sepLineView.backgroundColor = k999999Color
+        return sepLineView
+    }()
+    
+    private lazy var nameTextView: IQTextView = {
+        let nameTextView = IQTextView()
+        nameTextView.backgroundColor = kffffffColor
+        nameTextView.textColor = UIColor.black
+        nameTextView.font = kRegularFont16
+        nameTextView.placeholder = "输入歌曲名称"
+        nameTextView.placeholderTextColor = k999999Color
+        nameTextView.delegate = self
+        return nameTextView
+    }()
+    
+    private lazy var linkTextView: IQTextView = {
+        let linkTextView = IQTextView()
+        linkTextView.backgroundColor = kffffffColor
+        linkTextView.textColor = UIColor.black
+        linkTextView.font = kRegularFont16
+        linkTextView.placeholder = "输入歌曲链接(选填)"
+        linkTextView.placeholderTextColor = k999999Color
+        linkTextView.delegate = self
+        return linkTextView
+    }()
+    
+}
+
+extension PublishRecommendMusicController: UITextViewDelegate {
+    func textViewDidChange(_ textView: UITextView) {
+        if textView == nameTextView {
+            var fullStr = textView.text ?? ""
+            if textView.text?.count ?? 0 > 180 {
+                fullStr = String(fullStr.prefix(150)) as String
+                textView.text = fullStr
+            }
+        } else if textView == linkTextView {
+            var fullStr = textView.text ?? ""
+            if textView.text?.count ?? 0 > 180 {
+                fullStr = String(fullStr.prefix(150)) as String
+                textView.text = fullStr
+            }
+        }
+    }
+    
+}

+ 27 - 0
RainbowPlanet/RainbowPlanet/Router/PublishRouterModuleType.swift

@@ -0,0 +1,27 @@
+//
+//  PublishRouterModuleType.swift
+//  RainbowPlanet
+//
+//  Created by Christopher on 2019/7/16.
+//  Copyright © 2019 RainbowPlanet. All rights reserved.
+//
+
+import Foundation
+import SwiftyMediator
+
+/// 推荐音乐
+public enum PublishRouterModuleType: MediatorTargetType {
+    case push
+}
+
+extension PublishRouterModuleType: MediatorSourceType {
+    public var viewController: UIViewController? {
+        switch self {
+        case .push:
+            let vc = PublishRecommendMusicController()
+            return vc
+        }
+    }
+}
+
+