add
无故事王国
2024-06-03 3d8ce4866799bea7e66699acdeb86b60b0ba033c
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
//
//  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
                }
}