//
//  YHHomeViewCoontroller.swift
//  galaxy
//
//  Created by davidhuangA on 2024/1/3.
//  Copyright © 2024 www.davidhuang.com. All rights reserved.
//

import Foundation
import RxSwift
import GKNavigationBarSwift

class YHHomeViewController: YHBaseViewController {
    //C 对应的 VM
    let disposeBag = DisposeBag()

    lazy var homeReqVM : YHHomePageViewModel = {
        return YHHomePageViewModel()
    }()
    
    lazy var headBkgImagV: UIImageView = {
        let imagV = UIImageView()
        imagV.image = UIImage(named: "home_head_bkg")
        imagV.contentMode = .scaleAspectFill
        return imagV
    }()
    
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        //1.UI
        initView()
        
        //2.网络请求
//        bind()
//        requestData()
        
    }
    
    
    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
        
        //for test hjl
//        requestData()
        
    }
    
    private func requestData() {
        self.homeReqVM.getHomeConfig()
    }
    
    private func bind() {
        homeReqVM.subject.subscribe(onNext: { model in
            print("网络请求获取的数据是====>")
            print(model)
            
        }).disposed(by: DisposeBag())
    }
    
    private func initView()->Void {
//        gk_navTitle = ""
//        gk_navBarAlpha = 0.1
//        gk_navLineHidden = true
        
        
        
        
        view.addSubview(headBkgImagV)
        headBkgImagV.snp.makeConstraints { make in
            make.top.left.right.equalToSuperview()
            make.height.equalTo(307)
        }
        
        
        
    }
    
}
