| | |
| | | type = .video |
| | | } |
| | | Services.bannerList(position: type).subscribe(onNext: {[weak self] data in |
| | | guard let weakSelf = self else { return } |
| | | if let models = data.data{ |
| | | let imgs = models.map({$0.img}) |
| | | var items = [CommonBannerModel]() |
| | | for (index,img) in imgs.enumerated(){ |
| | | items.append(CommonBannerModel(index: index,resource: img,mediaType: .imageUrl)) |
| | | } |
| | | self?.searchView.bannerView.setItems(items: items,selectClouse: { m in |
| | | let index = m.index |
| | | jumpPage(model: models[index].model, page: models[index].page, type: models[index].type, id: models[index].turnId) |
| | | }) |
| | | |
| | | if models.count > 0{ |
| | | weakSelf.view.addSubview(weakSelf.searchView) |
| | | self?.searchView.btn_search.addTarget(self, action: #selector(weakSelf.beginSearch), for: .touchUpInside) |
| | | self?.searchView.tf_search.delegate = self! |
| | | let insertH = JQ_ScreenW * 0.564 + 57 |
| | | self?.collectionView.contentInset = UIEdgeInsets(top: insertH, left: 14, bottom: 14, right: 14) |
| | | self?.collectionView.scrollIndicatorInsets = UIEdgeInsets(top: insertH, left: 0, bottom: 0, right: 0) |
| | | |
| | | self?.searchView.bannerView.setItems(items: items,selectClouse: { m in |
| | | let index = m.index |
| | | jumpPage(model: models[index].model, page: models[index].page, type: models[index].type, id: models[index].turnId) |
| | | }) |
| | | } |
| | | } |
| | | }).disposed(by: disposeBag) |
| | | |
| | |
| | | collectionView.delegate = self |
| | | collectionView.dataSource = self |
| | | collectionView.backgroundColor = .white |
| | | |
| | | let insertH = JQ_ScreenW * 0.564 + 57 |
| | | collectionView.contentInset = UIEdgeInsets(top: insertH, left: 14, bottom: 14, right: 14) |
| | | collectionView.scrollIndicatorInsets = UIEdgeInsets(top: insertH, left: 0, bottom: 0, right: 0) |
| | | collectionView.contentInset = UIEdgeInsets(top: 0, left: 14, bottom: 14, right: 14) |
| | | |
| | | view.addSubview(collectionView) |
| | | collectionView.snp.makeConstraints { make in |
| | | make.edges.equalToSuperview() |
| | | } |
| | | |
| | | view.addSubview(searchView) |
| | | searchView.btn_search.addTarget(self, action: #selector(beginSearch), for: .touchUpInside) |
| | | searchView.tf_search.delegate = self |
| | | } |
| | | |
| | | override func setRx() { |