bug修复

This commit is contained in:
zjx 2025-06-17 14:43:34 +08:00
parent 290478c635
commit e9c2b300d6
5 changed files with 51 additions and 4 deletions

View File

@ -78,6 +78,10 @@ extension VPWebViewController {
//MARK: -------------- VPWebViewDelegate --------------
extension VPWebViewController: VPWebViewDelegate {
func webView(_ webView: VPWebView, shouldStartLoadWith navigationAction: WKNavigationAction) -> Bool {
return true
}
func webViewDidStartLoad(_ webView: VPWebView) {
VPHUD.show(containerView: self.view)
}

View File

@ -15,12 +15,18 @@ class VPHomeBannerCell: ZKCycleScrollViewCell {
titleLabel.text = model?.name
let watchCount = model?.watch_total ?? 0
var hotStr = ""
if watchCount > 1000 {
let numStr = NSNumber(floatLiteral: CGFloat(watchCount) / 1000).toString(maximumFractionDigits: 1)
hotView.setTitle("\(numStr)K", for: .normal)
hotStr = "\(numStr)K"
} else {
hotView.setTitle("\(watchCount)", for: .normal)
hotStr = "\(watchCount)"
}
if let category = model?.category?.first, category.count > 0 {
hotStr += " | \(category)"
}
hotView.setTitle(hotStr, for: .normal)
}
}

View File

@ -23,6 +23,9 @@ class VPHomePlayHistoricalView: UIView {
view.layer.cornerRadius = 10
view.layer.masksToBounds = true
view.addEffectView(style: .dark)
let tap = UITapGestureRecognizer(target: self, action: #selector(handlePlayButton))
view.addGestureRecognizer(tap)
return view
}()
@ -57,7 +60,7 @@ class VPHomePlayHistoricalView: UIView {
private lazy var playButton: UIButton = {
let button = UIButton(type: .custom)
button.setImage(UIImage(named: "play_icon_02"), for: .normal)
button.addTarget(self, action: #selector(handlePlayButton), for: .touchUpInside)
button.isUserInteractionEnabled = false
return button
}()

View File

@ -282,7 +282,7 @@ extension VPEpisodeView: UICollectionViewDelegate, UICollectionViewDataSource {
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
guard indexPath.row != currentIndex else { return }
var lastIndex = indexPath.row - 1
var lastIndex = indexPath.row - 1
var lastIsLock = false
if lastIndex > 0 && lastIndex < self.dataArr.count {
let lastModel = self.dataArr[lastIndex]

View File

@ -6,9 +6,18 @@
//
import UIKit
import WebKit
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() {
self.urlStr = kVPRewardsWebUrl
super.viewDidLoad()
@ -22,4 +31,29 @@ class VPRewardsViewController: VPCampaignWebViewController {
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)
}
}
}
}
}