//
//  WeChatBindingVC+LoginView.swift
//  MobilePortal
//
//  Created by caiyang on 2020/8/24.
//  Copyright © 2020 yin chen. All rights reserved.
//

import UIKit

extension WeChatBindingVC {
    func addInitLoginView(){
        loginView.isHidden = false
        loginView.passTextView.text = nil
        loginView.headTitleImage.isHidden = true
        loginView.weixinQQView.isHidden = true
        loginView.loginButton.setTitle("绑定", for: .normal)
        self.view .addSubview(loginView)
        loginView.buttonAutoLogin.isHidden = true
        loginView.userNameCountlock = {[weak self] in
            self?.loginInitType = .LoginNomType
//            self?.getLoginTypeHttpAction()
        }
        loginView.loginButton.addTarget(self, action: #selector(onLogin), for: .touchUpInside)
    }
    @objc func onLogin() {
        loginView.userTextView.resignFirstResponder()
        loginView.passTextView.resignFirstResponder()
        loginView.userTextView.text = loginView.userTextView.text!.replacingOccurrences(of:" ", with: "")
        loginView.passTextView.text = loginView.passTextView.text!.replacingOccurrences(of:" ", with: "")
        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().login_UaesName = loginView.userTextView.text
        //        AccountInfo.sharedInstance().passWord = loginView.passTextView.text
        //        if self.loginType == .OldLoginType {
        //            getLoginHttpPostCmdCmd()
        //        } else {
        //            loginGetAccess_token()
        //        }
//        getScopeListHttpCmd()
        self.loginInitType = .LoginActionType
//        getLoginTypeHttpAction()
        judgmentDeactivateEnable()
        
    }
}
