| | |
| | | func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { |
| | | |
| | | let item = viewModel.dataSource.value[indexPath.row] |
| | | |
| | | Services.gvieCourseAgain(id: item.id).subscribe(onNext: {[weak self]data in |
| | | guard let weakSelf = self else { return } |
| | | if let m = data.data{ |
| | | let vc = PaymentOrderVC(pendingModel: m, type: weakSelf.viewModel.state.value == 1 ? .muse:.course) |
| | | JQ_currentViewController().jq_push(vc: vc) |
| | | if item.paymentStatus == .no{ |
| | | //音频 |
| | | if viewModel.state.value == 1{ |
| | | Services.getMeditationDetail(id: item.businessId).subscribe(onNext: {data in |
| | | if let m = data.data{ |
| | | let vc = HomeItemDetailVC(model: m) |
| | | JQ_currentViewController().jq_push(vc: vc) |
| | | } |
| | | }).disposed(by: disposeBag) |
| | | } |
| | | }).disposed(by: disposeBag) |
| | | |
| | | //课程 |
| | | if viewModel.state.value == 2{ |
| | | Services.getCourseDetail(courseId: item.businessId).subscribe(onNext: {data in |
| | | if let m = data.data{ |
| | | if m.isVip == .no && m.chargeType == .vipFree{ |
| | | let vc = VIPCenterVC() |
| | | JQ_currentNavigationController().pushViewController(vc) |
| | | }else if m.courseType == .online{ |
| | | let vc = CourseDetialVC(courseModel: m) |
| | | JQ_currentViewController().jq_push(vc: vc) |
| | | }else{ |
| | | let vc = CourseDetialOfflineVC(courseId: m.id) |
| | | JQ_currentViewController().jq_push(vc: vc) |
| | | } |
| | | } |
| | | }).disposed(by: disposeBag) |
| | | } |
| | | }else{ |
| | | Services.gvieCourseAgain(id: item.id).subscribe(onNext: {[weak self]data in |
| | | guard let weakSelf = self else { return } |
| | | if let m = data.data{ |
| | | let vc = PaymentOrderVC(pendingModel: m, type: weakSelf.viewModel.state.value == 1 ? .muse:.course) |
| | | JQ_currentViewController().jq_push(vc: vc) |
| | | } |
| | | }).disposed(by: disposeBag) |
| | | } |
| | | |
| | | |
| | | |
| | | // if viewModel.state.value == 1{ |
| | | // //待支付 |