// // StatisticsPageController.swift // JiaPeiManage // // Created by Ning.ge on 2023/6/26. // import UIKit import RxSwift import RxCocoa final class StatisticsPageController: BaseGroupTableViewController { let cellIdentifier:String = "_StatisticsPageCell" // MARK: 服务属性 private let statisticsService: StatisticsServiceType = StatisticsService(networking: StatisticsNetworking()) // MARK: UI let let statusBar = UIView().then { $0.backgroundColor = UIColor.db_theme } let navBar = MeTraineeNavBar.loadFromNib().then { $0.title_label.text = "全部报名统计" } let headerView = StatisticsPageHeaderView.loadFromNib().then { $0.backgroundColor = .db_theme } override func setupConstraints() { statusBar.snp.makeConstraints { (make) in make.left.right.top.equalToSuperview() make.height.equalTo(Metric.statusBarHeight) } navBar.snp.remakeConstraints { (make) in make.left.right.equalToSuperview() make.height.equalTo(Metric.navBarHeight) make.top.equalTo(statusBar.snp.bottom) } tableView.snp.remakeConstraints { make in make.top.equalTo(navBar.snp.bottom) make.left.right.bottom.equalToSuperview() } } override func viewDidLoad() { super.viewDidLoad() setupUI() biandView() self.statisticsService.statisticsStuCount(city: LocalManager.userInfo.city!, schoolId: LocalManager.userInfo.schoolId).subscribe(onSuccess: { stuTotalCountDataModel in print("成功%@",stuTotalCountDataModel) }, onError: { error in }) .disposed(by: disposeBag) self.statisticsService.everyDayStuCountRequest(city: LocalManager.userInfo.city!, schoolId: LocalManager.userInfo.schoolId, startDate: "2023-06-25", endDate: "2023-06-26").subscribe(onSuccess: { stuCountDataModel in // self.rows.removeAll() // self.traineeDataModel = traineeDataModel // self.rows += traineeDataModel.rows! print("everyDayStuCountRequest成功 %@",stuCountDataModel) // self.hideLoadAnimation() // self.tableView.reloadData() // self.stopRefresh() }, onError: { error in // self.stopRefresh() }) .disposed(by: disposeBag) } // MARK: 私有方法 func setupUI(){ self.view.addSubview(navBar) self.view.addSubview(statusBar) self.view.backgroundColor = .db_theme self.navBar.back_button.addTarget(self, action: #selector(actionBackdo), for: .touchUpInside) self.navBar.search_button.isHidden = true } func biandView(){ tableView.delegate = self tableView.dataSource = self tableView.separatorStyle = .none //去除分割线 tableView.register(UINib(nibName: "StatisticsPageCell", bundle: nil), forCellReuseIdentifier: cellIdentifier) tableView.rowHeight = 44.f tableView.contentInset = UIEdgeInsets(top: -25, left: 0, bottom: -25, right: 0) setupRefreshHeader(tableView) {[unowned self] in // self.getStuResultList() self.stopRefresh() } self.isEmptyDisplay = false self.hideLoadAnimation() // 设置上拉加载更多 // tableView.es.addInfiniteScrolling { [weak self] in // self?.getLoadMore() // } } } //数据源 extension StatisticsPageController:UITableViewDataSource { func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { // if (rows.count>0){ // return rows.count // } return 10 } func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { // if(rows.count>0){ // let info = rows.first! as StuLogFacInfoModel // header03_view.usertemplate_imageview.sd_setImage(with: info.sourceimg?.urlValue) // } return headerView } func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { return 352.f } func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: cellIdentifier, for: indexPath) as! StatisticsPageCell cell.contentView.backgroundColor = ((indexPath.row%2) != 0) ? UIColor("#113357") : UIColor("#0B2B4D") cell.backgroundColor = ((indexPath.row%2) != 0) ? UIColor("#113357") : UIColor("#0B2B4D") // let info = rows[indexPath.row] as StuLogFacInfoModel // cell.stutime_label.text = info.crdate // cell.user_imageview.sd_setImage(with: info.img?.urlValue) // cell.similar_label.text = info.similar // cell.phone_label.text = info.sim return cell } } //事件 extension StatisticsPageController:UITableViewDelegate { }