Commit a5ffeb7950b41a329cb729963c0d70fcf1229b3d
1 parent
5d8a4b26
提交0.0.11
Showing
6 changed files
with
412 additions
and
14 deletions
CNLiveServiceCenterModule.podspec
| @@ -8,7 +8,7 @@ | @@ -8,7 +8,7 @@ | ||
| 8 | 8 | ||
| 9 | Pod::Spec.new do |s| | 9 | Pod::Spec.new do |s| |
| 10 | s.name = 'CNLiveServiceCenterModule' | 10 | s.name = 'CNLiveServiceCenterModule' |
| 11 | - s.version = '0.0.10' | 11 | + s.version = '0.0.11' |
| 12 | s.summary = '网家家企业端服务中心模块' | 12 | s.summary = '网家家企业端服务中心模块' |
| 13 | 13 | ||
| 14 | # This description is used to generate tags and improve search results. | 14 | # This description is used to generate tags and improve search results. |
CNLiveServiceCenterModule/Classes/CNLiveServiceCenterModule/Controller/CNLiveBServiceCenterController.m
| @@ -25,6 +25,7 @@ | @@ -25,6 +25,7 @@ | ||
| 25 | #import <CNLiveBServices/CNLiveBMineServiceProtocol.h> | 25 | #import <CNLiveBServices/CNLiveBMineServiceProtocol.h> |
| 26 | #import <CNLiveBServices/CNLiveLiveSetHomeProtocol.h> | 26 | #import <CNLiveBServices/CNLiveLiveSetHomeProtocol.h> |
| 27 | #import "CNLiveBCreatorViewController.h" | 27 | #import "CNLiveBCreatorViewController.h" |
| 28 | +#import "CNLiveBServiceLiveSelectedView.h" | ||
| 28 | 29 | ||
| 29 | #define CNLiveBGetServiceStatusUrl cn_API_OpenApi2(@"/user/readWJJBStatusById") | 30 | #define CNLiveBGetServiceStatusUrl cn_API_OpenApi2(@"/user/readWJJBStatusById") |
| 30 | #define CNLiveBOrganizationValidattionStatusUrl cn_API_OpenApi2(@"/auser/getAccount.action") | 31 | #define CNLiveBOrganizationValidattionStatusUrl cn_API_OpenApi2(@"/auser/getAccount.action") |
| @@ -46,6 +47,9 @@ | @@ -46,6 +47,9 @@ | ||
| 46 | 47 | ||
| 47 | @property (nonatomic , strong) CNLiveBServiceCenterModel *centerModel; | 48 | @property (nonatomic , strong) CNLiveBServiceCenterModel *centerModel; |
| 48 | 49 | ||
| 50 | +/** 相册弹出实体图*/ | ||
| 51 | +@property (nonatomic , strong) CNLiveBServiceLiveSelectedView *liveSelecctedView; | ||
| 52 | + | ||
| 49 | 53 | ||
| 50 | 54 | ||
| 51 | @end | 55 | @end |
| @@ -129,8 +133,19 @@ | @@ -129,8 +133,19 @@ | ||
| 129 | 133 | ||
| 130 | [self.view setBackgroundColor:[UIColor whiteColor]]; | 134 | [self.view setBackgroundColor:[UIColor whiteColor]]; |
| 131 | 135 | ||
| 136 | + if (CNUserShareModel.wjjStatus) { | ||
| 137 | + self.personStatus = [NSString stringWithFormat:@"%@",CNUserShareModel.wjjStatus.personStatus ? CNUserShareModel.wjjStatus.personStatus : @"0"]; | ||
| 138 | + self.institutionStatus = [NSString stringWithFormat:@"%@",CNUserShareModel.wjjStatus.institutionStatus ? CNUserShareModel.wjjStatus.institutionStatus : @"0"]; | ||
| 139 | + self.centerModel.personStatus = self.personStatus; | ||
| 140 | + self.centerModel.institutionStatus = self.institutionStatus; | ||
| 141 | + | ||
| 142 | + } | ||
| 143 | + | ||
| 144 | + | ||
| 145 | + | ||
| 132 | [self.view addSubview:self.tableView]; | 146 | [self.view addSubview:self.tableView]; |
| 133 | 147 | ||
| 148 | + | ||
| 134 | self.tableView.tableHeaderView = self.headerView; | 149 | self.tableView.tableHeaderView = self.headerView; |
| 135 | 150 | ||
| 136 | 151 | ||
| @@ -146,7 +161,7 @@ | @@ -146,7 +161,7 @@ | ||
| 146 | NSLog(@"点击-用户名字"); | 161 | NSLog(@"点击-用户名字"); |
| 147 | [weakSelf jumpPersonVC]; | 162 | [weakSelf jumpPersonVC]; |
| 148 | }; | 163 | }; |
| 149 | - | 164 | + |
| 150 | self.headerView.clickEnterViewBlock = ^(CNLiveBServiceCenterHeaderView * _Nonnull view, CNLiveBCenterAuthEnterView * _Nonnull enterView) { | 165 | self.headerView.clickEnterViewBlock = ^(CNLiveBServiceCenterHeaderView * _Nonnull view, CNLiveBCenterAuthEnterView * _Nonnull enterView) { |
| 151 | NSLog(@"点击-用户认证进入"); | 166 | NSLog(@"点击-用户认证进入"); |
| 152 | [weakSelf checkPersonCertification]; | 167 | [weakSelf checkPersonCertification]; |
| @@ -331,11 +346,8 @@ | @@ -331,11 +346,8 @@ | ||
| 331 | 346 | ||
| 332 | ///跳转直播页 | 347 | ///跳转直播页 |
| 333 | - (void)jumpLiveVC { | 348 | - (void)jumpLiveVC { |
| 334 | - /// 直播 | ||
| 335 | - id<CNLiveLiveSetHomeProtocol> organizationValidationProtocol = [[BeeHive shareInstance] createService:@protocol(CNLiveLiveSetHomeProtocol)]; | ||
| 336 | - UIViewController *vc = [organizationValidationProtocol pushLiveSettingWithHomeViewController]; | ||
| 337 | - vc.hidesBottomBarWhenPushed = YES; | ||
| 338 | - [self.navigationController pushViewController:vc animated:YES]; | 349 | + |
| 350 | + [self checkLiveCertification]; | ||
| 339 | 351 | ||
| 340 | 352 | ||
| 341 | } | 353 | } |
| @@ -478,7 +490,147 @@ | @@ -478,7 +490,147 @@ | ||
| 478 | 490 | ||
| 479 | if (!isEnter) { | 491 | if (!isEnter) { |
| 480 | 492 | ||
| 481 | - [QMUITips showError:err.domain inView:[UIApplication sharedApplication].keyWindow hideAfterDelay:0.5];//@"上传失败" | 493 | + [QMUITips showError:err.domain inView:[UIApplication sharedApplication].keyWindow hideAfterDelay:0.5];//@"上传失败" |
| 494 | + } | ||
| 495 | + | ||
| 496 | + }else { | ||
| 497 | + if (error) { | ||
| 498 | + if (error.code == -1001 || error.code == -1009) { | ||
| 499 | + [QMUITips showError:@"网络连接已断开" inView:[UIApplication sharedApplication].keyWindow hideAfterDelay:1.5]; | ||
| 500 | + }else { | ||
| 501 | + [QMUITips showError:error.domain inView:[UIApplication sharedApplication].keyWindow hideAfterDelay:1.5];//@"上传失败" | ||
| 502 | + } | ||
| 503 | + return; | ||
| 504 | + } | ||
| 505 | + | ||
| 506 | + } | ||
| 507 | + | ||
| 508 | + }]; | ||
| 509 | + | ||
| 510 | + | ||
| 511 | +} | ||
| 512 | + | ||
| 513 | + | ||
| 514 | +/// 检查直播个人状态状态 | ||
| 515 | +- (void)checkLiveCertification { | ||
| 516 | + | ||
| 517 | + //URL: https://apiwjjtest.cnlive.com/Daren/buser/getBUserInfo.action? | ||
| 518 | + NSString *strUrl = CNLiveBOrganizationPersonStatusUrl; | ||
| 519 | + NSDictionary *dict = @{ | ||
| 520 | + @"sid": [NSString stringWithFormat:@"%@",CNUserShareModel.uid], | ||
| 521 | + }; | ||
| 522 | + [QMUITips showLoadingInView:self.view]; | ||
| 523 | + | ||
| 524 | + __weak typeof(self) weakSelf = self; | ||
| 525 | + [CNLiveNetworking setAllowRequestDefaultArgument:YES]; | ||
| 526 | + [CNLiveNetworking setupShowDataResult:NO]; | ||
| 527 | + [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodPOST URLString:strUrl Param:dict CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) { | ||
| 528 | + [QMUITips hideAllTipsInView:self.view]; | ||
| 529 | + | ||
| 530 | + NSLog(@"点播详情数据 = %@",responseObject); | ||
| 531 | + | ||
| 532 | + NSString *resultCode = [NSString stringWithFormat:@"%@", responseObject[@"errorCode"]]; | ||
| 533 | + NSError *err = nil; | ||
| 534 | + id data = nil; | ||
| 535 | + if([resultCode isEqualToString:@"0"]) { | ||
| 536 | + data = responseObject[@"data"]; | ||
| 537 | + } else { | ||
| 538 | + @try { | ||
| 539 | + err = [[NSError alloc] initWithDomain:responseObject[@"errorMessage"] code:[resultCode integerValue] userInfo:nil]; | ||
| 540 | + } @catch (NSException *exception) { | ||
| 541 | + err = [[NSError alloc] initWithDomain:@"接口异常" code:500 userInfo:nil]; | ||
| 542 | + } | ||
| 543 | + } | ||
| 544 | + | ||
| 545 | + if (!err) { | ||
| 546 | + BOOL isEnter = NO; | ||
| 547 | + NSDictionary *dicContent = (NSDictionary *)data; | ||
| 548 | + if (dicContent) { | ||
| 549 | + if ([dicContent containsObjectForKey:@"checkStatus"]) { | ||
| 550 | + isEnter = YES; | ||
| 551 | + | ||
| 552 | + NSString *ischeckStatusStr = [NSString stringWithFormat:@"%@",[dicContent objectForKey:@"checkStatus"]]; | ||
| 553 | + if ([ischeckStatusStr isEqualToString:@"0"]) {//无认证_弹框直接去填表页 | ||
| 554 | + | ||
| 555 | + [weakSelf.liveSelecctedView popViewForView:[UIApplication sharedApplication].keyWindow]; | ||
| 556 | + weakSelf.liveSelecctedView.clickViewBlock = ^(CNLiveBServiceLiveSelectedView * _Nonnull view, NSInteger indexCount) { | ||
| 557 | + if (indexCount == 1) { | ||
| 558 | + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.25 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ | ||
| 559 | + /// 填表页 | ||
| 560 | + id<CNLiveBPersonAuthentProtocol> personProtocol = [[BeeHive shareInstance] createService:@protocol(CNLiveBPersonAuthentProtocol)]; | ||
| 561 | + UIViewController *vc = [personProtocol pushToPersonalCertificationStatusController:dicContent]; | ||
| 562 | + vc.hidesBottomBarWhenPushed = YES; | ||
| 563 | + [self.navigationController pushViewController:vc animated:YES]; | ||
| 564 | + }); | ||
| 565 | + | ||
| 566 | + }else { | ||
| 567 | + | ||
| 568 | + } | ||
| 569 | + | ||
| 570 | + }; | ||
| 571 | + | ||
| 572 | + | ||
| 573 | + }else if ([ischeckStatusStr isEqualToString:@"1"]) {//已认证 | ||
| 574 | + /// 直播 | ||
| 575 | + id<CNLiveLiveSetHomeProtocol> organizationValidationProtocol = [[BeeHive shareInstance] createService:@protocol(CNLiveLiveSetHomeProtocol)]; | ||
| 576 | + UIViewController *vc = [organizationValidationProtocol pushLiveSettingWithHomeViewController]; | ||
| 577 | + vc.hidesBottomBarWhenPushed = YES; | ||
| 578 | + [self.navigationController pushViewController:vc animated:YES]; | ||
| 579 | + | ||
| 580 | + | ||
| 581 | + isEnter = YES; | ||
| 582 | + }else if ([ischeckStatusStr isEqualToString:@"2"]) {//审核中_去状态页 | ||
| 583 | + isEnter = YES; | ||
| 584 | + | ||
| 585 | + [weakSelf.liveSelecctedView popViewForView:[UIApplication sharedApplication].keyWindow]; | ||
| 586 | + weakSelf.liveSelecctedView.clickViewBlock = ^(CNLiveBServiceLiveSelectedView * _Nonnull view, NSInteger indexCount) { | ||
| 587 | + if (indexCount == 1) { | ||
| 588 | + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.25 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ | ||
| 589 | + id<CNLiveBPersonAuthentProtocol> personProtocol = [[BeeHive shareInstance] createService:@protocol(CNLiveBPersonAuthentProtocol)]; | ||
| 590 | + UIViewController *vc = [personProtocol pushToPersonalCertificationStatusController:dicContent]; | ||
| 591 | + vc.hidesBottomBarWhenPushed = YES; | ||
| 592 | + [self.navigationController pushViewController:vc animated:YES]; | ||
| 593 | + }); | ||
| 594 | + | ||
| 595 | + }else { | ||
| 596 | + | ||
| 597 | + } | ||
| 598 | + | ||
| 599 | + }; | ||
| 600 | + | ||
| 601 | + | ||
| 602 | + | ||
| 603 | + | ||
| 604 | + }else if ([ischeckStatusStr isEqualToString:@"3"]) {//审核失败_去状态页 | ||
| 605 | + isEnter = YES; | ||
| 606 | + | ||
| 607 | + [weakSelf.liveSelecctedView popViewForView:[UIApplication sharedApplication].keyWindow]; | ||
| 608 | + weakSelf.liveSelecctedView.clickViewBlock = ^(CNLiveBServiceLiveSelectedView * _Nonnull view, NSInteger indexCount) { | ||
| 609 | + if (indexCount == 1) { | ||
| 610 | + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.25 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ | ||
| 611 | + id<CNLiveBPersonAuthentProtocol> personProtocol = [[BeeHive shareInstance] createService:@protocol(CNLiveBPersonAuthentProtocol)]; | ||
| 612 | + UIViewController *vc = [personProtocol pushToPersonalCertificationStatusController:dicContent]; | ||
| 613 | + vc.hidesBottomBarWhenPushed = YES; | ||
| 614 | + [self.navigationController pushViewController:vc animated:YES]; | ||
| 615 | + }); | ||
| 616 | + | ||
| 617 | + | ||
| 618 | + }else { | ||
| 619 | + | ||
| 620 | + } | ||
| 621 | + | ||
| 622 | + }; | ||
| 623 | + | ||
| 624 | + | ||
| 625 | + | ||
| 626 | + } | ||
| 627 | + | ||
| 628 | + } | ||
| 629 | + } | ||
| 630 | + | ||
| 631 | + if (!isEnter) { | ||
| 632 | + | ||
| 633 | + [QMUITips showError:err.domain inView:[UIApplication sharedApplication].keyWindow hideAfterDelay:0.5];//@"上传失败" | ||
| 482 | } | 634 | } |
| 483 | 635 | ||
| 484 | }else { | 636 | }else { |
| @@ -498,6 +650,7 @@ | @@ -498,6 +650,7 @@ | ||
| 498 | 650 | ||
| 499 | } | 651 | } |
| 500 | 652 | ||
| 653 | + | ||
| 501 | /// 检查机构认证状态 | 654 | /// 检查机构认证状态 |
| 502 | - (void)checkAccreditedInstitution { | 655 | - (void)checkAccreditedInstitution { |
| 503 | 656 | ||
| @@ -540,7 +693,7 @@ | @@ -540,7 +693,7 @@ | ||
| 540 | UIViewController *vc = [organizationValidationProtocol getOrganizationValidationController:dicContent]; | 693 | UIViewController *vc = [organizationValidationProtocol getOrganizationValidationController:dicContent]; |
| 541 | vc.hidesBottomBarWhenPushed = YES; | 694 | vc.hidesBottomBarWhenPushed = YES; |
| 542 | [self.navigationController pushViewController:vc animated:YES]; | 695 | [self.navigationController pushViewController:vc animated:YES]; |
| 543 | - | 696 | + |
| 544 | 697 | ||
| 545 | isEnter = YES; | 698 | isEnter = YES; |
| 546 | }else if ([isCertificationStr isEqualToString:@"1"]) { | 699 | }else if ([isCertificationStr isEqualToString:@"1"]) { |
| @@ -550,7 +703,7 @@ | @@ -550,7 +703,7 @@ | ||
| 550 | 703 | ||
| 551 | vc.hidesBottomBarWhenPushed = YES; | 704 | vc.hidesBottomBarWhenPushed = YES; |
| 552 | [self.navigationController pushViewController:vc animated:YES]; | 705 | [self.navigationController pushViewController:vc animated:YES]; |
| 553 | - | 706 | + |
| 554 | 707 | ||
| 555 | isEnter = YES; | 708 | isEnter = YES; |
| 556 | }else if ([isCertificationStr isEqualToString:@"2"]) { | 709 | }else if ([isCertificationStr isEqualToString:@"2"]) { |
| @@ -617,6 +770,14 @@ | @@ -617,6 +770,14 @@ | ||
| 617 | } | 770 | } |
| 618 | 771 | ||
| 619 | 772 | ||
| 773 | +- (CNLiveBServiceLiveSelectedView *)liveSelecctedView { | ||
| 774 | + if (!_liveSelecctedView) { | ||
| 775 | + _liveSelecctedView = [[CNLiveBServiceLiveSelectedView alloc]initWithFrame:CGRectZero]; | ||
| 776 | + } | ||
| 777 | + return _liveSelecctedView; | ||
| 778 | +} | ||
| 779 | + | ||
| 780 | + | ||
| 620 | 781 | ||
| 621 | /* | 782 | /* |
| 622 | #pragma mark - Navigation | 783 | #pragma mark - Navigation |
CNLiveServiceCenterModule/Classes/CNLiveServiceCenterModule/View/CNLiveBServiceCenterHeaderView.m
| @@ -130,9 +130,9 @@ | @@ -130,9 +130,9 @@ | ||
| 130 | //用户信息 | 130 | //用户信息 |
| 131 | NSString *userImagUrl = [NSString stringWithFormat:@"%@",CNUserShareModel.faceUrl]; | 131 | NSString *userImagUrl = [NSString stringWithFormat:@"%@",CNUserShareModel.faceUrl]; |
| 132 | [self.userImageV sd_setImageWithURL:[NSURL URLWithString:userImagUrl] placeholderImage:[UIImage imageNamedFromService:@"service_person"]]; | 132 | [self.userImageV sd_setImageWithURL:[NSURL URLWithString:userImagUrl] placeholderImage:[UIImage imageNamedFromService:@"service_person"]]; |
| 133 | - NSString *userName = [NSString stringWithFormat:@"%@",CNUserShareModel.nickname]; | 133 | + NSString *userName = [NSString stringWithFormat:@"%@",CNUserShareModel.nickname ? CNUserShareModel.nickname : @""]; |
| 134 | self.userNameL.text = userName; | 134 | self.userNameL.text = userName; |
| 135 | - NSString *userLoc = [NSString stringWithFormat:@"%@",CNUserShareModel.location]; | 135 | + NSString *userLoc = [NSString stringWithFormat:@"%@",CNUserShareModel.location ? CNUserShareModel.location : @""]; |
| 136 | self.locationL.text = userLoc; | 136 | self.locationL.text = userLoc; |
| 137 | 137 | ||
| 138 | } | 138 | } |
| @@ -200,7 +200,9 @@ | @@ -200,7 +200,9 @@ | ||
| 200 | 200 | ||
| 201 | if ([isPerson isEqualToString:@"1"]) { | 201 | if ([isPerson isEqualToString:@"1"]) { |
| 202 | self.personCertificationImageV.hidden = NO; | 202 | self.personCertificationImageV.hidden = NO; |
| 203 | + [self.enterView configUI:YES]; | ||
| 203 | }else { | 204 | }else { |
| 205 | + [self.enterView configUI:NO]; | ||
| 204 | self.personCertificationImageV.hidden = YES; | 206 | self.personCertificationImageV.hidden = YES; |
| 205 | } | 207 | } |
| 206 | 208 | ||
| @@ -506,6 +508,12 @@ | @@ -506,6 +508,12 @@ | ||
| 506 | #pragma mark - editUI | 508 | #pragma mark - editUI |
| 507 | - (void)configUI:(Boolean)isAuth { | 509 | - (void)configUI:(Boolean)isAuth { |
| 508 | 510 | ||
| 511 | + if (isAuth) { | ||
| 512 | + self.authL.text = @"用户已认证"; | ||
| 513 | + }else { | ||
| 514 | + self.authL.text = @"用户未认证"; | ||
| 515 | + } | ||
| 516 | + | ||
| 509 | } | 517 | } |
| 510 | 518 | ||
| 511 | #pragma mark - ***事件实现*** | 519 | #pragma mark - ***事件实现*** |
CNLiveServiceCenterModule/Classes/CNLiveServiceCenterModule/View/CNLiveBServiceLiveSelectedView.h
0 → 100644
| 1 | +// | ||
| 2 | +// CNLiveBOrganizationPhotoSelectedView.h | ||
| 3 | +// CNLiveOrganizationValidationModule | ||
| 4 | +// | ||
| 5 | +// Created by 梁星国 on 2020/4/14. | ||
| 6 | +// | ||
| 7 | + | ||
| 8 | +#import <UIKit/UIKit.h> | ||
| 9 | + | ||
| 10 | +NS_ASSUME_NONNULL_BEGIN | ||
| 11 | + | ||
| 12 | +@interface CNLiveBServiceLiveSelectedView : UIView | ||
| 13 | + | ||
| 14 | +/** 点击按钮l回调 */ | ||
| 15 | +@property (nonatomic, copy) void(^clickViewBlock)(CNLiveBServiceLiveSelectedView *view,NSInteger indexCount); | ||
| 16 | + | ||
| 17 | +-(void)popViewForView:(UIView *)view; | ||
| 18 | + | ||
| 19 | +-(void)dismissView; | ||
| 20 | + | ||
| 21 | + | ||
| 22 | +@end | ||
| 23 | + | ||
| 24 | +NS_ASSUME_NONNULL_END |
CNLiveServiceCenterModule/Classes/CNLiveServiceCenterModule/View/CNLiveBServiceLiveSelectedView.m
0 → 100644
| 1 | +// | ||
| 2 | +// CNLiveBOrganizationPhotoSelectedView.m | ||
| 3 | +// CNLiveOrganizationValidationModule | ||
| 4 | +// | ||
| 5 | +// Created by 梁星国 on 2020/4/14. | ||
| 6 | +// | ||
| 7 | + | ||
| 8 | +#import "CNLiveBServiceLiveSelectedView.h" | ||
| 9 | + | ||
| 10 | +#import <Masonry/Masonry.h> | ||
| 11 | +#import <CNLiveBaseKit/CNLiveBaseKit.h> | ||
| 12 | + | ||
| 13 | + | ||
| 14 | +@interface CNLiveBServiceLiveSelectedView () | ||
| 15 | + | ||
| 16 | +@property (strong ,nonatomic) UIView *contentView; | ||
| 17 | + | ||
| 18 | +@property (strong ,nonatomic) UIButton *cancelBtn; | ||
| 19 | + | ||
| 20 | +@property (strong , nonatomic) UIButton *sureBtn; | ||
| 21 | + | ||
| 22 | +@property (strong , nonatomic) UILabel *contentL; | ||
| 23 | + | ||
| 24 | +@end | ||
| 25 | + | ||
| 26 | +@implementation CNLiveBServiceLiveSelectedView | ||
| 27 | + | ||
| 28 | + | ||
| 29 | + | ||
| 30 | +- (instancetype)initWithFrame:(CGRect)frame | ||
| 31 | +{ | ||
| 32 | + self = [super initWithFrame:frame]; | ||
| 33 | + if (self) { | ||
| 34 | + | ||
| 35 | + [self setupUI]; | ||
| 36 | + [self editUI]; | ||
| 37 | + | ||
| 38 | + } | ||
| 39 | + return self; | ||
| 40 | +} | ||
| 41 | + | ||
| 42 | +- (void)awakeFromNib { | ||
| 43 | + [super awakeFromNib]; | ||
| 44 | + [self setupUI]; | ||
| 45 | + | ||
| 46 | +} | ||
| 47 | + | ||
| 48 | +- (void)layoutSubviews { | ||
| 49 | + [super layoutSubviews]; | ||
| 50 | + | ||
| 51 | + [self layoutUI]; | ||
| 52 | +} | ||
| 53 | + | ||
| 54 | +#pragma mark - getter,setter | ||
| 55 | + | ||
| 56 | + | ||
| 57 | +#pragma mark - setupUI | ||
| 58 | +- (void)setupUI { | ||
| 59 | + | ||
| 60 | + self.contentView.frame = CGRectMake(53, 257, KScreenWidth - 106, 170); | ||
| 61 | + [self.contentView setBackgroundColor:RGBOF(0xD8D8D8)]; | ||
| 62 | + [self.contentView addSubview:self.cancelBtn]; | ||
| 63 | + [self.contentView addSubview:self.sureBtn]; | ||
| 64 | + [self.contentView addSubview:self.contentL]; | ||
| 65 | + | ||
| 66 | + self.contentL.frame = CGRectMake(0, 0, self.contentView.frame.size.width, 126); | ||
| 67 | + self.cancelBtn.frame = CGRectMake(0, 127, self.contentView.frame.size.width /2, 44); | ||
| 68 | + [self.cancelBtn setBackgroundColor:[UIColor whiteColor]]; | ||
| 69 | + self.sureBtn.frame = CGRectMake(self.contentView.frame.size.width /2 + 1, 127, self.contentView.frame.size.width /2 -1, 44); | ||
| 70 | + [self.sureBtn setBackgroundColor:[UIColor whiteColor]]; | ||
| 71 | + | ||
| 72 | + | ||
| 73 | + [self addSubview:self.contentView]; | ||
| 74 | + | ||
| 75 | + UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(viewTapAction:)]; | ||
| 76 | + [self addGestureRecognizer:tap]; | ||
| 77 | + | ||
| 78 | + [self.sureBtn addTarget:self action:@selector(sureBtnAction:) forControlEvents:UIControlEventTouchUpInside]; | ||
| 79 | + [self.cancelBtn addTarget:self action:@selector(cancelBtnAction:) forControlEvents:UIControlEventTouchUpInside]; | ||
| 80 | +} | ||
| 81 | + | ||
| 82 | +#pragma mark - layoutUI | ||
| 83 | +- (void)layoutUI { | ||
| 84 | + | ||
| 85 | + | ||
| 86 | +} | ||
| 87 | + | ||
| 88 | +#pragma mark - editUI | ||
| 89 | +- (void)editUI { | ||
| 90 | + | ||
| 91 | +} | ||
| 92 | + | ||
| 93 | +#pragma mark - 事件实现 | ||
| 94 | +- (void)viewTapAction:(UITapGestureRecognizer *)tap { | ||
| 95 | + | ||
| 96 | + [self dismissView]; | ||
| 97 | +} | ||
| 98 | + | ||
| 99 | +- (void)sureBtnAction:(UIButton *)sender { | ||
| 100 | + | ||
| 101 | + if (self.clickViewBlock) { | ||
| 102 | + self.clickViewBlock(self, 1); | ||
| 103 | + __weak typeof(self) weakSelf = self; | ||
| 104 | + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ | ||
| 105 | + if (weakSelf) { | ||
| 106 | + [weakSelf dismissView]; | ||
| 107 | + } | ||
| 108 | + }); | ||
| 109 | + } | ||
| 110 | +} | ||
| 111 | + | ||
| 112 | +- (void)cancelBtnAction:(UIButton *)sender { | ||
| 113 | + | ||
| 114 | + if (self) { | ||
| 115 | + [self dismissView]; | ||
| 116 | + } | ||
| 117 | +} | ||
| 118 | + | ||
| 119 | +#pragma mark - 私有方法 | ||
| 120 | + | ||
| 121 | +#pragma mark - 弹出 | ||
| 122 | +-(void)popViewForView:(UIView *)view{ | ||
| 123 | + | ||
| 124 | + [view addSubview:self]; | ||
| 125 | + [view bringSubviewToFront:self]; | ||
| 126 | + self.frame = CGRectMake(0, 0, KScreenWidth, KScreenHeight); | ||
| 127 | + [self setBackgroundColor:RGBA(0, 0, 0, 0.5)]; | ||
| 128 | + self.alpha = 0.3; | ||
| 129 | + self.contentView.frame = CGRectMake(53, KScreenHeight, KScreenWidth - 106, 170); | ||
| 130 | + | ||
| 131 | + [UIView animateWithDuration:0.25 animations:^{ | ||
| 132 | + self.alpha = 1.0; | ||
| 133 | + | ||
| 134 | + self.contentView.frame = CGRectMake(53, 257, KScreenWidth - 106, 170); | ||
| 135 | + | ||
| 136 | + }]; | ||
| 137 | +} | ||
| 138 | + | ||
| 139 | +-(void)dismissView{ | ||
| 140 | + | ||
| 141 | + [UIView animateWithDuration:0.25 animations:^{ | ||
| 142 | + self.alpha = 0.3; | ||
| 143 | + self.contentView.frame = CGRectMake(53, KScreenHeight, KScreenWidth - 106, 170);; | ||
| 144 | + } completion:^(BOOL finished) { | ||
| 145 | + | ||
| 146 | + [self removeFromSuperview]; | ||
| 147 | + | ||
| 148 | + }]; | ||
| 149 | +} | ||
| 150 | + | ||
| 151 | + | ||
| 152 | + | ||
| 153 | +#pragma mark - 懒加载 | ||
| 154 | + | ||
| 155 | +- (UIView *)contentView { | ||
| 156 | + if (!_contentView) { | ||
| 157 | + _contentView = [[UIView alloc]initWithFrame:CGRectZero]; | ||
| 158 | + _contentView.layer.cornerRadius = 10; | ||
| 159 | + _contentView.layer.masksToBounds = YES; | ||
| 160 | + } | ||
| 161 | + return _contentView; | ||
| 162 | +} | ||
| 163 | + | ||
| 164 | + | ||
| 165 | +/** 取消按钮 */ | ||
| 166 | +- (UIButton *)cancelBtn { | ||
| 167 | + | ||
| 168 | + if (!_cancelBtn) { | ||
| 169 | + _cancelBtn = [UIButton buttonWithType:UIButtonTypeCustom]; | ||
| 170 | + [_cancelBtn setTitle:@"取消" forState:UIControlStateNormal]; | ||
| 171 | + [_cancelBtn setTitleColor:RGBOF(0x999999) forState:UIControlStateNormal]; | ||
| 172 | + } | ||
| 173 | + return _cancelBtn; | ||
| 174 | +} | ||
| 175 | + | ||
| 176 | +/** 去认证 */ | ||
| 177 | +- (UIButton *)sureBtn{ | ||
| 178 | + | ||
| 179 | + if (!_sureBtn) { | ||
| 180 | + _sureBtn = [UIButton buttonWithType:UIButtonTypeCustom]; | ||
| 181 | + [_sureBtn setTitle:@"去认证" forState:UIControlStateNormal]; | ||
| 182 | + [_sureBtn setTitleColor:RGBOF(0x48A7F9) forState:UIControlStateNormal]; | ||
| 183 | + } | ||
| 184 | + return _sureBtn; | ||
| 185 | +} | ||
| 186 | + | ||
| 187 | +/** 内容 */ | ||
| 188 | +- (UILabel *)contentL{ | ||
| 189 | + | ||
| 190 | + if (!_contentL) { | ||
| 191 | + _contentL = [[UILabel alloc]init]; | ||
| 192 | + _contentL.text = @"根据相关法律规定,直播需要\n完成实名认证,是否去认证?"; | ||
| 193 | + _contentL.textColor = RGBOF(0x333333); | ||
| 194 | + _contentL.textAlignment = NSTextAlignmentCenter; | ||
| 195 | + _contentL.numberOfLines = 0; | ||
| 196 | + _contentL.font = [UIFont systemFontOfSize:18]; | ||
| 197 | + [_contentL setBackgroundColor:[UIColor whiteColor]]; | ||
| 198 | + | ||
| 199 | + } | ||
| 200 | + return _contentL; | ||
| 201 | +} | ||
| 202 | + | ||
| 203 | + | ||
| 204 | + | ||
| 205 | +@end |
Example/CNLiveServiceCenterModule.xcodeproj/project.pbxproj
| @@ -208,7 +208,7 @@ | @@ -208,7 +208,7 @@ | ||
| 208 | 6003F587195388D20070C39A /* Frameworks */, | 208 | 6003F587195388D20070C39A /* Frameworks */, |
| 209 | 6003F588195388D20070C39A /* Resources */, | 209 | 6003F588195388D20070C39A /* Resources */, |
| 210 | CCC302347CCCFE680D14E779 /* [CP] Embed Pods Frameworks */, | 210 | CCC302347CCCFE680D14E779 /* [CP] Embed Pods Frameworks */, |
| 211 | - 7A1A31A9AB85C5464BF5829A /* [CP] Copy Pods Resources */, | 211 | + 4F0986FEAE0737650B68FDF9 /* [CP] Copy Pods Resources */, |
| 212 | ); | 212 | ); |
| 213 | buildRules = ( | 213 | buildRules = ( |
| 214 | ); | 214 | ); |
| @@ -343,7 +343,7 @@ | @@ -343,7 +343,7 @@ | ||
| 343 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; | 343 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; |
| 344 | showEnvVarsInLog = 0; | 344 | showEnvVarsInLog = 0; |
| 345 | }; | 345 | }; |
| 346 | - 7A1A31A9AB85C5464BF5829A /* [CP] Copy Pods Resources */ = { | 346 | + 4F0986FEAE0737650B68FDF9 /* [CP] Copy Pods Resources */ = { |
| 347 | isa = PBXShellScriptBuildPhase; | 347 | isa = PBXShellScriptBuildPhase; |
| 348 | buildActionMask = 2147483647; | 348 | buildActionMask = 2147483647; |
| 349 | files = ( | 349 | files = ( |