Commit 2fc6f675aa0fca646a1c1f9a9a9ae22ffb5d99c1

Authored by niudaojian
1 parent aac8a0db

首页添加添加认证界面

metaCode.xcodeproj/project.pbxproj
... ... @@ -36,6 +36,8 @@
36 36 798A44F22A30674200815935 /* CNLiveMineSubBodyListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 798A44F12A30674200815935 /* CNLiveMineSubBodyListView.swift */; };
37 37 79A68C4A2A26E6CE00DC3B43 /* (null) in Sources */ = {isa = PBXBuildFile; };
38 38 79A68C4C2A26EA6000DC3B43 /* (null) in Sources */ = {isa = PBXBuildFile; };
  39 + 7C2703302A36CBE30061EC50 /* CNCertificationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C27032F2A36CBE30061EC50 /* CNCertificationView.swift */; };
  40 + 7C2703332A36CC660061EC50 /* CNLiveGlobalBlock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C2703322A36CC660061EC50 /* CNLiveGlobalBlock.swift */; };
39 41 7C4931292A2D8BA8000E44B4 /* CNLiveBaseTabBarViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C4931282A2D8BA8000E44B4 /* CNLiveBaseTabBarViewController.swift */; };
40 42 7C49312D2A2DB9FA000E44B4 /* UITabBar+CNBadge.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C49312C2A2DB9FA000E44B4 /* UITabBar+CNBadge.swift */; };
41 43 7C4931312A2F142F000E44B4 /* CNHomePageBackgroupView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C4931302A2F142F000E44B4 /* CNHomePageBackgroupView.swift */; };
... ... @@ -112,6 +114,8 @@
112 114 798A44EF2A305BC200815935 /* UIButton+CNLiveExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIButton+CNLiveExtension.swift"; sourceTree = "<group>"; };
113 115 798A44F12A30674200815935 /* CNLiveMineSubBodyListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineSubBodyListView.swift; sourceTree = "<group>"; };
114 116 79A68C512A26F59C00DC3B43 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = metaCode/Info.plist; sourceTree = "<group>"; };
  117 + 7C27032F2A36CBE30061EC50 /* CNCertificationView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNCertificationView.swift; sourceTree = "<group>"; };
  118 + 7C2703322A36CC660061EC50 /* CNLiveGlobalBlock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveGlobalBlock.swift; sourceTree = "<group>"; };
115 119 7C4931282A2D8BA8000E44B4 /* CNLiveBaseTabBarViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveBaseTabBarViewController.swift; sourceTree = "<group>"; };
116 120 7C49312C2A2DB9FA000E44B4 /* UITabBar+CNBadge.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UITabBar+CNBadge.swift"; sourceTree = "<group>"; };
117 121 7C4931302A2F142F000E44B4 /* CNHomePageBackgroupView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNHomePageBackgroupView.swift; sourceTree = "<group>"; };
... ... @@ -266,6 +270,7 @@
266 270 7963988A2A260B3300D045EB /* Classes */ = {
267 271 isa = PBXGroup;
268 272 children = (
  273 + 7C2703312A36CC430061EC50 /* GlobalBlock */,
269 274 7C4931322A3076BE000E44B4 /* CustomView */,
270 275 790D01832A2D89E100C5978D /* Extensions */,
271 276 7CD675502A29C036008354C1 /* Constant */,
... ... @@ -378,6 +383,14 @@
378 383 path = ViewModel;
379 384 sourceTree = "<group>";
380 385 };
  386 + 7C2703312A36CC430061EC50 /* GlobalBlock */ = {
  387 + isa = PBXGroup;
  388 + children = (
  389 + 7C2703322A36CC660061EC50 /* CNLiveGlobalBlock.swift */,
  390 + );
  391 + path = GlobalBlock;
  392 + sourceTree = "<group>";
  393 + };
381 394 7C4931322A3076BE000E44B4 /* CustomView */ = {
382 395 isa = PBXGroup;
383 396 children = (
... ... @@ -407,6 +420,7 @@
407 420 7CD675412A2740F8008354C1 /* CNCustomIndexView.swift */,
408 421 7C4931302A2F142F000E44B4 /* CNHomePageBackgroupView.swift */,
409 422 7C4931372A307BDB000E44B4 /* CNHomePageGuideView.swift */,
  423 + 7C27032F2A36CBE30061EC50 /* CNCertificationView.swift */,
410 424 );
411 425 name = View;
412 426 path = HomePage/View;
... ... @@ -751,7 +765,9 @@
751 765 7CD6754F2A2840B9008354C1 /* CNMetaCodeHomePageController.swift in Sources */,
752 766 7CD675472A274167008354C1 /* NewPagedFlowView.m in Sources */,
753 767 79282A442A2F1C1E00B5F8CF /* CNLiveLoginAuthView.swift in Sources */,
  768 + 7C2703302A36CBE30061EC50 /* CNCertificationView.swift in Sources */,
754 769 790D01A32A2DDBA300C5978D /* CNLiveConfigManager.swift in Sources */,
  770 + 7C2703332A36CC660061EC50 /* CNLiveGlobalBlock.swift in Sources */,
755 771 798A44EA2A30135D00815935 /* CNLiveMineBodyListView.swift in Sources */,
756 772 79A68C4A2A26E6CE00DC3B43 /* (null) in Sources */,
757 773 79282A3E2A2EFDA000B5F8CF /* CNLiveLoginModel.swift in Sources */,
... ...
metaCode/Classes/GlobalBlock/CNLiveGlobalBlock.swift 0 → 100644
  1 +//
  2 +// CNLiveGlobalBlock.swift
  3 +// metaCode
  4 +//
  5 +// Created by daojian on 2023/6/12.
  6 +//
  7 +
  8 +import Foundation
  9 +
  10 +///点击事件回调
  11 +typealias closureBlock = ()->Void;
... ...
metaCode/Classes/Main/HomePage/Controller/CNMetaCodeHomePageController.swift
... ... @@ -18,8 +18,33 @@ let CNKeyIsFirstAppearUpSlideHomeGuide: String = &quot;isFirstAppearUpSlideHomeGuideK
18 18 ///存储是否第一次显示首页下滑引导
19 19 let CNKeyIsFirstAppearDownSlideHomeGuide: String = "isFirstAppearDownSlideHomeGuideKey"
20 20  
  21 +///用户身份认证状态
  22 +enum UserIdentityStatus {
  23 + ///未认证
  24 + case notCertified
  25 + ///已经认证
  26 + case haveBeenCertified
  27 +}
  28 +
21 29 class CNMetaCodeHomePageController:CNLiveBaseViewController, NewPagedFlowViewDelegate, NewPagedFlowViewDataSource, CNCustomIndexViewDelegate{
22 30  
  31 + ///添加认证View
  32 + lazy var addCertificationView: CNCertificationView = {
  33 + let addCertificationView = CNCertificationView(frame: self.view.bounds)
  34 +
  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
  47 + }()
23 48 ///上滑引导View
24 49 lazy var upSlideGuideView:CNHomePageGuideView = {
25 50 let upSlideGuideView = CNHomePageGuideView.init(frame: UIScreen.main.bounds)
... ... @@ -69,9 +94,12 @@ class CNMetaCodeHomePageController:CNLiveBaseViewController, NewPagedFlowViewDel
69 94  
70 95 ///NewPagedFlowView 开始滑动时的偏移量
71 96 private var beginOffset = 0.0
72   -
  97 + ///tabBar 的Y坐标位置
73 98 private var tabBarY:CGFloat = 0.0
74 99  
  100 + ///用户身份认证状态
  101 + private var identityStatus: UserIdentityStatus = .haveBeenCertified
  102 +
75 103 // MARK: - 懒加载
76 104 ///数据源
77 105 lazy var dataArray: NSMutableArray = {
... ... @@ -130,32 +158,25 @@ class CNMetaCodeHomePageController:CNLiveBaseViewController, NewPagedFlowViewDel
130 158  
131 159 self.topNavView.isHidden = true
132 160  
133   -
134   -//
135   -//
136   -// let maskView = UIView.init(frame: UIScreen.main.bounds)
137   -// maskView.backgroundColor = .black.withAlphaComponent(0.7)
138   -// maskView.isUserInteractionEnabled = false
139   -//
140   -// let path:UIBezierPath = UIBezierPath.init(rect: UIScreen.main.bounds)
141   -//
142   -// let W = KSreenWidth-50
143   -// let H = W*1.5
144   -// let rect = CGRectMake(25, (KSreenHeight-H)/2,W, H)
145   -//
146   -// let appendPath: UIBezierPath = UIBezierPath.init(roundedRect: rect, cornerRadius: 20)
147   -// path.append(appendPath.reversing())
148   -// let shapeLayer: CAShapeLayer = CAShapeLayer()
149   -// shapeLayer.path = path.cgPath;
150   -// maskView.layer.mask = shapeLayer;
151   -//
152   -// self.view.addSubview(maskView)
153   -
154 161 }
155 162 // MARK: - 添加UI
156 163 func setupUI(){
157 164 self.view.backgroundColor = KVCBackgroupColor
158 165 self.view.addSubview(self.backgroupView)
  166 +
  167 + switch self.identityStatus{
  168 +
  169 + case .notCertified:
  170 + self.view.addSubview(self.addCertificationView)
  171 + case .haveBeenCertified:
  172 + self.addPageView()
  173 + }
  174 +
  175 +
  176 + }
  177 +
  178 + ///添加主View
  179 + func addPageView(){
159 180 self.view.addSubview(self.pageFlowView)
160 181 self.pageFlowView.reloadData()
161 182  
... ... @@ -182,7 +203,6 @@ class CNMetaCodeHomePageController:CNLiveBaseViewController, NewPagedFlowViewDel
182 203 self.view.addSubview(self.upSlideGuideView)
183 204 self.view.addSubview(self.upSlideGifView)
184 205 }
185   -
186 206 }
187 207  
188 208 // MARK: - NewPagedFlowView代理
... ...
metaCode/Classes/Main/HomePage/View/CNCertificationView.swift 0 → 100644
  1 +//
  2 +// CNCertificationView.swift
  3 +// metaCode
  4 +//
  5 +// Created by daojian on 2023/6/12.
  6 +//
  7 +
  8 +import Foundation
  9 +
  10 +///身份认证View
  11 +class CNCertificationView : UIView{
  12 + ///添加身份点击事件回调
  13 + var addCertificationAction: closeBlock?
  14 +
  15 + lazy var contentView: UIView = {
  16 + let W = self.width-50
  17 + let H = W*1.5
  18 + let contentView = UIView.init(frame: CGRect(x: 25, y: KSreenHeight*0.16, width: W, height: H ))
  19 + contentView.backgroundColor = UIColor.white
  20 + contentView.clipsToBounds = true
  21 + contentView.layer.cornerRadius = 20
  22 +
  23 + return contentView
  24 +
  25 + }()
  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 + }()
  49 +
  50 + override init(frame: CGRect) {
  51 + super.init(frame: frame)
  52 + self.initUI()
  53 +
  54 + }
  55 +
  56 + required init?(coder: NSCoder) {
  57 + fatalError("init(coder:) has not been implemented")
  58 + }
  59 +
  60 + func initUI()
  61 + {
  62 + self.addSubview(self.contentView)
  63 + self.contentView.addSubview(self.addCerBtn)
  64 + self.contentView.addSubview(self.addCerBtnBottomTitle)
  65 + }
  66 +
  67 + @objc func addCerBtnAction(){
  68 +
  69 + if(self.addCertificationAction != nil){
  70 + self.addCertificationAction!()
  71 + }
  72 +
  73 + }
  74 +}
... ...
metaCode/Classes/Main/HomePage/View/CNCustomIndexView.swift
... ... @@ -142,6 +142,13 @@ class CNCustomIndexView:PGIndexBannerSubiew, UIScrollViewDelegate, WJColorChange
142 142 collectionView.backAction = {[weak self] in
143 143 self?.baseScrollView.setContentOffset(CGPoint(x: 0, y: (self!.baseScrollView.height)), animated: true)
144 144 self?.superScrollView?.isScrollEnabled = true
  145 +
  146 + let time = DispatchTime.now() + 0.5
  147 + DispatchQueue.main.asyncAfter(deadline:time, execute: DispatchWorkItem(block: {
  148 + //下滑提醒View回到初始位置
  149 + self?.topCollectMoneyRemindView.top = -((self?.topCollectMoneyRemindView.height)! + 50)
  150 + }))
  151 +
145 152 }
146 153 return collectionView
147 154 }()
... ...
metaCode/Classes/Main/HomePage/View/CNMainView.swift
... ... @@ -10,8 +10,8 @@ import YYCategories
10 10  
11 11 ///旋转动画时间
12 12 let KTransformAnimationTime:CGFloat = 0.75;
13   -///点击事件回调
14   -typealias closureBlock = ()->Void;
  13 +
  14 +
15 15  
16 16 ///正面View
17 17 class CNFrontMainView : UIView{
... ... @@ -105,7 +105,7 @@ class CNBackMainView : UIView{
105 105 bottomBackBtn.setTitleColor(UIColor("#333333"), for: .normal)
106 106 bottomBackBtn.setImage(UIImage(named: "homePage_backBtn_icon"), for: .normal)
107 107 bottomBackBtn.imageEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 8)
108   - bottomBackBtn.titleLabel?.font = UIFont.systemFont(ofSize: 15, weight: .regular)
  108 + bottomBackBtn.titleLabel?.font = UIFont.systemFont(ofSize: 15)
109 109  
110 110 bottomBackBtn.addTarget(self, action: #selector(tapAction), for: .touchUpInside)
111 111 return bottomBackBtn
... ... @@ -148,6 +148,7 @@ class CNMainView : UIView{
148 148 fatalError("init(coder:) has not been implemented")
149 149 }
150 150  
  151 + ///正面View
151 152 lazy var frontView:CNFrontMainView = {
152 153  
153 154 let frontView = CNFrontMainView.init(frame: self.bounds)
... ... @@ -157,6 +158,7 @@ class CNMainView : UIView{
157 158 return frontView
158 159 }()
159 160  
  161 + ///背面View
160 162 lazy var backView:CNBackMainView = {
161 163 let backView = CNBackMainView.init(frame: self.bounds)
162 164 backView.tapTransformAciton = { [weak self] in
... ... @@ -165,11 +167,15 @@ class CNMainView : UIView{
165 167 return backView
166 168 }()
167 169  
  170 +
  171 +
  172 +
168 173 func initUI()
169 174 {
170 175 self.addSubview(self.frontView)
171 176 self.addSubview(self.backView)
172 177  
  178 +
173 179 self.backView.isHidden = true;
174 180  
175 181 // self.layer.cornerRadius = 20;
... ...
metaCode/Classes/Other/AppDelegate.swift
... ... @@ -21,7 +21,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
21 21  
22 22 window = UIWindow.init(frame: UIScreen.main.bounds)
23 23 window?.backgroundColor = KVCBackgroupColor
24   - window?.rootViewController = UserInfoManager.shared.is_login ? CNLiveBaseTabBarViewController.init() : CNLiveLoginViewController.init()
  24 +// window?.rootViewController = UserInfoManager.shared.is_login ? CNLiveBaseTabBarViewController.init() : CNLiveLoginViewController.init()
  25 + window?.rootViewController = CNLiveBaseTabBarViewController.init()
25 26 window?.makeKeyAndVisible()
26 27  
27 28  
... ...
metaCode/Supporting Files/Assets.xcassets/Home/homePage_addCertification_icon.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "scale" : "1x"
  6 + },
  7 + {
  8 + "filename" : "添加@2x.png",
  9 + "idiom" : "universal",
  10 + "scale" : "2x"
  11 + },
  12 + {
  13 + "filename" : "添加@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_addCertification_icon.imageset/添加@2x.png 0 → 100644

54.8 KB

metaCode/Supporting Files/Assets.xcassets/Home/homePage_addCertification_icon.imageset/添加@3x.png 0 → 100644

114 KB