Commit 42b1cd9354036f4538c2e2ea76e2509a29dab7b9
Merge branch 'master' of http://bj.gitlab.cnlive.com/ios-team/CNLiveMateCode
Showing
14 changed files
with
349 additions
and
64 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 | + 19123FC12ABC11170075C883 /* CNWebViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19123FC02ABC11170075C883 /* CNWebViewController.swift */; }; | |
| 11 | 12 | 19F1C2332AB5728B0083D06C /* CNIDCardView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19F1C2322AB5728B0083D06C /* CNIDCardView.swift */; }; |
| 12 | 13 | 1DD2808DF02C120276F99F4D /* Pods_metaCode.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F1C55A719CFEE073C06D37CE /* Pods_metaCode.framework */; }; |
| 13 | 14 | 7905BB492AB0588B0089BC50 /* CNLiveMineAuthResultViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7905BB482AB0588B0089BC50 /* CNLiveMineAuthResultViewController.swift */; }; |
| ... | ... | @@ -114,6 +115,7 @@ |
| 114 | 115 | /* Begin PBXFileReference section */ |
| 115 | 116 | 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>"; }; |
| 116 | 117 | 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>"; }; |
| 118 | + 19123FC02ABC11170075C883 /* CNWebViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNWebViewController.swift; sourceTree = "<group>"; }; | |
| 117 | 119 | 19F1C2322AB5728B0083D06C /* CNIDCardView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNIDCardView.swift; sourceTree = "<group>"; }; |
| 118 | 120 | 54E09C540E13D78166D71395 /* Pods_metaCodeTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_metaCodeTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; |
| 119 | 121 | 63D879B49B1E42F1584DD75E /* Pods_metaCode_metaCodeUITests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_metaCode_metaCodeUITests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; |
| ... | ... | @@ -561,6 +563,7 @@ |
| 561 | 563 | isa = PBXGroup; |
| 562 | 564 | children = ( |
| 563 | 565 | 7CD6754E2A2840B9008354C1 /* CNMetaCodeHomePageController.swift */, |
| 566 | + 19123FC02ABC11170075C883 /* CNWebViewController.swift */, | |
| 564 | 567 | ); |
| 565 | 568 | name = Controller; |
| 566 | 569 | path = HomePage/Controller; |
| ... | ... | @@ -891,6 +894,7 @@ |
| 891 | 894 | 790B1FB62A41938F0074CF00 /* UIImage+CNLiveExtensions.swift in Sources */, |
| 892 | 895 | 790D019D2A2DCBD000C5978D /* UIView+CNLiveExtensions.swift in Sources */, |
| 893 | 896 | 790B1FB62A41938F0074CF00 /* UIImage+CNLiveExtensions.swift in Sources */, |
| 897 | + 19123FC12ABC11170075C883 /* CNWebViewController.swift in Sources */, | |
| 894 | 898 | 790D019D2A2DCBD000C5978D /* UIView+CNLiveExtensions.swift in Sources */, |
| 895 | 899 | 7C7C62F62A4D72E9007A912E /* CNLiveIdentityDB.swift in Sources */, |
| 896 | 900 | 790B1FB62A41938F0074CF00 /* UIImage+CNLiveExtensions.swift in Sources */, | ... | ... |
metaCode/Classes/Main/HomePage/Controller/CNMetaCodeHomePageController.swift
| ... | ... | @@ -36,7 +36,17 @@ enum NetAPIStatus { |
| 36 | 36 | case notNetwork |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | -class CNMetaCodeHomePageController:CNLiveBaseViewController, NewPagedFlowViewDelegate, NewPagedFlowViewDataSource, CNCustomIndexViewDelegate,UIGestureRecognizerDelegate{ | |
| 39 | +///垂直方向页面 | |
| 40 | +enum VNumPage { | |
| 41 | + ///下滑页 第一页 | |
| 42 | + case VNumPageDown | |
| 43 | + ///主要页面 第二页 | |
| 44 | + case VNumPageMain | |
| 45 | + ///上滑页 第三页 | |
| 46 | + case VNumPageUp | |
| 47 | +} | |
| 48 | + | |
| 49 | +class CNMetaCodeHomePageController:CNLiveBaseViewController, NewPagedFlowViewDelegate, NewPagedFlowViewDataSource, CNCustomIndexViewDelegate,UIGestureRecognizerDelegate,WKNavigationDelegate{ | |
| 40 | 50 | |
| 41 | 51 | |
| 42 | 52 | ///NewPagedFlowView 开始滑动时的偏移量 |
| ... | ... | @@ -48,6 +58,9 @@ class CNMetaCodeHomePageController:CNLiveBaseViewController, NewPagedFlowViewDel |
| 48 | 58 | // private var identityStatus: UserIdentityStatus = .notCertified |
| 49 | 59 | ///接口状态 |
| 50 | 60 | private var NetApiStatus: NetAPIStatus = .apiError |
| 61 | + ///接口状态 | |
| 62 | + public var vNumPage: VNumPage = .VNumPageMain | |
| 63 | + | |
| 51 | 64 | |
| 52 | 65 | // MARK: - 懒加载 |
| 53 | 66 | ///数据源 |
| ... | ... | @@ -201,6 +214,15 @@ class CNMetaCodeHomePageController:CNLiveBaseViewController, NewPagedFlowViewDel |
| 201 | 214 | } |
| 202 | 215 | override func viewWillAppear(_ animated: Bool) { |
| 203 | 216 | super.viewWillAppear(animated) |
| 217 | + switch vNumPage { | |
| 218 | + case .VNumPageMain://中间主页 | |
| 219 | + self.tabBarController?.tabBar.isHidden = false | |
| 220 | + case .VNumPageUp://上滑页 | |
| 221 | + self.tabBarController?.tabBar.isHidden = true | |
| 222 | + case .VNumPageDown://下滑页 | |
| 223 | + self.tabBarController?.tabBar.isHidden = true | |
| 224 | + } | |
| 225 | + | |
| 204 | 226 | |
| 205 | 227 | print("uid = ",UserInfoManager.shared.userInfo.uid) |
| 206 | 228 | |
| ... | ... | @@ -354,6 +376,8 @@ class CNMetaCodeHomePageController:CNLiveBaseViewController, NewPagedFlowViewDel |
| 354 | 376 | bannerView?.superScrollView = flowView.scrollView |
| 355 | 377 | bannerView?.associatedVCView = self.view |
| 356 | 378 | bannerView?.delegate = self |
| 379 | + bannerView?.upSlideView.webView.navigationDelegate = self | |
| 380 | + bannerView?.downSlideView.webView.navigationDelegate = self | |
| 357 | 381 | let identityModel = dataArray[index] as! StandListModel |
| 358 | 382 | bannerView?.idModel = identityModel |
| 359 | 383 | return bannerView |
| ... | ... | @@ -423,7 +447,7 @@ class CNMetaCodeHomePageController:CNLiveBaseViewController, NewPagedFlowViewDel |
| 423 | 447 | } |
| 424 | 448 | |
| 425 | 449 | |
| 426 | - //MARK: - CNCustomIndexView 代理方法 | |
| 450 | + //MARK: - CNCustomIndexView 代理方法 垂直方向滑动 | |
| 427 | 451 | |
| 428 | 452 | func customIndexViewWillBeiginScroll(scrollView: UIScrollView) { |
| 429 | 453 | self.view.height = KSreenHeight |
| ... | ... | @@ -458,6 +482,17 @@ class CNMetaCodeHomePageController:CNLiveBaseViewController, NewPagedFlowViewDel |
| 458 | 482 | |
| 459 | 483 | |
| 460 | 484 | func customIndexViewDidEndScroll(scrollView: UIScrollView) { |
| 485 | + if scrollView.contentOffset.y == 0{//下滑页 | |
| 486 | + self.tabBarController?.tabBar.isHidden = true | |
| 487 | + vNumPage = .VNumPageDown | |
| 488 | + }else if scrollView.contentOffset.y == KSreenHeight{//默认主页 | |
| 489 | + self.tabBarController?.tabBar.isHidden = false | |
| 490 | + vNumPage = .VNumPageMain | |
| 491 | + }else if scrollView.contentOffset.y == KSreenHeight*2{//上滑页 | |
| 492 | + self.tabBarController?.tabBar.isHidden = true | |
| 493 | + vNumPage = .VNumPageUp | |
| 494 | + } | |
| 495 | + | |
| 461 | 496 | if scrollView.contentOffset.y == KSreenHeight { |
| 462 | 497 | self.view.height = self.tabBarY |
| 463 | 498 | |
| ... | ... | @@ -473,6 +508,63 @@ class CNMetaCodeHomePageController:CNLiveBaseViewController, NewPagedFlowViewDel |
| 473 | 508 | } |
| 474 | 509 | } |
| 475 | 510 | } |
| 511 | + | |
| 512 | + // MARK: - WKWebViewDelegate | |
| 513 | + // 页面开始加载时调用 | |
| 514 | + func webView(_ webView: WKWebView, didStartProvisionalNavigation navigation: WKNavigation!) { | |
| 515 | + print("didStartProvisionalNavigation") | |
| 516 | + } | |
| 517 | + // 当内容开始返回时调用 | |
| 518 | + func webView(_ webView: WKWebView, didCommit navigation: WKNavigation!) { | |
| 519 | + print("didCommit") | |
| 520 | + } | |
| 521 | + // 页面加载完成之后调用 | |
| 522 | + func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) { | |
| 523 | + print("didFinish") | |
| 524 | + } | |
| 525 | + // 页面加载失败时调用 | |
| 526 | + func webView(_ webView: WKWebView, didFailProvisionalNavigation navigation: WKNavigation!, withError error: Error) { | |
| 527 | + print("didFailProvisionalNavigation") | |
| 528 | + } | |
| 529 | + // 接收到服务器跳转请求之后调用 | |
| 530 | + func webView(_ webView: WKWebView, didReceiveServerRedirectForProvisionalNavigation navigation: WKNavigation!) { | |
| 531 | + print("didReceiveServerRedirectForProvisionalNavigation") | |
| 532 | + } | |
| 533 | + // 在收到响应后,决定是否跳转 -> 默认允许 | |
| 534 | + func webView(_ webView: WKWebView, decidePolicyFor navigationResponse: WKNavigationResponse, decisionHandler: @escaping (WKNavigationResponsePolicy) -> Void) { | |
| 535 | + print("decidePolicyFor") | |
| 536 | + //允许跳转 | |
| 537 | + decisionHandler(.allow) | |
| 538 | + //不允许跳转 | |
| 539 | +// decisionHandler(.cancel) | |
| 540 | + } | |
| 541 | + // 在发送请求之前,决定是否跳转 -> 默认允许 | |
| 542 | + @available(iOS 13.0, *) | |
| 543 | + func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, preferences: WKWebpagePreferences, decisionHandler: @escaping (WKNavigationActionPolicy, WKWebpagePreferences) -> Void) { | |
| 544 | + print("decidePolicyFor") | |
| 545 | + let url:String = navigationAction.request.url!.absoluteString | |
| 546 | + print("navigationAction:\(navigationAction.navigationType.rawValue)") | |
| 547 | + print(url) | |
| 548 | + if(navigationAction.navigationType == .linkActivated){ | |
| 549 | + let webVC = CNWebViewController() | |
| 550 | + webVC.url = url | |
| 551 | + currentViewController()?.navigationController?.pushViewController(webVC, animated: true) | |
| 552 | + decisionHandler(.cancel, preferences) | |
| 553 | + return | |
| 554 | + }else if(navigationAction.navigationType == .other){ | |
| 555 | + if(url.contains("wjjh5.cnlive.com")){ | |
| 556 | + | |
| 557 | + decisionHandler(.allow, preferences) | |
| 558 | + return | |
| 559 | + }else | |
| 560 | + { | |
| 561 | + decisionHandler(.cancel, preferences) | |
| 562 | + return | |
| 563 | + } | |
| 564 | + } | |
| 565 | + decisionHandler(.allow, preferences) | |
| 566 | + } | |
| 567 | + | |
| 476 | 568 | //MARK: - 网络请求获取身份列表 |
| 477 | 569 | func getUserIdentityApi() |
| 478 | 570 | { | ... | ... |
metaCode/Classes/Main/HomePage/Controller/CNWebViewController.swift
0 → 100644
| 1 | +// | |
| 2 | +// CNWebViewController.swift | |
| 3 | +// metaCode | |
| 4 | +// | |
| 5 | +// Created by zx on 2023/9/21. | |
| 6 | +// | |
| 7 | + | |
| 8 | +import Foundation | |
| 9 | +import WebKit | |
| 10 | + | |
| 11 | +class CNWebViewController:CNLiveBaseViewController ,WKNavigationDelegate{ | |
| 12 | + | |
| 13 | + lazy var webView: WKWebView = { | |
| 14 | + let webView = WKWebView.init(frame: CGRectMake(0, 0, Width, Height)) | |
| 15 | + webView.scrollView.showsVerticalScrollIndicator = false | |
| 16 | + webView.scrollView.showsHorizontalScrollIndicator = false | |
| 17 | + webView.navigationDelegate = self | |
| 18 | + return webView | |
| 19 | + }() | |
| 20 | + | |
| 21 | + var _url:String? | |
| 22 | + var url:String? { | |
| 23 | + get{ | |
| 24 | + return _url | |
| 25 | + } | |
| 26 | + set{ | |
| 27 | + _url = newValue! | |
| 28 | + if (_url != ""){ | |
| 29 | + let webUrl: URL! = URL.init(string: _url!) | |
| 30 | + webView.load(URLRequest.init(url:webUrl)) | |
| 31 | + } | |
| 32 | + } | |
| 33 | + } | |
| 34 | + | |
| 35 | + override func viewDidLoad() { | |
| 36 | + super.viewDidLoad() | |
| 37 | + navigationBarHidden = false | |
| 38 | + self.view.addSubview(self.webView) | |
| 39 | + webView.snp.makeConstraints { make in | |
| 40 | + make.top.equalTo(get_system_nav_height()) | |
| 41 | + make.left.right.bottom.equalToSuperview() | |
| 42 | + } | |
| 43 | + | |
| 44 | + } | |
| 45 | + | |
| 46 | + // MARK: - WKWebViewDelegate | |
| 47 | + // 页面开始加载时调用 | |
| 48 | + func webView(_ webView: WKWebView, didStartProvisionalNavigation navigation: WKNavigation!) { | |
| 49 | + print("didStartProvisionalNavigation") | |
| 50 | + } | |
| 51 | + // 当内容开始返回时调用 | |
| 52 | + func webView(_ webView: WKWebView, didCommit navigation: WKNavigation!) { | |
| 53 | + print("didCommit") | |
| 54 | + } | |
| 55 | + // 页面加载完成之后调用 | |
| 56 | + func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) { | |
| 57 | + print("didFinish") | |
| 58 | + titleName = webView.title! | |
| 59 | + } | |
| 60 | + // 页面加载失败时调用 | |
| 61 | + func webView(_ webView: WKWebView, didFailProvisionalNavigation navigation: WKNavigation!, withError error: Error) { | |
| 62 | + print("didFailProvisionalNavigation") | |
| 63 | + } | |
| 64 | + // 接收到服务器跳转请求之后调用 | |
| 65 | + func webView(_ webView: WKWebView, didReceiveServerRedirectForProvisionalNavigation navigation: WKNavigation!) { | |
| 66 | + print("didReceiveServerRedirectForProvisionalNavigation") | |
| 67 | + } | |
| 68 | + // 在收到响应后,决定是否跳转 -> 默认允许 | |
| 69 | + func webView(_ webView: WKWebView, decidePolicyFor navigationResponse: WKNavigationResponse, decisionHandler: @escaping (WKNavigationResponsePolicy) -> Void) { | |
| 70 | + print("decidePolicyFor") | |
| 71 | + //允许跳转 | |
| 72 | + decisionHandler(.allow) | |
| 73 | + //不允许跳转 | |
| 74 | + // decisionHandler(.cancel) | |
| 75 | + } | |
| 76 | + // 在发送请求之前,决定是否跳转 -> 默认允许 | |
| 77 | + @available(iOS 13.0, *) | |
| 78 | + func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, preferences: WKWebpagePreferences, decisionHandler: @escaping (WKNavigationActionPolicy, WKWebpagePreferences) -> Void) { | |
| 79 | + | |
| 80 | + decisionHandler(.allow, preferences) | |
| 81 | + } | |
| 82 | +} | ... | ... |
metaCode/Classes/Main/HomePage/View/CNCustomIndexView.swift
| ... | ... | @@ -20,13 +20,15 @@ class CNCustomIndexTopView : UIView{ |
| 20 | 20 | let titleLabel = UILabel.init(frame: CGRectMake(10, 0, 75, 35)) |
| 21 | 21 | titleLabel.bottom = self.bottom - 5 |
| 22 | 22 | titleLabel.textColor = .white |
| 23 | + titleLabel.textAlignment = .left | |
| 23 | 24 | titleLabel.font = UIFont.systemFont(ofSize: 24, weight: .semibold) |
| 25 | + titleLabel.adjustsFontSizeToFitWidth=true | |
| 24 | 26 | return titleLabel |
| 25 | 27 | }() |
| 26 | 28 | ///关闭按钮 |
| 27 | 29 | lazy var closeBtn: UIButton = { |
| 28 | 30 | let closeBtn = UIButton(type: .custom) |
| 29 | - closeBtn.frame = CGRect(x: self.width - 30, y: 0, width: 30, height: 30) | |
| 31 | + closeBtn.frame = CGRect(x: self.width - 50, y: 0, width: 50, height: 50) | |
| 30 | 32 | closeBtn.centerY = self.titleLabel.centerY |
| 31 | 33 | closeBtn.setImage(UIImage(named: "homePage_close_icon"), for: .normal) |
| 32 | 34 | closeBtn.addTarget(self, action: #selector(closeBtnAction), for: .touchUpInside) |
| ... | ... | @@ -45,6 +47,16 @@ class CNCustomIndexTopView : UIView{ |
| 45 | 47 | func initUI(){ |
| 46 | 48 | self.addSubview(self.titleLabel) |
| 47 | 49 | self.addSubview(self.closeBtn) |
| 50 | + self.titleLabel.snp.makeConstraints { make in | |
| 51 | + make.centerY.equalToSuperview() | |
| 52 | + make.left.equalToSuperview() | |
| 53 | + make.right.equalTo(closeBtn.snp.left) | |
| 54 | + } | |
| 55 | + self.closeBtn.snp.makeConstraints { make in | |
| 56 | + make.centerY.equalToSuperview() | |
| 57 | + make.right.equalToSuperview() | |
| 58 | + make.width.equalTo(50) | |
| 59 | + } | |
| 48 | 60 | } |
| 49 | 61 | |
| 50 | 62 | //MARK: - 公开方法 |
| ... | ... | @@ -108,6 +120,7 @@ class CNCustomIndexView:PGIndexBannerSubiew, UIScrollViewDelegate, WJColorChange |
| 108 | 120 | _idModel = newValue |
| 109 | 121 | self.upSlideView.url = _idModel?.upPath |
| 110 | 122 | self.downSlideView.url = _idModel?.downPath |
| 123 | + self.topNavView.setTitleString(title:(_idModel?.name)!) | |
| 111 | 124 | } |
| 112 | 125 | |
| 113 | 126 | } |
| ... | ... | @@ -171,6 +184,7 @@ class CNCustomIndexView:PGIndexBannerSubiew, UIScrollViewDelegate, WJColorChange |
| 171 | 184 | collectionView.backgroundColor = .clear |
| 172 | 185 | collectionView.backAction = {[weak self] in |
| 173 | 186 | self?.baseScrollView.setContentOffset(CGPoint(x: 0, y: (self!.baseScrollView.height)), animated: true) |
| 187 | + currentViewController()?.tabBarController?.tabBar.isHidden = false | |
| 174 | 188 | self?.superScrollView?.isScrollEnabled = true |
| 175 | 189 | |
| 176 | 190 | let time = DispatchTime.now() + 0.5 |
| ... | ... | @@ -210,11 +224,12 @@ class CNCustomIndexView:PGIndexBannerSubiew, UIScrollViewDelegate, WJColorChange |
| 210 | 224 | |
| 211 | 225 | /// 顶部自定义导航 |
| 212 | 226 | lazy var topNavView: CNCustomIndexTopView = { |
| 213 | - let topNavView = CNCustomIndexTopView.init(frame: CGRect(x: 0, y: 0, width: self.width, height: KNavigationHeight)) | |
| 227 | + let topNavView = CNCustomIndexTopView.init(frame: CGRect(x: 0, y: 30, width: self.width, height: KNavigationHeight)) | |
| 214 | 228 | topNavView.alpha = 0 |
| 215 | 229 | topNavView.closeAction = { [weak self ] in |
| 216 | 230 | self!.baseScrollView.setContentOffset(CGPoint(x: 0, y: self!.baseScrollView.height), animated: true) |
| 217 | 231 | self?.superScrollView?.isScrollEnabled = true |
| 232 | + currentViewController()?.tabBarController?.tabBar.isHidden = false | |
| 218 | 233 | } |
| 219 | 234 | return topNavView |
| 220 | 235 | }() |
| ... | ... | @@ -236,7 +251,7 @@ class CNCustomIndexView:PGIndexBannerSubiew, UIScrollViewDelegate, WJColorChange |
| 236 | 251 | |
| 237 | 252 | self.addSubview(self.baseScrollView) |
| 238 | 253 | self.addSubview(self.topNavView) |
| 239 | - self.topNavView.setTitleString(title: "志愿者") | |
| 254 | +// self.topNavView.setTitleString(title: "志愿者") | |
| 240 | 255 | |
| 241 | 256 | self.baseScrollView.addSubview(self.downSlideView) |
| 242 | 257 | self.baseScrollView.addSubview(self.mainView) | ... | ... |
metaCode/Classes/Main/HomePage/View/CNDownSlideView.swift
metaCode/Classes/Main/HomePage/View/CNHomePageBackgroupView.swift
| ... | ... | @@ -28,6 +28,7 @@ class CNHomePageBackgroupSubView : UIView |
| 28 | 28 | let titleLabel = UILabel.init(frame: CGRectMake(25, KNavigationHeight - 20, KSreenWidth - 50, 35)) |
| 29 | 29 | titleLabel.textColor = .white |
| 30 | 30 | titleLabel.font = UIFont.systemFont(ofSize: 20, weight: .semibold) |
| 31 | + titleLabel.adjustsFontSizeToFitWidth=true | |
| 31 | 32 | return titleLabel |
| 32 | 33 | }() |
| 33 | 34 | ... | ... |
metaCode/Classes/Main/HomePage/View/CNMainView.swift
| ... | ... | @@ -27,23 +27,49 @@ class CNFrontMainView : UIView{ |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | ///视图总容器 |
| 30 | - lazy var frontContentView : UIView = { | |
| 30 | + lazy var frontTotolContentView : UIView = { | |
| 31 | 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 | |
| 32 | + let frontTotolContentView = UIView.init(frame: CGRect(x: 0, y: 0, width: self.width, height: self.height )) | |
| 33 | + frontTotolContentView.backgroundColor = UIColor.white | |
| 34 | + frontTotolContentView.clipsToBounds = true | |
| 35 | + frontTotolContentView.layer.cornerRadius = 20 | |
| 36 | + return frontTotolContentView | |
| 38 | 37 | }() |
| 39 | 38 | |
| 40 | - /// 已认证-身份卡片 | |
| 41 | - lazy var iDCardView:CNIDCardView = { | |
| 39 | + ///未认证-前置视图身份描述容器 | |
| 40 | + lazy var frontDescContentView : UIView = { | |
| 42 | 41 | |
| 43 | - let iDCardView:CNIDCardView = CNIDCardView(frame: CGRect(x: 20, y: 25, width: self.width-40, height: (self.width-40) * 0.64)) | |
| 44 | - return iDCardView | |
| 42 | + let frontDescContentView = UIView.init(frame: CGRect(x: 0, y: 0, width: self.width, height: self.height )) | |
| 43 | + frontDescContentView.backgroundColor = UIColor.white | |
| 44 | + frontDescContentView.clipsToBounds = true | |
| 45 | + frontDescContentView.layer.cornerRadius = 20 | |
| 46 | + frontDescContentView.addSubview(self.textViewBgImgView) | |
| 47 | + textViewBgImgView.snp.makeConstraints { make in | |
| 48 | + make.top.equalToSuperview() | |
| 49 | + make.left.equalToSuperview() | |
| 50 | + make.right.equalToSuperview() | |
| 51 | + make.bottom.equalToSuperview() | |
| 52 | + } | |
| 53 | + | |
| 54 | + frontDescContentView.addSubview(self.addStandBtn) | |
| 55 | + addStandBtn.snp.makeConstraints { make in | |
| 56 | + make.centerX.equalToSuperview() | |
| 57 | + make.bottom.equalToSuperview().offset(-30) | |
| 58 | + make.width.equalTo(150) | |
| 59 | + make.height.equalTo(39) | |
| 60 | + } | |
| 61 | + | |
| 62 | + frontDescContentView.addSubview(self.textView) | |
| 63 | + textView.snp.makeConstraints { make in | |
| 64 | + make.top.equalToSuperview().offset(40) | |
| 65 | + make.left.equalToSuperview().offset(30) | |
| 66 | + make.right.equalToSuperview().offset(-30) | |
| 67 | + make.bottom.equalTo(addStandBtn.snp.top).offset(-30) | |
| 68 | + } | |
| 69 | + | |
| 70 | + return frontDescContentView | |
| 71 | + | |
| 45 | 72 | }() |
| 46 | - | |
| 47 | 73 | //未认证下 textview |
| 48 | 74 | lazy var textView: UITextView = { |
| 49 | 75 | let textView = UITextView.init() |
| ... | ... | @@ -57,10 +83,10 @@ class CNFrontMainView : UIView{ |
| 57 | 83 | textView.clipsToBounds = true |
| 58 | 84 | textView.layer.cornerRadius = 14 |
| 59 | 85 | textView.isUserInteractionEnabled = false |
| 86 | + textView.backgroundColor = .clear | |
| 60 | 87 | return textView |
| 61 | 88 | }() |
| 62 | - | |
| 63 | - ///点击添加身份 按钮 | |
| 89 | + ///未认证-点击添加身份 按钮 | |
| 64 | 90 | lazy var addStandBtn: UIButton = { |
| 65 | 91 | let addStandBtn = UIButton(type: .custom) |
| 66 | 92 | addStandBtn.clipsToBounds = true |
| ... | ... | @@ -73,32 +99,55 @@ class CNFrontMainView : UIView{ |
| 73 | 99 | return addStandBtn |
| 74 | 100 | }() |
| 75 | 101 | |
| 76 | - ///前置视图容器 | |
| 77 | - lazy var contentView : UIView = { | |
| 102 | + ///已认证-前置视图卡片容器 | |
| 103 | + lazy var frontCardContentView : UIView = { | |
| 78 | 104 | |
| 79 | - let contentView = UIView.init(frame: CGRect(x: 0, y: 0, width: self.width, height: self.height )) | |
| 80 | - contentView.backgroundColor = UIColor.white | |
| 81 | - contentView.clipsToBounds = true | |
| 82 | - contentView.layer.cornerRadius = 20 | |
| 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) | |
| 105 | + let frontCardContentView = UIView.init(frame: CGRect(x: 0, y: 0, width: self.width, height: self.height )) | |
| 106 | + frontCardContentView.backgroundColor = UIColor.white | |
| 107 | + frontCardContentView.clipsToBounds = true | |
| 108 | + frontCardContentView.layer.cornerRadius = 20 | |
| 109 | + frontCardContentView.addSubview(self.cardViewBgImgView) | |
| 110 | + cardViewBgImgView.snp.makeConstraints { make in | |
| 111 | + make.top.equalToSuperview() | |
| 112 | + make.left.equalToSuperview() | |
| 113 | + make.right.equalToSuperview() | |
| 114 | + make.bottom.equalToSuperview() | |
| 97 | 115 | } |
| 98 | 116 | |
| 99 | - return contentView | |
| 117 | + frontCardContentView.addSubview(self.iDCardView) | |
| 118 | + iDCardView.snp.makeConstraints { make in | |
| 119 | + make.centerX.equalToSuperview() | |
| 120 | + make.top.equalToSuperview().offset(25) | |
| 121 | + make.width.equalTo(self.width-40) | |
| 122 | + make.height.equalTo((self.width-40) * 0.64) | |
| 123 | + } | |
| 124 | + return frontCardContentView | |
| 100 | 125 | |
| 101 | 126 | }() |
| 127 | + /// 已认证-身份卡片 | |
| 128 | + lazy var iDCardView:CNIDCardView = { | |
| 129 | + | |
| 130 | + let iDCardView:CNIDCardView = CNIDCardView(frame: CGRect(x: 20, y: 25, width: self.width-40, height: (self.width-40) * 0.64)) | |
| 131 | + return iDCardView | |
| 132 | + }() | |
| 133 | + | |
| 134 | + /// 已认证-身份卡片 | |
| 135 | + lazy var textViewBgImgView:UIImageView = { | |
| 136 | + | |
| 137 | + let textViewBgImgView:UIImageView = UIImageView() | |
| 138 | + textViewBgImgView.clipsToBounds = true | |
| 139 | + textViewBgImgView.layer.cornerRadius = 20 | |
| 140 | + return textViewBgImgView | |
| 141 | + }() | |
| 142 | + | |
| 143 | + /// 已认证-卡片后的背景图 | |
| 144 | + lazy var cardViewBgImgView:UIImageView = { | |
| 145 | + | |
| 146 | + let cardViewBgImgView:UIImageView = UIImageView() | |
| 147 | + cardViewBgImgView.clipsToBounds = true | |
| 148 | + cardViewBgImgView.layer.cornerRadius = 20 | |
| 149 | + return cardViewBgImgView | |
| 150 | + }() | |
| 102 | 151 | |
| 103 | 152 | //IDmodel |
| 104 | 153 | var _idModel : StandListModel? |
| ... | ... | @@ -112,37 +161,33 @@ class CNFrontMainView : UIView{ |
| 112 | 161 | if(auth == true){ |
| 113 | 162 | //已认证身份 |
| 114 | 163 | //显示证件View |
| 115 | - iDCardView.isHidden = false | |
| 164 | + frontCardContentView.isHidden = false | |
| 116 | 165 | iDCardView.idModel = newValue! |
| 117 | - contentView.isHidden = true | |
| 118 | - | |
| 166 | + frontDescContentView.isHidden = true | |
| 167 | + cardViewBgImgView.kf.setImage(with: URL(string: _idModel!.cardBackgroundImg), placeholder: UIImage(named: "homepage_cardBGImg")) | |
| 119 | 168 | }else |
| 120 | 169 | {//未认证身份 |
| 121 | - iDCardView.isHidden = true | |
| 170 | + frontCardContentView.isHidden = true | |
| 122 | 171 | //显示textview 添加身份 |
| 123 | - contentView.isHidden = false | |
| 172 | + frontDescContentView.isHidden = false | |
| 124 | 173 | textView.text = newValue!.description |
| 125 | 174 | addStandBtn.backgroundColor = HexColor(newValue!.backgroundColor) |
| 126 | - textView.backgroundColor = HexColor(newValue!.backgroundColor, alpha: 0.1) | |
| 175 | + textViewBgImgView.kf.setImage(with: URL(string: _idModel!.descBackgroundImg), placeholder: UIImage(named: "homepage_desc_bgImg")) | |
| 127 | 176 | } |
| 128 | 177 | } |
| 129 | 178 | } |
| 130 | 179 | |
| 131 | 180 | func initUI() |
| 132 | 181 | { |
| 133 | - self.addSubview(self.frontContentView) | |
| 134 | - self.frontContentView.addSubview(self.contentView) | |
| 135 | - self.frontContentView.addSubview(self.iDCardView) | |
| 182 | + self.addSubview(self.frontTotolContentView) | |
| 183 | + self.frontTotolContentView.addSubview(self.frontDescContentView) | |
| 184 | + self.frontTotolContentView.addSubview(self.frontCardContentView) | |
| 185 | + | |
| 136 | 186 | |
| 137 | 187 | self.makeConstraints() |
| 138 | 188 | } |
| 139 | 189 | func makeConstraints(){ |
| 140 | - self.iDCardView.snp.makeConstraints { make in | |
| 141 | - make.centerX.equalToSuperview() | |
| 142 | - make.top.equalToSuperview().offset(25) | |
| 143 | - make.width.equalTo(self.width-40) | |
| 144 | - make.height.equalTo((self.width-40) * 0.64) | |
| 145 | - } | |
| 190 | + | |
| 146 | 191 | } |
| 147 | 192 | |
| 148 | 193 | // MARK: -按钮点击事件 |
| ... | ... | @@ -291,7 +336,7 @@ class CNMainView : UIView{ |
| 291 | 336 | |
| 292 | 337 | // MARK: - <##><##>设置前置视图容器 |
| 293 | 338 | func isHiddenMainFrontContentView(isHidden:Bool){ |
| 294 | - self.frontView.contentView.isHidden = isHidden | |
| 339 | + self.frontView.frontTotolContentView.isHidden = isHidden | |
| 295 | 340 | } |
| 296 | 341 | |
| 297 | 342 | // MARK: - 事件 | ... | ... |
metaCode/Classes/Main/MinePage/ViewModel/CNLiveMineBaseModel.swift
| ... | ... | @@ -136,21 +136,24 @@ 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 | 139 | var id: Int = 0//ID号 |
| 140 | + var name: String?//名称 | |
| 141 | + var icon: String?//小圆图标 | |
| 143 | 142 | var createTime: Int = 0//注册时间 |
| 144 | - var createTimeString: String = "" | |
| 145 | - var timeString: String = "" | |
| 146 | - var auth: Bool = false//身份是否验证 | |
| 143 | + var enable: Bool = false//没用 | |
| 147 | 144 | var backgroundImg: String = ""//首页背景图 |
| 148 | 145 | var backgroundColor: String = ""//添加身份按钮背景色 |
| 149 | 146 | var backgroundColour: String = "" |
| 150 | 147 | var description: String = ""//首页身份说明描述 |
| 148 | + var descBackgroundImg: String = ""//首页文字背景图 | |
| 151 | 149 | var cardImg: String = ""//卡片背景图 |
| 152 | - var downPath: String = ""//下滑h5 | |
| 150 | + var cardBackgroundImg: String = ""//首页卡片背景图 | |
| 153 | 151 | var upPath: String = ""//上滑h5 |
| 152 | + var downPath: String = ""//下滑h5 | |
| 153 | + var auth: Bool = false//身份是否验证 | |
| 154 | + | |
| 155 | + var createTimeString: String = "" | |
| 156 | + var timeString: String = "" | |
| 154 | 157 | |
| 155 | 158 | override func mapping(mapper: HelpingMapper) { |
| 156 | 159 | mapper <<< | ... | ... |
metaCode/Supporting Files/Assets.xcassets/Home/homepage_cardBGImg.imageset/Contents.json
0 → 100644
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "scale" : "1x" | |
| 6 | + }, | |
| 7 | + { | |
| 8 | + "filename" : "homepage_cardBGImg@2x.png", | |
| 9 | + "idiom" : "universal", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "filename" : "homepage_cardBGImg@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_cardBGImg.imageset/homepage_cardBGImg@2x.png
0 → 100644
24.7 KB
metaCode/Supporting Files/Assets.xcassets/Home/homepage_cardBGImg.imageset/homepage_cardBGImg@3x.png
0 → 100644
48.4 KB
metaCode/Supporting Files/Assets.xcassets/Home/homepage_desc_bgImg.imageset/Contents.json
0 → 100644
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "scale" : "1x" | |
| 6 | + }, | |
| 7 | + { | |
| 8 | + "filename" : "homepage_desc_bgImg@2x.png", | |
| 9 | + "idiom" : "universal", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "filename" : "homepage_desc_bgImg@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_desc_bgImg.imageset/homepage_desc_bgImg@2x.png
0 → 100644
95.9 KB
metaCode/Supporting Files/Assets.xcassets/Home/homepage_desc_bgImg.imageset/homepage_desc_bgImg@3x.png
0 → 100644
311 KB