Explorar o código

1.修改Apex CRM图像查看。

Pen Li %!s(int64=7) %!d(string=hai) anos
pai
achega
0440aa29eb

+ 115 - 15
RedAnt CRM/APEX CRM/APEX CRM.xcodeproj/project.pbxproj

@@ -25,6 +25,12 @@
 		4212ABC521AD3C3200BE4E45 /* RADataProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = 4212ABC421AD3C3200BE4E45 /* RADataProvider.m */; };
 		4212ABCB21AD450A00BE4E45 /* RAShareItemProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = 4212ABC821AD450900BE4E45 /* RAShareItemProvider.m */; };
 		4212ABCC21AD450A00BE4E45 /* LPShareActivity.m in Sources */ = {isa = PBXBuildFile; fileRef = 4212ABCA21AD450900BE4E45 /* LPShareActivity.m */; };
+		42A8A21321AE7828003B854B /* RAPhotoPreviewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 42A8A20B21AE7828003B854B /* RAPhotoPreviewController.m */; };
+		42A8A21421AE7828003B854B /* PhotoList.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 42A8A20D21AE7828003B854B /* PhotoList.storyboard */; };
+		42A8A21521AE7828003B854B /* PhotoPreviewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 42A8A21021AE7828003B854B /* PhotoPreviewCell.m */; };
+		42A8A21A21AE8309003B854B /* RAPhotoPreview.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 42A8A21921AE8309003B854B /* RAPhotoPreview.xcassets */; };
+		42A8A21F21AE842E003B854B /* RAPhotoModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 42A8A21E21AE842E003B854B /* RAPhotoModel.m */; };
+		42A8A22321AE8603003B854B /* UIImage+RedAnt.m in Sources */ = {isa = PBXBuildFile; fileRef = 42A8A22221AE8603003B854B /* UIImage+RedAnt.m */; };
 		7106E80A21A684F20056DD20 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7106E80921A684F20056DD20 /* AppDelegate.m */; };
 		7106E80D21A684F20056DD20 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7106E80C21A684F20056DD20 /* ViewController.m */; };
 		7106E81021A684F20056DD20 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 7106E80E21A684F20056DD20 /* Main.storyboard */; };
@@ -78,6 +84,17 @@
 		4212ABC821AD450900BE4E45 /* RAShareItemProvider.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RAShareItemProvider.m; sourceTree = "<group>"; };
 		4212ABC921AD450900BE4E45 /* LPShareActivity.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LPShareActivity.h; sourceTree = "<group>"; };
 		4212ABCA21AD450900BE4E45 /* LPShareActivity.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LPShareActivity.m; sourceTree = "<group>"; };
+		42A8A20A21AE7828003B854B /* RAPhotoPreviewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RAPhotoPreviewController.h; sourceTree = "<group>"; };
+		42A8A20B21AE7828003B854B /* RAPhotoPreviewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RAPhotoPreviewController.m; sourceTree = "<group>"; };
+		42A8A20D21AE7828003B854B /* PhotoList.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = PhotoList.storyboard; sourceTree = "<group>"; };
+		42A8A20F21AE7828003B854B /* PhotoPreviewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PhotoPreviewCell.h; sourceTree = "<group>"; };
+		42A8A21021AE7828003B854B /* PhotoPreviewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PhotoPreviewCell.m; sourceTree = "<group>"; };
+		42A8A21821AE7C5A003B854B /* RAPhotoDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RAPhotoDelegate.h; sourceTree = "<group>"; };
+		42A8A21921AE8309003B854B /* RAPhotoPreview.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = RAPhotoPreview.xcassets; sourceTree = "<group>"; };
+		42A8A21D21AE842E003B854B /* RAPhotoModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RAPhotoModel.h; sourceTree = "<group>"; };
+		42A8A21E21AE842E003B854B /* RAPhotoModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RAPhotoModel.m; sourceTree = "<group>"; };
+		42A8A22121AE8603003B854B /* UIImage+RedAnt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImage+RedAnt.h"; sourceTree = "<group>"; };
+		42A8A22221AE8603003B854B /* UIImage+RedAnt.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImage+RedAnt.m"; sourceTree = "<group>"; };
 		7106E80521A684F20056DD20 /* APEX CRM.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "APEX CRM.app"; sourceTree = BUILT_PRODUCTS_DIR; };
 		7106E80821A684F20056DD20 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
 		7106E80921A684F20056DD20 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
@@ -214,6 +231,95 @@
 			path = ../../../common/Share;
 			sourceTree = "<group>";
 		};
+		42A8A20821AE7828003B854B /* InfinitePhoto */ = {
+			isa = PBXGroup;
+			children = (
+				42A8A21721AE7C48003B854B /* Delegate */,
+				42A8A20921AE7828003B854B /* Controller */,
+				42A8A20C21AE7828003B854B /* Storyboard */,
+				42A8A20E21AE7828003B854B /* View */,
+				42A8A21921AE8309003B854B /* RAPhotoPreview.xcassets */,
+			);
+			name = InfinitePhoto;
+			path = ../../../common/InfinitePhoto;
+			sourceTree = "<group>";
+		};
+		42A8A20921AE7828003B854B /* Controller */ = {
+			isa = PBXGroup;
+			children = (
+				42A8A20A21AE7828003B854B /* RAPhotoPreviewController.h */,
+				42A8A20B21AE7828003B854B /* RAPhotoPreviewController.m */,
+			);
+			path = Controller;
+			sourceTree = "<group>";
+		};
+		42A8A20C21AE7828003B854B /* Storyboard */ = {
+			isa = PBXGroup;
+			children = (
+				42A8A20D21AE7828003B854B /* PhotoList.storyboard */,
+			);
+			path = Storyboard;
+			sourceTree = "<group>";
+		};
+		42A8A20E21AE7828003B854B /* View */ = {
+			isa = PBXGroup;
+			children = (
+				42A8A20F21AE7828003B854B /* PhotoPreviewCell.h */,
+				42A8A21021AE7828003B854B /* PhotoPreviewCell.m */,
+			);
+			path = View;
+			sourceTree = "<group>";
+		};
+		42A8A21721AE7C48003B854B /* Delegate */ = {
+			isa = PBXGroup;
+			children = (
+				42A8A21821AE7C5A003B854B /* RAPhotoDelegate.h */,
+			);
+			path = Delegate;
+			sourceTree = "<group>";
+		};
+		42A8A21B21AE83CF003B854B /* Application */ = {
+			isa = PBXGroup;
+			children = (
+				42A8A21C21AE8418003B854B /* PhotoModel */,
+				7106E80821A684F20056DD20 /* AppDelegate.h */,
+				7106E80921A684F20056DD20 /* AppDelegate.m */,
+				7106E82121A6856E0056DD20 /* WKWebTestViewController.h */,
+				7106E81E21A6856E0056DD20 /* WKWebTestViewController.m */,
+				7106E80B21A684F20056DD20 /* ViewController.h */,
+				7106E80C21A684F20056DD20 /* ViewController.m */,
+				7106E82421A698D20056DD20 /* RAWKWebView.h */,
+				7106E82521A698D20056DD20 /* RAWKWebView.m */,
+				7106E80E21A684F20056DD20 /* Main.storyboard */,
+				7106E81121A684F50056DD20 /* Assets.xcassets */,
+				7106E81321A684F50056DD20 /* LaunchScreen.storyboard */,
+				7106E81621A684F50056DD20 /* Info.plist */,
+				4212AB9F21AD2AFE00BE4E45 /* InfoPlist.strings */,
+				7106E81721A684F50056DD20 /* main.m */,
+				4212ABA521AD2B7300BE4E45 /* Localizable.strings */,
+			);
+			name = Application;
+			sourceTree = "<group>";
+		};
+		42A8A21C21AE8418003B854B /* PhotoModel */ = {
+			isa = PBXGroup;
+			children = (
+				42A8A21D21AE842E003B854B /* RAPhotoModel.h */,
+				42A8A21E21AE842E003B854B /* RAPhotoModel.m */,
+			);
+			path = PhotoModel;
+			sourceTree = "<group>";
+		};
+		42A8A22021AE8603003B854B /* UIImage */ = {
+			isa = PBXGroup;
+			children = (
+				42A8A22121AE8603003B854B /* UIImage+RedAnt.h */,
+				42A8A22221AE8603003B854B /* UIImage+RedAnt.m */,
+			);
+			name = UIImage;
+			path = ../../../common/UIImage;
+			sourceTree = "<group>";
+		};
 		7106E7FC21A684F20056DD20 = {
 			isa = PBXGroup;
 			children = (
@@ -233,6 +339,8 @@
 		7106E80721A684F20056DD20 /* APEX CRM */ = {
 			isa = PBXGroup;
 			children = (
+				42A8A22021AE8603003B854B /* UIImage */,
+				42A8A20821AE7828003B854B /* InfinitePhoto */,
 				4212ABC621AD450900BE4E45 /* Share */,
 				4212ABB521AD389200BE4E45 /* Network */,
 				4212ABA721AD36E600BE4E45 /* HUD */,
@@ -243,21 +351,7 @@
 				7106E82B21ABF26C0056DD20 /* config */,
 				7106E82721ABF1F90056DD20 /* utils */,
 				4212ABC221AD3C0300BE4E45 /* DataProvider */,
-				7106E80821A684F20056DD20 /* AppDelegate.h */,
-				7106E80921A684F20056DD20 /* AppDelegate.m */,
-				7106E82121A6856E0056DD20 /* WKWebTestViewController.h */,
-				7106E81E21A6856E0056DD20 /* WKWebTestViewController.m */,
-				7106E80B21A684F20056DD20 /* ViewController.h */,
-				7106E80C21A684F20056DD20 /* ViewController.m */,
-				7106E82421A698D20056DD20 /* RAWKWebView.h */,
-				7106E82521A698D20056DD20 /* RAWKWebView.m */,
-				7106E80E21A684F20056DD20 /* Main.storyboard */,
-				7106E81121A684F50056DD20 /* Assets.xcassets */,
-				7106E81321A684F50056DD20 /* LaunchScreen.storyboard */,
-				7106E81621A684F50056DD20 /* Info.plist */,
-				4212AB9F21AD2AFE00BE4E45 /* InfoPlist.strings */,
-				7106E81721A684F50056DD20 /* main.m */,
-				4212ABA521AD2B7300BE4E45 /* Localizable.strings */,
+				42A8A21B21AE83CF003B854B /* Application */,
 			);
 			path = "APEX CRM";
 			sourceTree = "<group>";
@@ -359,6 +453,7 @@
 			isa = PBXResourcesBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
+				42A8A21A21AE8309003B854B /* RAPhotoPreview.xcassets in Resources */,
 				7106E81521A684F50056DD20 /* LaunchScreen.storyboard in Resources */,
 				4212AB9D21AD2AFE00BE4E45 /* InfoPlist.strings in Resources */,
 				7106E81221A684F50056DD20 /* Assets.xcassets in Resources */,
@@ -366,6 +461,7 @@
 				7106E81021A684F20056DD20 /* Main.storyboard in Resources */,
 				4212ABA321AD2B7300BE4E45 /* Localizable.strings in Resources */,
 				4212AB9121AD22AB00BE4E45 /* camera.xcassets in Resources */,
+				42A8A21421AE7828003B854B /* PhotoList.storyboard in Resources */,
 				4212AB9021AD22AB00BE4E45 /* Camera.storyboard in Resources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
@@ -380,8 +476,11 @@
 				4212ABCC21AD450A00BE4E45 /* LPShareActivity.m in Sources */,
 				4212AB9821AD25C800BE4E45 /* RAPreviewController.m in Sources */,
 				4212ABC521AD3C3200BE4E45 /* RADataProvider.m in Sources */,
+				42A8A21F21AE842E003B854B /* RAPhotoModel.m in Sources */,
 				7106E83D21AD1B070056DD20 /* zip.c in Sources */,
+				42A8A22321AE8603003B854B /* UIImage+RedAnt.m in Sources */,
 				7106E83B21AD1B070056DD20 /* unzip.c in Sources */,
+				42A8A21521AE7828003B854B /* PhotoPreviewCell.m in Sources */,
 				4212ABCB21AD450A00BE4E45 /* RAShareItemProvider.m in Sources */,
 				4212ABBE21AD389200BE4E45 /* NetworkUtils.m in Sources */,
 				7106E82221A6856E0056DD20 /* WKWebTestViewController.m in Sources */,
@@ -397,6 +496,7 @@
 				4212ABC121AD389200BE4E45 /* Reachability.m in Sources */,
 				7106E81821A684F50056DD20 /* main.m in Sources */,
 				7106E82F21AD1ACD0056DD20 /* RAUtils.m in Sources */,
+				42A8A21321AE7828003B854B /* RAPhotoPreviewController.m in Sources */,
 				7106E80A21A684F20056DD20 /* AppDelegate.m in Sources */,
 				4212AB9321AD22AB00BE4E45 /* RATakePhotoPreviewController.m in Sources */,
 				7106E84021AD1B0D0056DD20 /* ZipArchive.mm in Sources */,

+ 19 - 0
RedAnt CRM/APEX CRM/APEX CRM/PhotoModel/RAPhotoModel.h

@@ -0,0 +1,19 @@
+//
+//  RAPhotoModel.h
+//  APEX CRM
+//
+//  Created by Jack on 2018/11/28.
+//  Copyright © 2018年 USAI. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#import "RAPhotoDelegate.h"
+
+@interface RAPhotoModel : NSObject <RAPhotoItemDelegate>
+
+@property (nonatomic,weak) id<RAPhotoItemUIDelegate> delegate;
+@property (nonatomic,strong) UIImage *image;
+@property (nonatomic,copy) NSString *url;
+
+@end
+

+ 44 - 0
RedAnt CRM/APEX CRM/APEX CRM/PhotoModel/RAPhotoModel.m

@@ -0,0 +1,44 @@
+//
+//  RAPhotoModel.m
+//  APEX CRM
+//
+//  Created by Jack on 2018/11/28.
+//  Copyright © 2018年 USAI. All rights reserved.
+//
+
+#import "RAPhotoModel.h"
+#import "UIImage+RedAnt.h"
+
+@implementation RAPhotoModel
+@synthesize image = _image;
+
+- (void)setImage:(UIImage *)image {
+    _image = image;
+    
+    dispatch_async(dispatch_get_main_queue(), ^{
+        [self.delegate refreshUI];
+    });
+}
+
+- (UIImage *)image {
+    if (_image) {
+        return _image;
+    }
+    // place holder
+    return nil;
+}
+
+- (void)setUrl:(NSString *)url {
+    _url = [url copy];
+    if (_url) {
+        
+        dispatch_async(dispatch_get_global_queue(0, 0), ^{
+           self.image = [UIImage ra_imageWithURL:[NSURL URLWithString:url]];
+        });
+        
+    } else {
+        self.image = nil;
+    }
+}
+
+@end

+ 31 - 1
RedAnt CRM/APEX CRM/APEX CRM/RAWKWebView.m

@@ -16,6 +16,8 @@
 #import "RAProgressHUD.h"
 #import <MessageUI/MessageUI.h>
 #import "LPShareActivity.h"
+#import "RAPhotoPreviewController.h"
+#import "RAPhotoModel.h"
 
 @interface RAWKWebView () <UINavigationControllerDelegate,UIImagePickerControllerDelegate,MFMailComposeViewControllerDelegate>
 @property (strong, nonatomic)   WKWebView                   *wkwebView;
@@ -316,6 +318,34 @@
     [self.ra_viewController presentViewController:activityViewController animated:YES completion:nil];
 }
 
+- (void)ra_viewPhotos:(NSDictionary *)params {
+    
+//    NSArray *arr = @[
+//                     @"http://192.168.0.130/s1.jpg",
+//                     @"http://192.168.0.130/s2.jpg",
+//                     @"http://192.168.0.130/s3.jpg",
+//                     @"http://192.168.0.130/s4.jpg",
+//                     @"http://192.168.0.130/s5.jpg"
+//                     ];
+    
+    NSArray *urlArr = [params objectForKey:@"images"];
+    NSUInteger index = [[params objectForKey:@"index"] integerValue];
+    
+    NSMutableArray *mArr = [NSMutableArray array];
+    for (NSString *url in urlArr) {
+        
+        RAPhotoModel *model = [RAPhotoModel new];
+        model.url = url;
+        
+        [mArr addObject:model];
+    }
+    
+    
+    RAPhotoPreviewController *previewController = [RAPhotoPreviewController ra_photoPreviewControllerWithPhotoItems:mArr offset:index];
+    
+    [self.ra_viewController presentViewController:previewController animated:YES completion:nil];
+}
+
 #pragma mark -MFMailComposeViewControllerDelegate delegate
 
 - (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error {
@@ -457,7 +487,7 @@
 
 - (void)handleViewImage:(NSDictionary *)params
 {
-    
+    [self ra_viewPhotos:params];
 }
 
 - (void)handlePostDialog:(NSDictionary *)params