无故事王国
2023-11-29 93783809cfb18ae273bd3a78c8dbca91facd10d9
fix bug
13个文件已修改
128 ■■■■■ 已修改文件
WanPai/Base/BaseNav.swift 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WanPai/Base/BaseVC.swift 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WanPai/Common/VC/CommonScanQRCodeVC.swift 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WanPai/Config/Enums.swift 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
WanPai/Model/CommonModels.swift 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WanPai/Network/Services.swift 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WanPai/Root/Course/VC/CourseDetailApplyVC.swift 25 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WanPai/Root/Course/VC/CourseDetailVC.swift 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WanPai/Root/Course/VC/CourseExerciseSubListVC.swift 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WanPai/Root/Course/VC/CourseVideoDetailVC.swift 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WanPai/Root/Games/GamesVC.swift 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WanPai/Root/Yard/VC/YardBookingDetailVC.swift 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WanPai/Root/Yard/VC/YardBookingSubListVC.swift 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WanPai/Base/BaseNav.swift
@@ -10,7 +10,7 @@
class BaseNav: UINavigationController,UINavigationControllerDelegate {
    
    private var popDelegate: UIGestureRecognizerDelegate?
//    private var popDelegate: UIGestureRecognizerDelegate?
        /// 需要透明Nav的VC
@@ -26,9 +26,10 @@
        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()
@@ -50,8 +51,6 @@
            
            navigationBar.scrollEdgeAppearance = scrollBar //顶部透明
            navigationBar.standardAppearance = standardBar
        }else {
            navigationBar.titleTextAttributes = [.foregroundColor:UIColor.white,.font:Def_NavFont]
            navigationBar.isTranslucent = true
@@ -61,7 +60,6 @@
    }
    
    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, *) {
@@ -84,7 +82,7 @@
        //侧滑
    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
        }
WanPai/Base/BaseVC.swift
@@ -24,6 +24,11 @@
        }
    }
    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
        navigationController?.delegate?.navigationController?(navigationController!, willShow: self, animated: true)
    }
    override func viewDidLoad() {
        super.viewDidLoad()
        disposeBag = DisposeBag()
WanPai/Common/VC/CommonScanQRCodeVC.swift
@@ -162,16 +162,16 @@
        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)
WanPai/Config/Enums.swift
@@ -442,7 +442,7 @@
    }
}
enum ScanType:Int{
enum ScanType:Int,HandyJSONEnum{
    case games = 1000 //游戏
    case course = 1001 //运动营
    case yard = 1002 //场地
WanPai/Model/CommonModels.swift
@@ -446,6 +446,7 @@
    var videoUrl: String = ""
    var videoId = 0
    var coursePackageId = 0
    var scId:Int = 0
}
struct StartClouseReportModel:HandyJSON{
@@ -733,6 +734,7 @@
    var synopsis: String = ""
    var videoId: Int = 0
    var videoName: String = ""
    var scId:Int = 0
}
struct ExerciseVideoDetailModel:HandyJSON {
WanPai/Network/Services.swift
@@ -12,8 +12,8 @@
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"
@@ -603,11 +603,12 @@
    }
        /// 课后练习-课后视频详情
    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)
    }
@@ -661,12 +662,13 @@
    }
        /// 更新课后视频学习状态
    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)
    }
WanPai/Root/Course/VC/CourseDetailApplyVC.swift
@@ -66,12 +66,17 @@
            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:
@@ -109,15 +114,9 @@
            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)
WanPai/Root/Course/VC/CourseDetailVC.swift
@@ -66,7 +66,16 @@
                }
                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 = ""
WanPai/Root/Course/VC/CourseExerciseSubListVC.swift
@@ -10,6 +10,8 @@
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: "")
@@ -56,6 +58,12 @@
//        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()
WanPai/Root/Course/VC/CourseVideoDetailVC.swift
@@ -92,7 +92,7 @@
        }
        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
@@ -147,7 +147,7 @@
    @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 = "已学习"
@@ -155,6 +155,8 @@
                    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)
            }
        }
@@ -170,6 +172,7 @@
                    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)
            }
        }
WanPai/Root/Games/GamesVC.swift
@@ -59,13 +59,22 @@
    }
    @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: "识别失败")
                }
WanPai/Root/Yard/VC/YardBookingDetailVC.swift
@@ -231,9 +231,10 @@
        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)
WanPai/Root/Yard/VC/YardBookingSubListVC.swift
@@ -75,6 +75,8 @@
                weakSelf.tableView.endUpdates()
                weakSelf.tableView.reloadData()
            }else{
                weakSelf.viewModel.beginRefresh()
            }
        }).disposed(by: disposeBag)
    }