| | |
| | | private var redTeamItems = [WorldCupPeopleModel]() |
| | | private var blueTeamItems = [WorldCupPeopleModel]() |
| | | private var model:WorldCupJudgeModel! |
| | | private var deviceModel:ActivityDetailStoreModel? |
| | | private var deviceQRCode:String? |
| | | |
| | | required init(model:WorldCupJudgeModel) { |
| | |
| | | |
| | | if index > redTeamItems.count{ |
| | | redTeamItems.removeLast() |
| | | }else if redTeamItems.count == 1{ |
| | | redTeamItems.removeAll() |
| | | }else{ |
| | | redTeamItems.remove(at: index) |
| | | } |
| | |
| | | let index = sender.tag - 20 |
| | | if index > blueTeamItems.count{ |
| | | blueTeamItems.removeLast() |
| | | }else if redTeamItems.count == 1{ |
| | | blueTeamItems.removeAll() |
| | | }else{ |
| | | blueTeamItems.remove(at: index) |
| | | } |
| | |
| | | view_blue3Img.sd_setImage(with: URL(string: item.avatar)) |
| | | } |
| | | } |
| | | |
| | | btn_handle.isSelected = deviceModel != nil |
| | | } |
| | | |
| | | private func checkMutable(model:WorldCupPeopleModel)->Bool{ |
| | |
| | | |
| | | @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} |
| | |
| | | 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() |
| | |
| | | weakSelf.label_mathYard.isHidden = false |
| | | weakSelf.label_matchPoint.text = "所属赛点:" + model.name |
| | | weakSelf.label_mathYard.text = "所属场地:" + model.address |
| | | weakSelf.deviceModel = model |
| | | } |
| | | }).disposed(by: weakSelf.disposeBag) |
| | | } |