//
//  MineViewController+loginView.swift
//  MobilePortal
//
//  Created by xiejiangbo on 2019/3/25.
//  Copyright © 2019 yin chen. All rights reserved.
//

import UIKit

extension MineViewController {
    func addInitLoginView(){
        loginView.isHidden = false
        loginView.passTextView.text = nil
        self.view .addSubview(loginView)
        loginView.loginButton.addTarget(self, action: #selector(onLogin), for: .touchUpInside)
    }
    @objc func onLogin() {
        loginView.userTextView.resignFirstResponder()
        loginView.passTextView.resignFirstResponder()
        if loginView.userTextView.text == nil || loginView.userTextView.text?.count == 0 {
            SMToastView.showMessage("账号不能为空")
            return
        }
        if loginView.passTextView.text == nil || loginView.passTextView.text?.count == 0 {
            SMToastView.showMessage("密码不能为空")
            return
        }
        AccountInfo.sharedInstance().uaesName = loginView.userTextView.text
        AccountInfo.sharedInstance().passWord = loginView.passTextView.text
        //AccountInfo.sharedInstance().isAutoLogin = self.getBoolStr(bool: self.loginView.buttonAutoLogin.isSelected)
        
        
        getLoginHttpPostCmdCmd()
        
    }
    
    override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
        loginView.userTextView.resignFirstResponder()
        loginView.passTextView.resignFirstResponder()
    }
}
