Commit df53d118 authored by pete谢兆麟's avatar pete谢兆麟

登录需求

parent ac1b7ec7
......@@ -1187,6 +1187,8 @@
04AE205A2D1944D600891D24 /* YHGCMyFileListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AE20592D1944D600891D24 /* YHGCMyFileListViewController.swift */; };
04AE20632D1ADA8100891D24 /* YHGCPreviewViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AE20622D1ADA8100891D24 /* YHGCPreviewViewModel.swift */; };
04AE20652D1BD9B500891D24 /* YHGCCertificateEntryCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AE20642D1BD9B500891D24 /* YHGCCertificateEntryCell.swift */; };
04E4CF3E2D5C6D32004D4013 /* YHCountryMessageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04E4CF3D2D5C6D32004D4013 /* YHCountryMessageView.swift */; };
04E4CF402D5C83AE004D4013 /* YHSelectPhoneCountryViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04E4CF3F2D5C83AE004D4013 /* YHSelectPhoneCountryViewController.swift */; };
04EA376D2BEA06EF00DBAF64 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 04EA376C2BEA06EF00DBAF64 /* WebKit.framework */; };
04EA376F2BEA071600DBAF64 /* libc++.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 04EA376E2BEA070500DBAF64 /* libc++.tbd */; };
6203A87EDC96313BBE789D9C /* Pods_galaxy.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 987C69D43AE8D85DC1930DCF /* Pods_galaxy.framework */; };
......@@ -2411,6 +2413,8 @@
04AE20592D1944D600891D24 /* YHGCMyFileListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHGCMyFileListViewController.swift; sourceTree = "<group>"; };
04AE20622D1ADA8100891D24 /* YHGCPreviewViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHGCPreviewViewModel.swift; sourceTree = "<group>"; };
04AE20642D1BD9B500891D24 /* YHGCCertificateEntryCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHGCCertificateEntryCell.swift; sourceTree = "<group>"; };
04E4CF3D2D5C6D32004D4013 /* YHCountryMessageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCountryMessageView.swift; sourceTree = "<group>"; };
04E4CF3F2D5C83AE004D4013 /* YHSelectPhoneCountryViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHSelectPhoneCountryViewController.swift; sourceTree = "<group>"; };
04EA376C2BEA06EF00DBAF64 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; };
04EA376E2BEA070500DBAF64 /* libc++.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = "libc++.tbd"; path = "usr/lib/libc++.tbd"; sourceTree = SDKROOT; };
04FA8B2D2C084C7E00ABE43F /* ATAuthSDK.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; name = ATAuthSDK.bundle; path = "galaxy/Classes/Modules/AutoLogin(一键登录)/framework/ATAuthSDK_D.framework/ATAuthSDK.bundle"; sourceTree = "<group>"; };
......@@ -5518,6 +5522,7 @@
045C0EA82D12CA5E00BD2DC0 /* YHPickPhoneAddressViewController.swift */,
045C0EA92D12CA5E00BD2DC0 /* YHUserInfoSettingViewController.swift */,
045C0EAA2D12CA5E00BD2DC0 /* YHWebViewViewController.swift */,
04E4CF3F2D5C83AE004D4013 /* YHSelectPhoneCountryViewController.swift */,
);
path = C;
sourceTree = "<group>";
......@@ -5558,6 +5563,7 @@
045C0EB72D12CA5E00BD2DC0 /* YHLoginPrivacyView.swift */,
045C0EB82D12CA5E00BD2DC0 /* YHLoginStyleButton.swift */,
045C0EB92D12CA5E00BD2DC0 /* YHPhoneMessageView.swift */,
04E4CF3D2D5C6D32004D4013 /* YHCountryMessageView.swift */,
045C0EBA2D12CA5E00BD2DC0 /* YHPrivacyAlertView.swift */,
045C0EBB2D12CA5E00BD2DC0 /* YHValidateCodeInputView.swift */,
);
......@@ -7222,6 +7228,7 @@
045C112F2D12CA5F00BD2DC0 /* YHAboutUsAdvantageCell.swift in Sources */,
045C11302D12CA5F00BD2DC0 /* YHQuestionAndAnswerModel.swift in Sources */,
045C11312D12CA5F00BD2DC0 /* YHAdopterIncomeDetailViewController.swift in Sources */,
04E4CF3E2D5C6D32004D4013 /* YHCountryMessageView.swift in Sources */,
045C11322D12CA5F00BD2DC0 /* YHAdopterBirthViewController.swift in Sources */,
045C11332D12CA5F00BD2DC0 /* YHFormItemEnterDetailCell.swift in Sources */,
045C11342D12CA5F00BD2DC0 /* YHHomeWebViewModel.swift in Sources */,
......@@ -7790,6 +7797,7 @@
045C13332D12CA5F00BD2DC0 /* YHResignCertificateDetailViewController.swift in Sources */,
045C13342D12CA5F00BD2DC0 /* YHDeviceInfoViewController.swift in Sources */,
045C13352D12CA5F00BD2DC0 /* YHScoreOptionsView.swift in Sources */,
04E4CF402D5C83AE004D4013 /* YHSelectPhoneCountryViewController.swift in Sources */,
045C13362D12CA5F00BD2DC0 /* YHQualificationDetailVC.swift in Sources */,
045C13372D12CA5F00BD2DC0 /* YHResignFamilyInfoListCell.swift in Sources */,
045C13382D12CA5F00BD2DC0 /* YHButlerMessageReportHandler.swift in Sources */,
......@@ -8029,11 +8037,9 @@
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES;
CODE_SIGN_ENTITLEMENTS = galaxy/galaxyTestEnv.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 12;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = RXHYW88XR7;
DEVELOPMENT_TEAM = RXHYW88XR7;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
......@@ -8063,7 +8069,6 @@
PRODUCT_BUNDLE_IDENTIFIER = com.intelligence.galaxy;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = com.dev.profile;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = TESTENV;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_OBJC_BRIDGING_HEADER = "$(SRCROOT)/$(TARGET_NAME)/Res/galaxy-Bridge-Header.h";
......@@ -8178,11 +8183,9 @@
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES;
CODE_SIGN_ENTITLEMENTS = galaxy/galaxy.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 12;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = RXHYW88XR7;
DEVELOPMENT_TEAM = RXHYW88XR7;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
......@@ -8212,7 +8215,6 @@
PRODUCT_BUNDLE_IDENTIFIER = com.intelligence.galaxy;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = com.dev.profile;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = UATENV;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_OBJC_BRIDGING_HEADER = "$(SRCROOT)/$(TARGET_NAME)/Res/galaxy-Bridge-Header.h";
......@@ -8389,11 +8391,9 @@
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES;
CODE_SIGN_ENTITLEMENTS = galaxy/galaxyDebug.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 12;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = RXHYW88XR7;
DEVELOPMENT_TEAM = RXHYW88XR7;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
......@@ -8423,7 +8423,6 @@
PRODUCT_BUNDLE_IDENTIFIER = com.intelligence.galaxy;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = com.dev.profile;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_OBJC_BRIDGING_HEADER = "$(SRCROOT)/$(TARGET_NAME)/Res/galaxy-Bridge-Header.h";
SWIFT_VERSION = 5.0;
......@@ -8440,11 +8439,9 @@
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES;
CODE_SIGN_ENTITLEMENTS = galaxy/galaxy.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 12;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = RXHYW88XR7;
DEVELOPMENT_TEAM = RXHYW88XR7;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
......@@ -8474,7 +8471,6 @@
PRODUCT_BUNDLE_IDENTIFIER = com.intelligence.galaxy;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = com.dev.profile;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_OBJC_BRIDGING_HEADER = "$(SRCROOT)/$(TARGET_NAME)/Res/galaxy-Bridge-Header.h";
SWIFT_VERSION = 5.0;
......
......@@ -158,7 +158,7 @@ extension YHSelectCountryViewController: UITableViewDelegate, UITableViewDataSou
class YHCountryTableViewCell: UITableViewCell {
var titleLabel: UILabel!
var messagelabel: UILabel!
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
......@@ -193,6 +193,20 @@ class YHCountryTableViewCell: UITableViewCell {
make.centerY.equalToSuperview()
make.height.equalTo(20)
}
messagelabel = {
let label = UILabel()
label.font = UIFont.PFSC_R(ofSize: 13)
label.textColor = UIColor.mainTextColor
label.textAlignment = .right
return label
}()
contentView.addSubview(messagelabel)
messagelabel.snp.makeConstraints { make in
make.right.equalTo(-22)
make.centerY.equalToSuperview()
make.height.equalTo(20)
}
}
}
......@@ -13,6 +13,13 @@ class YHCountryMessage: SmartCodable {
var name_cn: String?
var name_en: String?
var code: String?
required init() {
}
init(name_cn: String? = nil, name_en: String? = nil, code: String? = nil) {
self.name_cn = name_cn
self.name_en = name_en
self.code = code
}
}
......@@ -23,6 +23,7 @@ class YHCodeSueecssViewController: YHBaseViewController {
var viewModel: YHLoginViewModel?
let appleLoginViewModel = YHAppleLoginViewModel()
var token: String = ""
var country: Country = Country(name: "中国大陆", code: "86", index: "")
var appleLoginParams: [String : Any] = [:]
private var isRequestFlag : Bool = false
......@@ -167,7 +168,7 @@ class YHCodeSueecssViewController: YHBaseViewController {
if type == .phone {
YHHUD.show(.progress(message: "登录中..."))
self.viewModel?.login(phone : phone, code: code, callBackBlock: {[weak self] success,error in
self.viewModel?.login(phone : phone, code: code, countryCode: self.country.code, callBackBlock: {[weak self] success,error in
YHHUD.hide()
self?.isRequestFlag = false
guard let self = self else { return }
......@@ -194,7 +195,7 @@ class YHCodeSueecssViewController: YHBaseViewController {
}
if type == .wechat {
self.viewModel?.wxlogin(unionId: self.token, phone: phone, code: code, callBackBlock: {[weak self] success, error in
self.viewModel?.wxlogin(unionId: self.token, phone: phone, code: code, countryCode: self.country.code, callBackBlock: {[weak self] success, error in
self?.isRequestFlag = false
guard let self = self else { return }
if success == false {
......@@ -219,6 +220,7 @@ class YHCodeSueecssViewController: YHBaseViewController {
var params = self.appleLoginParams
params["sms_code"] = code
params["mobile"] = phone
params["mobile_area_code"] = "+" + self.country.code
printLog("Apple login parmas: \(params)")
YHHUD.show(.progress(message: ""))
self.appleLoginViewModel.appleLogin(params: params) {[weak self] success, error in
......@@ -270,7 +272,7 @@ class YHCodeSueecssViewController: YHBaseViewController {
@objc func startClicked() {
YHHUD.show(.progress(message: ""))
viewModel?.getLoginCode(phoneNumber ?? "", callBackBlock: {[weak self] success,error in
viewModel?.getLoginCode(phoneNumber ?? "", code: self.country.code, callBackBlock: {[weak self] success,error in
YHHUD.hide()
guard let self = self else { return }
......
......@@ -28,6 +28,7 @@ class YHOtherLoginViewController: YHBaseViewController {
var loginTitleLabel: UILabel!
var loginSubTitleLabel: UILabel!
var phoneMessageView: YHPhoneMessageView!
var countryMessageView: YHCountryMessageView!
var getCodeButton: UIButton!
var wechatButton: UIButton!
var appleButton: UIButton!
......@@ -37,6 +38,7 @@ class YHOtherLoginViewController: YHBaseViewController {
var type: YHLoginType = .phone
var token: String = ""
var appleLoginParams: [String : Any] = [:]
var country: Country = Country(name: "中国大陆", code: "86", index: "")
override func viewDidLoad() {
super.viewDidLoad()
......@@ -118,6 +120,28 @@ class YHOtherLoginViewController: YHBaseViewController {
}()
view.addSubview(phoneMessageView)
phoneMessageView.snp.makeConstraints { make in
make.left.equalTo(20)
make.right.equalTo(-20)
make.top.equalTo(356)
make.height.equalTo(56)
}
countryMessageView = {
let view = YHCountryMessageView()
view.block = {[weak self] in
guard let self = self else { return }
let vc = YHSelectPhoneCountryViewController()
vc.backLocationStringController = { (country) in
self.country = country
self.countryMessageView.messageButton.setTitle(country.name, for: .normal)
self.phoneMessageView.messageButton.setTitle("+\(country.code)", for: .normal)
}
UIViewController.current?.navigationController?.pushViewController(vc)
}
return view
}()
view.addSubview(countryMessageView)
countryMessageView.snp.makeConstraints { make in
make.left.equalTo(20)
make.right.equalTo(-20)
make.top.equalTo(300)
......@@ -140,7 +164,7 @@ class YHOtherLoginViewController: YHBaseViewController {
getCodeButton.snp.makeConstraints { make in
make.left.equalTo(20)
make.right.equalTo(-20)
make.top.equalTo(373)
make.top.equalTo(431)
make.height.equalTo(48)
}
......@@ -150,7 +174,7 @@ class YHOtherLoginViewController: YHBaseViewController {
}()
view.addSubview(privacyView)
privacyView.snp.makeConstraints { make in
make.top.equalTo(442)
make.top.equalTo(503)
make.left.equalTo(25)
make.height.equalTo(20)
make.width.equalTo(260)
......@@ -237,13 +261,16 @@ class YHOtherLoginViewController: YHBaseViewController {
IQKeyboardManager.shared.resignFirstResponder()
if type == .phone {
let phoneNumer = phoneMessageView.phoneTextField.text ?? ""
guard phoneNumer.isMobile() == true else {
YHHUD.flash(message: "请输入正确的手机号")
return
if self.country.code == "86" {
guard phoneNumer.isMobile() == true else {
YHHUD.flash(message: "请输入正确的手机号")
return
}
}
if privacyView.isAgree {
YHHUD.show(.progress(message: ""))
viewModel?.getLoginCode(phoneNumer, callBackBlock: {[weak self] success,error in
viewModel?.getLoginCode(phoneNumer, code: self.country.code, callBackBlock: {[weak self] success,error in
YHHUD.hide()
guard let self = self else { return }
......@@ -251,6 +278,7 @@ class YHOtherLoginViewController: YHBaseViewController {
if success == true {
let vc = YHCodeSueecssViewController()
vc.phoneNumber = self.phoneMessageView.phoneTextField.text
vc.country = self.country
vc.type = self.type
vc.token = self.token
self.navigationController?.pushViewController(vc)
......@@ -286,12 +314,14 @@ class YHOtherLoginViewController: YHBaseViewController {
}
if type == .wechat {
let phoneNumer = phoneMessageView.phoneTextField.text ?? ""
guard phoneNumer.isMobile() == true else {
YHHUD.flash(message: "请输入正确的手机号")
return
if self.country.code == "86" {
guard phoneNumer.isMobile() == true else {
YHHUD.flash(message: "请输入正确的手机号")
return
}
}
YHHUD.show(.progress(message: ""))
viewModel?.getLoginCode(phoneNumer, callBackBlock: {[weak self] success,error in
viewModel?.getLoginCode(phoneNumer, code: self.country.code, callBackBlock: {[weak self] success,error in
YHHUD.hide()
guard let self = self else { return }
......@@ -299,6 +329,7 @@ class YHOtherLoginViewController: YHBaseViewController {
if success == true {
let vc = YHCodeSueecssViewController()
vc.phoneNumber = self.phoneMessageView.phoneTextField.text
vc.country = self.country
vc.type = self.type
vc.token = self.token
self.navigationController?.pushViewController(vc)
......@@ -313,12 +344,14 @@ class YHOtherLoginViewController: YHBaseViewController {
}
if type == .apple {
let phoneNumer = phoneMessageView.phoneTextField.text ?? ""
guard phoneNumer.isMobile() == true else {
YHHUD.flash(message: "请输入正确的手机号")
return
if self.country.code == "86" {
guard phoneNumer.isMobile() == true else {
YHHUD.flash(message: "请输入正确的手机号")
return
}
}
YHHUD.show(.progress(message: ""))
viewModel?.getLoginCode(phoneNumer, callBackBlock: {[weak self] success,error in
viewModel?.getLoginCode(phoneNumer, code: self.country.code, callBackBlock: {[weak self] success,error in
YHHUD.hide()
guard let self = self else { return }
......@@ -326,6 +359,7 @@ class YHOtherLoginViewController: YHBaseViewController {
if success == true {
let vc = YHCodeSueecssViewController()
vc.phoneNumber = self.phoneMessageView.phoneTextField.text
vc.country = self.country
vc.type = self.type
vc.token = self.token
vc.appleLoginParams = self.appleLoginParams
......@@ -347,7 +381,7 @@ class YHOtherLoginViewController: YHBaseViewController {
login.sendLogin()
login.success = { [weak self] unionId in
guard let self = self else { return }
self.viewModel.wxlogin(unionId: unionId, phone: "", code: "") {[weak self] success, error in
self.viewModel.wxlogin(unionId: unionId, phone: "", code: "", countryCode: self.country.code) {[weak self] success, error in
guard let self = self else { return }
if success {
YHLoginManager.shared.loginSuccessActionBlock?()
......
//
// YHCountryMessageView.swift
// galaxy
//
// Created by EDY on 2025/2/12.
// Copyright © 2025 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHCountryMessageView: UIView {
typealias PhoneBlock = (_ count: Int) -> ()
typealias Block = () -> ()
var block: Block?
var messageButton: UIButton!
var titleButton: UIButton!
var allowButton: UIButton!
override init(frame: CGRect) {
super.init(frame: frame)
setView()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func setView() {
titleButton = {
let button = UIButton(type: .custom)
button.titleLabel?.font = UIFont.PFSC_M(ofSize: 16)
button.setTitle("国家/地区", for: .normal)
button.setTitleColor(UIColor.mainTextColor, for: .normal)
button.addTarget(self, action: #selector(messageClick), for: .touchUpInside)
button.contentHorizontalAlignment = .left
return button
}()
addSubview(titleButton)
titleButton.snp.makeConstraints { make in
make.top.bottom.equalToSuperview()
make.left.equalToSuperview()
make.width.equalTo(85)
make.height.equalTo(20)
}
messageButton = {
let button = UIButton(type: .custom)
button.titleLabel?.font = UIFont.PFSC_M(ofSize: 16)
button.setTitle("中国大陆", for: .normal)
button.setTitleColor(UIColor.mainTextColor, for: .normal)
button.addTarget(self, action: #selector(messageClick), for: .touchUpInside)
button.contentHorizontalAlignment = .left
return button
}()
addSubview(messageButton)
messageButton.snp.makeConstraints { make in
make.top.bottom.equalToSuperview()
make.left.equalTo(105)
make.right.equalToSuperview()
make.height.equalTo(20)
}
allowButton = {
let button = UIButton(type: .custom)
button.setBackgroundImage(UIImage(named: "form_right_arrow"), for: .normal)
button.addTarget(self, action: #selector(messageClick), for: .touchUpInside)
return button
}()
addSubview(allowButton)
allowButton.snp.makeConstraints { make in
make.centerY.right.equalToSuperview()
make.width.height.equalTo(16)
}
let lineone = UIView()
lineone.backgroundColor = UIColor(hex: 0xf0f3f7, alpha: 0.8)
addSubview(lineone)
lineone.snp.makeConstraints { make in
make.left.equalTo(89)
make.height.equalTo(20)
make.width.equalTo(0.5)
make.centerY.equalToSuperview()
}
let line = UIView()
line.backgroundColor = UIColor(hex: 0xf0f3f7, alpha: 0.8)
addSubview(line)
line.snp.makeConstraints { make in
make.bottom.left.right.equalToSuperview()
make.height.equalTo(0.5)
}
}
@objc func messageClick() {
if let block = block {
block()
}
}
}
......@@ -14,7 +14,9 @@ class YHPhoneMessageView: UIView {
var block: Block?
var phoneBlock: PhoneBlock?
var messageButton: UIButton!
var titleButton: UIButton!
var phoneTextField: UITextField!
override init(frame: CGRect) {
super.init(frame: frame)
setView()
......@@ -25,20 +27,37 @@ class YHPhoneMessageView: UIView {
}
func setView() {
titleButton = {
let button = UIButton(type: .custom)
button.titleLabel?.font = UIFont.PFSC_M(ofSize: 16)
button.setTitle("手机号", for: .normal)
button.setTitleColor(UIColor.mainTextColor, for: .normal)
button.addTarget(self, action: #selector(messageClick), for: .touchUpInside)
button.contentHorizontalAlignment = .left
return button
}()
addSubview(titleButton)
titleButton.snp.makeConstraints { make in
make.top.bottom.equalToSuperview()
make.left.equalToSuperview()
make.width.equalTo(85)
make.height.equalTo(20)
}
messageButton = {
let button = UIButton(type: .custom)
button.titleLabel?.font = UIFont(name: "DINAlternate-Bold", size: 18)
button.titleLabel?.font = UIFont.PFSC_M(ofSize: 16)
button.setTitle("+86", for: .normal)
button.setTitleColor(UIColor.mainTextColor, for: .normal)
button.setTitleColor(UIColor(hex: 0x8993a2), for: .normal)
button.addTarget(self, action: #selector(messageClick), for: .touchUpInside)
button.titleLabel?.textAlignment = .left
button.contentHorizontalAlignment = .left
return button
}()
addSubview(messageButton)
messageButton.snp.makeConstraints { make in
make.top.bottom.equalToSuperview()
make.left.equalToSuperview()
make.width.equalTo(30)
make.left.equalTo(105)
make.width.equalTo(40)
make.height.equalTo(20)
}
......@@ -61,7 +80,15 @@ class YHPhoneMessageView: UIView {
make.height.equalTo(20)
make.right.equalToSuperview()
}
let lineone = UIView()
lineone.backgroundColor = UIColor(hex: 0xf0f3f7, alpha: 0.8)
addSubview(lineone)
lineone.snp.makeConstraints { make in
make.left.equalTo(89)
make.height.equalTo(20)
make.width.equalTo(0.5)
make.centerY.equalToSuperview()
}
let line = UIView()
line.backgroundColor = UIColor(hex: 0xf0f3f7, alpha: 0.8)
......
......@@ -21,10 +21,11 @@ class YHLoginViewModel: YHBaseViewModel {
//接口
extension YHLoginViewModel {
//发送验证码
func getLoginCode(_ phone: String, callBackBlock: @escaping (_ success: Bool,_ error:YHErrorModel?)->()) {
func getLoginCode(_ phone: String, code: String, callBackBlock: @escaping (_ success: Bool,_ error:YHErrorModel?)->()) {
let params: [String : Any] = ["type": "Phone",
"value": XXTEA.encryptString(toBase64String: phone, stringKey: "galaxyapps") ?? phone,
"extend":"register"]
"extend":"register",
"code": "+" + code]
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.User.verifyCode
let _ = YHNetRequest.postRequest(url: strUrl, params: params) {[weak self] json, code in
......@@ -48,13 +49,14 @@ extension YHLoginViewModel {
}
}
func login(phone: String, code: String,callBackBlock: @escaping (_ success: Bool,_ error: YHErrorModel?)->()) {
func login(phone: String, code: String, countryCode: String, callBackBlock: @escaping (_ success: Bool,_ error: YHErrorModel?)->()) {
let timestamp = Int(Date().timeIntervalSince1970)
print(timestamp)
let params: [String : Any] = ["mobile": XXTEA.encryptString(toBase64String: phone, stringKey: "galaxyapps") ?? phone,
"sms_code": code,
"client": "super_app",
"mobile_area_code": "+" + countryCode,
"testTimestamp":timestamp]
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Auth.login
let _ = YHNetRequest.postRequest(url: strUrl, params: params) {[weak self] json, code in
......@@ -135,18 +137,20 @@ extension YHLoginViewModel {
}
}
func wxlogin(unionId: String, phone: String, code: String, callBackBlock: @escaping (_ success: Bool,_ error: YHErrorModel?)->()) {
func wxlogin(unionId: String, phone: String, code: String, countryCode: String, callBackBlock: @escaping (_ success: Bool,_ error: YHErrorModel?)->()) {
let timestamp = Int(Date().timeIntervalSince1970)
print(timestamp)
var params: [String : Any] = ["union_id": unionId,
"client": "super_app",
"mobile_area_code": "+" + countryCode,
"testTimestamp":timestamp]
if phone.count != 0 {
params = ["union_id": unionId,
"mobile": phone,
"sms_code": code,
"client": "super_app",
"mobile_area_code": "+" + countryCode,
"testTimestamp":timestamp]
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment