//
|
// 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")
|
}
|
}
|