| | |
| | | override func viewDidLoad() { |
| | | super.viewDidLoad() |
| | | |
| | | |
| | | #if DEBUG |
| | | tf_email.text = "eeee" |
| | | tf_pwd.text = "111111" |
| | | |
| | | #endif |
| | | |
| | | } |
| | | |
| | | @IBAction func forgotAction(_ sender: UIButton) { |
| | |
| | | |
| | | @IBAction func loginAction(_ sender: UIButton) { |
| | | |
| | | let snapView = screnDelegate?.window?.snapshotView(afterScreenUpdates: true) |
| | | let nav = BaseNavigationController(rootViewController: HomeVC()) |
| | | screnDelegate?.window?.rootViewController = nav |
| | | screnDelegate?.window?.rootViewController?.view.addSubview(snapView!) |
| | | |
| | | UIView.animate(withDuration: 1.5) { |
| | | snapView?.alpha = 0 |
| | | snapView?.transform3D = CATransform3DMakeScale(1.5, 1.5, 1.5) |
| | | } completion: { _ in |
| | | snapView?.removeFromSuperview() |
| | | #if !DEBUG |
| | | guard !tf_email.isEmpty else { |
| | | alert(msg: "Please input email");return |
| | | } |
| | | |
| | | guard tf_email.text!.jq_isEmail else { |
| | | alert(msg: "Please enter the correct email");return |
| | | } |
| | | |
| | | guard !tf_pwd.text!.isEmpty else { |
| | | alert(msg: "Please enter password");return |
| | | } |
| | | #endif |
| | | |
| | | Services.companyLogin(username: tf_email.text!, password: tf_pwd.text!).subscribe(onNext: { data in |
| | | if let model = data.data{ |
| | | UserViewModel.saveUserInfo(model) |
| | | let snapView = screnDelegate?.window?.snapshotView(afterScreenUpdates: true) |
| | | let nav = BaseNavigationController(rootViewController: HomeVC()) |
| | | screnDelegate?.window?.rootViewController = nav |
| | | screnDelegate?.window?.rootViewController?.view.addSubview(snapView!) |
| | | |
| | | UIView.animate(withDuration: 1.5) { |
| | | snapView?.alpha = 0 |
| | | snapView?.transform3D = CATransform3DMakeScale(1.5, 1.5, 1.5) |
| | | } completion: { _ in |
| | | snapView?.removeFromSuperview() |
| | | UserViewModel.publishLoginSuccess() |
| | | } |
| | | } |
| | | }) { error in |
| | | |
| | | }.disposed(by: disposeBag) |
| | | } |
| | | } |