Commit 9e246ad126307e25794df2dc22d6b18f11a80b30

Authored by 张旭
1 parent 2e6e128c

已认证卡片逻辑

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 */; };
... ... @@ -110,6 +111,7 @@
110 111 /* Begin PBXFileReference section */
111 112 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>"; };
112 113 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>"; };
  114 + 19F1C2322AB5728B0083D06C /* CNIDCardView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNIDCardView.swift; sourceTree = "<group>"; };
113 115 54E09C540E13D78166D71395 /* Pods_metaCodeTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_metaCodeTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
114 116 63D879B49B1E42F1584DD75E /* Pods_metaCode_metaCodeUITests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_metaCode_metaCodeUITests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
115 117 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>"; };
... ... @@ -532,6 +534,7 @@
532 534 7C4931302A2F142F000E44B4 /* CNHomePageBackgroupView.swift */,
533 535 7C4931372A307BDB000E44B4 /* CNHomePageGuideView.swift */,
534 536 7C27032F2A36CBE30061EC50 /* CNCertificationView.swift */,
  537 + 19F1C2322AB5728B0083D06C /* CNIDCardView.swift */,
535 538 );
536 539 name = View;
537 540 path = HomePage/View;
... ... @@ -848,6 +851,7 @@
848 851 isa = PBXSourcesBuildPhase;
849 852 buildActionMask = 2147483647;
850 853 files = (
  854 + 19F1C2332AB5728B0083D06C /* CNIDCardView.swift in Sources */,
851 855 7CD675292A270F6A008354C1 /* WJColorChange.m in Sources */,
852 856 79F4B11C2A33036E00993C03 /* CNLiveMineInfoAlertView.swift in Sources */,
853 857 796398942A260C0100D045EB /* AppDelegate.swift in Sources */,
... ...
metaCode/Classes/Main/HomePage/View/CNDownSlideView.swift
... ... @@ -54,7 +54,7 @@ class CNDownSlideView:UIView{
54 54 }
55 55 set{
56 56 _url = newValue!
57   - _url = "https://www.baidu.com"
  57 +// _url = "https://www.baidu.com"
58 58 if (_url != ""){
59 59 let webUrl: URL! = URL.init(string: _url!)
60 60 webView.load(URLRequest.init(url:webUrl))
... ...
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
... ...
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
... ... @@ -10,8 +10,6 @@ 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 ///点击反转事件
... ... @@ -28,12 +26,7 @@ class CNFrontMainView : UIView{
28 26 fatalError("init(coder:) has not been implemented")
29 27 }
30 28  
31   - //接口失败,无网络
32   -// lazy var errorView: UIView = {
33   -//
34   -// }()
35   -
36   - //视图总容器
  29 + ///视图总容器
37 30 lazy var frontContentView : UIView = {
38 31  
39 32 let frontContentView = UIView.init(frame: CGRect(x: 0, y: 0, width: self.width, height: self.height ))
... ... @@ -44,6 +37,14 @@ class CNFrontMainView : UIView{
44 37 return frontContentView
45 38 }()
46 39  
  40 + /// 已认证-身份卡片
  41 + lazy var iDCardView:CNIDCardView = {
  42 +
  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
47 48 lazy var textView: UITextView = {
48 49 let textView = UITextView.init()
49 50  
... ... @@ -59,21 +60,7 @@ class CNFrontMainView : UIView{
59 60 return textView
60 61 }()
61 62  
62   -// lazy var imageView:UIImageView = {
63   -//
64   -// let tempImageView:UIImageView = UIImageView(frame: CGRect(x: 0, y: 0, width: self.width, height: self.width * 0.7))
65   -// tempImageView.image = UIImage(named: "homePage_zhongguorenming_bank")
66   -//
67   -// let path : UIBezierPath = UIBezierPath.init(roundedRect: tempImageView.bounds, byRoundingCorners: [.topLeft, .topRight], cornerRadii: CGSize(width: 20, height: 20))
68   -//
69   -// let maskLayer = CAShapeLayer()
70   -// maskLayer.frame = tempImageView.bounds
71   -// maskLayer.path = path.cgPath
72   -// tempImageView.layer.mask = maskLayer
73   -//
74   -// return tempImageView
75   -// }()
76   -
  63 + ///点击添加身份 按钮
77 64 lazy var addStandBtn: UIButton = {
78 65 let addStandBtn = UIButton(type: .custom)
79 66 addStandBtn.clipsToBounds = true
... ... @@ -86,19 +73,13 @@ class CNFrontMainView : UIView{
86 73 return addStandBtn
87 74 }()
88 75  
89   - //前置视图容器
  76 + ///前置视图容器
90 77 lazy var contentView : UIView = {
91 78  
92 79 let contentView = UIView.init(frame: CGRect(x: 0, y: 0, width: self.width, height: self.height ))
93 80 contentView.backgroundColor = UIColor.white
94 81 contentView.clipsToBounds = true
95 82 contentView.layer.cornerRadius = 20
96   -
97   -// let W = contentView.width - 40
98   -// let imageView = UIImageView.init(frame: CGRect(x: 20, y: 25, width: W, height: W*0.63))
99   -// imageView.image = UIImage.init(named: "homePage_mainView_front");
100   -// contentView.addSubview(imageView)
101   -
102 83 contentView.addSubview(self.addStandBtn)
103 84 addStandBtn.snp.makeConstraints { make in
104 85 make.centerX.equalToSuperview()
... ... @@ -126,34 +107,46 @@ class CNFrontMainView : UIView{
126 107 _idModel
127 108 }
128 109 set{
  110 + _idModel = newValue
129 111 let auth = newValue!.auth
130 112 if(auth == true){
131 113 //已认证身份
132 114 //显示证件View
133 115 print("已认证身份")
134   -// self.imageView.isHidden = false
135   - self.textView.isHidden = true
  116 + iDCardView.isHidden = false
  117 + iDCardView.idModel = newValue!
  118 + contentView.isHidden = true
  119 +
136 120 }else
137 121 {//未认证身份
138   -// self.imageView.isHidden = true
  122 + iDCardView.isHidden = true
139 123 //显示textview 添加身份
140   - self.textView.isHidden = false
141   - self.textView.text = newValue!.description
  124 + contentView.isHidden = false
  125 + textView.text = newValue!.description
142 126 addStandBtn.backgroundColor = HexColor(newValue!.backgroundColor)
143 127 textView.backgroundColor = HexColor(newValue!.backgroundColor, alpha: 0.1)
144 128 }
145   - _idModel = newValue
146   - }
147   -
  129 + }
148 130 }
149 131  
150 132 func initUI()
151 133 {
152 134 self.addSubview(self.frontContentView)
153 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 + }
154 147 }
155 148  
156   - // MARK: - <##>按钮点击事件
  149 + // MARK: -按钮点击事件
157 150 @objc func tapAction(){
158 151 tapTransformAciton!()
159 152 }
... ...
metaCode/Classes/Main/MinePage/ViewModel/CNLiveMineBaseModel.swift
... ... @@ -188,14 +188,17 @@ class MineStandInfoBaseModel: BaseModel {
188 188  
189 189 class MineStandInfoModel: BaseModel {
190 190 var authInfoId: Int = 0
191   - var name: String?
192   - var inputType: Int = 0//1文本输入 2数字输入 3下拉选择 4后台生成时间 5后台生成编码 6头像类型
193 191 var sort: Int = 0
  192 + var name: String?//卡片标签
  193 + var inputType: Int = 0//1文本输入 2数字输入 3下拉选择 4后台生成时间 5后台生成编码 6头像类型
194 194 var nonEmpty: Bool = false
  195 + var length: Int = 10
  196 + var children = [MineStandInfoModel]()
  197 + var userInfo: String? = ""//卡片标签的对应值
195 198 var input: Bool = false
196 199 var show: Bool = false
197 200 var value: String? = ""//自己定义的值
198   - var children = [MineStandInfoModel]()
  201 +
199 202 }
200 203  
201 204  
... ...
metaCode/Classes/Main/MinePage/ViewModel/CNLiveMineViewModel.swift
... ... @@ -413,9 +413,9 @@ class CNLiveMineViewModel: NSObject {
413 413 let newsModel = dictionaryToModel(resp as! [String : Any], MineStandInfoBaseModel.self,"data") as! MineStandInfoBaseModel
414 414 let tempArray = NSMutableArray()
415 415 for authinfo in newsModel.authInfos {
416   - if authinfo.input {
  416 +// if authinfo.input {
417 417 tempArray.add(authinfo)
418   - }
  418 +// }
419 419 }
420 420 resultBlock(tempArray,.success)
421 421 } 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