//
|
// 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
|
}
|
}
|
}
|