Commit 1f37aa8e43f1e0c57d985d3fccfddc38ff8e7a20
1 parent
9aaeca12
1.提前加载认证
2.企业认证和个人认证逻辑 3.已认证卡片UI 4.身份列表 网络缓存
Showing
7 changed files
with
317 additions
and
105 deletions
metaCode/Classes/Common/Base/CNLiveBaseTabBarViewController.swift
| @@ -36,12 +36,6 @@ class CNLiveBaseTabBarViewController: UITabBarController | @@ -36,12 +36,6 @@ class CNLiveBaseTabBarViewController: UITabBarController | ||
| 36 | self.setupBackgroup() | 36 | self.setupBackgroup() |
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | -// override func viewWillAppear(_ animated: Bool) { | ||
| 40 | -// super.viewWillAppear(animated) | ||
| 41 | -// | ||
| 42 | -// self.selectedIndex = 0 | ||
| 43 | -// | ||
| 44 | -// } | ||
| 45 | override func viewDidAppear(_ animated: Bool) { | 39 | override func viewDidAppear(_ animated: Bool) { |
| 46 | super.viewDidAppear(animated) | 40 | super.viewDidAppear(animated) |
| 47 | print("获取用户用户数据=====>\(UserInfoManager.shared.userInfo.uid)") | 41 | print("获取用户用户数据=====>\(UserInfoManager.shared.userInfo.uid)") |
| @@ -58,9 +52,9 @@ class CNLiveBaseTabBarViewController: UITabBarController | @@ -58,9 +52,9 @@ class CNLiveBaseTabBarViewController: UITabBarController | ||
| 58 | // MARK: - 控制器的信息 | 52 | // MARK: - 控制器的信息 |
| 59 | func setUpTabBar() { | 53 | func setUpTabBar() { |
| 60 | 54 | ||
| 61 | - let homeVC = CNLiveAuthViewController() | ||
| 62 | - let authVC = CNMetaCodeHomePageController() | ||
| 63 | - let mineVC = CNLiveMineViewController() | 55 | + let homeVC = CNLiveAuthViewController.init() |
| 56 | + let authVC = CNMetaCodeHomePageController.init() | ||
| 57 | + let mineVC = CNLiveMineViewController.init() | ||
| 64 | 58 | ||
| 65 | creatTabbarView(viewController: homeVC, image: "tabbar_hoem_icon_default", selectImage: "tabbar_hoem_icon_selected", title: "首页") | 59 | creatTabbarView(viewController: homeVC, image: "tabbar_hoem_icon_default", selectImage: "tabbar_hoem_icon_selected", title: "首页") |
| 66 | creatTabbarView(viewController: authVC, image: "tabbar_authentication_unSelect", selectImage: "tabbar_authentication", title: "认证") | 60 | creatTabbarView(viewController: authVC, image: "tabbar_authentication_unSelect", selectImage: "tabbar_authentication", title: "认证") |
| @@ -74,6 +68,11 @@ class CNLiveBaseTabBarViewController: UITabBarController | @@ -74,6 +68,11 @@ class CNLiveBaseTabBarViewController: UITabBarController | ||
| 74 | CNLiveBaseNavigationController(rootViewController: mineVC) | 68 | CNLiveBaseNavigationController(rootViewController: mineVC) |
| 75 | ] | 69 | ] |
| 76 | 70 | ||
| 71 | + //提前加载认证的viewDidLoad,但是会走两遍 | ||
| 72 | + DispatchQueue.main.asyncAfter(deadline: .now() + 1) { | ||
| 73 | + authVC.viewDidLoad() | ||
| 74 | + } | ||
| 75 | + | ||
| 77 | } | 76 | } |
| 78 | 77 | ||
| 79 | // MARK: - Tabar 背景图 | 78 | // MARK: - Tabar 背景图 |
metaCode/Classes/Main/HomePage/Controller/AuthMainController/CNMetaCodeHomePageController.swift
| @@ -622,13 +622,30 @@ class CNMetaCodeHomePageController:CNLiveBaseViewController, NewPagedFlowViewDel | @@ -622,13 +622,30 @@ class CNMetaCodeHomePageController:CNLiveBaseViewController, NewPagedFlowViewDel | ||
| 622 | self.NetApiStatus = .success | 622 | self.NetApiStatus = .success |
| 623 | let listArray:NSArray = (result as! StandListBaseModel).list as NSArray | 623 | let listArray:NSArray = (result as! StandListBaseModel).list as NSArray |
| 624 | if (listArray.count > 0){ | 624 | if (listArray.count > 0){ |
| 625 | - | 625 | + |
| 626 | self.dataArray = NSMutableArray.init() | 626 | self.dataArray = NSMutableArray.init() |
| 627 | self.dataArray.addObjects(from: listArray as! [Any]) | 627 | self.dataArray.addObjects(from: listArray as! [Any]) |
| 628 | self.addPageView() | 628 | self.addPageView() |
| 629 | 629 | ||
| 630 | self.backgroupView.updateData(idArray: listArray as! Array<StandListModel>) | 630 | self.backgroupView.updateData(idArray: listArray as! Array<StandListModel>) |
| 631 | 631 | ||
| 632 | + //请求身份详情,判断是企业认证还是个人认证 | ||
| 633 | + listArray.forEach { standListModel in | ||
| 634 | + let listModel = standListModel as! StandListModel | ||
| 635 | + if listModel.auth{ | ||
| 636 | + //已认证 | ||
| 637 | + listModel.isPersonOrEnterprise = 3 | ||
| 638 | + }else{ | ||
| 639 | + //未认证 | ||
| 640 | + self.getStandInfo(identityId: "\(listModel.id)") | ||
| 641 | +// if self.unStandModelArray.contains(listModel){ | ||
| 642 | +// | ||
| 643 | +// }else{ | ||
| 644 | +// self.unStandModelArray.add(listModel) | ||
| 645 | +// } | ||
| 646 | + } | ||
| 647 | + } | ||
| 648 | + | ||
| 632 | }else{ | 649 | }else{ |
| 633 | self.NetApiStatus = .apiError | 650 | self.NetApiStatus = .apiError |
| 634 | // self.identityStatus = .notCertified | 651 | // self.identityStatus = .notCertified |
| @@ -643,25 +660,70 @@ class CNMetaCodeHomePageController:CNLiveBaseViewController, NewPagedFlowViewDel | @@ -643,25 +660,70 @@ class CNMetaCodeHomePageController:CNLiveBaseViewController, NewPagedFlowViewDel | ||
| 643 | } | 660 | } |
| 644 | } | 661 | } |
| 645 | 662 | ||
| 663 | + // MARK: - 获取身份信息是个人认证还是企业认证 | ||
| 664 | + func getStandInfo(identityId:String){ | ||
| 665 | + CNLiveMineViewModel.requestsStandInfo(identityId: identityId, type: .effect, authType: .person) { result, respStatue in | ||
| 666 | + hiddenLoading() | ||
| 667 | + if respStatue == .success{ | ||
| 668 | + let standInfoBaseModel = result as! MineStandInfoBaseModel | ||
| 669 | + if standInfoBaseModel.authInfos.count > 0{ | ||
| 670 | + //个人认证有值 | ||
| 671 | + if standInfoBaseModel.enterpriseAuthInfos.count > 0{ | ||
| 672 | + //企业认证有值 | ||
| 673 | + self.dataArray.forEach { standListModel in | ||
| 674 | + let listModel = standListModel as! StandListModel | ||
| 675 | + if listModel.id == standInfoBaseModel.identityId{ | ||
| 676 | + //目标model,企业+个人 | ||
| 677 | + listModel.isPersonOrEnterprise = 0 | ||
| 678 | + } | ||
| 679 | + } | ||
| 680 | + | ||
| 681 | + }else{ | ||
| 682 | + //企业认证没值 | ||
| 683 | + //只显示个人 | ||
| 684 | + self.dataArray.forEach { standListModel in | ||
| 685 | + let listModel = standListModel as! StandListModel | ||
| 686 | + if listModel.id == standInfoBaseModel.identityId{ | ||
| 687 | + //目标model ,个人 | ||
| 688 | + listModel.isPersonOrEnterprise = 1 | ||
| 689 | + } | ||
| 690 | + } | ||
| 691 | + } | ||
| 692 | + | ||
| 693 | + }else if standInfoBaseModel.enterpriseAuthInfos.count > 0{ | ||
| 694 | + //企业认证有值,个人没值 | ||
| 695 | + //只显示企业 | ||
| 696 | + self.dataArray.forEach { standListModel in | ||
| 697 | + let listModel = standListModel as! StandListModel | ||
| 698 | + if listModel.id == standInfoBaseModel.identityId{ | ||
| 699 | + //目标model ,企业 | ||
| 700 | + listModel.isPersonOrEnterprise = 2 | ||
| 701 | + } | ||
| 702 | + } | ||
| 703 | + | ||
| 704 | + }else{ | ||
| 705 | + //企业个人都没值 | ||
| 706 | + self.dataArray.forEach { standListModel in | ||
| 707 | + let listModel = standListModel as! StandListModel | ||
| 708 | + if listModel.id == standInfoBaseModel.identityId{ | ||
| 709 | + //目标model ,已认证/无企业和个人 | ||
| 710 | + listModel.isPersonOrEnterprise = 3 | ||
| 711 | + } | ||
| 712 | + } | ||
| 713 | + } | ||
| 714 | + self.pageFlowView.reloadData() | ||
| 715 | + }else{ | ||
| 716 | + //网络请求失败 | ||
| 717 | + } | ||
| 718 | + } | ||
| 719 | + } | ||
| 720 | + | ||
| 721 | + // MARK: - 获取电商状态 | ||
| 646 | func getApplyShopInfo(){ | 722 | func getApplyShopInfo(){ |
| 647 | //获取当前店铺审核状态 | 723 | //获取当前店铺审核状态 |
| 648 | CNLiveMineViewModel.requestApplyShopInfo { [weak self] result, respStatue in | 724 | CNLiveMineViewModel.requestApplyShopInfo { [weak self] result, respStatue in |
| 649 | if respStatue == .success{ | 725 | if respStatue == .success{ |
| 650 | let shopModel = result as! MineApplyShopInfoModel | 726 | let shopModel = result as! MineApplyShopInfoModel |
| 651 | -// if shopModel.state == "0" || shopModel.state == "4"{ | ||
| 652 | -// //0未申请 //4闭店 | ||
| 653 | -// //未认证->店铺认证 | ||
| 654 | -// | ||
| 655 | -// }else if shopModel.state == "1"{ | ||
| 656 | -// //开店 | ||
| 657 | -// //已认证->显示卡片 | ||
| 658 | -// }else if shopModel.state == "2"{ | ||
| 659 | -// //申请中 | ||
| 660 | -// //"资料审核中" | ||
| 661 | -// }else if shopModel.state == "3"{ | ||
| 662 | -// //已拒绝 | ||
| 663 | -// //"重新修改提交" | ||
| 664 | -// } | ||
| 665 | self!.dataArray.forEach {listModel in | 727 | self!.dataArray.forEach {listModel in |
| 666 | let model = listModel as! StandListModel | 728 | let model = listModel as! StandListModel |
| 667 | model.shopStatus = shopModel.state | 729 | model.shopStatus = shopModel.state |
metaCode/Classes/Main/HomePage/View/VerticalViews/DownSlide/CNLiveDownSlideTodayRecommendCell.swift
| @@ -51,7 +51,7 @@ class CNLiveDownSlideTodayRecommendCell: UITableViewCell { | @@ -51,7 +51,7 @@ class CNLiveDownSlideTodayRecommendCell: UITableViewCell { | ||
| 51 | for i in 0..<totalNum{//i是第几行 | 51 | for i in 0..<totalNum{//i是第几行 |
| 52 | let contentMdl = model.contents[i] | 52 | let contentMdl = model.contents[i] |
| 53 | let imageView = UIImageView(frame: CGRectMake(DownSlideRecommendLeftGap, CGFloat(i)*(DownSlideTodayRecommendH+DownSlideRecommendLeftGap), CGFloat(DownSlideTodayRecommendW), CGFloat(DownSlideTodayRecommendH))) | 53 | let imageView = UIImageView(frame: CGRectMake(DownSlideRecommendLeftGap, CGFloat(i)*(DownSlideTodayRecommendH+DownSlideRecommendLeftGap), CGFloat(DownSlideTodayRecommendW), CGFloat(DownSlideTodayRecommendH))) |
| 54 | - imageView.kf.setImage(with: URL(string:contentMdl.poster!)) | 54 | + imageView.kf.setImage(with: URL(string:contentMdl.poster ?? "")) |
| 55 | imageView.tag = i | 55 | imageView.tag = i |
| 56 | imageView.layer.cornerRadius = 12 | 56 | imageView.layer.cornerRadius = 12 |
| 57 | imageView.clipsToBounds = true | 57 | imageView.clipsToBounds = true |
metaCode/Classes/Main/HomePage/View/VerticalViews/MainView/CNIDCardView.swift
| @@ -17,7 +17,7 @@ class CNIDCardView: UIView{ | @@ -17,7 +17,7 @@ class CNIDCardView: UIView{ | ||
| 17 | } | 17 | } |
| 18 | set{ | 18 | set{ |
| 19 | _idModel = newValue | 19 | _idModel = newValue |
| 20 | - iDCardBGView.kf.setImage(with: URL(string: _idModel!.cardImg), placeholder: UIImage(named: "homePage_idCardBG")) | 20 | + self.iDCardBGView.kf.setImage(with: URL(string: _idModel!.cardImg), placeholder: UIImage(named: "homePage_idCardBG")) |
| 21 | nameLabel.textColor = HexColor("\(_idModel!.backgroundColor)") | 21 | nameLabel.textColor = HexColor("\(_idModel!.backgroundColor)") |
| 22 | sexLabel.textColor = HexColor("\(_idModel!.backgroundColor)") | 22 | sexLabel.textColor = HexColor("\(_idModel!.backgroundColor)") |
| 23 | dateLabel.textColor = HexColor("\(_idModel!.backgroundColor)") | 23 | dateLabel.textColor = HexColor("\(_idModel!.backgroundColor)") |
| @@ -34,7 +34,7 @@ class CNIDCardView: UIView{ | @@ -34,7 +34,7 @@ class CNIDCardView: UIView{ | ||
| 34 | override init(frame: CGRect) { | 34 | override init(frame: CGRect) { |
| 35 | super.init(frame: frame) | 35 | super.init(frame: frame) |
| 36 | self.initUI() | 36 | self.initUI() |
| 37 | - self.makeConstraints() | 37 | +// self.makeConstraints() |
| 38 | } | 38 | } |
| 39 | 39 | ||
| 40 | required init?(coder: NSCoder) { | 40 | required init?(coder: NSCoder) { |
| @@ -44,51 +44,94 @@ class CNIDCardView: UIView{ | @@ -44,51 +44,94 @@ class CNIDCardView: UIView{ | ||
| 44 | func initUI() | 44 | func initUI() |
| 45 | { | 45 | { |
| 46 | self.addSubview(self.contentView) | 46 | self.addSubview(self.contentView) |
| 47 | - self.contentView.addSubview(self.iDCardBGView) | ||
| 48 | - self.contentView.addSubview(self.nameLabel) | ||
| 49 | - self.contentView.addSubview(self.sexLabel) | ||
| 50 | - self.contentView.addSubview(self.dateLabel) | ||
| 51 | - self.contentView.addSubview(self.IDLabel) | ||
| 52 | - self.contentView.addSubview(self.nameValueLabel) | ||
| 53 | - self.contentView.addSubview(self.sexValueLabel) | ||
| 54 | - self.contentView.addSubview(self.dateValueLabel) | ||
| 55 | - self.contentView.addSubview(self.IDValueLabel) | ||
| 56 | - self.contentView.addSubview(self.iDIconImgView) | 47 | + self.contentView.snp.makeConstraints { make in |
| 48 | + make.centerX.equalToSuperview() | ||
| 49 | + make.centerY.equalToSuperview() | ||
| 50 | + make.width.equalToSuperview() | ||
| 51 | + make.height.equalToSuperview() | ||
| 52 | + } | ||
| 53 | + self.addSubview(self.iDCardBGView) | ||
| 54 | + self.iDCardBGView.snp.makeConstraints { make in | ||
| 55 | + make.centerX.equalToSuperview() | ||
| 56 | + make.centerY.equalToSuperview() | ||
| 57 | + make.width.equalToSuperview() | ||
| 58 | + make.height.equalToSuperview() | ||
| 59 | + } | ||
| 60 | +// self.contentView.addSubview(self.nameLabel) | ||
| 61 | +// self.contentView.addSubview(self.sexLabel) | ||
| 62 | +// self.contentView.addSubview(self.dateLabel) | ||
| 63 | +// self.contentView.addSubview(self.IDLabel) | ||
| 64 | +// self.contentView.addSubview(self.nameValueLabel) | ||
| 65 | +// self.contentView.addSubview(self.sexValueLabel) | ||
| 66 | +// self.contentView.addSubview(self.dateValueLabel) | ||
| 67 | +// self.contentView.addSubview(self.IDValueLabel) | ||
| 68 | +// self.contentView.addSubview(self.iDIconImgView) | ||
| 57 | 69 | ||
| 58 | } | 70 | } |
| 59 | 71 | ||
| 60 | func loadIDDetailData(){ | 72 | func loadIDDetailData(){ |
| 61 | // showLoading(message: "") | 73 | // showLoading(message: "") |
| 62 | - CNLiveMineViewModel.requestsStandInfo(identityId: "\(_idModel!.id)", type: .havedate, authType: .person) { result, respStatue in | 74 | + self.subviews.forEach { view in |
| 75 | + if view.tag >= 10000{ | ||
| 76 | + view.removeFromSuperview() | ||
| 77 | + } | ||
| 78 | + } | ||
| 79 | + CNLiveMineViewModel.requestsStandInfo(identityId: "\(_idModel!.id)", type: .havedate, authType: .person) { [self] result, respStatue in | ||
| 63 | hiddenLoading() | 80 | hiddenLoading() |
| 64 | if respStatue == .success { | 81 | if respStatue == .success { |
| 65 | let cardArray = result as! NSMutableArray | 82 | let cardArray = result as! NSMutableArray |
| 83 | + let count = cardArray.count | ||
| 66 | if cardArray.count > 0{ | 84 | if cardArray.count > 0{ |
| 67 | for i in (0..<cardArray.count){ | 85 | for i in (0..<cardArray.count){ |
| 68 | let idCardModel = cardArray[i] as! MineStandInfoModel | 86 | let idCardModel = cardArray[i] as! MineStandInfoModel |
| 69 | - switch idCardModel.name { | ||
| 70 | - case "姓名": | ||
| 71 | - self.nameValueLabel.text = idCardModel.userInfo | ||
| 72 | - case "性别": | ||
| 73 | - self.sexValueLabel.text = idCardModel.userInfo | ||
| 74 | - case "认证时间": | ||
| 75 | - self.dateValueLabel.text = idCardModel.userInfo | ||
| 76 | - case "编号": | ||
| 77 | - self.IDValueLabel.text = idCardModel.userInfo | ||
| 78 | - case "证件照": | ||
| 79 | - let str:String = idCardModel.userInfo! | ||
| 80 | - if(str.isEmpty){ | ||
| 81 | - self.iDIconImgView.isHidden = true | ||
| 82 | - }else | ||
| 83 | - { | ||
| 84 | - self.iDIconImgView.isHidden = false | ||
| 85 | - self.iDIconImgView.kf.setImage(with: URL(string: str)) | ||
| 86 | - } | ||
| 87 | - | ||
| 88 | - self.iDCardBGView.kf.setImage(with: URL(string: self._idModel!.cardImg), placeholder: UIImage(named: "homePage_idCardBG")) | ||
| 89 | - default: | ||
| 90 | - break | ||
| 91 | - } | 87 | + let siBianGap:CGFloat = 17 |
| 88 | + let labelsGap:CGFloat = 10 | ||
| 89 | + | ||
| 90 | + let keyLabel = UILabel.init() | ||
| 91 | + keyLabel.textColor = HexColor(_idModel?.backgroundColor ?? "") | ||
| 92 | + keyLabel.textAlignment = .left | ||
| 93 | + keyLabel.font = Font(15) | ||
| 94 | + keyLabel.backgroundColor = .clear | ||
| 95 | + keyLabel.text = idCardModel.name ?? "" | ||
| 96 | + keyLabel.frame = CGRect(x: siBianGap, y: siBianGap+CGFloat(i)*21+CGFloat(i)*labelsGap, width: 70, height: 21) | ||
| 97 | + keyLabel.adjustsFontSizeToFitWidth = true | ||
| 98 | + keyLabel.tag = 10000+i | ||
| 99 | + self.addSubview(keyLabel) | ||
| 100 | + | ||
| 101 | + let valueLabel = UILabel.init() | ||
| 102 | + valueLabel.textColor = HexColor(_idModel?.backgroundColor ?? "") | ||
| 103 | + valueLabel.textAlignment = .left | ||
| 104 | + valueLabel.font = Font(15) | ||
| 105 | + valueLabel.backgroundColor = .clear | ||
| 106 | + valueLabel.text = idCardModel.userInfo ?? "" | ||
| 107 | + valueLabel.frame = CGRect(x: keyLabel.right+labelsGap+siBianGap, y: siBianGap+CGFloat(i)*21+CGFloat(i)*labelsGap, width: self.width-keyLabel.right-labelsGap-siBianGap-5, height: 21) | ||
| 108 | + valueLabel.adjustsFontSizeToFitWidth = true | ||
| 109 | + valueLabel.tag = 20000+i | ||
| 110 | + self.addSubview(valueLabel) | ||
| 111 | + | ||
| 112 | +// switch idCardModel.name { | ||
| 113 | +// case "姓名": | ||
| 114 | +// self.nameValueLabel.text = idCardModel.userInfo | ||
| 115 | +// case "性别": | ||
| 116 | +// self.sexValueLabel.text = idCardModel.userInfo | ||
| 117 | +// case "认证时间": | ||
| 118 | +// self.dateValueLabel.text = idCardModel.userInfo | ||
| 119 | +// case "编号": | ||
| 120 | +// self.IDValueLabel.text = idCardModel.userInfo | ||
| 121 | +// case "证件照": | ||
| 122 | +// let str:String = idCardModel.userInfo! | ||
| 123 | +// if(str.isEmpty){ | ||
| 124 | +// self.iDIconImgView.isHidden = true | ||
| 125 | +// }else | ||
| 126 | +// { | ||
| 127 | +// self.iDIconImgView.isHidden = false | ||
| 128 | +// self.iDIconImgView.kf.setImage(with: URL(string: str)) | ||
| 129 | +// } | ||
| 130 | +// | ||
| 131 | +// self.iDCardBGView.kf.setImage(with: URL(string: self._idModel!.cardImg), placeholder: UIImage(named: "homePage_idCardBG")) | ||
| 132 | +// default: | ||
| 133 | +// break | ||
| 134 | +// } | ||
| 92 | } | 135 | } |
| 93 | }else{ | 136 | }else{ |
| 94 | //没数据 | 137 | //没数据 |
| @@ -154,15 +197,15 @@ class CNIDCardView: UIView{ | @@ -154,15 +197,15 @@ class CNIDCardView: UIView{ | ||
| 154 | ///视图总容器 | 197 | ///视图总容器 |
| 155 | lazy var contentView : UIView = { | 198 | lazy var contentView : UIView = { |
| 156 | 199 | ||
| 157 | - let contentView = UIView.init(frame: CGRect(x: 0, y: 0, width: self.width, height: self.height )) | ||
| 158 | - contentView.backgroundColor = UIColor.white | 200 | + let contentView = UIView.init(frame: CGRect(x: 0, y: 0, width: 0, height: 0 )) |
| 201 | + contentView.backgroundColor = UIColor.clear | ||
| 159 | return contentView | 202 | return contentView |
| 160 | }() | 203 | }() |
| 161 | 204 | ||
| 162 | /// 身份卡片-背景图 | 205 | /// 身份卡片-背景图 |
| 163 | lazy var iDCardBGView:UIImageView = { | 206 | lazy var iDCardBGView:UIImageView = { |
| 164 | 207 | ||
| 165 | - let iDCardBGView:UIImageView = UIImageView(frame: CGRect(x: 20, y: 25, width: self.width-40, height: (self.width-40) * 0.64)) | 208 | + let iDCardBGView:UIImageView = UIImageView(frame: CGRect(x: 0, y: 0, width: 0, height: 0)) |
| 166 | iDCardBGView.backgroundColor = UIColor.clear | 209 | iDCardBGView.backgroundColor = UIColor.clear |
| 167 | return iDCardBGView | 210 | return iDCardBGView |
| 168 | }() | 211 | }() |
metaCode/Classes/Main/HomePage/View/VerticalViews/MainView/CNMainView.swift
| @@ -53,14 +53,6 @@ class CNFrontMainView : UIView{ | @@ -53,14 +53,6 @@ class CNFrontMainView : UIView{ | ||
| 53 | make.bottom.equalToSuperview() | 53 | make.bottom.equalToSuperview() |
| 54 | } | 54 | } |
| 55 | 55 | ||
| 56 | - frontDescContentView.addSubview(self.upMoreGIF) | ||
| 57 | - upMoreGIF.snp.makeConstraints { make in | ||
| 58 | - make.top.equalToSuperview().offset(5) | ||
| 59 | - make.right.equalToSuperview().offset(-self.width/2+24) | ||
| 60 | - make.width.equalTo(48) | ||
| 61 | - make.height.equalTo(30) | ||
| 62 | - } | ||
| 63 | - | ||
| 64 | frontDescContentView.addSubview(self.addStandBtn) | 56 | frontDescContentView.addSubview(self.addStandBtn) |
| 65 | addStandBtn.snp.makeConstraints { make in | 57 | addStandBtn.snp.makeConstraints { make in |
| 66 | make.centerX.equalToSuperview() | 58 | make.centerX.equalToSuperview() |
| @@ -84,13 +76,6 @@ class CNFrontMainView : UIView{ | @@ -84,13 +76,6 @@ class CNFrontMainView : UIView{ | ||
| 84 | make.height.equalTo(36) | 76 | make.height.equalTo(36) |
| 85 | } | 77 | } |
| 86 | 78 | ||
| 87 | - frontDescContentView.addSubview(self.downMoreGIF) | ||
| 88 | - downMoreGIF.snp.makeConstraints { make in | ||
| 89 | - make.top.equalTo(self.personalStandBtn.snp.bottom).offset((45-30)/2.0) | ||
| 90 | - make.centerX.equalTo(self.personalStandBtn.snp.right) | ||
| 91 | - make.width.equalTo(96) | ||
| 92 | - make.height.equalTo(30) | ||
| 93 | - } | ||
| 94 | 79 | ||
| 95 | frontDescContentView.addSubview(self.textView) | 80 | frontDescContentView.addSubview(self.textView) |
| 96 | textView.snp.makeConstraints { make in | 81 | textView.snp.makeConstraints { make in |
| @@ -120,7 +105,7 @@ class CNFrontMainView : UIView{ | @@ -120,7 +105,7 @@ class CNFrontMainView : UIView{ | ||
| 120 | return textView | 105 | return textView |
| 121 | }() | 106 | }() |
| 122 | 107 | ||
| 123 | - ///未认证-点击添加身份 按钮 | 108 | + ///未认证-店铺认证 按钮 |
| 124 | lazy var addStandBtn: UIButton = { | 109 | lazy var addStandBtn: UIButton = { |
| 125 | let addStandBtn = UIButton(type: .custom) | 110 | let addStandBtn = UIButton(type: .custom) |
| 126 | addStandBtn.clipsToBounds = true | 111 | addStandBtn.clipsToBounds = true |
| @@ -187,9 +172,9 @@ class CNFrontMainView : UIView{ | @@ -187,9 +172,9 @@ class CNFrontMainView : UIView{ | ||
| 187 | frontCardContentView.addSubview(self.iDCardView) | 172 | frontCardContentView.addSubview(self.iDCardView) |
| 188 | iDCardView.snp.makeConstraints { make in | 173 | iDCardView.snp.makeConstraints { make in |
| 189 | make.centerX.equalToSuperview() | 174 | make.centerX.equalToSuperview() |
| 190 | - make.top.equalToSuperview().offset(25) | ||
| 191 | - make.width.equalTo(self.width-40) | ||
| 192 | - make.height.equalTo((self.width-40) * 0.64) | 175 | + make.bottom.equalToSuperview().offset(-(45-30)/2.0-30-10) |
| 176 | + make.width.equalTo(262*KSreenWidth/375) | ||
| 177 | + make.height.equalTo(0.52*262*KSreenWidth/375) | ||
| 193 | } | 178 | } |
| 194 | return frontCardContentView | 179 | return frontCardContentView |
| 195 | 180 | ||
| @@ -197,7 +182,7 @@ class CNFrontMainView : UIView{ | @@ -197,7 +182,7 @@ class CNFrontMainView : UIView{ | ||
| 197 | /// 已认证-身份卡片 | 182 | /// 已认证-身份卡片 |
| 198 | lazy var iDCardView:CNIDCardView = { | 183 | lazy var iDCardView:CNIDCardView = { |
| 199 | 184 | ||
| 200 | - let iDCardView:CNIDCardView = CNIDCardView(frame: CGRect(x: 20, y: 25, width: self.width-40, height: (self.width-40) * 0.64)) | 185 | + let iDCardView:CNIDCardView = CNIDCardView(frame: CGRect(x: 0, y: 0, width: 262*KSreenWidth/375, height: 0.52*262*KSreenWidth/375)) |
| 201 | return iDCardView | 186 | return iDCardView |
| 202 | }() | 187 | }() |
| 203 | 188 | ||
| @@ -232,16 +217,34 @@ class CNFrontMainView : UIView{ | @@ -232,16 +217,34 @@ class CNFrontMainView : UIView{ | ||
| 232 | //已认证身份 | 217 | //已认证身份 |
| 233 | //显示证件View | 218 | //显示证件View |
| 234 | frontCardContentView.isHidden = false | 219 | frontCardContentView.isHidden = false |
| 235 | - iDCardView.idModel = newValue! | ||
| 236 | - frontDescContentView.isHidden = true | 220 | + self.addStandBtn.isHidden = true |
| 221 | + self.iDCardView.idModel = newValue! | ||
| 237 | cardViewBgImgView.kf.setImage(with: URL(string: _idModel!.cardBackgroundImg), placeholder: UIImage(named: "homepage_cardBGImg")) | 222 | cardViewBgImgView.kf.setImage(with: URL(string: _idModel!.cardBackgroundImg), placeholder: UIImage(named: "homepage_cardBGImg")) |
| 238 | - }else | ||
| 239 | - {//未认证身份 | ||
| 240 | - frontCardContentView.isHidden = true | ||
| 241 | - //显示textview 添加身份 | ||
| 242 | - frontDescContentView.isHidden = false | ||
| 243 | - textView.text = newValue!.description | ||
| 244 | 223 | ||
| 224 | + | ||
| 225 | + //隐藏textview | ||
| 226 | + textView.isHidden = true | ||
| 227 | + | ||
| 228 | + if frontCardContentView.contains(self.upMoreGIF){ | ||
| 229 | + self.upMoreGIF.removeFromSuperview() | ||
| 230 | + } | ||
| 231 | + frontCardContentView.addSubview(self.upMoreGIF) | ||
| 232 | + upMoreGIF.snp.makeConstraints { make in | ||
| 233 | + make.top.equalToSuperview().offset(5) | ||
| 234 | + make.right.equalToSuperview().offset(-self.width/2+24) | ||
| 235 | + make.width.equalTo(48) | ||
| 236 | + make.height.equalTo(30) | ||
| 237 | + } | ||
| 238 | + if frontCardContentView.contains(self.downMoreGIF){ | ||
| 239 | + self.downMoreGIF.removeFromSuperview() | ||
| 240 | + } | ||
| 241 | + frontCardContentView.addSubview(self.downMoreGIF) | ||
| 242 | + downMoreGIF.snp.makeConstraints { make in | ||
| 243 | + make.top.equalTo(self.iDCardView.snp.bottom).offset((45-30)/2.0) | ||
| 244 | + make.centerX.equalToSuperview() | ||
| 245 | + make.width.equalTo(96) | ||
| 246 | + make.height.equalTo(30) | ||
| 247 | + } | ||
| 245 | //上滑 下滑引导gif | 248 | //上滑 下滑引导gif |
| 246 | upMoreGIF.kf.setImage(with: URL(string: newValue!.upGuideImg)) | 249 | upMoreGIF.kf.setImage(with: URL(string: newValue!.upGuideImg)) |
| 247 | downMoreGIF.kf.setImage(with: URL(string: newValue!.downGuideImg)) | 250 | downMoreGIF.kf.setImage(with: URL(string: newValue!.downGuideImg)) |
| @@ -249,18 +252,102 @@ class CNFrontMainView : UIView{ | @@ -249,18 +252,102 @@ class CNFrontMainView : UIView{ | ||
| 249 | //电商 ,隐藏上滑下滑gif | 252 | //电商 ,隐藏上滑下滑gif |
| 250 | upMoreGIF.isHidden = true | 253 | upMoreGIF.isHidden = true |
| 251 | downMoreGIF.isHidden = true | 254 | downMoreGIF.isHidden = true |
| 252 | - self.addStandBtn.backgroundColor = HexColor(newValue!.backgroundColor) | 255 | + }else{ |
| 256 | + //非电商 ,显示上滑下滑gif | ||
| 257 | + upMoreGIF.isHidden = false | ||
| 258 | + downMoreGIF.isHidden = false | ||
| 259 | + } | ||
| 260 | + }else | ||
| 261 | + {//未认证身份 | ||
| 262 | + textView.isHidden = false | ||
| 263 | + | ||
| 264 | + if idModel?.id == 9{ | ||
| 265 | + //电商 | ||
| 266 | + //隐藏上滑下滑gif | ||
| 267 | + upMoreGIF.isHidden = true | ||
| 268 | + downMoreGIF.isHidden = true | ||
| 253 | self.addStandBtn.isHidden = false | 269 | self.addStandBtn.isHidden = false |
| 254 | self.personalStandBtn.isHidden = true | 270 | self.personalStandBtn.isHidden = true |
| 255 | self.enterpriseStandBtn.isHidden = true | 271 | self.enterpriseStandBtn.isHidden = true |
| 272 | + self.addStandBtn.isUserInteractionEnabled = true | ||
| 273 | + if idModel?.shopStatus == "0" || idModel?.shopStatus == "4"{ | ||
| 274 | + //0未申请 //4闭店 | ||
| 275 | + //未认证->店铺认证 | ||
| 276 | + self.addStandBtn.setTitle("店铺认证", for: .normal) | ||
| 277 | + }else if idModel?.shopStatus == "1"{ | ||
| 278 | + //开店 | ||
| 279 | + //已认证->显示卡片 | ||
| 280 | + }else if idModel?.shopStatus == "2"{ | ||
| 281 | + //申请中 | ||
| 282 | + //"资料审核中" | ||
| 283 | + self.addStandBtn.setTitle("资料审核中", for: .normal) | ||
| 284 | + self.addStandBtn.isUserInteractionEnabled = false | ||
| 285 | + }else if idModel?.shopStatus == "3"{ | ||
| 286 | + //已拒绝 | ||
| 287 | + //"重新修改提交" | ||
| 288 | + addStandBtn.setTitle("重新修改提交", for: .normal) | ||
| 289 | + } | ||
| 256 | }else{ | 290 | }else{ |
| 257 | - //非电商 ,显示上滑下滑gif | 291 | + //非电商 |
| 292 | + //显示上滑下滑gif | ||
| 258 | upMoreGIF.isHidden = false | 293 | upMoreGIF.isHidden = false |
| 259 | downMoreGIF.isHidden = false | 294 | downMoreGIF.isHidden = false |
| 260 | - self.addStandBtn.isHidden = true | ||
| 261 | - self.personalStandBtn.isHidden = false | ||
| 262 | - self.enterpriseStandBtn.isHidden = false | 295 | + |
| 296 | + if idModel?.isPersonOrEnterprise == 0{//企业+个人 | ||
| 297 | + self.addStandBtn.isHidden = true | ||
| 298 | + self.personalStandBtn.isHidden = false | ||
| 299 | + self.enterpriseStandBtn.isHidden = false | ||
| 300 | + }else if idModel?.isPersonOrEnterprise == 1{//个人 | ||
| 301 | + self.addStandBtn.isHidden = false | ||
| 302 | + self.addStandBtn.setTitle("个人认证", for: .normal) | ||
| 303 | + self.personalStandBtn.isHidden = true | ||
| 304 | + self.enterpriseStandBtn.isHidden = true | ||
| 305 | + }else if idModel?.isPersonOrEnterprise == 2{//企业 | ||
| 306 | + self.addStandBtn.isHidden = false | ||
| 307 | + self.addStandBtn.setTitle("企业认证", for: .normal) | ||
| 308 | + self.personalStandBtn.isHidden = true | ||
| 309 | + self.enterpriseStandBtn.isHidden = true | ||
| 310 | + }else if idModel?.isPersonOrEnterprise == 3{//已认证/无企业和个人 | ||
| 311 | + //不显示认证按钮 | ||
| 312 | + self.addStandBtn.isHidden = true | ||
| 313 | + self.personalStandBtn.isHidden = true | ||
| 314 | + self.enterpriseStandBtn.isHidden = true | ||
| 315 | + }else{ | ||
| 316 | + //不显示认证按钮 | ||
| 317 | + self.addStandBtn.isHidden = true | ||
| 318 | + self.personalStandBtn.isHidden = false | ||
| 319 | + self.enterpriseStandBtn.isHidden = false | ||
| 320 | + } | ||
| 321 | + } | ||
| 322 | + | ||
| 323 | + self.addStandBtn.backgroundColor = HexColor(newValue!.backgroundColor) | ||
| 324 | + frontCardContentView.isHidden = true | ||
| 325 | + //显示textview 添加身份 | ||
| 326 | + textView.text = newValue!.description | ||
| 327 | + | ||
| 328 | + if frontDescContentView.contains(self.upMoreGIF){ | ||
| 329 | + self.upMoreGIF.removeFromSuperview() | ||
| 330 | + } | ||
| 331 | + frontDescContentView.addSubview(self.upMoreGIF) | ||
| 332 | + upMoreGIF.snp.makeConstraints { make in | ||
| 333 | + make.top.equalToSuperview().offset(5) | ||
| 334 | + make.right.equalToSuperview().offset(-self.width/2+24) | ||
| 335 | + make.width.equalTo(48) | ||
| 336 | + make.height.equalTo(30) | ||
| 337 | + } | ||
| 338 | + if frontDescContentView.contains(self.downMoreGIF){ | ||
| 339 | + self.downMoreGIF.removeFromSuperview() | ||
| 263 | } | 340 | } |
| 341 | + frontDescContentView.addSubview(self.downMoreGIF) | ||
| 342 | + downMoreGIF.snp.makeConstraints { make in | ||
| 343 | + make.top.equalTo(self.personalStandBtn.snp.bottom).offset((45-30)/2.0) | ||
| 344 | + make.centerX.equalTo(self.personalStandBtn.snp.right) | ||
| 345 | + make.width.equalTo(96) | ||
| 346 | + make.height.equalTo(30) | ||
| 347 | + } | ||
| 348 | + //上滑 下滑引导gif | ||
| 349 | + upMoreGIF.kf.setImage(with: URL(string: newValue!.upGuideImg)) | ||
| 350 | + downMoreGIF.kf.setImage(with: URL(string: newValue!.downGuideImg)) | ||
| 264 | 351 | ||
| 265 | //个人认证,企业认证 | 352 | //个人认证,企业认证 |
| 266 | personalStandBtn.backgroundColor = HexColor(newValue!.atPersonageColour) | 353 | personalStandBtn.backgroundColor = HexColor(newValue!.atPersonageColour) |
| @@ -279,7 +366,7 @@ class CNFrontMainView : UIView{ | @@ -279,7 +366,7 @@ class CNFrontMainView : UIView{ | ||
| 279 | self.makeConstraints() | 366 | self.makeConstraints() |
| 280 | } | 367 | } |
| 281 | func makeConstraints(){ | 368 | func makeConstraints(){ |
| 282 | - | 369 | + |
| 283 | } | 370 | } |
| 284 | 371 | ||
| 285 | // MARK: -按钮点击事件 | 372 | // MARK: -按钮点击事件 |
| @@ -288,19 +375,19 @@ class CNFrontMainView : UIView{ | @@ -288,19 +375,19 @@ class CNFrontMainView : UIView{ | ||
| 288 | } | 375 | } |
| 289 | 376 | ||
| 290 | @objc func addStandBtnAction() { | 377 | @objc func addStandBtnAction() { |
| 291 | - //跳转到电商认证页面 | ||
| 292 | - self.pushStandVC() | 378 | + //跳转到 电商认证 / 个人 / 企业 |
| 379 | + self.pushStandVC(isPersonOrEnterprise: 3) | ||
| 293 | } | 380 | } |
| 294 | @objc func personalStandBtnAction() { | 381 | @objc func personalStandBtnAction() { |
| 295 | //跳转到 个人认证页面 | 382 | //跳转到 个人认证页面 |
| 296 | - self.pushStandVC() | 383 | + self.pushStandVC(isPersonOrEnterprise: 1) |
| 297 | } | 384 | } |
| 298 | @objc func enterpriseStandBtnAction() { | 385 | @objc func enterpriseStandBtnAction() { |
| 299 | //跳转到 企业认证页面 | 386 | //跳转到 企业认证页面 |
| 300 | - self.pushStandVC() | 387 | + self.pushStandVC(isPersonOrEnterprise: 2) |
| 301 | } | 388 | } |
| 302 | 389 | ||
| 303 | - func pushStandVC(){ | 390 | + func pushStandVC(isPersonOrEnterprise:Int){ |
| 304 | //跳转到 个人认证&企业认证 页面 | 391 | //跳转到 个人认证&企业认证 页面 |
| 305 | if _idModel!.id == 9 { | 392 | if _idModel!.id == 9 { |
| 306 | showLoading(message: "") | 393 | showLoading(message: "") |
| @@ -311,7 +398,23 @@ class CNFrontMainView : UIView{ | @@ -311,7 +398,23 @@ class CNFrontMainView : UIView{ | ||
| 311 | } | 398 | } |
| 312 | } | 399 | } |
| 313 | }else{ | 400 | }else{ |
| 314 | - navigationViewController().pushViewController(CNLiveMineInputViewController.init(listModel: self._idModel!, authType: .person), animated: pushAnimated) | 401 | + if self._idModel!.isPersonOrEnterprise == 1{ |
| 402 | + //个人 | ||
| 403 | + navigationViewController().pushViewController(CNLiveMineInputViewController.init(listModel: self._idModel!, authType: .person), animated: pushAnimated) | ||
| 404 | + }else if self._idModel!.isPersonOrEnterprise == 2{ | ||
| 405 | + //企业 | ||
| 406 | + navigationViewController().pushViewController(CNLiveMineInputViewController.init(listModel: self._idModel!, authType: .enterprise), animated: pushAnimated) | ||
| 407 | + | ||
| 408 | + }else{ | ||
| 409 | + if isPersonOrEnterprise == 1{ | ||
| 410 | + navigationViewController().pushViewController(CNLiveMineInputViewController.init(listModel: self._idModel!, authType: .person), animated: pushAnimated) | ||
| 411 | + | ||
| 412 | + }else if isPersonOrEnterprise == 2{ | ||
| 413 | + navigationViewController().pushViewController(CNLiveMineInputViewController.init(listModel: self._idModel!, authType: .enterprise), animated: pushAnimated) | ||
| 414 | + }else{ | ||
| 415 | + navigationViewController().pushViewController(CNLiveMineInputViewController.init(listModel: self._idModel!, authType: .person), animated: pushAnimated) | ||
| 416 | + } | ||
| 417 | + } | ||
| 315 | } | 418 | } |
| 316 | } | 419 | } |
| 317 | } | 420 | } |
metaCode/Classes/Main/MinePage/ViewModel/CNLiveMineBaseModel.swift
| @@ -131,6 +131,7 @@ class StandListBaseModel: BaseModel { | @@ -131,6 +131,7 @@ class StandListBaseModel: BaseModel { | ||
| 131 | var navigatePages: Int = 0 | 131 | var navigatePages: Int = 0 |
| 132 | var pageNum: Int = 0 | 132 | var pageNum: Int = 0 |
| 133 | var pages: Int = 0 | 133 | var pages: Int = 0 |
| 134 | + | ||
| 134 | } | 135 | } |
| 135 | 136 | ||
| 136 | final class StandListModel: BaseModel {//, TableCodable { | 137 | final class StandListModel: BaseModel {//, TableCodable { |
| @@ -161,6 +162,10 @@ final class StandListModel: BaseModel {//, TableCodable { | @@ -161,6 +162,10 @@ final class StandListModel: BaseModel {//, TableCodable { | ||
| 161 | 162 | ||
| 162 | var shopStatus: String = "0"//电商身份专用状态 0未申请 1开店 2申请中 3已拒绝 4闭店 | 163 | var shopStatus: String = "0"//电商身份专用状态 0未申请 1开店 2申请中 3已拒绝 4闭店 |
| 163 | 164 | ||
| 165 | + | ||
| 166 | + ///自定义 判断是 0个人+企业 , 1个人, 2企业 3已认证/无企业和个人 | ||
| 167 | + var isPersonOrEnterprise: Int = 0 | ||
| 168 | + | ||
| 164 | override func mapping(mapper: HelpingMapper) { | 169 | override func mapping(mapper: HelpingMapper) { |
| 165 | mapper <<< | 170 | mapper <<< |
| 166 | self.createTime <-- TransformOf(fromJSON: { [weak self] (raw) -> Int in | 171 | self.createTime <-- TransformOf(fromJSON: { [weak self] (raw) -> Int in |
metaCode/Classes/Main/MinePage/ViewModel/CNLiveMineViewModel.swift
| @@ -284,7 +284,7 @@ class CNLiveMineViewModel: NSObject { | @@ -284,7 +284,7 @@ class CNLiveMineViewModel: NSObject { | ||
| 284 | CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) | 284 | CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) |
| 285 | CNLiveNetworking.setAllowRequestDefaultArgument(true) | 285 | CNLiveNetworking.setAllowRequestDefaultArgument(true) |
| 286 | CNLiveNetworking.setupShowDataResult(false) | 286 | CNLiveNetworking.setupShowDataResult(false) |
| 287 | - CNLiveNetworking.requestNetwork(with: .GET, urlString: APPBaseMCUrl+"/identityApi/allList", param: param as! [String : String], cacheType: .networkOnly) { task, result, error in | 287 | + CNLiveNetworking.requestNetwork(with: .GET, urlString: APPBaseMCUrl+"/identityApi/allList", param: param as! [String : String], cacheType: .cacheNetwork) { task, result, error in |
| 288 | hiddenLoading() | 288 | hiddenLoading() |
| 289 | if (error == nil) { | 289 | if (error == nil) { |
| 290 | let resp = result as! NSDictionary | 290 | let resp = result as! NSDictionary |