CNLiveMineAuthResultViewController.swift
10.5 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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
//
// CNLiveMineAuthResultViewController.swift
// metaCode
//
// Created by open on 2023/9/12.
//
import Foundation
import SnapKit
enum CNLiveMineAuthResultShowType {
case detail//认证身份详情界面
case detail_shop//店铺信息提交完成
case result_success//身份信息结果页成功
case result_failer//身份信息结果页失败
}
class CNLiveMineAuthResultViewController: CNLiveBaseViewController {
lazy var mainView: UIImageView = {
let mainView = UIImageView()
mainView.contentMode = .scaleToFill
mainView.backgroundColor = .clear
if _show_type == .detail_shop {
mainView.image = UIImage(named: "mine_header_upload_result_info")
} else {
mainView.isHidden = !(_show_type == .result_success || _show_type == .result_failer)
mainView.image = UIImage(named: (_show_type == .result_success ? "mine_auth_result_header_success" : "mine_auth_result_header_failer"))
}
return mainView
}()
lazy var iconView: UIImageView = {
let mainView = UIImageView()
mainView.contentMode = .scaleToFill
mainView.image = UIImage(named: (_show_type == .result_success ? "auth_shenhezhong" : "auth_shenhezhong"))
return mainView
}()
lazy var tipName: UILabel = {
let tipName = UILabel.init()
if _show_type == .detail_shop {
tipName.text = "恭喜您,提交成功"
} else {
tipName.text = "认证申请已提交"
}
tipName.font = BoldFont_18_Fit
tipName.textAlignment = .center
tipName.textColor = .black
return tipName
}()
lazy var tipDesc: UILabel = {
let tipDesc = UILabel.init()
if _show_type == .detail_shop {
tipDesc.text = "请等待3个工作日,审核通过即可入驻平台!"
} else {
tipDesc.text = "请耐心等待,可随时关注审核进度"
}
tipDesc.textColor = HexColor("#A9A9A9")
tipDesc.textAlignment = .center
tipDesc.font = Font_13
return tipDesc
}()
lazy var sendButton: UIButton = {
let sendButton = UIButton(type: .custom)
if _show_type == .detail_shop {
sendButton.backgroundColor = .clear
sendButton.setTitle(" 我知道了 ", for: .normal)
sendButton.setTitleColor(HexColor("#609BFF"), for: .normal)
sendButton.titleLabel?.font = BoldFont_16_Fit
sendButton.layer.borderColor = HexColor("#609BFF")?.cgColor
sendButton.layer.borderWidth = 0.5
sendButton.layer.cornerRadius = 15
} else {
sendButton.layer.cornerRadius = 20
sendButton.setTitle("确 定", for: .normal)
sendButton.setTitleColor(.white, for: .normal)
sendButton.titleLabel?.font = BoldFont_16_Fit
}
sendButton.layer.masksToBounds = true
sendButton.addTarget(self, action: #selector(sendInfoActionMothod), for: .touchUpInside)
return sendButton
}()
/// 已认证-身份卡片
lazy var iDCardView:CNIDCardView = {
let iDCardView:CNIDCardView = CNIDCardView(frame: CGRect(x: (KSreenWidth - 40)/2, y: get_system_nav_height()+30, width: KSreenWidth - 40, height: (KSreenWidth-40) * 0.64))
iDCardView.isHidden = true
return iDCardView
}()
var _status: UIStatusBarStyle! = .lightContent
var _listModel:StandListModel!
var _show_type:CNLiveMineAuthResultShowType!
var _authType:CNLiveMineInputAuthType!
init(_ listModel:StandListModel,show_type:CNLiveMineAuthResultShowType,authType:CNLiveMineInputAuthType) {
super.init(nibName:nil, bundle:nil)
_listModel = listModel
_show_type = show_type
_authType = authType
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
if _show_type == .detail_shop {
let tempArray = NSMutableArray.init()
self.navigationController?.viewControllers.forEach({ item in
if (item.isKind(of: CNLiveMineShopViewController.self)) {
tempArray.remove(item)
}else{
tempArray.add(item)
}
})
self.navigationController?.viewControllers = tempArray as! [CNLiveBaseViewController]
} else {
if _show_type == .result_failer || _show_type == .result_success {
let tempArray = NSMutableArray.init()
self.navigationController?.viewControllers.forEach({ item in
if (item.isKind(of: CNLiveMineInputViewController.self)) {
tempArray.remove(item)
}else{
tempArray.add(item)
}
})
self.navigationController?.viewControllers = tempArray as! [CNLiveBaseViewController]
}
}
}
override func viewDidLoad() {
super.viewDidLoad()
navigationBarHidden = false
if _show_type == .detail_shop {
view.backgroundColor = HexColor("#F7F8FA")
topNavView.backgroundColor = .clear
titleName = "提交成功"
titleLabel.textColor = .black
_status = .default
setNeedsStatusBarAppearanceUpdate()
} else {
view.backgroundColor = .white
topNavView.backgroundColor = .clear
titleName = "元码数字认证"//"添加\(_listModel.name!)"
titleLabel.textColor = .white
leftBtnWhite = true
_status = .lightContent
setNeedsStatusBarAppearanceUpdate()
}
view.insertSubview(mainView, belowSubview: topNavView)
mainView.snp.makeConstraints { make in
if _show_type == .detail_shop {
make.centerX.equalToSuperview()
make.centerY.equalToSuperview().offset(-100)
make.size.equalTo(150)
} else {
make.left.top.right.equalToSuperview()
make.height.equalTo(0)//346
}
}
view.addSubview(iconView)
iconView.snp.makeConstraints { make in
make.centerX.equalToSuperview()
make.top.equalTo(adapt_length(length: 130))
}
view.addSubview(tipName)
tipName.snp.makeConstraints { make in
make.centerX.equalToSuperview()
make.top.equalTo(iconView.snp.bottom).offset(20)
}
view.addSubview(tipDesc)
tipDesc.snp.makeConstraints { make in
make.centerX.equalToSuperview()
make.top.equalTo(tipName.snp.bottom).offset(10)
}
view.addSubview(sendButton)
sendButton.snp.makeConstraints { make in
make.centerX.equalToSuperview()
if _show_type == .detail_shop {
make.top.equalTo(tipDesc.snp.bottom).offset(20)
make.height.equalTo(30)
make.width.equalTo(100)
} else {
make.top.equalTo(tipDesc.snp.bottom).offset(50)
make.height.equalTo(40)
make.width.equalTo(150)
}
}
if _show_type == .detail_shop {
NotificationCenter.default.post(name: Notification.Name.ShopAuthManage.DSShopDarenAuthResultNotification, object: nil)
} else {
view.addSubview(iDCardView)
iDCardView.snp.makeConstraints { make in
make.centerX.equalToSuperview()
make.top.equalToSuperview().offset(get_system_nav_height()+30)
make.height.equalTo((KSreenWidth-40) * 0.64)
make.width.equalTo(KSreenWidth-40)
}
sendButton.setGradient(colors: [UIColor(red: 103/255.0, green: 197/255.0, blue: 255/255.0, alpha: 1),UIColor(red: 96/255.0, green: 154/255.0, blue: 255/255.0, alpha: 1)], startPoint: CGPoint(x: 0, y: 0.5), endPoint: CGPoint(x: 1, y: 0.5))
CNLiveMineViewModel.startKeepTimeWithStand(id: "\(_listModel.id)", authType: _authType) { [weak self] result, respStatue in
if respStatue == .success {
let listBaseModel = result as! MineStandInfoBaseModel
self?.titleLabel.textColor = .black
self?.leftBtnWhite = false
self?.mainView.isHidden = true
self?.iDCardView.isHidden = false
self?.iDCardView.idModel = self?._listModel
self?.tipName.text = "恭喜您通过认证"
self?.tipDesc.text = listBaseModel.name.count > 0 ? "您已是\(listBaseModel.name)" : "恭喜您通过认证"
self?._status = .default
self?.setNeedsStatusBarAppearanceUpdate()
NotificationCenter.default.post(name: Notification.Name.StandAuth.StandAuthNotificationSuccess, object: nil)
}else{
self?.iDCardView.isHidden = true
self?.mainView.image = UIImage(named: "mine_auth_result_header_failer")
self?.tipName.text = "审核失败"
self?.tipDesc.text = "请您修改后重新提交"
}
}
}
}
override var preferredStatusBarStyle: UIStatusBarStyle {
return _status
}
@objc func sendInfoActionMothod() {
self.popVC()
}
override func ClickBackBtn() {
self.popVC()
}
func popVC(){
NotificationCenter.default.post(name: Notification.Name.StandAuth.StandAuthNotificationSuccess, object: nil)
let controllers = self.navigationController?.viewControllers
if controllers?.count ?? 0 > 2{
if controllers?[1] is CNLiveDigitalAssetsController{
let assetVC = controllers?[1] as! CNLiveDigitalAssetsController
self.navigationController?.popToViewController(assetVC, animated: true)
}else if controllers?[1] is CNLiveDigitalResumeController{
let vc = controllers?[1] as! CNLiveDigitalResumeController
self.navigationController?.popToViewController(vc, animated: true)
}else{
self.navigationController?.popToRootViewController(animated: true)
}
}else{
self.navigationController?.popToRootViewController(animated: true)
}
}
}