fix
无故事王国
2024-06-26 46acca18a3d1744e1930f0bac7509a2a5959df1b
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
//
//  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.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
                }
}