From 586eb879891e852e50302206470149766c35ee08 Mon Sep 17 00:00:00 2001 From: 杨锴 <841720330@qq.com> Date: 星期四, 05 九月 2024 15:07:57 +0800 Subject: [PATCH] fix API Login --- XQMuse/Root/Login/VC/ForgotPasswordChangeVC.swift | 34 +++++++++++++++++++++++++++++----- 1 files changed, 29 insertions(+), 5 deletions(-) diff --git a/XQMuse/Root/Login/VC/ForgotPasswordChangeVC.swift b/XQMuse/Root/Login/VC/ForgotPasswordChangeVC.swift index f426728..1d88e8d 100644 --- a/XQMuse/Root/Login/VC/ForgotPasswordChangeVC.swift +++ b/XQMuse/Root/Login/VC/ForgotPasswordChangeVC.swift @@ -13,14 +13,29 @@ @IBOutlet weak var tf_input: QMUITextField! @IBOutlet weak var btn_complete: UIButton! + @IBOutlet weak var btn_eye: UIButton! private let shadowView = UIView() + var secretCode:String = "" + var phone:String = "" + + init(phone:String,secretCode:String) { + super.init(nibName: nil, bundle: nil) + self.phone = phone + self.secretCode = secretCode + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + override func viewDidLoad() { super.viewDidLoad() title = "找回密码" } override func setUI() { + btn_eye.isSelected = true view.addSubview(shadowView) shadowView.backgroundColor = .white shadowView.snp.makeConstraints { make in @@ -38,14 +53,23 @@ shadowView.jq_gradientColor(colorArr: [UIColor(hexStr: "#F5F5F5").withAlphaComponent(0.15).cgColor,UIColor.white.cgColor], cornerRadius: 0, startPoint: CGPoint(x: 0, y: 0), endPoint: CGPoint(x: 0, y: 1), bounds: CGRect(x: 0, y: 0, width: JQ_ScreenW, height: 30),locations: [0.1,0.9]) } - + @IBAction func eyeAction(_ sender: UIButton) { + btn_eye.isSelected = !btn_eye.isSelected + tf_input.isSecureTextEntry = btn_eye.isSelected + } + @IBAction func completeAction(_ sender: UIButton) { + view.endEditing(true) guard !tf_input.text!.isEmpty else {alertError(msg: "请输入密码");return} guard tf_input.text!.count >= 8 else {alertError(msg: "密码至少8个字符,不能全是字母或数字");return} guard tf_input.text!.jq_isComplexPassword else {alertError(msg: "密码至少8个字符,不能全是字母或数字");return} - view.endEditing(true) - Popup_1_View.show(state: .success, title: "修改成功", subtitle: "您的密码已修改成功,快去登录账户吧") { - self.navigationController?.popToRootViewController(animated: true) - } + + Services.updatePwd(cellPhone: phone, password: tf_input.text!, secretCode: secretCode).subscribe(onNext: {data in + if let model = data.data{ + Popup_1_View.show(state: .success, title: "修改成功", subtitle: "您的密码已修改成功,快去登录账户吧") { + self.navigationController?.popToRootViewController(animated: true) + } + } + }).disposed(by: disposeBag) } } -- Gitblit v1.7.1