无故事王国
2024-03-13 919d1d6bb0ec4043ec25b58a492618239ca37529
WanPai/Root/Search/VC/MatchDetailVC.swift
@@ -37,6 +37,7 @@
            private var redTeamItems = [WorldCupPeopleModel]()
            private var blueTeamItems = [WorldCupPeopleModel]()
            private var model:WorldCupJudgeModel!
            private var deviceModel:ActivityDetailStoreModel?
            private var deviceQRCode:String?
            required init(model:WorldCupJudgeModel) {
@@ -124,6 +125,8 @@
                        if index > redTeamItems.count{
                                    redTeamItems.removeLast()
                        }else if redTeamItems.count == 1{
                                    redTeamItems.removeAll()
                        }else{
                                    redTeamItems.remove(at: index)
                        }
@@ -143,6 +146,8 @@
                        let index = sender.tag - 20
                        if index > blueTeamItems.count{
                                    blueTeamItems.removeLast()
                        }else if redTeamItems.count == 1{
                                    blueTeamItems.removeAll()
                        }else{
                                    blueTeamItems.remove(at: index)
                        }
@@ -197,6 +202,8 @@
                                                view_blue3Img.sd_setImage(with: URL(string: item.avatar))
                                    }
                        }
                        btn_handle.isSelected = deviceModel != nil
            }
            private func checkMutable(model:WorldCupPeopleModel)->Bool{
@@ -217,7 +224,7 @@
            @IBAction func handleAction(_ sender: UIButton) {
                        if sender.isSelected{
                        if deviceModel != nil{
                                    guard redTeamItems.count == 3 else{alert(msg: "红队人数不足");return}
                                    guard blueTeamItems.count == 3 else{alert(msg: "蓝队人数不足");return}
                                    guard let devCode = deviceQRCode else{alert(msg: "请扫描设备二维码");return}
@@ -243,8 +250,8 @@
                                                if status{
                                                            Services.startWorldCup(code: devCode, people: tempArray.jq_toJson1(), worldCupId: weakSelf.model.id).subscribe(onNext: {data in
                                                                        if let _ = data.data{
                                                                                    weakSelf.btn_handle.isEnabled = false
                                                                                    alert(msg: "比赛开始")
                                                                                    sender.isSelected = true
                                                                                    weakSelf.redTeamItems.removeAll()
                                                                                    weakSelf.blueTeamItems.removeAll()
                                                                                    weakSelf.updateUserView()
@@ -267,6 +274,7 @@
                                                                                    weakSelf.label_mathYard.isHidden = false
                                                                                    weakSelf.label_matchPoint.text = "所属赛点:" + model.name
                                                                                    weakSelf.label_mathYard.text = "所属场地:" + model.address
                                                                                    weakSelf.deviceModel = model
                                                                        }
                                                            }).disposed(by: weakSelf.disposeBag)
                                                }