| | |
| | | |
| | | class BaseNav: UINavigationController,UINavigationControllerDelegate { |
| | | |
| | | private var popDelegate: UIGestureRecognizerDelegate? |
| | | // private var popDelegate: UIGestureRecognizerDelegate? |
| | | |
| | | |
| | | /// 需要透明Nav的VC |
| | |
| | | self.navigationBar.shadowImage = UIImage() |
| | | self.navigationBar.isTranslucent = true |
| | | self.delegate = self |
| | | self.popDelegate = self.interactivePopGestureRecognizer?.delegate |
| | | |
| | | |
| | | // self.popDelegate = self.interactivePopGestureRecognizer?.delegate |
| | | self.interactivePopGestureRecognizer?.delegate = self |
| | | |
| | | |
| | | if #available(iOS 15.0, *) { |
| | | let scrollBar = UINavigationBarAppearance() |
| | | scrollBar.configureWithOpaqueBackground() |
| | |
| | | |
| | | navigationBar.scrollEdgeAppearance = scrollBar //顶部透明 |
| | | navigationBar.standardAppearance = standardBar |
| | | |
| | | |
| | | }else { |
| | | navigationBar.titleTextAttributes = [.foregroundColor:UIColor.white,.font:Def_NavFont] |
| | | navigationBar.isTranslucent = true |
| | |
| | | } |
| | | |
| | | open func navigationController(_ navigationController: UINavigationController, willShow viewController: UIViewController, animated: Bool) { |
| | | |
| | | let status = lucencyVCs.contains(where: {$0 == viewController.classForCoder}) |
| | | if (navigationController.viewControllers.count == 1 || status) && !(viewController is WelfareVC){ |
| | | if #available(iOS 15.0, *) { |
| | |
| | | //侧滑 |
| | | public func navigationController(_ navigationController: UINavigationController, didShow viewController: UIViewController, animated: Bool) { |
| | | if viewController == self.viewControllers[0] { |
| | | self.interactivePopGestureRecognizer!.delegate = self.popDelegate |
| | | self.interactivePopGestureRecognizer!.delegate = self |
| | | }else{ |
| | | self.interactivePopGestureRecognizer!.delegate = nil |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | override func viewWillAppear(_ animated: Bool) { |
| | | super.viewWillAppear(animated) |
| | | navigationController?.delegate?.navigationController?(navigationController!, willShow: self, animated: true) |
| | | } |
| | | |
| | | override func viewDidLoad() { |
| | | super.viewDidLoad() |
| | | disposeBag = DisposeBag() |
| | |
| | | self.present(alertController, animated: true, completion: nil) |
| | | } |
| | | |
| | | // public override func viewWillAppear(_ animated: Bool) { |
| | | // firstResult = true |
| | | // if let session = self.session { |
| | | // let queue = DispatchQueue(label: "startRun") |
| | | // queue.async { |
| | | // session.startRunning() |
| | | // } |
| | | // } |
| | | // scanTimer?.fireDate = NSDate.distantPast |
| | | // } |
| | | public override func viewWillAppear(_ animated: Bool) { |
| | | firstResult = true |
| | | if let session = self.session { |
| | | let queue = DispatchQueue(label: "startRun") |
| | | queue.async { |
| | | session.startRunning() |
| | | } |
| | | } |
| | | scanTimer?.fireDate = NSDate.distantPast |
| | | } |
| | | |
| | | func checkCameraAuth() -> Bool { |
| | | let status = AVCaptureDevice.authorizationStatus(for: .video) |
| | |
| | | } |
| | | } |
| | | |
| | | enum ScanType:Int{ |
| | | enum ScanType:Int,HandyJSONEnum{ |
| | | case games = 1000 //游戏 |
| | | case course = 1001 //运动营 |
| | | case yard = 1002 //场地 |
| | |
| | | var videoUrl: String = "" |
| | | var videoId = 0 |
| | | var coursePackageId = 0 |
| | | var scId:Int = 0 |
| | | } |
| | | |
| | | struct StartClouseReportModel:HandyJSON{ |
| | |
| | | var synopsis: String = "" |
| | | var videoId: Int = 0 |
| | | var videoName: String = "" |
| | | var scId:Int = 0 |
| | | } |
| | | |
| | | struct ExerciseVideoDetailModel:HandyJSON { |
| | |
| | | import JQTools |
| | | |
| | | #if DEBUG |
| | | //let All_Url = "http://192.168.110.27:56666" //罗易胜 |
| | | let All_Url = "http://8.137.22.229:56666" //正式地址 |
| | | let All_Url = "http://192.168.110.27:56666" //罗易胜 |
| | | //let All_Url = "http://8.137.22.229:56666" //正式地址 |
| | | let Game_Url = "https://try.daowepark.com" |
| | | |
| | | |
| | |
| | | } |
| | | |
| | | /// 课后练习-课后视频详情 |
| | | static func exerciseCourseDetail(coursePackageId:Int,videoId:Int)->Observable<BaseResponse<ExerciseVideoDetailModel>>{ |
| | | static func exerciseCourseDetail(coursePackageId:Int,videoId:Int,scId:Int? = nil)->Observable<BaseResponse<ExerciseVideoDetailModel>>{ |
| | | let params = ParamsAppender.build(url: All_Url) |
| | | .interface(url: "/course/api/startCource/afterSourceDetail") |
| | | .append(key: "coursePackageId", value: coursePackageId) |
| | | .append(key: "videoId", value: videoId) |
| | | .append(key: "scId", value: scId) |
| | | return NetworkRequest.request(params: params, method: .post, progress: true) |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | /// 更新课后视频学习状态 |
| | | static func updateVideoStatus(coursePackageId:Int,videoId:Int?)->Observable<BaseResponse<SimpleModel>>{ |
| | | static func updateVideoStatus(coursePackageId:Int,videoId:Int?,scId:Int? = nil)->Observable<BaseResponse<SimpleModel>>{ |
| | | let params = ParamsAppender.build(url: All_Url) |
| | | .interface(url: "/course/api/startCource/updateVideoStatus") |
| | | .append(key: "coursePackageId", value: coursePackageId) |
| | | .append(key: "videoId", value: videoId) |
| | | .append(key: "isOver", value: 1) |
| | | .append(key: "scId", value: scId) |
| | | return NetworkRequest.request(params: params, method: .post, progress: false) |
| | | } |
| | | |
| | |
| | | label_vaild.text = m.time |
| | | label_courseType.text = m.type.strTitle |
| | | |
| | | //默认选择传递过来的课时数 |
| | | for (index,clas) in m.list.enumerated(){ |
| | | if clas.classHours == classHours{ |
| | | selectClassIndex = index;break |
| | | } |
| | | if classHours != nil{ |
| | | let temp = detailModel?.list.filter({$0.classHours == classHours!}) ?? [] |
| | | detailModel?.list = temp |
| | | } |
| | | |
| | | // //默认选择传递过来的课时数 |
| | | // for (index,clas) in m.list.enumerated(){ |
| | | // if clas.classHours == classHours{ |
| | | // selectClassIndex = index;break |
| | | // } |
| | | // } |
| | | |
| | | switch m.type { |
| | | case .vocation: |
| | |
| | | view_banner.setItems(items: items) |
| | | } |
| | | |
| | | if let m = signUpModel{ |
| | | if var m = signUpModel{ |
| | | classHours = m.chooseHours |
| | | |
| | | //默认选择传递过来的课时数 |
| | | for (index,clas) in m.list.enumerated(){ |
| | | if clas.classHours == classHours{ |
| | | selectClassIndex = index;break |
| | | } |
| | | } |
| | | detailModel?.list = m.list.filter({$0.classHours == classHours}) |
| | | |
| | | if m.payStatus == .unPayment{ |
| | | btn_handleBtn.setTitle("待支付", for: .normal) |
| | |
| | | } |
| | | view_banner.setItems(items: items) |
| | | |
| | | if let subM = m.list.first { |
| | | var tempSub = m.list.first |
| | | if signUpCourseModel?.chooseHours != nil{ |
| | | for v in m.list{ |
| | | if v.classHours == signUpCourseModel?.chooseHours{ |
| | | tempSub = v;break |
| | | } |
| | | } |
| | | } |
| | | |
| | | if let subM = tempSub { |
| | | switch subM.payType { |
| | | case .coin: |
| | | label_price.text = "" |
| | |
| | | import RxSwift |
| | | import RxRelay |
| | | |
| | | let CourseExercise_Noti = Notification.Name.init("CourseExercise_Noti") |
| | | |
| | | class CourseExerciseViewModel:RefreshModel<ExerciseVideoModel>{ |
| | | let courseTypeId = BehaviorRelay<Int?>(value: nil) |
| | | let search = BehaviorRelay<String>(value: "") |
| | |
| | | // tableView.jq_setEmptyView() |
| | | } |
| | | |
| | | override func setRx() { |
| | | NotificationCenter.default.rx.notification(CourseExercise_Noti).take(until: self.rx.deallocated).subscribe(onNext: {[weak self] noti in |
| | | self?.viewModel.beginRefresh() |
| | | }).disposed(by: disposeBag) |
| | | } |
| | | |
| | | |
| | | @IBAction func searchAction(_ sender: UIButton) { |
| | | tf_search.resignFirstResponder() |
| | |
| | | } |
| | | |
| | | if let model{ |
| | | Services.exerciseCourseDetail(coursePackageId: model.coursePackageId, videoId: model.videoId).subscribe(onNext: {[weak self] data in |
| | | Services.exerciseCourseDetail(coursePackageId: model.coursePackageId, videoId: model.videoId,scId: model.scId).subscribe(onNext: {[weak self] data in |
| | | if let model = data.data{ |
| | | self?.exerciseVideoDetailModel = model |
| | | self?.label_name.text = model.packageName |
| | |
| | | @objc private func playbackEnd(){ |
| | | if let m = exerciseVideoDetailModel{ |
| | | if timeDuration >= CMTimeGetSeconds((playerVC.player?.currentItem?.duration)!) && m.studyStatus == 1 { |
| | | Services.updateVideoStatus(coursePackageId: m.coursePackageId, videoId: m.videoId).subscribe(onNext: {[weak self] data in |
| | | Services.updateVideoStatus(coursePackageId: m.coursePackageId, videoId: m.videoId,scId: model?.scId).subscribe(onNext: {[weak self] data in |
| | | alertSuccess(msg: "已获得积分") |
| | | self?.exerciseVideoDetailModel?.studyStatus = 2 |
| | | self?.label_studyState.text = "已学习" |
| | |
| | | self?.label_studyState.textColor = UIColor(hexStr: "#318C10") |
| | | self?.timeDuration = 0 |
| | | NotificationCenter.default.post(name: UpdateWelfare_Noti, object: nil) |
| | | NotificationCenter.default.post(name: CourseExercise_Noti, object: nil) |
| | | |
| | | }).disposed(by: disposeBag) |
| | | } |
| | | } |
| | |
| | | self?.label_studyState.textColor = UIColor(hexStr: "#318C10") |
| | | self?.timeDuration = 0 |
| | | NotificationCenter.default.post(name: UpdateWelfare_Noti, object: nil) |
| | | NotificationCenter.default.post(name: CourseExercise_Noti, object: nil) |
| | | }).disposed(by: disposeBag) |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | @IBAction func scanAction(_ sender: UIButton) { |
| | | let scan = CommonScanQRCodeVC { text, status in |
| | | let scan = CommonScanQRCodeVC {[weak self] text, status in |
| | | if status{ |
| | | |
| | | if let model = QRCodeModel.deserialize(from: text){ |
| | | print("--->\(model.toJSON())") |
| | | self.codeModel = model |
| | | self.checkUnPayGame(model) |
| | | if model.scan_type == .games{ |
| | | self?.codeModel = model |
| | | self?.checkUnPayGame(model) |
| | | }else if model.scan_type == .yard{ |
| | | alertError(msg: "识别类型错误") |
| | | // let vc = YardDetailVC(id: model.id!) |
| | | // self?.push(vc: vc) |
| | | }else if model.scan_type == .course{ |
| | | alertError(msg: "识别类型错误") |
| | | // let vc = CourseDetailVC(id: model.id!) |
| | | // self?.push(vc: vc) |
| | | } |
| | | }else{ |
| | | alertError(msg: "识别失败") |
| | | } |
| | |
| | | CommonAlertView.show(title: "提示", content: "确认取消本次的预约吗?") {[weak self] status in |
| | | if status{ |
| | | guard let weakSelf = self else { return } |
| | | Services.cancelMySite(id: id).subscribe(onNext: { data in |
| | | weakSelf.getData() |
| | | Services.cancelMySite(id: id).subscribe(onNext: {[weak self] data in |
| | | // weakSelf.getData() |
| | | NotificationCenter.default.post(name: RefreshBooking_Noti, object: nil) |
| | | self?.navigationController?.popViewController() |
| | | }) { error in |
| | | |
| | | }.disposed(by: weakSelf.disposeBag) |
| | |
| | | weakSelf.tableView.endUpdates() |
| | | weakSelf.tableView.reloadData() |
| | | |
| | | }else{ |
| | | weakSelf.viewModel.beginRefresh() |
| | | } |
| | | }).disposed(by: disposeBag) |
| | | } |