Commit b5ba5d04dd73315f42c7ccd9d12140edf10c3ab2
1 parent
97370c5b
切换视图, 实名切换按钮动态显示隐藏
Showing
4 changed files
with
109 additions
and
3 deletions
metaCode/Classes/Main/HomePage/Controller/AuthMainController/CNMetaCodeHomePageController.swift
| @@ -64,6 +64,15 @@ class CNMetaCodeHomePageController:CNLiveBaseViewController, NewPagedFlowViewDel | @@ -64,6 +64,15 @@ class CNMetaCodeHomePageController:CNLiveBaseViewController, NewPagedFlowViewDel | ||
| 64 | public var vNumPage: VNumPage = .VNumPageMain{ | 64 | public var vNumPage: VNumPage = .VNumPageMain{ |
| 65 | didSet { | 65 | didSet { |
| 66 | print("已设置 vNumPage的值为:\(vNumPage)") | 66 | print("已设置 vNumPage的值为:\(vNumPage)") |
| 67 | + let toBannerView = self.pageFlowView.cells[self.pageFlowView.currentPageIndex] as? CNCustomIndexView | ||
| 68 | + | ||
| 69 | + if vNumPage == .VNumPageDown || vNumPage == .VNumPageUp{ | ||
| 70 | + toBannerView?.isShowRealPerson = false | ||
| 71 | + | ||
| 72 | + }else{ | ||
| 73 | + toBannerView?.isShowRealPerson = true | ||
| 74 | + | ||
| 75 | + } | ||
| 67 | } | 76 | } |
| 68 | } | 77 | } |
| 69 | 78 | ||
| @@ -246,6 +255,7 @@ class CNMetaCodeHomePageController:CNLiveBaseViewController, NewPagedFlowViewDel | @@ -246,6 +255,7 @@ class CNMetaCodeHomePageController:CNLiveBaseViewController, NewPagedFlowViewDel | ||
| 246 | self.view.height = KSreenHeight | 255 | self.view.height = KSreenHeight |
| 247 | self.topNavView.isHidden = true | 256 | self.topNavView.isHidden = true |
| 248 | self.hiddenLeftRightView() | 257 | self.hiddenLeftRightView() |
| 258 | + | ||
| 249 | // print("22222222currentPageIndex:\(self.pageFlowView.currentPageIndex)") | 259 | // print("22222222currentPageIndex:\(self.pageFlowView.currentPageIndex)") |
| 250 | switch vNumPage { | 260 | switch vNumPage { |
| 251 | case .VNumPageMain://中间主页 | 261 | case .VNumPageMain://中间主页 |
| @@ -339,8 +349,6 @@ class CNMetaCodeHomePageController:CNLiveBaseViewController, NewPagedFlowViewDel | @@ -339,8 +349,6 @@ class CNMetaCodeHomePageController:CNLiveBaseViewController, NewPagedFlowViewDel | ||
| 339 | self.vNumPage = .VNumPageUp | 349 | self.vNumPage = .VNumPageUp |
| 340 | } | 350 | } |
| 341 | } | 351 | } |
| 342 | - | ||
| 343 | - | ||
| 344 | 352 | ||
| 345 | // MARK: -添加约束 | 353 | // MARK: -添加约束 |
| 346 | func makeConstraints(){ | 354 | func makeConstraints(){ |
| @@ -427,6 +435,7 @@ class CNMetaCodeHomePageController:CNLiveBaseViewController, NewPagedFlowViewDel | @@ -427,6 +435,7 @@ class CNMetaCodeHomePageController:CNLiveBaseViewController, NewPagedFlowViewDel | ||
| 427 | 435 | ||
| 428 | let identityModel = dataArray[index] as! StandListModel | 436 | let identityModel = dataArray[index] as! StandListModel |
| 429 | bannerView?.idModel = identityModel | 437 | bannerView?.idModel = identityModel |
| 438 | + bannerView?.updateRealPerson() | ||
| 430 | if (identityModel.userAuth == true){ | 439 | if (identityModel.userAuth == true){ |
| 431 | //已有数字认证 | 440 | //已有数字认证 |
| 432 | bannerView?.baseScrollView.isScrollEnabled = true | 441 | bannerView?.baseScrollView.isScrollEnabled = true |
metaCode/Classes/Main/HomePage/View/VerticalViews/CNCustomIndexView.swift
| @@ -6,10 +6,12 @@ | @@ -6,10 +6,12 @@ | ||
| 6 | // 认证-上下滑的容器View | 6 | // 认证-上下滑的容器View |
| 7 | 7 | ||
| 8 | import Foundation | 8 | import Foundation |
| 9 | +import SnapKit | ||
| 9 | 10 | ||
| 10 | typealias closeBlock = ()->Void; | 11 | typealias closeBlock = ()->Void; |
| 11 | 12 | ||
| 12 | class CNCustomIndexTopView : UIView{ | 13 | class CNCustomIndexTopView : UIView{ |
| 14 | + | ||
| 13 | ///关闭按钮事件回调 | 15 | ///关闭按钮事件回调 |
| 14 | var closeAction: closeBlock? | 16 | var closeAction: closeBlock? |
| 15 | 17 | ||
| @@ -82,7 +84,25 @@ protocol CNCustomIndexViewDelegate:NSObjectProtocol{ | @@ -82,7 +84,25 @@ protocol CNCustomIndexViewDelegate:NSObjectProtocol{ | ||
| 82 | } | 84 | } |
| 83 | 85 | ||
| 84 | class CNCustomIndexView:PGIndexBannerSubiew, UIScrollViewDelegate, WJColorChangeDelegate{ | 86 | class CNCustomIndexView:PGIndexBannerSubiew, UIScrollViewDelegate, WJColorChangeDelegate{ |
| 85 | - | 87 | + var _isShowRealPerson : Bool = false |
| 88 | + var isShowRealPerson : Bool { | ||
| 89 | + get{ | ||
| 90 | + _isShowRealPerson | ||
| 91 | + } | ||
| 92 | + set{ | ||
| 93 | + _isShowRealPerson = newValue | ||
| 94 | + if _isShowRealPerson == true{ | ||
| 95 | + self.bringSubviewToFront(self.topRealPersonBtn) | ||
| 96 | + self.bringSubviewToFront(self.sanjiaoImgView) | ||
| 97 | + self.topRealPersonBtn.isHidden = false | ||
| 98 | + self.sanjiaoImgView.isHidden = false | ||
| 99 | + }else{ | ||
| 100 | + self.topRealPersonBtn.isHidden = true | ||
| 101 | + self.sanjiaoImgView.isHidden = true | ||
| 102 | + } | ||
| 103 | + } | ||
| 104 | + } | ||
| 105 | + | ||
| 86 | ///记录开始拖拽时偏移量 | 106 | ///记录开始拖拽时偏移量 |
| 87 | var beginDragOffset: CGFloat = 0.0 | 107 | var beginDragOffset: CGFloat = 0.0 |
| 88 | 108 | ||
| @@ -239,6 +259,24 @@ class CNCustomIndexView:PGIndexBannerSubiew, UIScrollViewDelegate, WJColorChange | @@ -239,6 +259,24 @@ class CNCustomIndexView:PGIndexBannerSubiew, UIScrollViewDelegate, WJColorChange | ||
| 239 | return topNavView | 259 | return topNavView |
| 240 | }() | 260 | }() |
| 241 | 261 | ||
| 262 | + lazy var topRealPersonBtn: UILabel = { | ||
| 263 | + let closeBtn = UILabel() | ||
| 264 | + closeBtn.text = "当前对象: "+(UserInfoManager.shared.userInfo.currentUser?.name ?? "") | ||
| 265 | + closeBtn.textColor = HexColor("#FFFFFF") | ||
| 266 | + closeBtn.textAlignment = .right | ||
| 267 | + closeBtn.isUserInteractionEnabled = true | ||
| 268 | + closeBtn.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(topRealPersonBtnAction))) | ||
| 269 | + return closeBtn | ||
| 270 | + }() | ||
| 271 | + | ||
| 272 | + | ||
| 273 | + lazy var sanjiaoImgView :UIImageView = { | ||
| 274 | + let iconImgView = UIImageView(frame: CGRect(x: 0, y: 0, width: 4, height: 3)) | ||
| 275 | + iconImgView.image = UIImage(named: "auth_sanjiao") | ||
| 276 | + return iconImgView | ||
| 277 | + }() | ||
| 278 | + | ||
| 279 | + | ||
| 242 | // MARK: - 初始化方法 | 280 | // MARK: - 初始化方法 |
| 243 | override init(frame: CGRect) { | 281 | override init(frame: CGRect) { |
| 244 | super.init(frame: frame) | 282 | super.init(frame: frame) |
| @@ -259,10 +297,47 @@ class CNCustomIndexView:PGIndexBannerSubiew, UIScrollViewDelegate, WJColorChange | @@ -259,10 +297,47 @@ class CNCustomIndexView:PGIndexBannerSubiew, UIScrollViewDelegate, WJColorChange | ||
| 259 | self.baseScrollView.addSubview(self.mainView) | 297 | self.baseScrollView.addSubview(self.mainView) |
| 260 | self.baseScrollView.addSubview(self.upSlideView) | 298 | self.baseScrollView.addSubview(self.upSlideView) |
| 261 | self.addSubview(self.topNavView) | 299 | self.addSubview(self.topNavView) |
| 300 | + self.addSubview(self.topRealPersonBtn) | ||
| 301 | + self.topRealPersonBtn.snp.makeConstraints { make in | ||
| 302 | + make.right.equalToSuperview().offset(-9) | ||
| 303 | + make.top.equalTo(self.topNavView.snp.bottom) | ||
| 304 | + make.height.equalTo(20) | ||
| 305 | + } | ||
| 306 | + self.addSubview(self.sanjiaoImgView) | ||
| 307 | + self.sanjiaoImgView.snp.makeConstraints { make in | ||
| 308 | + make.left.equalTo(self.topRealPersonBtn.snp.right).offset(5) | ||
| 309 | + make.centerY.equalTo(self.topRealPersonBtn.snp.centerY) | ||
| 310 | + } | ||
| 311 | + | ||
| 262 | //默认偏移到中间 | 312 | //默认偏移到中间 |
| 263 | self.baseScrollView.setContentOffset(CGPointMake(0, self.frame.size.height), animated: true) | 313 | self.baseScrollView.setContentOffset(CGPointMake(0, self.frame.size.height), animated: true) |
| 264 | } | 314 | } |
| 265 | 315 | ||
| 316 | + // MARK: - 当前实名对象 | ||
| 317 | + @objc func topRealPersonBtnAction(){ | ||
| 318 | + var infoArr = Array<String>() | ||
| 319 | + UserInfoManager.shared.userInfo.userMsgUsers?.verifyUsers.forEach({ userMdl in | ||
| 320 | + infoArr.append(userMdl.name) | ||
| 321 | + }) | ||
| 322 | + MineStandListAlertView.showStandListView(infos: infoArr as NSArray,name: "实名对象切换", show_type: .string) {text in | ||
| 323 | + let seleText = text as? String | ||
| 324 | + let tempArr = UserInfoManager.shared.userInfo.userMsgUsers?.verifyUsers | ||
| 325 | + tempArr?.forEach({ userMdl in | ||
| 326 | + if userMdl.name == seleText{ | ||
| 327 | + let userInfo = UserInfoManager.shared.userInfo | ||
| 328 | + userInfo.currentUser = userMdl | ||
| 329 | + UserInfoManager.cacheUserInfo(userInfo: userInfo) | ||
| 330 | + self.topRealPersonBtn.text = "当前对象: "+(UserInfoManager.shared.userInfo.currentUser?.name ?? "") | ||
| 331 | + | ||
| 332 | + } | ||
| 333 | + }) | ||
| 334 | + } | ||
| 335 | + } | ||
| 336 | + | ||
| 337 | + func updateRealPerson(){ | ||
| 338 | + self.topRealPersonBtn.text = "当前对象: "+(UserInfoManager.shared.userInfo.currentUser?.name ?? "") | ||
| 339 | + } | ||
| 340 | + | ||
| 266 | // MARK: - 设置前置视图容器 | 341 | // MARK: - 设置前置视图容器 |
| 267 | func isHiddenMainFrontContentView(isHidden:Bool){ | 342 | func isHiddenMainFrontContentView(isHidden:Bool){ |
| 268 | self.mainView.isHiddenMainFrontContentView(isHidden: isHidden) | 343 | self.mainView.isHiddenMainFrontContentView(isHidden: isHidden) |
| @@ -411,6 +486,7 @@ class CNCustomIndexView:PGIndexBannerSubiew, UIScrollViewDelegate, WJColorChange | @@ -411,6 +486,7 @@ class CNCustomIndexView:PGIndexBannerSubiew, UIScrollViewDelegate, WJColorChange | ||
| 411 | self.wjColorEndScrollOrEndDragging(scrollView) | 486 | self.wjColorEndScrollOrEndDragging(scrollView) |
| 412 | //外部代理 | 487 | //外部代理 |
| 413 | self.delegate?.customIndexViewDidEndScroll(scrollView: scrollView) | 488 | self.delegate?.customIndexViewDidEndScroll(scrollView: scrollView) |
| 489 | + | ||
| 414 | } | 490 | } |
| 415 | 491 | ||
| 416 | //公用方法 | 492 | //公用方法 |
metaCode/Supporting Files/Assets.xcassets/AuthPage/auth_sanjiao.imageset/Contents.json
0 → 100644
| 1 | +{ | ||
| 2 | + "images" : [ | ||
| 3 | + { | ||
| 4 | + "idiom" : "universal", | ||
| 5 | + "scale" : "1x" | ||
| 6 | + }, | ||
| 7 | + { | ||
| 8 | + "filename" : "auth_sanjiao@2x.png", | ||
| 9 | + "idiom" : "universal", | ||
| 10 | + "scale" : "2x" | ||
| 11 | + }, | ||
| 12 | + { | ||
| 13 | + "idiom" : "universal", | ||
| 14 | + "scale" : "3x" | ||
| 15 | + } | ||
| 16 | + ], | ||
| 17 | + "info" : { | ||
| 18 | + "author" : "xcode", | ||
| 19 | + "version" : 1 | ||
| 20 | + } | ||
| 21 | +} |
metaCode/Supporting Files/Assets.xcassets/AuthPage/auth_sanjiao.imageset/auth_sanjiao@2x.png
0 → 100644
695 Bytes