//
|
// BindPhone_2_VC.swift
|
// XQMuse
|
//
|
// Created by 无故事王国 on 2024/8/21.
|
//
|
|
import UIKit
|
import JQTools
|
import QMUIKit
|
|
class BindPhone_2_VC: BaseVC {
|
|
@IBOutlet weak var tf_phone: QMUITextField!
|
@IBOutlet weak var tf_code: QMUITextField!
|
@IBOutlet weak var btn_complete: UIButton!
|
override func viewDidLoad() {
|
super.viewDidLoad()
|
title = "更改绑定手机"
|
|
yy_popBlock = { [weak self] in
|
self?.navigationController?.popToRootViewController(animated: true)
|
}
|
}
|
|
@IBAction func sendCodeAction(_ sender: UIButton) {
|
Services.sendCode(phone:tf_phone.text!,type: .exchangePhone).subscribe(onNext: { data in
|
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: {
|
sender.titleLabel?.font = UIFont.systemFont(ofSize: 14, weight: .medium)
|
sender.setTitleColor(UIColor(hexStr: "#96AD81"), for: .normal)
|
}
|
}
|
}).disposed(by: disposeBag)
|
}
|
|
|
@IBAction func completeAction(_ sender: UIButton) {
|
|
view.endEditing(true)
|
|
guard !tf_phone.text!.isEmpty else{
|
alertError(msg: "请输入手机号");return
|
}
|
|
guard tf_phone.text!.jq_isPhone else{
|
alertError(msg: "请正确的手机号");return
|
}
|
|
guard !tf_code.text!.isEmpty else{
|
alertError(msg: "请输入验证码");return
|
}
|
|
guard tf_code.text!.count == 6 else{
|
alertError(msg: "请输入6位验证码");return
|
}
|
|
Services.changePhone(phone: tf_phone.text!, code: tf_code.text!).subscribe(onNext: {data in
|
let vc = BindPhone_3_VC()
|
self.push(vc: vc)
|
}).disposed(by: disposeBag)
|
}
|
|
override func viewDidLayoutSubviews() {
|
super.viewDidLayoutSubviews()
|
btn_complete.jq_gradientNibColor(colorArr: [UIColor(hexStr: "#8EA47A").cgColor,UIColor(hexStr: "#AFCA98").cgColor], cornerRadius: 20)
|
}
|
}
|