Commit 6ece0a35857de79f19ca96ac1e152ccea3e3f82f
Merge branch 'master' of http://bj.gitlab.cnlive.com/ios-team/CNLiveMateCode
Showing
15 changed files
with
726 additions
and
241 deletions
metaCode.xcodeproj/project.pbxproj
| ... | ... | @@ -8,6 +8,7 @@ |
| 8 | 8 | |
| 9 | 9 | /* Begin PBXBuildFile section */ |
| 10 | 10 | 0D39E93D7229931C86EB1161 /* Pods_metaCode_metaCodeUITests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 63D879B49B1E42F1584DD75E /* Pods_metaCode_metaCodeUITests.framework */; }; |
| 11 | + 19F1C2332AB5728B0083D06C /* CNIDCardView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19F1C2322AB5728B0083D06C /* CNIDCardView.swift */; }; | |
| 11 | 12 | 1DD2808DF02C120276F99F4D /* Pods_metaCode.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F1C55A719CFEE073C06D37CE /* Pods_metaCode.framework */; }; |
| 12 | 13 | 7905BB492AB0588B0089BC50 /* CNLiveMineAuthResultViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7905BB482AB0588B0089BC50 /* CNLiveMineAuthResultViewController.swift */; }; |
| 13 | 14 | 790B1FB42A4153E90074CF00 /* CNLiveMineBaseModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 790B1FB32A4153E90074CF00 /* CNLiveMineBaseModel.swift */; }; |
| ... | ... | @@ -111,6 +112,7 @@ |
| 111 | 112 | /* Begin PBXFileReference section */ |
| 112 | 113 | 0EC910AB9EBD717B04432BC4 /* Pods-metaCode-metaCodeUITests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-metaCode-metaCodeUITests.debug.xcconfig"; path = "Target Support Files/Pods-metaCode-metaCodeUITests/Pods-metaCode-metaCodeUITests.debug.xcconfig"; sourceTree = "<group>"; }; |
| 113 | 114 | 170BC5D0622EA2969D110A3B /* Pods-metaCode.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-metaCode.release.xcconfig"; path = "Target Support Files/Pods-metaCode/Pods-metaCode.release.xcconfig"; sourceTree = "<group>"; }; |
| 115 | + 19F1C2322AB5728B0083D06C /* CNIDCardView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNIDCardView.swift; sourceTree = "<group>"; }; | |
| 114 | 116 | 54E09C540E13D78166D71395 /* Pods_metaCodeTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_metaCodeTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; |
| 115 | 117 | 63D879B49B1E42F1584DD75E /* Pods_metaCode_metaCodeUITests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_metaCode_metaCodeUITests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; |
| 116 | 118 | 67F8190701D1AB7F7724E8BA /* Pods-metaCodeTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-metaCodeTests.release.xcconfig"; path = "Target Support Files/Pods-metaCodeTests/Pods-metaCodeTests.release.xcconfig"; sourceTree = "<group>"; }; |
| ... | ... | @@ -535,6 +537,7 @@ |
| 535 | 537 | 7C4931302A2F142F000E44B4 /* CNHomePageBackgroupView.swift */, |
| 536 | 538 | 7C4931372A307BDB000E44B4 /* CNHomePageGuideView.swift */, |
| 537 | 539 | 7C27032F2A36CBE30061EC50 /* CNCertificationView.swift */, |
| 540 | + 19F1C2322AB5728B0083D06C /* CNIDCardView.swift */, | |
| 538 | 541 | ); |
| 539 | 542 | name = View; |
| 540 | 543 | path = HomePage/View; |
| ... | ... | @@ -851,6 +854,7 @@ |
| 851 | 854 | isa = PBXSourcesBuildPhase; |
| 852 | 855 | buildActionMask = 2147483647; |
| 853 | 856 | files = ( |
| 857 | + 19F1C2332AB5728B0083D06C /* CNIDCardView.swift in Sources */, | |
| 854 | 858 | 7CD675292A270F6A008354C1 /* WJColorChange.m in Sources */, |
| 855 | 859 | 79F4B11C2A33036E00993C03 /* CNLiveMineInfoAlertView.swift in Sources */, |
| 856 | 860 | 796398942A260C0100D045EB /* AppDelegate.swift in Sources */, | ... | ... |
metaCode/Classes/Common/Base/CNLiveBaseTabBarViewController.swift
| ... | ... | @@ -19,8 +19,8 @@ class CNTabBar:UITabBar{ |
| 19 | 19 | //我们需要在age属性发生变化后,更新一下nickName这个属性 |
| 20 | 20 | didSet |
| 21 | 21 | { |
| 22 | - print("frame = ", frame) | |
| 23 | - print("完成") | |
| 22 | +// print("frame = ", frame) | |
| 23 | +// print("完成") | |
| 24 | 24 | } |
| 25 | 25 | } |
| 26 | 26 | } |
| ... | ... | @@ -34,9 +34,6 @@ class CNLiveBaseTabBarViewController: UITabBarController |
| 34 | 34 | |
| 35 | 35 | self.setUpTabBar() |
| 36 | 36 | self.setupBackgroup() |
| 37 | - | |
| 38 | - selectedIndex = 1 | |
| 39 | - | |
| 40 | 37 | } |
| 41 | 38 | |
| 42 | 39 | override func viewWillAppear(_ animated: Bool) { | ... | ... |
metaCode/Classes/Main/HomePage/Controller/CNMetaCodeHomePageController.swift
| ... | ... | @@ -18,33 +18,91 @@ let CNKeyIsFirstAppearUpSlideHomeGuide: String = "isFirstAppearUpSlideHomeGuideK |
| 18 | 18 | ///存储是否第一次显示首页下滑引导 |
| 19 | 19 | let CNKeyIsFirstAppearDownSlideHomeGuide: String = "isFirstAppearDownSlideHomeGuideKey" |
| 20 | 20 | |
| 21 | -///用户身份认证状态 | |
| 22 | -enum UserIdentityStatus { | |
| 23 | - ///未认证 | |
| 24 | - case notCertified | |
| 25 | - ///已经认证 | |
| 26 | - case haveBeenCertified | |
| 21 | +/////用户身份认证状态 | |
| 22 | +//enum UserIdentityStatus { | |
| 23 | +// ///未认证 | |
| 24 | +// case notCertified | |
| 25 | +// ///已经认证 | |
| 26 | +// case haveBeenCertified | |
| 27 | +//} | |
| 28 | + | |
| 29 | +///数据状态 | |
| 30 | +enum NetAPIStatus { | |
| 31 | + ///接口成功 | |
| 32 | + case success | |
| 33 | + ///接口错误 | |
| 34 | + case apiError | |
| 35 | + ///无网络 | |
| 36 | + case notNetwork | |
| 27 | 37 | } |
| 28 | 38 | |
| 29 | 39 | class CNMetaCodeHomePageController:CNLiveBaseViewController, NewPagedFlowViewDelegate, NewPagedFlowViewDataSource, CNCustomIndexViewDelegate{ |
| 30 | 40 | |
| 31 | - ///添加认证View | |
| 32 | - lazy var addCertificationView: CNCertificationView = { | |
| 33 | - let addCertificationView = CNCertificationView(frame: self.view.bounds) | |
| 41 | + | |
| 42 | + ///NewPagedFlowView 开始滑动时的偏移量 | |
| 43 | + private var beginOffset = 0.0 | |
| 44 | + ///tabBar 的Y坐标位置 | |
| 45 | + private var tabBarY:CGFloat = 0.0 | |
| 46 | + | |
| 47 | + ///用户身份认证状态 | |
| 48 | +// private var identityStatus: UserIdentityStatus = .notCertified | |
| 49 | + ///接口状态 | |
| 50 | + private var NetApiStatus: NetAPIStatus = .apiError | |
| 51 | + | |
| 52 | + // MARK: - 懒加载 | |
| 53 | + ///数据源 | |
| 54 | + lazy var dataArray: NSMutableArray = { | |
| 34 | 55 | |
| 35 | - addCertificationView.addCertificationAction = { | |
| 36 | - [weak self] in | |
| 37 | - print("添加认证") | |
| 38 | - //模拟认证成功刷新主页面 | |
| 39 | - let time = DispatchTime.now() + 2.0 | |
| 40 | - DispatchQueue.main.asyncAfter(deadline: time, execute: DispatchWorkItem(block: { | |
| 41 | - self?.addCertificationView.isHidden = true | |
| 42 | - self?.addCertificationView.removeFromSuperview() | |
| 43 | - self?.addPageView() | |
| 44 | - })) | |
| 45 | - } | |
| 46 | - return addCertificationView | |
| 56 | + return NSMutableArray.init() | |
| 57 | + }() | |
| 58 | + | |
| 59 | + ///无网.接口失败View | |
| 60 | + lazy var notNetworkView: UIView = { | |
| 61 | + let W = Width-50 | |
| 62 | + let H = W*1.5 | |
| 63 | + let notNetworkView = UIView.init(frame: CGRect(x: 25, y: KSreenHeight*0.16, width: W, height: H )) | |
| 64 | + notNetworkView.backgroundColor = UIColor.white | |
| 65 | + notNetworkView.clipsToBounds = true | |
| 66 | + notNetworkView.layer.cornerRadius = 20 | |
| 67 | + | |
| 68 | + //接口错误Label | |
| 69 | + | |
| 70 | + return notNetworkView | |
| 71 | + }() | |
| 72 | + | |
| 73 | + //接口错误图片 | |
| 74 | + lazy var errorImgView: UIImageView = { | |
| 75 | + let errorImgView = UIImageView.init(image: UIImage(named: "mine_list_source_unusual_failed")) | |
| 76 | + errorImgView.contentMode = .scaleToFill | |
| 77 | + return errorImgView | |
| 47 | 78 | }() |
| 79 | + | |
| 80 | + //接口错误Label | |
| 81 | + lazy var errorLabel: UILabel = { | |
| 82 | + let errorLabel = UILabel.init() | |
| 83 | + errorLabel.textColor = HexColor("#666666") | |
| 84 | + errorLabel.textAlignment = .center | |
| 85 | + errorLabel.font = Font(15) | |
| 86 | + errorLabel.backgroundColor = .clear | |
| 87 | + errorLabel.text = "网络开小差了,刷新试试~" | |
| 88 | + return errorLabel | |
| 89 | + }() | |
| 90 | + | |
| 91 | + //接口错误刷新按钮 | |
| 92 | + lazy var errorFreshButton : UIButton = { | |
| 93 | + let errorFreshButton = UIButton(type: .custom) | |
| 94 | + errorFreshButton.backgroundColor = .clear | |
| 95 | + errorFreshButton.addTarget(self, action: #selector(errorFreshButtonAction), for: .touchUpInside) | |
| 96 | + errorFreshButton.layer.borderColor = HexColor("#609BFF")?.cgColor | |
| 97 | + errorFreshButton.layer.borderWidth = 0.5 | |
| 98 | + errorFreshButton.setTitle("刷新", for:.normal) | |
| 99 | + errorFreshButton.titleLabel?.font = Font(13) | |
| 100 | + errorFreshButton.setTitleColor(HexColor("#609BFF"), for: .normal) | |
| 101 | + errorFreshButton.clipsToBounds = true | |
| 102 | + errorFreshButton.layer.cornerRadius = 10.5 | |
| 103 | + return errorFreshButton | |
| 104 | + }() | |
| 105 | + | |
| 48 | 106 | ///上滑引导View |
| 49 | 107 | lazy var upSlideGuideView:CNHomePageGuideView = { |
| 50 | 108 | let upSlideGuideView = CNHomePageGuideView.init(frame: UIScreen.main.bounds) |
| ... | ... | @@ -91,22 +149,6 @@ class CNMetaCodeHomePageController:CNLiveBaseViewController, NewPagedFlowViewDel |
| 91 | 149 | return gif |
| 92 | 150 | }() |
| 93 | 151 | |
| 94 | - | |
| 95 | - ///NewPagedFlowView 开始滑动时的偏移量 | |
| 96 | - private var beginOffset = 0.0 | |
| 97 | - ///tabBar 的Y坐标位置 | |
| 98 | - private var tabBarY:CGFloat = 0.0 | |
| 99 | - | |
| 100 | - ///用户身份认证状态 | |
| 101 | - private var identityStatus: UserIdentityStatus = .notCertified | |
| 102 | - | |
| 103 | - // MARK: - 懒加载 | |
| 104 | - ///数据源 | |
| 105 | - lazy var dataArray: NSMutableArray = { | |
| 106 | - | |
| 107 | - return NSMutableArray.init() | |
| 108 | - }() | |
| 109 | - | |
| 110 | 152 | ///左右滑动分页view |
| 111 | 153 | lazy var pageFlowView: NewPagedFlowView = { |
| 112 | 154 | let pageFlowView = NewPagedFlowView.init(frame: CGRectMake(0, 0, Width, Height)) |
| ... | ... | @@ -150,43 +192,7 @@ class CNMetaCodeHomePageController:CNLiveBaseViewController, NewPagedFlowViewDel |
| 150 | 192 | super.viewWillAppear(animated) |
| 151 | 193 | |
| 152 | 194 | print("uid = ",UserInfoManager.shared.userInfo.uid) |
| 153 | - print("1111") | |
| 154 | - | |
| 155 | -// let db = CNIdentityDB() | |
| 156 | -// | |
| 157 | -// | |
| 158 | -// let model = CNIdentityModel() | |
| 159 | -// model.id = "q_123" | |
| 160 | -// model.name = "小米" | |
| 161 | -// db.insterObject(object: model) | |
| 162 | -// | |
| 163 | -// let model2 = CNIdentityModel() | |
| 164 | -// model2.id = "a_451" | |
| 165 | -// model2.name = "小明" | |
| 166 | -// db.insterObject(object: model2) | |
| 167 | -// | |
| 168 | -// let model4 = CNIdentityModel() | |
| 169 | -// model4.id = "3_234" | |
| 170 | -// model4.name = "小张" | |
| 171 | -// db.insterObject(object: model4) | |
| 172 | -// | |
| 173 | -// | |
| 174 | -// let time:DispatchTime = DispatchTime.now() + 2.0 | |
| 175 | -// DispatchQueue.main.asyncAfter(deadline: time, execute: DispatchWorkItem(block: { | |
| 176 | -// | |
| 177 | -// let modelNew = CNIdentityModel() | |
| 178 | -// modelNew.id = "a_451" | |
| 179 | -// modelNew.name = "小张" | |
| 180 | -// modelNew.icon = "http://apple.com" | |
| 181 | -// modelNew.createTime = "1234555223" | |
| 182 | -// modelNew.enable = true | |
| 183 | -// db.updateObject(newObject: modelNew) | |
| 184 | -// | |
| 185 | -// let allData = CNIdentityDB().searchAllObject() | |
| 186 | -// print(allData) | |
| 187 | -// | |
| 188 | -// })) | |
| 189 | - | |
| 195 | + self.getUserIdentityApi() | |
| 190 | 196 | |
| 191 | 197 | } |
| 192 | 198 | override func viewDidAppear(_ animated: Bool) { |
| ... | ... | @@ -201,15 +207,52 @@ class CNMetaCodeHomePageController:CNLiveBaseViewController, NewPagedFlowViewDel |
| 201 | 207 | func setupUI(){ |
| 202 | 208 | self.view.backgroundColor = KVCBackgroupColor |
| 203 | 209 | self.view.addSubview(self.backgroupView) |
| 210 | + self.view.addSubview(self.notNetworkView) | |
| 211 | + notNetworkView.isHidden = true | |
| 212 | + self.notNetworkView.addSubview(self.errorImgView) | |
| 213 | + self.notNetworkView.addSubview(self.errorLabel) | |
| 214 | + self.notNetworkView.addSubview(self.errorFreshButton) | |
| 215 | + | |
| 216 | + self.makeConstraints() | |
| 204 | 217 | |
| 205 | - switch self.identityStatus{ | |
| 206 | - | |
| 207 | - case .notCertified: | |
| 208 | - self.view.addSubview(self.addCertificationView) | |
| 209 | - case .haveBeenCertified: | |
| 210 | - self.addPageView() | |
| 218 | +// switch self.identityStatus{ | |
| 219 | +// | |
| 220 | +// case .notCertified: | |
| 221 | +// self.view.addSubview(self.addCertificationView) | |
| 222 | +// case .haveBeenCertified: | |
| 223 | +// self.addPageView() | |
| 224 | +// } | |
| 225 | + | |
| 226 | + } | |
| 227 | + | |
| 228 | + // MARK: -按钮点击事件 | |
| 229 | + //无网时刷新 | |
| 230 | + @objc func errorFreshButtonAction(){ | |
| 231 | + self.getUserIdentityApi() | |
| 232 | + } | |
| 233 | + | |
| 234 | + // MARK: -添加约束 | |
| 235 | + func makeConstraints(){ | |
| 236 | + self.errorImgView.snp.makeConstraints { make in | |
| 237 | + make.centerX.equalToSuperview() | |
| 238 | + make.centerY.equalToSuperview().offset(-60) | |
| 239 | + make.width.equalTo(190.5) | |
| 240 | + make.height.equalTo(100) | |
| 241 | + } | |
| 242 | + | |
| 243 | + self.errorLabel.snp.makeConstraints { make in | |
| 244 | + make.centerX.equalToSuperview() | |
| 245 | + make.top.equalTo(errorImgView.snp.bottom).offset(10.5) | |
| 246 | + make.width.equalToSuperview() | |
| 247 | + make.height.equalTo(21) | |
| 248 | + } | |
| 249 | + | |
| 250 | + self.errorFreshButton.snp.makeConstraints { make in | |
| 251 | + make.centerX.equalToSuperview() | |
| 252 | + make.top.equalTo(errorLabel.snp.bottom).offset(15) | |
| 253 | + make.width.equalTo(60) | |
| 254 | + make.height.equalTo(26) | |
| 211 | 255 | } |
| 212 | - | |
| 213 | 256 | |
| 214 | 257 | } |
| 215 | 258 | |
| ... | ... | @@ -261,8 +304,8 @@ class CNMetaCodeHomePageController:CNLiveBaseViewController, NewPagedFlowViewDel |
| 261 | 304 | bannerView?.superScrollView = flowView.scrollView |
| 262 | 305 | bannerView?.associatedVCView = self.view |
| 263 | 306 | bannerView?.delegate = self |
| 264 | - let identityModel = dataArray[index] as! CNLiveIdentityModel | |
| 265 | - | |
| 307 | + let identityModel = dataArray[index] as! StandListModel | |
| 308 | + bannerView?.idModel = identityModel | |
| 266 | 309 | return bannerView |
| 267 | 310 | } |
| 268 | 311 | |
| ... | ... | @@ -281,7 +324,6 @@ class CNMetaCodeHomePageController:CNLiveBaseViewController, NewPagedFlowViewDel |
| 281 | 324 | |
| 282 | 325 | if(currentOffset > beginOffset){ |
| 283 | 326 | |
| 284 | - | |
| 285 | 327 | if let rightView = self.backgroupView.getRightView(){ |
| 286 | 328 | |
| 287 | 329 | if let currentApearView = self.backgroupView.currentApearView{ |
| ... | ... | @@ -381,28 +423,63 @@ class CNMetaCodeHomePageController:CNLiveBaseViewController, NewPagedFlowViewDel |
| 381 | 423 | } |
| 382 | 424 | } |
| 383 | 425 | } |
| 384 | - //MARK: - 网络请求 | |
| 385 | - func getUserIdentityApi(){ | |
| 386 | - CNLiveHomePageViewModel.getUserIdentityApi { listArray, responseType, errorMsg in | |
| 387 | - switch responseType{ | |
| 388 | - case .success: | |
| 389 | - if(listArray.count>0){ | |
| 390 | - self.addCertificationView.isHidden = true | |
| 391 | - self.addCertificationView.removeFromSuperview() | |
| 392 | - self.dataArray.addObjects(from: listArray) | |
| 393 | - self.addPageView() | |
| 394 | - self.identityStatus = .haveBeenCertified | |
| 395 | - self.backgroupView.updateData(idArray: listArray ) | |
| 396 | - }else{ | |
| 397 | - self.identityStatus = .notCertified | |
| 398 | - } | |
| 399 | - | |
| 400 | - case .failed: | |
| 401 | - showMessage(message: errorMsg) | |
| 402 | - case .noNetwork: | |
| 403 | - showMessage(message: "网络未连接") | |
| 426 | + //MARK: - 网络请求获取身份列表 | |
| 427 | + func getUserIdentityApi() | |
| 428 | + { | |
| 429 | + CNLiveMineViewModel.requestAuthStandList(page: 1) | |
| 430 | + { result, respStatue in | |
| 431 | + | |
| 432 | + if respStatue == .success{ | |
| 433 | + self.NetApiStatus = .success | |
| 434 | + let listArray:NSArray = (result as! StandListBaseModel).list as NSArray | |
| 435 | + if (listArray.count > 0){ | |
| 436 | +// self.addCertificationView.isHidden = true | |
| 437 | +// self.addCertificationView.removeFromSuperview() | |
| 438 | + self.dataArray = NSMutableArray.init() | |
| 439 | + self.dataArray.addObjects(from: listArray as! [Any]) | |
| 440 | + self.addPageView() | |
| 441 | + | |
| 442 | +// self.identityStatus = .haveBeenCertified | |
| 443 | + self.backgroupView.updateData(idArray: listArray as! Array<StandListModel>) | |
| 444 | + }else{ | |
| 445 | + self.NetApiStatus = .apiError | |
| 446 | +// self.identityStatus = .notCertified | |
| 404 | 447 | } |
| 448 | + } | |
| 449 | + else if (respStatue == .failed){ | |
| 450 | + self.NetApiStatus = .apiError | |
| 451 | + }else if (respStatue == .noNetwork){ | |
| 452 | + self.NetApiStatus = .notNetwork | |
| 453 | + } | |
| 454 | + self.notNetworkSetting() | |
| 405 | 455 | } |
| 406 | 456 | } |
| 407 | 457 | |
| 458 | + //无网络,接口失败 配置 | |
| 459 | + func notNetworkSetting(){ | |
| 460 | + switch NetApiStatus{ | |
| 461 | + case .success://隐藏无网,错误页面,显示UI | |
| 462 | + self.pageFlowView.scrollView.isUserInteractionEnabled = true | |
| 463 | + self.pageFlowView.isHidden = false | |
| 464 | + self.notNetworkView.isHidden = true | |
| 465 | + notNetworkView.isHidden = true | |
| 466 | + case .apiError://显示错误页面,隐藏UI | |
| 467 | + self.pageFlowView.scrollView.isUserInteractionEnabled = false | |
| 468 | + self.pageFlowView.isHidden = true | |
| 469 | + self.notNetworkView.isHidden = false | |
| 470 | + notNetworkView.isHidden = false | |
| 471 | + errorImgView.image = UIImage(named: "mine_list_source_unusual_failed") | |
| 472 | + errorLabel.text = "接口请求错误,刷新试试~" | |
| 473 | + case .notNetwork://显示无网页面,隐藏UI | |
| 474 | + self.pageFlowView.scrollView.isUserInteractionEnabled = false | |
| 475 | + self.pageFlowView.isHidden = true | |
| 476 | + self.notNetworkView.isHidden = false | |
| 477 | + notNetworkView.isHidden = false | |
| 478 | + errorImgView.image = UIImage(named: "mine_list_source_unusual_noNet") | |
| 479 | + errorLabel.text = "网络开小差了,刷新试试~" | |
| 480 | + } | |
| 481 | + | |
| 482 | + | |
| 483 | + } | |
| 484 | + | |
| 408 | 485 | } | ... | ... |
metaCode/Classes/Main/HomePage/View/CNCertificationView.swift
| ... | ... | @@ -24,28 +24,28 @@ class CNCertificationView : UIView{ |
| 24 | 24 | |
| 25 | 25 | }() |
| 26 | 26 | |
| 27 | - ///添加身份认证按钮 | |
| 28 | - lazy var addCerBtn: UIButton = { | |
| 29 | - let addCerBtn = UIButton(type: .custom) | |
| 30 | - addCerBtn.frame = CGRect(x: 0, y: 0, width: 145, height: 141) | |
| 31 | - addCerBtn.centerX = self.contentView.width/2 | |
| 32 | - addCerBtn.centerY = self.contentView.height/2 | |
| 33 | - addCerBtn.setImage(UIImage(named: "homePage_addCertification_icon"), for: .normal) | |
| 34 | - addCerBtn.addTarget(self, action: #selector(addCerBtnAction), for: .touchUpInside) | |
| 35 | - return addCerBtn | |
| 36 | - }() | |
| 37 | - | |
| 38 | - ///添加身份按钮底部标题 | |
| 39 | - lazy var addCerBtnBottomTitle: UILabel = { | |
| 40 | - let addCerBtnBottomTitle = UILabel(frame: CGRect(x: 0, y: self.addCerBtn.bottom - 10, width: 100, height: 22)) | |
| 41 | - addCerBtnBottomTitle.centerX = self.addCerBtn.centerX | |
| 42 | - addCerBtnBottomTitle.textColor = UIColor("#0066FE") | |
| 43 | - addCerBtnBottomTitle.textAlignment = .center | |
| 44 | - addCerBtnBottomTitle.font = UIFont.systemFont(ofSize: 15, weight: .regular) | |
| 45 | - addCerBtnBottomTitle.text = "身份认证" | |
| 46 | - return addCerBtnBottomTitle | |
| 47 | - | |
| 48 | - }() | |
| 27 | +// ///添加身份认证按钮 | |
| 28 | +// lazy var addCerBtn: UIButton = { | |
| 29 | +// let addCerBtn = UIButton(type: .custom) | |
| 30 | +// addCerBtn.frame = CGRect(x: 0, y: 0, width: 145, height: 141) | |
| 31 | +// addCerBtn.centerX = self.contentView.width/2 | |
| 32 | +// addCerBtn.centerY = self.contentView.height/2 | |
| 33 | +// addCerBtn.setImage(UIImage(named: "homePage_addCertification_icon"), for: .normal) | |
| 34 | +// addCerBtn.addTarget(self, action: #selector(addCerBtnAction), for: .touchUpInside) | |
| 35 | +// return addCerBtn | |
| 36 | +// }() | |
| 37 | +// | |
| 38 | +// ///添加身份按钮底部标题 | |
| 39 | +// lazy var addCerBtnBottomTitle: UILabel = { | |
| 40 | +// let addCerBtnBottomTitle = UILabel(frame: CGRect(x: 0, y: self.addCerBtn.bottom - 10, width: 100, height: 22)) | |
| 41 | +// addCerBtnBottomTitle.centerX = self.addCerBtn.centerX | |
| 42 | +// addCerBtnBottomTitle.textColor = UIColor("#0066FE") | |
| 43 | +// addCerBtnBottomTitle.textAlignment = .center | |
| 44 | +// addCerBtnBottomTitle.font = UIFont.systemFont(ofSize: 15, weight: .regular) | |
| 45 | +// addCerBtnBottomTitle.text = "身份认证" | |
| 46 | +// return addCerBtnBottomTitle | |
| 47 | +// | |
| 48 | +// }() | |
| 49 | 49 | |
| 50 | 50 | override init(frame: CGRect) { |
| 51 | 51 | super.init(frame: frame) |
| ... | ... | @@ -60,15 +60,15 @@ class CNCertificationView : UIView{ |
| 60 | 60 | func initUI() |
| 61 | 61 | { |
| 62 | 62 | self.addSubview(self.contentView) |
| 63 | - self.contentView.addSubview(self.addCerBtn) | |
| 64 | - self.contentView.addSubview(self.addCerBtnBottomTitle) | |
| 65 | - } | |
| 63 | +// self.contentView.addSubview(self.addCerBtn) | |
| 64 | +// self.contentView.addSubview(self.addCerBtnBottomTitle) | |
| 65 | +// } | |
| 66 | 66 | |
| 67 | - @objc func addCerBtnAction(){ | |
| 68 | - | |
| 69 | - if(self.addCertificationAction != nil){ | |
| 70 | - self.addCertificationAction!() | |
| 71 | - } | |
| 72 | - | |
| 67 | +// @objc func addCerBtnAction(){ | |
| 68 | +// | |
| 69 | +// if(self.addCertificationAction != nil){ | |
| 70 | +// self.addCertificationAction!() | |
| 71 | +// } | |
| 72 | +// | |
| 73 | 73 | } |
| 74 | 74 | } | ... | ... |
metaCode/Classes/Main/HomePage/View/CNCustomIndexView.swift
| ... | ... | @@ -97,6 +97,35 @@ class CNCustomIndexView:PGIndexBannerSubiew, UIScrollViewDelegate, WJColorChange |
| 97 | 97 | ///父视图ScrollView |
| 98 | 98 | weak var superScrollView:UIScrollView? |
| 99 | 99 | |
| 100 | + //IDmodel | |
| 101 | + var _idModel : StandListModel? | |
| 102 | + var idModel : StandListModel? { | |
| 103 | + get{ | |
| 104 | + _idModel | |
| 105 | + } | |
| 106 | + set{ | |
| 107 | + self.mainView.idModel = newValue! | |
| 108 | + _idModel = newValue | |
| 109 | + self.upSlideView.url = _idModel?.upPath | |
| 110 | + self.downSlideView.url = _idModel?.downPath | |
| 111 | + } | |
| 112 | + | |
| 113 | + } | |
| 114 | + | |
| 115 | +// private(set) var userInfo: UserInfoModel { | |
| 116 | +// | |
| 117 | +// set { | |
| 118 | +// _userInfo = newValue | |
| 119 | +// } | |
| 120 | +// | |
| 121 | +// get { | |
| 122 | +// if _userInfo != nil && (_userInfo?.uid.count)! > 0 { | |
| 123 | +// return _userInfo! | |
| 124 | +// } | |
| 125 | +// return UserInfoManager.readUserInfo() | |
| 126 | +// } | |
| 127 | +// } | |
| 128 | + | |
| 100 | 129 | // MARK: - 懒加载 |
| 101 | 130 | |
| 102 | 131 | ///颜色数据 |
| ... | ... | @@ -139,6 +168,7 @@ class CNCustomIndexView:PGIndexBannerSubiew, UIScrollViewDelegate, WJColorChange |
| 139 | 168 | ///下滑显示的VIew |
| 140 | 169 | lazy var downSlideView: CNDownSlideView = { |
| 141 | 170 | let collectionView = CNDownSlideView.init(frame: CGRectMake(-25, 0, self.frame.size.width + 50, self.frame.size.height)) |
| 171 | + collectionView.backgroundColor = .clear | |
| 142 | 172 | collectionView.backAction = {[weak self] in |
| 143 | 173 | self?.baseScrollView.setContentOffset(CGPoint(x: 0, y: (self!.baseScrollView.height)), animated: true) |
| 144 | 174 | self?.superScrollView?.isScrollEnabled = true |
| ... | ... | @@ -222,6 +252,11 @@ class CNCustomIndexView:PGIndexBannerSubiew, UIScrollViewDelegate, WJColorChange |
| 222 | 252 | // self.addGestureRecognizer(singleTap) |
| 223 | 253 | // } |
| 224 | 254 | |
| 255 | + // MARK: - 设置前置视图容器 | |
| 256 | + func isHiddenMainFrontContentView(isHidden:Bool){ | |
| 257 | + self.mainView.isHiddenMainFrontContentView(isHidden: isHidden) | |
| 258 | + } | |
| 259 | + | |
| 225 | 260 | // MARK: - 设置颜色值跟随ScrollView滑动变化 |
| 226 | 261 | func addColorManager() |
| 227 | 262 | { | ... | ... |
metaCode/Classes/Main/HomePage/View/CNDownSlideView.swift
| ... | ... | @@ -7,6 +7,7 @@ |
| 7 | 7 | |
| 8 | 8 | import Foundation |
| 9 | 9 | import UIKit |
| 10 | +import WebKit | |
| 10 | 11 | |
| 11 | 12 | typealias backBlock = ()->Void; |
| 12 | 13 | |
| ... | ... | @@ -35,6 +36,32 @@ class CNDownSlideView:UIView{ |
| 35 | 36 | return contentView |
| 36 | 37 | }() |
| 37 | 38 | |
| 39 | + //h5网页 | |
| 40 | + // TODO: H:-10原为self.height-KTabBarHeight,但有白条,改成了-10 | |
| 41 | + lazy var webView: WKWebView = { | |
| 42 | + let webView = WKWebView.init(frame: CGRectMake(0, 0, self.width, self.height-KTabBarHeight-10)) | |
| 43 | + webView.scrollView.showsVerticalScrollIndicator = false | |
| 44 | + webView.scrollView.showsHorizontalScrollIndicator = false | |
| 45 | + webView.backgroundColor = .clear | |
| 46 | + webView.isOpaque = false | |
| 47 | + return webView | |
| 48 | + }() | |
| 49 | + | |
| 50 | + var _url:String? | |
| 51 | + var url:String? { | |
| 52 | + get{ | |
| 53 | + return _url | |
| 54 | + } | |
| 55 | + set{ | |
| 56 | + _url = newValue! | |
| 57 | +// _url = "https://www.baidu.com" | |
| 58 | + if (_url != ""){ | |
| 59 | + let webUrl: URL! = URL.init(string: _url!) | |
| 60 | + webView.load(URLRequest.init(url:webUrl)) | |
| 61 | + } | |
| 62 | + } | |
| 63 | + } | |
| 64 | + | |
| 38 | 65 | lazy var topView:UIView = { |
| 39 | 66 | |
| 40 | 67 | let tempTopView = UIView(frame: CGRect(x:0, y:20, width: self.width - 50, height: 70)) |
| ... | ... | @@ -83,8 +110,10 @@ class CNDownSlideView:UIView{ |
| 83 | 110 | ///初始化UI |
| 84 | 111 | func initUI(){ |
| 85 | 112 | self.addSubview(self.contentView) |
| 86 | - self.addSubview(self.topView) | |
| 113 | + self.contentView.addSubview(self.webView) | |
| 114 | +// self.addSubview(self.topView) | |
| 87 | 115 | self.addSubview(self.bottomView) |
| 116 | + | |
| 88 | 117 | } |
| 89 | 118 | |
| 90 | 119 | @objc func backBtnAction(){ | ... | ... |
metaCode/Classes/Main/HomePage/View/CNHomePageBackgroupView.swift
| ... | ... | @@ -17,6 +17,7 @@ class CNHomePageBackgroupSubView : UIView |
| 17 | 17 | var nextSubView: CNHomePageBackgroupSubView? |
| 18 | 18 | |
| 19 | 19 | var name: String = "" |
| 20 | + | |
| 20 | 21 | lazy var imageView: UIImageView = { |
| 21 | 22 | let imageView: UIImageView = UIImageView(image: UIImage(named: "homePage_backgroup_blue")) |
| 22 | 23 | imageView.frame = self.bounds |
| ... | ... | @@ -24,9 +25,9 @@ class CNHomePageBackgroupSubView : UIView |
| 24 | 25 | }() |
| 25 | 26 | |
| 26 | 27 | lazy var titleLabel: UILabel = { |
| 27 | - let titleLabel = UILabel.init(frame: CGRectMake(25, KNavigationHeight - 20, KSreenWidth - 100, 35)) | |
| 28 | + let titleLabel = UILabel.init(frame: CGRectMake(25, KNavigationHeight - 20, KSreenWidth - 50, 35)) | |
| 28 | 29 | titleLabel.textColor = .white |
| 29 | - titleLabel.font = UIFont.systemFont(ofSize: 24, weight: .semibold) | |
| 30 | + titleLabel.font = UIFont.systemFont(ofSize: 20, weight: .semibold) | |
| 30 | 31 | return titleLabel |
| 31 | 32 | }() |
| 32 | 33 | |
| ... | ... | @@ -93,49 +94,26 @@ class CNHomePageBackgroupView: UIView{ |
| 93 | 94 | //创建UI |
| 94 | 95 | func initUI(){ |
| 95 | 96 | |
| 96 | - | |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - func updateData(idArray:Array<CNLiveIdentityModel>){ | |
| 99 | + func updateData(idArray:Array<StandListModel>){ | |
| 100 | + let array = self.subviews | |
| 101 | + for i in (0..<array.count){ | |
| 102 | + let obj:UIView = array[i] | |
| 103 | + obj.removeFromSuperview() | |
| 104 | + } | |
| 105 | + self.dataArray = Array<CNHomePageBackgroupSubView>() | |
| 106 | + | |
| 100 | 107 | for i in (0..<idArray.count){ |
| 101 | 108 | |
| 102 | 109 | let subView: CNHomePageBackgroupSubView = CNHomePageBackgroupSubView.init(frame: self.bounds) |
| 103 | 110 | subView.frame = self.bounds |
| 104 | 111 | |
| 105 | - let idModel:CNLiveIdentityModel = idArray[i] | |
| 112 | + let idModel:StandListModel = idArray[i] | |
| 106 | 113 | let navTitle:String = idModel.name! |
| 107 | 114 | subView.setTitle(title: navTitle) |
| 108 | 115 | |
| 109 | - subView.imageView.kf.setImage(with: URL(string: idModel.backgroundImg!)) | |
| 110 | - //.setImageWith(URL(string: idModel.backgroundImg ?? "")!, placeholderImage: UIImage(named: "homePage_backgroup_red")) | |
| 111 | -// if (i == 0) { | |
| 112 | -// | |
| 113 | -// subView.name = navTitle | |
| 114 | -// } | |
| 115 | -// else if(i == 1){ | |
| 116 | -// subView.setTitle(title: "退伍军人") | |
| 117 | -// subView.setImage(image: UIImage(named: "homePage_backgroup_blue")) | |
| 118 | -// subView.name = "退伍军人" | |
| 119 | -// | |
| 120 | -// } | |
| 121 | -// else if(i == 2){ | |
| 122 | -// subView.setTitle(title: "慈善家") | |
| 123 | -// subView.setImage(image: UIImage(named: "homePage_backgroup_red")) | |
| 124 | -// subView.name = "慈善家" | |
| 125 | -// | |
| 126 | -// } | |
| 127 | -// else if(i == 3){ | |
| 128 | -// subView.setTitle(title: "退休干部") | |
| 129 | -// subView.setImage(image: UIImage(named: "homePage_backgroup_blue")) | |
| 130 | -// subView.name = "退休干部" | |
| 131 | -// | |
| 132 | -// } | |
| 133 | -// else if(i == 4){ | |
| 134 | -// subView.setTitle(title: "退休医生") | |
| 135 | -// subView.setImage(image: UIImage(named: "homePage_backgroup_red")) | |
| 136 | -// subView.name = "退伍军人" | |
| 137 | -// | |
| 138 | -// } | |
| 116 | + subView.imageView.kf.setImage(with: URL(string: idModel.backgroundImg),placeholder: UIImage(named: "homePage_backgroup_blue")) | |
| 139 | 117 | |
| 140 | 118 | //更新双向链表 |
| 141 | 119 | let lastSubView: CNHomePageBackgroupSubView? = self.dataArray.last |
| ... | ... | @@ -173,7 +151,7 @@ class CNHomePageBackgroupView: UIView{ |
| 173 | 151 | } |
| 174 | 152 | ///获取当前视图右边的子视图 |
| 175 | 153 | func getRightView()->CNHomePageBackgroupSubView?{ |
| 176 | - if(currentApearViewIndex == self.dataArray.count - 1){ | |
| 154 | + if(currentApearViewIndex >= self.dataArray.count - 1){ | |
| 177 | 155 | return nil |
| 178 | 156 | } |
| 179 | 157 | return dataArray[currentApearViewIndex + 1] |
| ... | ... | @@ -203,7 +181,6 @@ class CNHomePageBackgroupView: UIView{ |
| 203 | 181 | } |
| 204 | 182 | //更新当前显示的view所处的位置 |
| 205 | 183 | self.currentApearViewIndex = toIndex |
| 206 | - | |
| 207 | 184 | |
| 208 | 185 | //重置之前的currentApearView的Left 和 right |
| 209 | 186 | tempSubView?.maskLayer.left = 0; | ... | ... |
metaCode/Classes/Main/HomePage/View/CNIDCardView.swift
0 → 100644
| 1 | +// | |
| 2 | +// CNIDCardView.swift | |
| 3 | +// metaCode | |
| 4 | +// | |
| 5 | +// Created by zx on 2023/9/16. | |
| 6 | +// | |
| 7 | + | |
| 8 | +import Foundation | |
| 9 | + | |
| 10 | +class CNIDCardView: UIView{ | |
| 11 | + | |
| 12 | + //IDmodel | |
| 13 | + var _idModel : StandListModel? | |
| 14 | + var idModel : StandListModel? { | |
| 15 | + get{ | |
| 16 | + _idModel | |
| 17 | + } | |
| 18 | + set{ | |
| 19 | + _idModel = newValue | |
| 20 | + iDCardBGView.kf.setImage(with: URL(string: _idModel!.cardImg), placeholder: UIImage(named: "homePage_idCardBG")) | |
| 21 | + nameLabel.textColor = HexColor("\(_idModel!.backgroundColor)") | |
| 22 | + sexLabel.textColor = HexColor("\(_idModel!.backgroundColor)") | |
| 23 | + dateLabel.textColor = HexColor("\(_idModel!.backgroundColor)") | |
| 24 | + IDLabel.textColor = HexColor("\(_idModel!.backgroundColor)") | |
| 25 | + nameValueLabel.textColor = HexColor("\(_idModel!.backgroundColor)") | |
| 26 | + sexValueLabel.textColor = HexColor("\(_idModel!.backgroundColor)") | |
| 27 | + dateValueLabel.textColor = HexColor("\(_idModel!.backgroundColor)") | |
| 28 | + IDValueLabel.textColor = HexColor("\(_idModel!.backgroundColor)") | |
| 29 | + | |
| 30 | + self.loadIDDetailData() | |
| 31 | + } | |
| 32 | + } | |
| 33 | + | |
| 34 | + override init(frame: CGRect) { | |
| 35 | + super.init(frame: frame) | |
| 36 | + self.initUI() | |
| 37 | + self.makeConstraints() | |
| 38 | + } | |
| 39 | + | |
| 40 | + required init?(coder: NSCoder) { | |
| 41 | + fatalError("init(coder:) has not been implemented") | |
| 42 | + } | |
| 43 | + | |
| 44 | + func initUI() | |
| 45 | + { | |
| 46 | + self.addSubview(self.contentView) | |
| 47 | + self.contentView.addSubview(self.iDCardBGView) | |
| 48 | + self.contentView.addSubview(self.nameLabel) | |
| 49 | + self.contentView.addSubview(self.sexLabel) | |
| 50 | + self.contentView.addSubview(self.dateLabel) | |
| 51 | + self.contentView.addSubview(self.IDLabel) | |
| 52 | + self.contentView.addSubview(self.nameValueLabel) | |
| 53 | + self.contentView.addSubview(self.sexValueLabel) | |
| 54 | + self.contentView.addSubview(self.dateValueLabel) | |
| 55 | + self.contentView.addSubview(self.IDValueLabel) | |
| 56 | + } | |
| 57 | + | |
| 58 | + func loadIDDetailData(){ | |
| 59 | + CNLiveMineViewModel.requestsStandInfo(identityId: "\(_idModel!.id)", type: .havedate) { result, respStatue in | |
| 60 | + if respStatue == .success { | |
| 61 | + let cardArray = result as! NSMutableArray | |
| 62 | + for i in (0..<cardArray.count){ | |
| 63 | + let idCardModel = cardArray[i] as! MineStandInfoModel | |
| 64 | + switch idCardModel.name { | |
| 65 | + case "姓名": | |
| 66 | + self.nameValueLabel.text = idCardModel.userInfo | |
| 67 | + case "性别": | |
| 68 | + self.sexValueLabel.text = idCardModel.userInfo | |
| 69 | + case "认证时间": | |
| 70 | + self.dateValueLabel.text = idCardModel.userInfo | |
| 71 | + case "编号": | |
| 72 | + self.IDValueLabel.text = idCardModel.userInfo | |
| 73 | + | |
| 74 | + default: | |
| 75 | + break | |
| 76 | + } | |
| 77 | + } | |
| 78 | + } | |
| 79 | + } | |
| 80 | + } | |
| 81 | + | |
| 82 | + // MARK: - 懒加载 | |
| 83 | + ///视图总容器 | |
| 84 | + lazy var contentView : UIView = { | |
| 85 | + | |
| 86 | + let contentView = UIView.init(frame: CGRect(x: 0, y: 0, width: self.width, height: self.height )) | |
| 87 | + contentView.backgroundColor = UIColor.white | |
| 88 | + return contentView | |
| 89 | + }() | |
| 90 | + | |
| 91 | + /// 身份卡片-背景图 | |
| 92 | + lazy var iDCardBGView:UIImageView = { | |
| 93 | + | |
| 94 | + let iDCardBGView:UIImageView = UIImageView(frame: CGRect(x: 20, y: 25, width: self.width-40, height: (self.width-40) * 0.64)) | |
| 95 | + iDCardBGView.backgroundColor = UIColor.clear | |
| 96 | + return iDCardBGView | |
| 97 | + }() | |
| 98 | + | |
| 99 | + //姓名Label | |
| 100 | + lazy var nameLabel: UILabel = { | |
| 101 | + let nameLabel = UILabel.init() | |
| 102 | + nameLabel.textColor = .blue | |
| 103 | + nameLabel.textAlignment = .left | |
| 104 | + nameLabel.font = Font(13) | |
| 105 | + nameLabel.backgroundColor = .clear | |
| 106 | + nameLabel.text = "姓 名" | |
| 107 | + return nameLabel | |
| 108 | + }() | |
| 109 | + | |
| 110 | + //性别Label | |
| 111 | + lazy var sexLabel: UILabel = { | |
| 112 | + let sexLabel = UILabel.init() | |
| 113 | + sexLabel.textColor = .blue//HexColor("#666666") | |
| 114 | + sexLabel.textAlignment = .left | |
| 115 | + sexLabel.font = Font(13) | |
| 116 | + sexLabel.backgroundColor = .clear | |
| 117 | + sexLabel.text = "性 别" | |
| 118 | + return sexLabel | |
| 119 | + }() | |
| 120 | + | |
| 121 | + //注册日期Label | |
| 122 | + lazy var dateLabel: UILabel = { | |
| 123 | + let dateLabel = UILabel.init() | |
| 124 | + dateLabel.textColor = .blue//HexColor("#666666") | |
| 125 | + dateLabel.textAlignment = .left | |
| 126 | + dateLabel.font = Font(13) | |
| 127 | + dateLabel.backgroundColor = .clear | |
| 128 | + dateLabel.text = "注册日期" | |
| 129 | + return dateLabel | |
| 130 | + }() | |
| 131 | + | |
| 132 | + //编号Label | |
| 133 | + lazy var IDLabel: UILabel = { | |
| 134 | + let IDLabel = UILabel.init() | |
| 135 | + IDLabel.textColor = .blue//HexColor("#666666") | |
| 136 | + IDLabel.textAlignment = .left | |
| 137 | + IDLabel.font = Font(13) | |
| 138 | + IDLabel.backgroundColor = .clear | |
| 139 | + IDLabel.text = "编 号" | |
| 140 | + return IDLabel | |
| 141 | + }() | |
| 142 | + | |
| 143 | + //姓名ValueLabel | |
| 144 | + lazy var nameValueLabel: UILabel = { | |
| 145 | + let nameValueLabel = UILabel.init() | |
| 146 | + nameValueLabel.textColor = .blue | |
| 147 | + nameValueLabel.textAlignment = .left | |
| 148 | + nameValueLabel.font = Font(13) | |
| 149 | + nameValueLabel.backgroundColor = .clear | |
| 150 | + nameValueLabel.text = "姓名" | |
| 151 | + return nameValueLabel | |
| 152 | + }() | |
| 153 | + | |
| 154 | + //性别ValueLabel | |
| 155 | + lazy var sexValueLabel: UILabel = { | |
| 156 | + let sexValueLabel = UILabel.init() | |
| 157 | + sexValueLabel.textColor = .blue//HexColor("#666666") | |
| 158 | + sexValueLabel.textAlignment = .left | |
| 159 | + sexValueLabel.font = Font(13) | |
| 160 | + sexValueLabel.backgroundColor = .clear | |
| 161 | + sexValueLabel.text = "男" | |
| 162 | + return sexValueLabel | |
| 163 | + }() | |
| 164 | + | |
| 165 | + //注册日期ValueLabel | |
| 166 | + lazy var dateValueLabel: UILabel = { | |
| 167 | + let dateValueLabel = UILabel.init() | |
| 168 | + dateValueLabel.textColor = .blue//HexColor("#666666") | |
| 169 | + dateValueLabel.textAlignment = .left | |
| 170 | + dateValueLabel.font = Font(13) | |
| 171 | + dateValueLabel.backgroundColor = .clear | |
| 172 | + dateValueLabel.text = "2022年1月1日" | |
| 173 | + return dateValueLabel | |
| 174 | + }() | |
| 175 | + | |
| 176 | + //编号ValueLabel | |
| 177 | + lazy var IDValueLabel: UILabel = { | |
| 178 | + let IDValueLabel = UILabel.init() | |
| 179 | + IDValueLabel.textColor = .blue//HexColor("#666666") | |
| 180 | + IDValueLabel.textAlignment = .left | |
| 181 | + IDValueLabel.font = Font(13) | |
| 182 | + IDValueLabel.backgroundColor = .clear | |
| 183 | + IDValueLabel.text = "123" | |
| 184 | + return IDValueLabel | |
| 185 | + }() | |
| 186 | + | |
| 187 | + // MARK: - 约束 | |
| 188 | + func makeConstraints(){ | |
| 189 | + self.iDCardBGView.snp.makeConstraints { make in | |
| 190 | + make.centerX.equalToSuperview() | |
| 191 | + make.centerY.equalToSuperview() | |
| 192 | + make.width.equalToSuperview() | |
| 193 | + make.height.equalToSuperview() | |
| 194 | + } | |
| 195 | + //标签 | |
| 196 | + self.nameLabel.snp.makeConstraints { make in | |
| 197 | + make.left.equalToSuperview().offset(20) | |
| 198 | + make.top.equalTo(60) | |
| 199 | + } | |
| 200 | + self.sexLabel.snp.makeConstraints { make in | |
| 201 | + make.left.equalToSuperview().offset(20) | |
| 202 | + make.top.equalTo(nameLabel.snp.bottom).offset(10) | |
| 203 | + } | |
| 204 | + self.dateLabel.snp.makeConstraints { make in | |
| 205 | + make.left.equalToSuperview().offset(20) | |
| 206 | + make.top.equalTo(sexLabel.snp.bottom).offset(10) | |
| 207 | + } | |
| 208 | + self.IDLabel.snp.makeConstraints { make in | |
| 209 | + make.left.equalToSuperview().offset(20) | |
| 210 | + make.top.equalTo(dateLabel.snp.bottom).offset(10) | |
| 211 | + } | |
| 212 | + //标签值 | |
| 213 | + self.nameValueLabel.snp.makeConstraints { make in | |
| 214 | + make.left.equalTo(nameLabel.snp.right).offset(10) | |
| 215 | + make.top.equalTo(nameLabel.snp.top) | |
| 216 | + } | |
| 217 | + self.sexValueLabel.snp.makeConstraints { make in | |
| 218 | + make.left.equalTo(nameLabel.snp.right).offset(10) | |
| 219 | + make.top.equalTo(sexLabel.snp.top) | |
| 220 | + } | |
| 221 | + self.dateValueLabel.snp.makeConstraints { make in | |
| 222 | + make.left.equalTo(nameLabel.snp.right).offset(10) | |
| 223 | + make.top.equalTo(dateLabel.snp.top) | |
| 224 | + } | |
| 225 | + self.IDValueLabel.snp.makeConstraints { make in | |
| 226 | + make.left.equalTo(nameLabel.snp.right).offset(10) | |
| 227 | + make.top.equalTo(IDLabel.snp.top) | |
| 228 | + } | |
| 229 | + } | |
| 230 | + | |
| 231 | +} | ... | ... |
metaCode/Classes/Main/HomePage/View/CNMainView.swift
| ... | ... | @@ -6,12 +6,10 @@ |
| 6 | 6 | // |
| 7 | 7 | |
| 8 | 8 | import Foundation |
| 9 | - | |
| 9 | +import UIKit | |
| 10 | 10 | ///旋转动画时间 |
| 11 | 11 | let KTransformAnimationTime:CGFloat = 0.75; |
| 12 | 12 | |
| 13 | - | |
| 14 | - | |
| 15 | 13 | ///正面View |
| 16 | 14 | class CNFrontMainView : UIView{ |
| 17 | 15 | ///点击反转事件 |
| ... | ... | @@ -20,66 +18,142 @@ class CNFrontMainView : UIView{ |
| 20 | 18 | override init(frame: CGRect) { |
| 21 | 19 | super.init(frame: frame) |
| 22 | 20 | self.initUI() |
| 23 | - let tap:UITapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(tapAction)) | |
| 24 | - self.addGestureRecognizer(tap) | |
| 21 | +// let tap:UITapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(tapAction)) | |
| 22 | +// self.addGestureRecognizer(tap) | |
| 25 | 23 | } |
| 26 | 24 | |
| 27 | 25 | required init?(coder: NSCoder) { |
| 28 | 26 | fatalError("init(coder:) has not been implemented") |
| 29 | 27 | } |
| 30 | - lazy var nameLabel: UILabel = { | |
| 31 | - let nameLabel = UILabel.init() | |
| 32 | - nameLabel.textColor = .white | |
| 33 | - nameLabel.font = Font_16 | |
| 34 | - nameLabel.text = "啊啊" | |
| 35 | - nameLabel.textColor = .red | |
| 36 | - return nameLabel | |
| 28 | + | |
| 29 | + ///视图总容器 | |
| 30 | + lazy var frontContentView : UIView = { | |
| 31 | + | |
| 32 | + let frontContentView = UIView.init(frame: CGRect(x: 0, y: 0, width: self.width, height: self.height )) | |
| 33 | + frontContentView.backgroundColor = UIColor.white | |
| 34 | + frontContentView.clipsToBounds = true | |
| 35 | + frontContentView.layer.cornerRadius = 20 | |
| 36 | + frontContentView.addSubview(self.contentView) | |
| 37 | + return frontContentView | |
| 37 | 38 | }() |
| 38 | 39 | |
| 39 | - lazy var imageView:UIImageView = { | |
| 40 | + /// 已认证-身份卡片 | |
| 41 | + lazy var iDCardView:CNIDCardView = { | |
| 40 | 42 | |
| 41 | - let tempImageView:UIImageView = UIImageView(frame: CGRect(x: 0, y: 0, width: self.width, height: self.width * 0.7)) | |
| 42 | - tempImageView.image = UIImage(named: "homePage_zhongguorenming_bank") | |
| 43 | - | |
| 44 | - let path : UIBezierPath = UIBezierPath.init(roundedRect: tempImageView.bounds, byRoundingCorners: [.topLeft, .topRight], cornerRadii: CGSize(width: 20, height: 20)) | |
| 45 | - | |
| 46 | - let maskLayer = CAShapeLayer() | |
| 47 | - maskLayer.frame = tempImageView.bounds | |
| 48 | - maskLayer.path = path.cgPath | |
| 49 | - tempImageView.layer.mask = maskLayer | |
| 43 | + let iDCardView:CNIDCardView = CNIDCardView(frame: CGRect(x: 20, y: 25, width: self.width-40, height: (self.width-40) * 0.64)) | |
| 44 | + return iDCardView | |
| 45 | + }() | |
| 46 | + | |
| 47 | + //未认证下 textview | |
| 48 | + lazy var textView: UITextView = { | |
| 49 | + let textView = UITextView.init() | |
| 50 | 50 | |
| 51 | - return tempImageView | |
| 51 | + textView.textColor = HexColor("#333333") | |
| 52 | + textView.font = UIFont.init(name: "PingFangSC-Medium", size: 13) | |
| 53 | + textView.textAlignment = .left | |
| 54 | + textView.contentMode = .scaleAspectFill | |
| 55 | + textView.sizeToFit() | |
| 56 | + textView.backgroundColor = HexColor("#004FE0", alpha: 0.1) | |
| 57 | + textView.clipsToBounds = true | |
| 58 | + textView.layer.cornerRadius = 14 | |
| 59 | + textView.isUserInteractionEnabled = false | |
| 60 | + return textView | |
| 61 | + }() | |
| 62 | + | |
| 63 | + ///点击添加身份 按钮 | |
| 64 | + lazy var addStandBtn: UIButton = { | |
| 65 | + let addStandBtn = UIButton(type: .custom) | |
| 66 | + addStandBtn.clipsToBounds = true | |
| 67 | + addStandBtn.layer.cornerRadius = 19.5 | |
| 68 | + addStandBtn.backgroundColor = HexColor("#004FE0") | |
| 69 | + addStandBtn.setTitle("点击添加身份", for: .normal) | |
| 70 | + addStandBtn.setTitleColor(.white, for: .normal) | |
| 71 | + addStandBtn.titleLabel?.font = UIFont.init(name: "PingFangSC-Medium", size: 14) | |
| 72 | + addStandBtn.addTarget(self, action: #selector(addStandBtnAction), for: .touchUpInside) | |
| 73 | + return addStandBtn | |
| 52 | 74 | }() |
| 53 | 75 | |
| 76 | + ///前置视图容器 | |
| 54 | 77 | lazy var contentView : UIView = { |
| 55 | 78 | |
| 56 | 79 | let contentView = UIView.init(frame: CGRect(x: 0, y: 0, width: self.width, height: self.height )) |
| 57 | 80 | contentView.backgroundColor = UIColor.white |
| 58 | 81 | contentView.clipsToBounds = true |
| 59 | 82 | contentView.layer.cornerRadius = 20 |
| 60 | - | |
| 61 | - let W = contentView.width - 40 | |
| 62 | - let imageView = UIImageView.init(frame: CGRect(x: 20, y: 25, width: W, height: W*0.63)) | |
| 63 | - imageView.image = UIImage.init(named: "homePage_mainView_front"); | |
| 64 | - contentView.addSubview(imageView) | |
| 65 | - | |
| 66 | - nameLabel.frame = CGRect(x: 0, y: 0, width: 100, height: 30) | |
| 67 | - nameLabel.text = "啊啊" | |
| 68 | - contentView.addSubview(nameLabel) | |
| 83 | + contentView.addSubview(self.addStandBtn) | |
| 84 | + addStandBtn.snp.makeConstraints { make in | |
| 85 | + make.centerX.equalToSuperview() | |
| 86 | + make.bottom.equalToSuperview().offset(-30) | |
| 87 | + make.width.equalTo(150) | |
| 88 | + make.height.equalTo(39) | |
| 89 | + } | |
| 90 | + | |
| 91 | + contentView.addSubview(self.textView) | |
| 92 | + textView.snp.makeConstraints { make in | |
| 93 | + make.top.equalToSuperview().offset(40) | |
| 94 | + make.left.equalToSuperview().offset(30) | |
| 95 | + make.right.equalToSuperview().offset(-30) | |
| 96 | + make.bottom.equalTo(addStandBtn.snp.top).offset(-30) | |
| 97 | + } | |
| 69 | 98 | |
| 70 | 99 | return contentView |
| 71 | 100 | |
| 72 | 101 | }() |
| 73 | 102 | |
| 103 | + //IDmodel | |
| 104 | + var _idModel : StandListModel? | |
| 105 | + var idModel : StandListModel? { | |
| 106 | + get{ | |
| 107 | + _idModel | |
| 108 | + } | |
| 109 | + set{ | |
| 110 | + _idModel = newValue | |
| 111 | + let auth = newValue!.auth | |
| 112 | + if(auth == true){ | |
| 113 | + //已认证身份 | |
| 114 | + //显示证件View | |
| 115 | + print("已认证身份") | |
| 116 | + iDCardView.isHidden = false | |
| 117 | + iDCardView.idModel = newValue! | |
| 118 | + contentView.isHidden = true | |
| 119 | + | |
| 120 | + }else | |
| 121 | + {//未认证身份 | |
| 122 | + iDCardView.isHidden = true | |
| 123 | + //显示textview 添加身份 | |
| 124 | + contentView.isHidden = false | |
| 125 | + textView.text = newValue!.description | |
| 126 | + addStandBtn.backgroundColor = HexColor(newValue!.backgroundColor) | |
| 127 | + textView.backgroundColor = HexColor(newValue!.backgroundColor, alpha: 0.1) | |
| 128 | + } | |
| 129 | + } | |
| 130 | + } | |
| 131 | + | |
| 74 | 132 | func initUI() |
| 75 | 133 | { |
| 76 | -// self.addSubview(self.imageView) | |
| 77 | - self.addSubview(self.contentView) | |
| 134 | + self.addSubview(self.frontContentView) | |
| 135 | + self.frontContentView.addSubview(self.contentView) | |
| 136 | + self.frontContentView.addSubview(self.iDCardView) | |
| 137 | + | |
| 138 | + self.makeConstraints() | |
| 139 | + } | |
| 140 | + func makeConstraints(){ | |
| 141 | + self.iDCardView.snp.makeConstraints { make in | |
| 142 | + make.centerX.equalToSuperview() | |
| 143 | + make.top.equalToSuperview().offset(25) | |
| 144 | + make.width.equalTo(self.width-40) | |
| 145 | + make.height.equalTo((self.width-40) * 0.64) | |
| 146 | + } | |
| 78 | 147 | } |
| 79 | 148 | |
| 149 | + // MARK: -按钮点击事件 | |
| 80 | 150 | @objc func tapAction(){ |
| 81 | 151 | tapTransformAciton!() |
| 82 | 152 | } |
| 153 | + @objc func addStandBtnAction() { | |
| 154 | + //跳转到添加身份页面 | |
| 155 | + currentViewController()?.navigationController?.pushViewController(CNLiveMineInputViewController.init(listModel: _idModel!), animated: true) | |
| 156 | + } | |
| 83 | 157 | } |
| 84 | 158 | |
| 85 | 159 | ///反面View |
| ... | ... | @@ -122,6 +196,8 @@ class CNBackMainView : UIView{ |
| 122 | 196 | bottomBackBtn.addTarget(self, action: #selector(tapAction), for: .touchUpInside) |
| 123 | 197 | return bottomBackBtn |
| 124 | 198 | }() |
| 199 | + | |
| 200 | + | |
| 125 | 201 | //MARK: - 初始化 |
| 126 | 202 | override init(frame: CGRect) { |
| 127 | 203 | super.init(frame: frame) |
| ... | ... | @@ -160,6 +236,19 @@ class CNMainView : UIView{ |
| 160 | 236 | fatalError("init(coder:) has not been implemented") |
| 161 | 237 | } |
| 162 | 238 | |
| 239 | + //IDmodel | |
| 240 | + var _idModel : StandListModel? | |
| 241 | + var idModel : StandListModel? { | |
| 242 | + get{ | |
| 243 | + _idModel | |
| 244 | + } | |
| 245 | + set{ | |
| 246 | + self.frontView.idModel = newValue! | |
| 247 | + _idModel = newValue | |
| 248 | + } | |
| 249 | + | |
| 250 | + } | |
| 251 | + | |
| 163 | 252 | ///正面View |
| 164 | 253 | lazy var frontView:CNFrontMainView = { |
| 165 | 254 | |
| ... | ... | @@ -180,13 +269,11 @@ class CNMainView : UIView{ |
| 180 | 269 | }() |
| 181 | 270 | |
| 182 | 271 | |
| 183 | - | |
| 184 | - | |
| 185 | 272 | func initUI() |
| 186 | 273 | { |
| 187 | 274 | self.addSubview(self.frontView) |
| 188 | 275 | self.addSubview(self.backView) |
| 189 | - | |
| 276 | + | |
| 190 | 277 | |
| 191 | 278 | self.backView.isHidden = true; |
| 192 | 279 | |
| ... | ... | @@ -198,7 +285,13 @@ class CNMainView : UIView{ |
| 198 | 285 | |
| 199 | 286 | } |
| 200 | 287 | |
| 288 | + // MARK: - <##><##>设置前置视图容器 | |
| 289 | + func isHiddenMainFrontContentView(isHidden:Bool){ | |
| 290 | + self.frontView.contentView.isHidden = isHidden | |
| 291 | + } | |
| 292 | + | |
| 201 | 293 | // MARK: - 事件 |
| 294 | + | |
| 202 | 295 | ///旋转到反面 |
| 203 | 296 | func transformToBacnkView() |
| 204 | 297 | { |
| ... | ... | @@ -251,7 +344,7 @@ class CNMainView : UIView{ |
| 251 | 344 | ///缩放 |
| 252 | 345 | open func scaledView(scale:CGFloat) |
| 253 | 346 | { |
| 254 | - self.frontView.imageView.transform = CGAffineTransformMakeScale(scale, scale); | |
| 347 | +// self.frontView.imageView.transform = CGAffineTransformMakeScale(scale, scale); | |
| 255 | 348 | } |
| 256 | 349 | } |
| 257 | 350 | ... | ... |
metaCode/Classes/Main/HomePage/View/CNUpSlideView.swift
| ... | ... | @@ -10,6 +10,29 @@ import WebKit |
| 10 | 10 | |
| 11 | 11 | ///上滑显示的VIew |
| 12 | 12 | class CNUpSlideView:UIView{ |
| 13 | + | |
| 14 | + lazy var webView: WKWebView = { | |
| 15 | + let webView = WKWebView.init(frame: CGRectMake(10, 20, self.width - 20, self.height - 20)) | |
| 16 | + webView.scrollView.showsVerticalScrollIndicator = false | |
| 17 | + webView.scrollView.showsHorizontalScrollIndicator = false | |
| 18 | + webView.backgroundColor = .clear | |
| 19 | + return webView | |
| 20 | + }() | |
| 21 | + | |
| 22 | + var _url:String? | |
| 23 | + var url:String? { | |
| 24 | + get{ | |
| 25 | + return _url | |
| 26 | + } | |
| 27 | + set{ | |
| 28 | + _url = newValue! | |
| 29 | + if (_url != ""){ | |
| 30 | + let webUrl: URL! = URL.init(string: _url!) | |
| 31 | + webView.load(URLRequest.init(url:webUrl)) | |
| 32 | + } | |
| 33 | + } | |
| 34 | + } | |
| 35 | + | |
| 13 | 36 | override init(frame: CGRect) { |
| 14 | 37 | super.init(frame: frame) |
| 15 | 38 | self.initUI() |
| ... | ... | @@ -25,14 +48,7 @@ class CNUpSlideView:UIView{ |
| 25 | 48 | self.backgroundColor = UIColor.white; |
| 26 | 49 | self.clipsToBounds = true; |
| 27 | 50 | self.layer.cornerRadius = 20; |
| 28 | - | |
| 29 | - let webView:WKWebView = WKWebView.init(frame: CGRectMake(10, 20, self.width - 20, self.height - 20)) | |
| 30 | - let url: URL! = URL.init(string: "https://www.baidu.com") | |
| 31 | - webView.load(URLRequest.init(url:url)) | |
| 32 | - webView.scrollView.showsVerticalScrollIndicator = false | |
| 33 | - webView.scrollView.showsHorizontalScrollIndicator = false | |
| 34 | - | |
| 35 | - self.addSubview(webView) | |
| 51 | + self.addSubview(self.webView) | |
| 36 | 52 | |
| 37 | 53 | |
| 38 | 54 | // let imageview : UIImageView = UIImageView.init(frame: CGRect(x: 20, y: 10, width: self.width - 40, height: self.height - 20)) | ... | ... |
metaCode/Classes/Main/MinePage/ViewModel/CNLiveMineBaseModel.swift
| ... | ... | @@ -136,21 +136,22 @@ class StandListBaseModel: BaseModel { |
| 136 | 136 | |
| 137 | 137 | final class StandListModel: BaseModel, TableCodable { |
| 138 | 138 | |
| 139 | - var icon: String? | |
| 140 | - var name: String? | |
| 141 | - var enable: Bool = false | |
| 142 | - var id: Int = 0 | |
| 143 | - var createTime: Int = 0 | |
| 139 | + var icon: String?//小圆图标 | |
| 140 | + var name: String?//名称 | |
| 141 | + var enable: Bool = false//没用 | |
| 142 | + var id: Int = 0//ID号 | |
| 143 | + var createTime: Int = 0//注册时间 | |
| 144 | 144 | var createTimeString: String = "" |
| 145 | 145 | var timeString: String = "" |
| 146 | - var auth: Bool = false | |
| 147 | - var backgroundImg: String = "" | |
| 148 | - var backgroundColor: String = "" | |
| 146 | + var auth: Bool = false//身份是否验证 | |
| 147 | + var backgroundImg: String = ""//首页背景图 | |
| 148 | + var backgroundColor: String = ""//添加身份按钮背景色 | |
| 149 | 149 | var backgroundColour: String = "" |
| 150 | - var description: String = "" | |
| 151 | - var cardImg: String = "" | |
| 152 | - var downPath: String = "" | |
| 153 | - | |
| 150 | + var description: String = ""//首页身份说明描述 | |
| 151 | + var cardImg: String = ""//卡片背景图 | |
| 152 | + var downPath: String = ""//下滑h5 | |
| 153 | + var upPath: String = ""//上滑h5 | |
| 154 | + | |
| 154 | 155 | override func mapping(mapper: HelpingMapper) { |
| 155 | 156 | mapper <<< |
| 156 | 157 | self.createTime <-- TransformOf(fromJSON: { [weak self] (raw) -> Int in |
| ... | ... | @@ -210,14 +211,17 @@ class MineStandInfoBaseModel: BaseModel { |
| 210 | 211 | |
| 211 | 212 | class MineStandInfoModel: BaseModel { |
| 212 | 213 | var authInfoId: Int = 0 |
| 213 | - var name: String? | |
| 214 | - var inputType: Int = 0//1文本输入 2数字输入 3下拉选择 4后台生成时间 5后台生成编码 6头像类型 | |
| 215 | 214 | var sort: Int = 0 |
| 215 | + var name: String?//卡片标签 | |
| 216 | + var inputType: Int = 0//1文本输入 2数字输入 3下拉选择 4后台生成时间 5后台生成编码 6头像类型 | |
| 216 | 217 | var nonEmpty: Bool = false |
| 218 | + var length: Int = 10 | |
| 219 | + var children = [MineStandInfoModel]() | |
| 220 | + var userInfo: String? = ""//卡片标签的对应值 | |
| 217 | 221 | var input: Bool = false |
| 218 | 222 | var show: Bool = false |
| 219 | 223 | var value: String? = ""//自己定义的值 |
| 220 | - var children = [MineStandInfoModel]() | |
| 224 | + | |
| 221 | 225 | } |
| 222 | 226 | |
| 223 | 227 | // !!!: api/identityApi/myList 数据返回 | ... | ... |
metaCode/Classes/Main/MinePage/ViewModel/CNLiveMineViewModel.swift
| ... | ... | @@ -445,9 +445,9 @@ class CNLiveMineViewModel: NSObject { |
| 445 | 445 | let newsModel = dictionaryToModel(resp as! [String : Any], MineStandInfoBaseModel.self,"data") as! MineStandInfoBaseModel |
| 446 | 446 | let tempArray = NSMutableArray() |
| 447 | 447 | for authinfo in newsModel.authInfos { |
| 448 | - if authinfo.input { | |
| 448 | +// if authinfo.input { | |
| 449 | 449 | tempArray.add(authinfo) |
| 450 | - } | |
| 450 | +// } | |
| 451 | 451 | } |
| 452 | 452 | resultBlock(tempArray,.success) |
| 453 | 453 | } else { | ... | ... |
metaCode/Supporting Files/Assets.xcassets/Home/homePage_idCardBG.imageset/Contents.json
0 → 100644
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "scale" : "1x" | |
| 6 | + }, | |
| 7 | + { | |
| 8 | + "filename" : "homePage_idCardBG@2x.png", | |
| 9 | + "idiom" : "universal", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "filename" : "homePage_idCardBG@3x.png", | |
| 14 | + "idiom" : "universal", | |
| 15 | + "scale" : "3x" | |
| 16 | + } | |
| 17 | + ], | |
| 18 | + "info" : { | |
| 19 | + "author" : "xcode", | |
| 20 | + "version" : 1 | |
| 21 | + } | |
| 22 | +} | ... | ... |
metaCode/Supporting Files/Assets.xcassets/Home/homePage_idCardBG.imageset/homePage_idCardBG@2x.png
0 → 100644
19.2 KB
metaCode/Supporting Files/Assets.xcassets/Home/homePage_idCardBG.imageset/homePage_idCardBG@3x.png
0 → 100644
36.6 KB