| | |
| | | |
| | | class UpdatePhoneVC: BaseVC { |
| | | private var credential:ASAuthorizationAppleIDCredential? |
| | | private var firstAccessToken:String? //后端问题,要把上次的token带过来 |
| | | @IBOutlet weak var tf_phone: QMUITextField! |
| | | @IBOutlet weak var tf_code: QMUITextField! |
| | | @IBOutlet weak var btn_code: UIButton! |
| | | @IBOutlet weak var btn_isRead: UIButton! |
| | | |
| | | init(credential:ASAuthorizationAppleIDCredential? = nil) { |
| | | |
| | | |
| | | init(credential:ASAuthorizationAppleIDCredential? = nil,firstAccessToken:String?) { |
| | | super.init(nibName: nil, bundle: nil) |
| | | self.credential = credential |
| | | self.firstAccessToken = firstAccessToken |
| | | } |
| | | |
| | | @MainActor required init?(coder: NSCoder) { |
| | | required init?(coder: NSCoder) { |
| | | fatalError("init(coder:) has not been implemented") |
| | | } |
| | | |
| | | override func viewDidLoad() { |
| | | super.viewDidLoad() |
| | | title = "验证手机号" |
| | | |
| | | } |
| | | |
| | | @IBAction func isReadAction(_ sender: UIButton) { |
| | | btn_isRead.isSelected = !btn_isRead.isSelected |
| | | } |
| | | |
| | | @IBAction func getCodeAction(_ sender: UIButton) { |
| | |
| | | }).disposed(by: disposeBag) |
| | | } |
| | | |
| | | @IBAction func userRegisterTreatyAction(_ sender: UIButton) { |
| | | let vc = LoginTreatyVC() |
| | | vc.topIndex = 0 |
| | | vc.clickHandle {[unowned self] state in |
| | | self.btn_isRead.isSelected = state |
| | | } |
| | | vc.modalPresentationStyle = .custom |
| | | present(vc, animated: true) |
| | | } |
| | | |
| | | @IBAction func userPrivateTreatyAction(_ sender: UIButton) { |
| | | let vc = LoginTreatyVC() |
| | | vc.topIndex = 1 |
| | | vc.clickHandle {[unowned self] state in |
| | | self.btn_isRead.isSelected = state |
| | | } |
| | | vc.modalPresentationStyle = .custom |
| | | present(vc, animated: true) |
| | | } |
| | | |
| | | @IBAction func loginAction(_ sender: UIButton) { |
| | | view.endEditing(true) |
| | | |
| | | guard btn_isRead.isSelected else { |
| | | alertError(msg: "请先阅读并同意《用户注册协议》《用户隐私协议》");return |
| | | } |
| | | |
| | | guard tf_phone.text!.jq_isPhone else { |
| | | alertError(msg: "请输入正确的手机号");return |
| | | } |
| | |
| | | Services.confirmByApple(cellPhone: tf_phone.text!, captcha: tf_code.text!, loginType: .apple, wxOrAppleId: credentialUser,name: formatName, mail: credential!.email).subscribe(onNext: {data in |
| | | if var model = data.data{ |
| | | model.loginByAppleToken = String(data: self.credential!.identityToken!, encoding: .utf8) |
| | | model.accessToken = self.firstAccessToken ?? "" |
| | | model.appleId = self.credential!.user |
| | | sceneDelegate?.loginSuccess() |
| | | NotificationCenter.default.post(name: LoginDismiss_Noti, object: nil, userInfo: nil) |
| | |
| | | } |
| | | }).disposed(by: disposeBag) |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |