| | |
| | | class HomeListenSubVC: BaseVC { |
| | | |
| | | private var page:Int! |
| | | private var quarter:Int! |
| | | private var week:Int! |
| | | private var tableView:UITableView! |
| | | |
| | | required init(page:Int) { |
| | | self.page = page |
| | | required init(page:Int,quarter:Int,week:Int) { |
| | | super.init(nibName: nil, bundle: nil) |
| | | self.page = page |
| | | self.quarter = quarter |
| | | self.week = week |
| | | } |
| | | |
| | | required init?(coder: NSCoder) { |
| | |
| | | extension HomeListenSubVC:UITableViewDelegate{ |
| | | func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { |
| | | |
| | | if indexPath.section == 1{ |
| | | let day = page + 1 |
| | | |
| | | if page <= 4{ |
| | | if indexPath.row == 0{ |
| | | JQ_currentViewController().jq_push(vc: HomeListenFightVC(listenType: .lesson1)) |
| | | //听音选图 |
| | | Services.listenSelectPicture(day:day, quarter: quarter, week: week).subscribe(onNext: {result in |
| | | if let data = result.data{ |
| | | let fightVC = HomeListenFightVC(listenType: .lesson1) |
| | | fightVC.title = ListenType.lesson1.rawTitle |
| | | fightVC.data = data |
| | | JQ_currentViewController().jq_push(vc:fightVC) |
| | | } |
| | | }).disposed(by: disposeBag) |
| | | } |
| | | |
| | | if indexPath.row == 1{ |
| | | JQ_currentViewController().jq_push(vc: HomeListenFightVC(listenType: .lesson2)) |
| | | //看图选音 |
| | | Services.pictureSelectVoice(day: day, quarter: quarter, week: week).subscribe(onNext: {result in |
| | | if let data = result.data{ |
| | | let fightVC = HomeListenFightVC(listenType: .lesson2) |
| | | fightVC.title = ListenType.lesson2.rawTitle |
| | | fightVC.data = data |
| | | JQ_currentViewController().jq_push(vc:fightVC) |
| | | } |
| | | }).disposed(by: disposeBag) |
| | | |
| | | } |
| | | |
| | | if indexPath.row == 2{ |
| | | JQ_currentViewController().jq_push(vc: HomeListenFightVC(listenType: .lesson3)) |
| | | //归纳排除 |
| | | Services.induceExclude(day: day, quarter: quarter, week: week).subscribe(onNext: {result in |
| | | if let data = result.data{ |
| | | let fightVC = HomeListenFightVC(listenType: .lesson3) |
| | | fightVC.title = ListenType.lesson3.rawTitle |
| | | fightVC.data = data |
| | | JQ_currentViewController().jq_push(vc: fightVC) |
| | | } |
| | | }).disposed(by: disposeBag) |
| | | } |
| | | |
| | | if indexPath.row == 3{ |
| | | JQ_currentViewController().jq_push(vc: HomeListenFightVC(listenType: .lesson4)) |
| | | //有问有答 |
| | | Services.questionsAndAnswers(day: day, quarter: quarter, week: week).subscribe(onNext: {result in |
| | | if let data = result.data{ |
| | | let fightVC = HomeListenFightVC(listenType: .lesson4) |
| | | fightVC.title = ListenType.lesson4.rawTitle |
| | | fightVC.data = data |
| | | JQ_currentViewController().jq_push(vc: fightVC) |
| | | } |
| | | }).disposed(by: disposeBag) |
| | | } |
| | | |
| | | if indexPath.row == 4{ |
| | | JQ_currentViewController().jq_push(vc: HomeListenFightVC(listenType: .lesson5)) |
| | | //音图相配 |
| | | Services.pictureMateVoice(day: day, quarter: quarter, week: week).subscribe(onNext: {result in |
| | | if let data = result.data{ |
| | | let fightVC = HomeListenFightVC(listenType: .lesson5) |
| | | fightVC.title = ListenType.lesson5.rawTitle |
| | | fightVC.data = data |
| | | JQ_currentViewController().jq_push(vc: fightVC) |
| | | } |
| | | }).disposed(by: disposeBag) |
| | | } |
| | | } |
| | | |
| | | if indexPath.row == 5{ |
| | | //自主游戏 |
| | | if page == 5{ |
| | | if indexPath.row == 0{ |
| | | JQ_currentViewController().jq_push(vc: HomeListenFightVC(listenType: .game1)) |
| | | } |
| | | if indexPath.row == 6{ |
| | | if indexPath.row == 1{ |
| | | JQ_currentViewController().jq_push(vc: HomeListenFightVC(listenType: .game2)) |
| | | } |
| | | if indexPath.row == 7{ |
| | | } |
| | | |
| | | //听故事 |
| | | if page == 6{ |
| | | if indexPath.row == 0{ |
| | | JQ_currentViewController().jq_push(vc: HomeListenFightVC(listenType: .story1)) |
| | | } |
| | | if indexPath.row == 8{ |
| | | if indexPath.row == 1{ |
| | | JQ_currentViewController().jq_push(vc: HomeListenFightVC(listenType: .story2)) |
| | | } |
| | | } |
| | |
| | | |
| | | extension HomeListenSubVC:UITableViewDataSource{ |
| | | func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { |
| | | if section == 0{ |
| | | return 1 |
| | | |
| | | if page <= 4{ |
| | | if section == 0{return 1} |
| | | return 5 |
| | | }else{ |
| | | return 2 |
| | | } |
| | | return 9 |
| | | } |
| | | |
| | | func numberOfSections(in tableView: UITableView) -> Int { |
| | | if page <= 6{ |
| | | if page <= 4{ |
| | | return 2 |
| | | } |
| | | return 1 |
| | | } |
| | | |
| | | func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { |
| | | if indexPath.section == 0{ |
| | | if indexPath.section == 0 && page <= 4{ |
| | | let cell = tableView.dequeueReusableCell(withIdentifier: "_HomeListen_process_TCell", for: indexPath) as! HomeListen_process_TCell |
| | | return cell |
| | | }else{ |
| | | let cell = tableView.dequeueReusableCell(withIdentifier: "_HomeListen_item_TCell", for: indexPath) as! HomeListen_item_TCell |
| | | cell.label_title.text = "\(indexPath.row + 1)" |
| | | |
| | | switch indexPath.row { |
| | | case 0:cell.label_title.text = "题目类型一" |
| | | case 1:cell.label_title.text = "题目类型二" |
| | | case 2:cell.label_title.text = "题目类型三" |
| | | case 3:cell.label_title.text = "题目类型四" |
| | | case 4:cell.label_title.text = "题目类型五" |
| | | case 5:cell.label_title.text = "游戏一" |
| | | case 6:cell.label_title.text = "游戏二" |
| | | case 7:cell.label_title.text = "故事一" |
| | | case 8:cell.label_title.text = "故事二" |
| | | default:break |
| | | if page <= 4{ |
| | | cell.view_bg1.isHidden = true |
| | | switch indexPath.row { |
| | | case 0: |
| | | cell.label_title.text = "自主学习1-听音选图" |
| | | cell.view_bg2.backgroundColor = UIColor(hexString: "#6EC3FF") |
| | | case 1: |
| | | cell.label_title.text = "自主学习2-看图选音" |
| | | cell.view_bg2.backgroundColor = UIColor(hexString: "#FF9A85") |
| | | case 2: |
| | | cell.label_title.text = "自主学习3-归纳排除" |
| | | cell.view_bg2.backgroundColor = UIColor(hexString: "#28C8C5") |
| | | case 3: |
| | | cell.label_title.text = "自主学习4-有问有答" |
| | | cell.view_bg2.backgroundColor = UIColor(hexString: "#F8A169") |
| | | case 4: |
| | | cell.label_title.text = "自主学习5-音图相配" |
| | | cell.view_bg2.backgroundColor = UIColor(hexString: "#92CADB") |
| | | default:break |
| | | } |
| | | } |
| | | |
| | | if page == 5{ |
| | | cell.view_bg2.isHidden = true |
| | | switch indexPath.row { |
| | | case 0: |
| | | cell.label_title.text = "自主游戏1-超级听力" |
| | | cell.view_bg1.backgroundColor = UIColor(hexString: "#6EC3FF") |
| | | case 1: |
| | | cell.label_title.text = "自主游戏2-超级记忆" |
| | | cell.view_bg1.backgroundColor = UIColor(hexString: "#FF9A85") |
| | | default:break |
| | | } |
| | | } |
| | | |
| | | if page == 6{ |
| | | cell.view_bg2.isHidden = true |
| | | switch indexPath.row { |
| | | case 0: |
| | | cell.label_title.text = "自主故事1-看图配音" |
| | | cell.view_bg1.backgroundColor = UIColor(hexString: "#6EC3FF") |
| | | case 1: |
| | | cell.label_title.text = "自主故事2-框架记忆" |
| | | cell.view_bg1.backgroundColor = UIColor(hexString: "#FF9A85") |
| | | default:break |
| | | } |
| | | } |
| | | |
| | | return cell |
| | |
| | | } |
| | | |
| | | func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { |
| | | if indexPath.section == 0{ |
| | | return 145.5 |
| | | if page <= 5{ |
| | | if indexPath.section == 0{return 145.5} |
| | | return 127.5 |
| | | }else{ |
| | | return 127.5 |
| | | } |