Ver código fonte

登录+ 设置界面

jsonwang 4 anos atrás
pai
commit
48ec0240d2

+ 26 - 6
MusicVideoPlus/MusicVideoPlus.xcodeproj/project.pbxproj

@@ -14,11 +14,16 @@
 		41CA6E662667887C00874B19 /* MVMineController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 41CA6E652667887C00874B19 /* MVMineController.swift */; };
 		41CA6E69266788C000874B19 /* MVLoginController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 41CA6E68266788C000874B19 /* MVLoginController.swift */; };
 		41CA6E6C266788F700874B19 /* MVPlayerConntroller.swift in Sources */ = {isa = PBXBuildFile; fileRef = 41CA6E6B266788F700874B19 /* MVPlayerConntroller.swift */; };
+		41CA6E702667953700874B19 /* MVSettingController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 41CA6E6F2667953700874B19 /* MVSettingController.swift */; };
+		41CA6F4B26689F4400874B19 /* PQMineViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 41CA6F4A26689F4400874B19 /* PQMineViewModel.swift */; };
+		41CA6F782668B80D00874B19 /* PQPhoneLoginController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 41CA6F772668B80D00874B19 /* PQPhoneLoginController.swift */; };
 		94FE06D694DF52C85DEDA82B /* Pods_MusicVideoPlus.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3FA19A38D145C54301B3CD85 /* Pods_MusicVideoPlus.framework */; };
 /* End PBXBuildFile section */
 
 /* Begin PBXFileReference section */
 		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>"; };
 		4185322C2665342100DCA2C1 /* MusicVideoPlus.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MusicVideoPlus.app; sourceTree = BUILT_PRODUCTS_DIR; };
 		4185322F2665342100DCA2C1 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
 		418532382665342200DCA2C1 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
@@ -28,6 +33,9 @@
 		41CA6E652667887C00874B19 /* MVMineController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MVMineController.swift; sourceTree = "<group>"; };
 		41CA6E68266788C000874B19 /* MVLoginController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MVLoginController.swift; sourceTree = "<group>"; };
 		41CA6E6B266788F700874B19 /* MVPlayerConntroller.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MVPlayerConntroller.swift; sourceTree = "<group>"; };
+		41CA6E6F2667953700874B19 /* MVSettingController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MVSettingController.swift; sourceTree = "<group>"; };
+		41CA6F4A26689F4400874B19 /* PQMineViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PQMineViewModel.swift; sourceTree = "<group>"; };
+		41CA6F772668B80D00874B19 /* PQPhoneLoginController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PQPhoneLoginController.swift; sourceTree = "<group>"; };
 		BA41A7982C015630B0037270 /* Pods-MusicVideoPlus.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MusicVideoPlus.debug.xcconfig"; path = "Target Support Files/Pods-MusicVideoPlus/Pods-MusicVideoPlus.debug.xcconfig"; sourceTree = "<group>"; };
 		FA6E2A72ECD6573604333FD8 /* Pods-MusicVideoPlus.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MusicVideoPlus.release.xcconfig"; path = "Target Support Files/Pods-MusicVideoPlus/Pods-MusicVideoPlus.release.xcconfig"; sourceTree = "<group>"; };
 /* End PBXFileReference section */
@@ -65,10 +73,12 @@
 		4185322E2665342100DCA2C1 /* MusicVideoPlus */ = {
 			isa = PBXGroup;
 			children = (
+				4112DCF02668C45B00A5AFD9 /* MusicVideoPlus.entitlements */,
 				41CA6E39266782C900874B19 /* Classes */,
 				4185322F2665342100DCA2C1 /* AppDelegate.swift */,
 				418532382665342200DCA2C1 /* Assets.xcassets */,
 				4185323D2665342200DCA2C1 /* Info.plist */,
+				4112DD492668D6A600A5AFD9 /* MusicVideoPlus-Bridging-Header.h */,
 			);
 			path = MusicVideoPlus;
 			sourceTree = "<group>";
@@ -227,6 +237,7 @@
 		41CA6E4B266782C900874B19 /* Controllers */ = {
 			isa = PBXGroup;
 			children = (
+				41CA6E6F2667953700874B19 /* MVSettingController.swift */,
 			);
 			path = Controllers;
 			sourceTree = "<group>";
@@ -252,6 +263,7 @@
 		41CA6E4E266782C900874B19 /* ViewModels */ = {
 			isa = PBXGroup;
 			children = (
+				41CA6F4A26689F4400874B19 /* PQMineViewModel.swift */,
 			);
 			path = ViewModels;
 			sourceTree = "<group>";
@@ -266,6 +278,7 @@
 		41CA6E50266782C900874B19 /* Controllers */ = {
 			isa = PBXGroup;
 			children = (
+				41CA6F772668B80D00874B19 /* PQPhoneLoginController.swift */,
 				41CA6E68266788C000874B19 /* MVLoginController.swift */,
 			);
 			path = Controllers;
@@ -393,8 +406,8 @@
 				418532282665342100DCA2C1 /* Sources */,
 				418532292665342100DCA2C1 /* Frameworks */,
 				4185322A2665342100DCA2C1 /* Resources */,
-				2E2B1B077B208593EACAD1EF /* [CP] Embed Pods Frameworks */,
-				7742628E8B3E02ABB9DBBAC0 /* [CP] Copy Pods Resources */,
+				3115904EEDD5A7932018A62B /* [CP] Embed Pods Frameworks */,
+				9D93C15AA6F8E12D99470881 /* [CP] Copy Pods Resources */,
 			);
 			buildRules = (
 			);
@@ -471,7 +484,7 @@
 			shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n    # print error to STDERR\n    echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n    exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
 			showEnvVarsInLog = 0;
 		};
-		2E2B1B077B208593EACAD1EF /* [CP] Embed Pods Frameworks */ = {
+		3115904EEDD5A7932018A62B /* [CP] Embed Pods Frameworks */ = {
 			isa = PBXShellScriptBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
@@ -488,7 +501,7 @@
 			shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-MusicVideoPlus/Pods-MusicVideoPlus-frameworks.sh\"\n";
 			showEnvVarsInLog = 0;
 		};
-		7742628E8B3E02ABB9DBBAC0 /* [CP] Copy Pods Resources */ = {
+		9D93C15AA6F8E12D99470881 /* [CP] Copy Pods Resources */ = {
 			isa = PBXShellScriptBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
@@ -512,11 +525,14 @@
 			isa = PBXSourcesBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
+				41CA6E702667953700874B19 /* MVSettingController.swift in Sources */,
 				41CA6E6C266788F700874B19 /* MVPlayerConntroller.swift in Sources */,
 				41CA6E5E266782EC00874B19 /* MVBaseController.swift in Sources */,
 				41CA6E632667853C00874B19 /* MVHomeController.swift in Sources */,
 				41CA6E69266788C000874B19 /* MVLoginController.swift in Sources */,
 				41CA6E662667887C00874B19 /* MVMineController.swift in Sources */,
+				41CA6F4B26689F4400874B19 /* PQMineViewModel.swift in Sources */,
+				41CA6F782668B80D00874B19 /* PQPhoneLoginController.swift in Sources */,
 				418532302665342100DCA2C1 /* AppDelegate.swift in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
@@ -647,6 +663,7 @@
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
 				ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
 				ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
+				CODE_SIGN_ENTITLEMENTS = MusicVideoPlus/MusicVideoPlus.entitlements;
 				CODE_SIGN_STYLE = Automatic;
 				CURRENT_PROJECT_VERSION = 1000;
 				DEVELOPMENT_TEAM = UH52C8A7SN;
@@ -657,8 +674,9 @@
 					"@executable_path/Frameworks",
 				);
 				MARKETING_VERSION = 1.0.0;
-				PRODUCT_BUNDLE_IDENTIFIER = com.piaoquan.shanyin;
+				PRODUCT_BUNDLE_IDENTIFIER = com.piaoquan.pqspeed;
 				PRODUCT_NAME = "$(TARGET_NAME)";
+				SWIFT_OBJC_BRIDGING_HEADER = "MusicVideoPlus/MusicVideoPlus-Bridging-Header.h";
 				SWIFT_VERSION = 5.0;
 				TARGETED_DEVICE_FAMILY = 1;
 			};
@@ -671,6 +689,7 @@
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
 				ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
 				ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
+				CODE_SIGN_ENTITLEMENTS = MusicVideoPlus/MusicVideoPlus.entitlements;
 				CODE_SIGN_STYLE = Automatic;
 				CURRENT_PROJECT_VERSION = 1000;
 				DEVELOPMENT_TEAM = UH52C8A7SN;
@@ -681,8 +700,9 @@
 					"@executable_path/Frameworks",
 				);
 				MARKETING_VERSION = 1.0.0;
-				PRODUCT_BUNDLE_IDENTIFIER = com.piaoquan.shanyin;
+				PRODUCT_BUNDLE_IDENTIFIER = com.piaoquan.pqspeed;
 				PRODUCT_NAME = "$(TARGET_NAME)";
+				SWIFT_OBJC_BRIDGING_HEADER = "MusicVideoPlus/MusicVideoPlus-Bridging-Header.h";
 				SWIFT_VERSION = 5.0;
 				TARGETED_DEVICE_FAMILY = 1;
 			};

+ 26 - 1
MusicVideoPlus/MusicVideoPlus/AppDelegate.swift

@@ -6,7 +6,7 @@
 //
 
 import UIKit
-
+import BFFramework
 @main
 class AppDelegate: UIResponder, UIApplicationDelegate {
 
@@ -23,11 +23,36 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
         window?.rootViewController = navigationController
 
         window?.makeKeyAndVisible()
+        
+        let wxappInfo = WXApiInfo.init()
+        wxappInfo.state = "com.piaoquan.pqspeed"
+        wxappInfo.appid = "wxfc2fc07ab379e4bf"
+        wxappInfo.secret = "06f696424accb17b7234dce32e4821b4"
+        wxappInfo.universalLink = "https://speed.piaoquantv.com/"
+        wxappInfo.scope = "snsapi_userinfo"
+        PQSingletoWXApiUtil.shared.registerApp(appInfo: wxappInfo)
+        
+        
         return true
  
     }
 
  
+    func application(_: UIApplication, continue userActivity: NSUserActivity, restorationHandler _: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
+        return PQSingletoWXApiUtil.shared.handleOpenUniversalLink(userActivity: userActivity)
+    }
+
+    func application(_: UIApplication, open url: URL, options _: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool {
+        return PQSingletoWXApiUtil.shared.handleOpen(url: url)
+    }
+
+    func application(_: UIApplication, handleOpen url: URL) -> Bool {
+        return PQSingletoWXApiUtil.shared.handleOpen(url: url)
+    }
+
+    func application(_: UIApplication, open url: URL, sourceApplication _: String?, annotation _: Any) -> Bool {
+        return PQSingletoWXApiUtil.shared.handleOpen(url: url)
+    }
 
 
 }

+ 162 - 5
MusicVideoPlus/MusicVideoPlus/Classes/Modules/Base/Controllers/MVBaseController.swift

@@ -4,14 +4,171 @@
 //
 //  Created by ak on 2021/6/2.
 //
-
-import Foundation
+ 
+import Alamofire
 import UIKit
+import NXFramework_Swift
+import BFFramework
+public class MVBaseController: UIViewController, UIGestureRecognizerDelegate {
+    // 侧滑拦截返回
+    public var popGestureHandle: (() -> Void)?
+    public var naviTitle: String? // 标题
+    public var rightButton: UIButton? // 右边按钮
+    public var backButton: UIButton? // 左边按钮
+    public var navTitleLabel: UILabel? // 标题
+    public var navHeadImageView: UIImageView? // 导航条
+    public var isHiddenStatus: Bool = false { // 更新状态栏
+        didSet {
+            setNeedsStatusBarAppearanceUpdate()
+        }
+    }
+
+    lazy public var manager: NetworkReachabilityManager? = {
+        let manager = NetworkReachabilityManager(host: "www.baidu.com")
+        manager?.listener = { status in
+            if status == .reachable(.wwan) || status == .reachable(.ethernetOrWiFi) {
+           
+            }
+        }
+        return manager
+    }()
 
-class MVBaseController: UIViewController{
-    
-    override func viewDidLoad() {
+     override public func viewDidLoad() {
+        super.viewDidLoad()
+        navigationController?.isNavigationBarHidden = true
         view.backgroundColor = UIColor.white
+
+        navHeadImageView = UIImageView(image: UIImage())
+        navHeadImageView?.isUserInteractionEnabled = true
+        navHeadImageView?.backgroundColor = UIColor.white
+        navHeadImageView?.frame = CGRect(x: 0, y: 0, width: cScreenWidth, height: cDevice_iPhoneNavBarAndStatusBarHei)
+        view.addSubview(navHeadImageView!)
+ 
+        UINavigationBar.appearance().setBackgroundImage(UIImage(), for: .default)
+        automaticallyAdjustsScrollViewInsets = false
+        navigationController?.interactivePopGestureRecognizer?.delegate = self
+        fd_prefersNavigationBarHidden = true
+    }
+
+    public func hiddenNavigation() {
+        navHeadImageView?.isHidden = true
+
+    }
+
+    func showNavigation() {
+        if navHeadImageView != nil {
+            navHeadImageView?.isHidden = false
+
+            view.bringSubviewToFront(navHeadImageView!)
+        }
+    }
+
+    public func leftBackButton() {
+        leftButton(image: "icon_detail_back")
+    }
+
+    func leftButton(image: String?) {
+        let leftButton = UIButton(type: .custom)
+        leftButton.frame = CGRect(x: 0, y: cDevice_iPhoneStatusBarHei, width: cDefaultMargin * 4, height: cDefaultMargin * 4)
+        leftButton.imageEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: -5, right: 0)
+        leftButton.setImage(UIImage(named:  image ?? "icon_detail_back"), for: .normal)
+        leftButton.addTarget(self, action: #selector(backBtnClick), for: .touchUpInside)
+        navHeadImageView?.addSubview(leftButton)
+        backButton = leftButton
+    }
+
+    func rightButtonItem(image: String?, title: String?) {
+        let rightButtonItem = UIButton(type: .custom)
+        var rightW: CGFloat = cDefaultMargin
+        if title != nil, title?.count ?? 0 > 0 {
+            rightW = rightW + sizeWithText(text: title ?? "", font: UIFont.systemFont(ofSize: 16), size: CGSize(width: CGFloat.greatestFiniteMagnitude, height: cDefaultMargin * 4)).width
+            rightButtonItem.setTitle(title, for: .normal)
+            rightButtonItem.setTitleColor(UIColor.hexColor(hexadecimal: "#242F44"), for: .normal)
+            rightButtonItem.titleLabel?.font = UIFont.systemFont(ofSize: 16)
+        }
+        if image != nil, image?.count ?? 0 > 0 {
+            rightW = rightW + cDefaultMargin * 4
+            rightButtonItem.setImage(UIImage(named: image ?? ""), for: .normal)
+            rightButtonItem.imageEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: (title != nil && title?.count ?? 0 > 0) ? 0 : -5, right: 0)
+        }
+        rightButtonItem.adjustsImageWhenHighlighted = false
+        rightButtonItem.frame = CGRect(x: cScreenWidth - rightW, y: cDevice_iPhoneStatusBarHei, width: rightW, height: cDefaultMargin * 4)
+        rightButtonItem.addTarget(self, action: #selector(rightBtnClick(sender:)), for: .touchUpInside)
+        rightButtonItem.contentHorizontalAlignment = .center
+        navHeadImageView?.addSubview(rightButtonItem)
+        rightButton = rightButtonItem
+    }
+
+    func setTitle(title: String?, color: UIColor = UIColor.white) {
+        naviTitle = title
+        if navTitleLabel == nil {
+            let titleLabel = UILabel(frame: CGRect(x: cDefaultMargin * 5, y: cDevice_iPhoneStatusBarHei, width: cScreenWidth - 100, height: cDefaultMargin * 4))
+            titleLabel.textColor = color
+            titleLabel.textAlignment = .center
+            navTitleLabel = titleLabel
+            navHeadImageView?.addSubview(titleLabel)
+        }
+        navTitleLabel?.text = title
+    }
+
+    @objc func rightBtnClick(sender _: UIButton) {}
+
+    @objc func backBtnClick() {
+        navigationController?.popViewController(animated: true)
+    }
+
+    public override func viewDidAppear(_ animated: Bool) {
+        super.viewDidAppear(animated)
+      
+    }
+
+    public override func viewWillDisappear(_ animated: Bool) {
+        super.viewWillDisappear(animated)
+//        PQLoadingHUB.shared.dismissHUB()
+    }
+
+    public override func viewDidDisappear(_ animated: Bool) {
+        super.viewDidDisappear(animated)
+       
+        if view.viewWithTag(cGuideTag) != nil {
+            view.viewWithTag(cGuideTag)?.removeFromSuperview()
+        }
+    }
+
+    deinit {
+        PQNotification.removeObserver(self)
+        BFLog(message: "\(String(describing: type(of: self)))被销毁")
     }
 
+    public override var preferredStatusBarStyle: UIStatusBarStyle {
+        return .lightContent
+    }
+
+    public override var prefersStatusBarHidden: Bool {
+        return isHiddenStatus
+    }
+
+    /// 禁止滑动返回
+    /// - Returns: <#description#>
+    func disablePopGesture() -> MVBaseController {
+        let traget = navigationController?.interactivePopGestureRecognizer?.delegate
+        let pan = UIPanGestureRecognizer(target: traget, action: #selector(popGesture(panGes:)))
+        view.addGestureRecognizer(pan)
+        return self
+    }
+
+    /// 拦截侧滑手势
+    /// - Returns: <#description#>
+    @objc private func popGesture(panGes: UIPanGestureRecognizer) {
+        if panGes.state == .ended, popGestureHandle != nil {
+            popGestureHandle!()
+        }
+    }
+
+    public func gestureRecognizer(_: UIGestureRecognizer, shouldReceive touch: UITouch) -> Bool {
+        if touch.view is UISlider {
+            return false
+        }
+        return true
+    }
 }

+ 91 - 13
MusicVideoPlus/MusicVideoPlus/Classes/Modules/Home/MVHomeController.swift

@@ -7,23 +7,101 @@
  
 import BFFramework
 class MVHomeController: MVBaseController{
+    
+    // 卡点视频 btn
+    lazy var stuckPointBtn: UIButton = {
+        let stuckPointBtn = UIButton(type: .custom)
+        stuckPointBtn.addTarget(self, action: #selector(btnClick(sender:)), for: .touchUpInside)
+        stuckPointBtn.setImage(UIImage(named: "add"), for: .normal)
+        stuckPointBtn.adjustsImageWhenHighlighted = false
+        stuckPointBtn.tag = 2000
+        stuckPointBtn.backgroundColor = UIColor.hexColor(hexadecimal: "#3DC1C1")
+  
+        stuckPointBtn.addCorner(corner: 30)
+
+
+        return stuckPointBtn
+    }()
+    
+    // 个人中心btn
+    lazy var mineBtn: UIButton = {
+        let mineBtn = UIButton(type: .custom)
+        mineBtn.addTarget(self, action: #selector(btnClick(sender:)), for: .touchUpInside)
+        mineBtn.setBackgroundImage(UIImage(named: "wode"), for: .normal)
+        mineBtn.adjustsImageWhenHighlighted = false
+        mineBtn.tag = 1000
+        return mineBtn
+    }()
+    
+    // 设置btn
+    lazy var settingBtn: UIButton = {
+        let settingBtn = UIButton(type: .custom)
+        settingBtn.addTarget(self, action: #selector(btnClick(sender:)), for: .touchUpInside)
+        settingBtn.setBackgroundImage(UIImage(named: "set"), for: .normal)
+        settingBtn.adjustsImageWhenHighlighted = false
+        settingBtn.tag = 3000
+        return settingBtn
+    }()
+    
+    
+    
     override func viewDidLoad() {
         super.viewDidLoad()
-        view.backgroundColor = .red
+        view.addSubview(mineBtn)
+        view.addSubview(stuckPointBtn)
+        view.addSubview(settingBtn)
         
-        let btn = UIButton(type: .contactAdd)
-        btn.frame =  CGRect(x: 100, y: 100, width: 100, height: 100)
-        view.addSubview(btn)
- 
-        btn.addTarget(self, action: #selector(btnClicked), for: .touchUpInside)
+        addLayout()
+  
     }
     
-    @objc func btnClicked() -> String {
-        print("打开界面")
-        BFLog(message: "ssss")
-        navigationController?.pushViewController(PQStuckPointMaterialController(), animated: true)
-        return "111"
-    }
-
+    func addLayout() {
+        
+        mineBtn.snp.remakeConstraints { make in
+            make.width.equalTo(60)
+            make.height.equalTo(60)
+            make.left.equalToSuperview().offset(16)
+            make.bottom.equalToSuperview().offset(-50)
+        }
+        stuckPointBtn.snp.remakeConstraints { make in
+            make.width.equalTo(60)
+            make.height.equalTo(60)
+            make.centerX.equalToSuperview()
+            make.bottom.equalToSuperview().offset(-50)
+        }
+        
+        settingBtn.snp.remakeConstraints { make in
+            make.width.equalTo(60)
+            make.height.equalTo(60)
+            make.right.equalToSuperview().offset(-16)
+            make.bottom.equalToSuperview().offset(-50)
+        }
 
+    }
+    @objc func btnClick(sender: UIButton) {
+        
+        //先判断是否登录
+        if(!BFLoginUserInfo.shared.isLogin() && sender.tag != 3000){
+            navigationController?.present(MVLoginController(), animated: true, completion: nil)
+            return
+        }
+     
+        
+        switch sender.tag {
+       
+        case 1000:
+            navigationController?.pushViewController(MVMineController(), animated: true)
+          break
+        case 2000:
+            navigationController?.pushViewController(PQStuckPointMaterialController(), animated: true)
+            break
+        
+        case 3000:
+            navigationController?.pushViewController(MVSettingController(), animated: true)
+            break
+      
+        default:
+            break
+        }
+    }
 }

+ 319 - 2
MusicVideoPlus/MusicVideoPlus/Classes/Modules/Login/Controllers/MVLoginController.swift

@@ -5,9 +5,326 @@
 //  Created by ak on 2021/6/2.
 //
 
-import Foundation
-class MVLoginController: MVBaseController{
+import AuthenticationServices
+import JWTDecode
+import UIKit
+import BFFramework
+import TYAttributedLabel
 
+class MVLoginController: MVBaseController {
+    let nomalH: CGFloat = cDefaultMargin * 5
 
+    @available(iOS 13.0, *)
+    lazy var appleSignBtn: ASAuthorizationAppleIDButton = {
+        let appleSignBtn: ASAuthorizationAppleIDButton = ASAuthorizationAppleIDButton(type: .signIn, style: .white)
+        appleSignBtn.cornerRadius = nomalH / 2
+        //      appleSignBtn.backgroundColor = UIColor.hexColor(hexadecimal: "#333333")
+        appleSignBtn.isHidden = true
+        appleSignBtn.frame = CGRect(x: 0, y: 0, width: nomalH, height: nomalH)
+        appleSignBtn.center = view.center
+        appleSignBtn.addTarget(self, action: #selector(appleLoginAction), for: .touchUpInside)
+        return appleSignBtn
+    }()
+
+    lazy var protocolLab: TYAttributedLabel = {
+        let protocolLab = TYAttributedLabel()
+        protocolLab.highlightedLinkBackgroundColor = UIColor.black
+        protocolLab.backgroundColor = UIColor.white
+        protocolLab.delegate = self
+        protocolLab.numberOfLines = 0
+        protocolLab.font = UIFont.systemFont(ofSize: 12)
+        protocolLab.textAlignment = CTTextAlignment.center
+        return protocolLab
+    }()
+
+    lazy var loginBtn: UIButton = {
+        let loginBtn = UIButton(type: .custom)
+        loginBtn.addTarget(self, action: #selector(wechatLoginAction), for: .touchUpInside)
+        loginBtn.setTitleColor(UIColor.white, for: .normal)
+        loginBtn.setTitle(" 微信登录", for: .normal)
+        loginBtn.titleEdgeInsets = UIEdgeInsets(top: 0, left: 5, bottom: 0, right: 0)
+        loginBtn.titleLabel?.font = UIFont.systemFont(ofSize: 15)
+        loginBtn.setImage(UIImage(named: "weichatLogin"), for: .normal)
+        loginBtn.backgroundColor = UIColor.hexColor(hexadecimal: "#07C160")
+        loginBtn.addCorner(corner: nomalH / 2)
+        return loginBtn
+    }()
+
+    lazy var phoneLoginBtn: UIButton = {
+        let phoneLoginBtn = UIButton(type: .custom)
+        phoneLoginBtn.addTarget(self, action: #selector(phoneLoginAction), for: .touchUpInside)
+        phoneLoginBtn.setTitleColor(UIColor.hexColor(hexadecimal: "#07C160"), for: .normal)
+        phoneLoginBtn.setTitle(" 手机号登录", for: .normal)
+        phoneLoginBtn.titleEdgeInsets = UIEdgeInsets(top: 0, left: 5, bottom: 0, right: 0)
+
+        phoneLoginBtn.titleLabel?.font = UIFont.systemFont(ofSize: 12)
+        phoneLoginBtn.setImage(UIImage(named: "icon_phone"), for: .normal)
+        phoneLoginBtn.backgroundColor = UIColor.white
+        phoneLoginBtn.addCorner(corner: nomalH / 2)
+        return phoneLoginBtn
+    }()
+
+    //icon
+    lazy var IconView: UIImageView = {
+        let IconView = UIImageView.init(image: UIImage(named: "1024x1024px"))
+
+        return IconView
+    }()
+
+    lazy var remindBtn: UIButton = {
+        let remindBtn = UIButton(type: .custom)
+        remindBtn.backgroundColor = UIColor.hexColor(hexadecimal: "#333333")
+        remindBtn.setTitleColor(UIColor.hexColor(hexadecimal: "#999999"), for: .normal)
+        remindBtn.titleLabel?.font = UIFont.systemFont(ofSize: 13)
+        remindBtn.setTitle(remindTitle, for: .normal)
+        remindBtn.addCorner(corner: 12)
+        return remindBtn
+    }()
+
+    var remindTitle: String? {
+        didSet {
+            remindBtn.setTitle("  \(remindTitle ?? "登录")  ", for: .normal)
+        }
+    }
+
+    override  func viewDidLoad() {
+        super.viewDidLoad()
+        view.addSubview(IconView)
+        view.addSubview(remindBtn)
+
+        remindBtn.isHidden = !(remindTitle != nil && remindTitle?.count ?? 0 > 0)
+        // 请求配置
+        PQBaseViewModel.systemConfig { [weak self] _ in
+            self?.view.addSubview(self!.loginBtn)
+            self?.view.addSubview(self!.phoneLoginBtn)
+            self?.view.addSubview(self!.protocolLab)
+            if PQSingletoMemoryUtil.shared.needLogin {
+                if #available(iOS 13.0, *) {
+                    self?.view.addSubview(self!.appleSignBtn)
+                    self?.appleSignBtn.isHidden = false
+                    self?.loginBtn.setTitle(nil, for: .normal)
+                    self?.phoneLoginBtn.setTitle(nil, for: .normal)
+                }
+            }
+            self?.addLayout()
+            self?.phoneLoginBtn.isHidden = !PQSingletoMemoryUtil.shared.needLogin
+        }
+    }
+
+    override func viewWillAppear(_: Bool) {
+        super.viewWillAppear(true)
+
+        showNavigation()
+        leftButton(image: "close")
+ 
+    }
+
+    override public func viewWillDisappear(_: Bool) {
+        super.viewWillDisappear(true)
+ 
+    }
+
+    func addLayout() {
+        protocolLab.snp.makeConstraints { make in
+            make.bottom.equalTo(view).offset(-cDefaultMargin * 5)
+            make.left.equalTo(view).offset(cDefaultMargin * 2)
+            make.right.equalTo(view).offset(-cDefaultMargin * 2)
+            make.height.equalTo(cScreenHeigth <= 568 ? cDefaultMargin * 4 : cDefaultMargin * 6)
+        }
+        IconView.snp.makeConstraints { make in
+            make.top.equalTo(view).offset(241)
+            make.centerX.equalTo(view)
+            make.height.width.equalTo(260)
+        }
+        remindBtn.snp.makeConstraints { make in
+//            make.width.equalTo(cDefaultMargin * 13)
+            make.height.equalTo(cDefaultMargin * 4)
+            make.centerX.equalTo(IconView)
+            make.top.equalTo(IconView.snp_bottom).offset(cDefaultMargin * 4)
+        }
+        let isInstallWX = PQSingletoWXApiUtil.shared.isInstallWX()
+        
+        if PQSingletoMemoryUtil.shared.needLogin {
+            if #available(iOS 13.0, *) {
+                if isInstallWX {
+                    loginBtn.snp.makeConstraints { make in
+                        make.centerX.equalToSuperview()
+                        make.height.width.equalTo(nomalH)
+                        make.bottom.equalTo(protocolLab.snp_top).offset(-cDefaultMargin * 3)
+                    }
+                    phoneLoginBtn.snp.makeConstraints { make in
+                        make.left.equalTo(loginBtn.snp_right).offset(cDefaultMargin * 4)
+                        make.height.centerY.width.equalTo(loginBtn)
+                    }
+                    appleSignBtn.snp.makeConstraints { make in
+                        make.right.equalTo(loginBtn.snp_left).offset(-cDefaultMargin * 4)
+                        make.height.centerY.width.equalTo(loginBtn)
+                    }
+                } else {
+                    appleSignBtn.snp.makeConstraints { make in
+                        make.centerX.equalToSuperview().offset(-35)
+                        make.height.width.equalTo(nomalH)
+                        make.bottom.equalTo(protocolLab.snp_top).offset(-cDefaultMargin * 3)
+                    }
+                    phoneLoginBtn.snp.makeConstraints { make in
+                        make.left.equalTo(appleSignBtn.snp_right).offset(cDefaultMargin * 4)
+                        make.height.centerY.width.equalTo(appleSignBtn)
+                    }
+                }
+            } else {
+                if isInstallWX {
+                    loginBtn.snp.makeConstraints { make in
+                        make.left.right.equalTo(protocolLab)
+                        make.height.equalTo(nomalH)
+                        make.bottom.equalTo(protocolLab.snp_top).offset(-cDefaultMargin * 3)
+                    }
+                    phoneLoginBtn.snp.makeConstraints { make in
+                        make.left.right.equalTo(protocolLab)
+                        make.height.equalTo(nomalH)
+                        make.bottom.equalTo(loginBtn.snp_top).offset(-cDefaultMargin)
+                    }
+                } else {
+                    phoneLoginBtn.snp.makeConstraints { make in
+                        make.left.right.equalTo(protocolLab)
+                        make.height.equalTo(nomalH)
+                        make.bottom.equalTo(protocolLab.snp_top).offset(-cDefaultMargin * 3)
+                    }
+                }
+            }
+
+        } else {
+            loginBtn.snp.makeConstraints { make in
+                make.left.right.equalTo(protocolLab)
+                make.height.equalTo(nomalH)
+                make.bottom.equalTo(protocolLab.snp_top).offset(-cDefaultMargin * 3)
+            }
+        }
+    }
+}
+
+extension MVLoginController: TYAttributedLabelDelegate {
+    func attributedLabel(_: TYAttributedLabel!, textStorageClicked textStorage: TYTextStorageProtocol!, at _: CGPoint) {
+        var link: String? = (textStorage as? TYLinkTextStorage)?.linkData as? String ?? ""
+        if link == nil || (link?.count ?? 0) <= 0 {
+            let range = (textStorage as? TYLinkTextStorage)?.range
+            if range?.length == 11 {
+                link = cUserProtocol
+            } else if range?.length == 6 {
+                link = cPrivacy
+            }
+        }
+        let detail = PQBaseWebViewController()
+        detail.baseUrl = link
+        navigationController?.pushViewController(detail, animated: true)
+    }
 }
 
+extension MVLoginController: ASAuthorizationControllerDelegate, ASAuthorizationControllerPresentationContextProviding {
+    @objc func wechatLoginAction() {
+        PQSingletoWXApiUtil.shared.authorize().wxApiUtilHander = { [weak self] userData, errorMsg in
+            if userData == nil {
+                // cShowHUB(superView:nil, msg: errorMsg)
+                return
+            }
+            PQMineViewModel.wechatLogin(unionid: "\(userData?["unionid"] ?? "")", openId: "\(userData?["openid"] ?? "")", nickName: "\(userData?["nickname"] ?? "")", avatarUrl: "\(userData?["headimgurl"] ?? "")") { [weak self] _, errorMsg in
+                if errorMsg != nil {
+                    cShowHUB(superView: nil, msg: "登录失败,请重试~")
+                } else {
+                    cShowHUB(superView: nil, msg: "登录成功")
+                    self?.navigationController?.popViewController(animated: true)
+                    postNotification(name: cLoginSuccesssNotiKey)
+                }
+            }
+        }
+    }
+
+    @objc func phoneLoginAction() {
+        let vc = PQPhoneLoginController()
+        navigationController?.pushViewController(vc, animated: true)
+    }
+
+    @objc func appleLoginAction() {
+        if #available(iOS 13.0, *) {
+            let appleIDProvider = ASAuthorizationAppleIDProvider()
+            let appleRequest = appleIDProvider.createRequest()
+            appleRequest.requestedScopes = [.fullName, .email]
+            let auth = ASAuthorizationController(authorizationRequests: [appleRequest])
+            auth.delegate = self
+            auth.presentationContextProvider = self
+            auth.performRequests()
+        }
+    }
+
+    // Apple登录回调
+
+    @available(iOS 13.0, *)
+    func presentationAnchor(for _: ASAuthorizationController) -> ASPresentationAnchor {
+        return view.window!
+    }
+
+    @available(iOS 13.0, *)
+    func authorizationController(controller _: ASAuthorizationController, didCompleteWithError error: Error) {
+        BFLog(message: "didCompleteWithError - \(error)")
+        switch (error as NSError).code {
+        case ASAuthorizationError.canceled.rawValue:
+            cShowHUB(superView: nil, msg: "你取消了授权登录")
+        case ASAuthorizationError.failed.rawValue:
+            cShowHUB(superView: nil, msg: "授权失败,请重新登录")
+        case ASAuthorizationError.invalidResponse.rawValue:
+            cShowHUB(superView: nil, msg: "暂时无响应哦,请重新登录")
+        case ASAuthorizationError.notHandled.rawValue:
+            cShowHUB(superView: nil, msg: "暂时无响应哦,请重新登录")
+        case ASAuthorizationError.unknown.rawValue:
+            cShowHUB(superView: nil, msg: "暂时无响应哦,请重新登录")
+        default:
+            break
+        }
+    }
+
+    @available(iOS 13.0, *)
+    func authorizationController(controller _: ASAuthorizationController, didCompleteWithAuthorization authorization: ASAuthorization) {
+        if authorization.credential.isKind(of: ASAuthorizationAppleIDCredential.self) {
+            let credential: ASAuthorizationAppleIDCredential = authorization.credential as! ASAuthorizationAppleIDCredential
+            let user = credential.user
+            let identityToken = credential.identityToken
+            let token = String(data: identityToken!, encoding: .utf8)
+            if valideToken(token: token, user: user) {
+                PQMineViewModel.appleLogin(token: token ?? "") { [weak self] _, errorMsg in
+                    if errorMsg != nil {
+                        cShowHUB(superView: nil, msg: errorMsg)
+                    } else {
+                        cShowHUB(superView: nil, msg: "登录成功")
+                        self?.navigationController?.popViewController(animated: true)
+                        postNotification(name: cLoginSuccesssNotiKey)
+                    }
+                }
+            } else {
+                cShowHUB(superView: nil, msg: "校验失败,请重新登录")
+            }
+        } else if authorization.credential.isKind(of: ASPasswordCredential.self) {
+            let credential: ASPasswordCredential = authorization.credential as! ASPasswordCredential
+            let user = credential.user
+            BFLog(message: "user = \(user)")
+        }
+    }
+
+    /// 本地校验
+    /// - Parameters:
+    ///   - identityToken: <#identityToken description#>
+    ///   - user: <#user description#>
+    /// - Returns: <#description#>
+    func valideToken(token: String?, user: String) -> Bool {
+        if token == nil || (token?.isEmpty ?? true) {
+            return false
+        }
+        let jwt = try! decode(jwt: token!)
+        BFLog(message: "\(jwt)")
+        if jwt.body.keys.contains("sub") {
+            let sub: String = jwt.body["sub"] as! String
+            if sub == user { // 校验成功
+                return true
+            }
+        }
+        return false
+    }
+}

+ 193 - 0
MusicVideoPlus/MusicVideoPlus/Classes/Modules/Login/Controllers/PQPhoneLoginController.swift

@@ -0,0 +1,193 @@
+//
+//  PQPhoneLoginController.swift
+//  PQSpeed
+//
+//  Created by SanW on 2020/6/4.
+//  Copyright © 2020 BytesFlow. All rights reserved.
+//
+
+import UIKit
+import BFFramework
+class PQPhoneLoginController: MVBaseController {
+    lazy var titleLab: UILabel = {
+        let titleLab = UILabel()
+        titleLab.textColor = UIColor.white
+        titleLab.font = UIFont.systemFont(ofSize: 20, weight: .medium)
+        titleLab.text = "手机号登录"
+        titleLab.textAlignment = .center
+        return titleLab
+    }()
+
+    lazy var phoneTextField: UITextField = {
+        let phoneTextField = UITextField()
+        phoneTextField.textColor = UIColor.black
+        phoneTextField.font = UIFont.systemFont(ofSize: 16, weight: .medium)
+        let placeholder: NSMutableAttributedString = NSMutableAttributedString(string: "请输入手机号码")
+        placeholder.addAttributes([NSAttributedString.Key.font: UIFont.systemFont(ofSize: 16, weight: .regular), NSAttributedString.Key.foregroundColor: UIColor.hexColor(hexadecimal: "#A3A3A3")], range: NSRange(location: 0, length: placeholder.length))
+        phoneTextField.attributedPlaceholder = placeholder
+        phoneTextField.addTarget(self, action: #selector(valueChanged(textField:)), for: .editingChanged)
+        phoneTextField.delegate = self
+        phoneTextField.keyboardType = .phonePad
+        phoneTextField.returnKeyType = UIReturnKeyType.next
+        phoneTextField.textAlignment = .center
+        phoneTextField.rightViewMode = UITextField.ViewMode.always
+        return phoneTextField
+    }()
+
+    lazy var passTextField: UITextField = {
+        let passTextField = UITextField()
+        passTextField.textColor = UIColor.black
+        passTextField.font = UIFont.systemFont(ofSize: 16, weight: .medium)
+        passTextField.isSecureTextEntry = true
+        passTextField.textAlignment = .center
+        let placeholder: NSMutableAttributedString = NSMutableAttributedString(string: "请输入6-20位密码")
+        placeholder.addAttributes([NSAttributedString.Key.font: UIFont.systemFont(ofSize: 16, weight: .regular), NSAttributedString.Key.foregroundColor: UIColor.hexColor(hexadecimal: "#A3A3A3")], range: NSRange(location: 0, length: placeholder.length))
+        passTextField.attributedPlaceholder = placeholder
+        passTextField.addTarget(self, action: #selector(valueChanged(textField:)), for: .editingChanged)
+        passTextField.delegate = self
+        passTextField.returnKeyType = UIReturnKeyType.send
+        passTextField.rightViewMode = UITextField.ViewMode.always
+        return passTextField
+    }()
+
+    lazy var phoneLineView: UIView = {
+        let phoneLineView = UIView()
+        phoneLineView.backgroundColor = UIColor.hexColor(hexadecimal: "#333333")
+        return phoneLineView
+    }()
+
+    lazy var passLineView: UIView = {
+        let passLineView = UIView()
+        passLineView.backgroundColor = UIColor.hexColor(hexadecimal: "#333333")
+        return passLineView
+    }()
+
+    lazy var phoneLoginBtn: UIButton = {
+        let phoneLoginBtn = UIButton(type: .custom)
+        phoneLoginBtn.addTarget(self, action: #selector(loginAction), for: .touchUpInside)
+        phoneLoginBtn.backgroundColor = UIColor.black
+        phoneLoginBtn.setTitleColor(UIColor.white, for: .normal)
+        phoneLoginBtn.setTitle("登录", for: .normal)
+        phoneLoginBtn.titleLabel?.font = UIFont.systemFont(ofSize: 14)
+        phoneLoginBtn.backgroundColor = UIColor.hexColor(hexadecimal: "#333333")
+//      phoneLoginBtn.isEnabled = false
+        return phoneLoginBtn
+    }()
+
+    override func viewDidLoad() {
+        super.viewDidLoad()
+
+        // Do any additional setup after loading the view.
+        showNavigation()
+        leftBackButton()
+        view.addSubview(titleLab)
+        view.addSubview(phoneTextField)
+        view.addSubview(phoneLineView)
+        view.addSubview(passTextField)
+        view.addSubview(passLineView)
+        view.addSubview(phoneLoginBtn)
+        addLayout()
+    }
+
+    func addLayout() {
+        titleLab.snp.makeConstraints { make in
+            make.left.right.equalTo(view)
+            make.top.equalTo(view).offset(cDefaultMargin * 10)
+        }
+        phoneTextField.snp.makeConstraints { make in
+            make.top.equalTo(titleLab.snp_bottom).offset(cDefaultMargin * 8)
+            make.left.equalTo(view).offset(cDefaultMargin * 4)
+            make.right.equalTo(view).offset(-cDefaultMargin * 4)
+            make.height.equalTo(cDefaultMargin * 4)
+        }
+        phoneLineView.snp.makeConstraints { make in
+            make.left.right.equalTo(phoneTextField)
+            make.top.equalTo(phoneTextField.snp_bottom)
+            make.height.equalTo(0.5)
+        }
+        passTextField.snp.makeConstraints { make in
+            make.top.equalTo(phoneLineView.snp_bottom).offset(cDefaultMargin)
+            make.left.right.height.equalTo(phoneTextField)
+        }
+        passLineView.snp.makeConstraints { make in
+            make.left.right.equalTo(phoneTextField)
+            make.top.equalTo(passTextField.snp_bottom)
+            make.height.equalTo(0.5)
+        }
+        phoneLoginBtn.snp.makeConstraints { make in
+            make.left.equalTo(view).offset(cDefaultMargin * 2)
+            make.right.equalTo(view).offset(-cDefaultMargin * 2)
+            make.height.equalTo(cDefaultMargin * 5)
+            make.top.equalTo(passLineView.snp_bottom).offset(cDefaultMargin * 4)
+        }
+        phoneLoginBtn.addCorner(corner: 25)
+    }
+
+    @objc func loginAction() {
+        if phoneTextField.text?.count ?? 0 <= 0 {
+            cShowHUB(superView: view, msg: "请输入手机号码")
+            return
+        }
+        if phoneTextField.text?.count ?? 0 > 11 {
+            cShowHUB(superView: view, msg: "请输入正确的手机号码")
+            return
+        }
+        if passTextField.text?.count ?? 0 <= 0 {
+            cShowHUB(superView: view, msg: "请输入密码")
+            return
+        }
+        if passTextField.text?.count ?? 0 < 6 {
+            cShowHUB(superView: view, msg: "密码长度为6-20位")
+            return
+        }
+        if passTextField.text?.count ?? 0 > 20 {
+            cShowHUB(superView: view, msg: "密码长度为6-20位")
+            return
+        }
+        PQMineViewModel.phoneLoginOrRegister(isLogin: true, phone: phoneTextField.text!, password: passTextField.text!) { [weak self] response, _ in
+            if response == nil {
+//              cShowHUB(superView: (self?.view)!, msg: msg)
+                cShowHUB(superView: (self?.view)!, msg: "登录失败,请重试~")
+            } else {
+                cShowHUB(superView: nil, msg: "登录成功")
+                self?.navigationController?.popToRootViewController(animated: true)
+                postNotification(name: cLoginSuccesssNotiKey)
+            }
+        }
+    }
+}
+
+extension PQPhoneLoginController: UITextFieldDelegate {
+    @objc func valueChanged(textField: UITextField) {
+        if textField == phoneTextField, textField.text?.count ?? 0 > 11 {
+            textField.text = String(textField.text?.prefix(11) ?? "")
+        }
+        if textField == passTextField, textField.text?.count ?? 0 > 20 {
+            textField.text = String(textField.text?.prefix(20) ?? "")
+        }
+        isEnabled()
+    }
+
+    func textFieldShouldReturn(_ textField: UITextField) -> Bool {
+        if textField == phoneTextField {
+            passTextField.becomeFirstResponder()
+        } else {
+            loginAction()
+        }
+        return true
+    }
+
+    override func touchesBegan(_: Set<UITouch>, with _: UIEvent?) {
+        view.endEditing(true)
+    }
+
+    @objc func isEnabled() {
+        let isEnabled = (phoneTextField.text?.count ?? 0 == 11 && passTextField.text?.count ?? 0 >= 6 && passTextField.text?.count ?? 0 <= 20)
+//        phoneLoginBtn.isEnabled = isEnabled
+        if isEnabled {
+            phoneLoginBtn.backgroundColor = UIColor.hexColor(hexadecimal: "#07C160")
+        } else {
+            phoneLoginBtn.backgroundColor = UIColor.hexColor(hexadecimal: "#333333")
+        }
+    }
+}

+ 130 - 0
MusicVideoPlus/MusicVideoPlus/Classes/Modules/Login/ViewModels/PQMineViewModel.swift

@@ -0,0 +1,130 @@
+//
+//  PQMineViewModel.swift
+//  PQSpeed
+//
+//  Created by SanW on 2020/5/27.
+//  Copyright © 2020 BytesFlow. All rights reserved.
+//
+
+import UIKit
+import BFFramework
+
+// MARK: 我的相关ViewModel
+
+/// 我的相关ViewModel
+class PQMineViewModel: NSObject {
+    typealias completeHander = (_ userInfo: [String: Any]?, _ msg: String?) -> Void
+
+    /// 微信登录
+    /// - Parameters:
+    ///   - unionid: <#unionid description#>
+    ///   - openId: <#openId description#>
+    ///   - nickName: <#nickName description#>
+    ///   - avatarUrl: <#avatarUrl description#>
+    ///   - completeHander: <#completeHander description#>
+    /// - Returns: <#description#>
+    class func wechatLogin(unionid: String, openId: String, nickName: String, avatarUrl: String, completeHander: @escaping completeHander) {
+        SWNetRequest.postRequestData(url: PQENVUtil.shared.longvideoapi + login, parames: ["unionid": unionid, "openId": openId, "nickName": nickName, "avatarUrl": avatarUrl]) { response, _, error, _ in
+            if error == nil {
+                let userInfo: [String: Any] = response as! [String: Any]
+                // 处理用户登录信息
+                dealWithLoginInfo(userInfo: userInfo)
+                PQMineViewModel.userStatus { _, _ in
+                    completeHander(response! as? [String: Any], nil)
+                }
+            } else {
+                completeHander(nil, error?.msg)
+                
+            }
+        }
+    }
+
+    /// 手机号登录
+    /// - Parameters:
+    ///   - isLogin: <#isLogin description#>
+    ///   - phone: <#phone description#>
+    ///   - password: <#password description#>
+    /// - Returns: <#description#>
+    class func phoneLoginOrRegister(isLogin: Bool, phone: String, password: String, completeHander: @escaping completeHander) {
+        var url: String!
+        if isLogin {
+            url = PQENVUtil.shared.longvideoapi + phoneLoginUrl
+        } else {
+            url = PQENVUtil.shared.longvideoapi + phoneRegisterUrl
+        }
+        SWNetRequest.postRequestData(url: url, parames: ["account": phone, "passwd": password]) { response, _, error, _ in
+            if error != nil {
+                completeHander(nil, error?.msg)
+          
+                return
+            }
+            if response is NSNull || response == nil {
+                completeHander(nil, "请稍后重试")
+                return
+            }
+            let userInfo: [String: Any] = response as! [String: Any]
+            // 处理用户登录信息
+            dealWithLoginInfo(userInfo: userInfo)
+            PQMineViewModel.userStatus { _, _ in
+                completeHander(response! as? [String: Any], nil)
+            }
+        }
+    }
+
+    /// Apple账号登录
+    /// - Parameters:
+    ///   - token: token
+    /// - Returns: <#description#>b
+    class func appleLogin(token: String, completeHander: @escaping completeHander) {
+        SWNetRequest.postRequestData(url: PQENVUtil.shared.longvideoapi + appleLoginUrl, parames: ["token": token]) { response, _, error, _ in
+            if error != nil {
+                completeHander(nil, error?.msg)
+                return
+            }
+            if response is NSNull || response == nil {
+                completeHander(nil, "请稍后重试")
+                return
+            }
+            let userInfo: [String: Any] = response as! [String: Any]
+            // 处理用户登录信息
+            dealWithLoginInfo(userInfo: userInfo)
+            PQMineViewModel.userStatus { _, _ in
+                completeHander(response! as? [String: Any], nil)
+            }
+        }
+    }
+    
+    
+    /// 处理用户登录信息
+    /// - Parameter userInfo: <#userInfo description#>
+    /// - Returns: <#description#>
+    class func dealWithLoginInfo(userInfo: [String: Any]) {
+        BFLoginUserInfo.shared.updateData(userInfo: userInfo)
+
+        saveUserDefaults(key: cUserInfoStorageKey, value: BFLoginUserInfo.shared.toString())
+    
+      
+    }
+
+    /// 获取用户状态 1有效,2 已删除,3 已屏蔽,4 敏感
+    /// - Parameter completeHander: <#completeHander description#>
+    /// - Returns: <#description#>
+    class func userStatus(completeHander: @escaping (_ status: Int?, _ msg: String?) -> Void) {
+        if !BFLoginUserInfo.shared.isLogin() {
+            completeHander(nil, "未登录")
+            return
+        }
+        SWNetRequest.postRequestData(url: PQENVUtil.shared.longvideoapi + userStatusUrl, parames: nil) { response, _, error, _ in
+            if error != nil {
+                completeHander(nil, error?.msg)
+                return
+            }
+            if response is NSNull || response == nil {
+                completeHander(nil, "请稍后重试")
+                return
+            }
+            BFLoginUserInfo.shared.userStatus = "\(response ?? "1")"
+            completeHander(Int("\(response ?? "1")"), nil)
+        }
+    }
+}

+ 9 - 0
MusicVideoPlus/MusicVideoPlus/Classes/Modules/Mine/Controllers/MVMineController.swift

@@ -9,5 +9,14 @@ import Foundation
 
 class MVMineController: MVBaseController{
 
+    override func viewWillAppear(_: Bool) {
+        super.viewWillAppear(true)
+
+        showNavigation()
+        leftButton(image: "back_black")
+ 
+    }
+    
+    
 
 }

+ 119 - 0
MusicVideoPlus/MusicVideoPlus/Classes/Modules/Setting/Controllers/MVSettingController.swift

@@ -0,0 +1,119 @@
+//
+//  MVSettingController.swift
+//  MusicVideoPlus
+//
+//  Created by ak on 2021/6/2.
+//
+
+import UIKit
+import BFFramework
+class MVSettingController: MVBaseController{
+
+    //tips 1
+    lazy var tipsA: UILabel = {
+        let tipsA = UILabel()
+        tipsA.font = UIFont.systemFont(ofSize: 26, weight: .medium)
+        tipsA.textColor = UIColor.hexColor(hexadecimal: "#929292")
+        let infoDictionary = Bundle.main.infoDictionary
+         
+        let majorVersion :String = infoDictionary! ["CFBundleShortVersionString"] as! String//主程序版本号
+        tipsA.text = "APP版本号V\(majorVersion)"
+        tipsA.lineBreakMode = .byWordWrapping
+        tipsA.textAlignment = .center
+        tipsA.numberOfLines = 0
+        return tipsA
+    }()
+
+    //显示协议
+    lazy var protocolLab: TYAttributedLabel = {
+        let protocolLab = TYAttributedLabel()
+        protocolLab.highlightedLinkBackgroundColor = UIColor.clear
+        protocolLab.backgroundColor = UIColor.clear
+        protocolLab.delegate = self
+        protocolLab.numberOfLines = 0
+        protocolLab.font = UIFont.systemFont(ofSize: 14)
+        protocolLab.text = ""
+        protocolLab.textColor = UIColor.hexColor(hexadecimal: "#999999")
+        protocolLab.appendLink(withText: "《用户协议》", linkFont: UIFont.systemFont(ofSize: 14), linkColor: UIColor.hexColor(hexadecimal: "#6783AC"), underLineStyle: CTUnderlineStyle.single, linkData: cUserProtocol)
+
+        protocolLab.appendLink(withText: "《隐私协议》", linkFont: UIFont.systemFont(ofSize: 14), linkColor: UIColor.hexColor(hexadecimal: "#6783AC"), underLineStyle: CTUnderlineStyle.single, linkData: cPrivacy)
+
+        protocolLab.textAlignment = CTTextAlignment.center
+        return protocolLab
+    }()
+    
+    // 卡点视频 btn
+    lazy var logoutBtn: UIButton = {
+        let logoutBtn = UIButton(type: .custom)
+        logoutBtn.addTarget(self, action: #selector(btnClick), for: .touchUpInside)
+        logoutBtn.setImage(UIImage(named: "logoutBtn"), for: .normal)
+        logoutBtn.adjustsImageWhenHighlighted = false
+        return logoutBtn
+    }()
+    
+    override func viewWillAppear(_: Bool) {
+        super.viewWillAppear(true)
+
+        showNavigation()
+ 
+        leftButton(image: "back_black")
+ 
+    }
+    
+    override func viewDidLoad() {
+        super.viewDidLoad()
+        view.backgroundColor =  UIColor.hexColor(hexadecimal: "#F2F2F2")
+        navHeadImageView?.backgroundColor = UIColor.hexColor(hexadecimal: "#F2F2F2")
+        view.addSubview(tipsA)
+        view.addSubview(protocolLab)
+        view.addSubview(logoutBtn)
+        addLayout()
+    }
+    
+    @objc func btnClick() {
+        BFLog(message: "logout ")
+    }
+    
+    
+    func addLayout() {
+        
+        tipsA.snp.remakeConstraints { make in
+            make.width.equalTo(146)
+            make.height.equalTo(160)
+            make.centerX.equalToSuperview()
+            make.top.equalToSuperview().offset(313)
+        }
+        
+        protocolLab.snp.makeConstraints { make in
+            make.bottom.equalTo(view).offset(-cDefaultMargin * 5)
+            make.left.equalTo(view).offset(cDefaultMargin * 2)
+            make.right.equalTo(view).offset(-cDefaultMargin * 2)
+            make.height.equalTo(cScreenHeigth <= 568 ? cDefaultMargin * 4 : cDefaultMargin * 6)
+        }
+        
+        logoutBtn.snp.makeConstraints { make in
+            make.bottom.equalTo(protocolLab.snp_top).offset(-30)
+            make.centerX.equalToSuperview()
+            make.height.equalTo(50)
+            make.width.equalTo(335)
+        }
+    }
+}
+
+
+extension MVSettingController: TYAttributedLabelDelegate {
+    func attributedLabel(_: TYAttributedLabel!, textStorageClicked textStorage: TYTextStorageProtocol!, at _: CGPoint) {
+        var link: String? = (textStorage as? TYLinkTextStorage)?.linkData as? String ?? ""
+        if link == nil || (link?.count ?? 0) <= 0 {
+            let range = (textStorage as? TYLinkTextStorage)?.range
+            if range?.length == 0 {
+                link = cUserProtocol
+            } else if range?.length == 6 {
+                link = cPrivacy
+            }
+        }
+        let detail = PQBaseWebViewController()
+        detail.baseUrl = link
+        navigationController?.pushViewController(detail, animated: true)
+    }
+}

+ 12 - 0
MusicVideoPlus/MusicVideoPlus/MusicVideoPlus-Bridging-Header.h

@@ -0,0 +1,12 @@
+//
+//  MusicVideoPlus-Bridging-Header.h
+//  MusicVideoPlus
+//
+//  Created by ak on 2021/6/3.
+//
+
+#ifndef MusicVideoPlus_Bridging_Header_h
+#define MusicVideoPlus_Bridging_Header_h
+
+#import "TYAttributedLabel.h"
+#endif /* MusicVideoPlus_Bridging_Header_h */

+ 5 - 1
MusicVideoPlus/Podfile

@@ -4,6 +4,10 @@ target 'MusicVideoPlus' do
   # Comment the next line if you don't want to use dynamic frameworks
   use_frameworks!
   source 'https://github.com/CocoaPods/Specs.git'
-  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 'JWTDecode','2.6.0' # Apple登陆校验库
+  pod 'TYAttributedLabel','2.6.9' #  富文本
 end