72 lines
2.3 KiB
Swift
72 lines
2.3 KiB
Swift
//
|
|
// BRSpotlightViewViewController.swift
|
|
// BeeReel
|
|
//
|
|
// Created by 湖南秦九 on 2025/6/27.
|
|
//
|
|
|
|
import UIKit
|
|
|
|
class BRSpotlightViewViewController: BRViewController, WMZPageProtocol {
|
|
|
|
var viewModel: BRHomeViewModel?
|
|
|
|
private lazy var tableView: BRTableView = {
|
|
let tableView = BRTableView(frame: .zero, style: .plain)
|
|
tableView.delegate = self
|
|
tableView.dataSource = self
|
|
tableView.register(BRSpotlightMainBaseCell.self, forCellReuseIdentifier: "cell")
|
|
tableView.register(BRSpotlightHotMainCell.self, forCellReuseIdentifier: BRHomeModuleItem.ModuleKey.v3_recommand.rawValue)
|
|
tableView.register(BRSpotlightTopMainCell.self, forCellReuseIdentifier: BRHomeModuleItem.ModuleKey.week_ranking.rawValue)
|
|
tableView.register(BRSpotlightNewMainCell.self, forCellReuseIdentifier: BRHomeModuleItem.ModuleKey.new_recommand.rawValue)
|
|
tableView.register(BRSpotlightRecommandMainCell.self, forCellReuseIdentifier: BRHomeModuleItem.ModuleKey.cagetory_recommand.rawValue)
|
|
return tableView
|
|
}()
|
|
|
|
override func viewDidLoad() {
|
|
super.viewDidLoad()
|
|
|
|
br_setupUI()
|
|
}
|
|
|
|
|
|
func reloadData() {
|
|
tableView.reloadData()
|
|
}
|
|
|
|
func getMyScrollView() -> UIScrollView {
|
|
return tableView
|
|
}
|
|
}
|
|
|
|
extension BRSpotlightViewViewController {
|
|
|
|
private func br_setupUI() {
|
|
view.addSubview(tableView)
|
|
|
|
tableView.snp.makeConstraints { make in
|
|
make.left.right.bottom.equalToSuperview()
|
|
make.top.equalToSuperview().offset(15)
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
|
|
//MARK: -------------- UITableViewDelegate UITableViewDataSource --------------
|
|
extension BRSpotlightViewViewController: UITableViewDelegate, UITableViewDataSource {
|
|
|
|
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
|
let moduleItem = self.viewModel?.spotlightDataArr[indexPath.row]
|
|
let cell = tableView.dequeueReusableCell(withIdentifier: moduleItem?.module_key?.rawValue ?? "cell", for: indexPath) as! BRSpotlightMainBaseCell
|
|
cell.moduleItem = moduleItem
|
|
return cell
|
|
}
|
|
|
|
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
|
return self.viewModel?.spotlightDataArr.count ?? 0
|
|
}
|
|
|
|
|
|
}
|