| | |
| | | @IBOutlet weak var tf_pwd: QMUITextField! |
| | | @IBOutlet weak var tf_pwdAgain: QMUITextField! |
| | | @IBOutlet weak var btn_register: UIButton! |
| | | |
| | | @IBOutlet weak var btn_isRead: UIButton! |
| | | |
| | | private var viewModel = RegisterViewModel() |
| | | |
| | | let shadowView = UIView() |
| | |
| | | guard !viewModel.phone.value.isEmpty else {alertError(msg: "请输入手机号");return} |
| | | guard viewModel.phone.value.jq_isPhone else {alertError(msg: "请输入正确手机号");return} |
| | | |
| | | 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) |
| | | } |
| | | Services.sendCode(type: .register).subscribe(onNext: {data in |
| | | if let _ = data.data{ |
| | | 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 registerAction(_ sender: UIButton) { |
| | | |
| | | guard viewModel.checkSafe() else {return} |
| | | view.endEditing(true) |
| | | guard viewModel.checkSafe() else {return} |
| | | guard btn_isRead.isSelected else { |
| | | alertError(msg: "请阅读并同意《用户注册协议》和《用户隐私协议》");return |
| | | } |
| | | |
| | | Services.register(cellPhone: viewModel.phone.value, captcha: viewModel.code.value, password: viewModel.pwd.value).subscribe(onNext: {data in |
| | | if let model = data.data{ |
| | | UserViewModel.saveUserInfo(model) |
| | | sceneDelegate?.loginSuccess() |
| | | } |
| | | }).disposed(by: disposeBag) |
| | | } |
| | | |
| | | @IBAction func isReadAction(_ sender: UIButton) { |
| | | sender.isSelected = !sender.isSelected |
| | | } |
| | | |
| | | |
| | | @IBAction func userResigerAgreementAction(_ sender: Any) { |
| | | let vc = WebVC() |
| | | let vc = WebVC(type: .user) |
| | | vc.title = "用户注册协议" |
| | | push(vc: vc) |
| | | } |
| | | |
| | | |
| | | @IBAction func userPrivateAgreementAction(_ sender: Any) { |
| | | let vc = WebVC() |
| | | let vc = WebVC(type: .privacy) |
| | | vc.title = "用户隐私协议" |
| | | push(vc: vc) |
| | | } |