杨锴
2025-05-11 7453d2d0cef415b34323d1b91e6cfa4a6ba31178
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
//
//  GamesVC.swift
//  WanPai
//
//  Created by 无故事王国 on 2023/9/15.
//
 
import UIKit
import JQTools
import HandyJSON
 
let StartGame_Noti = Notification.Name.init("StartGame_Noti")
 
struct QRCodeModel:HandyJSON {
                var scan_type:ScanType? //扫码类型
                var space_id:Int? //场地ID
                var sutu_id:Int? //设备ID
                var id:Int? //运动营/场地/游戏
}
 
class GamesVC: BaseVC {
 
                private var codeModel:QRCodeModel!
 
                override func viewDidLoad() {
                                super.viewDidLoad()
                                title = "智慧球场"
                }
 
                override func setUI() {
                                view.backgroundColor = .white
                }
 
 
                private func checkUnPayGame(_ model:QRCodeModel){
                                let gamesListVC = GamesListVC(model: model)
                                addChild(gamesListVC)
                                view.addSubview(gamesListVC.view)
                                gamesListVC.view.frame = CGRect(x: 0, y: UIDevice.jq_safeEdges.top + navigationController!.navigationBar.height, width: JQ_ScreenW, height: JQ_ScreenH - UIDevice.jq_safeEdges.top - navigationController!.navigationBar.height)
                                gamesListVC.didMove(toParent: self)
                }
 
                override func setRx() {
 
                }
 
                @IBAction func scanAction(_ sender: UIButton) {
                                guard UIImagePickerController.isSourceTypeAvailable(.camera) else {
                                                alertError(msg: "当前环境相机不可用");return
                                }
 
                                let scan = CommonScanQRCodeVC {[weak self] text, status in
                                                if status{
 
                                                                if let model = QRCodeModel.deserialize(from: text){
                                                                                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: "识别失败")
                                                                }
 
                                                                //暂时关闭【勿删】
                                                                //                GamesPayView.show(price: 120, coin: 99) {
                                                                //                    PaymentView.show(money: (ali: 120, wx: 120, coin: 99,course:nil)) { type in
                                                                //                        let vc = PaymentResultVC(result: .success, objType: .games, handleVC: self)
                                                                //                        vc.modalPresentationStyle = .fullScreen
                                                                //                        self.present(vc, animated: true)
                                                                //
                                                                //                        DispatchQueue.main.asyncAfter(deadline: .now()+0.6) {
                                                                //                            self.checkUnPayGame()
                                                                //                        }
                                                                //                    }
                                                                //                }
                                                }
                                }
                                present(scan, animated: true)
                }
 
                @IBAction func myDatasourceAction(_ sender: UIButton) {
                                let vc = GamesDataSourceVC()
                                push(vc: vc)
                }
 
                //    @IBAction func introAction(_ sender: UIButton) {
                //        Services.game_intro().subscribe(onNext: {data in
                //            let vc = CommonWebVC(type: .other, content: data.data)
                //            vc.title = "步骤说明"
                //            self.push(vc: vc)
                //
                //        }) { error in
                //
                //        }.disposed(by: disposeBag)
                //
                //    }
 
}