Commit 24983a5f9c25072fe8a28821a17b9e2423a98847

Authored by liushiyu
1 parent c68704b0

提交我的界面添加审核失败界面

Showing 15 changed files with 239 additions and 31 deletions
metaCode.xcodeproj/project.pbxproj
@@ -52,6 +52,7 @@ @@ -52,6 +52,7 @@
52 798A44FF2A30A0A800815935 /* CNLiveInputFeedBackViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 798A44FE2A30A0A800815935 /* CNLiveInputFeedBackViewController.swift */; }; 52 798A44FF2A30A0A800815935 /* CNLiveInputFeedBackViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 798A44FE2A30A0A800815935 /* CNLiveInputFeedBackViewController.swift */; };
53 79A68C4A2A26E6CE00DC3B43 /* (null) in Sources */ = {isa = PBXBuildFile; }; 53 79A68C4A2A26E6CE00DC3B43 /* (null) in Sources */ = {isa = PBXBuildFile; };
54 79A68C4C2A26EA6000DC3B43 /* (null) in Sources */ = {isa = PBXBuildFile; }; 54 79A68C4C2A26EA6000DC3B43 /* (null) in Sources */ = {isa = PBXBuildFile; };
  55 + 79BA085D2AB18E8300D01875 /* CNLiveSaveAuthDataSourceDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79BA085C2AB18E8300D01875 /* CNLiveSaveAuthDataSourceDB.swift */; };
55 79F4B1162A32B96B00993C03 /* CNLiveMineInfoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79F4B1152A32B96B00993C03 /* CNLiveMineInfoViewController.swift */; }; 56 79F4B1162A32B96B00993C03 /* CNLiveMineInfoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79F4B1152A32B96B00993C03 /* CNLiveMineInfoViewController.swift */; };
56 79F4B11A2A32F21400993C03 /* CNLiveMineNickViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79F4B1192A32F21400993C03 /* CNLiveMineNickViewController.swift */; }; 57 79F4B11A2A32F21400993C03 /* CNLiveMineNickViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79F4B1192A32F21400993C03 /* CNLiveMineNickViewController.swift */; };
57 79F4B11C2A33036E00993C03 /* CNLiveMineInfoAlertView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79F4B11B2A33036E00993C03 /* CNLiveMineInfoAlertView.swift */; }; 58 79F4B11C2A33036E00993C03 /* CNLiveMineInfoAlertView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79F4B11B2A33036E00993C03 /* CNLiveMineInfoAlertView.swift */; };
@@ -155,6 +156,7 @@ @@ -155,6 +156,7 @@
155 798A44FC2A309EBA00815935 /* CNLiveTypeFeedBackViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveTypeFeedBackViewController.swift; sourceTree = "<group>"; }; 156 798A44FC2A309EBA00815935 /* CNLiveTypeFeedBackViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveTypeFeedBackViewController.swift; sourceTree = "<group>"; };
156 798A44FE2A30A0A800815935 /* CNLiveInputFeedBackViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveInputFeedBackViewController.swift; sourceTree = "<group>"; }; 157 798A44FE2A30A0A800815935 /* CNLiveInputFeedBackViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveInputFeedBackViewController.swift; sourceTree = "<group>"; };
157 79A68C512A26F59C00DC3B43 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = metaCode/Info.plist; sourceTree = "<group>"; }; 158 79A68C512A26F59C00DC3B43 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = metaCode/Info.plist; sourceTree = "<group>"; };
  159 + 79BA085C2AB18E8300D01875 /* CNLiveSaveAuthDataSourceDB.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveSaveAuthDataSourceDB.swift; sourceTree = "<group>"; };
158 79F4B1152A32B96B00993C03 /* CNLiveMineInfoViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineInfoViewController.swift; sourceTree = "<group>"; }; 160 79F4B1152A32B96B00993C03 /* CNLiveMineInfoViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineInfoViewController.swift; sourceTree = "<group>"; };
159 79F4B1192A32F21400993C03 /* CNLiveMineNickViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineNickViewController.swift; sourceTree = "<group>"; }; 161 79F4B1192A32F21400993C03 /* CNLiveMineNickViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineNickViewController.swift; sourceTree = "<group>"; };
160 79F4B11B2A33036E00993C03 /* CNLiveMineInfoAlertView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineInfoAlertView.swift; sourceTree = "<group>"; }; 162 79F4B11B2A33036E00993C03 /* CNLiveMineInfoAlertView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineInfoAlertView.swift; sourceTree = "<group>"; };
@@ -346,6 +348,7 @@ @@ -346,6 +348,7 @@
346 isa = PBXGroup; 348 isa = PBXGroup;
347 children = ( 349 children = (
348 7C7C62F52A4D72E9007A912E /* CNLiveIdentityDB.swift */, 350 7C7C62F52A4D72E9007A912E /* CNLiveIdentityDB.swift */,
  351 + 79BA085C2AB18E8300D01875 /* CNLiveSaveAuthDataSourceDB.swift */,
349 ); 352 );
350 path = Database; 353 path = Database;
351 sourceTree = "<group>"; 354 sourceTree = "<group>";
@@ -853,6 +856,7 @@ @@ -853,6 +856,7 @@
853 7963989D2A260E6200D045EB /* CNLiveBaseViewController.swift in Sources */, 856 7963989D2A260E6200D045EB /* CNLiveBaseViewController.swift in Sources */,
854 798A44FB2A30999900815935 /* CNLiveAlertTool.swift in Sources */, 857 798A44FB2A30999900815935 /* CNLiveAlertTool.swift in Sources */,
855 790D01A52A2DF65E00C5978D /* CNLiveLoginPickerView.swift in Sources */, 858 790D01A52A2DF65E00C5978D /* CNLiveLoginPickerView.swift in Sources */,
  859 + 79BA085D2AB18E8300D01875 /* CNLiveSaveAuthDataSourceDB.swift in Sources */,
856 79282A3C2A2EDC2500B5F8CF /* NSString+CNLiveExtensions.swift in Sources */, 860 79282A3C2A2EDC2500B5F8CF /* NSString+CNLiveExtensions.swift in Sources */,
857 790B1FB82A41B6A60074CF00 /* CNLiveMineMessageViewController.swift in Sources */, 861 790B1FB82A41B6A60074CF00 /* CNLiveMineMessageViewController.swift in Sources */,
858 798A44F22A30674200815935 /* CNLiveMineSubBodyListView.swift in Sources */, 862 798A44F22A30674200815935 /* CNLiveMineSubBodyListView.swift in Sources */,
metaCode/Classes/Common/Util/CNLiveCommonBaseModel.swift
@@ -8,10 +8,21 @@ @@ -8,10 +8,21 @@
8 import Foundation 8 import Foundation
9 import UIKit 9 import UIKit
10 import HandyJSON 10 import HandyJSON
  11 +import WCDBSwift
11 12
12 class BaseModel: HandyJSON { 13 class BaseModel: HandyJSON {
13 14
14 - required init() {} 15 + var database:Database
  16 +
  17 + required init() {
  18 + //数据库地址
  19 + let filePath = NSHomeDirectory() + "/Documents/DB/CNLiveBaseModel.db"
  20 + database = Database(at: filePath)
  21 +
  22 +// super.init()
  23 +
  24 +// try database.create(table: NSStringFromClass(self), of: BaseModel.self)
  25 + }
15 26
16 func mapping(mapper: HelpingMapper) { 27 func mapping(mapper: HelpingMapper) {
17 28
metaCode/Classes/Config/Database/CNLiveSaveAuthDataSourceDB.swift 0 → 100644
  1 +//
  2 +// CNLiveSaveAuthDataSourceDB.swift
  3 +// metaCode
  4 +//
  5 +// Created by open on 2023/9/13.
  6 +//
  7 +
  8 +import Foundation
  9 +import WCDBSwift
  10 +
  11 +///身份认证表名
  12 +let CNLiveAuthListTableName = "CNLiveAuthListTable"
  13 +
  14 +
  15 +class CNLiveAuthListDB : NSObject{
  16 +
  17 + ///数据库
  18 + var database:Database
  19 +
  20 + //重新init方法为私有,不让外部调用
  21 + override init() {
  22 +
  23 + //数据库地址
  24 + let filePath = NSHomeDirectory() + "/Documents/DB/CNLiveAuthListTable.db"
  25 + database = Database(at: filePath)
  26 +
  27 + super.init()
  28 + do {
  29 + try database.create(table: CNLiveAuthListTableName, of: MineAuthListModel.self)
  30 + } catch {
  31 + print("创建失败")
  32 + }
  33 + }
  34 +}
metaCode/Classes/Main/MinePage/Controller/CNLiveMineAddInfoViewController.swift
@@ -40,14 +40,6 @@ class CNLiveMineAddInfoViewController : CNLiveBaseViewController, UITableViewDel @@ -40,14 +40,6 @@ class CNLiveMineAddInfoViewController : CNLiveBaseViewController, UITableViewDel
40 40
41 lazy var dataArray: NSMutableArray = { 41 lazy var dataArray: NSMutableArray = {
42 var dataArray = NSMutableArray() 42 var dataArray = NSMutableArray()
43 - if _show_type == .info {  
44 - dataArray.add(["image":"mine_header_icon_defult_ava","name":"志愿者身份","number":"证件编号:410800111127954"])  
45 - dataArray.add(["image":"mine_header_icon_defult_ava","name":"退伍军人身份","number":"证件编号:410800111127912"])  
46 - dataArray.add(["image":"mine_header_icon_defult_ava","name":"退伍军人身份","number":"证件编号:410800111127934"])  
47 - dataArray.add(["image":"mine_header_icon_defult_ava","name":"退伍军人身份","number":"证件编号:410800111127956"])  
48 - dataArray.add(["image":"mine_header_icon_defult_ava","name":"退伍军人身份","number":"证件编号:410800111127967"])  
49 - dataArray.add(["image":"mine_header_icon_defult_ava","name":"退伍军人身份","number":"证件编号:410800111127978"])  
50 - }  
51 return dataArray 43 return dataArray
52 }() 44 }()
53 45
@@ -105,6 +97,9 @@ class CNLiveMineAddInfoViewController : CNLiveBaseViewController, UITableViewDel @@ -105,6 +97,9 @@ class CNLiveMineAddInfoViewController : CNLiveBaseViewController, UITableViewDel
105 case .none: 97 case .none:
106 break 98 break
107 } 99 }
  100 + if _show_type == .info || _show_type == .add {
  101 + showLoading(message: "")
  102 + }
108 loadData() 103 loadData()
109 addRefreshView() 104 addRefreshView()
110 navigationBarHidden = false 105 navigationBarHidden = false
@@ -114,7 +109,6 @@ class CNLiveMineAddInfoViewController : CNLiveBaseViewController, UITableViewDel @@ -114,7 +109,6 @@ class CNLiveMineAddInfoViewController : CNLiveBaseViewController, UITableViewDel
114 make.left.right.bottom.equalToSuperview() 109 make.left.right.bottom.equalToSuperview()
115 } 110 }
116 } 111 }
117 -  
118 112
119 private func loadData() { 113 private func loadData() {
120 if _show_type == .add { 114 if _show_type == .add {
@@ -153,10 +147,35 @@ class CNLiveMineAddInfoViewController : CNLiveBaseViewController, UITableViewDel @@ -153,10 +147,35 @@ class CNLiveMineAddInfoViewController : CNLiveBaseViewController, UITableViewDel
153 } 147 }
154 } 148 }
155 } 149 }
  150 + if _show_type == .info {
  151 + CNLiveMineViewModel.requestsGETAuthInfoList(page: pageNum) { [weak self] result, respStatue in
  152 + if respStatue == .success {
  153 + let listBaseModel = result as! MineAuthListBaseModel
  154 + if listBaseModel.pageNum == 1 {
  155 + self!.dataArray.removeAllObjects()
  156 + self!.dataArray.addObjects(from: (result as! MineAuthListBaseModel).list)
  157 + self!.tableView.reloadData()
  158 + self!.tableView.mj_header?.endRefreshing()
  159 + self!.tableView.mj_footer?.endRefreshing()
  160 + }
  161 + if listBaseModel.total == listBaseModel.pageNum {
  162 + self!.tableView.mj_footer?.endRefreshing()
  163 + self!.tableView.mj_footer?.endRefreshingWithNoMoreData()
  164 + self!.tableView.reloadData()
  165 + }
  166 + }else if (respStatue == .noNetwork) {
  167 + self!.network_type = .noNetwork
  168 + self!.tableView.reloadEmptyDataSet()
  169 + } else {
  170 + self!.network_type = .failed
  171 + self!.tableView.reloadEmptyDataSet()
  172 + }
  173 + }
  174 + }
156 } 175 }
157 176
158 private func addRefreshView() { 177 private func addRefreshView() {
159 - if _show_type == .add { 178 + if _show_type == .add || _show_type == .info {
160 tableView.mj_header = MJRefreshNormalHeader.init(refreshingBlock: {[weak self] in 179 tableView.mj_header = MJRefreshNormalHeader.init(refreshingBlock: {[weak self] in
161 self!.pageNum = 1 180 self!.pageNum = 1
162 self!.loadData() 181 self!.loadData()
@@ -259,8 +278,8 @@ extension CNLiveMineAddInfoViewController { @@ -259,8 +278,8 @@ extension CNLiveMineAddInfoViewController {
259 guard let cell = tableView.dequeueReusableCell(withIdentifier: kCNLiveMineStandInfoTableViewIdentifier) as? MineStandInfoTableViewCell else { 278 guard let cell = tableView.dequeueReusableCell(withIdentifier: kCNLiveMineStandInfoTableViewIdentifier) as? MineStandInfoTableViewCell else {
260 return MineStandInfoTableViewCell() 279 return MineStandInfoTableViewCell()
261 } 280 }
262 - let dict = dataArray[indexPath.row] as! Dictionary<String, Any>  
263 - cell.setupWithDataSource(icon: dict["image"] as! String, name: dict["name"] as! String,number: dict["number"] as! String) 281 + let authModel = dataArray[indexPath.row] as! MineAuthListModel
  282 + cell.setupWithDataSource(icon: authModel.icon!, name: authModel.name!,number: "\(authModel.code)")
264 cell.userInteractionEnabledWhileDragging = false 283 cell.userInteractionEnabledWhileDragging = false
265 return cell 284 return cell
266 } 285 }
@@ -299,17 +318,7 @@ extension CNLiveMineAddInfoViewController { @@ -299,17 +318,7 @@ extension CNLiveMineAddInfoViewController {
299 func tableView(_ tableView: UITableView, moveRowAt sourceIndexPath: IndexPath, 318 func tableView(_ tableView: UITableView, moveRowAt sourceIndexPath: IndexPath,
300 to destinationIndexPath: IndexPath) { 319 to destinationIndexPath: IndexPath) {
301 objc_sync_enter(self) 320 objc_sync_enter(self)
302 - print("交换之前===>\(dataArray)")  
303 swap(&dataArray[sourceIndexPath.row], &dataArray[destinationIndexPath.row]) 321 swap(&dataArray[sourceIndexPath.row], &dataArray[destinationIndexPath.row])
304 - print("交换之后===>\(dataArray)")  
305 -// let dict: Dictionary = dataArray[sourceIndexPath.row] as! Dictionary<String, Any>  
306 -// dataArray.remove(sourceIndexPath.row)  
307 -// if destinationIndexPath.row > dataArray.count {  
308 -// dataArray.append(dict)  
309 -// } else {  
310 -// dataArray.insert(dict, at: destinationIndexPath.row)  
311 -// }  
312 objc_sync_exit(self) 322 objc_sync_exit(self)
313 -// tableView.reloadData()  
314 } 323 }
315 } 324 }
metaCode/Classes/Main/MinePage/Controller/CNLiveMineAuthResultViewController.swift
@@ -7,6 +7,11 @@ @@ -7,6 +7,11 @@
7 7
8 import Foundation 8 import Foundation
9 9
  10 +enum CNLiveMineAuthResultShowType {
  11 + case detail//认证身份详情界面
  12 + case result_success//身份信息结果页成功
  13 + case result_failer//身份信息结果页失败
  14 +}
10 15
11 class CNLiveMineAuthResultViewController: CNLiveBaseViewController { 16 class CNLiveMineAuthResultViewController: CNLiveBaseViewController {
12 17
@@ -14,7 +19,8 @@ class CNLiveMineAuthResultViewController: CNLiveBaseViewController { @@ -14,7 +19,8 @@ class CNLiveMineAuthResultViewController: CNLiveBaseViewController {
14 let mainView = UIImageView() 19 let mainView = UIImageView()
15 mainView.backgroundColor = .white 20 mainView.backgroundColor = .white
16 mainView.contentMode = .scaleToFill 21 mainView.contentMode = .scaleToFill
17 - mainView.image = UIImage(named: "mIne_auth_result_header_icon") 22 + mainView.isHidden = !(_show_type == .result_success || _show_type == .result_failer)
  23 + mainView.image = UIImage(named: (_show_type == .result_success ? "mine_auth_result_header_success" : "mine_auth_result_header_failer"))
18 return mainView 24 return mainView
19 }() 25 }()
20 26
@@ -48,9 +54,11 @@ class CNLiveMineAuthResultViewController: CNLiveBaseViewController { @@ -48,9 +54,11 @@ class CNLiveMineAuthResultViewController: CNLiveBaseViewController {
48 }() 54 }()
49 55
50 var _listModel:StandListModel! 56 var _listModel:StandListModel!
51 - init(listModel:StandListModel) { 57 + var _show_type:CNLiveMineAuthResultShowType!
  58 + init(listModel:StandListModel,show_type:CNLiveMineAuthResultShowType) {
52 super.init(nibName:nil, bundle:nil) 59 super.init(nibName:nil, bundle:nil)
53 _listModel = listModel 60 _listModel = listModel
  61 + _show_type = show_type
54 } 62 }
55 63
56 required init?(coder: NSCoder) { 64 required init?(coder: NSCoder) {
@@ -107,6 +115,14 @@ class CNLiveMineAuthResultViewController: CNLiveBaseViewController { @@ -107,6 +115,14 @@ class CNLiveMineAuthResultViewController: CNLiveBaseViewController {
107 } 115 }
108 116
109 @objc func sendInfoActionMothod() { 117 @objc func sendInfoActionMothod() {
110 - 118 + if _show_type == .result_failer || _show_type == .result_success {
  119 + let tempArray = NSMutableArray.init()
  120 + self.navigationController?.viewControllers.forEach({ item in
  121 + if (item.isKind(of: NSClassFromString("CNLiveMineInputViewController")!)) {
  122 + tempArray.remove(item)
  123 + }
  124 + })
  125 + self.navigationController?.viewControllers = tempArray as! [CNLiveBaseViewController]
  126 + }
111 } 127 }
112 } 128 }
metaCode/Classes/Main/MinePage/Controller/CNLiveMineInputViewController.swift
@@ -106,7 +106,7 @@ class CNLiveMineInputViewController : CNLiveBaseViewController, UITableViewDeleg @@ -106,7 +106,7 @@ class CNLiveMineInputViewController : CNLiveBaseViewController, UITableViewDeleg
106 if respStatue == .success { 106 if respStatue == .success {
107 showMessage(message: "上传成功") 107 showMessage(message: "上传成功")
108 DispatchQueue.main.asyncAfter(deadline: .now()+1) { [self] in 108 DispatchQueue.main.asyncAfter(deadline: .now()+1) { [self] in
109 - self.navigationController?.pushViewController(CNLiveMineAuthResultViewController.init(listModel: _listModel), animated: true) 109 + self.navigationController?.pushViewController(CNLiveMineAuthResultViewController.init(listModel: _listModel,show_type: .result_success), animated: true)
110 } 110 }
111 } 111 }
112 } 112 }
metaCode/Classes/Main/MinePage/View/CNLiveMineSubBodyListView.swift
@@ -155,7 +155,7 @@ class MineStandInfoTableViewCell: UITableViewCell { @@ -155,7 +155,7 @@ class MineStandInfoTableViewCell: UITableViewCell {
155 }() 155 }()
156 156
157 public func setupWithDataSource(icon: String, name: String,number: String) { 157 public func setupWithDataSource(icon: String, name: String,number: String) {
158 - iconView.image = UIImage(named: icon) 158 + iconView.kf.setImage(with: URL(string: icon), placeholder: UIImage.imageWithColor(color: HexColor("#f9f9f9")!, size: CGSize(width: 50, height: 50)))
159 titleLabel.text = name 159 titleLabel.text = name
160 numberLabel.text = number 160 numberLabel.text = number
161 } 161 }
metaCode/Classes/Main/MinePage/ViewModel/CNLiveMineBaseModel.swift
@@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
7 7
8 import Foundation 8 import Foundation
9 import HandyJSON 9 import HandyJSON
10 - 10 +import WCDBSwift
11 11
12 class UpdateInfoModel: BaseModel { 12 class UpdateInfoModel: BaseModel {
13 13
@@ -175,7 +175,7 @@ class MineStandInfoBaseModel: BaseModel { @@ -175,7 +175,7 @@ class MineStandInfoBaseModel: BaseModel {
175 class MineStandInfoModel: BaseModel { 175 class MineStandInfoModel: BaseModel {
176 var authInfoId: Int = 0 176 var authInfoId: Int = 0
177 var name: String? 177 var name: String?
178 - var inputType: Int = 0//1 文本输入 2数字输入 3下拉选择 4后台生成时间 5后台生成编码 178 + var inputType: Int = 0//1 文本输入 2数字输入 3下拉选择 4后台生成时间 5后台生成编码 6头像类型
179 var sort: Int = 0 179 var sort: Int = 0
180 var nonEmpty: Bool = false 180 var nonEmpty: Bool = false
181 var input: Bool = false 181 var input: Bool = false
@@ -183,3 +183,60 @@ class MineStandInfoModel: BaseModel { @@ -183,3 +183,60 @@ class MineStandInfoModel: BaseModel {
183 var value: String? = ""//自己定义的值 183 var value: String? = ""//自己定义的值
184 var children = [MineStandInfoModel]() 184 var children = [MineStandInfoModel]()
185 } 185 }
  186 +
  187 +
  188 +class MineAuthListBaseModel: BaseModel {
  189 + required init() {}
  190 +
  191 + var prePage: Int = 0
  192 + var pageSize: Int = 0
  193 + var startRow: Int = 0
  194 + var navigateLastPage: Int = 0
  195 + var firstPage: Int = 0
  196 + var nextPage: Int = 0
  197 + var size: Int = 0
  198 + var endRow: Int = 0
  199 + var isLastPage: Bool = false
  200 + var hasNextPage: Bool = false
  201 + var navigateFirstPage: Int = 0
  202 + var lastPage: Int = 0
  203 + var total: Int = 0
  204 + var list = [MineAuthListModel]()
  205 + var navigatepageNums = [Int]()
  206 + var isFirstPage: Bool = false
  207 + var hasPreviousPage: Bool = false
  208 + var navigatePages: Int = 0
  209 + var pageNum: Int = 0
  210 + var pages: Int = 0
  211 +}
  212 +
  213 +final class MineAuthListModel: BaseModel, TableCodable {
  214 +
  215 + required init() {}
  216 +
  217 + var cardImg: String? = ""
  218 + var name: String? = ""
  219 + var icon: String? = ""
  220 + var authTime: Int = 0
  221 + var code: Int = 0
  222 + var identityId: Int = 0
  223 + var userStatus: Int = 0
  224 +
  225 + enum CodingKeys: String, CodingTableKey {
  226 + typealias Root = MineAuthListModel
  227 + static let objectRelationalMapping = TableBinding(CodingKeys.self){
  228 + //设置表的主键key为id,用来区分数据唯一性, 如果id为int类型,可以按实现按顺序递增
  229 + BindColumnConstraint(identityId, isPrimary: true)
  230 + }
  231 + case identityId //不修改数据库字段名,和属性名保持一直
  232 + case name //不修改数据库字段名,和属性名保持一直
  233 + case icon
  234 + case cardImg
  235 + case authTime
  236 + case code
  237 + case userStatus
  238 + }
  239 +}
  240 +
  241 +
  242 +
metaCode/Classes/Main/MinePage/ViewModel/CNLiveMineViewModel.swift
@@ -25,6 +25,12 @@ enum CNLiveMineResponseType { @@ -25,6 +25,12 @@ enum CNLiveMineResponseType {
25 case noNetwork 25 case noNetwork
26 case unkonw 26 case unkonw
27 } 27 }
  28 +
  29 +enum CNLiveMineSortType {
  30 + case homepage //主页
  31 + case authlist //我的身份信息列表界面
  32 + case minelist //我的界面->我的身份
  33 +}
28 typealias resultBlock = (_ type: CNLiveMineRequestType,_ result: Bool) -> Void 34 typealias resultBlock = (_ type: CNLiveMineRequestType,_ result: Bool) -> Void
29 typealias resultNewsBlock = (_ result: Any,_ respStatue :CNLiveMineResponseType) -> Void 35 typealias resultNewsBlock = (_ result: Any,_ respStatue :CNLiveMineResponseType) -> Void
30 class CNLiveMineViewModel: NSObject { 36 class CNLiveMineViewModel: NSObject {
@@ -252,7 +258,6 @@ class CNLiveMineViewModel: NSObject { @@ -252,7 +258,6 @@ class CNLiveMineViewModel: NSObject {
252 param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "sid") 258 param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "sid")
253 param.setValue("10", forKey: "pageSize") 259 param.setValue("10", forKey: "pageSize")
254 param.setValue("\(page)", forKey: "page") 260 param.setValue("\(page)", forKey: "page")
255 - showLoading(message: "")  
256 CNLiveNetworking.setAllowRequestDefaultArgument(true) 261 CNLiveNetworking.setAllowRequestDefaultArgument(true)
257 CNLiveNetworking.setupShowDataResult(false) 262 CNLiveNetworking.setupShowDataResult(false)
258 CNLiveNetworking.requestNetwork(with: .GET, urlString: APPBaseMCUrl+"/identityApi/allList", param: param as! [String : String], cacheType: .networkOnly) { task, result, error in 263 CNLiveNetworking.requestNetwork(with: .GET, urlString: APPBaseMCUrl+"/identityApi/allList", param: param as! [String : String], cacheType: .networkOnly) { task, result, error in
@@ -281,6 +286,44 @@ class CNLiveMineViewModel: NSObject { @@ -281,6 +286,44 @@ class CNLiveMineViewModel: NSObject {
281 } 286 }
282 } 287 }
283 288
  289 + /// 获取已认证身份列表
  290 + /// - Parameters:
  291 + /// - page: 页数
  292 + /// - resultBlock: 数据返回
  293 + static func requestsGETAuthInfoList(page: NSInteger, resultBlock: @escaping resultNewsBlock) {
  294 + let param = NSMutableDictionary()
  295 + param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "sid")
  296 + param.setValue("1", forKey: "type") //0正在审核 1已认证 -1审核失败
  297 + param.setValue("\(page)", forKey: "page")
  298 + param.setValue("10", forKey: "pageSize")
  299 + CNLiveNetworking.setAllowRequestDefaultArgument(true)
  300 + CNLiveNetworking.setupShowDataResult(false)
  301 + CNLiveNetworking.requestNetwork(with: .GET, urlString: APPBaseMCUrl+"/identityApi/myList", param: param as! [String: String], cacheType: .networkOnly) { task, result, error in
  302 + hiddenLoading()
  303 + if (error == nil) {
  304 + let resp = result as! NSDictionary
  305 + let errorCode = "\(resp["errorCode"] ?? "0")"
  306 + if (errorCode == "0") {
  307 + let listModel = dictionaryToModel(resp as! [String : Any], MineAuthListBaseModel.self,"data") as! MineAuthListBaseModel
  308 + resultBlock(listModel,.success)
  309 + } else {
  310 + showMessage(message: resp["errorMessage"] as! String)
  311 + resultBlock(NSNull(),.failed)
  312 + }
  313 + } else {
  314 + if page > 1 {
  315 + if CNLiveNetworking.isNetworking() {
  316 + showMessage(message: "获取失败")
  317 + resultBlock(NSNull(),.failed)
  318 + } else {
  319 + showMessage(message: "似乎与网络断开链接")
  320 + resultBlock(NSNull(),.noNetwork)
  321 + }
  322 + }
  323 + }
  324 + }
  325 + }
  326 +
284 /// 上传用户认证信息接口 327 /// 上传用户认证信息接口
285 /// - Parameters: 328 /// - Parameters:
286 /// - infos: 认证信息数据 329 /// - infos: 认证信息数据
@@ -448,6 +491,18 @@ class CNLiveMineViewModel: NSObject { @@ -448,6 +491,18 @@ class CNLiveMineViewModel: NSObject {
448 } 491 }
449 } 492 }
450 493
  494 +
  495 + /// 首页及身份认证界面数据获取及排序
  496 + /// - Parameters:
  497 + /// - sortType: 回去数据来源
  498 + /// - resultBlock: 数据返回
  499 + static func requestHomePageDataSourceList(sortType: CNLiveMineSortType,resultBlock: @escaping resultBlock) {
  500 +// CNLiveMineViewModel.requestsGETAuthInfoList(page: 1) { result, respStatue in
  501 +//
  502 +// }
  503 +
  504 + }
  505 +
451 /// 获取十位时间戳 506 /// 获取十位时间戳
452 static var timeStamp: Int { 507 static var timeStamp: Int {
453 let timeInterval: TimeInterval = NSDate().timeIntervalSince1970 508 let timeInterval: TimeInterval = NSDate().timeIntervalSince1970
metaCode/Supporting Files/Assets.xcassets/MinePage/mIne_auth_result_header_icon.imageset/Contents.json renamed to metaCode/Supporting Files/Assets.xcassets/MinePage/mIne_auth_result_header_success.imageset/Contents.json
metaCode/Supporting Files/Assets.xcassets/MinePage/mIne_auth_result_header_icon.imageset/mIne_auth_result_header_icon@2x.png renamed to metaCode/Supporting Files/Assets.xcassets/MinePage/mIne_auth_result_header_success.imageset/mIne_auth_result_header_icon@2x.png

159 KB

metaCode/Supporting Files/Assets.xcassets/MinePage/mIne_auth_result_header_icon.imageset/mIne_auth_result_header_icon@3x.png renamed to metaCode/Supporting Files/Assets.xcassets/MinePage/mIne_auth_result_header_success.imageset/mIne_auth_result_header_icon@3x.png

575 KB

metaCode/Supporting Files/Assets.xcassets/MinePage/mine_auth_result_header_failer.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "scale" : "1x"
  6 + },
  7 + {
  8 + "filename" : "mine_auth_result_header_failer@2x.png",
  9 + "idiom" : "universal",
  10 + "scale" : "2x"
  11 + },
  12 + {
  13 + "filename" : "mine_auth_result_header_failer@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/MinePage/mine_auth_result_header_failer.imageset/mine_auth_result_header_failer@2x.png 0 → 100644

145 KB

metaCode/Supporting Files/Assets.xcassets/MinePage/mine_auth_result_header_failer.imageset/mine_auth_result_header_failer@3x.png 0 → 100644

444 KB