fix
杨锴
2024-10-30 5283b8ffa2bf84135f4b0156d1704cc352bb7cef
XQMuse/Root/Login/VC/ForgotPasswordInputCodeVC.swift
@@ -43,7 +43,7 @@
                        super.viewDidAppear(animated)
                        c1.becomeFirstResponder()
                        c1.jq_borderWidth = 1
                        starTimer()
                        sendCode()
            }
    override func viewDidLoad() {
@@ -92,17 +92,24 @@
                        }
            }
            private func sendCode(){
        Services.sendCode(phone:phone,type: .forgetPwd).subscribe(onNext: { _ in
                                    self.starTimer()
                        }).disposed(by: disposeBag)
            }
            private func starTimer(){
                        times = 60
                        btn_retry.isEnabled = false
                        btn_retry.alpha = 0.5
                        timer = Timer(timeInterval: 1.0, repeats: true) {[unowned self] t in
                                    self.times -= 1
                                    self.label_retryCode.text = "\(self.times)s后可重新发送验证码"
                                    if self.times == 0{
                                                self.label_retryCode.text = ""
                                                self.btn_retry.isEnabled = true
                                                self.btn_retry.alpha = 1.0
                        timer = Timer(timeInterval: 1.0, repeats: true) {[weak self] t in
                                    self?.times -= 1
                                    self?.label_retryCode.text = "\(self?.times ?? 0)s后可重新发送验证码"
                                    if self?.times == 0{
                                                self?.label_retryCode.text = ""
                                                self?.btn_retry.isEnabled = true
                                                self?.btn_retry.alpha = 1.0
                                                t.invalidate()
                                    }
                        }
@@ -115,19 +122,29 @@
            }
            @IBAction func checkingAction(_ sender: UIButton) {
                        view.endEditing(true)
                        if inputCode.count != 6{
                                    alertError(msg: "请输入验证码");return
                        }
                        view.endEditing(true)
                        Popup_1_View.show(state: .success, title: "验证成功", subtitle:"手机号验证成功") {
                                    let vc = ForgotPasswordChangeVC()
                                    self.push(vc: vc)
                        }
                        Services.forgotPwdVerifyCode(cellPhone: phone, captcha: inputCode).subscribe(onNext: {data in
                                                if data.data?.successFlag ?? false{
                                                            Popup_1_View.show(state: .success, title: "验证成功", subtitle:"手机号验证成功") {
                                                                        let vc = ForgotPasswordChangeVC(phone:self.phone,secretCode: data.data?.secret ?? "")
                                                                        self.push(vc: vc)
                                                            }
                                                }else{
                                                            Popup_1_View.show(state: .fail, title: "验证失败", subtitle:"手机号验证失败") {
                                                            }
                                                }
                        }).disposed(by: disposeBag)
            }
            @IBAction func tryAgainAction(_ sender: UIButton) {
                        view.endEditing(true)
                        starTimer()
                        sendCode()
            }