bug修复
This commit is contained in:
parent
290478c635
commit
e9c2b300d6
@ -78,6 +78,10 @@ extension VPWebViewController {
|
|||||||
//MARK: -------------- VPWebViewDelegate --------------
|
//MARK: -------------- VPWebViewDelegate --------------
|
||||||
extension VPWebViewController: VPWebViewDelegate {
|
extension VPWebViewController: VPWebViewDelegate {
|
||||||
|
|
||||||
|
func webView(_ webView: VPWebView, shouldStartLoadWith navigationAction: WKNavigationAction) -> Bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
func webViewDidStartLoad(_ webView: VPWebView) {
|
func webViewDidStartLoad(_ webView: VPWebView) {
|
||||||
VPHUD.show(containerView: self.view)
|
VPHUD.show(containerView: self.view)
|
||||||
}
|
}
|
||||||
|
@ -15,12 +15,18 @@ class VPHomeBannerCell: ZKCycleScrollViewCell {
|
|||||||
titleLabel.text = model?.name
|
titleLabel.text = model?.name
|
||||||
|
|
||||||
let watchCount = model?.watch_total ?? 0
|
let watchCount = model?.watch_total ?? 0
|
||||||
|
var hotStr = ""
|
||||||
if watchCount > 1000 {
|
if watchCount > 1000 {
|
||||||
let numStr = NSNumber(floatLiteral: CGFloat(watchCount) / 1000).toString(maximumFractionDigits: 1)
|
let numStr = NSNumber(floatLiteral: CGFloat(watchCount) / 1000).toString(maximumFractionDigits: 1)
|
||||||
hotView.setTitle("\(numStr)K", for: .normal)
|
hotStr = "\(numStr)K"
|
||||||
} else {
|
} else {
|
||||||
hotView.setTitle("\(watchCount)", for: .normal)
|
hotStr = "\(watchCount)"
|
||||||
}
|
}
|
||||||
|
if let category = model?.category?.first, category.count > 0 {
|
||||||
|
hotStr += " | \(category)"
|
||||||
|
}
|
||||||
|
|
||||||
|
hotView.setTitle(hotStr, for: .normal)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,6 +23,9 @@ class VPHomePlayHistoricalView: UIView {
|
|||||||
view.layer.cornerRadius = 10
|
view.layer.cornerRadius = 10
|
||||||
view.layer.masksToBounds = true
|
view.layer.masksToBounds = true
|
||||||
view.addEffectView(style: .dark)
|
view.addEffectView(style: .dark)
|
||||||
|
|
||||||
|
let tap = UITapGestureRecognizer(target: self, action: #selector(handlePlayButton))
|
||||||
|
view.addGestureRecognizer(tap)
|
||||||
return view
|
return view
|
||||||
}()
|
}()
|
||||||
|
|
||||||
@ -57,7 +60,7 @@ class VPHomePlayHistoricalView: UIView {
|
|||||||
private lazy var playButton: UIButton = {
|
private lazy var playButton: UIButton = {
|
||||||
let button = UIButton(type: .custom)
|
let button = UIButton(type: .custom)
|
||||||
button.setImage(UIImage(named: "play_icon_02"), for: .normal)
|
button.setImage(UIImage(named: "play_icon_02"), for: .normal)
|
||||||
button.addTarget(self, action: #selector(handlePlayButton), for: .touchUpInside)
|
button.isUserInteractionEnabled = false
|
||||||
return button
|
return button
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
@ -282,7 +282,7 @@ extension VPEpisodeView: UICollectionViewDelegate, UICollectionViewDataSource {
|
|||||||
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
|
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
|
||||||
guard indexPath.row != currentIndex else { return }
|
guard indexPath.row != currentIndex else { return }
|
||||||
|
|
||||||
var lastIndex = indexPath.row - 1
|
var lastIndex = indexPath.row - 1
|
||||||
var lastIsLock = false
|
var lastIsLock = false
|
||||||
if lastIndex > 0 && lastIndex < self.dataArr.count {
|
if lastIndex > 0 && lastIndex < self.dataArr.count {
|
||||||
let lastModel = self.dataArr[lastIndex]
|
let lastModel = self.dataArr[lastIndex]
|
||||||
|
@ -6,9 +6,18 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
import WebKit
|
||||||
|
|
||||||
class VPRewardsViewController: VPCampaignWebViewController {
|
class VPRewardsViewController: VPCampaignWebViewController {
|
||||||
|
|
||||||
|
private lazy var emptyView: VPEmptyView = {
|
||||||
|
let view = VPEmptyView.createNoNetworkEmptyView { [weak self] in
|
||||||
|
guard let self = self else { return }
|
||||||
|
self.webView.reload()
|
||||||
|
}
|
||||||
|
return view
|
||||||
|
}()
|
||||||
|
|
||||||
override func viewDidLoad() {
|
override func viewDidLoad() {
|
||||||
self.urlStr = kVPRewardsWebUrl
|
self.urlStr = kVPRewardsWebUrl
|
||||||
super.viewDidLoad()
|
super.viewDidLoad()
|
||||||
@ -22,4 +31,29 @@ class VPRewardsViewController: VPCampaignWebViewController {
|
|||||||
self.webView.reload()
|
self.webView.reload()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override func webView(_ webView: VPWebView, shouldStartLoadWith navigationAction: WKNavigationAction) -> Bool {
|
||||||
|
let result = super.webView(webView, shouldStartLoadWith: navigationAction)
|
||||||
|
emptyView.removeFromSuperview()
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
override func webViewDidFinishLoad(_ webView: VPWebView) {
|
||||||
|
super.webViewDidFinishLoad(webView)
|
||||||
|
emptyView.isHidden = true
|
||||||
|
}
|
||||||
|
|
||||||
|
override func webView(_ webView: VPWebView, didFailLoadWithError error: any Error) {
|
||||||
|
super.webView(webView, didFailLoadWithError: error)
|
||||||
|
|
||||||
|
if VPNetworkReachabilityManager.manager.isReachable != true {
|
||||||
|
if emptyView.superview == nil {
|
||||||
|
view.addSubview(emptyView)
|
||||||
|
emptyView.snp.makeConstraints { make in
|
||||||
|
make.left.equalToSuperview()
|
||||||
|
make.centerX.equalToSuperview()
|
||||||
|
make.centerY.equalToSuperview().offset(-100)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user