|
@@ -17,11 +17,14 @@ class BindPhoneNumberView: BaseView {
|
|
|
|
|
|
/// 验证码
|
|
|
var sms : String = ""
|
|
|
+
|
|
|
+ /// 邀请码
|
|
|
+ var invitationCode : String = ""
|
|
|
|
|
|
typealias SendSmSBlock = (_ smsButton: CountdownButton,_ phoneNumber : String) -> Void
|
|
|
var sendSmSBlock : SendSmSBlock?
|
|
|
|
|
|
- typealias LoginBlock = (_ phoneNumber : String ,_ sms : String) -> Void
|
|
|
+ typealias LoginBlock = (_ phoneNumber : String ,_ sms : String,_ invitationCode : String) -> Void
|
|
|
var loginBlock : LoginBlock?
|
|
|
|
|
|
override func setupViews() {
|
|
@@ -37,6 +40,10 @@ class BindPhoneNumberView: BaseView {
|
|
|
smsBgView.addSubview(linesmsLabel)
|
|
|
smsBgView.addSubview(smsButton)
|
|
|
smsBgView.addSubview(smsTextField)
|
|
|
+
|
|
|
+ addSubview(invitationCodeBgView)
|
|
|
+ invitationCodeBgView.addSubview(lineInvitationCodeLabel)
|
|
|
+ invitationCodeBgView.addSubview(invitationCodeTextField)
|
|
|
|
|
|
addSubview(loginButton)
|
|
|
}
|
|
@@ -92,9 +99,23 @@ class BindPhoneNumberView: BaseView {
|
|
|
make.left.equalTo(phoneAreaCodeLabel)
|
|
|
make.width.equalTo(kScreenWidth - kScaleValue(value: 76 + 30 + smsButton.width))
|
|
|
}
|
|
|
+
|
|
|
+ invitationCodeBgView.snp.makeConstraints { (make) in
|
|
|
+ make.top.equalTo(smsBgView.snp.bottom)
|
|
|
+ make.left.right.height.equalTo(phoneNumberBgView)
|
|
|
+ }
|
|
|
+ lineInvitationCodeLabel.snp.makeConstraints { (make) in
|
|
|
+ make.left.right.bottom.equalToSuperview()
|
|
|
+ make.height.equalTo(0.5)
|
|
|
+ }
|
|
|
+ invitationCodeTextField.snp.makeConstraints { (make) in
|
|
|
+ make.left.right.equalToSuperview()
|
|
|
+ make.top.equalToSuperview().offset(kScaleValue(value: 6))
|
|
|
+ make.height.equalTo(phoneAreaCodeLabel)
|
|
|
+ }
|
|
|
|
|
|
loginButton.snp.makeConstraints { (make) in
|
|
|
- make.top.equalTo(smsBgView.snp.bottom).offset(kScaleValue(value: 35))
|
|
|
+ make.top.equalTo(invitationCodeBgView.snp.bottom).offset(kScaleValue(value: 35))
|
|
|
make.height.equalTo(kScaleValue(value:44))
|
|
|
make.left.equalToSuperview().offset(kScaleValue(value: 38))
|
|
|
make.right.equalToSuperview().offset(kScaleValue(value: -38))
|
|
@@ -146,7 +167,7 @@ class BindPhoneNumberView: BaseView {
|
|
|
phoneNumberTextField.clearButtonMode = .whileEditing
|
|
|
phoneNumberTextField.sizeToFit()
|
|
|
phoneNumberTextField.keyboardType = .numberPad
|
|
|
- phoneNumberTextField.tintColor = kFFA42FColor
|
|
|
+ phoneNumberTextField.tintColor = kThemeColor
|
|
|
|
|
|
phoneNumberTextField.rx.text.changed.subscribe(onNext: { [weak self] (text) in
|
|
|
self?.phoneNumberTextField.text = String(text?.prefix(11) ?? "") as String
|
|
@@ -173,12 +194,12 @@ class BindPhoneNumberView: BaseView {
|
|
|
smsButton.disabledText = " seconds后重新获取 "
|
|
|
smsButton.setTitle(smsButton.normalText, for: UIControl.State.normal)
|
|
|
smsButton.setTitle(smsButton.disabledText, for: UIControl.State.disabled)
|
|
|
- smsButton.setTitleColor(kFFA42FColor, for: UIControl.State.normal)
|
|
|
+ smsButton.setTitleColor(kThemeColor, for: UIControl.State.normal)
|
|
|
smsButton.setTitleColor(k333333Color, for: UIControl.State.disabled)
|
|
|
smsButton.titleLabel?.font = kScaleRegularFont12
|
|
|
smsButton.contentHorizontalAlignment = UIControl.ContentHorizontalAlignment.center
|
|
|
smsButton.sizeToFit()
|
|
|
- smsButton.normalBorderColor = kFFA42FColor
|
|
|
+ smsButton.normalBorderColor = kThemeColor
|
|
|
smsButton.normalBorderWidth = 0.5
|
|
|
smsButton.normalCornerRadius = kScaleValue(value: 15)
|
|
|
smsButton.normalBackgroundColor = UIColor.white
|
|
@@ -209,7 +230,7 @@ class BindPhoneNumberView: BaseView {
|
|
|
smsTextField.font = kScaleRegularFont16
|
|
|
smsTextField.sizeToFit()
|
|
|
smsTextField.keyboardType = .numberPad
|
|
|
- smsTextField.tintColor = kFFA42FColor
|
|
|
+ smsTextField.tintColor = kThemeColor
|
|
|
smsTextField.rx.text.changed.subscribe(onNext: { [weak self] (text) in
|
|
|
self?.smsTextField.text = String(text?.prefix(6) ?? "") as String
|
|
|
self?.sms = self?.smsTextField.text ?? ""
|
|
@@ -218,6 +239,33 @@ class BindPhoneNumberView: BaseView {
|
|
|
|
|
|
return smsTextField
|
|
|
}()
|
|
|
+
|
|
|
+ private lazy var invitationCodeBgView: UIView = {
|
|
|
+ let invitationCodeBgView = UIView()
|
|
|
+ return invitationCodeBgView
|
|
|
+ }()
|
|
|
+
|
|
|
+ private lazy var lineInvitationCodeLabel: UILabel = {
|
|
|
+ let lineInvitationCodeLabel = UILabel()
|
|
|
+ lineInvitationCodeLabel.backgroundColor = ke6e6e6Color
|
|
|
+ return lineInvitationCodeLabel
|
|
|
+ }()
|
|
|
+
|
|
|
+ private lazy var invitationCodeTextField : UITextField = {
|
|
|
+ let invitationCodeTextField = UITextField()
|
|
|
+ invitationCodeTextField.placeholder = "请输入邀请码(选填)"
|
|
|
+ invitationCodeTextField.borderStyle = .none
|
|
|
+ invitationCodeTextField.textColor = k666666Color
|
|
|
+ invitationCodeTextField.font = kScaleRegularFont16
|
|
|
+ invitationCodeTextField.clearButtonMode = .whileEditing
|
|
|
+ invitationCodeTextField.sizeToFit()
|
|
|
+ invitationCodeTextField.keyboardType = .numberPad
|
|
|
+ invitationCodeTextField.tintColor = kThemeColor
|
|
|
+ invitationCodeTextField.rx.text.orEmpty.changed.subscribe(onNext: { [weak self] (text) in
|
|
|
+ self?.invitationCode = self?.invitationCodeTextField.text ?? ""
|
|
|
+ }).disposed(by: disposeBag)
|
|
|
+ return invitationCodeTextField
|
|
|
+ }()
|
|
|
|
|
|
private lazy var loginButton: UIButton = {
|
|
|
let loginButton = UIButton(type: UIButton.ButtonType.custom)
|
|
@@ -233,7 +281,7 @@ class BindPhoneNumberView: BaseView {
|
|
|
loginButton.rx.tap.subscribe(onNext: { [weak self] (data) in
|
|
|
|
|
|
if let loginBlock = self?.loginBlock {
|
|
|
- loginBlock((self?.phoneNumber)!,(self?.sms)!)
|
|
|
+ loginBlock((self?.phoneNumber)!,(self?.sms)!,(self?.invitationCode)!)
|
|
|
}
|
|
|
|
|
|
}).disposed(by: disposeBag)
|
|
@@ -249,7 +297,7 @@ class BindPhoneNumberView: BaseView {
|
|
|
}.subscribe(onNext: {
|
|
|
[weak self] isEmpty in
|
|
|
self?.loginButton.isEnabled = isEmpty
|
|
|
- }).disposed(by: self.disposeBag)
|
|
|
+ }).disposed(by: self.disposeBag)
|
|
|
}
|
|
|
|
|
|
}
|