CNLiveDigitalSecCollectionCell.swift
4.16 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
//
// CNLiveDigitalSecCollectionCell.swift
// metaCode
//
// Created by zx on 2024/6/18.
//
import Foundation
import Kingfisher
class CNLiveDigitalSecCollectionCell: UICollectionViewCell {
var _authListModel : MineAuthListModel?
var authListModel : MineAuthListModel? {
get{
_authListModel
}
set{
_authListModel = newValue!
setupNewUI(model: _authListModel!)
}
}
lazy var iconImgView :UIImageView = {
let iconImgView = UIImageView(frame: CGRect(x: 0, y: 0, width: 60, height: 60))
iconImgView.clipsToBounds = true
iconImgView.layer.cornerRadius = 30
iconImgView.contentMode = .scaleAspectFill
iconImgView.clipsToBounds = true
return iconImgView
}()
lazy var bottomTitleLabel: UILabel = {
let titleLabel = UILabel.init(frame: CGRectMake(0, 47, 60, 16))
titleLabel.textColor = .white
titleLabel.textAlignment = .center
titleLabel.layer.cornerRadius = 8
titleLabel.clipsToBounds = true
titleLabel.font = Font_14
titleLabel.text = "审核中"
titleLabel.backgroundColor = HexColor("#FFD20B")
titleLabel.adjustsFontSizeToFitWidth=true
return titleLabel
}()
//是否选中
var _cellIsSelected : Bool = false
var cellIsSelected : Bool {
get{
_cellIsSelected
}
set{
_cellIsSelected = newValue
if _cellIsSelected == true{
//选中
self.iconImgView.layer.borderWidth = 1
self.iconImgView.layer.borderColor = HexColor("#1961FE")?.cgColor
}else{
//未选中
self.iconImgView.layer.borderWidth = 0
self.iconImgView.layer.borderColor = HexColor("#1961FE")?.cgColor
}
// self.rightIconImgView.isHidden = !_cellIsSelected
}
}
lazy var titleLabel: UILabel = {
let titleLabel = UILabel.init(frame: CGRectMake(0, self.iconImgView.bottom+8, 60, 17))
titleLabel.textColor = HexColor("#1961FE")
titleLabel.textAlignment = .center
titleLabel.adjustsFontSizeToFitWidth = true
titleLabel.font = Font_12
return titleLabel
}()
lazy var addBtn: UIButton = {
let closeBtn = UIButton(type: .custom)
closeBtn.frame = CGRect(x: 0, y: 0, width: 60, height: 60)
closeBtn.setImage(UIImage(named: "auth_add"), for: .normal)
closeBtn.addTarget(self, action: #selector(addBtnAction), for: .touchUpInside)
return closeBtn
}()
override init(frame: CGRect) {
super.init(frame: frame)
self.contentView.addSubview(self.iconImgView)
// self.iconImgView.addSubview(self.rightIconImgView)
self.contentView.addSubview(self.titleLabel)
self.contentView.addSubview(self.addBtn)
self.contentView.addSubview(self.bottomTitleLabel)
self.bottomTitleLabel.isHidden = true
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func setupNewUI(model:MineAuthListModel){
self.bottomTitleLabel.isHidden = true
if model.identityId != 0{
self.titleLabel.text = model.name
self.iconImgView.kf.setImage(with: URL(string: model.icon ?? ""))
self.addBtn.isHidden = true
self.titleLabel.isHidden = false
self.iconImgView.isHidden = false
if model.userStatus == 0{
//审核中
self.bottomTitleLabel.isHidden = false
}else if model.userStatus == 1{
//审核成功
self.bottomTitleLabel.isHidden = true
}else{
self.bottomTitleLabel.isHidden = true
}
}else{
self.addBtn.isHidden = false
self.titleLabel.isHidden = true
self.iconImgView.isHidden = true
}
}
@objc func addBtnAction(){
navigationViewController().pushViewController(CNLiveIdentityRepositoryController(), animated: true)
}
}