//
|
// StudyVC.swift
|
// DolphinEnglishLearnStudent
|
//
|
// Created by 无故事王国 on 2024/5/22.
|
//
|
|
import UIKit
|
|
class StudyVC: BaseVC {
|
@IBOutlet weak var view_menu: UIView!
|
@IBOutlet weak var tableView: UITableView!
|
|
private var gamesRecordModel:StudyGamesModel?{
|
didSet{
|
self.tableView.reloadData()
|
}
|
}
|
|
|
override func viewDidLoad() {
|
super.viewDidLoad()
|
|
Services.studyGamesRecord().subscribe(onNext: {result in
|
if let m = result.data{
|
self.gamesRecordModel = m
|
}
|
}).disposed(by: disposeBag)
|
}
|
|
override func setUI() {
|
super.setUI()
|
tableView.delegate = self
|
tableView.dataSource = self
|
tableView.register(UINib(nibName: "Home_1_TCell", bundle: nil), forCellReuseIdentifier: "_Home_1_TCell")
|
tableView.separatorStyle = .none
|
|
}
|
|
override func viewDidLayoutSubviews() {
|
super.viewDidLayoutSubviews()
|
view_menu.jq_addCorners(corner: [.topLeft,.topRight], radius: 20)
|
}
|
}
|
|
extension StudyVC:UITableViewDelegate{
|
|
}
|
|
extension StudyVC:UITableViewDataSource{
|
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
let cell = tableView.dequeueReusableCell(withIdentifier: "_Home_1_TCell", for: indexPath) as! Home_1_TCell
|
|
if indexPath.row % 2 == 0{
|
cell.contentView.backgroundColor = UIColor(hexStr: "#F4FAFE")
|
}else{
|
cell.contentView.backgroundColor = .white
|
}
|
if let m = gamesRecordModel?.gameRecordList[indexPath.row]{
|
cell.studyGamesRecordModel = m
|
}
|
|
|
return cell
|
}
|
|
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
return gamesRecordModel?.gameRecordList.count ?? 0
|
}
|
|
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
|
return 40
|
}
|
}
|