| | |
| | | var day = BehaviorRelay<Int?>(value: 0) |
| | | |
| | | //游戏专属,游戏等级 |
| | | var gameLevel = BehaviorRelay<Int>(value:0) |
| | | var gameLevel = BehaviorRelay<Int>(value:-1) |
| | | |
| | | //回答错误数量 |
| | | var correctNum:Int = 0{ |
| | |
| | | |
| | | |
| | | private func showGameLevel(canLevel:Int){ |
| | | guard viewModel.gameLevel.value == -1 else {return} |
| | | ChooseLevelView.show(canLevel: canLevel) {[weak self] level in |
| | | guard let weakSelf = self else { return } |
| | | weakSelf.viewModel.gameLevel.accept(level) |
| | |
| | | CommonAlertView.show(content: "未完成全部答题,确认退出吗?") {[weak self] () in |
| | | guard let weakSelf = self else { return } |
| | | for vc in weakSelf.navigationController?.viewControllers ?? []{ |
| | | if vc.isKind(of: HomeListenVC.self){ |
| | | if vc.isKind(of: HomeListenV2VC.self){ |
| | | weakSelf.navigationController?.popToViewController(vc, animated: true) |
| | | NotificationCenter.default.post(name: Refresh_ListenSchedule_Noti, object: nil) |
| | | break |
| | |
| | | CommonAlertView.show(content: "未完成全部答题,确认退出吗?") {[weak self] () in |
| | | guard let weakSelf = self else { return } |
| | | for vc in weakSelf.navigationController?.viewControllers ?? []{ |
| | | if vc.isKind(of: HomeListenVC.self){ |
| | | if vc.isKind(of: HomeListenV2VC.self){ |
| | | weakSelf.navigationController?.popToViewController(vc, animated: true) |
| | | NotificationCenter.default.post(name: Refresh_ListenSchedule_Noti, object: nil) |
| | | break |
| | |
| | | }).disposed(by: weakSelf.disposeBag) |
| | | } |
| | | for vc in weakSelf.navigationController?.viewControllers ?? []{ |
| | | if vc.isKind(of: HomeListenVC.self){ |
| | | if vc.isKind(of: HomeListenV2VC.self){ |
| | | weakSelf.navigationController?.popToViewController(vc, animated: true) |
| | | NotificationCenter.default.post(name: Refresh_ListenSchedule_Noti, object: nil) |
| | | break |
| | |
| | | func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { |
| | | let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "_CardItemCCell", for: indexPath) as! CardItemCCell |
| | | if data is ListenNewModel{ |
| | | let model = pages[indexPath.row] |
| | | cell.titleL.text = "\(indexPath.row + 1)" |
| | | if pages.count > indexPath.row{ |
| | | let model = pages[indexPath.row] |
| | | cell.titleL.text = "\(indexPath.row + 1)" |
| | | |
| | | if viewModel.listenType.value == .lesson1{ |
| | | if model.filter({$0.status == 2}).count == 4{ |
| | | cell.titleL.textColor = UIColor(hexString: "#52C41A") |
| | | cell.titleL.jq_borderColor = UIColor(hexString: "#52C41A") |
| | | }else if model.filter({$0.status == 3}).count >= 1 { |
| | | cell.titleL.textColor = UIColor(hexString: "#FF4D4F") |
| | | cell.titleL.jq_borderColor = UIColor(hexString: "#52C41A") |
| | | if viewModel.listenType.value == .lesson1{ |
| | | if model.filter({$0.status == 2}).count == 4{ |
| | | cell.titleL.textColor = UIColor(hexString: "#52C41A") |
| | | cell.titleL.jq_borderColor = UIColor(hexString: "#52C41A") |
| | | }else if model.filter({$0.status == 3}).count >= 1 { |
| | | cell.titleL.textColor = UIColor(hexString: "#FF4D4F") |
| | | cell.titleL.jq_borderColor = UIColor(hexString: "#52C41A") |
| | | }else{ |
| | | cell.titleL.textColor = .black.withAlphaComponent(0.25) |
| | | cell.titleL.jq_borderColor = .black.withAlphaComponent(0.25) |
| | | } |
| | | }else{ |
| | | cell.titleL.textColor = .black.withAlphaComponent(0.25) |
| | | cell.titleL.jq_borderColor = .black.withAlphaComponent(0.25) |
| | | } |
| | | }else{ |
| | | //状态1灰色未答题 2绿色正确 3红色错误 |
| | | switch model.first!.status{ |
| | | case 1: |
| | | cell.titleL.textColor = .black.withAlphaComponent(0.25) |
| | | cell.titleL.jq_borderColor = .black.withAlphaComponent(0.25) |
| | | case 2: |
| | | cell.titleL.textColor = UIColor(hexString: "#52C41A") |
| | | cell.titleL.jq_borderColor = UIColor(hexString: "#52C41A") |
| | | case 3: |
| | | cell.titleL.textColor = UIColor(hexString: "#FF4D4F") |
| | | cell.titleL.jq_borderColor = UIColor(hexString: "#52C41A") |
| | | default:break |
| | | //状态1灰色未答题 2绿色正确 3红色错误 |
| | | switch model.first!.status{ |
| | | case 1: |
| | | cell.titleL.textColor = .black.withAlphaComponent(0.25) |
| | | cell.titleL.jq_borderColor = .black.withAlphaComponent(0.25) |
| | | case 2: |
| | | cell.titleL.textColor = UIColor(hexString: "#52C41A") |
| | | cell.titleL.jq_borderColor = UIColor(hexString: "#52C41A") |
| | | case 3: |
| | | cell.titleL.textColor = UIColor(hexString: "#FF4D4F") |
| | | cell.titleL.jq_borderColor = UIColor(hexString: "#52C41A") |
| | | default:break |
| | | } |
| | | } |
| | | } |
| | | } |