|
@@ -1,571 +0,0 @@
|
|
|
-//
|
|
|
-// JDForgotPasswordCell.swift
|
|
|
-// Koala
|
|
|
-//
|
|
|
-// Created by mac on 2023/10/16.
|
|
|
-// Copyright © 2023 刘千军. All rights reserved.
|
|
|
-//
|
|
|
-
|
|
|
-import UIKit
|
|
|
-
|
|
|
-class JDForgotPasswordCell: BaseTableViewCell {
|
|
|
- var index: Int = 0 // 选择下标 0 ,邮箱 ,1 手机
|
|
|
- var forgotPasswordVM: ForgotPasswordViewModel?
|
|
|
-
|
|
|
- lazy var countryView: UIView = {
|
|
|
- let v = UIView()
|
|
|
- v.backgroundColor = .clear
|
|
|
- v.isUserInteractionEnabled = true
|
|
|
-
|
|
|
- v.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(clickCountryCodeAction)))
|
|
|
- return v
|
|
|
- }()
|
|
|
-
|
|
|
- lazy var countryLb: UILabel = {
|
|
|
- let v = UILabel()
|
|
|
- v.textColor = .black
|
|
|
- v.setTextFont(.PFSM, 14)
|
|
|
- v.text = switchLanguage("国际/地区")
|
|
|
- return v
|
|
|
- }()
|
|
|
-
|
|
|
- lazy var countryLineView: UIView = {
|
|
|
- let v = UIView()
|
|
|
- v.backgroundColor = _color("#E8E8E8&#E8E8E8")
|
|
|
- return v
|
|
|
- }()
|
|
|
-
|
|
|
- lazy var countryArrowIv: UIImageView = {
|
|
|
- let v = UIImageView()
|
|
|
- v.image = _image("Base_W_RightArrows&Base_W_RightArrows")
|
|
|
- return v
|
|
|
- }()
|
|
|
-
|
|
|
- lazy var accountBgView: UIView = {
|
|
|
- let v = UIView()
|
|
|
- v.backgroundColor = .clear
|
|
|
- return v
|
|
|
- }()
|
|
|
-
|
|
|
- lazy var accountInputView: JDPhoneInputView = {
|
|
|
- let inView = JDPhoneInputView()
|
|
|
- inView.codeBgView.isHidden = false
|
|
|
- inView.textField.delegate = self
|
|
|
- inView.textField.addTarget(self, action: #selector(inputChange(_:)), for: .editingChanged)
|
|
|
- inView.clickCountryCodeBlock = { [weak self] in
|
|
|
- self?.clickCountryCodeAction()
|
|
|
- }
|
|
|
- return inView
|
|
|
- }()
|
|
|
-
|
|
|
- lazy var codeBgView: UIView = {
|
|
|
- let v = UIView()
|
|
|
-
|
|
|
- return v
|
|
|
- }()
|
|
|
-
|
|
|
- lazy var codeInputView: JDCodeInputView = {
|
|
|
- let inView = JDCodeInputView()
|
|
|
- inView.sendBgView.isHidden = false
|
|
|
- inView.textField.delegate = self
|
|
|
- inView.textField.addTarget(self, action: #selector(inputChange(_:)), for: .editingChanged)
|
|
|
-
|
|
|
- inView.clickSendCodeBlock = { [weak self] in
|
|
|
- self?.clickSendCodeAction()
|
|
|
- }
|
|
|
- return inView
|
|
|
- }()
|
|
|
-
|
|
|
- lazy var pwBgView: UIView = {
|
|
|
- let v = UIView()
|
|
|
-
|
|
|
- return v
|
|
|
- }()
|
|
|
-
|
|
|
- lazy var pwInputView: JDPasswordInputView = {
|
|
|
- let inView = JDPasswordInputView()
|
|
|
-// inView.setOpenBtnShow()
|
|
|
-
|
|
|
- inView.textField.delegate = self
|
|
|
- inView.textField.addTarget(self, action: #selector(inputChange(_:)), for: .editingChanged)
|
|
|
-// inView.setTitleText(text: switchLanguage("重置密码"))
|
|
|
- inView.setTextPlaceholder(text: "请设置密码")
|
|
|
- return inView
|
|
|
- }()
|
|
|
-
|
|
|
- lazy var rePwBgView: UIView = {
|
|
|
- let v = UIView()
|
|
|
-
|
|
|
- return v
|
|
|
- }()
|
|
|
-
|
|
|
- lazy var pwRepeatInputView: JDPasswordInputView = {
|
|
|
- let inView = JDPasswordInputView()
|
|
|
-// inView.setOpenBtnShow()
|
|
|
- inView.textField.delegate = self
|
|
|
- inView.textField.addTarget(self, action: #selector(inputChange(_:)), for: .editingChanged)
|
|
|
-// inView.setTitleText(text: switchLanguage("再一次输入新密码"))
|
|
|
- inView.setTextPlaceholder(text: "再次确认密码")
|
|
|
- return inView
|
|
|
- }()
|
|
|
-
|
|
|
- lazy var submitBtn: UIButton = {
|
|
|
- let submitBtn = UIButton(type: .custom)
|
|
|
- submitBtn.setTitle(switchLanguage("重置密码"), for: .normal)
|
|
|
- submitBtn.setTitleColor(WhiteTextColor, for: .normal)
|
|
|
- submitBtn.backgroundColor = MainBackGroundColor
|
|
|
- submitBtn.setViewLayerBorderColor(myColor: .clear, borderWidth: 0, maskBounds: 22)
|
|
|
- submitBtn.setTextFont(.PFSM, 16)
|
|
|
- submitBtn.addTarget(self, action: #selector(clickSubmitBtnAction), for: .touchUpInside)
|
|
|
- return submitBtn
|
|
|
-
|
|
|
- }()
|
|
|
-
|
|
|
- lazy var useEmailLoginBtn: UIButton = {
|
|
|
- let v = UIButton(type: .custom)
|
|
|
-
|
|
|
- v.setTitle(switchLanguage("使用邮箱"), for: .normal)
|
|
|
- v.setTitleColor(.black, for: .normal)
|
|
|
- v.setTextFont(.PFSR, 14)
|
|
|
- v.reactive.controlEvents(.touchUpInside).observeValues { [weak self] _ in
|
|
|
-
|
|
|
- if self?.index == 0 {
|
|
|
- self?.updateLayer(index: 1)
|
|
|
- } else {
|
|
|
- self?.updateLayer(index: 0)
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- return v
|
|
|
- }()
|
|
|
-
|
|
|
- lazy var textView: UITextView = {
|
|
|
- let v = UITextView()
|
|
|
-
|
|
|
- let str1: String = switchLanguage("返回登录")
|
|
|
-
|
|
|
- let attri = NSMutableAttributedString(attributedString: NSAttributedString(string: str1, attributes: [NSAttributedString.Key.foregroundColor: TitleTextColor, NSAttributedString.Key.font: UIFont.systemFont(ofSize: 14)]))
|
|
|
-// attri.addAttributes([NSAttributedString.Key.link:("Login"+"://")],
|
|
|
-// range: ((attri.string) as NSString).range(of: str1))
|
|
|
-
|
|
|
- attri.addAttributes([NSAttributedString.Key.link: "Login"+"://"], range: NSMakeRange(0, str1.length))
|
|
|
- v.linkTextAttributes = [NSAttributedString.Key.foregroundColor: TitleTextColor]
|
|
|
- v.attributedText = attri
|
|
|
- v.delegate = self
|
|
|
- v.textAlignment = .center
|
|
|
- v.backgroundColor = .clear
|
|
|
- v.isEditable = false
|
|
|
-
|
|
|
- return v
|
|
|
- }()
|
|
|
-
|
|
|
- override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
|
|
|
- super.init(style: style, reuseIdentifier: reuseIdentifier)
|
|
|
-
|
|
|
- contentView.backgroundColor = .clear
|
|
|
-
|
|
|
- contentView.addSubview(self.countryView)
|
|
|
- self.countryView.snp.makeConstraints { make in
|
|
|
- make.left.equalTo(contentView.snp.left).offset(18)
|
|
|
- make.right.equalTo(contentView.snp.right).offset(-18)
|
|
|
- make.top.equalTo(contentView.snp.top).offset(10)
|
|
|
- make.height.equalTo(50)
|
|
|
- }
|
|
|
- self.countryView.addSubview(self.countryLb)
|
|
|
- self.countryLb.snp.makeConstraints { make in
|
|
|
- make.left.equalTo(self.countryView.snp.left)
|
|
|
- make.centerY.equalTo(self.countryView)
|
|
|
- }
|
|
|
- self.countryView.addSubview(self.countryArrowIv)
|
|
|
- self.countryArrowIv.snp.makeConstraints { make in
|
|
|
- make.right.equalTo(self.countryView.snp.right)
|
|
|
- make.centerY.equalTo(self.countryView)
|
|
|
- make.size.equalTo(CGSize(width: 5, height: 10))
|
|
|
- }
|
|
|
- self.countryView.addSubview(self.countryLineView)
|
|
|
- self.countryLineView.snp.makeConstraints { make in
|
|
|
- make.left.right.bottom.equalTo(self.countryView)
|
|
|
- make.height.equalTo(1)
|
|
|
- }
|
|
|
-
|
|
|
- contentView.addSubview(self.accountBgView)
|
|
|
- self.accountBgView.snp.makeConstraints { make in
|
|
|
- make.left.right.equalTo(self.countryView)
|
|
|
- make.top.equalTo(self.countryView.snp.bottom)
|
|
|
- make.height.equalTo(50)
|
|
|
- }
|
|
|
- self.accountBgView.addSubview(self.accountInputView)
|
|
|
- self.accountInputView.snp.makeConstraints { make in
|
|
|
- make.edges.equalTo(self.accountBgView)
|
|
|
- }
|
|
|
-
|
|
|
- contentView.addSubview(self.codeBgView)
|
|
|
- self.codeBgView.snp.makeConstraints { make in
|
|
|
- make.left.right.equalTo(self.countryView)
|
|
|
- make.top.equalTo(self.accountBgView.snp.bottom)
|
|
|
- make.height.equalTo(50)
|
|
|
- }
|
|
|
-
|
|
|
- self.codeBgView.addSubview(self.codeInputView)
|
|
|
- self.codeInputView.snp.makeConstraints { make in
|
|
|
- make.edges.equalTo(self.codeBgView)
|
|
|
- }
|
|
|
-
|
|
|
- contentView.addSubview(self.pwBgView)
|
|
|
- self.pwBgView.snp.makeConstraints { make in
|
|
|
- make.left.right.equalTo(self.countryView)
|
|
|
- make.top.equalTo(self.codeBgView.snp.bottom)
|
|
|
- make.height.equalTo(50)
|
|
|
- }
|
|
|
-
|
|
|
- self.pwBgView.addSubview(self.pwInputView)
|
|
|
- self.pwInputView.snp.makeConstraints { make in
|
|
|
- make.edges.equalTo(self.pwBgView)
|
|
|
- }
|
|
|
-
|
|
|
- contentView.addSubview(self.rePwBgView)
|
|
|
- self.rePwBgView.snp.makeConstraints { make in
|
|
|
- make.left.right.equalTo(self.countryView)
|
|
|
- make.top.equalTo(self.pwBgView.snp.bottom)
|
|
|
- make.height.equalTo(50)
|
|
|
- }
|
|
|
-
|
|
|
- self.rePwBgView.addSubview(self.pwRepeatInputView)
|
|
|
- self.pwRepeatInputView.snp.makeConstraints { make in
|
|
|
- make.edges.equalTo(self.rePwBgView)
|
|
|
- }
|
|
|
-
|
|
|
- contentView.addSubview(self.submitBtn)
|
|
|
- self.submitBtn.snp.makeConstraints { make in
|
|
|
- make.left.right.equalTo(self.countryView)
|
|
|
- make.top.equalTo(self.rePwBgView.snp.bottom).offset(75)
|
|
|
- make.height.equalTo(44)
|
|
|
- }
|
|
|
-
|
|
|
- contentView.addSubview(self.useEmailLoginBtn)
|
|
|
- self.useEmailLoginBtn.snp.makeConstraints { make in
|
|
|
- make.top.equalTo(self.submitBtn.snp.bottom).offset(26)
|
|
|
- make.centerX.equalTo(contentView)
|
|
|
- }
|
|
|
-
|
|
|
- contentView.addSubview(self.textView)
|
|
|
- self.textView.snp.makeConstraints { make in
|
|
|
- make.top.equalTo(self.useEmailLoginBtn.snp.bottom).offset(100)
|
|
|
- make.centerX.equalTo(contentView)
|
|
|
- make.size.equalTo(CGSize(width: 200, height: 30))
|
|
|
- make.bottom.equalTo(contentView.snp.bottom).offset(-100)
|
|
|
- }
|
|
|
-
|
|
|
- self.updateLayer(index: 0)
|
|
|
- }
|
|
|
-
|
|
|
- @available(*, unavailable)
|
|
|
- required init?(coder aDecoder: NSCoder) {
|
|
|
- fatalError("init(coder:) has not been implemented")
|
|
|
- }
|
|
|
-
|
|
|
- /*
|
|
|
- override func awakeFromNib() {
|
|
|
- super.awakeFromNib()
|
|
|
- self.backgroundColor = ALLBackGroundColor
|
|
|
- self.contentView.backgroundColor = .clear
|
|
|
-
|
|
|
- self.accountBgView.backgroundColor = .clear
|
|
|
- self.codeBgView.backgroundColor = .clear
|
|
|
- self.pwBgView.backgroundColor = .clear
|
|
|
- self.pwRepeatBgView.backgroundColor = .clear
|
|
|
-
|
|
|
- self.accountBgView.addSubview(self.accountInputView)
|
|
|
- self.codeBgView.addSubview(self.codeInputView)
|
|
|
- self.pwBgView.addSubview(self.pwInputView)
|
|
|
- self.pwRepeatBgView.addSubview(self.pwRepeatInputView)
|
|
|
-
|
|
|
- self.accountInputView.snp.makeConstraints { make in
|
|
|
- make.edges.equalToSuperview()
|
|
|
- }
|
|
|
-
|
|
|
- self.codeInputView.snp.makeConstraints { make in
|
|
|
- make.edges.equalToSuperview()
|
|
|
- }
|
|
|
-
|
|
|
- self.pwInputView.snp.makeConstraints { make in
|
|
|
- make.edges.equalToSuperview()
|
|
|
- }
|
|
|
-
|
|
|
- self.pwRepeatInputView.snp.makeConstraints { make in
|
|
|
- make.edges.equalToSuperview()
|
|
|
- }
|
|
|
-
|
|
|
- submitBtn.setTitle(switchLanguage("重置密码"), for: .normal)
|
|
|
- submitBtn.setTitleColor(WhiteTextColor, for: .normal)
|
|
|
- submitBtn.backgroundColor = MainBackGroundColor
|
|
|
- submitBtn.setViewLayerBorderColor(myColor: .clear, borderWidth: 0, maskBounds: 4)
|
|
|
- submitBtn.setTextFont(.PFSM, 16)
|
|
|
- submitBtn.addTarget(self, action: #selector(clickSubmitBtnAction), for: .touchUpInside)
|
|
|
-
|
|
|
- let str1:String = switchLanguage("已有账户?")
|
|
|
- let str2:String = " " + switchLanguage("快速登录")
|
|
|
-
|
|
|
- let attri = NSMutableAttributedString(attributedString: NSAttributedString(string: str1 + str2,attributes:[NSAttributedString.Key.foregroundColor : TitleTextColor,NSAttributedString.Key.font : UIFont.systemFont(ofSize: 14)]))
|
|
|
- attri.addAttributes([NSAttributedString.Key.link:("Login"+"://")],
|
|
|
- range: ((attri.string) as NSString).range(of: str2))
|
|
|
- textView.linkTextAttributes = [NSAttributedString.Key.foregroundColor : MainBackGroundColor]
|
|
|
- textView.attributedText = attri
|
|
|
- textView.delegate = self
|
|
|
- textView.textAlignment = .center
|
|
|
- textView.backgroundColor = .clear
|
|
|
- textView.isEditable = false
|
|
|
-
|
|
|
- updateLayer(index: 0)
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- */
|
|
|
- override func setSelected(_ selected: Bool, animated: Bool) {
|
|
|
- super.setSelected(selected, animated: animated)
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-extension JDForgotPasswordCell: UITextFieldDelegate, UITextViewDelegate {
|
|
|
- func textView(_ textView: UITextView, shouldInteractWith URL: URL, in characterRange: NSRange) -> Bool {
|
|
|
- // 判断超链接协议
|
|
|
- if let sch = URL.scheme, sch == "Login" {
|
|
|
- currentVc()?.navigationController?.popViewController(animated: true)
|
|
|
- return true
|
|
|
- }
|
|
|
- return false
|
|
|
- }
|
|
|
-
|
|
|
- // MARK: - 输入框的变化
|
|
|
-
|
|
|
- @objc func inputChange(_ textField: UITextField) {
|
|
|
- let text = textField.text ?? ""
|
|
|
- if textField == self.accountInputView.textField {
|
|
|
- self.forgotPasswordVM?.account = text
|
|
|
- } else if textField == self.codeInputView.textField {
|
|
|
- self.forgotPasswordVM?.code = text
|
|
|
- } else if textField == self.pwInputView.textField {
|
|
|
- self.forgotPasswordVM?.pw = text
|
|
|
- } else {
|
|
|
- self.forgotPasswordVM?.pwRepeat = text
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // 限制输入
|
|
|
- func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
|
|
|
- let existingString: NSString = textField.text as NSString? ?? "" as NSString
|
|
|
- let candidateString = existingString.replacingCharacters(in: range, with: string)
|
|
|
- if candidateString.length < existingString.length {
|
|
|
- return true
|
|
|
- }
|
|
|
-
|
|
|
- return true
|
|
|
- }
|
|
|
-
|
|
|
- // 已经开始编辑
|
|
|
- func textFieldDidBeginEditing(_ textField: UITextField) {
|
|
|
- if textField == self.accountInputView.textField {
|
|
|
- self.accountInputView.bgView.removeErrorView()
|
|
|
-// self.accountInputView.bgView.updateLayerBorderColor(color: MainBackGroundColor)
|
|
|
- } else if textField == self.codeInputView.textField {
|
|
|
- self.codeInputView.bgView.removeErrorView()
|
|
|
-// self.codeInputView.bgView.updateLayerBorderColor(color: MainBackGroundColor)
|
|
|
- } else if textField == self.pwInputView.textField {
|
|
|
- self.pwInputView.bgView.removeErrorView()
|
|
|
-// self.pwInputView.bgView.updateLayerBorderColor(color: MainBackGroundColor)
|
|
|
- } else {
|
|
|
- self.pwRepeatInputView.bgView.removeErrorView()
|
|
|
-// self.pwRepeatInputView.bgView.updateLayerBorderColor(color: MainBackGroundColor)
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // 已经结束编辑
|
|
|
- func textFieldDidEndEditing(_ textField: UITextField) {
|
|
|
- let text: String = textField.text ?? ""
|
|
|
- if textField == self.accountInputView.textField {
|
|
|
- self.accountInputView.bgView.updateLayerBorderColor(color: .clear)
|
|
|
- if self.index == 0 { // 手机错误提示
|
|
|
- guard text.length > 0 else {
|
|
|
-// self.accountInputView.bgView.addErrorView(switchLanguage("请输入手机号"))
|
|
|
- return
|
|
|
- }
|
|
|
- } else if self.index == 1 { // 邮箱错误提示
|
|
|
- guard text.length > 0 else {
|
|
|
-// self.accountInputView.bgView.addErrorView(switchLanguage("请输入邮箱"))
|
|
|
- return
|
|
|
- }
|
|
|
- let pp = "^([a-zA-Z0-9_\\-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$"
|
|
|
- let predicate = NSPredicate(format: "SELF MATCHES %@", pp)
|
|
|
-
|
|
|
- if !predicate.evaluate(with: text) {
|
|
|
-// self.accountInputView.bgView.addErrorView(switchLanguage("邮箱格式错误"))
|
|
|
- }
|
|
|
- }
|
|
|
- } else if textField == self.codeInputView.textField {
|
|
|
-// self.codeInputView.bgView.updateLayerBorderColor(color: .clear)
|
|
|
- } else if textField == self.pwInputView.textField {
|
|
|
- self.pwInputView.bgView.updateLayerBorderColor(color: .clear)
|
|
|
- guard text.length > 0 else {
|
|
|
-// self.pwInputView.bgView.addErrorView(switchLanguage("请输入密码"))
|
|
|
- return
|
|
|
- }
|
|
|
- let pp = "^(?=.*[0-9])(?=.*[a-zA-Z])[0-9a-zA-Z~!@#$%^&*.?_-]{8,20}$"
|
|
|
- let predicate = NSPredicate(format: "SELF MATCHES %@", pp)
|
|
|
-
|
|
|
- if !predicate.evaluate(with: text) {
|
|
|
-// self.pwInputView.bgView.addErrorView(switchLanguage("8-20位字符,必须包含数字和字母"))
|
|
|
- }
|
|
|
- } else if textField == self.pwRepeatInputView.textField {
|
|
|
- self.pwRepeatInputView.bgView.updateLayerBorderColor(color: .clear)
|
|
|
- guard text == self.pwInputView.textField.text ?? "" else {
|
|
|
-// self.pwRepeatInputView.bgView.addErrorView(switchLanguage("两次密码不一致"))
|
|
|
- return
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-extension JDForgotPasswordCell {
|
|
|
- func updateLayer(index: Int) {
|
|
|
- self.index = index
|
|
|
- self.forgotPasswordVM?.type = index
|
|
|
- if index == 0 {
|
|
|
- self.accountInputView.codeBgView.isHidden = false
|
|
|
- self.accountInputView.setTextPlaceholder(text: switchLanguage("请输入手机号码"))
|
|
|
-
|
|
|
- self.accountInputView.updateLayerView(index: 0)
|
|
|
- self.useEmailLoginBtn.setTitle(switchLanguage("使用邮箱"), for: .normal)
|
|
|
-
|
|
|
- } else {
|
|
|
- self.accountInputView.codeBgView.isHidden = true
|
|
|
- self.accountInputView.setTextPlaceholder(text: switchLanguage("请输入邮箱地址"))
|
|
|
- self.accountInputView.updateLayerView(index: 1)
|
|
|
- self.useEmailLoginBtn.setTitle(switchLanguage("使用手机"), for: .normal)
|
|
|
- }
|
|
|
-
|
|
|
- self.codeInputView.setTextPlaceholder(text: switchLanguage("请输入验证码"))
|
|
|
- self.pwInputView.setTextPlaceholder(text: switchLanguage("请设置密码"))
|
|
|
- self.pwRepeatInputView.setTextPlaceholder(text: switchLanguage("再次确认密码"))
|
|
|
-
|
|
|
- self.accountInputView.textField.text = ""
|
|
|
- self.codeInputView.textField.text = ""
|
|
|
- self.pwInputView.textField.text = ""
|
|
|
- self.pwRepeatInputView.textField.text = ""
|
|
|
-
|
|
|
- self.accountInputView.bgView.removeErrorView()
|
|
|
- self.codeInputView.bgView.removeErrorView()
|
|
|
- self.pwInputView.bgView.removeErrorView()
|
|
|
- self.pwRepeatInputView.bgView.removeErrorView()
|
|
|
-
|
|
|
- self.forgotPasswordVM?.account = ""
|
|
|
- self.forgotPasswordVM?.pw = ""
|
|
|
- self.forgotPasswordVM?.code = ""
|
|
|
- self.forgotPasswordVM?.pwRepeat = ""
|
|
|
- }
|
|
|
-
|
|
|
- //
|
|
|
- func forgotPasswordUpdate(vm: ForgotPasswordViewModel) {
|
|
|
- self.forgotPasswordVM = vm
|
|
|
- self.updateLayer(index: 0)
|
|
|
-// self.accountInputView.leftCodeBtn.setTitle(emojiFlagForISOCountryCode(countryCode: vm.abbreviate), for: .normal)
|
|
|
-
|
|
|
- self.countryLb.text = "国际/地区("+vm.countryName+")"
|
|
|
-// self.accountInputView.rightCodeBtn.setTitle("+"+vm.areaCode, for: .normal)
|
|
|
- self.accountInputView.rightCodeLb.text = "+"+vm.areaCode
|
|
|
- self.accountInputView.textField.text = vm.account
|
|
|
- self.codeInputView.textField.text = vm.code
|
|
|
- self.pwInputView.textField.text = vm.pw
|
|
|
- self.pwRepeatInputView.textField.text = vm.pwRepeat
|
|
|
- }
|
|
|
-
|
|
|
- @objc func clickCountryCodeAction() {
|
|
|
- self.endEditing(true)
|
|
|
- let pop = CountrySelectPopView()
|
|
|
- pop.showRelyPopupView(view: self.countryView) { [weak self] model in
|
|
|
- if model.areaCode.length > 0 {
|
|
|
-// self?.accountInputView.leftCodeBtn.setTitle(emojiFlagForISOCountryCode(countryCode: model.abbreviate), for: .normal)
|
|
|
- self?.countryLb.text = "国际/地区("+model.name+")"
|
|
|
-// self?.accountInputView.rightCodeBtn.setTitle("+"+model.areaCode, for: .normal)
|
|
|
- self?.accountInputView.rightCodeLb.text = "+"+model.areaCode
|
|
|
- self?.forgotPasswordVM?.abbreviate = model.abbreviate
|
|
|
- self?.forgotPasswordVM?.areaCode = model.areaCode
|
|
|
- self?.forgotPasswordVM?.countryName = model.name
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- func clickSendCodeAction() {
|
|
|
- self.endEditing(true)
|
|
|
- guard (self.accountInputView.textField.text ?? "").length > 0 else {
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
- self.forgotPasswordVM?.netCode()
|
|
|
- }
|
|
|
-
|
|
|
- @objc func clickSubmitBtnAction() {
|
|
|
- self.endEditing(true)
|
|
|
-
|
|
|
-// guard (accountInputView.textField.text ?? "").length > 0 else {
|
|
|
-//
|
|
|
-// ProgressHUD.showError(status: switchLanguage("请输入账号"))
|
|
|
-// return
|
|
|
-// }
|
|
|
-//
|
|
|
-// guard (codeInputView.textField.text ?? "").length > 0 else {
|
|
|
-//
|
|
|
-// ProgressHUD.showError(status: switchLanguage("请输入验证码"))
|
|
|
-// return
|
|
|
-// }
|
|
|
-//
|
|
|
-// guard (pwInputView.textField.text ?? "").length > 0 else {
|
|
|
-//
|
|
|
-// ProgressHUD.showError(status: switchLanguage("请输入密码"))
|
|
|
-// return
|
|
|
-// }
|
|
|
-//
|
|
|
-// let pp = "^(?=.*[0-9])(?=.*[a-zA-Z])[0-9a-zA-Z~!@#$%^&*.?_-]{8,20}$"
|
|
|
-// let predicate = NSPredicate.init(format: "SELF MATCHES %@",pp)
|
|
|
-//
|
|
|
-// if !predicate .evaluate(with: pwInputView.textField.text ?? ""){
|
|
|
-//
|
|
|
-// // self.pwInputView.bgView.addErrorView(switchLanguage("8-20位字符,必须包含数字和字母"))
|
|
|
-// ProgressHUD.showError(status: switchLanguage("8-20位字符"))
|
|
|
-// return
|
|
|
-// }
|
|
|
-
|
|
|
- guard (self.accountInputView.textField.text ?? "").length > 0 else {
|
|
|
- ProgressHUD.showError(status: switchLanguage("请输入账号"))
|
|
|
-
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
- guard (self.codeInputView.textField.text ?? "").length > 0 else {
|
|
|
- ProgressHUD.showError(status: switchLanguage("请输入验证码"))
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
- guard (self.pwInputView.textField.text ?? "").length > 0 else {
|
|
|
- ProgressHUD.showError(status: switchLanguage("请输入新密码"))
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
- let pp = "^(?=.*[0-9])(?=.*[a-zA-Z])[0-9a-zA-Z~!@#$%^&*.?_-]{8,20}$"
|
|
|
- let predicate = NSPredicate(format: "SELF MATCHES %@", pp)
|
|
|
-
|
|
|
- if !predicate.evaluate(with: self.pwInputView.textField.text ?? "") {
|
|
|
- ProgressHUD.showError(status: switchLanguage("8-20位字符,包含数字和字母"))
|
|
|
-
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
- guard (self.pwInputView.textField.text ?? "") == (self.pwRepeatInputView.textField.text ?? "") else {
|
|
|
- ProgressHUD.showError(status: switchLanguage("确认密码输入不一致"))
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
- self.forgotPasswordVM?.netNewPassword()
|
|
|
- }
|
|
|
-}
|