CNLiveVodAlbumListCollectionCell.swift
3.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
//
// CNLiveVodAlbumListCollectionCell.swift
// metaCode
//
// Created by zx on 2025/3/4.
// 点播-剧集列表cell
import Foundation
import Kingfisher
class CNLiveVodAlbumListCollectionCell: UICollectionViewCell {
var num = 0//当前是第几
var isJiShuSelected = false//是否集数选中
//contentsModel
var _vodAlbumListModel : CNLiveVodAlbumListModel?
var vodAlbumListModel : CNLiveVodAlbumListModel? {
get{
_vodAlbumListModel
}
set{
_vodAlbumListModel = newValue!
setupNewUI(model: _vodAlbumListModel!)
}
}
//集数按钮
lazy var jiShuBtn: UIButton = {
let expandBtn = UIButton.init(type: .custom)
expandBtn.backgroundColor = HexColor("#EBF2FF")//nor EEEEEE,sele #EBF2FF
expandBtn.frame = CGRect(x: 0, y: 0, width: 50, height: 50)
expandBtn.setTitle("1", for: .normal)
expandBtn.setTitleColor(HexColor("#999999"), for: .normal)
expandBtn.setTitleColor(HexColor("#478BFF"), for: .selected)
expandBtn.titleLabel?.font = Font_18
expandBtn.layer.borderColor = HexColor("#2076FF")?.cgColor
expandBtn.layer.borderWidth = 0.5
expandBtn.layer.cornerRadius = 9
expandBtn.clipsToBounds = true
expandBtn.isUserInteractionEnabled = false
// expandBtn.addTarget(self, action: #selector(jiShuBtnAction), for: .touchUpInside)
return expandBtn
}()
//付费角标
lazy var payIconView :UIImageView = {
let layerView = UIImageView()
layerView.image = UIImage(named: "home_player_pay")
layerView.frame = CGRect(x: 0, y: 0, width: 26, height: 15)
return layerView
}()
override init(frame: CGRect) {
super.init(frame: frame)
self.contentView.addSubview(self.jiShuBtn)
self.jiShuBtn.addSubview(self.payIconView)
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func setupNewUI(model:CNLiveVodAlbumListModel){
let isPaid = CNLivePlayerTool.isShowPaidIcon(product: model.product)
if isPaid{
self.payIconView.isHidden = false
}else{
self.payIconView.isHidden = true
}
// if model.product?.productType == "2" || model.product?.productType == "5"{//付费
// payIconView.isHidden = false
// }else{
// if model.product?.check == true {
// //免费或者付过费了
// self.payIconView.isHidden = true
// } else {
// if model.product?.productType == "4" {
// //这里表示可以进行试听
// self.payIconView.isHidden = true
// } else {
// self.payIconView.isHidden = true
// }
// }
// }
jiShuBtn.setTitle("\(self.num+1)", for: .normal)
if self.isJiShuSelected{
//选中
jiShuBtn.setTitleColor(HexColor("#478BFF"), for: .normal)
jiShuBtn.layer.borderColor = HexColor("#2076FF")?.cgColor
jiShuBtn.layer.borderWidth = 0.5
jiShuBtn.backgroundColor = HexColor("#EBF2FF")//nor EEEEEE,sele #EBF2FF
}else{
//未选中
jiShuBtn.setTitleColor(HexColor("#999999"), for: .normal)
jiShuBtn.layer.borderColor = HexColor("#EEEEEE")?.cgColor
jiShuBtn.layer.borderWidth = 0
jiShuBtn.backgroundColor = HexColor("#EEEEEE")//nor EEEEEE,sele #EBF2FF
}
}
// @objc func jiShuBtnAction(){
//
// }
}