无故事王国
2023-12-08 cf002d12c6cc172a2fe989243c038cc64f627a02
WanPai/Root/Course/VC/CourseOnlineListVC.swift
@@ -55,16 +55,27 @@
         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)
@@ -88,19 +99,12 @@
        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() {