MoralViewController.swift
3.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
//
// MoralViewController.swift
// ParentAssistant
//
// Created by Cao yang on 2018/3/22.
// Copyright © 2018年 HANGZHOUTEAM. All rights reserved.
//
import UIKit
class MoralViewController: UIViewController,UITableViewDelegate,UITableViewDataSource {
@IBOutlet weak var tableView: UITableView!
var data = Array<JSON>()
override func viewDidLoad() {
super.viewDidLoad()
self.title = "德育报告"
tableView.delegate = self
tableView.dataSource = self
downLoadDataFromNet()
}
private func downLoadDataFromNet(){
let params = ["screenId":1,"startDate":"2018-03-08","endDate":"2018-04-08","classId":"70","schoolId":1] as [String : Any]
HTTPServer.shared.getEvaluationSceneAnalysis(parameters: params as [String : AnyObject]) { (backData, error) in
print(backData!)
if error == nil && JSON.fromString(backData)!["status"].intValue == 1 {
// self.data = SceneEvaluate(j: JSON.fromString(backData)!.contentData())
// if self.data != nil{
// print(self.data)
// }
}
}
}
func numberOfSections(in tableView: UITableView) -> Int {
return 3
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if section == 2 {
return 3
}else{
return 1
}
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
switch indexPath.section {
case 0:
return 240
case 1:
return 240
case 2:
return 70
default:
return 0
}
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
var cell = UITableViewCell.init()
switch indexPath.section {
case 0:
cell = tableView.dequeueReusableCell(withIdentifier: "moralDetail", for: indexPath)
return cell
case 1:
cell = tableView.dequeueReusableCell(withIdentifier: "educationDetail", for: indexPath)
return cell
case 2:
cell = tableView.dequeueReusableCell(withIdentifier: "behaviorDetail", for: indexPath)
return cell
default:
return cell
}
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if indexPath.section == 2 {
let scene = Story.instantiateViewControllerWithIdentifier("SceneDetailViewController", storyName: "Main") as! SceneDetailViewController
self.navigationController?.pushViewController(scene, animated: true)
}
}
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.
}
*/
}