SMobileChangeViewController.swift 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. //
  2. // SMobileChangeViewController.swift
  3. // O2Platform
  4. //
  5. // Created by 刘振兴 on 2016/10/17.
  6. // Copyright © 2016年 zoneland. All rights reserved.
  7. //
  8. import UIKit
  9. import Alamofire
  10. import AlamofireImage
  11. import AlamofireObjectMapper
  12. import ObjectMapper
  13. import CocoaLumberjack
  14. import O2OA_Auth_SDK
  15. class SMobileChangeViewController: UIViewController {
  16. @IBOutlet weak var modifyButton: UIButton!
  17. @IBOutlet weak var phoneNumberLabel: UILabel!
  18. override func awakeFromNib() {
  19. }
  20. override func viewDidLoad() {
  21. super.viewDidLoad()
  22. let mobile = O2AuthSDK.shared.bindDevice()?.mobile
  23. self.phoneNumberLabel.text = mobile
  24. self.modifyButton.layer.borderWidth = 1.0
  25. self.modifyButton.layer.cornerRadius = 20
  26. self.modifyButton.layer.masksToBounds = true
  27. self.modifyButton.layer.borderColor = base_color.cgColor
  28. self.modifyButton.theme_setTitleColor(ThemeColorPicker(keyPath: "Base.base_color"), forState: .normal)
  29. }
  30. override func didReceiveMemoryWarning() {
  31. super.didReceiveMemoryWarning()
  32. // Dispose of any resources that can be recreated.
  33. }
  34. @IBAction func modifyMobileAction(_ sender: UIButton) {
  35. self.showDefaultConfirm(title: "确认提示", message: "确定要解绑当前手机号码,解绑后需要重新绑定服务器后才能继续使用?") { (action) in
  36. let deviceId = O2AuthSDK.shared.bindDevice()?.name ?? ""
  37. O2AuthSDK.shared.unBindFromCollect(deviceId: deviceId, callback: { (result, error) in
  38. DDLogDebug("unbind callback result:\(result) , error:\(error ?? "")")
  39. O2AuthSDK.shared.clearAllInformationBeforeReBind(callback: { (result, msg) in
  40. DDLogInfo("清空登录和绑定信息,result:\(result), msg:\(msg ?? "")")
  41. OOAppsInfoDB.shareInstance.removeAll()
  42. DispatchQueue.main.async {
  43. self.forwardDestVC("login", "bindVC")
  44. }
  45. })
  46. })
  47. }
  48. }
  49. }