IHSignUpManager.swift 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. //
  2. // IHSignUpManager.swift
  3. // Inhealth
  4. //
  5. // Created by weclouds on 2020/1/19.
  6. // Copyright © 2020 weclouds. All rights reserved.
  7. //
  8. import UIKit
  9. class IHSignUpManager: NSObject {
  10. // private var vc = UIViewController()
  11. private weak var vc : UIViewController?
  12. lazy var mainView: IHSignUpView = {
  13. let mainView = Bundle.main.loadNibNamed("IHSignUpView", owner: nil, options: nil)?.last as! IHSignUpView
  14. mainView.delegate = self
  15. return mainView
  16. }()
  17. func bindController(_ vc: UIViewController) {
  18. self.vc = vc
  19. createUI()
  20. }
  21. deinit {
  22. log.debug("IHSignUpManager销毁")
  23. }
  24. func createUI() {
  25. self.vc?.view.addSubview(mainView)
  26. self.vc?.navigationBarTitle = "注册帐号"
  27. setNavigationBar()
  28. }
  29. func setNavigationBar() {
  30. let backItem = UIBarButtonItem(image: UIImage(named: "返回"), style: .done, target: self, action: #selector(backAction))
  31. self.vc?.navigationItem.leftBarButtonItem = backItem
  32. }
  33. @objc func backAction() {
  34. self.vc?.dismiss(animated: true, completion: nil )
  35. }
  36. }
  37. extension IHSignUpManager:IHSignUpViewDelegate{
  38. //编辑注册信息
  39. func signupToService(_ account: String?, passowrd: String?, passwordAgain: String?) {
  40. if account == "" || passowrd == "" || passwordAgain == "" {
  41. g_showHUD("请填写全部内容")
  42. return
  43. }
  44. if passowrd != passwordAgain {
  45. g_showHUD("二次密码不一致")
  46. return
  47. }
  48. AppShare.register_username = account!
  49. AppShare.register_password = passowrd!
  50. let guestInfo = IHGuestInfoVCtr() //进入下一页继续编辑
  51. self.vc?.navigationController?.pushViewController(guestInfo, animated: true)
  52. }
  53. func goPrivacyPolicy() {
  54. let vc = IHPrivacyVCtr()
  55. let nav = IHNavigationController(rootViewController: vc)
  56. nav.modalPresentationStyle = .fullScreen
  57. self.vc?.present(nav, animated: true, completion: nil)
  58. }
  59. }