EstuLogListViewController.swift 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. //
  2. // EstuLogListViewController.swift
  3. // JiaPeiManage
  4. //
  5. // Created by Ning.ge on 2023/8/28.
  6. //
  7. import UIKit
  8. import RxSwift
  9. import RxCocoa
  10. final class EstuLogListViewController: BaseTableViewController {
  11. let cellIdentifier:String = "_EstuLogListCell"
  12. let dtcellIdentifier:String = "_EstuLogListDetailsCell"
  13. // MARK: 服务属性
  14. private let cocahService: CoachServiceType = CoachService(networking: CoachNetworking())
  15. // MARK: 私有属性
  16. // MARK: UI let
  17. let statusBar = UIView().then {
  18. $0.backgroundColor = UIColor.db_theme
  19. }
  20. let navBar = MeTraineeNavBar.loadFromNib().then {
  21. $0.search_button.isHidden = true
  22. }
  23. let estuLogHeaderView = EstuLogHeaderView.loadFromNib()
  24. let mtheader01_view = MeTraineeDetails01HeaderView.loadFromNib().then {
  25. $0.title_label.text = "查询明细"
  26. }
  27. let header01_view = EstuLog01HeaderView.loadFromNib()
  28. var selectPath = -1;
  29. override func setupConstraints() {
  30. statusBar.snp.makeConstraints { (make) in
  31. make.left.right.top.equalToSuperview()
  32. make.height.equalTo(Metric.statusBarHeight)
  33. }
  34. navBar.snp.remakeConstraints { (make) in
  35. make.left.right.equalToSuperview()
  36. make.height.equalTo(Metric.navBarHeight)
  37. make.top.equalTo(statusBar.snp.bottom)
  38. }
  39. tableView.snp.remakeConstraints { make in
  40. make.top.equalTo(self.navBar.snp.bottom)
  41. make.left.right.bottom.equalTo(self.view)
  42. }
  43. self.loadViewIfNeeded()
  44. }
  45. func scrollViewDidScroll(_ scrollView: UIScrollView) {
  46. }
  47. // MARK: StatusBar
  48. override func viewWillAppear(_ animated: Bool) {
  49. super.viewWillAppear(animated)
  50. self.navigationController?.setNavigationBarHidden(true, animated: true)
  51. }
  52. init(type:TraineeType) {
  53. super.init()
  54. navBar.title_label.text = "电子教学日志"
  55. }
  56. required convenience init?(coder aDecoder: NSCoder) {
  57. fatalError("init(coder:) has not been implemented")
  58. }
  59. override func viewDidLoad() {
  60. super.viewDidLoad()
  61. configureMagicController()
  62. setupUI()
  63. biandView()
  64. }
  65. // MARK: 私有方法
  66. func setupUI(){
  67. self.navBar.back_button.addTarget(self, action: #selector(actionBackdo), for: .touchUpInside)
  68. }
  69. func configureMagicController(){
  70. self.view.addSubview(navBar)
  71. self.view.addSubview(statusBar)
  72. }
  73. func biandView(){
  74. tableView.delegate = self
  75. tableView.dataSource = self
  76. tableView.separatorStyle = .none //去除分割线
  77. tableView.register(UINib(nibName: "EstuLogListCell", bundle: nil), forCellReuseIdentifier: cellIdentifier)
  78. tableView.register(UINib(nibName: "EstuLogListDetailsCell", bundle: nil), forCellReuseIdentifier: dtcellIdentifier)
  79. setupRefreshHeader(tableView) {[unowned self] in
  80. // self.getStuResultList()
  81. }
  82. self.isEmptyDisplay = false
  83. self.hideLoadAnimation()
  84. // 设置上拉加载更多
  85. tableView.es.addInfiniteScrolling { [weak self] in
  86. // self?.getLoadMore()
  87. }
  88. // tableView点击事件
  89. tableView.rx.itemSelected.throttle(.seconds(1), scheduler: MainScheduler.instance)
  90. .subscribe(onNext: { [weak self]indexPath in
  91. print("点击\(indexPath)行")
  92. self?.selectPath = indexPath.row
  93. self?.tableView.reloadData()
  94. // let rowInfo:RowInfo = self!.meTraineeSearchViewModel.rows[indexPath.row]
  95. // if rowInfo != nil && rowInfo.bmType == "2" {
  96. // let context: Int = rowInfo.id!
  97. // NYSwRouter.push(NYSwPushType.trainee_info,context: context)
  98. // }
  99. // self?.tableView.deselectRow(at: indexPath, animated: false)
  100. }).disposed(by: disposeBag)
  101. }
  102. }
  103. //数据源
  104. extension EstuLogListViewController:UITableViewDataSource {
  105. func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
  106. return 10
  107. }
  108. func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
  109. let header_view = UIView().then {
  110. $0.backgroundColor = .db_theme
  111. }
  112. header_view.addSubview(estuLogHeaderView)
  113. estuLogHeaderView.snp.makeConstraints { make in
  114. make.left.right.top.equalTo(header_view)
  115. make.height.equalTo(59.f)
  116. }
  117. header_view.addSubview(mtheader01_view)
  118. mtheader01_view.snp.makeConstraints { make in
  119. make.top.equalTo(estuLogHeaderView.bottom)
  120. make.left.right.equalTo(header_view)
  121. make.height.equalTo(52.f)
  122. }
  123. header_view.addSubview(header01_view)
  124. header01_view.snp.makeConstraints { make in
  125. make.top.equalTo(mtheader01_view.bottom)
  126. make.left.right.equalTo(header_view)
  127. make.height.equalTo(44.f)
  128. }
  129. header_view.layoutIfNeeded()
  130. return header_view
  131. }
  132. func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
  133. return 155.f
  134. }
  135. func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
  136. var cell:UITableViewCell;
  137. if self.selectPath == indexPath.row {
  138. cell = tableView.dequeueReusableCell(withIdentifier: dtcellIdentifier, for: indexPath) as! EstuLogListDetailsCell
  139. }else {
  140. cell = tableView.dequeueReusableCell(withIdentifier: cellIdentifier, for: indexPath) as! EstuLogListCell
  141. }
  142. return cell
  143. }
  144. func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
  145. if(selectPath==indexPath.row){
  146. return 465.f;
  147. }
  148. return 80.f;
  149. }
  150. }
  151. //事件
  152. extension EstuLogListViewController:UITableViewDelegate {
  153. }