| | |
| | | private var collectionView:UICollectionView! |
| | | private var topTitle:String! |
| | | private var viewModel = HomeItemViewModel() |
| | | private var showType: DisplayType! |
| | | |
| | | init(topTitle:String,id:Int) { |
| | | init(topTitle:String,id:Int,showType: DisplayType) { |
| | | super.init(nibName: nil, bundle: nil) |
| | | self.topTitle = topTitle |
| | | self.showType = showType |
| | | self.viewModel.id.accept(id) |
| | | } |
| | | |
| | |
| | | func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { |
| | | let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "_HomeRelaxBanner_2_CCell", for: indexPath) as! HomeRelaxBanner_2_CCell |
| | | let model = viewModel.dataSource.value!.list[indexPath.row] |
| | | cell.setMeditationModel(model) |
| | | cell.setMeditationModel(model,showType: showType) |
| | | return cell |
| | | } |
| | | |
| | |
| | | func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { |
| | | let m = viewModel.dataSource.value!.list[indexPath.row] |
| | | |
| | | let isVip = UserViewModel.getAvatarInfo().isVip |
| | | let isVip = UserViewModel.getAvatarInfo().checkVip() |
| | | |
| | | if m.chargeType == .free || (m.chargeType == .vipFree && isVip == .yes) || (m.chargeType == .payment && m.isBuy == .yes){ |
| | | if m.chargeType == .free || (m.chargeType == .vipFree && isVip) || (m.chargeType == .payment && m.isBuy == .yes){ |
| | | let detailVC = HomeItemDetailVC(id: m.id) |
| | | jq_push(vc: detailVC) |
| | | }else{ |