From 3d8ce4866799bea7e66699acdeb86b60b0ba033c Mon Sep 17 00:00:00 2001 From: 无故事王国 <841720330@qq.com> Date: 星期一, 03 六月 2024 19:51:06 +0800 Subject: [PATCH] add --- DolphinEnglishLearnStudent/Login/LoginVC.swift | 18 +++++++++++++----- 1 files changed, 13 insertions(+), 5 deletions(-) diff --git a/DolphinEnglishLearnStudent/Login/LoginVC.swift b/DolphinEnglishLearnStudent/Login/LoginVC.swift index 21da0cb..6b2dcd1 100644 --- a/DolphinEnglishLearnStudent/Login/LoginVC.swift +++ b/DolphinEnglishLearnStudent/Login/LoginVC.swift @@ -41,7 +41,7 @@ alert(msg: "请输入验证码");return false } - guard tf_phone.text!.count != 6 else { + guard tf_authCode.text!.count == 6 else { alert(msg: "请输入6位验证码");return false } return true @@ -54,14 +54,14 @@ /// 隐私协议 @IBAction func privacyAction(_ sender: UIButton) { - let vc = CommonWebVC(type: .privacyAgreement) + let vc = CommonWebVC(type: .PrivacyPolicy) vc.title = "隐私协议" self.navigationController?.pushViewController(vc, animated: true) } /// 用户协议 @IBAction func privacyUserAction(_ sender: UIButton) { - let vc = CommonWebVC(type: .userAgreement) + let vc = CommonWebVC(type: .UserProtocol) vc.title = "用户协议" self.navigationController?.pushViewController(vc, animated: true) } @@ -69,7 +69,9 @@ @IBAction func getCodeAction(_ sender: UIButton) { guard authInputPhone() else {return} - sender.openCountDown(60, defultTitle: "获取验证码", textColor:UIColor(hexStr: "#41A2EB"), unenableColor: .gray) + Services.sendPhoneCode(phone: tf_phone.text!).subscribe(onNext: {_ in + sender.openCountDown(60, defultTitle: "获取验证码", textColor:UIColor(hexStr: "#41A2EB"), unenableColor: .gray) + }).disposed(by: disposeBag) } @IBAction func loginAction(_ sender: UIButton) { @@ -81,6 +83,12 @@ alert(msg: "请阅读并同意《隐私协议》《用户协议》");return } - sceneDelegate?.loginSuccess() + Services.login(phone: tf_phone.text!, code: tf_authCode.text!).subscribe(onNext: {result in + if var token = result.data?.token{ + token.request_time = Int(Date().timeIntervalSince1970) + LoginTokenModel.saveToken(token) + sceneDelegate?.loginSuccess() + } + }).disposed(by: disposeBag) } } -- Gitblit v1.7.1