Commit 7288c14de7053e22afaab90e951771c319cc6b93

Authored by “张旭”
1 parent 6a7dcb1a

机构认证部分逻辑

metaCode/Classes/Main/HomePage/Controller/AuthMainController/CNMetaCodeHomePageController.swift
... ... @@ -665,56 +665,110 @@ class CNMetaCodeHomePageController:CNLiveBaseViewController, NewPagedFlowViewDel
665 665 }
666 666 }
667 667  
668   - // MARK: - 获取身份信息是个人认证还是企业认证
  668 + // MARK: - 获取身份信息是个人认证还是企业认证,机构认证
669 669 func getStandInfo(identityId:String){
670 670 CNLiveMineViewModel.requestsStandInfo(identityId: identityId, type: .effect, authType: .person) { result, respStatue in
671 671 hiddenLoading()
672 672 if respStatue == .success{
673 673 let standInfoBaseModel = result as! MineStandInfoBaseModel
  674 + self.dataArray.forEach { standListModel in
  675 + let listModel = standListModel as! StandListModel
  676 + listModel.standInfoBaseModel = standInfoBaseModel
  677 + }
  678 +
674 679 if standInfoBaseModel.authInfos.count > 0{
675 680 //个人认证有值
676 681 if standInfoBaseModel.enterpriseAuthInfos.count > 0{
677   - //企业认证有值
  682 + //个人有值,企业认证有值
  683 + if standInfoBaseModel.agencyAuthInfos.count > 0{
  684 + //个人有值,企业有值,机构认证有值
  685 + self.dataArray.forEach { standListModel in
  686 + let listModel = standListModel as! StandListModel
  687 + if listModel.id == standInfoBaseModel.identityId{
  688 + //目标model,企业+个人+机构
  689 + listModel.isPersonOrEnterprise = 4
  690 + }
  691 + }
  692 +
  693 + }else{
  694 + //个人有值,企业有值,机构认证没值
  695 + self.dataArray.forEach { standListModel in
  696 + let listModel = standListModel as! StandListModel
  697 + if listModel.id == standInfoBaseModel.identityId{
  698 + //目标model,企业+个人
  699 + listModel.isPersonOrEnterprise = 0
  700 + }
  701 + }
  702 + }
  703 +
  704 + }else{
  705 + //个人有值,企业认证没值
  706 + if standInfoBaseModel.agencyAuthInfos.count > 0{
  707 + //个人有值,企业没值,机构有值
  708 + self.dataArray.forEach { standListModel in
  709 + let listModel = standListModel as! StandListModel
  710 + if listModel.id == standInfoBaseModel.identityId{
  711 + //目标model
  712 + listModel.isPersonOrEnterprise = 0
  713 + }
  714 + }
  715 + }else{
  716 + //个人有值,企业没值,机构没值
  717 + self.dataArray.forEach { standListModel in
  718 + let listModel = standListModel as! StandListModel
  719 + if listModel.id == standInfoBaseModel.identityId{
  720 + //目标model ,个人
  721 + listModel.isPersonOrEnterprise = 1
  722 + }
  723 + }
  724 + }
  725 + }
  726 +
  727 + }else if standInfoBaseModel.enterpriseAuthInfos.count > 0{
  728 + //企业认证有值,个人没值
  729 + if standInfoBaseModel.agencyAuthInfos.count > 0{
  730 + ///企业有值,个人没值,机构有值
678 731 self.dataArray.forEach { standListModel in
679 732 let listModel = standListModel as! StandListModel
680 733 if listModel.id == standInfoBaseModel.identityId{
681   - //目标model,企业+个人
  734 + //目标model
682 735 listModel.isPersonOrEnterprise = 0
683 736 }
684 737 }
685   -
686 738 }else{
687   - //企业认证没值
688   - //只显示个人
  739 + ///企业有值,个人没值,机构没值
689 740 self.dataArray.forEach { standListModel in
690 741 let listModel = standListModel as! StandListModel
691 742 if listModel.id == standInfoBaseModel.identityId{
692   - //目标model ,个人
693   - listModel.isPersonOrEnterprise = 1
  743 + //目标model ,企业
  744 + listModel.isPersonOrEnterprise = 2
694 745 }
695 746 }
696 747 }
697 748  
698   - }else if standInfoBaseModel.enterpriseAuthInfos.count > 0{
699   - //企业认证有值,个人没值
700   - //只显示企业
701   - self.dataArray.forEach { standListModel in
702   - let listModel = standListModel as! StandListModel
703   - if listModel.id == standInfoBaseModel.identityId{
704   - //目标model ,企业
705   - listModel.isPersonOrEnterprise = 2
706   - }
707   - }
708 749  
709 750 }else{
710 751 //企业个人都没值
711   - self.dataArray.forEach { standListModel in
712   - let listModel = standListModel as! StandListModel
713   - if listModel.id == standInfoBaseModel.identityId{
714   - //目标model ,已认证/无企业和个人
715   - listModel.isPersonOrEnterprise = 3
  752 + if standInfoBaseModel.agencyAuthInfos.count > 0{
  753 + //企业没值,个人没值,机构有值
  754 + self.dataArray.forEach { standListModel in
  755 + let listModel = standListModel as! StandListModel
  756 + if listModel.id == standInfoBaseModel.identityId{
  757 + //目标model 机构
  758 + listModel.isPersonOrEnterprise = 5
  759 + }
  760 + }
  761 + }else{
  762 + //企业没值,个人没值,机构没值
  763 + self.dataArray.forEach { standListModel in
  764 + let listModel = standListModel as! StandListModel
  765 + if listModel.id == standInfoBaseModel.identityId{
  766 + //目标model ,已认证/无企业和个人
  767 + listModel.isPersonOrEnterprise = 3
  768 + }
716 769 }
717 770 }
  771 +
718 772 }
719 773 self.pageFlowView.reloadData()
720 774 }else{
... ...
metaCode/Classes/Main/HomePage/View/VerticalViews/MainView/CNMainView.swift
... ... @@ -75,7 +75,15 @@ class CNFrontMainView : UIView{
75 75 make.width.equalTo(120)
76 76 make.height.equalTo(36)
77 77 }
78   -
  78 +
  79 + frontDescContentView.addSubview(self.unStandBtnBgView)
  80 + unStandBtnBgView.snp.makeConstraints { make in
  81 + make.left.equalToSuperview().offset(30)
  82 + make.bottom.equalToSuperview().offset(-45)
  83 + make.width.equalTo(self.width-60)
  84 + make.height.equalTo(36)
  85 + }
  86 +
79 87  
80 88 frontDescContentView.addSubview(self.textView)
81 89 textView.snp.makeConstraints { make in
... ... @@ -105,7 +113,7 @@ class CNFrontMainView : UIView{
105 113 return textView
106 114 }()
107 115  
108   - ///未认证-店铺认证 按钮
  116 + ///未认证-店铺认证 按钮(一个按钮时)
109 117 lazy var addStandBtn: UIButton = {
110 118 let addStandBtn = UIButton(type: .custom)
111 119 addStandBtn.clipsToBounds = true
... ... @@ -118,7 +126,7 @@ class CNFrontMainView : UIView{
118 126 return addStandBtn
119 127 }()
120 128  
121   - ///未认证-个人认证 按钮
  129 + ///未认证-个人认证 按钮(两个按钮时第一个)
122 130 lazy var personalStandBtn: UIButton = {
123 131 let personalStandBtn = UIButton(type: .custom)
124 132 personalStandBtn.layer.cornerRadius = 19.5
... ... @@ -127,9 +135,10 @@ class CNFrontMainView : UIView{
127 135 personalStandBtn.setTitleColor(HexColor("#FFFFFF"), for: .normal)
128 136 personalStandBtn.titleLabel?.font = UIFont.init(name: "PingFangSC-Medium", size: 14)
129 137 personalStandBtn.addTarget(self, action: #selector(personalStandBtnAction), for: .touchUpInside)
  138 + personalStandBtn.isHidden = true
130 139 return personalStandBtn
131 140 }()
132   - ///未认证-企业认证 按钮
  141 + ///未认证-企业认证 按钮(两个按钮时第二个)
133 142 lazy var enterpriseStandBtn: UIButton = {
134 143 let enterpriseStandBtn = UIButton(type: .custom)
135 144 enterpriseStandBtn.layer.cornerRadius = 19.5
... ... @@ -138,8 +147,16 @@ class CNFrontMainView : UIView{
138 147 enterpriseStandBtn.setTitleColor(HexColor("#FFFFFF"), for: .normal)
139 148 enterpriseStandBtn.titleLabel?.font = UIFont.init(name: "PingFangSC-Medium", size: 14)
140 149 enterpriseStandBtn.addTarget(self, action: #selector(enterpriseStandBtnAction), for: .touchUpInside)
  150 + enterpriseStandBtn.isHidden = true
141 151 return enterpriseStandBtn
142 152 }()
  153 + //未认证-3个认证按钮背景图
  154 + lazy var unStandBtnBgView :UIView = {
  155 + let unStandBtnBgView = UIView(frame: CGRect(x: 0, y: 0, width: 0, height: 0))
  156 + unStandBtnBgView.backgroundColor = .red
  157 + return unStandBtnBgView
  158 + }()
  159 +
143 160  
144 161 //上滑更多Gif
145 162 lazy var upMoreGIF: UIImageView = {
... ... @@ -220,10 +237,9 @@ class CNFrontMainView : UIView{
220 237 self.addStandBtn.isHidden = true
221 238 self.iDCardView.idModel = newValue!
222 239 cardViewBgImgView.kf.setImage(with: URL(string: _idModel!.cardBackgroundImg), placeholder: UIImage(named: "homepage_cardBGImg"))
223   -
224   -
225 240 //隐藏textview
226 241 textView.isHidden = true
  242 + unStandBtnBgView.isHidden = true
227 243  
228 244 if frontCardContentView.contains(self.upMoreGIF){
229 245 self.upMoreGIF.removeFromSuperview()
... ... @@ -269,6 +285,7 @@ class CNFrontMainView : UIView{
269 285 self.addStandBtn.isHidden = false
270 286 self.personalStandBtn.isHidden = true
271 287 self.enterpriseStandBtn.isHidden = true
  288 + self.unStandBtnBgView.isHidden = true
272 289 self.addStandBtn.isUserInteractionEnabled = true
273 290 if idModel?.shopInfoModel?.state == "0" || idModel?.shopInfoModel?.state == "4"{
274 291 //0未申请 //4闭店
... ... @@ -293,30 +310,63 @@ class CNFrontMainView : UIView{
293 310 upMoreGIF.isHidden = false
294 311 downMoreGIF.isHidden = false
295 312  
296   - if idModel?.isPersonOrEnterprise == 0{//企业+个人
  313 + if idModel?.isPersonOrEnterprise == 0{//企业+个人等 2个按钮
297 314 self.addStandBtn.isHidden = true
298 315 self.personalStandBtn.isHidden = false
299 316 self.enterpriseStandBtn.isHidden = false
  317 + unStandBtnBgView.isHidden = true
  318 + let presonInfoCount = self.idModel?.standInfoBaseModel?.authInfos.count ?? 0
  319 + let enterInfoCount = self.idModel?.standInfoBaseModel?.enterpriseAuthInfos.count ?? 0
  320 + let agencyInfoCount = self.idModel?.standInfoBaseModel?.agencyAuthInfos.count ?? 0
  321 + if presonInfoCount > 0 && enterInfoCount > 0{
  322 + //个人+企业
  323 + self.personalStandBtn.setTitle("个人认证", for: .normal)
  324 + self.enterpriseStandBtn.setTitle("企业认证", for: .normal)
  325 + }else if presonInfoCount > 0 && agencyInfoCount > 0{
  326 + //个人+机构
  327 + self.personalStandBtn.setTitle("个人认证", for: .normal)
  328 + self.enterpriseStandBtn.setTitle("机构认证", for: .normal)
  329 + }else if enterInfoCount > 0 && agencyInfoCount > 0{
  330 + //企业+机构
  331 + self.personalStandBtn.setTitle("企业认证", for: .normal)
  332 + self.enterpriseStandBtn.setTitle("机构认证", for: .normal)
  333 + }
300 334 }else if idModel?.isPersonOrEnterprise == 1{//个人
301 335 self.addStandBtn.isHidden = false
302 336 self.addStandBtn.setTitle("个人认证", for: .normal)
303 337 self.personalStandBtn.isHidden = true
304 338 self.enterpriseStandBtn.isHidden = true
  339 + self.unStandBtnBgView.isHidden = true
305 340 }else if idModel?.isPersonOrEnterprise == 2{//企业
306 341 self.addStandBtn.isHidden = false
307 342 self.addStandBtn.setTitle("企业认证", for: .normal)
308 343 self.personalStandBtn.isHidden = true
309 344 self.enterpriseStandBtn.isHidden = true
  345 + self.unStandBtnBgView.isHidden = true
310 346 }else if idModel?.isPersonOrEnterprise == 3{//已认证/无企业和个人
311 347 //不显示认证按钮
312 348 self.addStandBtn.isHidden = true
313 349 self.personalStandBtn.isHidden = true
314 350 self.enterpriseStandBtn.isHidden = true
  351 + self.unStandBtnBgView.isHidden = true
  352 + }else if idModel?.isPersonOrEnterprise == 4{//个人+企业+机构
  353 + //显示认证按钮
  354 + self.addStandBtn.isHidden = true
  355 + self.personalStandBtn.isHidden = true
  356 + self.enterpriseStandBtn.isHidden = true
  357 + self.unStandBtnBgView.isHidden = false
  358 + }else if idModel?.isPersonOrEnterprise == 5{//机构
  359 + self.addStandBtn.isHidden = false
  360 + self.addStandBtn.setTitle("机构认证", for: .normal)
  361 + self.personalStandBtn.isHidden = true
  362 + self.enterpriseStandBtn.isHidden = true
  363 + self.unStandBtnBgView.isHidden = true
315 364 }else{
316 365 //不显示认证按钮
317 366 self.addStandBtn.isHidden = true
318 367 self.personalStandBtn.isHidden = false
319 368 self.enterpriseStandBtn.isHidden = false
  369 + self.unStandBtnBgView.isHidden = true
320 370 }
321 371 }
322 372  
... ... @@ -405,6 +455,10 @@ class CNFrontMainView : UIView{
405 455 //企业
406 456 navigationViewController().pushViewController(CNLiveMineInputViewController.init(listModel: self._idModel!, authType: .enterprise), animated: pushAnimated)
407 457  
  458 + }else if self._idModel!.isPersonOrEnterprise == 5{
  459 + //机构
  460 + navigationViewController().pushViewController(CNLiveMineInputViewController.init(listModel: self._idModel!, authType: .enterprise), animated: pushAnimated)//enterprise换成机构
  461 +
408 462 }else{
409 463 if isPersonOrEnterprise == 1{
410 464 navigationViewController().pushViewController(CNLiveMineInputViewController.init(listModel: self._idModel!, authType: .person), animated: pushAnimated)
... ...
metaCode/Classes/Main/MinePage/ViewModel/CNLiveMineBaseModel.swift
... ... @@ -160,11 +160,14 @@ final class StandListModel: BaseModel {//, TableCodable {
160 160 var createTimeString: String = ""//-
161 161 var timeString: String = ""
162 162  
  163 + ////自定义属性
163 164 //电商身份专用
164 165 var shopInfoModel: MineApplyShopInfoModel?
165 166  
166   - ///自定义 判断是 0个人+企业 , 1个人, 2企业 3已认证/无企业和个人
  167 + ///自定义 判断是 0个人+企业(两个组合) , 1个人, 2企业 3已认证/无企业和个人 , 4个人+企业+机构 5机构
167 168 var isPersonOrEnterprise: Int = 0
  169 + //身份详情model
  170 + var standInfoBaseModel:MineStandInfoBaseModel?
168 171  
169 172 override func mapping(mapper: HelpingMapper) {
170 173 mapper <<<
... ... @@ -222,8 +225,9 @@ final class StandListModel: BaseModel {//, TableCodable {
222 225  
223 226 // !!!: /api/identityApi/getIdentity 接口标记
224 227 class MineStandInfoBaseModel: BaseModel {
225   - var authInfos = [MineStandInfoModel]()
226   - var enterpriseAuthInfos = [MineStandInfoModel]()
  228 + var authInfos = [MineStandInfoModel]()//个人认证
  229 + var enterpriseAuthInfos = [MineStandInfoModel]()//企业认证
  230 + var agencyAuthInfos = [MineStandInfoModel]()//机构认证
227 231 var icon: String?
228 232 var name: String?
229 233 var identityId: Int = 0
... ... @@ -240,7 +244,8 @@ class MineStandInfoModel: BaseModel {
240 244 var sort: Int = 0
241 245 var name: String?//卡片标签
242 246 var sub_title: String?//报名项说明
243   - var inputType: Int = 0//1 文本输入 2数字输入 3下拉选择 4认证时间 5认证编码 6正图 7小竖图 8大横图 9单选 10多选 11选项 12时间选择器 13主标题 16大文本框
  247 + var inputType: Int = 0//1 文本输入 2数字输入 3下拉选择 4认证时间 5认证编码 6正图 7小竖图 8大横图 9单选 10多选 11选项 12时间选择器 13主标题 16大文本框 17弹窗
  248 + var subTitle: String?//17时弹窗 inputType =17 弹窗; subTitle 返回json image、jumpType 、jumpPath ;jumpType 沿用身份里的类型 ‘1 外链 2原生页面 3店铺详情 4 店铺控制台’ 并新增 ‘5上滑地址 6下滑地址’
244 249 var nonEmpty: Bool = false
245 250 var length: Int = 10
246 251 var children = [MineStandInfoModel]()
... ... @@ -250,6 +255,11 @@ class MineStandInfoModel: BaseModel {
250 255 var value: String? = ""//自己定义的值
251 256  
252 257 }
  258 +class MineStandInfoSubTitleModel: BaseModel {
  259 + var image: String? = ""//弹窗图片
  260 + var jumpType: String? = ""//弹窗点击跳转类型
  261 + var jumpPath: String? = ""//弹窗点击跳转地址
  262 +}
253 263  
254 264 // !!!: api/identityApi/myList 数据返回
255 265 class MineAuthListBaseModel: BaseModel {
... ...