| | |
| | | } |
| | | } |
| | | |
| | | let CourseOfficalComment_Noti = Notification.Name.init("CourseOfficalComment_Noti") |
| | | |
| | | class CourseVCOfficalCommentVC: BaseVC { |
| | | |
| | | private var collectionView:UICollectionView! |
| | |
| | | private var subTitleItems = [TitleItem]() |
| | | private var bannerModels = [CommonBannerModel]() |
| | | private var viewModel = CourseVCOfficalViewModel() |
| | | |
| | | override func viewDidAppear(_ animated: Bool) { |
| | | super.viewDidAppear(animated) |
| | | Services.getCourseBannerList().subscribe(onNext: {data in |
| | | for (index,v) in (data.data ?? []).enumerated(){ |
| | | self.bannerModels.append(CommonBannerModel(index: index, id: v.id, name: v.name, resource:v.imageUrl.jq_urlEncoded(), mediaType: .imageUrl,courseId: v.courseId)) |
| | | } |
| | | self.collectionView.reloadData() |
| | | }).disposed(by: disposeBag) |
| | | } |
| | | |
| | | override func viewDidLoad() { |
| | | super.viewDidLoad() |
| | |
| | | self.collectionView.reloadData() |
| | | }).disposed(by: disposeBag) |
| | | |
| | | Services.getCourseBannerList().subscribe(onNext: {data in |
| | | for (index,v) in (data.data ?? []).enumerated(){ |
| | | self.bannerModels.append(CommonBannerModel(index: index, id: v.id, name: v.name, resource:v.imageUrl.jq_urlEncoded(), mediaType: .imageUrl,courseId: v.courseId)) |
| | | } |
| | | self.collectionView.reloadData() |
| | | }).disposed(by: disposeBag) |
| | | |
| | | |
| | | viewModel.configure(collectionView) |
| | | viewModel.beginRefresh() |
| | |
| | | } |
| | | } |
| | | |
| | | override func setRx() { |
| | | NotificationCenter.default.rx.notification(CourseOfficalComment_Noti).take(until: self.rx.deallocated).subscribe(onNext: {[weak self] _ in |
| | | self?.viewModel.beginRefresh() |
| | | }).disposed(by: disposeBag) |
| | | } |
| | | |
| | | override var shouldAutorotate: Bool{ |
| | | return false |
| | | } |
| | |
| | | let model = viewModel.dataSource.value!.list[indexPath.row] |
| | | |
| | | if model.courseType == .online{ |
| | | let vc = CourseDetialVC(courseId: model.id) |
| | | JQ_currentViewController().jq_push(vc: vc) |
| | | if model.chargeType == .vipFree || model.chargeType == .payment{ |
| | | guard sceneDelegate!.checkisLoginState() else{return} |
| | | } |
| | | |
| | | |
| | | Services.getCourseDetail(courseId: model.id).subscribe(onNext: {data in |
| | | if let m = data.data{ |
| | | if m.isVip == .no && m.chargeType == .vipFree{ |
| | | let vc = VIPCenterVC() |
| | | JQ_currentViewController().jq_push(vc: 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{ |
| | | let vc = CourseDetialOfflineVC(courseId: model.id) |
| | | JQ_currentViewController().jq_push(vc: vc) |
| | |
| | | let model = viewModel.dataSource.value!.list[indexPath.row] |
| | | let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "_HomeRelaxBanner_2_CCell", for: indexPath) as! HomeRelaxBanner_2_CCell |
| | | cell.setCourseModel(model) |
| | | cell.label_title.font = UIFont.systemFont(ofSize: 19, weight: .bold) |
| | | cell.cons_title_top.constant = 14 |
| | | cell.cons_title_left.constant = 16.5 |
| | | return cell |
| | | } |
| | | |