add
无故事王国
2024-05-30 48d448a48dfb546d1752192ab95b92fb16f15465
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
//
//  HomeListenSubVC.swift
//  DolphinEnglishLearnStudent
//
//  Created by 无故事王国 on 2024/5/23.
//
 
import UIKit
 
class HomeListenSubVC: BaseVC {
 
                private var page:Int!
                private var tableView:UITableView!
 
                required init(page:Int) {
                                self.page = page
                                super.init(nibName: nil, bundle: nil)
                }
                
                required init?(coder: NSCoder) {
                                fatalError("init(coder:) has not been implemented")
                }
 
    override func viewDidLoad() {
        super.viewDidLoad()
                                navigationItem.titleView = UIView()
    }
 
                override func setUI() {
                                super.setUI()
                                tableView = UITableView(frame: .zero, style: .plain)
                                tableView.delegate = self
                                tableView.dataSource = self
                                tableView.separatorStyle = .none
                                tableView.backgroundColor = Config.ThemeBGColor
                                tableView.register(UINib(nibName: "HomeListen_process_TCell", bundle: nil), forCellReuseIdentifier: "_HomeListen_process_TCell")
                                tableView.register(UINib(nibName: "HomeListen_item_TCell", bundle: nil), forCellReuseIdentifier: "_HomeListen_item_TCell")
                                view.addSubview(tableView)
                                tableView.snp.makeConstraints { make in
                                                make.edges.equalToSuperview()
                                }
                }
}
 
extension HomeListenSubVC:UITableViewDelegate{
                func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
 
                                if indexPath.section == 1{
                                                if indexPath.row == 0{
                                                                JQ_currentViewController().jq_push(vc: HomeListenFightVC(listenType: .lesson1))
                                                }
 
                                                if indexPath.row == 1{
                                                                JQ_currentViewController().jq_push(vc: HomeListenFightVC(listenType: .lesson2))
                                                }
 
                                                if indexPath.row == 2{
                                                                JQ_currentViewController().jq_push(vc: HomeListenFightVC(listenType: .lesson3))
                                                }
 
                                                if indexPath.row == 3{
                                                                JQ_currentViewController().jq_push(vc: HomeListenFightVC(listenType: .lesson4))
                                                }
 
                                                if indexPath.row == 4{
                                                                JQ_currentViewController().jq_push(vc: HomeListenFightVC(listenType: .lesson5))
                                                }
 
                                                if indexPath.row == 5{
                                                                JQ_currentViewController().jq_push(vc: HomeListenFightVC(listenType: .game1))
                                                }
                                                if indexPath.row == 6{
                                                                JQ_currentViewController().jq_push(vc: HomeListenFightVC(listenType: .game2))
                                                }
                                                if indexPath.row == 7{
                                                                JQ_currentViewController().jq_push(vc: HomeListenFightVC(listenType: .story1))
                                                }
                                                if indexPath.row == 8{
                                                                JQ_currentViewController().jq_push(vc: HomeListenFightVC(listenType: .story2))
                                                }
                                }
                }
}
 
extension HomeListenSubVC:UITableViewDataSource{
                func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
                                if section == 0{
                                                return 1
                                }
                                return 9
                }
 
                func numberOfSections(in tableView: UITableView) -> Int {
                                if page <= 6{
                                                return 2
                                }
                                return 1
                }
 
                func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
                                if indexPath.section == 0{
                                                let cell = tableView.dequeueReusableCell(withIdentifier: "_HomeListen_process_TCell", for: indexPath) as! HomeListen_process_TCell
                                                return cell
                                }else{
                                                let cell = tableView.dequeueReusableCell(withIdentifier: "_HomeListen_item_TCell", for: indexPath) as! HomeListen_item_TCell
                                                cell.label_title.text = "\(indexPath.row + 1)"
 
                                                switch indexPath.row {
                                                                case 0:cell.label_title.text = "题目类型一"
                                                                case 1:cell.label_title.text = "题目类型二"
                                                                case 2:cell.label_title.text = "题目类型三"
                                                                case 3:cell.label_title.text = "题目类型四"
                                                                case 4:cell.label_title.text = "题目类型五"
                                                                case 5:cell.label_title.text = "游戏一"
                                                                case 6:cell.label_title.text = "游戏二"
                                                                case 7:cell.label_title.text = "故事一"
                                                                case 8:cell.label_title.text = "故事二"
                                                                default:break
                                                }
 
                                                return cell
                                }
                }
 
                func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
                                if indexPath.section == 0{
                                                return 145.5
                                }else{
                                                return 127.5
                                }
                }
}