Commit 07d1a9cd authored by pete谢兆麟's avatar pete谢兆麟

删除无用文件

parent d4293fc1
...@@ -246,8 +246,8 @@ ...@@ -246,8 +246,8 @@
049537852BA9B28500AF7E59 /* YHCertificateTemplateCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 049537842BA9B28500AF7E59 /* YHCertificateTemplateCell.swift */; }; 049537852BA9B28500AF7E59 /* YHCertificateTemplateCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 049537842BA9B28500AF7E59 /* YHCertificateTemplateCell.swift */; };
049663BA2BF6105C003C8295 /* YHRefreshHeaderAnimator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 049663B92BF6105C003C8295 /* YHRefreshHeaderAnimator.swift */; }; 049663BA2BF6105C003C8295 /* YHRefreshHeaderAnimator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 049663B92BF6105C003C8295 /* YHRefreshHeaderAnimator.swift */; };
049663C02BF729F6003C8295 /* galaxy_refresher.gif in Resources */ = {isa = PBXBuildFile; fileRef = 049663BF2BF729F5003C8295 /* galaxy_refresher.gif */; }; 049663C02BF729F6003C8295 /* galaxy_refresher.gif in Resources */ = {isa = PBXBuildFile; fileRef = 049663BF2BF729F5003C8295 /* galaxy_refresher.gif */; };
0499E3042C05B91A0037E646 /* YHAppleLoginViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0499E3032C05B91A0037E646 /* YHAppleLoginViewController.swift */; };
0499E3002C056EE30037E646 /* YHAutoLoginView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0499E2FF2C056EE30037E646 /* YHAutoLoginView.swift */; }; 0499E3002C056EE30037E646 /* YHAutoLoginView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0499E2FF2C056EE30037E646 /* YHAutoLoginView.swift */; };
0499E3042C05B91A0037E646 /* YHAppleLoginViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0499E3032C05B91A0037E646 /* YHAppleLoginViewController.swift */; };
049A48A82B49417300D0C641 /* YHAboutUsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 049A48A72B49417300D0C641 /* YHAboutUsViewController.swift */; }; 049A48A82B49417300D0C641 /* YHAboutUsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 049A48A72B49417300D0C641 /* YHAboutUsViewController.swift */; };
049A48AA2B49536000D0C641 /* YHAboutUsAdvantageCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 049A48A92B49536000D0C641 /* YHAboutUsAdvantageCell.swift */; }; 049A48AA2B49536000D0C641 /* YHAboutUsAdvantageCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 049A48A92B49536000D0C641 /* YHAboutUsAdvantageCell.swift */; };
049AC4C62BC3E55300F857F4 /* YHServiceSectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 049AC4C52BC3E55300F857F4 /* YHServiceSectionView.swift */; }; 049AC4C62BC3E55300F857F4 /* YHServiceSectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 049AC4C52BC3E55300F857F4 /* YHServiceSectionView.swift */; };
...@@ -427,8 +427,6 @@ ...@@ -427,8 +427,6 @@
A5D5ADEF2BB90FBC0039FA6B /* YHCheckEamilAlertView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5D5ADEE2BB90FBB0039FA6B /* YHCheckEamilAlertView.swift */; }; A5D5ADEF2BB90FBC0039FA6B /* YHCheckEamilAlertView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5D5ADEE2BB90FBB0039FA6B /* YHCheckEamilAlertView.swift */; };
A5DE0D3C2BB9016200976FE1 /* YHEmailInputAlertView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5DE0D3B2BB9016200976FE1 /* YHEmailInputAlertView.swift */; }; A5DE0D3C2BB9016200976FE1 /* YHEmailInputAlertView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5DE0D3B2BB9016200976FE1 /* YHEmailInputAlertView.swift */; };
A5DF3D462BF72BA1003D5F03 /* YHTestViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5DF3D452BF72BA0003D5F03 /* YHTestViewController.swift */; }; A5DF3D462BF72BA1003D5F03 /* YHTestViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5DF3D452BF72BA0003D5F03 /* YHTestViewController.swift */; };
A5DF3D482BF9A1D0003D5F03 /* YHPhoneLoginWithVideoBkgViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5DF3D472BF9A1D0003D5F03 /* YHPhoneLoginWithVideoBkgViewController.swift */; };
A5DF3D4E2BF9FDAC003D5F03 /* YHCodeSueecssWithVideoBkgViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5DF3D4D2BF9FDAC003D5F03 /* YHCodeSueecssWithVideoBkgViewController.swift */; };
A5E69D512BA304D400411932 /* DIN Alternate Bold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = A5E69D502BA304D400411932 /* DIN Alternate Bold.ttf */; }; A5E69D512BA304D400411932 /* DIN Alternate Bold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = A5E69D502BA304D400411932 /* DIN Alternate Bold.ttf */; };
A5EF21312BA6DF94005027E6 /* YHMineSchemeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5EF21302BA6DF94005027E6 /* YHMineSchemeViewController.swift */; }; A5EF21312BA6DF94005027E6 /* YHMineSchemeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5EF21302BA6DF94005027E6 /* YHMineSchemeViewController.swift */; };
A5EF21332BA6E030005027E6 /* YHFileListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5EF21322BA6E030005027E6 /* YHFileListViewController.swift */; }; A5EF21332BA6E030005027E6 /* YHFileListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5EF21322BA6E030005027E6 /* YHFileListViewController.swift */; };
...@@ -720,8 +718,8 @@ ...@@ -720,8 +718,8 @@
049537842BA9B28500AF7E59 /* YHCertificateTemplateCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCertificateTemplateCell.swift; sourceTree = "<group>"; }; 049537842BA9B28500AF7E59 /* YHCertificateTemplateCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCertificateTemplateCell.swift; sourceTree = "<group>"; };
049663B92BF6105C003C8295 /* YHRefreshHeaderAnimator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHRefreshHeaderAnimator.swift; sourceTree = "<group>"; }; 049663B92BF6105C003C8295 /* YHRefreshHeaderAnimator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHRefreshHeaderAnimator.swift; sourceTree = "<group>"; };
049663BF2BF729F5003C8295 /* galaxy_refresher.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = galaxy_refresher.gif; sourceTree = "<group>"; }; 049663BF2BF729F5003C8295 /* galaxy_refresher.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = galaxy_refresher.gif; sourceTree = "<group>"; };
0499E3032C05B91A0037E646 /* YHAppleLoginViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHAppleLoginViewController.swift; sourceTree = "<group>"; };
0499E2FF2C056EE30037E646 /* YHAutoLoginView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHAutoLoginView.swift; sourceTree = "<group>"; }; 0499E2FF2C056EE30037E646 /* YHAutoLoginView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHAutoLoginView.swift; sourceTree = "<group>"; };
0499E3032C05B91A0037E646 /* YHAppleLoginViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHAppleLoginViewController.swift; sourceTree = "<group>"; };
049A48A72B49417300D0C641 /* YHAboutUsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHAboutUsViewController.swift; sourceTree = "<group>"; }; 049A48A72B49417300D0C641 /* YHAboutUsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHAboutUsViewController.swift; sourceTree = "<group>"; };
049A48A92B49536000D0C641 /* YHAboutUsAdvantageCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHAboutUsAdvantageCell.swift; sourceTree = "<group>"; }; 049A48A92B49536000D0C641 /* YHAboutUsAdvantageCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHAboutUsAdvantageCell.swift; sourceTree = "<group>"; };
049AC4C52BC3E55300F857F4 /* YHServiceSectionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHServiceSectionView.swift; sourceTree = "<group>"; }; 049AC4C52BC3E55300F857F4 /* YHServiceSectionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHServiceSectionView.swift; sourceTree = "<group>"; };
...@@ -907,8 +905,6 @@ ...@@ -907,8 +905,6 @@
A5D5ADEE2BB90FBB0039FA6B /* YHCheckEamilAlertView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCheckEamilAlertView.swift; sourceTree = "<group>"; }; A5D5ADEE2BB90FBB0039FA6B /* YHCheckEamilAlertView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCheckEamilAlertView.swift; sourceTree = "<group>"; };
A5DE0D3B2BB9016200976FE1 /* YHEmailInputAlertView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHEmailInputAlertView.swift; sourceTree = "<group>"; }; A5DE0D3B2BB9016200976FE1 /* YHEmailInputAlertView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHEmailInputAlertView.swift; sourceTree = "<group>"; };
A5DF3D452BF72BA0003D5F03 /* YHTestViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHTestViewController.swift; sourceTree = "<group>"; }; A5DF3D452BF72BA0003D5F03 /* YHTestViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHTestViewController.swift; sourceTree = "<group>"; };
A5DF3D472BF9A1D0003D5F03 /* YHPhoneLoginWithVideoBkgViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHPhoneLoginWithVideoBkgViewController.swift; sourceTree = "<group>"; };
A5DF3D4D2BF9FDAC003D5F03 /* YHCodeSueecssWithVideoBkgViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCodeSueecssWithVideoBkgViewController.swift; sourceTree = "<group>"; };
A5E69D502BA304D400411932 /* DIN Alternate Bold.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "DIN Alternate Bold.ttf"; sourceTree = "<group>"; }; A5E69D502BA304D400411932 /* DIN Alternate Bold.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "DIN Alternate Bold.ttf"; sourceTree = "<group>"; };
A5EF21302BA6DF94005027E6 /* YHMineSchemeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHMineSchemeViewController.swift; sourceTree = "<group>"; }; A5EF21302BA6DF94005027E6 /* YHMineSchemeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHMineSchemeViewController.swift; sourceTree = "<group>"; };
A5EF21322BA6E030005027E6 /* YHFileListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHFileListViewController.swift; sourceTree = "<group>"; }; A5EF21322BA6E030005027E6 /* YHFileListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHFileListViewController.swift; sourceTree = "<group>"; };
...@@ -1730,6 +1726,14 @@ ...@@ -1730,6 +1726,14 @@
path = CustomRefreshHeader; path = CustomRefreshHeader;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
0499E2FE2C056ECA0037E646 /* V */ = {
isa = PBXGroup;
children = (
0499E2FF2C056EE30037E646 /* YHAutoLoginView.swift */,
);
path = V;
sourceTree = "<group>";
};
0499E3012C05B73D0037E646 /* AppleLogin(苹果登录) */ = { 0499E3012C05B73D0037E646 /* AppleLogin(苹果登录) */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
...@@ -1747,7 +1751,6 @@ ...@@ -1747,7 +1751,6 @@
path = C; path = C;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
04A671562B9F18C800C1FB91 /* MyCertificates(我的证书) */ = { 04A671562B9F18C800C1FB91 /* MyCertificates(我的证书) */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
...@@ -1860,14 +1863,6 @@ ...@@ -1860,14 +1863,6 @@
path = M; path = M;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
0499E2FE2C056ECA0037E646 /* V */ = {
isa = PBXGroup;
children = (
0499E2FF2C056EE30037E646 /* YHAutoLoginView.swift */,
);
path = V;
sourceTree = "<group>";
};
04D5C5642B8ED91200190021 /* M */ = { 04D5C5642B8ED91200190021 /* M */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
...@@ -2161,8 +2156,6 @@ ...@@ -2161,8 +2156,6 @@
04B9EE592C06CC3100A4018D /* YHOtherLoginViewController.swift */, 04B9EE592C06CC3100A4018D /* YHOtherLoginViewController.swift */,
0468D4252B495A5400CFB916 /* YHPickPhoneAddressViewController.swift */, 0468D4252B495A5400CFB916 /* YHPickPhoneAddressViewController.swift */,
04E86E0C2B70D51D00A35F4B /* YHWebViewViewController.swift */, 04E86E0C2B70D51D00A35F4B /* YHWebViewViewController.swift */,
A5DF3D472BF9A1D0003D5F03 /* YHPhoneLoginWithVideoBkgViewController.swift */,
A5DF3D4D2BF9FDAC003D5F03 /* YHCodeSueecssWithVideoBkgViewController.swift */,
); );
path = C; path = C;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -2909,7 +2902,6 @@ ...@@ -2909,7 +2902,6 @@
045EEECF2B9F171A0022A143 /* YHScoreOptionsView.swift in Sources */, 045EEECF2B9F171A0022A143 /* YHScoreOptionsView.swift in Sources */,
0445E6AF2BE9CFF6003C52F9 /* YHAppVersionForceUpdateView.swift in Sources */, 0445E6AF2BE9CFF6003C52F9 /* YHAppVersionForceUpdateView.swift in Sources */,
04B9EE5A2C06CC3100A4018D /* YHCodeSueecssViewController.swift in Sources */, 04B9EE5A2C06CC3100A4018D /* YHCodeSueecssViewController.swift in Sources */,
A5DF3D4E2BF9FDAC003D5F03 /* YHCodeSueecssWithVideoBkgViewController.swift in Sources */,
045EEEC12B9F171A0022A143 /* YHOtherInfoFillModel.swift in Sources */, 045EEEC12B9F171A0022A143 /* YHOtherInfoFillModel.swift in Sources */,
0468D43A2B579EAC00CFB916 /* YHLoginViewModel.swift in Sources */, 0468D43A2B579EAC00CFB916 /* YHLoginViewModel.swift in Sources */,
045EEE9E2B9F171A0022A143 /* YHWorkExampleModel.swift in Sources */, 045EEE9E2B9F171A0022A143 /* YHWorkExampleModel.swift in Sources */,
...@@ -3040,7 +3032,6 @@ ...@@ -3040,7 +3032,6 @@
045EEE822B9F171A0022A143 /* YHPersonInfoIdentityCardModel.swift in Sources */, 045EEE822B9F171A0022A143 /* YHPersonInfoIdentityCardModel.swift in Sources */,
045EEE952B9F171A0022A143 /* YHPreviewInfoCertificateInformationItemsView.swift in Sources */, 045EEE952B9F171A0022A143 /* YHPreviewInfoCertificateInformationItemsView.swift in Sources */,
044413FD2BC386DA00784A14 /* YHServiceViewController.swift in Sources */, 044413FD2BC386DA00784A14 /* YHServiceViewController.swift in Sources */,
A5DF3D482BF9A1D0003D5F03 /* YHPhoneLoginWithVideoBkgViewController.swift in Sources */,
045EEEBB2B9F171A0022A143 /* YHWorkIntroductionTableViewCell.swift in Sources */, 045EEEBB2B9F171A0022A143 /* YHWorkIntroductionTableViewCell.swift in Sources */,
045EEEED2B9F171A0022A143 /* YHParentInfoVC.swift in Sources */, 045EEEED2B9F171A0022A143 /* YHParentInfoVC.swift in Sources */,
04A7BC912B6B7B89000E8D47 /* YHTwoOptionAlertView.swift in Sources */, 04A7BC912B6B7B89000E8D47 /* YHTwoOptionAlertView.swift in Sources */,
......
//
// YHCodeSueecssWithVideoBkgViewController.swift
// galaxy
//
// Created by davidhuangA on 2024/5/19.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
import IQKeyboardManagerSwift
import AVFoundation
class YHCodeSueecssWithVideoBkgViewController: YHBaseViewController {
var time = 60
var bgImageView: UIImageView!
var closeButton: UIButton!
var loginTitleLabel: UILabel!
var loginSubTitleLabel: UILabel!
var getCodeLabel: UILabel!
var getCodeButton: UIButton!
var smscodeView: YHSmsCodeInputView!
var phoneNumber: String?
var viewModel: YHLoginViewModel?
private var isRequestFlag : Bool = false
override func viewDidLoad() {
super.viewDidLoad()
setView()
startTime()
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
smscodeView.textField.becomeFirstResponder()
}
//视频
private var player: AVPlayer?
private var playerLayer: AVPlayerLayer?
lazy var frontHoldView: UIView = {
let view = UIView()
view.backgroundColor = UIColor.mainTextColor30
return view
}()
override var preferredStatusBarStyle: UIStatusBarStyle {
return .lightContent
}
override func viewDidDisappear(_ animated: Bool) {
super.viewDidDisappear(animated)
isRequestFlag = false
}
}
extension YHCodeSueecssWithVideoBkgViewController {
private func setupBackgroundVideo() {
guard let videoURL = Bundle.main.url(forResource: "loginBkg", withExtension: "mov") else { return }
player = AVPlayer(url: videoURL)
player?.actionAtItemEnd = .none
playerLayer = AVPlayerLayer(player: player)
playerLayer?.frame = view.bounds
playerLayer?.videoGravity = .resizeAspectFill
view.layer.insertSublayer(playerLayer!, at: 0)
player?.play()
player?.seek(to: .zero)
NotificationCenter.default.addObserver(self, selector: #selector(playerItemDidPlayToEndTimeNotification), name: AVPlayerItem.didPlayToEndTimeNotification, object: nil)
}
@objc func playerItemDidPlayToEndTimeNotification() {
player?.seek(to: .zero)
}
}
extension YHCodeSueecssWithVideoBkgViewController {
func setView() {
viewModel = YHLoginViewModel()
gk_navBackgroundColor = .clear
gk_navShadowColor = .clear
gk_navigationBar.isHidden = true
view.backgroundColor = .white
setupBackgroundVideo()
setupFrontUI()
}
func requetLogin(phone: String, code: String) {
if isRequestFlag {
#if DEBUG
YHHUD.flash(message: "请求已发送")
#endif
return
}
isRequestFlag = true
YHHUD.show(.progress(message: "登录中..."))
self.viewModel?.login(phone : phone, code: code, callBackBlock: {[weak self] success,error in
YHHUD.hide()
self?.isRequestFlag = false
guard let self = self else { return }
if success == false {
if error?.errorCode == YHErrorCode.unregisterError.rawValue {
YHCommonAlertView.show("状态提示", "您的账号已注销,暂时无法登录app \n \r\n具体详情可邮件联系\r\nnick.gzm@galaxyoversea.com", "", "我知道了") {
self.navigationController?.popViewController()
}
} else {
self.smscodeView.textField.becomeFirstResponder()
YHHUD.flash(message: error?.errorMsg ?? "")
}
} else {
YHLoginManager.shared.loginSuccessActionBlock?()
YHHUD.flash(message: "登录成功")
IQKeyboardManager.shared.enable = true
self.dismiss(animated: true)
}
})
}
func startTime() {
getCodeLabel.isHidden = false
getCodeButton.isHidden = true
let sourceTimer = DispatchSource.makeTimerSource()
sourceTimer.schedule(deadline: DispatchTime.now(), repeating: DispatchTimeInterval.milliseconds(1000), leeway: DispatchTimeInterval.milliseconds(0))
sourceTimer.setEventHandler {
if self.time != 0 {
self.time -= 1
DispatchQueue.main.async {
self.getCodeLabel?.text = String.localizedStringWithFormat("重新获取(%d)",self.time)
}
} else if self.time <= 0 {
sourceTimer.cancel()
DispatchQueue.main.async {
self.time = 60
self.getCodeLabel.isHidden = true
self.getCodeButton.isHidden = false
}
}
}
// 启动定时器
sourceTimer.resume()
}
@objc func startClicked() {
YHHUD.show(.progress(message: ""))
viewModel?.getLoginCode(phoneNumber ?? "", callBackBlock: {[weak self] success,error in
YHHUD.hide()
guard let self = self else { return }
if success == true {
self.startTime()
} else {
YHHUD.flash(message: error?.errorMsg ?? "")
}
})
}
@objc func close() {
IQKeyboardManager.shared.enable = false
self.navigationController?.popViewController()
}
func setupFrontUI() {
// bgImageView = {
// let imageView = UIImageView()
// imageView.image = UIImage(named: "login_phone_bg_image")
// imageView.isUserInteractionEnabled = true
// return imageView
// }()
// view.addSubview(bgImageView)
// bgImageView.snp.makeConstraints { make in
// make.left.right.top.equalTo(view)
// make.height.equalTo(300)
// }
view.addSubview(frontHoldView)
frontHoldView.snp.makeConstraints { make in
make.edges.equalToSuperview()
}
closeButton = {
let button = UIButton(type: .custom)
// button.setImage(UIImage(named: "login_back"), for: .normal)
button.setImage(UIImage(named: "back_icon_for_code_input"), for: .normal)
button.addTarget(self, action: #selector(close), for: .touchUpInside)
return button
}()
frontHoldView.addSubview(closeButton)
closeButton.snp.makeConstraints { make in
make.left.equalTo(13)
make.top.equalTo(51)
make.width.height.equalTo(30)
}
loginTitleLabel = {
let label = UILabel()
label.text = "请输入验证码"
label.font = UIFont.PFSC_B(ofSize: 30)
label.textColor = UIColor.white
return label
}()
frontHoldView.addSubview(loginTitleLabel)
loginTitleLabel.snp.makeConstraints { make in
make.left.equalTo(24)
make.right.equalTo(-24)
make.top.equalTo(closeButton.snp.bottom).offset(67)
make.height.equalTo(42)
}
loginSubTitleLabel = {
let label = UILabel()
label.text = "已发送至 \(phoneNumber ?? "")"
label.font = UIFont.PFSC_R(ofSize: 15)
label.textColor = UIColor(hex: 0xffffff, alpha: 0.8)
return label
}()
frontHoldView.addSubview(loginSubTitleLabel)
loginSubTitleLabel.snp.makeConstraints { make in
make.left.equalTo(24)
make.right.equalTo(-24)
make.top.equalTo(loginTitleLabel.snp.bottom).offset(4)
make.height.equalTo(20)
}
smscodeView = {
let view = YHSmsCodeInputView(config: YHSmsCodeViewConfig())
view.complete = { [weak self] code in
guard let self = self else { return }
if let phone = self.phoneNumber {
// 登录接口需要加一个deviceToken参数
YHHUD.show(.progress(message: "登录中..."))
if YHLoginManager.shared.deviceTokenModel.registerId.isEmpty {
JPUSHService.registrationIDCompletionHandler {
resCode, registrationID in
YHHUD.hide()
YHLoginManager.shared.deviceTokenModel.registerId = registrationID ?? ""
self.requetLogin(phone: phone, code: code)
}
} else {
self.requetLogin(phone: phone, code: code)
}
} else {
printLog("errror : 电话号码为空")
}
}
return view
}()
frontHoldView.addSubview(smscodeView)
smscodeView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.top.equalTo(288)
make.height.equalTo(55)
}
getCodeLabel = {
let button = UILabel()
button.font = UIFont.PFSC_M(ofSize: 16)
button.text = "重新发送(58)"
button.textColor = UIColor.mainTextColor
button.textAlignment = .center
button.isHidden = false
button.layer.cornerRadius = 24
button.backgroundColor = UIColor.init(hex: 0xffffff,transparency: 0.4)
button.clipsToBounds = true
// button.layer.borderWidth = 1
// button.layer.borderColor = UIColor(hex: 0xebeef4).cgColor
return button
}()
frontHoldView.addSubview(getCodeLabel)
getCodeLabel.snp.makeConstraints { make in
make.centerX.equalToSuperview()
make.top.equalTo(382)
make.height.equalTo(48)
make.width.equalTo(335)
}
getCodeButton = {
let button = UIButton(type: .custom)
button.titleLabel?.font = UIFont.PFSC_M(ofSize: 16)
button.contentHorizontalAlignment = .center
button.setTitle("获取验证码", for: .normal)
button.setTitleColor( UIColor(hex: 0x000000, alpha: 1.0), for: .normal)
button.addTarget(self, action: #selector(startClicked), for: .touchUpInside)
button.isHidden = true
button.layer.cornerRadius = 24
button.clipsToBounds = true
button.backgroundColor = UIColor(hex: 0xffffff, alpha: 1.0)
// button.layer.borderWidth = 1
// button.layer.borderColor = UIColor(hex: 0xebeef4).cgColor
return button
}()
frontHoldView.addSubview(getCodeButton)
getCodeButton.snp.makeConstraints { make in
make.centerX.equalToSuperview()
make.top.equalTo(382)
make.height.equalTo(48)
make.width.equalTo(335)
}
let tap = UITapGestureRecognizer(target: self, action: #selector(clickFrontView))
frontHoldView.addGestureRecognizer(tap)
}
@objc func clickFrontView() {
self.smscodeView.textField.becomeFirstResponder()
}
}
//
// YHPhoneLiginWithVideoBkgViewController.swift
// galaxy
//
// Created by davidhuangA on 2024/5/19.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
import IQKeyboardManagerSwift
import AVFoundation
class YHPhoneLoginWithVideoBkgViewController: YHBaseViewController {
var bgImageView: UIImageView!
var closeButton: UIButton!
var logImageView: UIImageView!
var loginTitleLabel: UILabel!
var loginSubTitleLabel: UILabel!
var phoneMessageView: YHPhoneMessageView!
var getCodeButton: UIButton!
var privacyView: YHLoginPrivacyView!
var otherLoginButton: UIButton!
var viewModel: YHLoginViewModel?
override func viewDidLoad() {
super.viewDidLoad()
setView()
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
YHAnalytics.timeStrat("loginTime")
IQKeyboardManager.shared.enable = false
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
YHAnalytics.timeEnd("loginTime")
}
override func viewDidDisappear(_ animated: Bool) {
super.viewDidDisappear(animated)
}
//视频
private var player: AVPlayer?
private var playerLayer: AVPlayerLayer?
lazy var frontHoldView: UIView = {
let view = UIView()
view.backgroundColor = UIColor.mainTextColor30
return view
}()
lazy var contentHoldView: UIView = {
let view = UIView()
view.backgroundColor = .clear
return view
}()
// 视图控制器被销毁前,移除所有观察者
deinit {
NotificationCenter.default.removeObserver(self, name: UIResponder.keyboardWillShowNotification, object: nil)
NotificationCenter.default.removeObserver(self, name: UIResponder.keyboardWillHideNotification, object: nil)
UITextField.appearance().tintColor = .brandMainColor
}
}
extension YHPhoneLoginWithVideoBkgViewController {
@objc func keyboardWillShow(notification: NSNotification) {
if ((notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue) != nil {
contentHoldView.snp.remakeConstraints { make in
make.top.equalTo(loginSubTitleLabel.snp.bottom).offset(72)
make.left.right.equalToSuperview()
}
}
if let keyboardSize = (notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue {
let keyboardHeight = keyboardSize.height
// 使用键盘的高度进行后续操作
contentHoldView.snp.remakeConstraints { make in
make.bottom.equalToSuperview().offset(-32-keyboardHeight)
make.left.right.equalToSuperview()
}
}
}
// 键盘将要隐藏时的处理函数
@objc func keyboardWillHide(notification: NSNotification) {
contentHoldView.snp.remakeConstraints { make in
make.bottom.equalToSuperview().offset(-40)
make.left.right.equalToSuperview()
}
}
func setView() {
view.backgroundColor = .white
gk_navBackgroundColor = .clear
gk_navShadowColor = .clear
gk_navigationBar.isHidden = true
viewModel = YHLoginViewModel()
// 添加键盘显示的观察者
NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillShow), name: UIResponder.keyboardWillShowNotification, object: nil)
// 添加键盘隐藏的观察者
NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillHide), name: UIResponder.keyboardWillHideNotification, object: nil)
UITextField.appearance().tintColor = .white
setupBackgroundVideo()
setupFrontUI()
}
func setupFrontUI() {
view.addSubview(frontHoldView)
frontHoldView.snp.makeConstraints { make in
make.edges.equalToSuperview()
}
closeButton = {
let button = UIButton(type: .custom)
button.setImage(UIImage(named: "login_close"), for: .normal)
button.addTarget(self, action: #selector(close), for: .touchUpInside)
return button
}()
frontHoldView.addSubview(closeButton)
closeButton.snp.makeConstraints { make in
make.left.equalTo(13)
make.top.equalTo(51)
make.width.height.equalTo(30)
}
otherLoginButton = {
let button = UIButton(type: .custom)
button.setTitle("其他登录方式", for: .normal)
button.contentHorizontalAlignment = .right
button.titleLabel?.font = UIFont.PFSC_M(ofSize: 14)
button.setTitleColor(UIColor.white, for: .normal)
button.addTarget(self, action: #selector(otherLogin), for: .touchUpInside)
return button
}()
frontHoldView.addSubview(otherLoginButton)
otherLoginButton.snp.makeConstraints { make in
make.right.equalTo(-13)
make.height.equalTo(20)
make.width.equalTo(84)
make.centerY.equalTo(closeButton.snp.centerY)
}
logImageView = {
let imageView = UIImageView()
imageView.image = UIImage(named: "login_icon")
// imageView.layer.masksToBounds = true
// imageView.layer.cornerRadius = kCornerRadius8
return imageView
}()
frontHoldView.addSubview(logImageView)
logImageView.snp.makeConstraints { make in
make.left.equalTo(24)
make.top.equalTo(closeButton.snp.bottom).offset(32)
make.width.equalTo(82)
make.height.equalTo(30)
}
loginTitleLabel = {
let label = UILabel()
label.text = "欢迎来到银河港生活"
label.font = UIFont.PFSC_B(ofSize: 30)
label.textColor = UIColor.white
return label
}()
frontHoldView.addSubview(loginTitleLabel)
loginTitleLabel.snp.makeConstraints { make in
make.left.equalTo(logImageView.snp.left)
make.right.equalTo(-24)
make.top.equalTo(logImageView.snp.bottom).offset(12)
make.height.equalTo(42)
}
loginSubTitleLabel = {
let label = UILabel()
label.text = "手机号首次登录自动注册"
label.font = UIFont.PFSC_R(ofSize: 15)
label.textColor = UIColor(hex: 0xffffff, alpha: 0.8)
return label
}()
frontHoldView.addSubview(loginSubTitleLabel)
loginSubTitleLabel.snp.makeConstraints { make in
make.left.equalTo(logImageView.snp.left)
make.right.equalTo(-24)
make.top.equalTo(loginTitleLabel.snp.bottom).offset(4)
make.height.equalTo(20)
}
frontHoldView.addSubview(contentHoldView)
contentHoldView.snp.makeConstraints { make in
make.bottom.equalToSuperview().offset(-40)
make.left.right.equalToSuperview()
}
phoneMessageView = {
let view = YHPhoneMessageView()
view.backgroundColor = .clear//UIColor.contentBkgColor
view.phoneBlock = {[weak self] count in
guard let self = self else { return }
if count == 0 {
self.getCodeButton.backgroundColor = UIColor.white.withAlphaComponent(0.4)
self.getCodeButton.isEnabled = false
} else {
self.getCodeButton.backgroundColor = UIColor.white
self.getCodeButton.isEnabled = true
}
}
return view
}()
let attributes : [NSAttributedString.Key: Any] = [
.foregroundColor : UIColor(hex: 0xffffff, alpha: 0.5),
.font : UIFont(name: "DINAlternate-Bold", size: 18) as Any
]
phoneMessageView.phoneTextField.attributedPlaceholder = NSAttributedString(string: "请输入手机号",attributes: attributes)
contentHoldView.addSubview(phoneMessageView)
phoneMessageView.snp.makeConstraints { make in
make.left.equalTo(20)
make.right.equalTo(-20)
make.top.equalTo(0)
make.height.equalTo(44)
}
getCodeButton = {
let button = UIButton(type: .custom)
button.backgroundColor = UIColor.white.withAlphaComponent(0.4)
button.titleLabel?.font = UIFont.PFSC_M(ofSize: 16)
button.contentHorizontalAlignment = .center
button.setTitle("获取验证码", for: .normal)
button.setTitleColor( UIColor(hex:0x000000), for: .normal)
button.layer.cornerRadius = 24
button.addTarget(self, action: #selector(getCode), for: .touchUpInside)
button.isEnabled = false
return button
}()
contentHoldView.addSubview(getCodeButton)
getCodeButton.snp.makeConstraints { make in
make.left.equalTo(20)
make.right.equalTo(-20)
make.top.equalTo(phoneMessageView.snp.bottom).offset(32)
make.height.equalTo(48)
}
privacyView = {
let view = YHLoginPrivacyView()
return view
}()
contentHoldView.addSubview(privacyView)
privacyView.snp.makeConstraints { make in
make.top.equalTo(getCodeButton.snp.bottom).offset(24)
make.left.equalTo(20)
make.height.equalTo(20)
make.width.equalTo(260)
make.bottom.equalToSuperview()
}
}
@objc func getCode() {
let phoneNumer = phoneMessageView.phoneTextField.text ?? ""
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
YHHUD.hide()
guard let self = self else { return }
if success == true {
let vc = YHCodeSueecssWithVideoBkgViewController()
vc.phoneNumber = self.phoneMessageView.phoneTextField.text
self.navigationController?.pushViewController(vc)
} else {
var msg = error?.errorMsg ?? ""
if msg.isEmpty {
msg = String(error?.errorCode ?? 404)
}
YHHUD.flash(message: msg)
}
})
} else {
let view = YHPrivacyAlertView(frame: view.bounds)
view.urlBlock = { [weak self] (type,url) in
guard let self = self else { return }
let vc = YHWebViewViewController()
vc.url = url
if type == 0 {
vc.navTitle = "银河港生活隐私政策"
} else if type == 1 {
vc.navTitle = "银河港生活用户条款"
}
self.navigationController?.pushViewController(vc)
}
view.agreeBlock = { [weak self] in
guard let self = self else { return }
self.privacyView.isAgree = true
self.getCode()
}
self.view.addSubview(view)
}
}
@objc func close() {
YHLoginManager.shared.loginSuccessActionBlock = nil
IQKeyboardManager.shared.enable = true
dismiss(animated: true)
}
@objc func otherLogin() {
let vc = YHOtherLoginViewController()
self.navigationController?.pushViewController(vc)
}
}
extension YHPhoneLoginWithVideoBkgViewController {
private func setupBackgroundVideo() {
guard let videoURL = Bundle.main.url(forResource: "loginBkg", withExtension: "mov") else { return }
player = AVPlayer(url: videoURL)
player?.actionAtItemEnd = .none
playerLayer = AVPlayerLayer(player: player)
playerLayer?.frame = view.bounds
playerLayer?.videoGravity = .resizeAspectFill
view.layer.insertSublayer(playerLayer!, at: 0)
player?.play()
player?.seek(to: .zero)
NotificationCenter.default.addObserver(self, selector: #selector(playerItemDidPlayToEndTimeNotification), name: AVPlayerItem.didPlayToEndTimeNotification, object: nil)
}
@objc func playerItemDidPlayToEndTimeNotification() {
player?.seek(to: .zero)
}
}
...@@ -33,7 +33,7 @@ class YHLoginPrivacyView: UIView { ...@@ -33,7 +33,7 @@ class YHLoginPrivacyView: UIView {
agreeButton = { agreeButton = {
let button = UIButton(type: .custom) let button = UIButton(type: .custom)
button.setBackgroundImage(UIImage(named: "login_privacy_disagree_glay"), for: .normal) button.setBackgroundImage(UIImage(named: "login_privacy_disagree_glay"), for: .normal)
button.setBackgroundImage(UIImage(named: "login_privacy_agree_white"), for: .selected) button.setBackgroundImage(UIImage(named: "login_privacy_agree"), for: .selected)
button.addTarget(self, action: #selector(agreeClick), for: .touchUpInside) button.addTarget(self, action: #selector(agreeClick), for: .touchUpInside)
return button return button
......
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