首页播放历史
This commit is contained in:
parent
11cd8628aa
commit
e18a1652ca
@ -80,6 +80,12 @@ class SPHomeViewController: SPHomeChildController {
|
||||
|
||||
private var headerView: SPHomeHeaderView?
|
||||
|
||||
private lazy var playHistoricalView: SPHomePlayHistoricalView = {
|
||||
let view = SPHomePlayHistoricalView()
|
||||
view.isHidden = true
|
||||
return view
|
||||
}()
|
||||
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
@ -144,6 +150,7 @@ extension SPHomeViewController {
|
||||
view.addSubview(allButton)
|
||||
view.addSubview(rewardButton)
|
||||
view.addSubview(self.collectionView)
|
||||
view.addSubview(playHistoricalView)
|
||||
|
||||
// logoImageView.snp.makeConstraints { make in
|
||||
// make.left.equalToSuperview().offset(16)
|
||||
@ -174,6 +181,12 @@ extension SPHomeViewController {
|
||||
// make.top.equalToSuperview().offset(kSPStatusbarHeight + 66)
|
||||
make.top.equalTo(searchButton.snp.bottom).offset(34)
|
||||
}
|
||||
|
||||
playHistoricalView.snp.makeConstraints { make in
|
||||
make.left.equalToSuperview().offset(16)
|
||||
make.centerX.equalToSuperview()
|
||||
make.bottom.equalToSuperview().offset(-4)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -329,6 +342,11 @@ extension SPHomeViewController {
|
||||
self.viewModel.playHistoryArr = list
|
||||
self.layout.headerReferenceSize = CGSize(width: kSPScreenWidth, height: SPHomeHeaderView.contentHeight(viewModel: self.viewModel))
|
||||
self.collectionView.reloadData()
|
||||
|
||||
if let model = listModel?.list?.first {
|
||||
self.playHistoricalView.model = model
|
||||
self.playHistoricalView.isHidden = false
|
||||
}
|
||||
}
|
||||
self.updateEmptyState()
|
||||
completer?()
|
||||
@ -354,4 +372,6 @@ extension SPHomeViewController {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
138
MoviaBox/Class/Home/View/SPHomePlayHistoricalView.swift
Normal file
138
MoviaBox/Class/Home/View/SPHomePlayHistoricalView.swift
Normal file
@ -0,0 +1,138 @@
|
||||
//
|
||||
// SPHomePlayHistoricalView.swift
|
||||
// MoviaBox
|
||||
//
|
||||
// Created by 长沙佳儿 on 2025/6/17.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
class SPHomePlayHistoricalView: UIView {
|
||||
|
||||
var model: SPShortModel? {
|
||||
didSet {
|
||||
coverImageView.sp_setImage(url: model?.image_url)
|
||||
titleLabel.text = model?.name
|
||||
subtitleLabel.text = "movia_watched_episode".localizedReplace(text: model?.current_episode ?? "")
|
||||
}
|
||||
}
|
||||
|
||||
private lazy var bgView: UIView = {
|
||||
let view = UIImageView(image: UIImage(named: "home_historical_bg_image_"))
|
||||
view.isUserInteractionEnabled = true
|
||||
// view.addEffectView(style: .dark)
|
||||
// view.addRadius(topLeft: 0, topRight: 24, bottomLeft: 0, bottomRight: 24)
|
||||
let tap = UITapGestureRecognizer(target: self, action: #selector(handlePlayButton))
|
||||
view.addGestureRecognizer(tap)
|
||||
return view
|
||||
}()
|
||||
|
||||
private lazy var coverImageView: SPImageView = {
|
||||
let imageView = SPImageView()
|
||||
imageView.layer.cornerRadius = 4
|
||||
imageView.layer.masksToBounds = true
|
||||
return imageView
|
||||
}()
|
||||
|
||||
private lazy var closeButton: UIButton = {
|
||||
let button = UIButton(type: .custom)
|
||||
button.setImage(UIImage(named: "close_icon_03"), for: .normal)
|
||||
button.addTarget(self, action: #selector(handleCloseButton), for: .touchUpInside)
|
||||
return button
|
||||
}()
|
||||
|
||||
private lazy var playButton: UIButton = {
|
||||
let button = UIButton(type: .custom)
|
||||
button.isUserInteractionEnabled = false
|
||||
button.setImage(UIImage(named: "play_icon_05"), for: .normal)
|
||||
button.addTarget(self, action: #selector(handlePlayButton), for: .touchUpInside)
|
||||
return button
|
||||
}()
|
||||
|
||||
private lazy var titleLabel: UILabel = {
|
||||
let label = UILabel()
|
||||
label.font = .fontMedium(ofSize: 12)
|
||||
label.textColor = .colorFFFFFF()
|
||||
return label
|
||||
}()
|
||||
|
||||
private lazy var subtitleLabel: UILabel = {
|
||||
let label = UILabel()
|
||||
label.font = .fontRegular(ofSize: 12)
|
||||
label.textColor = .colorFFFFFF(alpha: 0.3)
|
||||
return label
|
||||
}()
|
||||
|
||||
override init(frame: CGRect) {
|
||||
super.init(frame: frame)
|
||||
|
||||
sp_setupUI()
|
||||
}
|
||||
|
||||
required init?(coder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
|
||||
@objc private func handleCloseButton() {
|
||||
self.isHidden = true
|
||||
}
|
||||
|
||||
@objc private func handlePlayButton() {
|
||||
guard let shortPlayId = model?.short_play_id else { return }
|
||||
|
||||
let vc = SPPlayerDetailViewController()
|
||||
vc.shortPlayId = shortPlayId
|
||||
SPAPPTool.topViewController()?.navigationController?.pushViewController(vc, animated: true)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension SPHomePlayHistoricalView {
|
||||
|
||||
private func sp_setupUI() {
|
||||
addSubview(bgView)
|
||||
addSubview(coverImageView)
|
||||
bgView.addSubview(closeButton)
|
||||
bgView.addSubview(playButton)
|
||||
bgView.addSubview(titleLabel)
|
||||
bgView.addSubview(subtitleLabel)
|
||||
|
||||
|
||||
bgView.snp.makeConstraints { make in
|
||||
make.left.right.bottom.equalToSuperview()
|
||||
// make.height.equalTo(48)
|
||||
}
|
||||
|
||||
coverImageView.snp.makeConstraints { make in
|
||||
make.left.bottom.top.equalToSuperview()
|
||||
make.height.equalTo(58)
|
||||
make.width.equalTo(44)
|
||||
}
|
||||
|
||||
closeButton.snp.makeConstraints { make in
|
||||
make.centerY.equalToSuperview()
|
||||
make.right.equalToSuperview().offset(-4)
|
||||
make.width.equalTo(32)
|
||||
make.height.equalTo(40)
|
||||
}
|
||||
|
||||
playButton.snp.makeConstraints { make in
|
||||
make.centerY.equalToSuperview()
|
||||
make.right.equalToSuperview().offset(-38)
|
||||
}
|
||||
|
||||
titleLabel.snp.makeConstraints { make in
|
||||
make.left.equalToSuperview().offset(52)
|
||||
make.top.equalToSuperview().offset(7)
|
||||
make.right.lessThanOrEqualToSuperview().offset(-100)
|
||||
}
|
||||
|
||||
subtitleLabel.snp.makeConstraints { make in
|
||||
make.left.equalTo(titleLabel)
|
||||
make.bottom.equalToSuperview().offset(-7)
|
||||
make.right.lessThanOrEqualToSuperview().offset(-100)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -28,6 +28,12 @@ class SPRewardsViewController: SPCampaignWebViewController {
|
||||
|
||||
self.webView.backgroundColor = .clear
|
||||
self.webView.scrollView.backgroundColor = .clear
|
||||
|
||||
self.webView.snp.remakeConstraints { make in
|
||||
make.left.right.bottom.equalToSuperview()
|
||||
make.top.equalToSuperview().offset(kSPNavBarHeight)
|
||||
}
|
||||
|
||||
setEmptyView()
|
||||
|
||||
|
||||
|
@ -124,7 +124,14 @@ extension SPLocalizedManager {
|
||||
}
|
||||
|
||||
extension String {
|
||||
|
||||
var localized: String {
|
||||
return SPLocalizedManager.shared.localizedString(forKey: self)
|
||||
var text = SPLocalizedManager.shared.localizedString(forKey: self)
|
||||
text = text.replacingOccurrences(of: "<br>", with: "\n")
|
||||
return text
|
||||
}
|
||||
|
||||
func localizedReplace(text: String) -> String {
|
||||
return self.localized.replacingOccurrences(of: "##", with: text)
|
||||
}
|
||||
}
|
||||
|
22
MoviaBox/Source/Assets.xcassets/icon/close_icon_03.imageset/Contents.json
vendored
Normal file
22
MoviaBox/Source/Assets.xcassets/icon/close_icon_03.imageset/Contents.json
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "Frame@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "Frame@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
MoviaBox/Source/Assets.xcassets/icon/close_icon_03.imageset/Frame@2x.png
vendored
Normal file
BIN
MoviaBox/Source/Assets.xcassets/icon/close_icon_03.imageset/Frame@2x.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 310 B |
BIN
MoviaBox/Source/Assets.xcassets/icon/close_icon_03.imageset/Frame@3x.png
vendored
Normal file
BIN
MoviaBox/Source/Assets.xcassets/icon/close_icon_03.imageset/Frame@3x.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 399 B |
22
MoviaBox/Source/Assets.xcassets/icon/play_icon_05.imageset/Contents.json
vendored
Normal file
22
MoviaBox/Source/Assets.xcassets/icon/play_icon_05.imageset/Contents.json
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "Frame 1912056685@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "Frame 1912056685@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
MoviaBox/Source/Assets.xcassets/icon/play_icon_05.imageset/Frame 1912056685@2x.png
vendored
Normal file
BIN
MoviaBox/Source/Assets.xcassets/icon/play_icon_05.imageset/Frame 1912056685@2x.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.6 KiB |
BIN
MoviaBox/Source/Assets.xcassets/icon/play_icon_05.imageset/Frame 1912056685@3x.png
vendored
Normal file
BIN
MoviaBox/Source/Assets.xcassets/icon/play_icon_05.imageset/Frame 1912056685@3x.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.6 KiB |
44
MoviaBox/Source/Assets.xcassets/image/home_historical_bg_image_.imageset/Contents.json
vendored
Normal file
44
MoviaBox/Source/Assets.xcassets/image/home_historical_bg_image_.imageset/Contents.json
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "背景切图@2x.png",
|
||||
"idiom" : "universal",
|
||||
"resizing" : {
|
||||
"cap-insets" : {
|
||||
"left" : 88,
|
||||
"right" : 72
|
||||
},
|
||||
"center" : {
|
||||
"mode" : "tile",
|
||||
"width" : 1
|
||||
},
|
||||
"mode" : "3-part-horizontal"
|
||||
},
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "背景切图@3x.png",
|
||||
"idiom" : "universal",
|
||||
"resizing" : {
|
||||
"cap-insets" : {
|
||||
"left" : 108,
|
||||
"right" : 110
|
||||
},
|
||||
"center" : {
|
||||
"mode" : "tile",
|
||||
"width" : 1
|
||||
},
|
||||
"mode" : "3-part-horizontal"
|
||||
},
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
MoviaBox/Source/Assets.xcassets/image/home_historical_bg_image_.imageset/背景切图@2x.png
vendored
Normal file
BIN
MoviaBox/Source/Assets.xcassets/image/home_historical_bg_image_.imageset/背景切图@2x.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
BIN
MoviaBox/Source/Assets.xcassets/image/home_historical_bg_image_.imageset/背景切图@3x.png
vendored
Normal file
BIN
MoviaBox/Source/Assets.xcassets/image/home_historical_bg_image_.imageset/背景切图@3x.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 24 KiB |
@ -114,6 +114,7 @@
|
||||
"Y_complex" = "years";
|
||||
"movia_vip_membership" = "VIP Membership";
|
||||
"movia_library" = "Library";
|
||||
"movia_watched_episode" = "Watched EP##";
|
||||
|
||||
|
||||
"movia_vip_alert_text_01" = "Short Drama VIP Exclusive";
|
||||
|
Loading…
x
Reference in New Issue
Block a user