Commit c25aa29db5e9eafd76d4b54f3476fddaa7d016f9

Authored by liushiyu
1 parent 95533522

提交身份认证界面

Showing 19 changed files with 974 additions and 31 deletions
... ... @@ -12,8 +12,6 @@ target 'metaCode' do
12 12 # Comment the next line if you don't want to use dynamic frameworks
13 13 use_frameworks!
14 14  
15   -# pod 'YYCategories'
16   -
17 15 # Pods for metaCode
18 16 #网络请求基础库
19 17 pod 'AFNetworking'
... ... @@ -23,6 +21,8 @@ target 'metaCode' do
23 21 pod 'IQKeyboardManagerSwift'
24 22 #布局文件
25 23 pod 'SnapKit'
  24 + #刷新组件
  25 + pod 'MJRefresh'
26 26 #加载框
27 27 pod 'MBProgressHUD'
28 28 #空白占位
... ...
metaCode.xcodeproj/project.pbxproj
... ... @@ -9,6 +9,7 @@
9 9 /* Begin PBXBuildFile section */
10 10 0D39E93D7229931C86EB1161 /* Pods_metaCode_metaCodeUITests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 63D879B49B1E42F1584DD75E /* Pods_metaCode_metaCodeUITests.framework */; };
11 11 1DD2808DF02C120276F99F4D /* Pods_metaCode.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F1C55A719CFEE073C06D37CE /* Pods_metaCode.framework */; };
  12 + 7905BB492AB0588B0089BC50 /* CNLiveMineAuthResultViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7905BB482AB0588B0089BC50 /* CNLiveMineAuthResultViewController.swift */; };
12 13 790B1FB42A4153E90074CF00 /* CNLiveMineBaseModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 790B1FB32A4153E90074CF00 /* CNLiveMineBaseModel.swift */; };
13 14 790B1FB62A41938F0074CF00 /* UIImage+CNLiveExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 790B1FB52A41938F0074CF00 /* UIImage+CNLiveExtensions.swift */; };
14 15 790B1FB82A41B6A60074CF00 /* CNLiveMineMessageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 790B1FB72A41B6A60074CF00 /* CNLiveMineMessageViewController.swift */; };
... ... @@ -33,6 +34,7 @@
33 34 793CAF522A58FCA200882EF4 /* CNLiveMineExchangeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 793CAF512A58FCA200882EF4 /* CNLiveMineExchangeViewController.swift */; };
34 35 796398942A260C0100D045EB /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7963988D2A260C0100D045EB /* AppDelegate.swift */; };
35 36 7963989D2A260E6200D045EB /* CNLiveBaseViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7963989C2A260E6200D045EB /* CNLiveBaseViewController.swift */; };
  37 + 79656E382AAEBA8E00119A61 /* CNLiveMineInputViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79656E372AAEBA8E00119A61 /* CNLiveMineInputViewController.swift */; };
36 38 7978A8432A396632007C86B8 /* CNLiveMineViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7978A8422A396632007C86B8 /* CNLiveMineViewModel.swift */; };
37 39 7987BF3D2A497644000A1ABC /* CNLiveMineQuestViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7987BF3C2A497644000A1ABC /* CNLiveMineQuestViewController.swift */; };
38 40 7989B5C52A4BDC6000A19B10 /* CNLiveMineEarnViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7989B5C42A4BDC6000A19B10 /* CNLiveMineEarnViewController.swift */; };
... ... @@ -111,6 +113,7 @@
111 113 63D879B49B1E42F1584DD75E /* Pods_metaCode_metaCodeUITests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_metaCode_metaCodeUITests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
112 114 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>"; };
113 115 721865F548C997EFAE525B6F /* Pods-metaCode-metaCodeUITests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-metaCode-metaCodeUITests.release.xcconfig"; path = "Target Support Files/Pods-metaCode-metaCodeUITests/Pods-metaCode-metaCodeUITests.release.xcconfig"; sourceTree = "<group>"; };
  116 + 7905BB482AB0588B0089BC50 /* CNLiveMineAuthResultViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineAuthResultViewController.swift; sourceTree = "<group>"; };
114 117 790B1FB32A4153E90074CF00 /* CNLiveMineBaseModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineBaseModel.swift; sourceTree = "<group>"; };
115 118 790B1FB52A41938F0074CF00 /* UIImage+CNLiveExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIImage+CNLiveExtensions.swift"; sourceTree = "<group>"; };
116 119 790B1FB72A41B6A60074CF00 /* CNLiveMineMessageViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineMessageViewController.swift; sourceTree = "<group>"; };
... ... @@ -135,6 +138,7 @@
135 138 793CAF512A58FCA200882EF4 /* CNLiveMineExchangeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineExchangeViewController.swift; sourceTree = "<group>"; };
136 139 7963988D2A260C0100D045EB /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
137 140 7963989C2A260E6200D045EB /* CNLiveBaseViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CNLiveBaseViewController.swift; sourceTree = "<group>"; };
  141 + 79656E372AAEBA8E00119A61 /* CNLiveMineInputViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineInputViewController.swift; sourceTree = "<group>"; };
138 142 7978A8422A396632007C86B8 /* CNLiveMineViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineViewModel.swift; sourceTree = "<group>"; };
139 143 7987BF3C2A497644000A1ABC /* CNLiveMineQuestViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineQuestViewController.swift; sourceTree = "<group>"; };
140 144 7989B5C42A4BDC6000A19B10 /* CNLiveMineEarnViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineEarnViewController.swift; sourceTree = "<group>"; };
... ... @@ -323,6 +327,8 @@
323 327 7989B5C42A4BDC6000A19B10 /* CNLiveMineEarnViewController.swift */,
324 328 7989B5C62A4BDC7200A19B10 /* CNLiveMineEarnListViewController.swift */,
325 329 793CAF512A58FCA200882EF4 /* CNLiveMineExchangeViewController.swift */,
  330 + 79656E372AAEBA8E00119A61 /* CNLiveMineInputViewController.swift */,
  331 + 7905BB482AB0588B0089BC50 /* CNLiveMineAuthResultViewController.swift */,
326 332 );
327 333 path = Controller;
328 334 sourceTree = "<group>";
... ... @@ -878,6 +884,7 @@
878 884 7CD675402A2740B0008354C1 /* CNDownSlideView.swift in Sources */,
879 885 7C2703362A3AFD3A0061EC50 /* CNLiveEnvironment.swift in Sources */,
880 886 798A44FD2A309EBA00815935 /* CNLiveTypeFeedBackViewController.swift in Sources */,
  887 + 79656E382AAEBA8E00119A61 /* CNLiveMineInputViewController.swift in Sources */,
881 888 7CD6754F2A2840B9008354C1 /* CNMetaCodeHomePageController.swift in Sources */,
882 889 7989B5C52A4BDC6000A19B10 /* CNLiveMineEarnViewController.swift in Sources */,
883 890 792E57DB2A3AE9F4005834DB /* CNLiveCommonQiniuTool.swift in Sources */,
... ... @@ -896,6 +903,7 @@
896 903 79396EED2A319F220053E1AF /* NSObject+CNLiveExtensions.swift in Sources */,
897 904 7C4931312A2F142F000E44B4 /* CNHomePageBackgroupView.swift in Sources */,
898 905 790D018B2A2D8B3300C5978D /* CNLiveLoginViewController.swift in Sources */,
  906 + 7905BB492AB0588B0089BC50 /* CNLiveMineAuthResultViewController.swift in Sources */,
899 907 798A44EC2A302DBE00815935 /* CNLiveMineAddInfoViewController.swift in Sources */,
900 908 7CD675422A2740F8008354C1 /* CNCustomIndexView.swift in Sources */,
901 909 790D01912A2DAC5E00C5978D /* CNLiveConfigFontMacro.swift in Sources */,
... ...
metaCode/Classes/Common/Base/CNLiveBaseViewController.swift
... ... @@ -50,6 +50,19 @@ class CNLiveBaseViewController: UIViewController {
50 50 }
51 51 }
52 52  
  53 + public var _leftBtnWhite: Bool = false
  54 + public var leftBtnWhite: Bool {
  55 + get {
  56 + return _leftBtnWhite
  57 + }
  58 + set {
  59 + _leftBtnWhite = newValue
  60 + //先设置一个默认返回按钮
  61 + let leftBtn_array : Array<UIButton> = [UIButton.backItem(imageName: (_leftBtnWhite ? "mine_header_icon_white_back":"main_navi_left_icon_back"), target: self, action: #selector(ClickBackBtn))]
  62 + leftNavBtns = leftBtn_array
  63 + }
  64 + }
  65 +
53 66 /// //顶部导航内容(不带topLine)偏移量Y 初始值为0
54 67 public var _topNavViewSubUIContentOffsetY: CGFloat = 0.0
55 68 public var topNavViewSubUIContentOffsetY: CGFloat {
... ... @@ -199,9 +212,7 @@ class CNLiveBaseViewController: UIViewController {
199 212 topNavView.addSubview(titleLabel)
200 213 topNavView.addSubview(topLine)
201 214  
202   - //先设置一个默认返回按钮
203   - let leftBtn_array : Array<UIButton> = [UIButton.backItem(imageName: "main_navi_left_icon_back", target: self, action: #selector(ClickBackBtn))]
204   - leftNavBtns = leftBtn_array
  215 + leftBtnWhite = false
205 216 }
206 217  
207 218 @objc func ClickBackBtn() {
... ...
metaCode/Classes/Config/Database/CNLiveIdentityDB.swift
... ... @@ -12,7 +12,7 @@ import WCDBSwift
12 12 let CNLiveIdentityTableName = "CNLiveIdentityTable"
13 13  
14 14 ///身份model
15   -class CNLiveIdentityModel: BaseModel,TableCodable {
  15 +final class CNLiveIdentityModel: BaseModel,TableCodable {
16 16 var id: String = ""
17 17 var name: String?
18 18 var icon: String?
... ...
metaCode/Classes/Extensions/NSObject+CNLiveExtensions.swift
... ... @@ -94,7 +94,7 @@ func showMessage(message: String) {
94 94 /// - Parameter message: 提示词
95 95 func showLoading(message: String) {
96 96 let delegate = UIApplication.shared.delegate as! AppDelegate
97   -
  97 +
98 98 delegate.window?.subviews.forEach({ view in
99 99 if view.isKind(of: MBProgressHUD.layerClass) {
100 100 let hub = view as! MBProgressHUD
... ...
metaCode/Classes/Main/MinePage/Controller/CNLiveMineAddInfoViewController.swift
... ... @@ -7,6 +7,7 @@
7 7  
8 8 import Foundation
9 9 import EmptyDataSet_Swift
  10 +import MJRefresh
10 11  
11 12 enum CNLiveMineInfoShowType {
12 13 case add//添加身份
... ... @@ -39,13 +40,13 @@ class CNLiveMineAddInfoViewController : CNLiveBaseViewController, UITableViewDel
39 40  
40 41 lazy var dataArray: NSMutableArray = {
41 42 var dataArray = NSMutableArray()
42   - if _show_type == .add {
43   - dataArray.add(["image":"mine_header_icon_defult_ava","name":"志愿者身份"])
44   - dataArray.add(["image":"mine_header_icon_defult_ava","name":"退伍军人身份"])
45   - }
46 43 if _show_type == .info {
47 44 dataArray.add(["image":"mine_header_icon_defult_ava","name":"志愿者身份","number":"证件编号:410800111127954"])
48   - 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"])
49 50 }
50 51 return dataArray
51 52 }()
... ... @@ -75,13 +76,16 @@ class CNLiveMineAddInfoViewController : CNLiveBaseViewController, UITableViewDel
75 76 return copyButton
76 77 }()
77 78  
  79 + var pageNum: NSInteger
78 80 var network_type: CNLiveMineResponseType!
79 81 var _show_type:CNLiveMineInfoShowType!
80 82 init(show_type:CNLiveMineInfoShowType) {
  83 + self.pageNum = 1
81 84 super.init(nibName:nil, bundle:nil)
82 85 _show_type = show_type
83 86 }
84 87  
  88 +
85 89 required init?(coder: NSCoder) {
86 90 fatalError("init(coder:) has not been implemented")
87 91 }
... ... @@ -96,14 +100,13 @@ class CNLiveMineAddInfoViewController : CNLiveBaseViewController, UITableViewDel
96 100 tableView.dragInteractionEnabled = true
97 101 case .message:
98 102 titleName = "消息中心"
99   - loadData()
100 103 // topNavView.addSubview(setButton)
101 104 // topNavView.addSubview(copyButton)
102   -
103 105 case .none:
104 106 break
105 107 }
106   -
  108 + loadData()
  109 + addRefreshView()
107 110 navigationBarHidden = false
108 111 view.addSubview(tableView)
109 112 tableView.snp.makeConstraints { make in
... ... @@ -111,17 +114,58 @@ class CNLiveMineAddInfoViewController : CNLiveBaseViewController, UITableViewDel
111 114 make.left.right.bottom.equalToSuperview()
112 115 }
113 116 }
  117 +
114 118  
115   - func loadData() {
116   - CNLiveMineViewModel.requestMessage { [weak self] result, respStatue in
117   - self!.network_type = respStatue
118   - if respStatue == .success {
119   - self!.listArray = (result as! NewsModel).list
120   - self!.tableView.reloadData()
121   - }else{
122   - self!.tableView.reloadEmptyDataSet()
  119 + private func loadData() {
  120 + if _show_type == .add {
  121 + CNLiveMineViewModel.requestAuthStandList(page: self.pageNum) { [weak self] result, respStatue in
  122 + if respStatue == .success {
  123 + let listBaseModel = result as! StandListBaseModel
  124 + if listBaseModel.pageNum == 1 {
  125 + self!.dataArray.removeAllObjects()
  126 + self!.dataArray.addObjects(from: (result as! StandListBaseModel).list)
  127 + self!.tableView.reloadData()
  128 + self!.tableView.mj_header?.endRefreshing()
  129 + self!.tableView.mj_footer?.endRefreshing()
  130 + }
  131 + if listBaseModel.total == listBaseModel.pageNum {
  132 + self!.tableView.mj_footer?.endRefreshing()
  133 + self!.tableView.mj_footer?.endRefreshingWithNoMoreData()
  134 + self!.tableView.reloadData()
  135 + }
  136 + }else if (respStatue == .noNetwork) {
  137 + self!.network_type = .noNetwork
  138 + self!.tableView.reloadEmptyDataSet()
  139 + } else {
  140 + self!.network_type = .failed
  141 + self!.tableView.reloadEmptyDataSet()
  142 + }
123 143 }
124 144 }
  145 + if _show_type == .message {
  146 + CNLiveMineViewModel.requestMessage { [weak self] result, respStatue in
  147 + self!.network_type = respStatue
  148 + if respStatue == .success {
  149 + self!.listArray = (result as! NewsModel).list
  150 + self!.tableView.reloadData()
  151 + }else{
  152 + self!.tableView.reloadEmptyDataSet()
  153 + }
  154 + }
  155 + }
  156 + }
  157 +
  158 + private func addRefreshView() {
  159 + if _show_type == .add {
  160 + tableView.mj_header = MJRefreshNormalHeader.init(refreshingBlock: {[weak self] in
  161 + self!.pageNum = 1
  162 + self!.loadData()
  163 + })
  164 + tableView.mj_footer = MJRefreshFooter.init(refreshingBlock: {[weak self] in
  165 + self!.pageNum += 1
  166 + self!.loadData()
  167 + })
  168 + }
125 169 }
126 170  
127 171  
... ... @@ -198,8 +242,8 @@ extension CNLiveMineAddInfoViewController {
198 242 guard let cell = tableView.dequeueReusableCell(withIdentifier: kCNLiveMineInfoLListTableViewIdentifier) as? MineInfoLListTableViewCell else {
199 243 return MineInfoLListTableViewCell()
200 244 }
201   - let dict = dataArray[indexPath.row] as! Dictionary<String, Any>
202   - cell.setupWithDataSource(icon: dict["image"] as! String, name: dict["name"] as! String)
  245 + let listModel = dataArray[indexPath.row] as! StandListModel
  246 + cell.setupWithDataSource(icon: listModel.icon!, name: listModel.name!, is_auth: listModel.auth)
203 247 cell.userInteractionEnabledWhileDragging = true
204 248 return cell
205 249  
... ... @@ -226,6 +270,14 @@ extension CNLiveMineAddInfoViewController {
226 270 let listModel = listArray[indexPath.row]
227 271 self.navigationController?.pushViewController(CNLiveMineMessageViewController.init(listModel: listModel), animated: true)
228 272 }
  273 + if _show_type == .add {
  274 + let listModel = dataArray[indexPath.row] as! StandListModel
  275 + if listModel.auth {
  276 + showMessage(message: "您已添加此身份,请直接使用")
  277 + return
  278 + }
  279 + self.navigationController?.pushViewController(CNLiveMineInputViewController.init(listModel: listModel), animated: true)
  280 + }
229 281 }
230 282 func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
231 283 return 100
... ... @@ -247,6 +299,9 @@ extension CNLiveMineAddInfoViewController {
247 299 func tableView(_ tableView: UITableView, moveRowAt sourceIndexPath: IndexPath,
248 300 to destinationIndexPath: IndexPath) {
249 301 objc_sync_enter(self)
  302 + print("交换之前===>\(dataArray)")
  303 + swap(&dataArray[sourceIndexPath.row], &dataArray[destinationIndexPath.row])
  304 + print("交换之后===>\(dataArray)")
250 305 // let dict: Dictionary = dataArray[sourceIndexPath.row] as! Dictionary<String, Any>
251 306 // dataArray.remove(sourceIndexPath.row)
252 307 // if destinationIndexPath.row > dataArray.count {
... ...
metaCode/Classes/Main/MinePage/Controller/CNLiveMineAuthResultViewController.swift 0 → 100644
  1 +//
  2 +// CNLiveMineAuthResultViewController.swift
  3 +// metaCode
  4 +//
  5 +// Created by open on 2023/9/12.
  6 +//
  7 +
  8 +import Foundation
  9 +
  10 +
  11 +class CNLiveMineAuthResultViewController: CNLiveBaseViewController {
  12 +
  13 + lazy var mainView: UIImageView = {
  14 + let mainView = UIImageView()
  15 + mainView.backgroundColor = .white
  16 + mainView.contentMode = .scaleToFill
  17 + mainView.image = UIImage(named: "mIne_auth_result_header_icon")
  18 + return mainView
  19 + }()
  20 +
  21 + lazy var tipName: UILabel = {
  22 + let tipName = UILabel.init()
  23 + tipName.text = "资料审核中"
  24 + tipName.font = BoldFont_18_Fit
  25 + tipName.textAlignment = .center
  26 + tipName.textColor = .black
  27 + return tipName
  28 + }()
  29 +
  30 + lazy var tipDesc: UILabel = {
  31 + let tipDesc = UILabel.init()
  32 + tipDesc.text = "请耐心等待,预计一分钟之内完成审核"
  33 + tipDesc.textColor = HexColor("#A9A9A9")
  34 + tipDesc.textAlignment = .center
  35 + tipDesc.font = Font_13
  36 + return tipDesc
  37 + }()
  38 +
  39 + lazy var sendButton: UIButton = {
  40 + let sendButton = UIButton(type: .custom)
  41 + sendButton.setTitle("确 定", for: .normal)
  42 + sendButton.setTitleColor(.white, for: .normal)
  43 + sendButton.titleLabel?.font = BoldFont_16_Fit
  44 + sendButton.layer.cornerRadius = 20
  45 + sendButton.layer.masksToBounds = true
  46 + sendButton.addTarget(self, action: #selector(sendInfoActionMothod), for: .touchUpInside)
  47 + return sendButton
  48 + }()
  49 +
  50 + var _listModel:StandListModel!
  51 + init(listModel:StandListModel) {
  52 + super.init(nibName:nil, bundle:nil)
  53 + _listModel = listModel
  54 + }
  55 +
  56 + required init?(coder: NSCoder) {
  57 + fatalError("init(coder:) has not been implemented")
  58 + }
  59 +
  60 + override func viewWillAppear(_ animated: Bool) {
  61 + super.viewWillAppear(animated)
  62 +
  63 + }
  64 +
  65 + override func viewDidLoad() {
  66 + super.viewDidLoad()
  67 +
  68 + navigationBarHidden = false
  69 + view.backgroundColor = .white
  70 + topNavView.backgroundColor = .clear
  71 + titleName = "添加\(_listModel.name!)"
  72 + titleLabel.textColor = .white
  73 + leftBtnWhite = true
  74 + setNeedsStatusBarAppearanceUpdate()
  75 +
  76 +
  77 + view.insertSubview(mainView, belowSubview: topNavView)
  78 + mainView.snp.makeConstraints { make in
  79 + make.left.top.right.equalToSuperview()
  80 + make.height.equalTo(346)
  81 + }
  82 + view.addSubview(tipName)
  83 + tipName.snp.makeConstraints { make in
  84 + make.centerX.equalToSuperview()
  85 + make.top.equalTo(mainView.snp.bottom).offset(20)
  86 + }
  87 +
  88 + view.addSubview(tipDesc)
  89 + tipDesc.snp.makeConstraints { make in
  90 + make.centerX.equalToSuperview()
  91 + make.top.equalTo(tipName.snp.bottom).offset(10)
  92 + }
  93 +
  94 + view.addSubview(sendButton)
  95 + sendButton.snp.makeConstraints { make in
  96 + make.centerX.equalToSuperview()
  97 + make.top.equalTo(tipDesc.snp.bottom).offset(50)
  98 + make.height.equalTo(40)
  99 + make.width.equalTo(150)
  100 + }
  101 + sendButton.setGradient(colors: [UIColor(red: 103/255.0, green: 197/255.0, blue: 255/255.0, alpha: 1),UIColor(red: 96/255.0, green: 154/255.0, blue: 255/255.0, alpha: 1)], startPoint: CGPoint(x: 0, y: 0.5), endPoint: CGPoint(x: 1, y: 0.5))
  102 + }
  103 +
  104 +
  105 + override var preferredStatusBarStyle: UIStatusBarStyle {
  106 + return .lightContent
  107 + }
  108 +
  109 + @objc func sendInfoActionMothod() {
  110 +
  111 + }
  112 +}
... ...
metaCode/Classes/Main/MinePage/Controller/CNLiveMineInputViewController.swift 0 → 100644
  1 +//
  2 +// CNLiveMineInputViewController.swift
  3 +// metaCode
  4 +//
  5 +// Created by open on 2023/9/11.
  6 +//
  7 +
  8 +import Foundation
  9 +import EmptyDataSet_Swift
  10 +
  11 +class CNLiveMineInputViewController : CNLiveBaseViewController, UITableViewDelegate, UITableViewDataSource, EmptyDataSetSource, EmptyDataSetDelegate{
  12 +
  13 + let kMineBodyInputAuthCellIdentifier = "kMineBodyInputAuthCellIdentifier"
  14 + lazy var tableView: UITableView = {
  15 + let tableView = UITableView(frame: .zero, style: .plain)
  16 + tableView.delegate = self
  17 + tableView.dataSource = self
  18 + tableView.emptyDataSetSource = self
  19 + tableView.emptyDataSetDelegate = self
  20 + tableView.backgroundColor = HexColor("#F7F8FA")
  21 + tableView.tableFooterView = UIView.init()
  22 + tableView.contentInsetAdjustmentBehavior = .scrollableAxes
  23 + tableView.separatorStyle = .none
  24 + tableView.register(MineBodyInputAuthCell.self, forCellReuseIdentifier: kMineBodyInputAuthCellIdentifier)
  25 + return tableView
  26 + }()
  27 +
  28 + lazy var sendButton: UIButton = {
  29 + let sendButton = UIButton(type: .custom)
  30 + sendButton.setTitle("添加身份", for: .normal)
  31 + sendButton.setTitleColor(.white, for: .normal)
  32 + sendButton.titleLabel?.font = BoldFont_16_Fit
  33 + sendButton.layer.cornerRadius = 20
  34 + sendButton.layer.masksToBounds = true
  35 + sendButton.isHidden = true
  36 + sendButton.addTarget(self, action: #selector(sendInfoActionMothod), for: .touchUpInside)
  37 + return sendButton
  38 + }()
  39 +
  40 + lazy var dataArray: NSMutableArray = {
  41 + return NSMutableArray.init()
  42 + }()
  43 +
  44 + var _listModel:StandListModel!
  45 + init(listModel:StandListModel) {
  46 + super.init(nibName:nil, bundle:nil)
  47 + _listModel = listModel
  48 + }
  49 +
  50 + required init?(coder: NSCoder) {
  51 + fatalError("init(coder:) has not been implemented")
  52 + }
  53 +
  54 + override func viewDidLoad() {
  55 + super.viewDidLoad()
  56 +
  57 + navigationBarHidden = false
  58 + titleName = _listModel.name ?? ""
  59 + view.backgroundColor = HexColor("#F7F8FA")
  60 +
  61 + loadStandInfoData()
  62 +
  63 + view.addSubview(sendButton)
  64 + sendButton.snp.makeConstraints { make in
  65 + make.bottom.equalToSuperview().offset(-get_system_tabbar_ui_offsetHeight() - 20)
  66 + make.left.equalToSuperview().offset(10)
  67 + make.right.equalToSuperview().offset(-10)
  68 + make.height.equalTo(40)
  69 + }
  70 + setupWithSendBtnStatue(statue: false)
  71 +
  72 + view.addSubview(tableView)
  73 + tableView.snp.makeConstraints { make in
  74 + make.top.equalTo(get_system_nav_height())
  75 + make.left.right.equalToSuperview()
  76 + make.bottom.equalTo(sendButton.snp.top).offset(-10)
  77 + }
  78 + }
  79 +
  80 + private func loadStandInfoData() {
  81 + CNLiveMineViewModel.requestsStandInfo(identityId: "\(_listModel.id)") {[weak self] result, respStatue in
  82 + if respStatue == .success {
  83 + self?.dataArray.addObjects(from: result as! [Any])
  84 + self?.tableView.reloadData()
  85 + if (self?.dataArray.count)! > 0 {
  86 + self?.sendButton.isHidden = false
  87 + self?.tableView.tableHeaderView = self?.setupHeaderAndFooter(is_last: false)
  88 + self?.tableView.tableFooterView = self?.setupHeaderAndFooter(is_last: true)
  89 + }
  90 + }
  91 + }
  92 + }
  93 +
  94 + private func setupWithSendBtnStatue(statue: Bool) {
  95 + var alpha = 0.3
  96 + if statue {
  97 + alpha = 1
  98 + }
  99 + sendButton.setGradient(colors: [UIColor(red: 103/255.0, green: 197/255.0, blue: 255/255.0, alpha: alpha),UIColor(red: 96/255.0, green: 154/255.0, blue: 255/255.0, alpha: alpha)], startPoint: CGPoint(x: 0, y: 0.5), endPoint: CGPoint(x: 1, y: 0.5))
  100 + sendButton.isUserInteractionEnabled = statue
  101 + }
  102 +
  103 + @objc func sendInfoActionMothod() {
  104 +
  105 + CNLiveMineViewModel.requestsPOSTAuthInfo(identityId: "\(_listModel.id)", infos: self.dataArray) { [self] result, respStatue in
  106 + if respStatue == .success {
  107 + showMessage(message: "上传成功")
  108 + DispatchQueue.main.asyncAfter(deadline: .now()+1) { [self] in
  109 + self.navigationController?.pushViewController(CNLiveMineAuthResultViewController.init(listModel: _listModel), animated: true)
  110 + }
  111 + }
  112 + }
  113 + }
  114 +
  115 +
  116 + func setupHeaderAndFooter(is_last: Bool) -> UIView {
  117 + let mainView = UIView.init(frame: CGRect(x: 0, y: 0, width: Int(KSreenWidth), height: 10));
  118 + mainView.backgroundColor = .clear
  119 + let v = UIView.init(frame: CGRect(x: 10, y: 0, width: Int(KSreenWidth) - 20, height: 10))
  120 + v.backgroundColor = .white
  121 + if !is_last {
  122 + v.addCorner(conrners: [.topLeft, .topRight], radius: 10)
  123 + } else {
  124 + v.addCorner(conrners: [.bottomLeft, .bottomRight], radius: 10)
  125 + }
  126 + mainView.addSubview(v)
  127 + return mainView
  128 + }
  129 +
  130 +}
  131 +
  132 +extension CNLiveMineInputViewController {
  133 +
  134 + func numberOfSections(in tableView: UITableView) -> Int {
  135 + return 1
  136 + }
  137 +
  138 + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
  139 + return self.dataArray.count
  140 + }
  141 +
  142 + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
  143 +
  144 + let cell = tableView.dequeueReusableCell(withIdentifier: kMineBodyInputAuthCellIdentifier) as! MineBodyInputAuthCell
  145 + cell.setListModel(infoModel: self.dataArray[indexPath.row] as! MineStandInfoModel, is_last: indexPath.row == self.dataArray.count - 1) { [weak self] in
  146 + let is_result = self?.inspectResult()
  147 + self?.setupWithSendBtnStatue(statue: is_result ?? true)
  148 + }
  149 + return cell
  150 + }
  151 +
  152 + func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
  153 + return 50
  154 + }
  155 +
  156 + func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
  157 + let infoModel = self.dataArray[indexPath.row] as! MineStandInfoModel
  158 + if infoModel.children.count > 0 {
  159 + self.view.endEditing(true)
  160 + DispatchQueue.main.asyncAfter(deadline: .now()+0.5) {
  161 + MineStandListAlertView.showStandListView(infos: infoModel.children as NSArray,name: "选择\(infoModel.name ?? "")") {[weak self] text in
  162 + infoModel.value = text
  163 + self?.tableView.reloadData()
  164 + let is_result = self?.inspectResult()
  165 + self?.setupWithSendBtnStatue(statue: is_result ?? true)
  166 + }
  167 + }
  168 + }
  169 + }
  170 +
  171 + private func inspectResult() -> Bool {
  172 + var is_result: Bool = true
  173 + for item in self.dataArray {
  174 + let listModel = item as! MineStandInfoModel
  175 + if (listModel.nonEmpty && listModel.value?.count == 0) {
  176 + is_result = false
  177 + }
  178 + }
  179 + return is_result
  180 + }
  181 +}
... ...
metaCode/Classes/Main/MinePage/View/CNLiveMineBodyListView.swift
... ... @@ -613,5 +613,136 @@ class MIneBodyFiveViewCell: UITableViewCell {
613 613 required init?(coder: NSCoder) {
614 614 fatalError("init(coder:) has not been implemented")
615 615 }
  616 +}
  617 +
  618 +typealias resultInputBlock = () -> Void
  619 +class MineBodyInputAuthCell: UITableViewCell, UITextFieldDelegate {
616 620  
  621 + lazy var mainView: UIView = {
  622 + let mainView = UIView.init(frame: CGRect.zero)
  623 + mainView.backgroundColor = .white
  624 + return mainView
  625 + }()
  626 +
  627 + lazy var nameLabel: UILabel = {
  628 + let nameLabel = UILabel.init()
  629 + nameLabel.textColor = HexColor("#333333")
  630 + nameLabel.font = BoldFont_16_Fit
  631 + nameLabel.backgroundColor = .white
  632 + return nameLabel
  633 + }()
  634 +
  635 + lazy var contentField: UITextField = {
  636 + let contentField = UITextField.init()
  637 + contentField.backgroundColor = .white
  638 + contentField.font = BoldFont_15_Fit
  639 + contentField.textColor = HexColor("#333333")
  640 + contentField.clearButtonMode = .whileEditing
  641 + contentField.textAlignment = .right
  642 + contentField.delegate = self
  643 + return contentField
  644 + }()
  645 +
  646 + lazy var moreBtn: UIButton = {
  647 + let moreBtn = UIButton.init(type: .custom)
  648 + moreBtn.setImage(UIImage(named: "mine_header_message_gray_more"), for: .normal)
  649 + moreBtn.layer.masksToBounds = true
  650 + moreBtn.layer.cornerRadius = 15
  651 + moreBtn.isHidden = true
  652 + return moreBtn
  653 + }()
  654 +
  655 + lazy var line_label: UILabel = {
  656 + let lineLabel = UILabel.init()
  657 + lineLabel.backgroundColor = HexColor("#f3f3f3")
  658 + return lineLabel
  659 + }()
  660 +
  661 +
  662 + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
  663 + super.init(style: style, reuseIdentifier: reuseIdentifier)
  664 + selectionStyle = .none
  665 + backgroundColor = .clear
  666 +
  667 + addSubview(mainView)
  668 + mainView.addSubview(nameLabel)
  669 + mainView.addSubview(moreBtn)
  670 + mainView.addSubview(contentField)
  671 + mainView.addSubview(moreBtn)
  672 + mainView.addSubview(line_label)
  673 + setConstrainta()
  674 + }
  675 +
  676 + required init?(coder: NSCoder) {
  677 + fatalError("init(coder:) has not been implemented")
  678 + }
  679 +
  680 + func contentAction() {
  681 +
  682 + }
  683 +
  684 + fileprivate var _infoModel : MineStandInfoModel?
  685 + fileprivate var _resultInputBlock : resultInputBlock?
  686 + func setListModel(infoModel: MineStandInfoModel, is_last: Bool,resultInputBlock: @escaping resultInputBlock) {
  687 + _infoModel = infoModel
  688 + _resultInputBlock = resultInputBlock
  689 + nameLabel.text = infoModel.name
  690 + if (infoModel.value ?? "").count > 0 {
  691 + contentField.text = infoModel.value
  692 + }
  693 + contentField.placeholder = "请输入\(infoModel.name ?? "")"
  694 + line_label.isHidden = is_last
  695 + if infoModel.inputType == 2 {
  696 + contentField.keyboardType = .numberPad
  697 + } else if (infoModel.inputType == 1) {
  698 + contentField.keyboardType = .default
  699 + } else if (infoModel.inputType == 3 && infoModel.children.count > 0) {//禁止输入 显示下拉选择
  700 + contentField.isUserInteractionEnabled = false
  701 + moreBtn.isHidden = false
  702 + contentField.snp.remakeConstraints { make in
  703 + make.centerY.equalToSuperview()
  704 + make.right.equalTo(moreBtn.snp.left)
  705 + }
  706 + }
  707 + }
  708 +
  709 + func setConstrainta() {
  710 + mainView.snp.makeConstraints { make in
  711 + make.top.equalToSuperview()
  712 + make.bottom.equalToSuperview()
  713 + make.left.equalToSuperview().offset(10)
  714 + make.right.equalToSuperview().offset(-10)
  715 + }
  716 + nameLabel.snp.makeConstraints { make in
  717 + make.centerY.equalToSuperview()
  718 + make.left.equalToSuperview().offset(15)
  719 + }
  720 + moreBtn.snp.makeConstraints { make in
  721 + make.centerY.equalToSuperview()
  722 + make.right.equalToSuperview().offset(-8)
  723 + }
  724 + contentField.snp.makeConstraints { make in
  725 + make.centerY.equalToSuperview()
  726 + make.right.equalToSuperview().offset(-10)
  727 + }
  728 + moreBtn.snp.makeConstraints { make in
  729 + make.centerY.equalToSuperview()
  730 + make.right.equalToSuperview().offset(-5)
  731 + }
  732 + line_label.snp.makeConstraints { make in
  733 + make.centerX.equalToSuperview()
  734 + make.bottom.equalToSuperview().offset(-1)
  735 + make.width.equalTo(Int(KSreenWidth) - 40)
  736 + make.height.equalTo(0.5)
  737 + }
  738 + }
  739 +
  740 + func textFieldShouldEndEditing(_ textField: UITextField) -> Bool {
  741 + return contentField.resignFirstResponder()
  742 + }
  743 +
  744 + func textFieldDidEndEditing(_ textField: UITextField) {
  745 + _infoModel?.value = textField.text ?? ""
  746 + _resultInputBlock!()
  747 + }
617 748 }
... ...
metaCode/Classes/Main/MinePage/View/CNLiveMineInfoAlertView.swift
... ... @@ -543,5 +543,180 @@ class UpdataAlertView: UIView {
543 543 ConfigManager.shared.show_update = false
544 544 removeFromSuperview()
545 545 }
  546 +}
  547 +
  548 +class MineStandListAlertView: UIView, UIPickerViewDelegate, UIPickerViewDataSource {
  549 +
  550 + lazy var tapGesture = UITapGestureRecognizer()
  551 + lazy var grayMaskView: UIView = {
  552 + let grayMaskView = UIView()
  553 + tapGesture.addTarget(self, action: #selector(setupCloseButtonAction))
  554 + grayMaskView.backgroundColor = UIColor.black.withAlphaComponent(0.2)
  555 + grayMaskView.addGestureRecognizer(tapGesture)
  556 + return grayMaskView
  557 + }()
  558 +
  559 + lazy var backView: UIView = {
  560 + let backView = UIView()
  561 + backView.backgroundColor = UIColor.white
  562 + backView.layer.cornerRadius = 12
  563 + return backView
  564 + }()
546 565  
  566 + lazy var pickerView: UIPickerView = {
  567 + let pickerView = UIPickerView.init()
  568 + pickerView.backgroundColor = .white
  569 + pickerView.delegate = self
  570 + pickerView.dataSource = self
  571 + return pickerView
  572 + }()
  573 +
  574 + lazy var nameLable : UILabel = {
  575 + let nameLable = UILabel.init()
  576 + nameLable.backgroundColor = .white
  577 + nameLable.font = BoldFont_16_Fit
  578 + nameLable.textAlignment = .center
  579 + nameLable.textColor = .black
  580 + return nameLable
  581 + }()
  582 +
  583 + lazy var lineLable : UILabel = {
  584 + let lineLable = UILabel.init()
  585 + lineLable.backgroundColor = HexColor("#E6E6E6")
  586 + return lineLable
  587 + }()
  588 +
  589 + lazy var doneButton : UIButton = {
  590 + let doneButton = UIButton(type: .custom)
  591 + doneButton.setTitle("确定", for: .normal)
  592 + doneButton.setTitleColor(HexColor("#0066FE"), for: .normal)
  593 + doneButton.titleLabel?.font = Font_16
  594 + doneButton.addTarget(self, action: #selector(setupDoneButtonAction), for: .touchUpInside)
  595 + return doneButton
  596 + }()
  597 +
  598 + lazy var closeButton : UIButton = {
  599 + let closeButton = UIButton(type: .custom)
  600 + closeButton.setTitle("取消", for: .normal)
  601 + closeButton.setTitleColor(HexColor("#B4B4B4"), for: .normal)
  602 + closeButton.titleLabel?.font = Font_16
  603 + closeButton.addTarget(self, action: #selector(setupCloseButtonAction), for: .touchUpInside)
  604 + return closeButton
  605 + }()
  606 +
  607 + var text: String?
  608 + var result: CloseGenderResultBlock?
  609 + var _infos: NSArray?
  610 + init(frame: CGRect, infos: NSArray) {
  611 + super.init(frame: frame)
  612 +
  613 + _infos = infos
  614 + text = (infos.firstObject as! MineStandInfoModel).name
  615 +
  616 + addSubview(grayMaskView)
  617 + addSubview(backView)
  618 + backView.addSubview(pickerView)
  619 + backView.addSubview(nameLable)
  620 + backView.addSubview(lineLable)
  621 + backView.addSubview(closeButton)
  622 + backView.addSubview(doneButton)
  623 + setConstraints()
  624 + }
  625 +
  626 + func setConstraints() {
  627 + grayMaskView.snp.makeConstraints { make in
  628 + make.edges.equalToSuperview()
  629 + }
  630 + backView.snp.makeConstraints { make in
  631 + make.top.equalTo(self.snp.bottom).offset(0)
  632 + make.left.right.equalToSuperview()
  633 + make.height.equalTo(250)
  634 + }
  635 + doneButton.snp.makeConstraints { make in
  636 + make.right.equalToSuperview()
  637 + make.top.equalTo(10)
  638 + make.height.equalTo(30)
  639 + make.width.equalTo(60)
  640 + }
  641 + closeButton.snp.makeConstraints { make in
  642 + make.centerY.equalTo(doneButton)
  643 + make.left.equalTo(8)
  644 + make.height.equalTo(30)
  645 + make.width.equalTo(60)
  646 + }
  647 + nameLable.snp.makeConstraints { make in
  648 + make.centerY.equalTo(doneButton)
  649 + make.centerX.equalToSuperview()
  650 + }
  651 + lineLable.snp.makeConstraints { make in
  652 + make.left.right.equalToSuperview()
  653 + make.height.equalTo(1)
  654 + make.top.equalTo(doneButton.snp.bottom).offset(10)
  655 + }
  656 + pickerView.snp.makeConstraints { make in
  657 + make.bottom.equalToSuperview()
  658 + make.left.right.equalToSuperview()
  659 + make.top.equalTo(lineLable.snp.bottom)
  660 + }
  661 + }
  662 +
  663 + static public func showStandListView(infos: NSArray, name: String, result: @escaping CloseGenderResultBlock) {
  664 + let pickerView = MineStandListAlertView.init(frame: .zero, infos: infos)
  665 + pickerView.result = result
  666 + pickerView.nameLable.text = name
  667 + let window = UIApplication.shared.windows.last
  668 + window?.addSubview(pickerView)
  669 + pickerView.snp.makeConstraints { make in
  670 + make.edges.equalToSuperview()
  671 + }
  672 + window?.layoutIfNeeded()
  673 + pickerView.alpha = 0
  674 + UIView.animate(withDuration: 0.1) {
  675 + pickerView.alpha = 1
  676 + } completion: { _ in
  677 + UIView.animate(withDuration: 0.1) {
  678 + pickerView.backView.snp.updateConstraints { make in
  679 + make.top.equalTo(pickerView.snp.bottom).offset(-pickerView.backView.frame.height)
  680 + }
  681 + pickerView.layoutIfNeeded()
  682 + }
  683 + }
  684 + }
  685 +
  686 + func numberOfComponents(in pickerView: UIPickerView) -> Int {
  687 + return 1
  688 + }
  689 +
  690 + func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int {
  691 + return _infos?.count ?? 0
  692 + }
  693 +
  694 + func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? {
  695 + let infoModel = _infos![row] as! MineStandInfoModel
  696 + return infoModel.name
  697 + }
  698 +
  699 + func pickerView(_ pickerView: UIPickerView, rowHeightForComponent component: Int) -> CGFloat {
  700 + return 45.0
  701 + }
  702 +
  703 + func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) {
  704 + let infoModel = _infos![row] as! MineStandInfoModel
  705 + text = infoModel.name ?? ""
  706 + }
  707 +
  708 + required init?(coder: NSCoder) {
  709 + fatalError("init(coder:) has not been implemented")
  710 + }
  711 +
  712 + @objc func setupCloseButtonAction() -> Void {
  713 + removeFromSuperview()
  714 + }
  715 +
  716 + @objc func setupDoneButtonAction() -> Void {
  717 + removeFromSuperview()
  718 + if (result != nil) {
  719 + result!(text ?? "")
  720 + }
  721 + }
547 722 }
... ...
metaCode/Classes/Main/MinePage/View/CNLiveMineSubBodyListView.swift
... ... @@ -32,6 +32,7 @@ class MineInfoLListTableViewCell : UITableViewCell {
32 32 titleLabel.backgroundColor = .clear
33 33 titleLabel.textColor = .black
34 34 titleLabel.font = BoldFont_18_Fit
  35 + titleLabel.minimumScaleFactor = 14*FontFit
35 36 return titleLabel
36 37 }()
37 38  
... ... @@ -43,12 +44,23 @@ class MineInfoLListTableViewCell : UITableViewCell {
43 44 addBtn.titleLabel?.font = BoldFont_15
44 45 addBtn.layer.cornerRadius = 15
45 46 addBtn.layer.masksToBounds = true
  47 + addBtn.isUserInteractionEnabled = false
46 48 return addBtn
47 49 }()
48 50  
49   - public func setupWithDataSource(icon: String, name: String) {
50   - iconView.image = UIImage(named: icon)
  51 + public func setupWithDataSource(icon: String, name: String, is_auth: Bool) {
  52 + iconView.kf.indicatorType = .activity
  53 + iconView.kf.setImage(with: URL(string: icon), placeholder: UIImage.imageWithColor(color: HexColor("0xf9f9f9")!, size: CGSize(width: 50, height: 50)))
51 54 titleLabel.text = name
  55 + if is_auth {
  56 + addBtn.backgroundColor = HexColor("#DCDCDC")
  57 + addBtn.setTitleColor(HexColor("#666666"), for: .normal)
  58 + addBtn.setTitle(" 已添加 ", for: .normal)
  59 + }else {
  60 + addBtn.backgroundColor = HexColor("#67C5FF")
  61 + addBtn.setTitleColor(.white, for: .normal)
  62 + addBtn.setTitle(" 去添加 ", for: .normal)
  63 + }
52 64 }
53 65  
54 66 override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
... ... @@ -76,16 +88,17 @@ class MineInfoLListTableViewCell : UITableViewCell {
76 88 make.left.equalToSuperview().offset(15)
77 89 make.size.equalTo(50)
78 90 }
79   - titleLabel.snp.makeConstraints { make in
80   - make.centerY.equalToSuperview()
81   - make.left.equalTo(iconView.snp.right).offset(10)
82   - }
83 91 addBtn.snp.makeConstraints { make in
84 92 make.centerY.equalToSuperview()
85 93 make.right.equalToSuperview().offset(-15)
86 94 make.width.equalTo(80)
87 95 make.height.equalTo(30)
88 96 }
  97 + titleLabel.snp.makeConstraints { make in
  98 + make.centerY.equalToSuperview()
  99 + make.left.equalTo(iconView.snp.right).offset(10)
  100 + make.right.equalTo(addBtn.snp.left).offset(5)
  101 + }
89 102 }
90 103  
91 104 required init?(coder: NSCoder) {
... ...
metaCode/Classes/Main/MinePage/ViewModel/CNLiveMineBaseModel.swift
... ... @@ -109,3 +109,77 @@ class NewsListModel: BaseModel {
109 109 // })
110 110 }
111 111 }
  112 +
  113 +class StandListBaseModel: BaseModel {
  114 + var prePage: Int = 0
  115 + var pageSize: Int = 0
  116 + var startRow: Int = 0
  117 + var navigateLastPage: Int = 0
  118 + var firstPage: Int = 0
  119 + var nextPage: Int = 0
  120 + var size: Int = 0
  121 + var endRow: Int = 0
  122 + var isLastPage: Bool = false
  123 + var hasNextPage: Bool = false
  124 + var navigateFirstPage: Int = 0
  125 + var lastPage: Int = 0
  126 + var total: Int = 0
  127 + var list = [StandListModel]()
  128 + var navigatepageNums = [Int]()
  129 + var isFirstPage: Bool = false
  130 + var hasPreviousPage: Bool = false
  131 + var navigatePages: Int = 0
  132 + var pageNum: Int = 0
  133 + var pages: Int = 0
  134 +}
  135 +
  136 +class StandListModel: BaseModel {
  137 +
  138 + var icon: String?
  139 + var name: String?
  140 + var enable: Bool = false
  141 + var id: Int = 0
  142 + var createTime: Int = 0
  143 + var createTimeString: String = ""
  144 + var timeString: String = ""
  145 + var auth: Bool = false
  146 +
  147 + override func mapping(mapper: HelpingMapper) {
  148 + mapper <<<
  149 + self.createTime <-- TransformOf(fromJSON: { [weak self] (raw) -> Int in
  150 + if (raw ?? 0)! > 0 {
  151 + let date = NSDate(timeIntervalSince1970: TimeInterval((raw!)/1000))
  152 + let dateFormatter = DateFormatter()
  153 + dateFormatter.locale = Locale.init(identifier: "zh_CN")
  154 + dateFormatter.dateFormat = "MM-dd"
  155 + self?.createTimeString = dateFormatter.string(from: date as Date)
  156 + let dateFormatter_time = DateFormatter()
  157 + dateFormatter_time.locale = Locale.init(identifier: "zh_CN")
  158 + dateFormatter_time.dateFormat = "yyyy年MM月dd日 HH:mm"
  159 + self?.timeString = dateFormatter_time.string(from: date as Date)
  160 + }
  161 + return raw!
  162 + }, toJSON: { (tuple) -> Int? in
  163 + return tuple
  164 + })
  165 + }
  166 +}
  167 +
  168 +class MineStandInfoBaseModel: BaseModel {
  169 + var authInfos = [MineStandInfoModel]()
  170 + var icon: String?
  171 + var name: String?
  172 + var identityId: Int = 0
  173 +}
  174 +
  175 +class MineStandInfoModel: BaseModel {
  176 + var authInfoId: Int = 0
  177 + var name: String?
  178 + var inputType: Int = 0//1 文本输入 2数字输入 3下拉选择 4后台生成时间 5后台生成编码
  179 + var sort: Int = 0
  180 + var nonEmpty: Bool = false
  181 + var input: Bool = false
  182 + var show: Bool = false
  183 + var value: String? = ""//自己定义的值
  184 + var children = [MineStandInfoModel]()
  185 +}
... ...
metaCode/Classes/Main/MinePage/ViewModel/CNLiveMineViewModel.swift
... ... @@ -7,6 +7,8 @@
7 7  
8 8 import Foundation
9 9 import CNLiveRequestBastKit
  10 +import HandyJSON
  11 +import AFNetworking
10 12  
11 13 enum CNLiveMineRequestType {
12 14 case icon
... ... @@ -241,6 +243,143 @@ class CNLiveMineViewModel: NSObject {
241 243 }
242 244 }
243 245  
  246 + /// 获取身份信息列表数据
  247 + /// - Parameters:
  248 + /// - page: 页数
  249 + /// - resultBlock: 返回
  250 + static func requestAuthStandList(page: NSInteger, resultBlock: @escaping resultNewsBlock) {
  251 + let param = NSMutableDictionary()
  252 + param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "sid")
  253 + param.setValue("10", forKey: "pageSize")
  254 + param.setValue("\(page)", forKey: "page")
  255 + showLoading(message: "")
  256 + CNLiveNetworking.setAllowRequestDefaultArgument(true)
  257 + CNLiveNetworking.setupShowDataResult(false)
  258 + CNLiveNetworking.requestNetwork(with: .GET, urlString: APPBaseMCUrl+"/identityApi/allList", param: param as! [String : String], cacheType: .networkOnly) { task, result, error in
  259 + hiddenLoading()
  260 + if (error == nil) {
  261 + let resp = result as! NSDictionary
  262 + let errorCode = "\(resp["errorCode"] ?? "0")"
  263 + if (errorCode == "0") {
  264 + let newsModel = dictionaryToModel(resp as! [String : Any], StandListBaseModel.self,"data") as! StandListBaseModel
  265 + resultBlock(newsModel,.success)
  266 + } else {
  267 + showMessage(message: resp["errorMessage"] as! String)
  268 + resultBlock(NSNull(),.failed)
  269 + }
  270 + } else {
  271 + if page > 1 {
  272 + if CNLiveNetworking.isNetworking() {
  273 + showMessage(message: "获取失败")
  274 + resultBlock(NSNull(),.failed)
  275 + } else {
  276 + showMessage(message: "似乎与网络断开链接")
  277 + resultBlock(NSNull(),.noNetwork)
  278 + }
  279 + }
  280 + }
  281 + }
  282 + }
  283 +
  284 + /// 上传用户认证信息接口
  285 + /// - Parameters:
  286 + /// - infos: 认证信息数据
  287 + /// - resultBlock: 返回
  288 + static func requestsPOSTAuthInfo(identityId: String,infos: NSArray, resultBlock: @escaping resultNewsBlock) {
  289 +
  290 + let values = NSMutableDictionary()
  291 + values.addEntries(from: ["sid":UserInfoManager.shared.userInfo.uid])
  292 + values.addEntries(from: ["identityId":identityId])
  293 + let temp_array = NSMutableArray()
  294 + for info in infos {
  295 + let value = (info as! MineStandInfoModel).value ?? ""
  296 + let key = (info as! MineStandInfoModel).name ?? ""
  297 + let authInfoId = (info as! MineStandInfoModel).authInfoId
  298 + let inputType = (info as! MineStandInfoModel).inputType
  299 + if value.count == 0 {
  300 + if inputType == 3 {
  301 + showMessage(message: "请选择\(key)")
  302 + return
  303 + } else {
  304 + showMessage(message: "请填写\(key)")
  305 + return
  306 + }
  307 + }
  308 + temp_array.add(["authInfoId":authInfoId,"msg":value] as [String : Any])
  309 + }
  310 + values.addEntries(from: ["authInfo":temp_array])
  311 + do {
  312 + let request = URLRequest.init(url: URL.init(string: APPBaseMCUrl+"/identityApi/saveUserMsg")!) as! NSMutableURLRequest
  313 + request.httpMethod = "POST"
  314 + request.timeoutInterval = 10
  315 + request.setValue("application/json", forHTTPHeaderField: "Content-Type")
  316 + let data = try JSONSerialization.data(withJSONObject: values, options: .prettyPrinted)
  317 + request.httpBody = data
  318 + showLoading(message: "")
  319 + CNLiveNetworking.setAllowRequestDefaultArgument(false)
  320 + CNLiveNetworking.setupShowDataResult(false)
  321 + CNLiveNetworking.setBuildCustomUrlRequest(request as URLRequest) { task, result, error in
  322 + hiddenLoading()
  323 + if (error == nil) {
  324 + let resp = result as! NSDictionary
  325 + let errorCode = "\(resp["errorCode"] ?? "0")"
  326 + if (errorCode == "0") {
  327 + resultBlock(NSNull(),.success)
  328 + } else {
  329 + showMessage(message: resp["errorMessage"] as! String)
  330 + resultBlock(NSNull(),.failed)
  331 + }
  332 + } else {
  333 + if CNLiveNetworking.isNetworking() {
  334 + showMessage(message: "上传失败")
  335 + resultBlock(NSNull(),.failed)
  336 + } else {
  337 + showMessage(message: "似乎与网络断开链接")
  338 + resultBlock(NSNull(),.noNetwork)
  339 + }
  340 + }
  341 + }
  342 + } catch {
  343 + showMessage(message: "上传失败")
  344 + resultBlock(NSNull(),.failed)
  345 + }
  346 + }
  347 +
  348 + /// 获取身份信息数据
  349 + /// - Parameters:
  350 + /// - identityId: 身份id
  351 + /// - resultBlock: 返回
  352 + static func requestsStandInfo(identityId: String, resultBlock: @escaping resultNewsBlock) {
  353 + let param = NSMutableDictionary()
  354 + param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "sid")
  355 + param.setValue(identityId, forKey: "identityId")
  356 + showLoading(message: "")
  357 + CNLiveNetworking.setAllowRequestDefaultArgument(true)
  358 + CNLiveNetworking.setupShowDataResult(false)
  359 + CNLiveNetworking.requestNetwork(with: .GET, urlString: APPBaseMCUrl+"/identityApi/getIdentity", param: param as! [String: String], cacheType: .networkOnly) { task, result, error in
  360 + hiddenLoading()
  361 + if (error == nil) {
  362 + let resp = result as! NSDictionary
  363 + let errorCode = "\(resp["errorCode"] ?? "0")"
  364 + if (errorCode == "0") {
  365 + let newsModel = dictionaryToModel(resp as! [String : Any], MineStandInfoBaseModel.self,"data") as! MineStandInfoBaseModel
  366 + resultBlock(newsModel.authInfos,.success)
  367 + } else {
  368 + showMessage(message: resp["errorMessage"] as! String)
  369 + resultBlock(NSNull(),.failed)
  370 + }
  371 + } else {
  372 + if CNLiveNetworking.isNetworking() {
  373 + showMessage(message: "获取失败")
  374 + resultBlock(NSNull(),.failed)
  375 + } else {
  376 + showMessage(message: "似乎与网络断开链接")
  377 + resultBlock(NSNull(),.noNetwork)
  378 + }
  379 + }
  380 + }
  381 + }
  382 +
244 383 /// 获取最新app版本
245 384 /// - Parameter resultBlock: 结果回调
246 385 static func requestSystemNews(resultBlock: @escaping resultNewsBlock) {
... ...
metaCode/Supporting Files/Assets.xcassets/MinePage/mIne_auth_result_header_icon.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "scale" : "1x"
  6 + },
  7 + {
  8 + "filename" : "mIne_auth_result_header_icon@2x.png",
  9 + "idiom" : "universal",
  10 + "scale" : "2x"
  11 + },
  12 + {
  13 + "filename" : "mIne_auth_result_header_icon@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_icon.imageset/mIne_auth_result_header_icon@2x.png 0 → 100644

159 KB

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

575 KB

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

333 Bytes

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

578 Bytes