| | |
| | | |
| | | |
| | | private func getData(){ |
| | | Services.weekList(quarter: selectIndexPath.row).subscribe(onNext: {result in |
| | | Services.weekList(quarter: selectIndexPath.row + 1).subscribe(onNext: {result in |
| | | self.dataItems[self.selectIndexPath.row] = result.data ?? [] |
| | | self.collectionView.reloadData() |
| | | }).disposed(by: disposeBag) |
| | |
| | | extension HomeListenMenuVC:UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout{ |
| | | |
| | | func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { |
| | | let vc = HomeListenVC() |
| | | let model = dataItems[selectIndexPath.row][indexPath.row] |
| | | |
| | | let quarter = selectIndexPath.row + 1 //季度 |
| | | let week = model.week //周 |
| | | let vc = HomeListenVC(quarter: quarter, week: week) |
| | | push(vc: vc) |
| | | } |
| | | |
| | | func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { |
| | | let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "_HomeListenMenuCCell", for: indexPath) as! HomeListenMenuCCell |
| | | cell.setTitle(week: "第一周", title: "提示基础认知能力", coin: 2000) |
| | | cell.contentView.backgroundColor = UIColor.qmui_random() |
| | | let seal = indexPath.row % 10 |
| | | cell.contentView.backgroundColor = UIColor(hexString: repeatColors[seal]) |
| | | let model = dataItems[selectIndexPath.row][indexPath.row] |
| | | cell.setTitle(week: "第\(model.week.jq_cn)周", title: model.title, coin: model.totalIntegral) |
| | | |
| | | return cell |
| | | } |
| | | |
| | |
| | | getData() |
| | | } |
| | | tableView.reloadData() |
| | | collectionView.reloadData() |
| | | } |
| | | |
| | | func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { |
| | |
| | | private var label_title = UILabel() |
| | | private var label_completeCoin = UILabel() |
| | | |
| | | var listenWeekModel:ListenWeekModel!{ |
| | | didSet{ |
| | | |
| | | } |
| | | } |
| | | |
| | | override init(frame: CGRect) { |
| | | super.init(frame: frame) |
| | | |