//
//  YHLoginViewController.swift
//  galaxy
//
//  Created by EDY on 2023/12/26.
//

import UIKit
import SnapKit

class YHLoginViewController: YHBaseViewController {
    var bgImageView: UIImageView!
    var loginTitleLabel: UILabel!
    var loginSubTitleLabel: UILabel!
    var loginPhoneLabel: UILabel!
    var loginButton: UIButton!
    var messageButton: YHLoginStyleButton!
    var emailButton: YHLoginStyleButton!
    var centerLine: UIView!
    var centerImageView: UIImageView!
    var promptsLabel: UILabel!
    var wxButton: UIButton!
    var privacyView: YHLoginPrivacyView!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        setView()
        // Do any additional setup after loading the view.
        
    }
    
    func setView() {
        bgImageView = {
            let imageView = UIImageView()
            imageView.image = UIImage(named: "login_bg_image")
            return imageView
        }()
        view.addSubview(bgImageView)
        bgImageView.snp.makeConstraints { make in
            make.left.right.top.bottom.equalTo(view)
        }
        loginTitleLabel = {
            let label = UILabel()
            label.text = "登录后更精彩"
            label.font = kBoldFont(size: 32)
            label.textColor = YHColorWithHex(0xffffff)
            return label
        }()
        view.addSubview(loginTitleLabel)
        loginTitleLabel.snp.makeConstraints { make in
            make.left.equalTo(14)
            make.right.equalTo(-14)
            make.top.equalTo(111)
            make.height.equalTo(39)
        }
        loginSubTitleLabel = {
            let label = UILabel()
            label.text = "香港美好生活期待与你的相遇"
            label.font = kFont(size: 20)
            label.textColor = YHColorWithHex(0xffffff)
            return label
        }()
        view.addSubview(loginSubTitleLabel)
        loginSubTitleLabel.snp.makeConstraints { make in
            make.left.equalTo(14)
            make.right.equalTo(-14)
            make.top.equalTo(159)
            make.height.equalTo(24)
        }
        loginPhoneLabel = {
            let label = UILabel()
            label.text = "+86  133****3800"
            label.font = kBoldFont(size: 20)
            label.textAlignment = .center
            label.textColor = YHColorWithHex(0xffffff)
            return label
        }()
        view.addSubview(loginPhoneLabel)
        loginPhoneLabel.snp.makeConstraints { make in
            make.left.equalTo(14)
            make.right.equalTo(-14)
            make.top.equalTo(245)
            make.height.equalTo(24)
        }
        loginButton = {
            let button = UIButton(type: .custom)
            button.backgroundColor = YHColorWithHex(0x4d9ff8)
            button.titleLabel?.font = kBoldFont(size: 16)
            button.contentHorizontalAlignment = .center
            button.setTitle("本机号码一键登录", for: .normal)
            button.setTitleColor(YHColorWithHex(0xffffff), for: .normal)
            button.layer.cornerRadius = 24
            return button
        }()
        view.addSubview(loginButton)
        loginButton.snp.makeConstraints { make in
            make.left.equalTo(21)
            make.right.equalTo(-21)
            make.top.equalTo(289)
            make.height.equalTo(48)
        }
        centerLine = {
            let view = UIView()
            view.backgroundColor = YHColorWithHex(0xffffff)
            return view
        }()
        view.addSubview(centerLine)
        centerLine.snp.makeConstraints { make in
            make.centerX.equalToSuperview()
            make.top.equalTo(368)
            make.height.equalTo(20)
            make.width.equalTo(1)
        }
        messageButton = {
            let button = YHLoginStyleButton()
            button.setContent(image: UIImage(named: "login_style_message")!, message: "验证码登录")
            return button
        }()
        view.addSubview(messageButton)
        messageButton.snp.makeConstraints { make in
            make.right.equalTo(centerLine.snp.left).offset(-10)
            make.centerY.equalTo(centerLine)
            make.height.equalTo(20)
            make.width.equalTo(110)
        }
        emailButton = {
            let button = YHLoginStyleButton()
            button.setContent(image: UIImage(named: "login_style_email")!, message: "邮箱登录")
            return button
        }()
        view.addSubview(emailButton)
        emailButton.snp.makeConstraints { make in
            make.left.equalTo(centerLine.snp.right).offset(10)
            make.centerY.equalTo(centerLine)
            make.height.equalTo(20)
            make.width.equalTo(93)
        }
        centerImageView = {
            let imageView = UIImageView()
            imageView.image = UIImage(named: "login_center_image")
            return imageView
        }()
        view.addSubview(centerImageView)
        centerImageView.snp.makeConstraints { make in
            make.centerX.equalTo(view)
            make.width.equalTo(153)
            make.height.equalTo(108)
            make.bottom.equalTo(-188)
        }
        promptsLabel = {
            let label = UILabel()
            label.text = "其他登录方式（第三方账号注册需绑定手机号）"
            label.font = kFont(size: 12)
            label.textColor = YHColorWithHex(0xffffff)
            label.textAlignment = .center
            return label
        }()
        view.addSubview(promptsLabel)
        promptsLabel.snp.makeConstraints { make in
            make.left.equalTo(14)
            make.right.equalTo(-14)
            make.bottom.equalTo(-89)
            make.height.equalTo(20)
        }
        wxButton = {
            let button = UIButton(type: .custom)
            button.setBackgroundImage(UIImage(named: "login_style_wx"), for: .normal)
            return button
        }()
        view.addSubview(wxButton)
        wxButton.snp.makeConstraints { make in
            make.centerX.equalToSuperview()
            make.bottom.equalTo(-59)
            make.height.equalTo(18)
            make.width.equalTo(21)
        }
        privacyView = {
            let view = YHLoginPrivacyView()
            return view
        }()
        view.addSubview(privacyView)
        privacyView.snp.makeConstraints { make in
            make.bottom.equalTo(-24)
            make.centerX.equalToSuperview()
            make.height.equalTo(20)
            make.width.equalTo(308)
        }
        //测试
    }
}
