فهرست منبع

1.完成Apex Mobile文档下载。
2.修改Apex Mobile文档通过Quick Look查看。
3.修改Apex Mobile部分按钮图标。

Pen Li 8 سال پیش
والد
کامیت
99d84474d8
27فایلهای تغییر یافته به همراه512 افزوده شده و 71 حذف شده
  1. 133 22
      Apex Mobile/Apex Mobile/AMResultViewController.m
  2. 1 1
      Apex Mobile/Apex Mobile/ApexMobileDB.m
  3. 1 0
      Apex Mobile/Apex Mobile/Base.lproj/Localizable.strings
  4. 196 8
      Apex Mobile/Apex Mobile/DetailPageViewController.m
  5. 75 17
      Apex Mobile/Apex Mobile/LocalDocumentsViewController.m
  6. 13 10
      Apex Mobile/Apex Mobile/LoginViewController.m
  7. 11 8
      Apex Mobile/Apex Mobile/Main.storyboard
  8. 2 1
      Apex Mobile/Apex Mobile/MylistViewController.m
  9. 23 0
      Apex Mobile/Apex Mobile/NewImages.xcassets/ic_clear.imageset/Contents.json
  10. BIN
      Apex Mobile/Apex Mobile/NewImages.xcassets/ic_clear.imageset/ic_clear.png
  11. BIN
      Apex Mobile/Apex Mobile/NewImages.xcassets/ic_clear.imageset/ic_clear@2x.png
  12. BIN
      Apex Mobile/Apex Mobile/NewImages.xcassets/ic_clear.imageset/ic_clear@3x.png
  13. BIN
      Apex Mobile/Apex Mobile/NewImages.xcassets/ic_exit.imageset/ic_exit.png
  14. BIN
      Apex Mobile/Apex Mobile/NewImages.xcassets/ic_exit.imageset/ic_exit@2x.png
  15. BIN
      Apex Mobile/Apex Mobile/NewImages.xcassets/ic_exit.imageset/ic_exit@3x.png
  16. 23 0
      Apex Mobile/Apex Mobile/NewImages.xcassets/ic_mark_read.imageset/Contents.json
  17. BIN
      Apex Mobile/Apex Mobile/NewImages.xcassets/ic_mark_read.imageset/ic_mark_read.png
  18. BIN
      Apex Mobile/Apex Mobile/NewImages.xcassets/ic_mark_read.imageset/ic_mark_read@2x.png
  19. BIN
      Apex Mobile/Apex Mobile/NewImages.xcassets/ic_mark_read.imageset/ic_mark_read@3x.png
  20. 23 0
      Apex Mobile/Apex Mobile/NewImages.xcassets/ic_menu.imageset/Contents.json
  21. BIN
      Apex Mobile/Apex Mobile/NewImages.xcassets/ic_menu.imageset/ic_menu.png
  22. BIN
      Apex Mobile/Apex Mobile/NewImages.xcassets/ic_menu.imageset/ic_menu@2x.png
  23. BIN
      Apex Mobile/Apex Mobile/NewImages.xcassets/ic_menu.imageset/ic_menu@3x.png
  24. 1 1
      Apex Mobile/Apex Mobile/RANetwork.h
  25. 7 2
      Apex Mobile/Apex Mobile/RANetwork.m
  26. 2 1
      Apex Mobile/Apex Mobile/ToolslistViewController.m
  27. 1 0
      Apex Mobile/Apex Mobile/zh-Hans.lproj/Localizable.strings

+ 133 - 22
Apex Mobile/Apex Mobile/AMResultViewController.m

@@ -97,6 +97,35 @@
     [self resetContraint];
     [self resetContraint];
     [self configureTableView];
     [self configureTableView];
     
     
+    UIBarButtonItem *saveBtn = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"ic_save"] style:UIBarButtonItemStylePlain target:self action:@selector(saveDocumentClick:)];
+    self.quickLook.navigationItem.rightBarButtonItem = saveBtn;
+}
+
+- (void)saveDocumentClick:(id)sender {
+    
+    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
+    NSString *path = [paths objectAtIndex:0];
+    NSString *filePath = [path stringByAppendingPathComponent:[self.documentPath lastPathComponent]];
+    
+    NSError *err;
+    
+    if ([[NSFileManager defaultManager] fileExistsAtPath:filePath]) {
+        [[NSFileManager defaultManager] removeItemAtPath:filePath error:nil];
+    }
+    [[NSFileManager defaultManager] moveItemAtPath:self.documentPath toPath:filePath error:&err];
+    
+    UIAlertController *alertVC;
+    UIAlertAction *action = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
+        
+    }];
+    if (err) {
+        alertVC = [UIAlertController alertControllerWithTitle:@"Warning" message:[NSString stringWithFormat:@"save document failed:\n%@",err.localizedDescription] preferredStyle:UIAlertControllerStyleAlert];
+    } else {
+        alertVC = [UIAlertController alertControllerWithTitle:nil message:@"save document success" preferredStyle:UIAlertControllerStyleAlert];
+    }
+    [alertVC addAction:action];
+    
+    [self presentViewController:alertVC animated:YES completion:nil];
 }
 }
 
 
 - (void)viewWillAppear:(BOOL)animated {
 - (void)viewWillAppear:(BOOL)animated {
@@ -235,42 +264,124 @@
 - (void)showQuickLookAtIndexPath:(NSIndexPath *)indexPath Action:(NSDictionary *)action {
 - (void)showQuickLookAtIndexPath:(NSIndexPath *)indexPath Action:(NSDictionary *)action {
     
     
     
     
-    NSMutableDictionary *params = [NSMutableDictionary new];
     
     
-    NSMutableDictionary *criteria =[NSMutableDictionary new];
+    NSMutableDictionary *params =[NSMutableDictionary new];
     for(NSString* key in [action[@"params"] allKeys] )
     for(NSString* key in [action[@"params"] allKeys] )
     {
     {
         NSArray* item =self.content_data[[NSString stringWithFormat:@"item_%ld",indexPath.row]];
         NSArray* item =self.content_data[[NSString stringWithFormat:@"item_%ld",indexPath.row]];
         int idx =[action[@"params"][key] intValue];
         int idx =[action[@"params"][key] intValue];
-        criteria[key]=item[ idx];
+        params[key]=item[idx];
     }
     }
 
 
-
-    params[@"criteria"]=[RAConvertor dict2string:criteria] ;
     
     
     NSString* URL =action[@"url"];
     NSString* URL =action[@"url"];
+//    URL = @"http://192.168.0.130/lantern-installer.apk";
+//    params = nil;
+    
+    NSString *module_name = [self.params objectForKey:@"module_name"];
     __weak typeof(self) weakSelf = self;
     __weak typeof(self) weakSelf = self;
+    
+    // show alert
+    UIAlertController *alertController = [UIAlertController alertControllerWithTitle: nil
+                                                                             message: @"loading..."
+                                                                      preferredStyle: UIAlertControllerStyleAlert];
+    
+    
+    
+    UIViewController *customVC     = [[UIViewController alloc] init];
+    
+    
+    UIActivityIndicatorView* spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
+    spinner.color = [UIColor darkGrayColor];
+    [spinner startAnimating];
+    [customVC.view addSubview:spinner];
+    
+    [customVC.view addConstraint:[NSLayoutConstraint
+                                  constraintWithItem: spinner
+                                  attribute:NSLayoutAttributeCenterX
+                                  relatedBy:NSLayoutRelationEqual
+                                  toItem:customVC.view
+                                  attribute:NSLayoutAttributeCenterX
+                                  multiplier:1.0f
+                                  constant:0.0f]];
+    
+    
+    
+    [customVC.view addConstraint:[NSLayoutConstraint
+                                  constraintWithItem: spinner
+                                  attribute:NSLayoutAttributeCenterY
+                                  relatedBy:NSLayoutRelationEqual
+                                  toItem:customVC.view
+                                  attribute:NSLayoutAttributeCenterY
+                                  multiplier:1.0f
+                                  constant:0.0f]];
+    
+    
+    [alertController setValue:customVC forKey:@"contentViewController"];
+    
+    [self presentViewController: alertController animated: YES completion: nil];
+    
+    // download
     dispatch_async(dispatch_get_global_queue(0, 0), ^{
     dispatch_async(dispatch_get_global_queue(0, 0), ^{
 
 
-        NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
-        NSString *documents = [paths objectAtIndex:0];
-        NSString *path = [documents stringByAppendingPathComponent:[NSUUID UUID].UUIDString];
+//        NSArray *paths = NSSearchPathForDirectoriesInDomains(nstem, NSUserDomainMask, YES);
+//        NSString *documents = [paths objectAtIndex:0];
+//        NSString *cacheDir = [documents stringByAppendingPathComponent:[module_name stringByAppendingString:@"_download"]];
+
+        NSString *cacheDir = NSTemporaryDirectory();
         
         
-        [RANetwork download_file:params url:URL toCachePath:path progressHandler:^(NSURLSessionTask *task, double progress) {
-            
+        if (![[NSFileManager defaultManager] fileExistsAtPath:cacheDir]) {
+            [[NSFileManager defaultManager] createDirectoryAtPath:cacheDir withIntermediateDirectories:NO attributes:nil error:nil];
+        }
+
+//        NSString *path = [cacheDir stringByAppendingPathComponent:[NSUUID UUID].UUIDString];
+
+
+
+        [RANetwork download_file:params url:URL toCachePath:cacheDir progressHandler:^(NSURLSessionTask *task, double progress) {
+
+            DebugLog(@"download progress %f",progress);
         } completionHandler:^(NSMutableDictionary *result) {
         } completionHandler:^(NSMutableDictionary *result) {
-            
-            weakSelf.documentPath = path;
-            
-            if (path) {
-                dispatch_async(dispatch_get_main_queue(), ^{
-                    [weakSelf.navigationController pushViewController:weakSelf.quickLook animated:NO];
-                });
-            }
-            
+
+            dispatch_async(dispatch_get_main_queue(), ^{
+
+                weakSelf.documentPath = nil;
+                [alertController dismissViewControllerAnimated:YES completion:^{
+                    
+                    
+                    if ([[result objectForKey:@"result"] intValue] == RESULT_TRUE) {
+                        
+                        NSString *cachePath = [result objectForKey:@"path"];
+                        weakSelf.documentPath = cachePath;
+                        
+                        if (cachePath) { // push 必须在completion中
+                            [weakSelf.navigationController pushViewController:weakSelf.quickLook animated:YES];
+                        }
+                        
+                    } else {
+                        
+                        NSString *msg = [result objectForKey:@"msg"];
+                        
+                        UIAlertController *alertVC = [UIAlertController alertControllerWithTitle: @"Warning"
+                                                                                                 message: msg
+                                                                                          preferredStyle: UIAlertControllerStyleAlert];
+                        UIAlertAction *action = [UIAlertAction actionWithTitle:@"Ok" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
+                            
+                        }];
+                        [alertVC addAction:action];
+                        [weakSelf presentViewController:alertVC animated:YES completion:nil];
+                    }
+                    
+                }];
+                
+                
+            });
+
+            DebugLog(@"download result %@",result);
+
         }];
         }];
-        
-        
+
+
     });
     });
     
     
 }
 }
@@ -428,7 +539,7 @@
 
 
 - (void)MenuClick:(UIBarButtonItem *)sender {
 - (void)MenuClick:(UIBarButtonItem *)sender {
     
     
-    UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"Menu" message:nil preferredStyle:UIAlertControllerStyleAlert];
+    UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"menu", nil) message:nil preferredStyle:UIAlertControllerStyleAlert];
     //block代码块取代了delegate
     //block代码块取代了delegate
     
     
     __weak typeof(self) weakSelf = self;
     __weak typeof(self) weakSelf = self;

+ 1 - 1
Apex Mobile/Apex Mobile/ApexMobileDB.m

@@ -49,7 +49,7 @@
     NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
     NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
     NSString *documents = [paths objectAtIndex:0];
     NSString *documents = [paths objectAtIndex:0];
     NSString *database_path = [documents stringByAppendingPathComponent:DBNAME];
     NSString *database_path = [documents stringByAppendingPathComponent:DBNAME];
-    
+    DebugLog(@"home path %@",documents);
     if (sqlite3_open([database_path UTF8String], &db) != SQLITE_OK) {
     if (sqlite3_open([database_path UTF8String], &db) != SQLITE_OK) {
         
         
         DebugLog(@"sqlite3_open failed. msg:%s",sqlite3_errmsg(db));
         DebugLog(@"sqlite3_open failed. msg:%s",sqlite3_errmsg(db));

+ 1 - 0
Apex Mobile/Apex Mobile/Base.lproj/Localizable.strings

@@ -48,3 +48,4 @@
 "alert_msg_password_notequal"="New password not equal confirm password!";
 "alert_msg_password_notequal"="New password not equal confirm password!";
 "ask_click"="\nClick for more detail";
 "ask_click"="\nClick for more detail";
 "fields setting"="Setting";
 "fields setting"="Setting";
+"menu"="Menu";

+ 196 - 8
Apex Mobile/Apex Mobile/DetailPageViewController.m

@@ -14,8 +14,12 @@
 #define  LABEL_MARGIN 5
 #define  LABEL_MARGIN 5
 #import "TabBarController.h"
 #import "TabBarController.h"
 #import "DetailCellTracking.h"
 #import "DetailCellTracking.h"
+#import <QuickLook/QuickLook.h>
 
 
-@interface DetailPageViewController ()
+@interface DetailPageViewController () <QLPreviewControllerDataSource,QLPreviewControllerDelegate>
+
+@property (nonatomic,strong) QLPreviewController *quickLook;
+@property (nonatomic,copy) NSString *documentPath;
 
 
 @end
 @end
 
 
@@ -73,8 +77,41 @@
     //        self.view.backgroundColor= [UIColor whiteColor];
     //        self.view.backgroundColor= [UIColor whiteColor];
     [self loadpage];
     [self loadpage];
 	// Do any additional setup after loading the view.
 	// Do any additional setup after loading the view.
+    
+    UIBarButtonItem *saveBtn = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"ic_save"] style:UIBarButtonItemStylePlain target:self action:@selector(saveDocumentClick:)];
+    self.quickLook.navigationItem.rightBarButtonItem = saveBtn;
+}
+
+- (void)saveDocumentClick:(id)sender {
+    
+    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
+    NSString *path = [paths objectAtIndex:0];
+    NSString *filePath = [path stringByAppendingPathComponent:[self.documentPath lastPathComponent]];
+    
+    NSError *err;
+    
+    if ([[NSFileManager defaultManager] fileExistsAtPath:filePath]) {
+        [[NSFileManager defaultManager] removeItemAtPath:filePath error:nil];
+    }
+    [[NSFileManager defaultManager] moveItemAtPath:self.documentPath toPath:filePath error:&err];
+    
+    UIAlertController *alertVC;
+    UIAlertAction *action = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
+        
+    }];
+    if (err) {
+        alertVC = [UIAlertController alertControllerWithTitle:@"Warning" message:[NSString stringWithFormat:@"save document failed:\n%@",err.localizedDescription] preferredStyle:UIAlertControllerStyleAlert];
+    } else {
+        alertVC = [UIAlertController alertControllerWithTitle:nil message:@"save document success" preferredStyle:UIAlertControllerStyleAlert];
+    }
+    [alertVC addAction:action];
+    
+    [self presentViewController:alertVC animated:YES completion:nil];
+    
 }
 }
 
 
+
+
 - (void)didReceiveMemoryWarning
 - (void)didReceiveMemoryWarning
 {
 {
     [super didReceiveMemoryWarning];
     [super didReceiveMemoryWarning];
@@ -194,7 +231,114 @@
 //    return UIInterfaceOrientationLandscapeRight;
 //    return UIInterfaceOrientationLandscapeRight;
 //}
 //}
 
 
-
+- (void)showDocument:(NSString *)url {
+    
+    __weak typeof(self) weakSelf = self;
+    
+    // show alert
+    UIAlertController *alertController = [UIAlertController alertControllerWithTitle: nil
+                                                                             message: @"loading..."
+                                                                      preferredStyle: UIAlertControllerStyleAlert];
+    
+    
+    
+    UIViewController *customVC     = [[UIViewController alloc] init];
+    
+    
+    UIActivityIndicatorView* spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
+    spinner.color = [UIColor darkGrayColor];
+    [spinner startAnimating];
+    [customVC.view addSubview:spinner];
+    
+    [customVC.view addConstraint:[NSLayoutConstraint
+                                  constraintWithItem: spinner
+                                  attribute:NSLayoutAttributeCenterX
+                                  relatedBy:NSLayoutRelationEqual
+                                  toItem:customVC.view
+                                  attribute:NSLayoutAttributeCenterX
+                                  multiplier:1.0f
+                                  constant:0.0f]];
+    
+    
+    
+    [customVC.view addConstraint:[NSLayoutConstraint
+                                  constraintWithItem: spinner
+                                  attribute:NSLayoutAttributeCenterY
+                                  relatedBy:NSLayoutRelationEqual
+                                  toItem:customVC.view
+                                  attribute:NSLayoutAttributeCenterY
+                                  multiplier:1.0f
+                                  constant:0.0f]];
+    
+    
+    [alertController setValue:customVC forKey:@"contentViewController"];
+    
+    [self presentViewController: alertController animated: YES completion: nil];
+    
+    // download
+    dispatch_async(dispatch_get_global_queue(0, 0), ^{
+        
+        //        NSArray *paths = NSSearchPathForDirectoriesInDomains(nstem, NSUserDomainMask, YES);
+        //        NSString *documents = [paths objectAtIndex:0];
+        //        NSString *cacheDir = [documents stringByAppendingPathComponent:[module_name stringByAppendingString:@"_download"]];
+        
+        NSString *cacheDir = NSTemporaryDirectory();
+        
+        if (![[NSFileManager defaultManager] fileExistsAtPath:cacheDir]) {
+            [[NSFileManager defaultManager] createDirectoryAtPath:cacheDir withIntermediateDirectories:NO attributes:nil error:nil];
+        }
+        
+        //        NSString *path = [cacheDir stringByAppendingPathComponent:[NSUUID UUID].UUIDString];
+        
+        
+        
+        [RANetwork download_file:nil url:url toCachePath:cacheDir progressHandler:^(NSURLSessionTask *task, double progress) {
+            
+            DebugLog(@"download progress %f",progress);
+        } completionHandler:^(NSMutableDictionary *result) {
+            
+            dispatch_async(dispatch_get_main_queue(), ^{
+                
+                weakSelf.documentPath = nil;
+                [alertController dismissViewControllerAnimated:YES completion:^{
+                    
+                    
+                    if ([[result objectForKey:@"result"] intValue] == RESULT_TRUE) {
+                        
+                        NSString *cachePath = [result objectForKey:@"path"];
+                        weakSelf.documentPath = cachePath;
+                        
+                        if (cachePath) { // push 必须在completion中
+                            [weakSelf.navigationController pushViewController:weakSelf.quickLook animated:YES];
+                        }
+                        
+                    } else {
+                        
+                        NSString *msg = [result objectForKey:@"msg"];
+                        
+                        UIAlertController *alertVC = [UIAlertController alertControllerWithTitle: @"Warning"
+                                                                                         message: msg
+                                                                                  preferredStyle: UIAlertControllerStyleAlert];
+                        UIAlertAction *action = [UIAlertAction actionWithTitle:@"Ok" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
+                            
+                        }];
+                        [alertVC addAction:action];
+                        [weakSelf presentViewController:alertVC animated:YES completion:nil];
+                    }
+                    
+                }];
+                
+                
+            });
+            
+            DebugLog(@"download result %@",result);
+            
+        }];
+        
+        
+    });
+    
+}
 
 
 #pragma mark - web view delegate
 #pragma mark - web view delegate
 - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
 - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
@@ -206,13 +350,16 @@
     NSString* str = request.URL.absoluteString;
     NSString* str = request.URL.absoluteString;
     if([str isEqualToString:@"about:blank"])
     if([str isEqualToString:@"about:blank"])
         return true;
         return true;
-    WebViewController *ViewController = [[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"WebViewController"];
-    ViewController.url = str;
-    //    ViewController. = self.function_name;
-    //    ViewController.behavior =BEHAVIOR_SEARCH;
+//    WebViewController *ViewController = [[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"WebViewController"];
+//    ViewController.url = str;
+//    //    ViewController. = self.function_name;
+//    //    ViewController.behavior =BEHAVIOR_SEARCH;
+//
+//    [self.navigationController pushViewController:ViewController animated:YES];
+//      DebugLog(@"shouldStartLoadWithRequest");
+    
+    [self showDocument:request.URL.absoluteString];
     
     
-    [self.navigationController pushViewController:ViewController animated:YES];
-      DebugLog(@"shouldStartLoadWithRequest");
     return false;
     return false;
 }
 }
 - (void)webViewDidFinishLoad:(UIWebView *)webView
 - (void)webViewDidFinishLoad:(UIWebView *)webView
@@ -730,4 +877,45 @@
     return nil;
     return nil;
 }
 }
 
 
+#pragma mark - Quick Look
+
+- (QLPreviewController *)quickLook {
+    if (!_quickLook)
+    {
+        _quickLook = [[QLPreviewController alloc] init];
+        _quickLook.delegate = self;
+        _quickLook.dataSource = self;
+    }
+    else
+    {
+        [_quickLook reloadData];
+    }
+    return _quickLook;
+}
+
+#pragma mark - QuickLook Data Source
+
+- (NSInteger)numberOfPreviewItemsInPreviewController:(QLPreviewController *)controller {
+    return 1;
+}
+
+- (id <QLPreviewItem>) previewController:(QLPreviewController *)controller previewItemAtIndex:(NSInteger)index {
+    
+    return [NSURL fileURLWithPath:self.documentPath];
+}
+
+#pragma mark - QuickLook Delegate
+
+- (void) previewControllerDidDismiss:(QLPreviewController *)controller {
+    
+}
+
+/**
+ * 文件内部链接点击不进行外部跳转
+ */
+- (BOOL) previewController:(QLPreviewController *)controller shouldOpenURL:(NSURL *)url forPreviewItem:(id<QLPreviewItem>)item {
+    return NO;
+}
+
+
 @end
 @end

+ 75 - 17
Apex Mobile/Apex Mobile/LocalDocumentsViewController.m

@@ -7,8 +7,12 @@
 //
 //
 
 
 #import "LocalDocumentsViewController.h"
 #import "LocalDocumentsViewController.h"
+#import <QuickLook/QuickLook.h>
 
 
-@interface LocalDocumentsViewController ()
+@interface LocalDocumentsViewController () <QLPreviewControllerDelegate,QLPreviewControllerDataSource>
+
+@property (nonatomic,strong) QLPreviewController *quickLook;
+@property (nonatomic,copy) NSString *selectedDocumentPath;
 
 
 @end
 @end
 
 
@@ -96,6 +100,12 @@
     [self initpanel];
     [self initpanel];
 }
 }
 
 
+- (void)viewWillAppear:(BOOL)animated {
+    [super viewWillAppear:animated];
+    
+    self.selectedDocumentPath = nil;
+}
+
 - (void)didReceiveMemoryWarning
 - (void)didReceiveMemoryWarning
 {
 {
     [super didReceiveMemoryWarning];
     [super didReceiveMemoryWarning];
@@ -223,24 +233,30 @@
 
 
 -(void)openFile: (NSString *) file_url  {
 -(void)openFile: (NSString *) file_url  {
     
     
-    NSURL *file_URL = [NSURL fileURLWithPath:file_url];
+    self.selectedDocumentPath = file_url;
     
     
-    if (file_URL != nil) {
-        if (self.fileInteractionController == nil) {
-            //_fileInteractionController = [[UIDocumentInteractionController alloc] init];
-            _fileInteractionController = [UIDocumentInteractionController interactionControllerWithURL:file_URL];
-            _fileInteractionController.delegate = self;
-            //  [_fileInteractionController retain];//不适用ARC,记得RETAIN 使用ARC注释这一行
-        }
-        else {
-            self.fileInteractionController.URL = file_URL;
-        }
-        
-// [self.fileInteractionController presentOpenInMenuFromRect:self.view.frame inView:self.view animated:YES];
-        [self.fileInteractionController presentOptionsMenuFromRect:self.view.frame inView:self.view animated:YES];
-//        [self.fileInteractionController  presentPreviewAnimated:YES];
-        
+    if (self.selectedDocumentPath) {
+        [self.navigationController pushViewController:self.quickLook animated:YES];
     }
     }
+    
+//    NSURL *file_URL = [NSURL fileURLWithPath:file_url];
+//
+//    if (file_URL != nil) {
+//        if (self.fileInteractionController == nil) {
+//            //_fileInteractionController = [[UIDocumentInteractionController alloc] init];
+//            _fileInteractionController = [UIDocumentInteractionController interactionControllerWithURL:file_URL];
+//            _fileInteractionController.delegate = self;
+//            //  [_fileInteractionController retain];//不适用ARC,记得RETAIN 使用ARC注释这一行
+//        }
+//        else {
+//            self.fileInteractionController.URL = file_URL;
+//        }
+//
+//// [self.fileInteractionController presentOpenInMenuFromRect:self.view.frame inView:self.view animated:YES];
+//        [self.fileInteractionController presentOptionsMenuFromRect:self.view.frame inView:self.view animated:YES];
+////        [self.fileInteractionController  presentPreviewAnimated:YES];
+//
+//    }
 }
 }
 #pragma mark methods for the UIDocumentInteractionControllerDelegate
 #pragma mark methods for the UIDocumentInteractionControllerDelegate
 
 
@@ -268,4 +284,46 @@
 - (UIView *)documentInteractionControllerViewForPreview:(UIDocumentInteractionController *)controller{
 - (UIView *)documentInteractionControllerViewForPreview:(UIDocumentInteractionController *)controller{
     return self.view;
     return self.view;
 }
 }
+
+#pragma mark - Quick Look
+
+- (QLPreviewController *)quickLook {
+    if (!_quickLook)
+    {
+        _quickLook = [[QLPreviewController alloc] init];
+        _quickLook.delegate = self;
+        _quickLook.dataSource = self;
+    }
+    else
+    {
+        [_quickLook reloadData];
+    }
+    return _quickLook;
+}
+
+#pragma mark - QuickLook Data Source
+
+- (NSInteger)numberOfPreviewItemsInPreviewController:(QLPreviewController *)controller {
+    return 1;
+}
+
+- (id <QLPreviewItem>) previewController:(QLPreviewController *)controller previewItemAtIndex:(NSInteger)index {
+    
+    return [NSURL fileURLWithPath:self.selectedDocumentPath];
+}
+
+#pragma mark - QuickLook Delegate
+
+- (void) previewControllerDidDismiss:(QLPreviewController *)controller {
+    
+}
+
+/**
+ * 文件内部链接点击不进行外部跳转
+ */
+- (BOOL) previewController:(QLPreviewController *)controller shouldOpenURL:(NSURL *)url forPreviewItem:(id<QLPreviewItem>)item {
+    return NO;
+}
+
+
 @end
 @end

+ 13 - 10
Apex Mobile/Apex Mobile/LoginViewController.m

@@ -130,22 +130,13 @@
     [super viewDidLoad];
     [super viewDidLoad];
     [self.checkSavePassword setImage:[UIImage imageNamed:@"unchecked_32.png"] forState:UIControlStateNormal];
     [self.checkSavePassword setImage:[UIImage imageNamed:@"unchecked_32.png"] forState:UIControlStateNormal];
     [self.checkSavePassword setImage:[UIImage imageNamed:@"checked_32.png"] forState:UIControlStateSelected];
     [self.checkSavePassword setImage:[UIImage imageNamed:@"checked_32.png"] forState:UIControlStateSelected];
-    NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
-    NSString * user = [AESCrypt decrypt:[defaults stringForKey:@"user"] password:@"usai"];
+    
     
     
     self.editUser.delegate = self;
     self.editUser.delegate = self;
     self.editPassword.delegate = self;
     self.editPassword.delegate = self;
     self.resize = false;
     self.resize = false;
     self.ioffset = 0;
     self.ioffset = 0;
-    NSString * password = [AESCrypt decrypt:[defaults stringForKey:@"password"] password:@"usai"];
     
     
-    if(user.length>0&&password.length>0)
-    {
-        self.editUser.text=user;
-        self.editPassword.text=password;
-        self.checkSavePassword.selected=true;
-        
-    }
     
     
     self.title=@"Login";
     self.title=@"Login";
     
     
@@ -159,6 +150,18 @@
     [super viewWillAppear:animated];
     [super viewWillAppear:animated];
     
     
     
     
+    NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
+    NSString * user = [AESCrypt decrypt:[defaults stringForKey:@"user"] password:@"usai"];
+    NSString * password = [AESCrypt decrypt:[defaults stringForKey:@"password"] password:@"usai"];
+    
+    if(user.length>0&&password.length>0)
+    {
+        self.editUser.text=user;
+        self.editPassword.text=password;
+        self.checkSavePassword.selected=true;
+        
+    }
+    
     [self clearNavigationbar];
     [self clearNavigationbar];
     [self configureNavigationBar];
     [self configureNavigationBar];
 }
 }

+ 11 - 8
Apex Mobile/Apex Mobile/Main.storyboard

@@ -173,7 +173,6 @@
                                     <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="User" minimumFontSize="17" clearButtonMode="always" translatesAutoresizingMaskIntoConstraints="NO" id="dHA-PV-ECL">
                                     <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="User" minimumFontSize="17" clearButtonMode="always" translatesAutoresizingMaskIntoConstraints="NO" id="dHA-PV-ECL">
                                         <rect key="frame" x="20" y="0.0" width="335" height="30"/>
                                         <rect key="frame" x="20" y="0.0" width="335" height="30"/>
                                         <constraints>
                                         <constraints>
-                                            <constraint firstAttribute="width" constant="335" id="bAR-Fg-jKi"/>
                                             <constraint firstAttribute="height" constant="30" id="yn6-o8-hfY"/>
                                             <constraint firstAttribute="height" constant="30" id="yn6-o8-hfY"/>
                                         </constraints>
                                         </constraints>
                                         <inset key="insetFor6xAndEarlier" minX="0.0" minY="70" maxX="0.0" maxY="-70"/>
                                         <inset key="insetFor6xAndEarlier" minX="0.0" minY="70" maxX="0.0" maxY="-70"/>
@@ -219,6 +218,7 @@
                                     <constraint firstItem="O5q-tH-vch" firstAttribute="centerX" secondItem="OnO-n9-f7N" secondAttribute="centerX" id="9eJ-iH-oTl"/>
                                     <constraint firstItem="O5q-tH-vch" firstAttribute="centerX" secondItem="OnO-n9-f7N" secondAttribute="centerX" id="9eJ-iH-oTl"/>
                                     <constraint firstItem="LxN-nX-R7q" firstAttribute="leading" secondItem="O5q-tH-vch" secondAttribute="leading" id="AeB-jY-RRd"/>
                                     <constraint firstItem="LxN-nX-R7q" firstAttribute="leading" secondItem="O5q-tH-vch" secondAttribute="leading" id="AeB-jY-RRd"/>
                                     <constraint firstItem="vvk-xp-NJf" firstAttribute="top" secondItem="O5q-tH-vch" secondAttribute="bottom" constant="20" id="Gra-Tq-Fi8"/>
                                     <constraint firstItem="vvk-xp-NJf" firstAttribute="top" secondItem="O5q-tH-vch" secondAttribute="bottom" constant="20" id="Gra-Tq-Fi8"/>
+                                    <constraint firstItem="dHA-PV-ECL" firstAttribute="leading" secondItem="OnO-n9-f7N" secondAttribute="leading" constant="20" id="HL3-xu-Qlv"/>
                                     <constraint firstItem="dHA-PV-ECL" firstAttribute="centerX" secondItem="OnO-n9-f7N" secondAttribute="centerX" id="QII-AH-rLY"/>
                                     <constraint firstItem="dHA-PV-ECL" firstAttribute="centerX" secondItem="OnO-n9-f7N" secondAttribute="centerX" id="QII-AH-rLY"/>
                                     <constraint firstItem="O5q-tH-vch" firstAttribute="width" secondItem="dHA-PV-ECL" secondAttribute="width" id="cmr-UO-Edb"/>
                                     <constraint firstItem="O5q-tH-vch" firstAttribute="width" secondItem="dHA-PV-ECL" secondAttribute="width" id="cmr-UO-Edb"/>
                                     <constraint firstItem="O5q-tH-vch" firstAttribute="top" secondItem="dHA-PV-ECL" secondAttribute="bottom" constant="20" id="e9m-LC-gPr"/>
                                     <constraint firstItem="O5q-tH-vch" firstAttribute="top" secondItem="dHA-PV-ECL" secondAttribute="bottom" constant="20" id="e9m-LC-gPr"/>
@@ -794,10 +794,10 @@
                                 <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
                                 <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
                                 <items>
                                 <items>
                                     <barButtonItem style="plain" id="bX6-SA-fCQ">
                                     <barButtonItem style="plain" id="bX6-SA-fCQ">
-                                        <button key="customView" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="q98-Ul-Lg7">
-                                            <rect key="frame" x="16" y="7" width="36" height="30"/>
+                                        <button key="customView" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="q98-Ul-Lg7">
+                                            <rect key="frame" x="16" y="7" width="30" height="30"/>
                                             <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                                             <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
-                                            <state key="normal" title="Clear">
+                                            <state key="normal" image="ic_clear">
                                                 <color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                                 <color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                             </state>
                                             </state>
                                             <connections>
                                             <connections>
@@ -807,10 +807,10 @@
                                     </barButtonItem>
                                     </barButtonItem>
                                     <barButtonItem systemItem="flexibleSpace" id="DPL-8Q-HwA"/>
                                     <barButtonItem systemItem="flexibleSpace" id="DPL-8Q-HwA"/>
                                     <barButtonItem style="plain" id="VRS-1z-M9u">
                                     <barButtonItem style="plain" id="VRS-1z-M9u">
-                                        <button key="customView" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="azJ-db-8ce">
-                                            <rect key="frame" x="311" y="7" width="48" height="30"/>
+                                        <button key="customView" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="azJ-db-8ce">
+                                            <rect key="frame" x="329" y="7" width="30" height="30"/>
                                             <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                                             <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
-                                            <state key="normal" title="Search">
+                                            <state key="normal" image="bar_search">
                                                 <color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                                 <color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                             </state>
                                             </state>
                                             <connections>
                                             <connections>
@@ -975,7 +975,7 @@
                         <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                         <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                     </view>
                     </view>
                     <navigationItem key="navigationItem" id="hLT-6n-O4w">
                     <navigationItem key="navigationItem" id="hLT-6n-O4w">
-                        <barButtonItem key="rightBarButtonItem" title="Mark all read" id="hcg-nl-Lld">
+                        <barButtonItem key="rightBarButtonItem" title="Item" image="ic_mark_read" springLoaded="YES" style="plain" id="hcg-nl-Lld">
                             <connections>
                             <connections>
                                 <action selector="delAllMessage:" destination="BfC-lP-sdY" id="SS4-Ue-PVY"/>
                                 <action selector="delAllMessage:" destination="BfC-lP-sdY" id="SS4-Ue-PVY"/>
                             </connections>
                             </connections>
@@ -1645,6 +1645,9 @@
     </scenes>
     </scenes>
     <resources>
     <resources>
         <image name="apexlogo-2" width="129" height="32"/>
         <image name="apexlogo-2" width="129" height="32"/>
+        <image name="bar_search" width="30" height="30"/>
+        <image name="ic_clear" width="30" height="30"/>
+        <image name="ic_mark_read" width="30" height="30"/>
         <image name="ic_pdf128" width="64" height="64"/>
         <image name="ic_pdf128" width="64" height="64"/>
         <image name="ic_setting" width="30" height="30"/>
         <image name="ic_setting" width="30" height="30"/>
         <image name="map (1)" width="32" height="32"/>
         <image name="map (1)" width="32" height="32"/>

+ 2 - 1
Apex Mobile/Apex Mobile/MylistViewController.m

@@ -124,7 +124,8 @@
         
         
         
         
         JLCustomerNavigationAlertController *nav = [[JLCustomerNavigationAlertController alloc] initWithRootViewController:viewcontroller];
         JLCustomerNavigationAlertController *nav = [[JLCustomerNavigationAlertController alloc] initWithRootViewController:viewcontroller];
-        nav.preferredContentSize = CGSizeMake(350, 170);
+        CGFloat width = [UIScreen mainScreen].bounds.size.width;
+        nav.preferredContentSize = CGSizeMake(width * 0.9, 170);
         
         
         [self presentViewController:nav animated:YES completion:nil];
         [self presentViewController:nav animated:YES completion:nil];
         
         

+ 23 - 0
Apex Mobile/Apex Mobile/NewImages.xcassets/ic_clear.imageset/Contents.json

@@ -0,0 +1,23 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "filename" : "ic_clear.png",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "ic_clear@2x.png",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "ic_clear@3x.png",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

BIN
Apex Mobile/Apex Mobile/NewImages.xcassets/ic_clear.imageset/ic_clear.png


BIN
Apex Mobile/Apex Mobile/NewImages.xcassets/ic_clear.imageset/ic_clear@2x.png


BIN
Apex Mobile/Apex Mobile/NewImages.xcassets/ic_clear.imageset/ic_clear@3x.png


BIN
Apex Mobile/Apex Mobile/NewImages.xcassets/ic_exit.imageset/ic_exit.png


BIN
Apex Mobile/Apex Mobile/NewImages.xcassets/ic_exit.imageset/ic_exit@2x.png


BIN
Apex Mobile/Apex Mobile/NewImages.xcassets/ic_exit.imageset/ic_exit@3x.png


+ 23 - 0
Apex Mobile/Apex Mobile/NewImages.xcassets/ic_mark_read.imageset/Contents.json

@@ -0,0 +1,23 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "filename" : "ic_mark_read.png",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "ic_mark_read@2x.png",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "ic_mark_read@3x.png",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

BIN
Apex Mobile/Apex Mobile/NewImages.xcassets/ic_mark_read.imageset/ic_mark_read.png


BIN
Apex Mobile/Apex Mobile/NewImages.xcassets/ic_mark_read.imageset/ic_mark_read@2x.png


BIN
Apex Mobile/Apex Mobile/NewImages.xcassets/ic_mark_read.imageset/ic_mark_read@3x.png


+ 23 - 0
Apex Mobile/Apex Mobile/NewImages.xcassets/ic_menu.imageset/Contents.json

@@ -0,0 +1,23 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "filename" : "ic_menu.png",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "ic_menu@2x.png",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "ic_menu@3x.png",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

BIN
Apex Mobile/Apex Mobile/NewImages.xcassets/ic_menu.imageset/ic_menu.png


BIN
Apex Mobile/Apex Mobile/NewImages.xcassets/ic_menu.imageset/ic_menu@2x.png


BIN
Apex Mobile/Apex Mobile/NewImages.xcassets/ic_menu.imageset/ic_menu@3x.png


+ 1 - 1
Apex Mobile/Apex Mobile/RANetwork.h

@@ -40,5 +40,5 @@
 + (NSDictionary *)requestHome;
 + (NSDictionary *)requestHome;
 + (NSDictionary *)search:(NSMutableDictionary *)params;
 + (NSDictionary *)search:(NSMutableDictionary *)params;
 + (NSDictionary *)requestOrderHistory:(NSMutableDictionary *)params;
 + (NSDictionary *)requestOrderHistory:(NSMutableDictionary *)params;
-+ (void)download_file:(NSDictionary *)params url:(NSString *)url toCachePath:(NSString *)path progressHandler:(progressHandler)progressHandler completionHandler:(resultHandler)result;
++ (void)download_file:(NSMutableDictionary *)params url:(NSString *)url toCachePath:(NSString *)path progressHandler:(progressHandler)progressHandler completionHandler:(resultHandler)result;
 @end
 @end

+ 7 - 2
Apex Mobile/Apex Mobile/RANetwork.m

@@ -75,6 +75,11 @@
 }
 }
 +(NSMutableDictionary*) prepare_addtional_params:(NSMutableDictionary* ) params
 +(NSMutableDictionary*) prepare_addtional_params:(NSMutableDictionary* ) params
 {
 {
+    
+    if (params == nil) {
+        params = [NSMutableDictionary dictionary];
+    }
+    
     AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
     AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
 //    if(appDelegate.user!=nil && params[@"user"] == nil)
 //    if(appDelegate.user!=nil && params[@"user"] == nil)
 //        [params setValue:[AESCrypt AES128Encrypt:appDelegate.user key:@"Usai2010"] forKey:@"user"];
 //        [params setValue:[AESCrypt AES128Encrypt:appDelegate.user key:@"Usai2010"] forKey:@"user"];
@@ -1267,8 +1272,8 @@
     return resultDic;
     return resultDic;
 }
 }
 
 
-+ (void)download_file:(NSDictionary *)params url:(NSString *)url toCachePath:(NSString *)path progressHandler:(progressHandler)progressHandler completionHandler:(resultHandler)result {
-    
++ (void)download_file:(NSMutableDictionary *)params url:(NSString *)url toCachePath:(NSString *)path progressHandler:(progressHandler)progressHandler completionHandler:(resultHandler)result {
+    params = [self prepare_addtional_params:params];
     [NetworkUtils downloadFileOffset:0 Param:params from:url method:@"POST" toPath:path progressHandler:progressHandler completionHandler:result];
     [NetworkUtils downloadFileOffset:0 Param:params from:url method:@"POST" toPath:path progressHandler:progressHandler completionHandler:result];
 }
 }
 
 

+ 2 - 1
Apex Mobile/Apex Mobile/ToolslistViewController.m

@@ -147,8 +147,9 @@
         UIBarButtonItem *closeItem = [[UIBarButtonItem alloc] initWithImage:[[UIImage imageNamed:@"ic_exit"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] style:UIBarButtonItemStylePlain target:self action:@selector(dismissPresentedVC:)];
         UIBarButtonItem *closeItem = [[UIBarButtonItem alloc] initWithImage:[[UIImage imageNamed:@"ic_exit"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] style:UIBarButtonItemStylePlain target:self action:@selector(dismissPresentedVC:)];
         viewcontroller.navigationItem.rightBarButtonItem = closeItem;
         viewcontroller.navigationItem.rightBarButtonItem = closeItem;
         JLCustomerNavigationAlertController *nav = [[JLCustomerNavigationAlertController alloc] initWithRootViewController:viewcontroller];
         JLCustomerNavigationAlertController *nav = [[JLCustomerNavigationAlertController alloc] initWithRootViewController:viewcontroller];
-        nav.preferredContentSize = CGSizeMake(320, 120);
+        nav.preferredContentSize = CGSizeMake(300, 120);
         [self presentViewController:nav animated:YES completion:nil];
         [self presentViewController:nav animated:YES completion:nil];
+        
     }
     }
 
 
 }
 }

+ 1 - 0
Apex Mobile/Apex Mobile/zh-Hans.lproj/Localizable.strings

@@ -47,3 +47,4 @@
 "alert_msg_password_notequal"="新密码两次输入不一致。";
 "alert_msg_password_notequal"="新密码两次输入不一致。";
 "ask_click"="\n点击查看详细信息";
 "ask_click"="\n点击查看详细信息";
 "fields setting"="设置字段";
 "fields setting"="设置字段";
+"menu"="菜单";