杨锴
2024-10-25 098286ed0313b1d3f1141113b371f8b17b8b26b5
XQMuse/Root/Me/VC/WatchHistoryDetailVC.swift
@@ -10,18 +10,18 @@
import RxRelay
import RxSwift
class WatchHistoryViewModel:RefreshInnerModel<CourseModel>{
class WatchHistoryViewModel:RefreshModel<CourseModel>{
            let state = BehaviorRelay<Int>(value: 1)
            var type = BehaviorRelay<WatchType>(value: .collect)
            override func api() -> (Observable<BaseResponse<BaseResponseList<CourseModel>>>)? {
                        switch type.value {
                                    case .history:Services.lookHistory(page: page, pageSize: 20, state: state.value)
                                    case .collect:Services.myCollect(page: page, pageSize: 20, state: state.value)
                                    case .payment:Services.myOrderCourse(page: page, pageSize: 20, state: state.value)
                        }
            }
    override func api() -> (Observable<BaseResponse<[CourseModel]>>)? {
        switch type.value {
            case .history:return Services.lookHistory(page: page, pageSize: 20, state: state.value)
            case .collect:return Services.myCollect(page: page, pageSize: 20, state: state.value)
            case .payment:return Services.myOrderCourse(page: page, pageSize: 20, state: state.value)
        }
    }
}
@@ -66,12 +66,12 @@
extension WatchHistoryDetailVC:UICollectionViewDelegate & UICollectionViewDataSource{
            func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
                        return viewModel.dataSource.value?.list.count ?? 0
        return viewModel.dataSource.value.count
            }
            func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
                        let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "_HomeRelaxBannerCCell", for: indexPath) as! HomeRelaxBannerCCell
                        let m = viewModel.dataSource.value!.list[indexPath.row]
                        let m = viewModel.dataSource.value[indexPath.row]
                        cell.setCourseModel(m)
                        return cell
            }
@@ -82,12 +82,12 @@
            func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
                        let m = viewModel.dataSource.value!.list[indexPath.row]
                        let m = viewModel.dataSource.value[indexPath.row]
                        if viewModel.state.value == 1{
                                    let vc = HomeItemDetailVC(id: m.id)
            let vc = HomeItemDetailVC(id: m.businessId)
                                    JQ_currentViewController().jq_push(vc: vc)
                        }else{
                                    let vc = CourseDetialVC(courseId: m.id)
                                    let vc = CourseDetialVC(courseId: m.businessId)
                                    JQ_currentViewController().jq_push(vc: vc)
                        }
            }