ProgramCheckViewController.swift 3.01 KB
//
//  ProgramCheckViewController.swift
//  ParentAssistant
//
//  Created by Cao yang on 2018/4/11.
//  Copyright © 2018年 HANGZHOUTEAM. All rights reserved.
//

import UIKit

class ProgramCheckViewController: UIViewController,UITableViewDelegate,UITableViewDataSource {

    lazy var tableView = {()-> UITableView in
        let table = UITableView.init(frame: CGRect.init(x: 0, y: 0, width: screenWidth, height: screenHeight-44-22))
        table.backgroundColor = backGroundColor
        table.delegate = self
        table.dataSource = self
        table.tableFooterView = UIView.init()
        table.separatorStyle = .none
        table.register(UINib.init(nibName: "GrowCheckUpTableViewCell", bundle: nil), forCellReuseIdentifier: "GrowCheckUpTableViewCell")
        table.register(UINib.init(nibName: "GrowCheckDownTableViewCell", bundle: nil), forCellReuseIdentifier: "GrowCheckDownTableViewCell")
        return table
    }()
    
  
    
    override func viewDidLoad() {
        super.viewDidLoad()
        self.view.addSubview(self.tableView)
        // Do any additional setup after loading the view.
        downLoadDataFromNet()
    }
    
    /// 获取数据
    private func downLoadDataFromNet(){
        let params = ["studentid":185,"schoolid":1,"starttime":"2017-07-19"] as [String : Any]
        HTTPServer.shared.getStudentCheckList(parameters: params as [String : AnyObject]) { (backData, error) in
            print(backData!)
            if error == nil && JSON.fromString(backData)!["status"].intValue == 1 {
            
            }
        }
    }

    
    //MARK: - TableView Delegate && DataSource
    func numberOfSections(in tableView: UITableView) -> Int {
        return 1
    }
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return 3
    }
    func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
        if indexPath.row == 0 {
            return 120
        }else{
            return 160
        }
    }
    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        
        if indexPath.row == 0 {
            let cell = tableView.dequeueReusableCell(withIdentifier: "GrowCheckUpTableViewCell", for: indexPath) as! GrowCheckUpTableViewCell
            return cell
        }else{
            let cell = tableView.dequeueReusableCell(withIdentifier: "GrowCheckDownTableViewCell", for: indexPath) as! GrowCheckDownTableViewCell
            return cell
        }
    }
    
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    

    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        // Get the new view controller using segue.destinationViewController.
        // Pass the selected object to the new view controller.
    }
    */

}