add
无故事王国
2024-05-28 64d4343b54e747804656a3fb7eca4a2d14d6e5de
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
//
//  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))
                                                }
                                }
                }
}
 
extension HomeListenSubVC:UITableViewDataSource{
                func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
                                if section == 0{
                                                return 1
                                }
                                return 8
                }
 
                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)"
                                                return cell
                                }
                }
 
                func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
                                if indexPath.section == 0{
                                                return 145.5
                                }else{
                                                return 127.5
                                }
                }
}