//
|
// CourseVCTeacherSpecialVC.swift
|
// XQMuse
|
//
|
// Created by 无故事王国 on 2024/8/15.
|
//
|
|
import UIKit
|
import JQTools
|
|
let CourseVCTeacherSpecial_Update = Notification.Name.init("CourseVCTeacherSpecial_Update")
|
|
class CourseVCTeacherSpecialVC: BaseVC {
|
private var tableView:UITableView?
|
private var headerView:VideoView!
|
private var model:TutorInfoModel?
|
|
private var cell0:CourseDetail_1_TCell?
|
private var cell1:CourseDetail_3_TCell?
|
|
override func viewDidDisappear(_ animated: Bool) {
|
super.viewDidDisappear(animated)
|
headerView.pauseVideo()
|
}
|
|
override func viewDidLoad() {
|
super.viewDidLoad()
|
|
cell0 = (tableView!.dequeueReusableCell(withIdentifier: "_CourseDetail_1_TCell") as! CourseDetail_1_TCell)
|
cell1 = (tableView!.dequeueReusableCell(withIdentifier: "_CourseDetail_3_TCell") as! CourseDetail_3_TCell)
|
|
cell0!.backgroundColor = UIColor(hexString: "#f6f6f6")
|
cell1!.backgroundColor = UIColor(hexString: "#f6f6f6")
|
|
Services.tutorInfo().subscribe(onNext: { data in
|
if let m = data.data{
|
self.model = m
|
self.cell0!.setContent(title: "导师简介", content: m.tutorIntroduction)
|
self.cell1!.setItems(m.list)
|
self.tableView?.reloadData()
|
self.headerView.updateVideoUrl(m.videoUrl,autoPlay: false,placeHoderImageUrl: m.coverUrl.jq_urlEncoded())
|
}
|
}).disposed(by: disposeBag)
|
|
|
self.cell0?.webView.scrollView.rx.observe(CGSize.self, "contentSize").map { (size) -> CGFloat? in
|
if let size = size{
|
return size.height
|
}
|
return nil
|
}.subscribe(onNext: { [unowned self](height) in
|
if let height = height{
|
if height > self.cell0?.cons_webHei.constant ?? 0{
|
self.cell0?.cons_webHei.constant = height
|
self.tableView?.reloadData()
|
}
|
}
|
}).disposed(by: disposeBag)
|
}
|
|
override func setUI() {
|
super.setUI()
|
tableView = UITableView(frame: .zero, style: .plain)
|
tableView!.contentInsetAdjustmentBehavior = .never
|
tableView!.separatorStyle = .none
|
tableView!.delegate = self
|
tableView!.dataSource = self
|
tableView?.contentInset = UIEdgeInsets(top: 0, left: 0, bottom: 20, right: 0)
|
tableView!.showsVerticalScrollIndicator = false
|
if #available(iOS 15.0, *) {
|
tableView!.sectionHeaderTopPadding = 0
|
}
|
tableView!.backgroundColor = UIColor(hexString: "#f6f6f6")
|
tableView!.register(UINib(nibName: "CourseDetail_1_TCell", bundle: nil), forCellReuseIdentifier: "_CourseDetail_1_TCell")
|
tableView!.register(UINib(nibName: "CourseDetail_3_TCell", bundle: nil), forCellReuseIdentifier: "_CourseDetail_3_TCell")
|
|
view.addSubview(tableView!)
|
tableView!.snp.makeConstraints { make in
|
make.edges.equalToSuperview()
|
}
|
|
DispatchQueue.main.async {
|
self.headerView = VideoView(url: nil)
|
self.tableView!.tableHeaderView = self.headerView
|
self.headerView.frame = CGRect(x: 0, y: 0, width: JQ_ScreenW, height: JQ_ScreenW * 0.56)
|
}
|
}
|
|
override func setRx() {
|
|
}
|
|
override var shouldAutorotate: Bool{
|
return true
|
}
|
}
|
extension CourseVCTeacherSpecialVC:UITableViewDataSource{
|
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
return 2
|
}
|
|
func numberOfSections(in tableView: UITableView) -> Int {
|
return 1
|
}
|
|
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
|
if indexPath.row == 0 || indexPath.row == 1{
|
return UITableView.automaticDimension
|
}
|
return 770.736
|
}
|
|
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
|
if indexPath.row == 0{
|
return cell0!
|
}
|
|
if indexPath.row == 1{
|
return cell1!
|
}
|
|
var cell = tableView.dequeueReusableCell(withIdentifier: "cell")
|
if cell == nil{
|
cell = UITableViewCell(style: .value1, reuseIdentifier: "cell")
|
}
|
return cell!
|
}
|
|
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
|
return 73.5
|
}
|
}
|
|
extension CourseVCTeacherSpecialVC:UITableViewDelegate{
|
|
|
}
|