杨锴
2025-04-16 09a372bc45fde16fd42257ab6f78b8deeecf720b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
//
//  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)
                }
}