//
//  AutonmousMoreViewController.swift
//  MobilePortal
//
//  Created by caiyang on 2020/4/28.
//  Copyright © 2020 yin chen. All rights reserved.
//

import UIKit

class AutonmousMoreViewController: BaseViewController {

    lazy var collectionView: UICollectionView = {
        let layout = UICollectionViewFlowLayout()
        btnViewWidth = SCREEN_WHIDTH()/CGFloat(cellNum)
        btnViewHeight = btnViewWidth*0.9
        //self.dataSource = xinfo.detaileArray
        //最小行间距
        layout.minimumLineSpacing = 0
        //设置垂直间距
        layout.minimumInteritemSpacing = 0
        //设置 cell 上下左右的间距
        layout.sectionInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
        layout.itemSize = CGSize(width:btnViewWidth, height:btnViewHeight)
        //layout.headerReferenceSize = CGSize(width: SCREEN_WHIDTH(), height: 26*HEIGHT_RATIO())
        
        let collectionView = UICollectionView.init(frame: .zero, collectionViewLayout: layout)
        self.view.addSubview(collectionView)
        collectionView.snp.makeConstraints { (make) in
            make.width.height.equalToSuperview()
            make.center.equalToSuperview()
        }
        collectionView.collectionViewLayout = layout
        registerCollectinViewCell(collectionView, cell: UpcomingCollectionViewCell.self)
        registerCollectinViewCell(collectionView, cell: MineCollectionViewCell.self)
        collectionView.backgroundColor = UIColor.white
        return collectionView
    }()
    var dataSource:NSMutableArray!
    var delegate = UpcomingViewControllerDelegate()
    var layout = UICollectionViewFlowLayout()
    var cellNum:Double!
    var btnViewWidth = CGFloat()
    var btnViewHeight = CGFloat()
    
    var selecClassModel = ApplicationHttpListModel()
    var companyListModelArray = NSMutableArray()
    var departmentListModelArray = NSMutableArray()
    
    
    override func viewDidLoad() {
        super.viewDidLoad()
//        initDragCollectionView()
        initTitleBar()
        self.title = "自助服务"
        actionHttpGCD()
        // Do any additional setup after loading the view.
    }
    override func initReturnBtn(){
        let leftN:UIBarButtonItem = UIBarButtonItem.init(image: UIImage.init(named: "return_image")?.withRenderingMode(.alwaysOriginal), style: .plain, target: self, action: #selector(arrowResponse))
        self.navigationItem.leftBarButtonItem = leftN
    }
    func actionHttpGCD(){
        showHintView()
        queue.async(group: group, execute: {[weak self] in
            self?.group.enter()
            self?.getAutonomousHttpPostCmd()
        })
        group.notify(queue: DispatchQueue.main) {[weak self] in
            self?.initDragCollectionView()
            self?.hidenHintView()
        }
    }

}
