| | |
| | | var teamScheduleModel:TeamScheduleModel? |
| | | |
| | | private var answerIndex:IndexPath? //答案的Index |
| | | private var playingIndex:IndexPath? |
| | | private var answerIndexs = Set<IndexPath>() //回答过的Index集合 |
| | | private var filterItems = [[Listen1SubModel]]() //此类型特殊,需要数据清理 |
| | | private var handleClouse:(()->Void)? |
| | |
| | | override func viewDidLoad() { |
| | | super.viewDidLoad() |
| | | |
| | | |
| | | playingIndex = IndexPath(row: 0, section: 0) |
| | | //回传记录,始终保持答题进度 |
| | | if let team = teamScheduleModel{ |
| | | for teamId in team.teamIds{ |
| | |
| | | self.view.layoutIfNeeded() |
| | | }completion: { _ in |
| | | self.setAnswerStackView() |
| | | VoicePlayer.share().playerAt(url: m.correct) |
| | | self.voicePlayer.playerAt(url: m.correct) |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | override func viewDidAppear(_ animated: Bool) { |
| | |
| | | UIView.animate(withDuration: 0.4) { |
| | | copyView.frame = CGRect(origin: newRect1.origin, size: CGSize(width: newRect1.width, height: 40)) |
| | | } completion: { _ in |
| | | self.viewModel.selectIndex.accept(nil) |
| | | for v in self.stackView.subviews{ |
| | | v.removeFromSuperview() |
| | | let nextIndex = IndexPath(row: 0, section: 1) |
| | | if self.viewModel.selectIndex.value != nextIndex{ |
| | | self.viewModel.selectIndex.accept(nextIndex) |
| | | let m = self.filterItems[nextIndex.section][nextIndex.row] |
| | | self.voicePlayer.playerAt(url: m.correct) |
| | | self.collectionView.reloadData() |
| | | |
| | | for v in self.stackView.subviews{ |
| | | v.removeFromSuperview() |
| | | } |
| | | |
| | | self.setAnswerStackView() |
| | | self.stackView.layoutIfNeeded() |
| | | } |
| | | self.stackView.layoutIfNeeded() |
| | | } |
| | | } |
| | | } |
| | |
| | | cell.backgroundColor = .white |
| | | cell.contentView.backgroundColor = .white |
| | | cell.indexPath = indexPath |
| | | |
| | | if playingIndex == indexPath{ |
| | | cell.playing() |
| | | }else{ |
| | | cell.playEnd() |
| | | } |
| | | |
| | | cell.playAtIndex {[weak self] index in |
| | | guard let weakSelf = self else { return } |
| | | weakSelf.viewModel.selectIndex.accept(index) |
| | |
| | | |
| | | extension HomeListenFight_lesson_4_VC:VoicePlayerDelegate{ |
| | | func playComplete() { |
| | | playingIndex = nil |
| | | self.view.isUserInteractionEnabled = true |
| | | |
| | | for subV in view.subviews { |