无故事王国
2023-06-28 a56ff03fc62bb894160f9b71fc54f66e77e48712
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
    //
    //  StudentCourseDetailVC.swift
    //  WanPai
    //
    //  Created by 无故事王国 on 2023/6/27.
    //
 
import UIKit
import JQTools
import QMUIKit
 
class StudentCourseDetailVC: BaseVC {
 
    private lazy var tableView:UITableView = {
        let table = UITableView(frame: .zero, style: .plain)
        table.separatorStyle = .none
        table.delegate = self
        table.dataSource = self
        if #available(iOS 15.0, *) {
            table.sectionHeaderTopPadding = 0
        }
        table.register(UINib(nibName: "CourseChargeTCell", bundle: nil), forCellReuseIdentifier: "_CourseChargeTCell")
        return table
    }()
 
    private let headView = StudentCourseDetailHeadView.jq_loadNibView()
 
    override func viewDidLoad() {
        super.viewDidLoad()
        title = "课时详情"
 
        headView.renewalClouse = { [weak self] () in
            let vc = CourseDetailApplyVC()
            self?.push(vc: vc)
        }
    }
 
    override func setUI() {
        view.addSubview(tableView)
        tableView.snp.makeConstraints { make in
            make.edges.equalToSuperview()
        }
 
 
        tableView.tableHeaderView = headView
        headView.snp.makeConstraints { make in
            make.width.equalToSuperview()
            make.height.greaterThanOrEqualTo(0)
        }
        headView.layoutIfNeeded()
    }
}
 
extension StudentCourseDetailVC:UITableViewDelegate{
 
}
 
extension StudentCourseDetailVC:UITableViewDataSource{
    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCell(withIdentifier: "_CourseChargeTCell") as! CourseChargeTCell
        return cell
    }
 
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return 50
    }
 
    func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
        return 67
    }
 
    func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
        let v = HeaderInSectionView()
        return v
    }
}
 
private class HeaderInSectionView:UIView{
 
    private lazy var btn_datetime:QMUIButton = {
        let btn = QMUIButton(type: .custom)
        btn.setTitle(Date().jq_format("yyyy年M月>"), for: .normal)
        btn.setTitleColor(UIColor(hexStr: "#0048FF"), for: .normal)
        btn.titleLabel?.font = UIFont.systemFont(ofSize: 16, weight: .medium)
        return btn
    }()
 
    private lazy var btn_filter:QMUIButton = {
        let btn = QMUIButton(type: .custom)
        btn.setTitleColor(UIColor(hexStr: "#414141"), for: .normal)
        btn.titleLabel?.font = UIFont.systemFont(ofSize: 16)
        btn.jq_borderWidth = 1
        btn.jq_borderColor = UIColor(hexStr: "#D5D1D1")
        btn.cornerRadius = 4
        btn.setTitle("全部记录", for: .normal)
        btn.setImage(UIImage(named: "icon_down_arrow"), for: .normal)
        btn.imagePosition = .right
        btn.spacingBetweenImageAndTitle = 5
        return btn
    }()
 
    override init(frame: CGRect) {
        super.init(frame: frame)
 
        backgroundColor = .white
 
        addSubview(btn_datetime)
        addSubview(btn_filter)
 
        btn_filter.snp.makeConstraints { make in
            make.right.equalTo(-14)
            make.height.equalTo(38)
            make.width.equalTo(100)
            make.bottom.equalTo(-16)
        }
 
        btn_datetime.snp.makeConstraints { make in
            make.left.equalTo(14)
            make.height.equalTo(22)
            make.centerY.equalTo(btn_filter)
        }
 
        btn_filter.addTarget(self, action: #selector(fliterAction), for: .touchUpInside)
        btn_datetime.addTarget(self, action: #selector(datetimePickerAction), for: .touchUpInside)
    }
 
    @objc func fliterAction(){
        JQ_MenuView().show(self, tapView: btn_filter, items: ["1","2"],tableHei: 140) { index, str in
 
        }
    }
 
    @objc func datetimePickerAction(){
        CommonDatePickerView.show()
    }
 
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}