| | |
| | | class CourseVideoDetailVC: BaseVC { |
| | | @IBOutlet weak var view_videoContainer: UIView! |
| | | |
| | | private var id:Int! |
| | | private var id:Int? |
| | | private var model:ExerciseVideoModel? |
| | | |
| | | @IBOutlet weak var label_name: UILabel! |
| | | @IBOutlet weak var label_introduce: UILabel! |
| | |
| | | }() |
| | | |
| | | |
| | | required init(id:Int) { |
| | | init(id:Int) { |
| | | super.init(nibName: nil, bundle: nil) |
| | | self.id = id |
| | | } |
| | | |
| | | init(model:ExerciseVideoModel){ |
| | | super.init(nibName: nil, bundle: nil) |
| | | self.model = model |
| | | } |
| | | |
| | | required init?(coder: NSCoder) { |
| | |
| | | override func viewDidLoad() { |
| | | super.viewDidLoad() |
| | | |
| | | if let id { |
| | | Services.benefitsVideoDetail(id: id).subscribe(onNext: { [weak self] data in |
| | | if let model = data.data{ |
| | | self?.playerVC.player = AVPlayer(url: URL(string: model.courseVideo)!) |
| | |
| | | }).disposed(by: disposeBag) |
| | | } |
| | | |
| | | if let model{ |
| | | Services.exerciseCourseDetail(coursePackageId: model.coursePackageId, videoId: model.videoId).subscribe(onNext: {[weak self] data in |
| | | if let model = data.data{ |
| | | self?.playerVC.player = AVPlayer(url: URL(string: model.videoURL)!) |
| | | self?.playerVC.player?.play() |
| | | |
| | | self?.label_name.text = model.packageName |
| | | self?.label_coin.text = "\(model.integral)积分" |
| | | self?.label_introduce.text = model.synopsis |
| | | if model.studyStatus == 1{ |
| | | self?.label_studyState.text = "已学习" |
| | | self?.label_studyState.backgroundColor = UIColor(hexStr: "#318C10").withAlphaComponent(0.29) |
| | | self?.label_studyState.textColor = UIColor(hexStr: "#318C10") |
| | | }else{ |
| | | self?.label_studyState.text = "未学习" |
| | | self?.label_studyState.backgroundColor = UIColor(hexStr: "#FD9331").withAlphaComponent(0.29) |
| | | self?.label_studyState.textColor = Def_ThemeColor |
| | | } |
| | | |
| | | SDWebImageDownloader.shared.downloadImage(with: URL(string: model.detailedDiagram)) { image, data, error, state in |
| | | if let img = image{ |
| | | self?.img_introduceCover.image = img |
| | | let radio = img.size.width / img.size.height |
| | | self?.cons_imgHei.constant = JQ_ScreenW * radio |
| | | } |
| | | } |
| | | } |
| | | }).disposed(by: disposeBag) |
| | | } |
| | | } |
| | | |
| | | override func setUI() { |
| | | view_videoContainer.addSubview(playerVC.view) |
| | | playerVC.view.frame = view_videoContainer.frame |