无数据页面开发

This commit is contained in:
zjx 2025-06-10 10:34:43 +08:00
parent 601d9200d2
commit b018486f21
11 changed files with 143 additions and 19 deletions

View File

@ -219,6 +219,7 @@
BFF5B2772DF2CA4B0044227A /* VPDetailRecommandBannerCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFF5B2762DF2CA4B0044227A /* VPDetailRecommandBannerCell.swift */; };
BFF5B2792DF679720044227A /* VPMoreVideoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFF5B2782DF679720044227A /* VPMoreVideoViewController.swift */; };
BFF5B4AF2DF6B6630044227A /* VPMutualCollectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFF5B4AE2DF6B6630044227A /* VPMutualCollectionView.swift */; };
BFF5B6E52DF7C8590044227A /* VPEmptyView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFF5B6E42DF7C8580044227A /* VPEmptyView.swift */; };
F939C04AD4003BA127F15C28 /* Pods_Veloria.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 34F57E87E765BF8D72A43DCA /* Pods_Veloria.framework */; };
/* End PBXBuildFile section */
@ -443,6 +444,7 @@
BFF5B2762DF2CA4B0044227A /* VPDetailRecommandBannerCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VPDetailRecommandBannerCell.swift; sourceTree = "<group>"; };
BFF5B2782DF679720044227A /* VPMoreVideoViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VPMoreVideoViewController.swift; sourceTree = "<group>"; };
BFF5B4AE2DF6B6630044227A /* VPMutualCollectionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VPMutualCollectionView.swift; sourceTree = "<group>"; };
BFF5B6E42DF7C8580044227A /* VPEmptyView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VPEmptyView.swift; sourceTree = "<group>"; };
E0BDA3570E00C90877E45AA0 /* Pods-VideoPlayer.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-VideoPlayer.debug.xcconfig"; path = "Target Support Files/Pods-VideoPlayer/Pods-VideoPlayer.debug.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */
@ -1070,6 +1072,7 @@
isa = PBXGroup;
children = (
BF5E75B52DE46DB600DE9DFE /* UIScrollView+Empty.swift */,
BFF5B6E42DF7C8580044227A /* VPEmptyView.swift */,
);
path = Empty;
sourceTree = "<group>";
@ -1536,6 +1539,7 @@
BF5E75B82DE46F7100DE9DFE /* VPNetworkReachabilityManager.swift in Sources */,
BFF5B26A2DF170DD0044227A /* VPIAPVerifyModel.swift in Sources */,
BF0FA6D52DDC5B5D00C9E5F2 /* VPApi.swift in Sources */,
BFF5B6E52DF7C8590044227A /* VPEmptyView.swift in Sources */,
BF0FA7C12DE45D5D00C9E5F2 /* VPUserInfo.swift in Sources */,
BF0FA7392DDECF8900C9E5F2 /* VPHomeListViewController.swift in Sources */,
BFF5AFB42DE7FF4E0044227A /* VPCoinsViewController.swift in Sources */,

View File

@ -61,7 +61,7 @@ class VPWalletAPI {
param.parameters = [
"page_size" : 20,
"current_page" : page,
"buy_type" : buyType.rawValue
"buy_type" : buyType == .subVip ? "vip" : buyType.rawValue
]
VPNetwork.request(parameters: param) { (response: VPNetworkResponse<VPListModel<VPRechargeRecordModel>>) in

View File

@ -42,7 +42,7 @@ class VPSearchResultView: UIView {
collectionView.dataSource = self
collectionView.contentInset = .init(top: 0, left: 0, bottom: UIScreen.tabbarSafeBottomMargin + 10, right: 0)
collectionView.register(VPSearchResultCell.self, forCellWithReuseIdentifier: "cell")
collectionView.vp_addNormalEmpty(image: UIImage(named: "empty_image_02"))
collectionView.vp_addNormalEmpty(image: UIImage(named: "empty_image_02"), title: "kEmptyTitle02".localized, des: "kEmptyDes02".localized)
collectionView.keyboardDismissMode = .onDrag
return collectionView
}()

View File

@ -11,7 +11,7 @@ class VPMeToolCell: VPTableViewCell {
private lazy var stackView: UIStackView = {
let view = UIStackView(arrangedSubviews: [walletButton, storeButton, rewardsButton, favoritesButton])
let view = UIStackView(arrangedSubviews: [walletButton, storeButton, /*rewardsButton,*/ favoritesButton])
view.axis = .horizontal
view.distribution = .fillEqually
view.alignment = .center

View File

@ -223,6 +223,10 @@ extension VPDetailPlayerViewController {
let view = VPPlayerRechargeView()
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)
}
@ -330,7 +334,7 @@ extension VPDetailPlayerViewController {
extension VPDetailPlayerViewController {
private func requestDetailData() {
private func requestDetailData(indexPath: IndexPath? = nil) {
guard let shortPlayId = shortPlayId else { return }
isShowRecommand = false
@ -350,7 +354,10 @@ extension VPDetailPlayerViewController {
self.reloadData { [weak self] in
guard let self = self else { return }
if let videoInfo = self.detailModel?.video_info {
if let indexPath = indexPath {
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 {

View File

@ -18,6 +18,7 @@ class VPPlayerCoinBuyView: UIView {
var shortPlayId: String?
var videoId: String?
var buyFinishBlock: (() -> Void)?
private lazy var selectedIndex = 0
@ -104,9 +105,11 @@ extension VPPlayerCoinBuyView: UICollectionViewDelegate, UICollectionViewDataSou
self.selectedIndex = indexPath.row
collectionView.reloadData()
VPIAPManager.manager.start(model: dataArr[indexPath.row], shortPlayId: self.shortPlayId, videoId: self.videoId) { finish in
VPIAPManager.manager.start(model: dataArr[indexPath.row], shortPlayId: self.shortPlayId, videoId: self.videoId) { [weak self] finish in
guard let self = self else { return }
if finish {
VPLoginManager.manager.updateUserInfo(completer: nil)
self.buyFinishBlock?()
}
}
}

View File

@ -22,6 +22,8 @@ class VPPlayerRechargeView: HWPanModalContentView {
}
}
var buyFinishBlock: (() -> Void)?
//MARK: UI
private lazy var bgView: UIImageView = {
let imageView = UIImageView(image: UIImage(named: "bg_image_01"))
@ -53,11 +55,21 @@ class VPPlayerRechargeView: HWPanModalContentView {
private lazy var vipView: VPPlayerVipBuyView = {
let view = VPPlayerVipBuyView()
view.buyFinishBlock = { [weak self] in
self?.buyFinishBlock?()
self?.dismiss(animated: true) {
}
}
return view
}()
private lazy var coinView: VPPlayerCoinBuyView = {
let view = VPPlayerCoinBuyView()
view.buyFinishBlock = { [weak self] in
self?.buyFinishBlock?()
self?.dismiss(animated: true) {
}
}
return view
}()
@ -68,7 +80,7 @@ class VPPlayerRechargeView: HWPanModalContentView {
override init(frame: CGRect) {
super.init(frame: frame)
NotificationCenter.default.addObserver(self, selector: #selector(updateCoin), name: VPLoginManager.userInfoUpdateNotification, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(buyVipFinishNotification), name: VPIAPManager.buyVipFinishNotification, object: nil)
// NotificationCenter.default.addObserver(self, selector: #selector(buyVipFinishNotification), name: VPIAPManager.buyVipFinishNotification, object: nil)
vp_setupUI()
@ -143,12 +155,12 @@ extension VPPlayerRechargeView {
coinLabel.attributedText = string
}
@objc private func buyVipFinishNotification() {
if VPLoginManager.manager.userInfo?.is_vip == true {
self.dismiss(animated: true) {
}
}
}
// @objc private func buyVipFinishNotification() {
// if VPLoginManager.manager.userInfo?.is_vip == true {
// self.dismiss(animated: true) {
// }
// }
// }
}
extension VPPlayerRechargeView {

View File

@ -18,6 +18,8 @@ class VPPlayerVipBuyView: UIView {
var shortPlayId: String?
var videoId: String?
var buyFinishBlock: (() -> Void)?
private lazy var currentIndex: Int = 0
private lazy var collectionViewLayout: UICollectionViewFlowLayout = {
@ -143,9 +145,11 @@ extension VPPlayerVipBuyView: UICollectionViewDelegate, UICollectionViewDataSour
self.collectionView.reloadData()
}
VPIAPManager.manager.start(model: dataArr[indexPath.row], shortPlayId: self.shortPlayId, videoId: self.videoId) { finish in
VPIAPManager.manager.start(model: dataArr[indexPath.row], shortPlayId: self.shortPlayId, videoId: self.videoId) { [weak self] finish in
guard let self = self else { return }
if finish {
VPLoginManager.manager.updateUserInfo(completer: nil)
self.buyFinishBlock?()
}
}
}

View File

@ -9,12 +9,17 @@ import UIKit
import EmptyDataSet_Swift
extension UIScrollView {
func vp_addNormalEmpty(image: UIImage? = UIImage(named: "empty_image_01"), title: String? = nil, titleColor: UIColor? = nil) {
func vp_addNormalEmpty(image: UIImage? = UIImage(named: "empty_image_01"), title: String? = "kEmptyTitle01".localized, des: String? = "kEmptyDes01".localized) {
let emptyView = VPEmptyView()
emptyView.image = image
emptyView.title = title
emptyView.des = des
self.emptyDataSetView { view in
view.image(image)
.isScrollAllowed(true)
.verticalOffset(-100)
view.customView(emptyView)
.verticalOffset(-130)
}
}
}

View File

@ -0,0 +1,86 @@
//
// VPEmptyView.swift
// Veloria
//
// Created by on 2025/6/10.
//
import UIKit
class VPEmptyView: UIView {
var image: UIImage? {
didSet {
imageView.image = image
}
}
var title: String? {
didSet {
titleLabel.text = title
}
}
var des: String? {
didSet {
desLabel.text = des
}
}
private lazy var imageView: UIImageView = {
let imageView = UIImageView()
return imageView
}()
private lazy var titleLabel: UILabel = {
let label = UILabel()
label.font = .fontMedium(ofSize: 17)
label.textColor = .color05CEA0()
return label
}()
private lazy var desLabel: UILabel = {
let label = UILabel()
label.font = .fontRegular(ofSize: 15)
label.textColor = .colorE5E5E5()
return label
}()
override init(frame: CGRect) {
super.init(frame: frame)
vp_setupUI()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
extension VPEmptyView {
private func vp_setupUI() {
addSubview(imageView)
addSubview(titleLabel)
addSubview(desLabel)
imageView.snp.makeConstraints { make in
make.centerX.equalToSuperview()
make.top.equalToSuperview()
}
titleLabel.snp.makeConstraints { make in
make.centerX.equalToSuperview()
make.bottom.equalTo(imageView).offset(-18)
}
desLabel.snp.makeConstraints { make in
make.centerX.equalToSuperview()
make.top.equalTo(titleLabel.snp.bottom).offset(15)
make.bottom.equalToSuperview()
}
}
}

View File

@ -90,7 +90,10 @@
"Watch Now" = "Watch Now";
"More" = "More";
"kEmptyTitle01" = "Nothing Here Yet";
"kEmptyDes01" = "Start exploring and add something!";
"kEmptyTitle02" = "Not Found";
"kEmptyDes02" = "Sorry, we couldn't find anything.";
"kDetailRecommandTitle" = "Picked Just for You";
"kHomeTitleText" = "10,000+ addictive shorts await!";
"kSearchPlaceholderText1" = "Search dramas";