| | |
| | | @IBOutlet weak var cons_registerCenterX: NSLayoutConstraint! |
| | | @IBOutlet weak var cons_loginCenterX: NSLayoutConstraint! |
| | | @IBOutlet weak var btn_reader: UIButton! |
| | | @IBOutlet weak var cons_stackHei: NSLayoutConstraint! |
| | | @IBOutlet weak var stack_handleView: UIStackView! |
| | | |
| | | |
| | | @IBOutlet weak var cons_loginWidth: NSLayoutConstraint! |
| | | private let loginType = BehaviorRelay<LoginType>(value: .pwd) |
| | |
| | | textView_treaty.isEditable = false |
| | | let paragraphStyle = NSMutableParagraphStyle() |
| | | paragraphStyle.lineBreakMode = NSLineBreakMode.byCharWrapping |
| | | |
| | | paragraphStyle.lineSpacing = 3 |
| | | |
| | | let content = "我已阅读并同意《隐私协议》《用户协议》《运动安全告知书》" |
| | | let attribute = NSMutableAttributedString(string: content) |
| | | attribute.addAttributes([NSAttributedString.Key.link:URL(string: "tip://treaty")!], range: content.jq_subRange("《隐私协议》")!) |
| | | attribute.addAttribute(.foregroundColor, value: UIColor.black.withAlphaComponent(0.6), range: NSRange(location: 0, length: content.count)) |
| | | attribute.addAttribute(.font, value: UIFont.systemFont(ofSize: 12, weight: .medium), range: NSRange(location: 0, length: content.count)) |
| | | attribute.addAttributes([NSAttributedString.Key.link:URL(string: "tip://treaty")!,.foregroundColor:UIColor(hexStr: "0078CD")], range: content.jq_subRange("《隐私协议》")!) |
| | | attribute.addAttributes([NSAttributedString.Key.link:URL(string: "tip://user")!], range: content.jq_subRange("《用户协议》")!) |
| | | attribute.addAttributes([NSAttributedString.Key.link:URL(string: "tip://sportSafety")!], range: content.jq_subRange("《运动安全告知书》")!) |
| | | attribute.addAttributes([.paragraphStyle:paragraphStyle], range: _NSRange(location: 0, length: content.count)) |
| | |
| | | case .pwd: |
| | | weakSelf.tf_verify.isSecureTextEntry = !weakSelf.btn_eye.isSelected |
| | | weakSelf.tf_verify.keyboardType = .default |
| | | weakSelf.tf_verify.maximumTextLength = 30 |
| | | weakSelf.tf_verify.maximumTextLength = 18 |
| | | weakSelf.tf_verify.placeholder = "请输入密码" |
| | | case .smsCode: |
| | | weakSelf.tf_verify.isSecureTextEntry = false |
| | |
| | | |
| | | let str = btn_pwdLogin.isSelected ? "登录":"注册/登录" |
| | | |
| | | self.cons_stackHei.constant = self.btn_pwdLogin.isSelected ? 25:0 |
| | | |
| | | UIView.animate(withDuration: 0.4) { |
| | | self.view.layoutIfNeeded() |
| | | self.btn_login.setTitle(str, for: .normal) |
| | | if self.btn_pwdLogin.isSelected{ |
| | | self.stack_handleView.alpha = 1 |
| | | self.btn_login.localGradientColor(cornerRadius: 20,bounds: CGRect(x: 0, y: 0, width: 144, height: 40)) |
| | | }else{ |
| | | self.stack_handleView.alpha = 0 |
| | | self.btn_login.localGradientColor(cornerRadius: 20,bounds: CGRect(x: 0, y: 0, width: 189, height: 40)) |
| | | } |
| | | } completion: { _ in |
| | |
| | | |
| | | @IBAction func getCodeAction(_ sender: UIButton) { |
| | | guard !tf_phone.text!.isEmpty else {alertError(msg: tf_phone.placeholder!);return} |
| | | guard tf_phone.text!.jq_isPhone else {alertError(msg: "请输入正确的手机号");return} |
| | | guard tf_phone.text!.jq_isPhone else {alertError(msg: "请输入正确的手机号");return} |
| | | Services.getSMSCode(phone: tf_phone.text!, type: .login).subscribe(onNext: {data in |
| | | if data.code == 200{ |
| | | sender.jq_openCountDown() |
| | | sender.openCountDown() |
| | | }else{ |
| | | alertError(msg: data.msg) |
| | | } |
| | |
| | | |
| | | let type = loginType.value |
| | | guard !tf_phone.text!.isEmpty else {alertError(msg: tf_phone.placeholder!);return} |
| | | guard tf_phone.text!.jq_isPhone else {alertError(msg: "请输入正确的手机号");return} |
| | | guard !tf_verify.text!.isEmpty else {alertError(msg: tf_verify.placeholder!);return} |
| | | guard btn_reader.isSelected else {alert(msg: "请先仔细阅读并同意协议");return} |
| | | guard btn_reader.isSelected else {alert(msg: "请阅读并同意《隐私协议》《用户协议》《运动安全告知书》");return} |
| | | |
| | | Services.login(phone: tf_phone.text!, verity: tf_verify.text!, type: type).subscribe(onNext: {data in |
| | | if let token = data.data{ |
| | |
| | | } |
| | | |
| | | @IBAction func registerAction(_ sender: UIButton) { |
| | | guard btn_reader.isSelected else {alert(msg: "请阅读并同意《隐私协议》《用户协议》《运动安全告知书》");return} |
| | | let vc = LoginRegOrForgotVC(type: .register) |
| | | push(vc: vc) |
| | | } |
| | |
| | | } |
| | | |
| | | @IBAction func wechatLoginAcion(_ sender: QMUIButton) { |
| | | guard btn_reader.isSelected else {alert(msg: "请先仔细阅读并同意协议");return} |
| | | guard btn_reader.isSelected else {alert(msg: "请阅读并同意《隐私协议》《用户协议》《运动安全告知书》");return} |
| | | showHUD() |
| | | WeChatTools.sendAuthRequest() |
| | | } |