apple 5 rokov pred
rodič
commit
1f0ecbe12c

+ 6 - 0
ios/JianYuIOS/JianYuIOS.xcodeproj/project.pbxproj

@@ -60,6 +60,7 @@
 		1859ECB0249239740046A36F /* echarts.min.js in Resources */ = {isa = PBXBuildFile; fileRef = 1859EC84249239740046A36F /* echarts.min.js */; };
 		1859ECB1249239740046A36F /* weui.min.js in Resources */ = {isa = PBXBuildFile; fileRef = 1859EC85249239740046A36F /* weui.min.js */; };
 		1859ECB2249239740046A36F /* axios.min.js in Resources */ = {isa = PBXBuildFile; fileRef = 1859EC86249239740046A36F /* axios.min.js */; };
+		1859ECB524923B290046A36F /* JYNewWebController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1859ECB424923B290046A36F /* JYNewWebController.m */; };
 		185F510A23A76765009F9022 /* CoreLocation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 185F510923A76765009F9022 /* CoreLocation.framework */; };
 		1876C3FC219920DE00BC23DE /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1876C3FB219920DE00BC23DE /* ViewController.m */; };
 		187B4EE321EC356100A9368D /* UIView+Extension.m in Sources */ = {isa = PBXBuildFile; fileRef = 187B4EE221EC356100A9368D /* UIView+Extension.m */; };
@@ -199,6 +200,8 @@
 		1859EC84249239740046A36F /* echarts.min.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = echarts.min.js; sourceTree = "<group>"; };
 		1859EC85249239740046A36F /* weui.min.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = weui.min.js; sourceTree = "<group>"; };
 		1859EC86249239740046A36F /* axios.min.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = axios.min.js; sourceTree = "<group>"; };
+		1859ECB324923B290046A36F /* JYNewWebController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JYNewWebController.h; sourceTree = "<group>"; };
+		1859ECB424923B290046A36F /* JYNewWebController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = JYNewWebController.m; sourceTree = "<group>"; };
 		185F510923A76765009F9022 /* CoreLocation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreLocation.framework; path = System/Library/Frameworks/CoreLocation.framework; sourceTree = SDKROOT; };
 		1876C3FB219920DE00BC23DE /* ViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = "<group>"; };
 		187B4EE121EC356100A9368D /* UIView+Extension.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UIView+Extension.h"; sourceTree = "<group>"; };
@@ -592,6 +595,8 @@
 				188036F92193EA09006F9D7B /* JYTabBarController.m */,
 				18C9D8E5219A5F9F001AC829 /* UITabBar+badge.h */,
 				18C9D8E6219A5F9F001AC829 /* UITabBar+badge.m */,
+				1859ECB324923B290046A36F /* JYNewWebController.h */,
+				1859ECB424923B290046A36F /* JYNewWebController.m */,
 				C55FF3BC20230E7E0088AECC /* NewWebController.h */,
 				C55FF3BD20230E7E0088AECC /* NewWebController.m */,
 				C55FF3BE20230E7E0088AECC /* NewWebController.xib */,
@@ -865,6 +870,7 @@
 			isa = PBXSourcesBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
+				1859ECB524923B290046A36F /* JYNewWebController.m in Sources */,
 				18EF1114232F683C006D4579 /* UIDevice+Hardware.m in Sources */,
 				1876C3FC219920DE00BC23DE /* ViewController.m in Sources */,
 				C55FF3BF20230E7E0088AECC /* NewWebController.m in Sources */,

BIN
ios/JianYuIOS/JianYuIOS.xcworkspace/xcuserdata/apple.xcuserdatad/UserInterfaceState.xcuserstate


+ 1 - 1
ios/JianYuIOS/JianYuIOS/BaseClass1/PrefixHeader.pch

@@ -133,7 +133,7 @@ _Pragma("clang diagnostic pop")\
 #import "Reachability.h"
 #import "NJKWebViewProgressView.h"
 #import "NJKWebViewProgress.h"
-
+#import "JYNewWebController.h"
 
 #define kHost @"http://web-jydev-wss.jianyu360.cn/" //王山
 

+ 5 - 5
ios/JianYuIOS/JianYuIOS/Classes(模块)/JYNewExpViewController.m

@@ -413,12 +413,12 @@ NSString *const new_AesKey_3 = @"mGlAgnIBB8bx2nch";
     [self removeNoNetViews];
     [[LXViewControllerManager shareViewControllerManager] hideHud];
     
-    [self performSelector:@selector(afterPageClick) withObject:nil afterDelay:2];
+//    [self performSelector:@selector(afterPageClick) withObject:nil afterDelay:2];
 }
 
--(void)afterPageClick {
-    [self isExitCallToJS:@"afterPageInit()" withMethodName:@"afterPageInit"];
-}
+//-(void)afterPageClick {
+//    [self isExitCallToJS:@"afterPageInit()" withMethodName:@"afterPageInit"];
+//}
 // 页面开始加载时调用
 - (void)webView:(WKWebView *)webView didStartProvisionalNavigation:(WKNavigation *)navigation{
     
@@ -554,7 +554,7 @@ NSString *const new_AesKey_3 = @"mGlAgnIBB8bx2nch";
     if (url) {
         if ([AFNetworkReachabilityManager sharedManager].networkReachabilityStatus == AFNetworkReachabilityStatusNotReachable || [AFNetworkReachabilityManager sharedManager].networkReachabilityStatus == AFNetworkReachabilityStatusUnknown) {
         }
-        NewWebController *ctr = [[NewWebController alloc] init];
+        JYNewWebController *ctr = [[JYNewWebController alloc] init];
         ctr.url = url;
         if (!title || [title isEqualToString:@""] || [title isEqualToString:@"undefined"]) {
             ctr.titleShow = nil;

+ 7 - 5
ios/JianYuIOS/JianYuIOS/Classes(模块)/JYNewMineViewController.m

@@ -434,13 +434,13 @@ NSString *const new_AesKey_4 = @"mGlAgnIBB8bx2nch";
     [self removeNoNetViews];
     [[LXViewControllerManager shareViewControllerManager] hideHud];
     
-    [self performSelector:@selector(afterPageClick) withObject:nil afterDelay:2];
+//    [self performSelector:@selector(afterPageClick) withObject:nil afterDelay:2];
 
 }
 
--(void)afterPageClick {
-    [self isExitCallToJS:@"afterPageInit()" withMethodName:@"afterPageInit"];
-}
+//-(void)afterPageClick {
+//    [self isExitCallToJS:@"afterPageInit()" withMethodName:@"afterPageInit"];
+//}
 // 页面开始加载时调用
 - (void)webView:(WKWebView *)webView didStartProvisionalNavigation:(WKNavigation *)navigation{
     
@@ -577,7 +577,9 @@ NSString *const new_AesKey_4 = @"mGlAgnIBB8bx2nch";
     if (url) {
         if ([AFNetworkReachabilityManager sharedManager].networkReachabilityStatus == AFNetworkReachabilityStatusNotReachable || [AFNetworkReachabilityManager sharedManager].networkReachabilityStatus == AFNetworkReachabilityStatusUnknown) {
         }
-        NewWebController *ctr = [[NewWebController alloc] init];
+
+        JYNewWebController *ctr = [[JYNewWebController alloc] init];
+//        NewWebController *ctr = [[NewWebController alloc] init];
         ctr.url = url;
         if (!title || [title isEqualToString:@""] || [title isEqualToString:@"undefined"]) {
             ctr.titleShow = nil;

+ 6 - 6
ios/JianYuIOS/JianYuIOS/Classes(模块)/JYNewSearchViewController.m

@@ -367,7 +367,7 @@ NSString *const new_AesKey_1 = @"mGlAgnIBB8bx2nch";
     if ([strRequest containsString:@"jyapp/article/content"]) {
         NSLog(@"拦截的链接:%@",strRequest);
         if (![strRequest containsString:kHost]) {
-             NewWebController *ctr = [[NewWebController alloc] init];
+             JYNewWebController *ctr = [[JYNewWebController alloc] init];
              ctr.url = strRequest;
             ctr.titleShow = [self stringByEvaluatingJavaScriptFromString:@"document.title"];
              kMainQueue(^{
@@ -631,13 +631,13 @@ NSString *const new_AesKey_1 = @"mGlAgnIBB8bx2nch";
     [self removeNoNetViews];
     [[LXViewControllerManager shareViewControllerManager] hideHud];
     //延迟测试
-    [self performSelector:@selector(afterPageClick) withObject:nil afterDelay:2];
+//    [self performSelector:@selector(afterPageClick) withObject:nil afterDelay:2];
 
 }
 
--(void)afterPageClick {
-    [self isExitCallToJS:@"afterPageInit()" withMethodName:@"afterPageInit"];
-}
+//-(void)afterPageClick {
+//    [self isExitCallToJS:@"afterPageInit()" withMethodName:@"afterPageInit"];
+//}
 // 页面开始加载时调用
 - (void)webView:(WKWebView *)webView didStartProvisionalNavigation:(WKNavigation *)navigation{
     
@@ -771,7 +771,7 @@ NSString *const new_AesKey_1 = @"mGlAgnIBB8bx2nch";
     if (url) {
         if ([AFNetworkReachabilityManager sharedManager].networkReachabilityStatus == AFNetworkReachabilityStatusNotReachable || [AFNetworkReachabilityManager sharedManager].networkReachabilityStatus == AFNetworkReachabilityStatusUnknown) {
         }
-        NewWebController *ctr = [[NewWebController alloc] init];
+        JYNewWebController *ctr = [[JYNewWebController alloc] init];
         ctr.url = url;
         if (!title || [title isEqualToString:@""] || [title isEqualToString:@"undefined"]) {
             ctr.titleShow = nil;

+ 5 - 5
ios/JianYuIOS/JianYuIOS/Classes(模块)/JYNewSubViewController.m

@@ -421,12 +421,12 @@ NSString *const new_AesKey_2 = @"mGlAgnIBB8bx2nch";
     [self removeNoNetViews];
     [[LXViewControllerManager shareViewControllerManager] hideHud];
 
-    [self performSelector:@selector(afterPageClick) withObject:nil afterDelay:2];
+//    [self performSelector:@selector(afterPageClick) withObject:nil afterDelay:2];
 }
 
--(void)afterPageClick {
-    [self isExitCallToJS:@"afterPageInit()" withMethodName:@"afterPageInit"];
-}
+//-(void)afterPageClick {
+//    [self isExitCallToJS:@"afterPageInit()" withMethodName:@"afterPageInit"];
+//}
 // 页面开始加载时调用
 - (void)webView:(WKWebView *)webView didStartProvisionalNavigation:(WKNavigation *)navigation{
     
@@ -564,7 +564,7 @@ NSString *const new_AesKey_2 = @"mGlAgnIBB8bx2nch";
     if (url) {
         if ([AFNetworkReachabilityManager sharedManager].networkReachabilityStatus == AFNetworkReachabilityStatusNotReachable || [AFNetworkReachabilityManager sharedManager].networkReachabilityStatus == AFNetworkReachabilityStatusUnknown) {
         }
-        NewWebController *ctr = [[NewWebController alloc] init];
+        JYNewWebController *ctr = [[JYNewWebController alloc] init];
         ctr.url = url;
         if (!title || [title isEqualToString:@""] || [title isEqualToString:@"undefined"]) {
             ctr.titleShow = nil;

+ 20 - 0
ios/JianYuIOS/JianYuIOS/JYNewWebController.h

@@ -0,0 +1,20 @@
+//
+//  JYNewWebController.h
+//  JianYuIOS
+//
+//  Created by apple on 2020/6/11.
+//  Copyright © 2020 lixianglan. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface JYNewWebController : UIViewController
+
+@property(nonatomic, strong)NSString *url;
+@property(nonatomic, strong)NSString *titleShow;
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 164 - 0
ios/JianYuIOS/JianYuIOS/JYNewWebController.m

@@ -0,0 +1,164 @@
+//
+//  JYNewWebController.m
+//  JianYuIOS
+//
+//  Created by apple on 2020/6/11.
+//  Copyright © 2020 lixianglan. All rights reserved.
+//
+
+#import "JYNewWebController.h"
+#import <WebKit/WebKit.h>
+
+@interface JYNewWebController ()
+
+
+@property (nonatomic, strong) UIProgressView *progressView;
+@property (nonatomic, strong) WKWebView *webView;
+
+@end
+
+@implementation JYNewWebController
+
+-(void)viewWillAppear:(BOOL)animated
+{
+    [super viewWillAppear:animated];
+    [self.navigationController setNavigationBarHidden:YES animated:animated];
+}
+//进度条
+- (UIProgressView *)progressView
+{
+    if (_progressView == nil) {
+        _progressView = [[UIProgressView alloc] initWithFrame:CGRectMake(0,STATUS_BAR_HEIGHT - 2,WIDTH,2)];
+        _progressView.tintColor = [UIColor blueColor];
+        _progressView.trackTintColor = [UIColor whiteColor];
+    }
+    return _progressView;
+}
+
+#pragma mark - event response
+// 计算wkWebView进度条
+- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
+    if (object == self.webView && [keyPath isEqualToString:@"estimatedProgress"]) {
+        CGFloat newprogress = [[change objectForKey:NSKeyValueChangeNewKey] doubleValue];
+        self.progressView.alpha = 1.0f;
+        [self.progressView setProgress:newprogress animated:YES];
+        if (newprogress >= 1.0f) {
+            [UIView animateWithDuration:0.3f
+                                  delay:0.3f
+                                options:UIViewAnimationOptionCurveEaseOut
+                             animations:^{
+                                 self.progressView.alpha = 0.0f;
+                             }
+                             completion:^(BOOL finished) {
+                                 [self.progressView setProgress:0 animated:NO];
+                             }];
+        }
+        
+    } else {
+        [super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
+    }
+}
+
+-(void)initUI {
+    //默认都隐藏
+    UIButton *backBtn_1 = [ZKControl createButtonWithFrame:CGRectMake(15, STATUS_BAR_HEIGHT+15, 30, 30) title:@"" imageName:@"back_normal" bgImageName:nil target:self method:@selector(backBtn1Click)];
+    backBtn_1.backgroundColor = [UIColor blackColor];
+    backBtn_1.layer.cornerRadius = 15;
+    backBtn_1.layer.masksToBounds = YES;
+    
+    
+    UIView *titleView = [ZKControl createViewWithFrame:CGRectMake(0, 0, WIDTH, NAVIGATION_BAR_HEIGHT) color:[UIColor whiteColor]];
+    [self.view addSubview:titleView];
+    
+
+    //默认都隐藏
+    UIButton *backBtn_2 = [ZKControl createButtonWithFrame:CGRectMake(10, STATUS_BAR_HEIGHT, 60, 44) title:@"" imageName:@"arrowLeft" bgImageName:nil target:self method:@selector(backBtn2Click)];
+    UILabel *titleLabel = [ZKControl createLabelWithFrame:CGRectMake(50, STATUS_BAR_HEIGHT, WIDTH-100, 44) font:17 text:@"公告信息" TextAlignment:NSTextAlignmentCenter TextColor:UIColorFromRGB(0x333333) bgColor:nil];
+    UIView *lineView= [ZKControl createViewWithFrame:CGRectMake(0, NAVIGATION_BAR_HEIGHT-1, WIDTH, 1) color:[UIColor groupTableViewBackgroundColor]];
+    
+    [titleView addSubview:titleLabel];
+    [titleView addSubview:backBtn_2];
+    [titleView addSubview:lineView];
+    CGFloat H = 0.0;
+    if (self.titleShow) {
+        if ([self.titleShow isEqualToString:@"-1"]) {
+            titleView.hidden = YES;
+            backBtn_1.hidden = YES;
+        }else {
+            titleView.hidden = NO;
+            backBtn_1.hidden = YES;
+            H = NAVIGATION_BAR_HEIGHT;
+        }
+    }else {
+        titleView.hidden = YES;
+        backBtn_1.hidden = NO;
+    }
+    
+    self.webView = [[WKWebView alloc] initWithFrame:CGRectMake(0, H, WIDTH, HEIGHT-TAB_BAR_HEIGHT)];
+    if (iPhoneX) {
+        if (@available(iOS 11.0, *)) {
+            self.webView.scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
+        }
+    }
+    self.webView.scrollView.bounces = NO;
+    [self.webView addObserver:self forKeyPath:@"estimatedProgress" options:NSKeyValueObservingOptionNew context:nil];
+    [self.view addSubview:self.webView];
+    [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:self.url]]];
+    [self.view addSubview:backBtn_1];
+    [self.view addSubview:titleView];
+}
+
+- (void)viewDidLoad {
+    [super viewDidLoad];
+    // Do any additional setup after loading the view.
+    
+    self.view.backgroundColor = [UIColor whiteColor];
+    NSLog(@"title:%@",self.title);
+    [self initUI];//渲染页面
+    [self.view addSubview:self.progressView];
+
+    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(dismissSelf) name:@"kNewWebControllerDismiss" object:nil];
+}
+
+-(void)backBtn1Click
+{
+    if (self.webView.canGoBack) {// web能退 就后退
+        [self.webView goBack];
+    }else{// 跳回上级页面
+        [self dismissViewControllerAnimated:NO completion:nil];
+    }
+}
+-(void)backBtn2Click
+{
+    if (self.webView.canGoBack) {// web能退 就后退
+        [self.webView goBack];
+    }else{// 跳回上级页面
+        [self dismissViewControllerAnimated:NO completion:nil];
+    }
+}
+
+-(void)dismissSelf{
+    kMainQueue(^{
+        [self dismissViewControllerAnimated:NO completion:nil];
+    });
+}
+
+
+
+
+
+
+
+
+
+/*
+#pragma mark - Navigation
+
+// In a storyboard-based application, you will often want to do a little preparation before navigation
+- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
+    // Get the new view controller using [segue destinationViewController].
+    // Pass the selected object to the new view controller.
+}
+*/
+
+@end

+ 5 - 7
ios/JianYuIOS/JianYuIOS/NewWebController.xib

@@ -1,11 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
-    <device id="retina4_7" orientation="portrait">
-        <adaptation id="fullscreen"/>
-    </device>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="16097" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
+    <device id="retina4_7" orientation="portrait" appearance="light"/>
     <dependencies>
         <deployment identifier="iOS"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
@@ -87,10 +85,10 @@
                 <constraint firstItem="hKS-9A-lkH" firstAttribute="top" secondItem="9yt-yG-Kvh" secondAttribute="bottom" id="ZBl-A3-xFX"/>
                 <constraint firstItem="9yt-yG-Kvh" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" id="i13-TT-Cqr"/>
             </constraints>
-            <point key="canvasLocation" x="33.5" y="53.5"/>
+            <point key="canvasLocation" x="29.600000000000001" y="38.23088455772114"/>
         </view>
     </objects>
     <resources>
-        <image name="arrowLeft.png" width="10" height="19"/>
+        <image name="arrowLeft.png" width="10.5" height="19"/>
     </resources>
 </document>