From b1e53d01722f1705d99f5cf6ec63c8c493811405 Mon Sep 17 00:00:00 2001 From: 杨锴 <841720330@qq.com> Date: 星期五, 13 九月 2024 18:56:16 +0800 Subject: [PATCH] fix API --- XQMuse/Root/Course/VC/CourseVCTeacherSpecialVC.swift | 51 +++++++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 43 insertions(+), 8 deletions(-) diff --git a/XQMuse/Root/Course/VC/CourseVCTeacherSpecialVC.swift b/XQMuse/Root/Course/VC/CourseVCTeacherSpecialVC.swift index 7a686ca..7944004 100644 --- a/XQMuse/Root/Course/VC/CourseVCTeacherSpecialVC.swift +++ b/XQMuse/Root/Course/VC/CourseVCTeacherSpecialVC.swift @@ -11,10 +11,34 @@ 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) + } + }).disposed(by: disposeBag) } override func setUI() { @@ -39,10 +63,26 @@ } DispatchQueue.main.async { - self.headerView = VideoView(url: "http://vfx.mtime.cn/Video/2021/07/10/mp4/210710094507540173.mp4") + 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() { + 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 var shouldAutorotate: Bool{ @@ -68,16 +108,11 @@ func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { if indexPath.row == 0{ - let cell = tableView.dequeueReusableCell(withIdentifier: "_CourseDetail_1_TCell") as! CourseDetail_1_TCell - cell.backgroundColor = UIColor(hexString: "#f6f6f6") - cell.setContent(title: "导师简介", content: "") - return cell + return cell0! } if indexPath.row == 1{ - let cell = tableView.dequeueReusableCell(withIdentifier: "_CourseDetail_3_TCell") as! CourseDetail_3_TCell - cell.backgroundColor = UIColor(hexString: "#f6f6f6") - return cell + return cell1! } var cell = tableView.dequeueReusableCell(withIdentifier: "cell") -- Gitblit v1.7.1