//
|
// ForgotPasswordChangeVC.swift
|
// XQMuse
|
//
|
// Created by 无故事王国 on 2024/8/13.
|
//
|
|
import UIKit
|
import QMUIKit
|
import JQTools
|
|
class ForgotPasswordChangeVC: BaseVC {
|
|
@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 = "修改密码"
|
|
yy_popBlock = {[weak self] in
|
guard let weakSelf = self else { return }
|
for vc in weakSelf.navigationController?.viewControllers ?? []{
|
if vc is ForgotPasswordVC{
|
weakSelf.navigationController?.popToViewController(vc, animated: true);break
|
}
|
}
|
}
|
}
|
|
override func setUI() {
|
btn_eye.isSelected = true
|
view.addSubview(shadowView)
|
shadowView.backgroundColor = .white
|
shadowView.snp.makeConstraints { make in
|
make.top.equalTo(self.view.safeAreaLayoutGuide.snp.top).offset(0)
|
make.left.right.equalToSuperview()
|
make.height.equalTo(30)
|
}
|
}
|
|
override func viewDidLayoutSubviews() {
|
super.viewDidLayoutSubviews()
|
|
btn_complete.jq_gradientNibColor(colorArr: [UIColor(hexStr: "#8EA47A").cgColor,UIColor(hexStr: "#AFCA98").cgColor], cornerRadius: 20)
|
|
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}
|
|
Services.updatePwd(cellPhone: phone, password: tf_input.text!, secretCode: secretCode).subscribe(onNext: {data in
|
if data.code == 200{
|
Popup_1_View.show(state: .success, title: "修改成功", subtitle: "您的密码已修改成功,快去登录账户吧") {
|
self.navigationController?.popToRootViewController(animated: true)
|
}
|
}
|
}).disposed(by: disposeBag)
|
}
|
}
|