From 09a372bc45fde16fd42257ab6f78b8deeecf720b Mon Sep 17 00:00:00 2001
From: 杨锴 <841720330@qq.com>
Date: 星期三, 16 四月 2025 16:38:05 +0800
Subject: [PATCH] fix bug

---
 XQMuse/Root/Login/VC/ForgotPasswordInputCodeVC.swift |   56 ++++++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 40 insertions(+), 16 deletions(-)

diff --git a/XQMuse/Root/Login/VC/ForgotPasswordInputCodeVC.swift b/XQMuse/Root/Login/VC/ForgotPasswordInputCodeVC.swift
index 70f83d7..f9040ad 100644
--- a/XQMuse/Root/Login/VC/ForgotPasswordInputCodeVC.swift
+++ b/XQMuse/Root/Login/VC/ForgotPasswordInputCodeVC.swift
@@ -43,12 +43,12 @@
 								super.viewDidAppear(animated)
 								c1.becomeFirstResponder()
 								c1.jq_borderWidth = 1
-								starTimer()
+//								sendCode()
 				}
 
     override func viewDidLoad() {
         super.viewDidLoad()
-								title = "找回密码"
+								title = "修改密码"
 
 								c1.delegate = self
 								c2.delegate = self
@@ -56,6 +56,8 @@
 								c4.delegate = self
 								c5.delegate = self
 								c6.delegate = self
+
+        starTimer()
     }
 
 				override func setUI() {
@@ -66,7 +68,7 @@
 												make.left.right.equalToSuperview()
 												make.height.equalTo(30)
 								}
-								label_hint.text = "验证码已发送至:" + phone.jq_blotOutPhone()
+								label_hint.text = "验证码已发送至:" + phone.jq_insertBlank()
 				}
 
 				override func setRx() {
@@ -92,17 +94,29 @@
 								}
 				}
 
+
+				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.attributedText = AttributedStringbuilder.build()
+                .add(string: "\(self?.times ?? 0)s", withFont: .systemFont(ofSize: 12, weight: .medium), withColor: UIColor(hexStr: "#98B083"))
+                .add(string: "后可重新获取验证码", withFont: .systemFont(ofSize: 12, weight: .medium), withColor: UIColor(hexStr: "#B7B7B7")).mutableAttributedString
+
+//												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 +129,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()
 				}
 				
 

--
Gitblit v1.7.1