//
|
// StudyVC.swift
|
// DolphinEnglishLearnStudent
|
//
|
// Created by 无故事王国 on 2024/5/22.
|
//
|
|
import UIKit
|
import JQTools
|
|
class StudyVC: BaseVC {
|
|
@IBOutlet weak var label_currentProcess: UILabel!
|
@IBOutlet weak var label_surplusProcess: UILabel!
|
@IBOutlet weak var label_studyTotalTimes: UILabel!
|
@IBOutlet weak var label_studyWeekTotalTimes: UILabel!
|
@IBOutlet weak var view_menu: UIView!
|
@IBOutlet weak var tableView: UITableView!
|
|
private var gamesRecordModel:StudyGamesModel?{
|
didSet{
|
self.tableView.reloadData()
|
|
label_currentProcess.text = "当前进度:周目\(gamesRecordModel?.record?.week.jq_cn ?? "")"
|
label_surplusProcess.text = "剩余进度:\(gamesRecordModel?.record?.surplus.jq_cn ?? "")周目"
|
|
label_studyTotalTimes.attributedText = AttributedStringbuilder.build().add(string: "学习总时长:", withFont: .systemFont(ofSize: 16), withColor: UIColor(hexString: "#2B3648")!).add(string: "\(gamesRecordModel?.record?.totalStudy ?? 0)小时", withFont: .systemFont(ofSize: 16, weight: .medium), withColor: UIColor(hexString: "#2B3648")!).add(string: "|今日学习:", withFont: .systemFont(ofSize: 16), withColor: UIColor(hexString: "#2B3648")!).add(string: "\(gamesRecordModel?.record?.todayStudy ?? 0)小时", withFont: .systemFont(ofSize: 16, weight: .medium), withColor: UIColor(hexString: "#2B3648")!).mutableAttributedString
|
|
|
label_studyWeekTotalTimes.attributedText = AttributedStringbuilder.build().add(string: "本周学习时长:", withFont: .systemFont(ofSize: 16), withColor: UIColor(hexString: "#2B3648")!).add(string: "\(gamesRecordModel?.record?.weekStudy ?? 0)小时", withFont: .systemFont(ofSize: 16, weight: .medium), withColor: UIColor(hexString: "#2B3648")!).add(string: "|本月学习时长:", withFont: .systemFont(ofSize: 16), withColor: UIColor(hexString: "#2B3648")!).add(string: "\(gamesRecordModel?.record?.monthStudy ?? 0)小时", withFont: .systemFont(ofSize: 16, weight: .medium), withColor: UIColor(hexString: "#2B3648")!).mutableAttributedString
|
|
}
|
}
|
|
|
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.showsVerticalScrollIndicator = false
|
tableView.showsHorizontalScrollIndicator = false
|
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
|
}
|
}
|