Commit 698c7dabd87f0a2cf387b44ed6d0c6943a116222
1 parent
5552beec
* [x] 数字简历页面-官方认证-数字资产页-官方认证-一排三个,➕放在最后一个
* [x] 数字简历页面-官方认证-数字资产页-官方认证-已审核的排序放在前面 * [x] 数字简历页面-官方认证-数字资产页-切换实名对象没有刷新页面数据
Showing
4 changed files
with
96 additions
and
45 deletions
metaCode/Classes/Main/HomePage/Controller/DigitalAuth/数字认证身份相关页面/CNLiveDigitalAssetsController.swift
| ... | ... | @@ -102,8 +102,8 @@ class CNLiveDigitalAssetsController:CNLiveBaseViewController, UITableViewDataSou |
| 102 | 102 | } |
| 103 | 103 | } |
| 104 | 104 | self!.dataArray.removeAllObjects() |
| 105 | - self!.dataArray.addObjects(from: listBaseModel.list) | |
| 106 | - self!.dataArray.add(MineAuthListModel()) | |
| 105 | + self!.dataArray.addObjects(from: arr) | |
| 106 | + self!.dataArray.add(MineAuthListModel())//加号 | |
| 107 | 107 | self!.tableView.reloadData() |
| 108 | 108 | } |
| 109 | 109 | |
| ... | ... | @@ -125,6 +125,9 @@ class CNLiveDigitalAssetsController:CNLiveBaseViewController, UITableViewDataSou |
| 125 | 125 | let cell = CNLiveDigitalFirstCell() |
| 126 | 126 | return cell |
| 127 | 127 | } |
| 128 | + cell.digitalFirstChangePersonBlock = { | |
| 129 | + self.loadData() | |
| 130 | + } | |
| 128 | 131 | return cell |
| 129 | 132 | }else if indexPath.row == 1{ |
| 130 | 133 | guard let cell = tableView.dequeueReusableCell(withIdentifier: kCNLiveDigitalSecCellIdentifier) as? CNLiveDigitalSecCell |
| ... | ... | @@ -151,7 +154,13 @@ class CNLiveDigitalAssetsController:CNLiveBaseViewController, UITableViewDataSou |
| 151 | 154 | if indexPath.row == 0{ |
| 152 | 155 | return adapt_length(length: 121+20) |
| 153 | 156 | }else if indexPath.row == 1{ |
| 154 | - return adapt_length(length: 152+15) | |
| 157 | + let cellH:CGFloat = adapt_length(length: 152+15) | |
| 158 | + if self.dataArray.count == 0{ | |
| 159 | + return cellH | |
| 160 | + }else{ | |
| 161 | + let hang:CGFloat = CGFloat((self.dataArray.count-1)/3+1) | |
| 162 | + return adapt_length(length: 53)+100*hang+15 | |
| 163 | + } | |
| 155 | 164 | }else{ |
| 156 | 165 | return 317+15 |
| 157 | 166 | } | ... | ... |
metaCode/Classes/Main/HomePage/View/DigitalAuthViews/数字资产cell/CNLiveDigitalFirstCell.swift
| ... | ... | @@ -10,8 +10,11 @@ import Kingfisher |
| 10 | 10 | import SnapKit |
| 11 | 11 | |
| 12 | 12 | //typealias SelectBlock = (_ currentCell: CNLiveDigitalAuthCell ,_ identitiesId:String) -> Void |
| 13 | +//刷新tableView | |
| 14 | +typealias DigitalFirstChangePersonBlock = () -> Void | |
| 15 | + | |
| 13 | 16 | class CNLiveDigitalFirstCell: UITableViewCell { |
| 14 | - | |
| 17 | + var digitalFirstChangePersonBlock:DigitalFirstChangePersonBlock? | |
| 15 | 18 | lazy var whiteView :UIView = { |
| 16 | 19 | let whiteView = UIView(frame: CGRect(x: 15, y:adapt_length(length: 20), width: KSreenWidth-30, height: adapt_length(length: 121))) |
| 17 | 20 | whiteView.backgroundColor = .white |
| ... | ... | @@ -213,6 +216,10 @@ class CNLiveDigitalFirstCell: UITableViewCell { |
| 213 | 216 | let (gender, age) = self.extractGenderAndAge(fromIDCardNumber: UserInfoManager.shared.userInfo.currentUser?.idNo ?? "") |
| 214 | 217 | let ageStr = String(format: "%d", age ?? 0) |
| 215 | 218 | self.phoneTitleLabel.text = gender+" | "+ageStr+"岁"+" | "+UserInfoManager.shared.userInfo.mobile |
| 219 | + //刷新数字资产页面 | |
| 220 | + if self.digitalFirstChangePersonBlock != nil{ | |
| 221 | + self.digitalFirstChangePersonBlock?() | |
| 222 | + } | |
| 216 | 223 | } |
| 217 | 224 | }) |
| 218 | 225 | } | ... | ... |
metaCode/Classes/Main/HomePage/View/DigitalAuthViews/数字资产cell/CNLiveDigitalSecCell.swift
| ... | ... | @@ -31,9 +31,10 @@ class CNLiveDigitalSecCell: UITableViewCell, UICollectionViewDelegate, UICollect |
| 31 | 31 | let kCNLiveDigitalSecCollectCellID = "kCNLiveDigitalSecCollectCellID" |
| 32 | 32 | lazy var threeCollectionView: UICollectionView = { |
| 33 | 33 | let layout = UICollectionViewFlowLayout() |
| 34 | - layout.itemSize = CGSizeMake(adapt_length(length: 60), adapt_length(length: 60+3+17)) | |
| 35 | - layout.minimumLineSpacing = (KSreenWidth-30-adapt_length(length: 60)*3-36)/2//22 | |
| 36 | - layout.scrollDirection = .horizontal | |
| 34 | + layout.itemSize = CGSizeMake(100, 100) | |
| 35 | + layout.minimumLineSpacing = 0//(KSreenWidth-30- 100*3-36)/2//22 | |
| 36 | + layout.minimumInteritemSpacing = 0 // 图标之间的间距 | |
| 37 | + layout.scrollDirection = .vertical | |
| 37 | 38 | let collectionView = UICollectionView(frame: .zero, collectionViewLayout: layout) |
| 38 | 39 | collectionView.delegate = self |
| 39 | 40 | collectionView.dataSource = self |
| ... | ... | @@ -41,7 +42,7 @@ class CNLiveDigitalSecCell: UITableViewCell, UICollectionViewDelegate, UICollect |
| 41 | 42 | collectionView.register(CNLiveDigitalSecCollectionCell.self, forCellWithReuseIdentifier: kCNLiveDigitalSecCollectCellID) |
| 42 | 43 | return collectionView |
| 43 | 44 | }() |
| 44 | - var currSeleIndex = 0 | |
| 45 | +// var currSeleIndex = 0 | |
| 45 | 46 | |
| 46 | 47 | var _digitalListModels : [MineAuthListModel]? |
| 47 | 48 | var digitalListModels : [MineAuthListModel]? { |
| ... | ... | @@ -60,6 +61,12 @@ class CNLiveDigitalSecCell: UITableViewCell, UICollectionViewDelegate, UICollect |
| 60 | 61 | self.backgroundColor = .clear |
| 61 | 62 | self.selectionStyle = .none |
| 62 | 63 | self.contentView.addSubview(self.whiteView) |
| 64 | + self.whiteView.snp.makeConstraints { make in | |
| 65 | + make.top.equalToSuperview().offset(15) | |
| 66 | + make.left.equalTo(15) | |
| 67 | + make.right.equalToSuperview().offset(-15) | |
| 68 | + make.bottom.equalToSuperview() | |
| 69 | + } | |
| 63 | 70 | self.whiteView.addSubview(self.myIdentityTitleLabel) |
| 64 | 71 | self.myIdentityTitleLabel.snp.makeConstraints { make in |
| 65 | 72 | make.top.equalToSuperview().offset(adapt_length(length: 15)) |
| ... | ... | @@ -68,9 +75,10 @@ class CNLiveDigitalSecCell: UITableViewCell, UICollectionViewDelegate, UICollect |
| 68 | 75 | |
| 69 | 76 | self.whiteView.addSubview(self.threeCollectionView) |
| 70 | 77 | self.threeCollectionView.snp.makeConstraints { make in |
| 71 | - make.left.right.equalToSuperview().offset(adapt_length(length: 18)) | |
| 78 | + make.left.equalToSuperview().offset(adapt_length(length: 18)) | |
| 72 | 79 | make.top.equalTo(adapt_length(length: 53)) |
| 73 | - make.height.equalTo(adapt_length(length: 60+7+17)) | |
| 80 | +// make.height.equalTo(adapt_length(length: 60+7+17)) | |
| 81 | + make.bottom.equalToSuperview() | |
| 74 | 82 | make.width.equalToSuperview().offset(adapt_length(length: -36)) |
| 75 | 83 | } |
| 76 | 84 | |
| ... | ... | @@ -136,18 +144,26 @@ class CNLiveDigitalSecCell: UITableViewCell, UICollectionViewDelegate, UICollect |
| 136 | 144 | func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { |
| 137 | 145 | let cell = collectionView.dequeueReusableCell(withReuseIdentifier: kCNLiveDigitalSecCollectCellID, for: indexPath) as! CNLiveDigitalSecCollectionCell |
| 138 | 146 | cell.authListModel = self.digitalListModels?[indexPath.row] |
| 139 | - if indexPath.row == currSeleIndex | |
| 140 | - {// | |
| 141 | - cell.cellIsSelected = true | |
| 142 | - }else{ | |
| 143 | - // | |
| 144 | - cell.cellIsSelected = false | |
| 145 | - } | |
| 147 | +// if indexPath.row == currSeleIndex | |
| 148 | +// {// | |
| 149 | +// cell.cellIsSelected = true | |
| 150 | +// }else{ | |
| 151 | +// // | |
| 152 | +// cell.cellIsSelected = false | |
| 153 | +// } | |
| 146 | 154 | return cell |
| 147 | 155 | } |
| 156 | + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { | |
| 157 | + // 假设图标高度为100 | |
| 158 | + let padding: CGFloat = 0//(KSreenWidth-30-100*3-36)/2//10 // 图标间的间距 | |
| 159 | + let numberOfItemsPerRow: CGFloat = 3 | |
| 160 | + let availableWidth = collectionView.bounds.width - (numberOfItemsPerRow - 1) * padding | |
| 161 | + let itemWidth = availableWidth / numberOfItemsPerRow | |
| 162 | + return CGSize(width: itemWidth, height: 100) // 假设图标高度为100 | |
| 163 | + } | |
| 148 | 164 | |
| 149 | 165 | func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { |
| 150 | - self.currSeleIndex = indexPath.row | |
| 166 | +// self.currSeleIndex = indexPath.row | |
| 151 | 167 | self.threeCollectionView.reloadData() |
| 152 | 168 | } |
| 153 | 169 | } | ... | ... |
metaCode/Classes/Main/HomePage/View/DigitalAuthViews/数字资产cell/CNLiveDigitalSecCollectionCell.swift
| ... | ... | @@ -7,6 +7,7 @@ |
| 7 | 7 | |
| 8 | 8 | import Foundation |
| 9 | 9 | import Kingfisher |
| 10 | +import SnapKit | |
| 10 | 11 | |
| 11 | 12 | class CNLiveDigitalSecCollectionCell: UICollectionViewCell { |
| 12 | 13 | |
| ... | ... | @@ -42,35 +43,34 @@ class CNLiveDigitalSecCollectionCell: UICollectionViewCell { |
| 42 | 43 | return titleLabel |
| 43 | 44 | }() |
| 44 | 45 | |
| 45 | - //是否选中 | |
| 46 | - var _cellIsSelected : Bool = false | |
| 47 | - var cellIsSelected : Bool { | |
| 48 | - get{ | |
| 49 | - _cellIsSelected | |
| 50 | - } | |
| 51 | - set{ | |
| 52 | - _cellIsSelected = newValue | |
| 53 | - | |
| 54 | - if _cellIsSelected == true{ | |
| 55 | - //选中 | |
| 56 | - self.iconImgView.layer.borderWidth = 1 | |
| 57 | - self.iconImgView.layer.borderColor = HexColor("#1961FE")?.cgColor | |
| 58 | - }else{ | |
| 59 | - //未选中 | |
| 60 | - self.iconImgView.layer.borderWidth = 0 | |
| 61 | - self.iconImgView.layer.borderColor = HexColor("#1961FE")?.cgColor | |
| 62 | - } | |
| 63 | - | |
| 64 | - | |
| 65 | -// self.rightIconImgView.isHidden = !_cellIsSelected | |
| 66 | - } | |
| 67 | - } | |
| 46 | +// //是否选中 | |
| 47 | +// var _cellIsSelected : Bool = false | |
| 48 | +// var cellIsSelected : Bool { | |
| 49 | +// get{ | |
| 50 | +// _cellIsSelected | |
| 51 | +// } | |
| 52 | +// set{ | |
| 53 | +// _cellIsSelected = newValue | |
| 54 | +// | |
| 55 | +// if _cellIsSelected == true{ | |
| 56 | +// //选中 | |
| 57 | +// self.iconImgView.layer.borderWidth = 1 | |
| 58 | +// self.iconImgView.layer.borderColor = HexColor("#1961FE")?.cgColor | |
| 59 | +// }else{ | |
| 60 | +// //未选中 | |
| 61 | +// self.iconImgView.layer.borderWidth = 0 | |
| 62 | +// self.iconImgView.layer.borderColor = HexColor("#1961FE")?.cgColor | |
| 63 | +// } | |
| 64 | +// | |
| 65 | +// | |
| 66 | +//// self.rightIconImgView.isHidden = !_cellIsSelected | |
| 67 | +// } | |
| 68 | +// } | |
| 68 | 69 | |
| 69 | 70 | lazy var titleLabel: UILabel = { |
| 70 | - let titleLabel = UILabel.init(frame: CGRectMake(0, self.iconImgView.bottom+8, 60, 17)) | |
| 71 | + let titleLabel = UILabel.init(frame: CGRectMake(0, self.iconImgView.bottom+8, 100, 17)) | |
| 71 | 72 | titleLabel.textColor = HexColor("#1961FE") |
| 72 | 73 | titleLabel.textAlignment = .center |
| 73 | - titleLabel.adjustsFontSizeToFitWidth = true | |
| 74 | 74 | titleLabel.font = Font_12 |
| 75 | 75 | return titleLabel |
| 76 | 76 | }() |
| ... | ... | @@ -83,14 +83,33 @@ class CNLiveDigitalSecCollectionCell: UICollectionViewCell { |
| 83 | 83 | return closeBtn |
| 84 | 84 | }() |
| 85 | 85 | |
| 86 | - | |
| 87 | 86 | override init(frame: CGRect) { |
| 88 | 87 | super.init(frame: frame) |
| 88 | + self.contentView.backgroundColor = .clear | |
| 89 | 89 | self.contentView.addSubview(self.iconImgView) |
| 90 | -// self.iconImgView.addSubview(self.rightIconImgView) | |
| 90 | + self.iconImgView.snp.makeConstraints { make in | |
| 91 | + make.top.equalToSuperview() | |
| 92 | + make.width.height.equalTo(60) | |
| 93 | + make.centerX.equalToSuperview() | |
| 94 | + } | |
| 91 | 95 | self.contentView.addSubview(self.titleLabel) |
| 96 | + self.titleLabel.snp.makeConstraints { make in | |
| 97 | + make.top.equalTo(self.iconImgView.snp.bottom).offset(8) | |
| 98 | + make.left.right.equalToSuperview() | |
| 99 | + } | |
| 92 | 100 | self.contentView.addSubview(self.addBtn) |
| 101 | + self.addBtn.snp.makeConstraints { make in | |
| 102 | + make.top.equalToSuperview() | |
| 103 | + make.width.height.equalTo(60) | |
| 104 | + make.centerX.equalToSuperview() | |
| 105 | + } | |
| 93 | 106 | self.contentView.addSubview(self.bottomTitleLabel) |
| 107 | + self.bottomTitleLabel.snp.makeConstraints { make in | |
| 108 | + make.top.equalTo(self.iconImgView.snp.bottom).offset(-16) | |
| 109 | + make.height.equalTo(16) | |
| 110 | + make.width.equalTo(60) | |
| 111 | + make.centerX.equalToSuperview() | |
| 112 | + } | |
| 94 | 113 | self.bottomTitleLabel.isHidden = true |
| 95 | 114 | } |
| 96 | 115 | ... | ... |