杨锴
2024-11-05 0fb7413df54760ac6bd15b90b738e0706de1629e
XQMuse/Root/Login/LoginVC.swift
@@ -62,7 +62,8 @@
            @IBOutlet weak var btn_sendCode: UIButton!
            @IBOutlet weak var btn_isRead: UIButton!
    @IBOutlet weak var btn_wechat: UIButton!
    @IBOutlet weak var image_security: UIImageView!
    private var cellularData:CTCellularData!
            private var viewModel = LoginViewModel()
@@ -181,8 +182,10 @@
                        switch viewModel.loginType.value{
                                    case .code:
                                                tf_content.isSecureTextEntry = false
                image_security.image = UIImage(named: "icon_code")
                                    case .pwd:
                                                tf_content.isSecureTextEntry = btn_eye.isSelected
                image_security.image = UIImage(named: "icon_pwd")
                        }
            }
            
@@ -202,8 +205,8 @@
                        guard viewModel.loginPhone.value.jq_isPhone else {alert(msg: "请输入正确手机号");return}
        Services.sendCode(phone:tf_phone.text!,type: .codeLogin).subscribe(onNext: {data in
                                    if let _ = data.data{
                                                sender.jq_openCountDown(60, defultTitle: "发送验证码") {
            if data.code == 200{
                                                sender.jq_openCountDown(60, defultTitle: "获取验证码") {
                                                            sender.titleLabel?.font = UIFont.systemFont(ofSize: 12)
                                                            sender.setTitleColor(.black.withAlphaComponent(0.3), for: .normal)
                                                } completeClouse: {
@@ -218,7 +221,7 @@
                        guard viewModel.checkSafe() else {return}
                        guard btn_isRead.isSelected else {
                                    alertError(msg: "请阅读并同意《用户注册协议》和《用户隐私协议》");return
            alert(msg: "请阅读并同意《用户注册协议》和《用户隐私协议》");return
                        }
                        Services.loginBy(phone: viewModel.loginPhone.value, content: viewModel.loginContent.value, type: viewModel.loginType.value).subscribe(onNext: { data in
@@ -238,23 +241,31 @@
            }
            @IBAction func userRegisterTreatyAction(_ sender: UIButton) {
                        let vc = LoginTreatyVC()
                        vc.topIndex = 0
                        vc.clickHandle {[unowned self] state in
                                    self.btn_isRead.isSelected = state
                        }
                        vc.modalPresentationStyle = .custom
                        present(vc, animated: true)
        let vc = WebVC(type: .user)
        vc.title = "用户注册协议"
        push(vc: vc)
//                        let vc = LoginTreatyVC()
//                        vc.topIndex = 0
//                        vc.clickHandle {[unowned self] state in
//                                    self.btn_isRead.isSelected = state
//                        }
//                        vc.modalPresentationStyle = .custom
//                        present(vc, animated: true)
            }
            @IBAction func userPrivateTreatyAction(_ sender: UIButton) {
                        let vc = LoginTreatyVC()
                        vc.topIndex = 1
                        vc.clickHandle {[unowned self] state in
                                    self.btn_isRead.isSelected = state
                        }
                        vc.modalPresentationStyle = .custom
                        present(vc, animated: true)
//                        let vc = LoginTreatyVC()
//                        vc.topIndex = 1
//                        vc.clickHandle {[unowned self] state in
//                                    self.btn_isRead.isSelected = state
//                        }
//                        vc.modalPresentationStyle = .custom
//                        present(vc, animated: true)
        let vc = WebVC(type: .privacy)
        vc.title = "用户隐私协议"
        push(vc: vc)
            }
            
            @IBAction func registerAction(_ sender: UIButton) {
@@ -264,14 +275,14 @@
            @IBAction func loginByWechatAction(_ sender: UIButton) {
        guard btn_isRead.isSelected else {
            alertError(msg: "请阅读并同意《用户注册协议》和《用户隐私协议》");return
            alert(msg: "请阅读并同意《用户注册协议》和《用户隐私协议》");return
        }
        WeChatTools.sendAuthRequest()
            }
            @IBAction func loginByAppleAction(_ sender: UIButton) {
        guard btn_isRead.isSelected else {
            alertError(msg: "请阅读并同意《用户注册协议》和《用户隐私协议》");return
            alert(msg: "请阅读并同意《用户注册协议》和《用户隐私协议》");return
        }
        let provider = ASAuthorizationAppleIDProvider() //主要作用是用创建相应的请求,查询用户授权状态