StatisticsPageController.swift 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. //
  2. // StatisticsPageController.swift
  3. // JiaPeiManage
  4. //
  5. // Created by Ning.ge on 2023/6/26.
  6. //
  7. import UIKit
  8. import RxSwift
  9. import RxCocoa
  10. final class StatisticsPageController: BaseGroupTableViewController {
  11. let cellIdentifier:String = "_StatisticsPageCell"
  12. // MARK: 服务属性
  13. private let statisticsService: StatisticsServiceType = StatisticsService(networking: StatisticsNetworking())
  14. // MARK: UI let
  15. let statusBar = UIView().then {
  16. $0.backgroundColor = UIColor.db_theme
  17. }
  18. let navBar = MeTraineeNavBar.loadFromNib().then {
  19. $0.title_label.text = "全部报名统计"
  20. }
  21. let headerView = StatisticsPageHeaderView.loadFromNib().then {
  22. $0.backgroundColor = .db_theme
  23. }
  24. override func setupConstraints() {
  25. statusBar.snp.makeConstraints { (make) in
  26. make.left.right.top.equalToSuperview()
  27. make.height.equalTo(Metric.statusBarHeight)
  28. }
  29. navBar.snp.remakeConstraints { (make) in
  30. make.left.right.equalToSuperview()
  31. make.height.equalTo(Metric.navBarHeight)
  32. make.top.equalTo(statusBar.snp.bottom)
  33. }
  34. tableView.snp.remakeConstraints { make in
  35. make.top.equalTo(navBar.snp.bottom)
  36. make.left.right.bottom.equalToSuperview()
  37. }
  38. }
  39. override func viewDidLoad() {
  40. super.viewDidLoad()
  41. setupUI()
  42. biandView()
  43. self.statisticsService.statisticsStuCount(city: LocalManager.userInfo.city!, schoolId: LocalManager.userInfo.schoolId).subscribe(onSuccess: { stuTotalCountDataModel in
  44. print("成功%@",stuTotalCountDataModel)
  45. }, onError: { error in
  46. })
  47. .disposed(by: disposeBag)
  48. self.statisticsService.everyDayStuCountRequest(city: LocalManager.userInfo.city!, schoolId: LocalManager.userInfo.schoolId, startDate: "2023-06-25", endDate: "2023-06-26").subscribe(onSuccess: { stuCountDataModel in
  49. // self.rows.removeAll()
  50. // self.traineeDataModel = traineeDataModel
  51. // self.rows += traineeDataModel.rows!
  52. print("everyDayStuCountRequest成功 %@",stuCountDataModel)
  53. // self.hideLoadAnimation()
  54. // self.tableView.reloadData()
  55. // self.stopRefresh()
  56. }, onError: { error in
  57. // self.stopRefresh()
  58. })
  59. .disposed(by: disposeBag)
  60. }
  61. // MARK: 私有方法
  62. func setupUI(){
  63. self.view.addSubview(navBar)
  64. self.view.addSubview(statusBar)
  65. self.view.backgroundColor = .db_theme
  66. self.navBar.back_button.addTarget(self, action: #selector(actionBackdo), for: .touchUpInside)
  67. self.navBar.search_button.isHidden = true
  68. }
  69. func biandView(){
  70. tableView.delegate = self
  71. tableView.dataSource = self
  72. tableView.separatorStyle = .none //去除分割线
  73. tableView.register(UINib(nibName: "StatisticsPageCell", bundle: nil), forCellReuseIdentifier: cellIdentifier)
  74. tableView.rowHeight = 44.f
  75. tableView.contentInset = UIEdgeInsets(top: -25, left: 0, bottom: -25, right: 0)
  76. setupRefreshHeader(tableView) {[unowned self] in
  77. // self.getStuResultList()
  78. self.stopRefresh()
  79. }
  80. self.isEmptyDisplay = false
  81. self.hideLoadAnimation()
  82. // 设置上拉加载更多
  83. // tableView.es.addInfiniteScrolling { [weak self] in
  84. // self?.getLoadMore()
  85. // }
  86. }
  87. }
  88. //数据源
  89. extension StatisticsPageController:UITableViewDataSource {
  90. func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
  91. // if (rows.count>0){
  92. // return rows.count
  93. // }
  94. return 10
  95. }
  96. func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
  97. // if(rows.count>0){
  98. // let info = rows.first! as StuLogFacInfoModel
  99. // header03_view.usertemplate_imageview.sd_setImage(with: info.sourceimg?.urlValue)
  100. // }
  101. return headerView
  102. }
  103. func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
  104. return 352.f
  105. }
  106. func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
  107. let cell = tableView.dequeueReusableCell(withIdentifier: cellIdentifier, for: indexPath) as! StatisticsPageCell
  108. cell.contentView.backgroundColor = ((indexPath.row%2) != 0) ? UIColor("#113357") : UIColor("#0B2B4D")
  109. cell.backgroundColor = ((indexPath.row%2) != 0) ? UIColor("#113357") : UIColor("#0B2B4D")
  110. // let info = rows[indexPath.row] as StuLogFacInfoModel
  111. // cell.stutime_label.text = info.crdate
  112. // cell.user_imageview.sd_setImage(with: info.img?.urlValue)
  113. // cell.similar_label.text = info.similar
  114. // cell.phone_label.text = info.sim
  115. return cell
  116. }
  117. }
  118. //事件
  119. extension StatisticsPageController:UITableViewDelegate {
  120. }