SMSViewController.swift 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. //
  2. // SMSViewController.swift
  3. // SocketChat
  4. //
  5. // Created by Justine on 16/5/31.
  6. // Copyright © 2016年 AppCoda. All rights reserved.
  7. //
  8. import UIKit
  9. import Alamofire
  10. class SMSViewController: UIViewController {
  11. @IBOutlet weak var mobile: UITextField!
  12. @IBOutlet weak var smscode: UITextField!
  13. let serverid = USER_SERVER_ID as! String
  14. let userid = DEFAULT_USER_ID as! Int
  15. let loginname = DEFAULT_USER_NAME as! String
  16. @IBAction func requireCode(sender: UIButton) {
  17. var remainingSeconds: Int = 60
  18. sender.enabled = false
  19. sender.setTitle(String(remainingSeconds), forState: UIControlState.Disabled)
  20. //请求验证码
  21. let mobile = trimstring(self.mobile.text!,trimchar: " ")
  22. let param:[String:AnyObject] = ["serverID":serverid,
  23. "loginName":loginname,
  24. "userID":userid,
  25. "mobile":mobile
  26. ]
  27. request(.POST, RequireSMSURL, parameters: param).responseJSON { (R) in
  28. guard R.result.error == nil else{
  29. return
  30. }
  31. }
  32. }
  33. @IBAction func checkCode(sender: UIButton) {
  34. //获取手机号 未校验
  35. //mobile
  36. //获取验证码
  37. //验证。。。。
  38. //mobile.text
  39. }
  40. func timer(times:Int){
  41. }
  42. override func viewDidLoad() {
  43. super.viewDidLoad()
  44. // Do any additional setup after loading the view.
  45. }
  46. override func didReceiveMemoryWarning() {
  47. super.didReceiveMemoryWarning()
  48. // Dispose of any resources that can be recreated.
  49. }
  50. /*
  51. // MARK: - Navigation
  52. // In a storyboard-based application, you will often want to do a little preparation before navigation
  53. override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
  54. // Get the new view controller using segue.destinationViewController.
  55. // Pass the selected object to the new view controller.
  56. }
  57. */
  58. }