Commit 0ec9cf91 cgx

对接部分H5页面

1 个父辈 fb3f3ce2
......@@ -106,6 +106,7 @@
_webView.scrollView.dk_backgroundColorPicker = DKColorPickerWithKey(VCViewBG);
_webView.scrollView.showsVerticalScrollIndicator = NO;
_webView.hidden = YES;
_webView.scrollView.bounces = NO;
_webView.scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
[_webView addObserver:self forKeyPath:@"estimatedProgress" options:NSKeyValueObservingOptionNew context:nil];
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:self.linkUrl cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:10.0];
......
......@@ -10,9 +10,9 @@
// 服务器主机地址
#define ServerURL DSInfoDic[@"HOST_URL"]
// API接口地址
#define APIURL [ServerURL stringByAppendingPathComponent:@"sleepiql"]
#define APIURL [NSString stringWithFormat:@"%@/%@", ServerURL, @"sleepiql"]
// AI睡眠教练接口地址
#define AICoachURL [ServerURL stringByAppendingPathComponent:@"sleep/ai/sleep_aicocah"]
#define AICoachURL [NSString stringWithFormat:@"%@/%@", ServerURL, @"sleep/ai/sleep_aicocah"]
// 我的睡眠报告地址
#define MySleepReportURL [ServerURL stringByAppendingPathComponent:@"sleep/ssmian/sleep_diary?step=10"]
// 我的睡眠评测
......
......@@ -93,6 +93,17 @@
}
#pragma mark - WKNavigationDelegate
- (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(nonnull WKNavigationAction *)navigationAction decisionHandler:(nonnull void (^)(WKNavigationActionPolicy))decisionHandler {
NSString *url = navigationAction.request.URL.absoluteString;
if ([url isEqualToString:AICoachURL]) {
decisionHandler(WKNavigationActionPolicyAllow);
} else {
// 开启新的webview页面加载
[self.navigationController pushViewController:[[DsWebController alloc] initWithLink:url isShowNavi:YES] animated:YES];
decisionHandler(WKNavigationActionPolicyCancel);
}
}
// 开始加载
- (void)webView:(WKWebView *)webView didCommitNavigation:(WKNavigation *)navigation {
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES];
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!