CNLiveDigitalAssetsController.swift
4.91 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
130
131
132
133
134
135
136
137
138
//
// CNLiveDigitalAssetsController.swift
// metaCode
//
// Created by zx on 2024/6/17.
// 数字资产页面
import Foundation
class CNLiveDigitalAssetsController:CNLiveBaseViewController, UITableViewDataSource, UITableViewDelegate{
lazy var nextBtn: UIButton = {
let nextBtn = UIButton(type: .custom)
nextBtn.setTitle("培训就业指南", for: .normal)
nextBtn.setTitleColor(.white, for: .normal)
nextBtn.titleLabel?.font = Font_17
nextBtn.backgroundColor = HexColor("#1961FE")
nextBtn.layer.cornerRadius = 22
nextBtn.clipsToBounds = true
nextBtn.addTarget(self, action: #selector(nextBtnAction), for: .touchUpInside)
return nextBtn
}()
let kCNLiveDigitalFirstCellIdentifier = "kCNLiveDigitalFirstCellIdentifier"
let kCNLiveDigitalSecCellIdentifier = "kCNLiveDigitalSecCellIdentifier"
lazy var tableView : UITableView = {
let tableView = UITableView(frame: .zero, style: .plain)
tableView.dataSource = self
tableView.delegate = self
tableView.separatorStyle = .none
tableView.tableFooterView = UIView.init()
tableView.register(CNLiveDigitalFirstCell.self, forCellReuseIdentifier: kCNLiveDigitalFirstCellIdentifier)
tableView.register(CNLiveDigitalSecCell.self, forCellReuseIdentifier: kCNLiveDigitalSecCellIdentifier)
return tableView
}()
lazy var dataArray: NSMutableArray = {
var dataArray = NSMutableArray()
return dataArray
}()
override func viewDidLoad() {
super.viewDidLoad()
navigationBarHidden = false
titleName = "元码数字认证"
self.initUI()
self.loadData()
}
func initUI(){
//背景图
let layerView = UIView()
layerView.frame = CGRect(x: 0, y: KNavigationHeight, width:KSreenWidth, height: adapt_length(length: 234))
// fillCode
let bgLayer1 = CAGradientLayer()
bgLayer1.colors = [UIColor(red: 0.16, green: 0.45, blue: 0.99, alpha: 1).cgColor, UIColor(red: 0.96, green: 0.96, blue: 0.98, alpha: 1).cgColor]
bgLayer1.locations = [0, 1]
bgLayer1.frame = layerView.bounds
bgLayer1.startPoint = CGPoint(x: 0.5, y: 0)
bgLayer1.endPoint = CGPoint(x: 1, y: 1)
layerView.layer.addSublayer(bgLayer1)
view.addSubview(layerView)
view.addSubview(self.tableView)
self.tableView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.top.equalToSuperview().offset(KNavigationHeight)
make.bottom.equalToSuperview().offset(adapt_length(length: -59))
}
self.tableView.backgroundColor = .clear
self.view.addSubview(self.nextBtn)
self.nextBtn.snp.makeConstraints { make in
make.top.equalTo(self.tableView.snp.bottom).offset(adapt_length(length: 10))
make.height.equalTo(adapt_length(length: 44))
make.left.equalTo(15)
make.right.equalToSuperview().offset(-15)
}
}
func loadData(){
CNLiveMineViewModel.requestsGETAuthInfoList(page: 1) { [weak self] result, respStatue in
if respStatue == .success {
let listBaseModel = result as! MineAuthListBaseModel
if self != nil{
self!.dataArray.addObjects(from: listBaseModel.list)
self!.dataArray.add(MineAuthListModel())
self!.tableView.reloadData()
}
}else {
}
}
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 2
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if indexPath.row == 0{
guard let cell = tableView.dequeueReusableCell(withIdentifier: kCNLiveDigitalFirstCellIdentifier) as? CNLiveDigitalFirstCell
else {
let cell = CNLiveDigitalFirstCell()
return cell
}
return cell
}else{
guard let cell = tableView.dequeueReusableCell(withIdentifier: kCNLiveDigitalSecCellIdentifier) as? CNLiveDigitalSecCell
else {
let cell = CNLiveDigitalSecCell()
cell.digitalListModels = self.dataArray as? [MineAuthListModel]
return cell
}
cell.digitalListModels = self.dataArray as? [MineAuthListModel]
return cell
}
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if indexPath.row == 0{
return adapt_length(length: 121+20)
}else{
return adapt_length(length: 838+15)
}
}
deinit {
}
@objc func nextBtnAction(){
showMessage(message: "此功能对您暂未开放")
}
}