Commit 794989b33bcc5e26c9f4dc48399917b57c826d7a
1 parent
6f862433
提交添加web跳转
Showing
4 changed files
with
143 additions
and
4 deletions
CNLiveOrganizationValidationModule/Classes/CNLiveOrganizationValidationModule/Controller/CNLiveBAgreementCommitFinishController.m
| ... | ... | @@ -10,6 +10,8 @@ |
| 10 | 10 | #import "UIImage+OrganizationValidation.h" |
| 11 | 11 | #import <CNLiveBaseKit/CNLiveBaseKit.h> |
| 12 | 12 | #import "CNLiveBOrganizationTextField.h" |
| 13 | +#import <YYKit/YYKit.h> | |
| 14 | +#import "CNLiveBWebViewController.h" | |
| 13 | 15 | |
| 14 | 16 | |
| 15 | 17 | |
| ... | ... | @@ -17,7 +19,7 @@ |
| 17 | 19 | |
| 18 | 20 | @property (strong, nonatomic) UIImageView *imageVeiw; |
| 19 | 21 | |
| 20 | -@property (strong, nonatomic) UILabel *contentL; | |
| 22 | +@property (strong, nonatomic) YYLabel *contentL; | |
| 21 | 23 | |
| 22 | 24 | @property (strong, nonatomic) UIView *leftTipV; |
| 23 | 25 | |
| ... | ... | @@ -40,6 +42,33 @@ |
| 40 | 42 | // Do any additional setup after loading the view. |
| 41 | 43 | [self setupUI]; |
| 42 | 44 | [self layoutUI]; |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + NSString *contentText = @"您提交资料已完成,查询审核状态需登录PC端操作\n\n请复制链接:http://open.cnlive.com\n\n到电脑浏览器打开查询"; | |
| 49 | + NSString *tipText = @"http://open.cnlive.com"; | |
| 50 | + NSMutableAttributedString *text = [[NSMutableAttributedString alloc] initWithString:contentText]; | |
| 51 | + NSRange range = [contentText rangeOfString:tipText]; | |
| 52 | + // 2. 将属性设置为文本,可以使用几乎所有的CoreText属性。 | |
| 53 | + text.font = [UIFont systemFontOfSize:12]; | |
| 54 | + text.color = RGBOF(0x7b7b7b); | |
| 55 | + text.alignment = NSTextAlignmentCenter; | |
| 56 | + __weak typeof(self) weakSelf = self; | |
| 57 | + [text setTextHighlightRange:range | |
| 58 | + color:[UIColor colorWithRed:0.093 green:0.492 blue:1.000 alpha:1.000] | |
| 59 | + backgroundColor:[UIColor whiteColor] | |
| 60 | + tapAction:^(UIView *containerView, NSAttributedString *text, NSRange range, CGRect rect) { | |
| 61 | + //点击文本的操作 | |
| 62 | + NSLog(@"输出内容"); | |
| 63 | + | |
| 64 | + CNLiveBWebViewController * vc = [[CNLiveBWebViewController alloc]init]; | |
| 65 | + vc.url = tipText; | |
| 66 | + vc.title = @"视讯云"; | |
| 67 | + [weakSelf.navigationController pushViewController:vc animated:YES]; | |
| 68 | + | |
| 69 | + }]; | |
| 70 | + | |
| 71 | + self.contentL.attributedText = text; | |
| 43 | 72 | } |
| 44 | 73 | |
| 45 | 74 | #pragma mark - |
| ... | ... | @@ -152,9 +181,9 @@ |
| 152 | 181 | } |
| 153 | 182 | |
| 154 | 183 | |
| 155 | -- (UILabel *)contentL { | |
| 184 | +- (YYLabel *)contentL { | |
| 156 | 185 | if (!_contentL) { |
| 157 | - _contentL = [[UILabel alloc]initWithFrame:CGRectZero]; | |
| 186 | + _contentL = [[YYLabel alloc]initWithFrame:CGRectZero]; | |
| 158 | 187 | _contentL.textColor = RGBOF(0x999999); |
| 159 | 188 | _contentL.text = @"您提交资料已完成,查询审核状态需登录PC端操作\n\n请复制链接:http://open.cnlive.com\n\n到电脑浏览器打开查询"; |
| 160 | 189 | _contentL.font = [UIFont systemFontOfSize:14]; | ... | ... |
CNLiveOrganizationValidationModule/Classes/CNLiveOrganizationValidationModule/Controller/CNLiveBWebViewController.h
0 → 100644
| 1 | +// | |
| 2 | +// CNLiveBWebViewController.h | |
| 3 | +// CNLiveOrganizationValidationModule | |
| 4 | +// | |
| 5 | +// Created by 梁星国 on 2020/4/22. | |
| 6 | +// | |
| 7 | + | |
| 8 | +#import <UIKit/UIKit.h> | |
| 9 | +#import <CNLiveBusinessBaseModule/CNLiveBusinessBaseModule.h> | |
| 10 | + | |
| 11 | +NS_ASSUME_NONNULL_BEGIN | |
| 12 | + | |
| 13 | +@interface CNLiveBWebViewController : CNCommonViewController | |
| 14 | + | |
| 15 | +@property (strong, nonatomic) NSString *url; | |
| 16 | + | |
| 17 | +@end | |
| 18 | + | |
| 19 | +NS_ASSUME_NONNULL_END | ... | ... |
CNLiveOrganizationValidationModule/Classes/CNLiveOrganizationValidationModule/Controller/CNLiveBWebViewController.m
0 → 100644
| 1 | +// | |
| 2 | +// CNLiveBWebViewController.m | |
| 3 | +// CNLiveOrganizationValidationModule | |
| 4 | +// | |
| 5 | +// Created by 梁星国 on 2020/4/22. | |
| 6 | +// | |
| 7 | + | |
| 8 | +#import "CNLiveBWebViewController.h" | |
| 9 | +#import <WebKit/WebKit.h> | |
| 10 | +#import <CNLiveEnvironment/CNLiveEnvironment.h> | |
| 11 | +#import <CNLiveRequestBastKit/CNLiveNetworkRequest.h> | |
| 12 | +#import <CNLiveRequestBastKit/CNLiveNetworking.h> | |
| 13 | +#import <CNLiveUserManagement/CNUserInfoManager.h> | |
| 14 | +#import <CNLiveBeeHive/CNLiveBeeHive.h> | |
| 15 | +#import <MJExtension/MJExtension.h> | |
| 16 | +#import <QMUIKit/QMUIKit.h> | |
| 17 | +#import <YYKit/YYKit.h> | |
| 18 | +#import <objc/runtime.h> | |
| 19 | +#import <CNLiveBaseKit/CNLiveBaseKit.h> | |
| 20 | + | |
| 21 | + | |
| 22 | +@interface CNLiveBWebViewController ()<WKNavigationDelegate,WKUIDelegate,UIScrollViewDelegate> | |
| 23 | + | |
| 24 | +@property (strong, nonatomic) WKWebView *wkwebView; | |
| 25 | + | |
| 26 | +@property (assign,nonatomic) NSUInteger loadCount; | |
| 27 | +@property (assign,nonatomic) UIProgressView *progressView; | |
| 28 | + | |
| 29 | +@end | |
| 30 | + | |
| 31 | +@implementation CNLiveBWebViewController | |
| 32 | + | |
| 33 | +- (void)viewDidLoad { | |
| 34 | + [super viewDidLoad]; | |
| 35 | + [self.view setBackgroundColor:[UIColor whiteColor]]; | |
| 36 | + [self initWKWebView]; | |
| 37 | + | |
| 38 | + | |
| 39 | +} | |
| 40 | + | |
| 41 | +-(void)initWKWebView | |
| 42 | +{ | |
| 43 | + | |
| 44 | + UIProgressView *progress = [[UIProgressView alloc]initWithFrame:CGRectMake(0, kNavigationBarHeight, KScreenWidth, 1)]; | |
| 45 | + progress.tintColor = RGBOF(0x389FEF); | |
| 46 | + progress.trackTintColor = [UIColor whiteColor]; | |
| 47 | + [self.view addSubview:progress]; | |
| 48 | + self.progressView = progress; | |
| 49 | + | |
| 50 | + | |
| 51 | + self.view.backgroundColor = [UIColor whiteColor]; | |
| 52 | + WKWebView *webView = [[WKWebView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, KScreenHeight)]; | |
| 53 | + [self.view addSubview:webView]; | |
| 54 | + webView.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight; | |
| 55 | + [webView addObserver:self forKeyPath:@"estimatedProgress" options:NSKeyValueObservingOptionNew context:nil]; | |
| 56 | + if (self.url) { | |
| 57 | + NSURL *url = [NSURL URLWithString:self.url]; | |
| 58 | + if (url) { | |
| 59 | + NSURLRequest *request = [NSURLRequest requestWithURL:url]; | |
| 60 | + [webView loadRequest:request]; | |
| 61 | + } | |
| 62 | + } | |
| 63 | + [self.view insertSubview:webView belowSubview:progress]; | |
| 64 | + | |
| 65 | +} | |
| 66 | + | |
| 67 | +- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSKeyValueChangeKey,id> *)change context:(void *)context{ | |
| 68 | + | |
| 69 | + if ([keyPath isEqualToString:@"estimatedProgress"]) { | |
| 70 | + CGFloat newProgress = [[change objectForKey:NSKeyValueChangeNewKey] doubleValue]; | |
| 71 | + if (newProgress == 1) { | |
| 72 | + self.progressView.hidden = YES; | |
| 73 | + [self.progressView setProgress:0 animated:NO]; | |
| 74 | + }else{ | |
| 75 | + self.progressView.hidden = NO; | |
| 76 | + [self.progressView setProgress:newProgress animated:YES]; | |
| 77 | + } | |
| 78 | + } | |
| 79 | +} | |
| 80 | + | |
| 81 | +- (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler{ | |
| 82 | + // 在发送请求之前,决定是否跳转 | |
| 83 | + decisionHandler(WKNavigationActionPolicyAllow); | |
| 84 | + | |
| 85 | + | |
| 86 | +} | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | +@end | ... | ... |
Example/CNLiveOrganizationValidationModule/CNLIVEBViewController.m
| ... | ... | @@ -109,7 +109,7 @@ |
| 109 | 109 | |
| 110 | 110 | /// 详情页 审核中 |
| 111 | 111 | id<CNLiveBOrganizationValidationProtocol> organizationValidationProtocol = [[BeeHive shareInstance] createService:@protocol(CNLiveBOrganizationValidationProtocol)]; |
| 112 | - UIViewController *vc = [organizationValidationProtocol getOrganizationDetailController:dicContent]; | |
| 112 | + UIViewController *vc = [organizationValidationProtocol getOrganizationAuditController:dicContent]; | |
| 113 | 113 | [self.navigationController pushViewController:vc animated:YES]; |
| 114 | 114 | |
| 115 | 115 | isEnter = YES; | ... | ... |