| | |
| | | var level:Int! |
| | | var info:String! |
| | | var btnName:String! |
| | | var medalType:MedalType = .club |
| | | } |
| | | |
| | | lazy private var tableView:UITableView = { |
| | |
| | | |
| | | override func viewDidLoad() { |
| | | super.viewDidLoad() |
| | | title = "运动营成员勋章" |
| | | title = "运动营成员徽章" |
| | | |
| | | view.addSubview(tableView) |
| | | tableView.snp.makeConstraints { make in |
| | |
| | | for model in models{ |
| | | switch model.medalType{ |
| | | case .club: |
| | | self?.items.append(MentalInfo(icon: UIImage(named: "icon_coupon_1"), l1: "COURSE", l2: model.medalName, level: model.levelNum, info: model.upgradeConditions, btnName: "去预约")) |
| | | self?.items.append(MentalInfo(icon: UIImage(named: "icon_coupon_1"), l1: "COURSE", l2: model.medalName, level: model.levelNum, info: String(format: "再上课打卡%@次可升级LV%ld", model.upgradeConditions,model.nextLevel), btnName: "去预约",medalType: model.medalType)) |
| | | case .communtiy: |
| | | self?.items.append(MentalInfo(icon: UIImage(named: "icon_coupon_3"), l1: "ON_LINE", l2: model.medalName, level: model.levelNum, info: model.upgradeConditions, btnName: "去预约")) |
| | | self?.items.append(MentalInfo(icon: UIImage(named: "icon_coupon_3"), l1: "ON_LINE", l2: model.medalName, level: model.levelNum, info: String(format: "再预约场地%@次可升级LV%ld", model.upgradeConditions,model.nextLevel), btnName: "去预约",medalType: model.medalType)) |
| | | case .deepPlayer: |
| | | self?.items.append(MentalInfo(icon: UIImage(named: "icon_coupon_4"), l1: "APPOINTMENT", l2: model.medalName, level: model.levelNum, info: model.upgradeConditions, btnName: "去完成")) |
| | | self?.items.append(MentalInfo(icon: UIImage(named: "icon_coupon_4"), l1: "APPOINTMENT", l2: model.medalName, level: model.levelNum, info: String(format: "再完成课后练习%@次可升级LV%ld", model.upgradeConditions,model.nextLevel), btnName: "去完成",medalType: model.medalType)) |
| | | case .sport: |
| | | self?.items.append(MentalInfo(icon: UIImage(named: "icon_coupon_2"), l1: "EVENTS", l2: model.medalName, level: model.levelNum, info: model.upgradeConditions, btnName: "去报名")) |
| | | self?.items.append(MentalInfo(icon: UIImage(named: "icon_coupon_2"), l1: "EVENTS", l2: model.medalName, level: model.levelNum, info: String(format: "再参与赛事%@次可升级LV%ld", model.upgradeConditions,model.nextLevel), btnName: "去报名",medalType: model.medalType)) |
| | | } |
| | | } |
| | | self?.tableView.reloadData() |
| | |
| | | } |
| | | } |
| | | |
| | | extension StudentMentalListVC:UITableViewDelegate{} |
| | | extension StudentMentalListVC:UITableViewDelegate{ |
| | | func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { |
| | | let model = items[indexPath.row] |
| | | switch model.medalType { |
| | | case .club: |
| | | navigationController?.popToRootViewController(animated: true) |
| | | case .communtiy: |
| | | let vc = YardListVC() |
| | | push(vc: vc) |
| | | case .sport: |
| | | let vc = ActivityListVC() |
| | | push(vc: vc) |
| | | case .deepPlayer: |
| | | let vc = CourseExerciseSubListVC() |
| | | push(vc: vc) |
| | | } |
| | | } |
| | | } |
| | | |
| | | extension StudentMentalListVC:UITableViewDataSource{ |
| | | func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { |