修复播放详情bug
This commit is contained in:
parent
ef0b3b1ab8
commit
8ebd677a1e
@ -25,6 +25,7 @@ class SPVideoAPI: NSObject {
|
||||
var param = SPNetworkParameters(path: "/getVideoDetails")
|
||||
param.method = .get
|
||||
param.parameters = parameters
|
||||
param.isLoding = true
|
||||
|
||||
SPNetwork.request(parameters: param) { (response: SPNetworkResponse<SPVideoDetailModel>) in
|
||||
completer?(response.data)
|
||||
|
@ -235,6 +235,10 @@ extension SPPlayerDetailViewController {
|
||||
let view = SPPlayBuyView()
|
||||
view.shortPlayId = videoInfo.short_play_id
|
||||
view.videoId = videoInfo.short_play_video_id
|
||||
view.buyFinishBlock = { [weak self] in
|
||||
guard let self = self else { return }
|
||||
self.requestDetailData(indexPath: self.currentIndexPath)
|
||||
}
|
||||
view.present(in: nil)
|
||||
}
|
||||
|
||||
@ -295,15 +299,15 @@ extension SPPlayerDetailViewController {
|
||||
}
|
||||
|
||||
@objc private func buyVipFinishNotification() {
|
||||
guard SPLoginManager.manager.userInfo?.is_vip == true else { return }
|
||||
|
||||
self.detailModel?.episodeList?.forEach({
|
||||
$0.is_lock = false
|
||||
})
|
||||
|
||||
self.reloadData { [weak self] in
|
||||
self?.play()
|
||||
}
|
||||
// guard SPLoginManager.manager.userInfo?.is_vip == true else { return }
|
||||
//
|
||||
// self.detailModel?.episodeList?.forEach({
|
||||
// $0.is_lock = false
|
||||
// })
|
||||
//
|
||||
// self.reloadData { [weak self] in
|
||||
// self?.play()
|
||||
// }
|
||||
}
|
||||
///网络切换通知
|
||||
@objc private func reachabilityDidChangeNotification() {
|
||||
@ -368,7 +372,7 @@ extension SPPlayerDetailViewController {
|
||||
|
||||
extension SPPlayerDetailViewController {
|
||||
|
||||
private func requestDetailData() {
|
||||
private func requestDetailData(indexPath: IndexPath? = nil) {
|
||||
guard let shortPlayId = self.shortPlayId else { return }
|
||||
isShowRecommand = false
|
||||
recommandTimer?.invalidate()
|
||||
@ -382,7 +386,10 @@ extension SPPlayerDetailViewController {
|
||||
self.reloadData { [weak self] in
|
||||
guard let self = self else { return }
|
||||
|
||||
if let videoInfo = self.detailModel?.video_info {
|
||||
if let indexPath = indexPath, indexPath.row < (model.episodeList?.count ?? 0) {
|
||||
self.scrollToItem(indexPath: indexPath, animated: false)
|
||||
|
||||
} else if let videoInfo = self.detailModel?.video_info {
|
||||
var row: Int?
|
||||
self.detailModel?.episodeList?.enumerated().forEach({
|
||||
if $1.id == videoInfo.id {
|
||||
@ -390,11 +397,7 @@ extension SPPlayerDetailViewController {
|
||||
}
|
||||
})
|
||||
if let row = row {
|
||||
self.scrollToItem(indexPath: IndexPath(row: row, section: 0), animated: false) { [weak self] in
|
||||
guard let self = self else { return }
|
||||
//跳转到指定进度
|
||||
// self.viewModel.currentPlayer?.seekToTime(toTime: (videoInfo.play_seconds ?? 0) / 1000)
|
||||
}
|
||||
self.scrollToItem(indexPath: .init(row: row, section: 0), animated: false)
|
||||
} else {
|
||||
self.scrollToItem(indexPath: .init(row: 0, section: 0), animated: false)
|
||||
}
|
||||
|
@ -9,6 +9,8 @@ import UIKit
|
||||
|
||||
class SPPlayBuyView: HWPanModalContentView {
|
||||
|
||||
var buyFinishBlock: (() -> Void)?
|
||||
|
||||
var shortPlayId: String? {
|
||||
didSet {
|
||||
rechargeView.shortPlayId = shortPlayId
|
||||
@ -122,6 +124,7 @@ extension SPPlayBuyView {
|
||||
guard let self = self else { return }
|
||||
self.rechargeView.userInfo = SPLoginManager.manager.userInfo
|
||||
}
|
||||
self.buyFinishBlock?()
|
||||
|
||||
self.dismiss(animated: true) {
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user