| | |
| | | class HomeListenVC: BaseVC { |
| | | |
| | | //限制后面的点击:天数(1开始) |
| | | private var limitDay = 7 |
| | | private var limitDay = 1 |
| | | private var quarter:Int! |
| | | private var week:Int! |
| | | |
| | |
| | | |
| | | override func viewDidLoad() { |
| | | super.viewDidLoad() |
| | | |
| | | Services.studySchedule(week: week, day: 1).subscribe(onNext: {data in |
| | | self.limitDay = data.data?.day ?? 0 |
| | | |
| | | #if DEBUG |
| | | self.limitDay = 5 |
| | | #endif |
| | | |
| | | if self.limitDay == 5{ |
| | | self.limitDay = Int.max |
| | | } |
| | | |
| | | for (index,titleL) in (self.menu.subviews.last?.subviews[1].subviews ?? []).filter({$0 is UIButton}).enumerated(){ |
| | | if let btn = titleL as? UIButton{ |
| | | btn.setTitleColor(index < (self.limitDay - 1) ? .black:.black.withAlphaComponent(0.33), for: .normal) |
| | | self.menu.setEnabled(index < (self.limitDay - 1), forItemAt: UInt(index)) |
| | | } |
| | | } |
| | | self.pageVC.reloadData() |
| | | }).disposed(by: disposeBag) |
| | | } |
| | | |
| | | override func setUI() { |
| | |
| | | make.bottom.equalTo(self.view.safeAreaLayoutGuide.snp.bottom) |
| | | } |
| | | |
| | | for (index,titleL) in (menu.subviews.last?.subviews[1].subviews ?? []).filter({$0 is UIButton}).enumerated(){ |
| | | if index >= limitDay{ |
| | | for (index,titleL) in (self.menu.subviews.last?.subviews[1].subviews ?? []).filter({$0 is UIButton}).enumerated(){ |
| | | if index >= (self.limitDay - 1){ |
| | | if let btn = titleL as? UIButton{ |
| | | btn.setTitleColor(.black.withAlphaComponent(0.33), for: .normal) |
| | | menu.setEnabled(false, forItemAt: UInt(index)) |
| | | self.menu.setEnabled(false, forItemAt: UInt(index)) |
| | | } |
| | | } |
| | | } |