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

import UIKit

extension WeChatBindingViewController {

    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.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().login_UaesName = loginView.userTextView.text
//        AccountInfo.sharedInstance().passWord = loginView.passTextView.text
//        if self.loginType == .OldLoginType {
//            getLoginHttpPostCmdCmd()
//        } else {
//            loginGetAccess_token()
//        }
        getScopeListHttpCmd()
    }
    
}
