Pen Li 9 лет назад
Родитель
Сommit
48bfd66ba5

+ 0 - 25
RedAnt ERP Mobile/iSales-NPD/JKLock/JKDotView.h

@@ -1,25 +0,0 @@
-//
-//  JKDotView.h
-//  Lock
-//
-//  Created by Jack on 2016/10/13.
-//  Copyright © 2016年 mini1. All rights reserved.
-//
-
-#import <UIKit/UIKit.h>
-
-typedef NS_ENUM(NSUInteger, JKDotState) {
-    JKDotStateNormal,
-    JKDotStateSelected
-};
-
-@interface JKDotView : UIView
-
-@property (nonatomic,assign) JKDotState state;
-
-@property (nonatomic,strong) UIColor *strokColor;
-@property (nonatomic,strong) UIColor *fillColor;
-
-- (instancetype)initWithFrame:(CGRect)frame strokColor:(UIColor *)strokColor fillColor:(UIColor *)fillColor;
-
-@end

+ 0 - 88
RedAnt ERP Mobile/iSales-NPD/JKLock/JKDotView.m

@@ -1,88 +0,0 @@
-//
-//  JKDotView.m
-//  Lock
-//
-//  Created by Jack on 2016/10/13.
-//  Copyright © 2016年 mini1. All rights reserved.
-//
-
-#import "JKDotView.h"
-
-@interface JKDotView ()
-
-@property (nonatomic,strong) CAShapeLayer *inscribedCircleLayer;///<内切圆
-
-
-@end
-
-@implementation JKDotView
-
--(CAShapeLayer *)inscribedCircleLayer{
-    if (!_inscribedCircleLayer) {
-        _inscribedCircleLayer = [CAShapeLayer layer];
-        _inscribedCircleLayer.strokeColor = self.strokColor.CGColor;
-        _inscribedCircleLayer.fillColor = [UIColor clearColor].CGColor;
-        _inscribedCircleLayer.lineWidth = 1.0f;
-    }
-    return _inscribedCircleLayer;
-}
-
-- (void)drawLayer:(CALayer *)layer inContext:(CGContextRef)ctx {
-    
-    self.inscribedCircleLayer.path = [UIBezierPath bezierPathWithOvalInRect:self.bounds].CGPath;
-    
-    [self.layer addSublayer:self.inscribedCircleLayer];
-    
-}
-
-- (instancetype)initWithFrame:(CGRect)frame {
-    if (self = [super initWithFrame:frame]) {
-        self.backgroundColor = [UIColor clearColor];
-        [self.layer setNeedsDisplay];
-    }
-    return self;
-}
-
-- (instancetype)initWithFrame:(CGRect)frame strokColor:(UIColor *)strokColor fillColor:(UIColor *)fillColor {
-    if (self = [super initWithFrame:frame]) {
-        
-        self.strokColor = strokColor;
-        self.fillColor = fillColor;
-        
-        self.backgroundColor = [UIColor clearColor];
-        [self.layer setNeedsDisplay];
-        
-    }
-    return self;
-}
-
-- (void)setState:(JKDotState)state {
-    _state = state;
-    
-    switch (state) {
-        case JKDotStateNormal:{
-            _inscribedCircleLayer.strokeColor = self.strokColor.CGColor;
-            _inscribedCircleLayer.fillColor = [UIColor clearColor].CGColor;
-        }
-            break;
-        case JKDotStateSelected:{
-            _inscribedCircleLayer.strokeColor = self.fillColor.CGColor;
-            _inscribedCircleLayer.fillColor = self.fillColor.CGColor;
-        }
-            break;
-            
-        default:
-            break;
-    }
-}
-
-- (UIColor *)strokColor {
-    return _strokColor ? _strokColor : [UIColor blackColor];
-}
-
-- (UIColor *)fillColor {
-    return _fillColor ? _fillColor : [UIColor blackColor];
-}
-
-
-@end

+ 0 - 23
RedAnt ERP Mobile/iSales-NPD/JKLock/JKLockButton.h

@@ -1,23 +0,0 @@
-//
-//  JKLockButton.h
-//  Lock
-//
-//  Created by Jack on 2016/10/13.
-//  Copyright © 2016年 mini1. All rights reserved.
-//
-
-#import <UIKit/UIKit.h>
-
-
-
-@interface JKLockButton : UIButton
-
-@property (nonatomic,assign) NSInteger number;
-
-@property (nonatomic,strong) UIColor *strokColor;
-@property (nonatomic,strong) UIColor *fillColor;
-@property (nonatomic,strong) UIColor *highlightColor;
-
-- (instancetype)initWithFrame:(CGRect)frame strokColor:(UIColor *)strokColor highlightColor:(UIColor *)highlightColor;
-
-@end

+ 0 - 119
RedAnt ERP Mobile/iSales-NPD/JKLock/JKLockButton.m

@@ -1,119 +0,0 @@
-//
-//  JKLockButton.m
-//  Lock
-//
-//  Created by Jack on 2016/10/13.
-//  Copyright © 2016年 mini1. All rights reserved.
-//
-
-#import "JKLockButton.h"
-
-@interface JKLockButton ()
-
-@property (nonatomic,strong) CAShapeLayer *inscribedCircleLayer;///<内切圆
-
-@property (nonatomic,strong) CAShapeLayer *borderLayer;///<边框
-
-
-@end
-
-@implementation JKLockButton
-
-- (void)setNumber:(NSInteger)number {
-    _number = number;
-    
-    if (number >= 0 && number < 10) {
-        [self setTitle:[NSString stringWithFormat:@"%d",number] forState:UIControlStateNormal];
-        self.titleLabel.font = [UIFont systemFontOfSize:17.0f];
-    } else {
-        [self setTitle:@"delete" forState:UIControlStateNormal];
-        self.titleLabel.font = [UIFont systemFontOfSize:14.0f];
-    }
-    [self setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
-}
--(CAShapeLayer *)inscribedCircleLayer{
-    if (!_inscribedCircleLayer) {
-        _inscribedCircleLayer = [CAShapeLayer layer];
-        _inscribedCircleLayer.strokeColor = self.strokColor.CGColor;
-        _inscribedCircleLayer.fillColor = [UIColor clearColor].CGColor;
-        _inscribedCircleLayer.lineWidth = 1.0f;
-    }
-    return _inscribedCircleLayer;
-}
-
--(CAShapeLayer *)borderLayer{
-    if (!_borderLayer) {
-        _borderLayer = [CAShapeLayer layer];
-        _borderLayer.fillColor = [UIColor clearColor].CGColor;
-        _borderLayer.strokeColor = [UIColor clearColor].CGColor;
-        _borderLayer.lineWidth = 1.0f;
-    }
-    return _borderLayer;
-}
-
-
-- (void)drawLayer:(CALayer *)layer inContext:(CGContextRef)ctx {
-    
-    self.inscribedCircleLayer.path = [UIBezierPath bezierPathWithOvalInRect:self.bounds].CGPath;
-
-    self.borderLayer.path = [UIBezierPath bezierPathWithRect:self.bounds].CGPath;
-    
-    [self.layer addSublayer:self.inscribedCircleLayer];
-    [self.layer addSublayer:self.borderLayer];
-    
-}
-
-- (instancetype)initWithFrame:(CGRect)frame strokColor:(UIColor *)strokColor highlightColor:(UIColor *)highlightColor {
-    if (self = [super initWithFrame:frame]) {
-        self.strokColor = strokColor;
-        self.highlightColor = highlightColor;
-        [self.layer setNeedsDisplay];
-        [self.inscribedCircleLayer addSublayer:self.titleLabel.layer];
-    }
-    return self;
-}
-
-- (instancetype)initWithFrame:(CGRect)frame {
-    if (self = [super initWithFrame:frame]) {
-        [self.layer setNeedsDisplay];
-        [self.inscribedCircleLayer addSublayer:self.titleLabel.layer];
-    }
-    return self;
-}
-
-- (void)setImage:(UIImage *)image forState:(UIControlState)state {
-    
-}
-
-- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
-    self.inscribedCircleLayer.strokeColor = self.highlightColor.CGColor;
-    self.inscribedCircleLayer.fillColor = self.highlightColor.CGColor;
-    
-    NSSet *allTargets = self.allTargets;
-    
-    id target = [allTargets.allObjects firstObject];
-    
-    if (target) {
-        [self sendActionsForControlEvents:UIControlEventTouchUpInside];
-    }
-}
-
-- (void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
-    self.inscribedCircleLayer.strokeColor = self.strokColor.CGColor;
-    self.inscribedCircleLayer.fillColor = [UIColor clearColor].CGColor;
-}
-
-- (UIColor *)highlightColor {
-    return _highlightColor ? _highlightColor : [UIColor colorWithRed:0.5 green:0.5 blue:0.5 alpha:0.5];
-}
-
-- (UIColor *)strokColor {
-    return _strokColor ? _strokColor : [UIColor lightGrayColor];
-}
-
-- (UIColor *)fillColor {
-    return _fillColor ? _fillColor : self.highlightColor;
-}
-
-
-@end

+ 0 - 30
RedAnt ERP Mobile/iSales-NPD/JKLock/JKLockController.h

@@ -1,30 +0,0 @@
-//
-//  JKLockController.h
-//  Lock
-//
-//  Created by Jack on 2016/10/13.
-//  Copyright © 2016年 mini1. All rights reserved.
-//
-
-#import <UIKit/UIKit.h>
-
-typedef void(^authoBlock)(BOOL failure);
-
-@interface JKLockController : UIViewController
-
-@property (nonatomic,copy) authoBlock authoReturn;
-
-#pragma mark - color
-
-@property (nonatomic,strong) UIColor *backgroundColor;
-@property (nonatomic,strong) UIColor *dotStrokColor;
-@property (nonatomic,strong) UIColor *dotFillColor;
-@property (nonatomic,strong) UIColor *lockStrokColor;
-//@property (nonatomic,strong) UIColor *lockFillColor;
-@property (nonatomic,strong) UIColor *lockHighlightColor;
-
-#pragma mark - method
-
-- (void)setPasswordKey:(NSString *)passwordKey;
-
-@end

+ 0 - 433
RedAnt ERP Mobile/iSales-NPD/JKLock/JKLockController.m

@@ -1,433 +0,0 @@
-//
-//  JKLockController.m
-//  Lock
-//
-//  Created by Jack on 2016/10/13.
-//  Copyright © 2016年 mini1. All rights reserved.
-//
-
-#import "JKLockController.h"
-#import "JKLockButton.h"
-#import "JKDotView.h"
-#import "JKMessageBoxController.h"
-#import "AppDelegate.h"
-
-#define Password_Length 4
-#define Dot_Interval 60
-#define Dot_Width 20
-
-#define View_Tag 10086
-
-@interface JKLockController ()
-
-@property (nonatomic,strong) UILabel *tipLabel;///<提示标签
-@property (nonatomic,copy) NSString *password;///<密码
-@property (nonatomic,strong) UIButton *forgottenButton;
-@property (nonatomic,strong) UIButton *resetButton;
-@property (nonatomic,strong) NSMutableArray *dotArray;///<密码视图
-@property (nonatomic,copy) NSString *input;///<输入
-@property (nonatomic,assign) NSUInteger index;///<输入了多少位
-
-@property (nonatomic,copy,readonly) NSString *passwordKey;///<取密码的钥匙
-
-@end
-
-@implementation JKLockController
-
-- (void)setPasswordKey:(NSString *)passwordKey {
-    _passwordKey = passwordKey;
-}
-
-- (instancetype)init {
-    if (self = [super init]) {
-        self.backgroundColor = [UIColor colorWithRed:0.8 green:0.8 blue:0.8 alpha:0.8];
-        
-        self.dotStrokColor = [UIColor colorWithRed:0.4737 green:0.3641 blue:0.2456 alpha:0.5];
-        self.dotFillColor = [UIColor colorWithRed:0.4737 green:0.3641 blue:0.2456 alpha:0.5];
-        
-        self.lockStrokColor = [UIColor colorWithRed:0.4737 green:0.3641 blue:0.2456 alpha:0.5];
-        self.lockHighlightColor = [UIColor colorWithRed:0.4737 green:0.3641 blue:0.2456 alpha:0.5];
-    }
-    return self;
-}
-
-- (void)viewDidLoad {
-    [super viewDidLoad];
-    // Do any additional setup after loading the view.
-    self.view.backgroundColor = self.backgroundColor;
-        
-    self.index = 0;
-    self.input = @"";
-    [self loadPassword];
-    [self configAppearance];
-    
-}
-
-- (void)didReceiveMemoryWarning {
-    [super didReceiveMemoryWarning];
-    // Dispose of any resources that can be recreated.
-}
-
-- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
-    return YES;
-}
-
-- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
-    
-    [self configAppearance];
-}
-
-- (void)clearView {
-    for (UIView *view in self.view.subviews) {
-        [view removeFromSuperview];
-        [self.dotArray removeAllObjects];
-    }
-}
-
-- (void)configAppearance {
-    CGFloat width = CGRectGetWidth(self.view.bounds);
-    CGFloat height = CGRectGetHeight(self.view.bounds);
-    
-//    [self clearView];
-    
-    // 20
-    CGFloat y0 = height * 0.2;
-    self.tipLabel.center = CGPointMake(width / 2, y0 + CGRectGetHeight(self.tipLabel.bounds) / 2);
-    [self.view addSubview:self.tipLabel];
-    
-    // 10
-    CGFloat y1 = y0 + CGRectGetHeight(self.tipLabel.bounds) + 20; // 间距20,高度20
-    CGFloat x1 = (width - Dot_Width * Password_Length - Dot_Interval * (Password_Length - 1)) / 2;
-    for (int i = 0; i < Password_Length; i++) {
-        JKDotView *dotView = [self.view viewWithTag:View_Tag + 20 + i];
-        if (dotView) {
-            dotView.frame = CGRectMake(x1 + (Dot_Width + Dot_Interval) * i, y1, Dot_Width, Dot_Width);
-        } else {
-            JKDotView *dot = [[JKDotView alloc] initWithFrame:CGRectMake(x1 + (Dot_Width + Dot_Interval) * i, y1, Dot_Width, Dot_Width) strokColor:self.dotStrokColor fillColor:self.dotFillColor];
-            dot.tag = View_Tag + 20 + i;
-            
-            [self.view addSubview:dot];
-            [self.dotArray addObject:dot];
-        }
-    }
-    
-    // 70
-    // 3 * 4
-    CGFloat y2 = y1 + Dot_Width + 0.1 * height; // 间距 80 / 40
-    CGFloat Button_Width = 0.07 * (width > height ? height : width);
-    CGFloat interval = 0.05 * (width > height ? height : width);
-    CGFloat x2 = (width - Button_Width * 3 - interval * 2) / 2;
-    
-    for (int i = 0; i < 3; i++) { // col
-        
-        for (int j = 0; j < 4; j++) { // row
-            
-            int index = 3 * j + i + View_Tag + 50;
-            UIView *view = [self.view viewWithTag:index];
-            
-            if (i == 0 && j == 3) { // 取消
-                
-                if (!view) {
-                    UIButton *cancelBtn = [UIButton buttonWithType:UIButtonTypeCustom];
-                    cancelBtn.frame = CGRectMake(x2 + (Button_Width + interval) * i, y2 + (Button_Width + interval) * j, Button_Width, Button_Width);
-                    [cancelBtn setTitle:@"cancel" forState:UIControlStateNormal];
-                    [cancelBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
-                    [cancelBtn setTitleColor:[UIColor lightGrayColor] forState:UIControlStateHighlighted];
-                    [cancelBtn addTarget:self action:@selector(cancelButtonClick:) forControlEvents:UIControlEventTouchUpInside];
-                    [self.view addSubview:cancelBtn];
-                    cancelBtn.tag = index;
-                } else {
-                    view.frame = CGRectMake(x2 + (Button_Width + interval) * i, y2 + (Button_Width + interval) * j, Button_Width, Button_Width);
-                }
-                
-            } else if (i == 2 && j == 3) { // 删除
-                
-                if (view) {
-                    view.frame = CGRectMake(x2 + (Button_Width + interval) * i, y2 + (Button_Width + interval) * j, Button_Width, Button_Width);
-                } else {
-                    UIButton *deleteBtn = [UIButton buttonWithType:UIButtonTypeCustom];
-                    deleteBtn.frame = CGRectMake(x2 + (Button_Width + interval) * i, y2 + (Button_Width + interval) * j, Button_Width, Button_Width);
-                    [deleteBtn setTitle:@"delete" forState:UIControlStateNormal];
-                    [deleteBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
-                    [deleteBtn setTitleColor:[UIColor lightGrayColor] forState:UIControlStateHighlighted];
-                    [deleteBtn addTarget:self action:@selector(deleteButtonClick:) forControlEvents:UIControlEventTouchUpInside];
-                    [self.view addSubview:deleteBtn];
-                    deleteBtn.tag = index;
-                }
-                
-            } else { // 数字
-                JKLockButton *btn = (JKLockButton *)view;
-                if (btn) {
-                    btn.frame = CGRectMake(x2 + (Button_Width + interval) * i, y2 + (Button_Width + interval) * j, Button_Width, Button_Width);
-                } else {
-                    btn = [[JKLockButton alloc] initWithFrame:CGRectMake(x2 + (Button_Width + interval) * i, y2 + (Button_Width + interval) * j, Button_Width, Button_Width) strokColor:self.lockStrokColor highlightColor:self.lockHighlightColor];
-                    if (i == 1 && j == 3) {
-                        btn.number = 0;
-                    } else {
-                        btn.number = 1 + i + j * 3;
-                    }
-                    [self.view addSubview:btn];
-                    [btn addTarget:self action:@selector(numberButtonClick:) forControlEvents:UIControlEventTouchUpInside];
-                    btn.tag = index;
-                }
-
-                
-            }
-            
-        }
-        
-    }
-    
-    // forget
-    self.forgottenButton.frame = CGRectMake(width - 120, height - 40, 120, 40);
-    [self.view addSubview:self.forgottenButton];
-    
-    // reset
-    self.resetButton.frame = CGRectMake(0, height - 40, 120, 40);
-    [self.view addSubview:self.resetButton];
-    
-}
-
-- (void)loadPassword {
-    
-    NSString *password = [[NSUserDefaults standardUserDefaults] objectForKey:self.passwordKey];
-    self.password = password;
-    
-}
-
-- (void)setPassword:(NSString *)password {
-    _password = password;
-    if (password) {
-        self.tipLabel.text = @"Please Input Your Password";
-    } else {
-        self.tipLabel.text = @"Please Set A Password";
-    }
-}
-
-- (UILabel *)tipLabel {
-    if (!_tipLabel) {
-        _tipLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, 20)];
-        _tipLabel.font = [UIFont systemFontOfSize:20.0f];
-        _tipLabel.textAlignment = NSTextAlignmentCenter;
-        
-    }
-    return _tipLabel;
-}
-
-- (UIButton *)forgottenButton {
-    if (!_forgottenButton) {
-        _forgottenButton = [UIButton buttonWithType:UIButtonTypeCustom];
-        [_forgottenButton setTitle:@"forget password" forState:UIControlStateNormal];
-        [_forgottenButton setTitleColor:[UIColor lightGrayColor] forState:UIControlStateHighlighted];
-        _forgottenButton.tag = View_Tag + 2;
-        _forgottenButton.titleLabel.font = [UIFont systemFontOfSize:14.0f];
-        [_forgottenButton addTarget:self action:@selector(forgottenButtonClick:) forControlEvents:UIControlEventTouchUpInside];
-    }
-    return _forgottenButton;
-}
-
-- (UIButton *)resetButton {
-    if (!_resetButton) {
-        _resetButton = [UIButton buttonWithType:UIButtonTypeCustom];
-        [_resetButton setTitle:@"reset password" forState:UIControlStateNormal];
-        [_resetButton setTitleColor:[UIColor lightGrayColor] forState:UIControlStateHighlighted];
-        _resetButton.tag = View_Tag + 2;
-        _resetButton.titleLabel.font = [UIFont systemFontOfSize:14.0f];
-        [_resetButton addTarget:self action:@selector(resetButtonClick:) forControlEvents:UIControlEventTouchUpInside];
-    }
-    return _resetButton;
-}
-
-- (NSMutableArray *)dotArray {
-    if (!_dotArray) {
-        _dotArray = [NSMutableArray arrayWithCapacity:Password_Length];
-    }
-    return _dotArray;
-}
-
-- (void)numberButtonClick:(JKLockButton *)sender {
-    if (self.index < Password_Length) {
-        NSInteger number = sender.number;
-        JKDotView *dot = [self.dotArray objectAtIndex:self.index];
-        dot.state = JKDotStateSelected;
-        
-        self.input = [self.input stringByAppendingString:[NSString stringWithFormat:@"%d",number]];
-        self.index++;
-    }
-    
-    if (self.index == Password_Length) {
-        
-        [self performSelector:@selector(verifyPassword) withObject:nil afterDelay:0.5];
-    }
-}
-
-- (void)cancelButtonClick:(UIButton *)sender {
-    if (self.navigationController) {
-        [self.navigationController popViewControllerAnimated:YES];
-    } else {
-        [self dismissViewControllerAnimated:YES completion:nil];
-    }
-}
-
-- (void)deleteButtonClick:(UIButton *)sender {
-    if (self.index > 0) {
-        
-        JKDotView *dot = [self.dotArray objectAtIndex:self.index - 1];
-        dot.state = JKDotStateNormal;
-        
-        self.input = [self.input substringToIndex:self.index - 1];
-        self.index--;
-        
-    }
-}
-
-- (void)forgottenButtonClick:(UIButton *)sender {
-
-    JKMessageBoxController *messageBoxController = [JKMessageBoxController messageBoxControllerWithTip:@"Please enter your login password"];
-    
-    __weak typeof(messageBoxController) weakVC = messageBoxController;
-    __weak typeof(self) weakself = self;
-    
-    messageBoxController.changeHandler = ^(UITextField *textField,NSRange range,NSString *string) {
-        
-        return YES;
-    };
-    
-    messageBoxController.textHandler = ^(NSString *text){
-        
-        AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
-        
-        if ([text isEqualToString:appDelegate.password]) {
-            
-//            [[NSUserDefaults standardUserDefaults] removeObjectForKey:self.passwordKey];
-//            weakself.password = nil;
-            weakself.index = 0;
-            weakself.input = @"";
-            for (JKDotView *dot in self.dotArray) {
-                dot.state = JKDotStateNormal;
-            }
-            
-//            weakself.tipLabel.text = @"Please Set A New Password";
-            [weakVC dismissViewControllerAnimated:YES completion:^{
-//                weakself.tipLabel.text = @"Please Set A New Password";
-                
-                    UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"Your Current Password" message:weakself.password preferredStyle:UIAlertControllerStyleAlert];
-
-                
-                    UIAlertAction *action = [UIAlertAction actionWithTitle:@"ok" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
-                
-                        if (alertController.navigationController) {
-                            [alertController.navigationController popViewControllerAnimated:YES];
-                        } else {
-                            [alertController dismissViewControllerAnimated:YES completion:nil];
-                        }
-                
-                    }];
-                
-                    [alertController addAction:action];
-                    
-
-                    [weakself presentViewController:alertController animated:YES completion:nil];
-
-
-                
-            }];
-            
-        } else {
-            
-            [weakVC warning:@"It's wrong,please try again"];
-            
-        }
-        
-        
-        
-        
-    };
-    
-    [self presentViewController:messageBoxController animated:YES completion:nil];
-    
-}
-
-- (void)resetButtonClick:(UIButton *)sender {
-    JKMessageBoxController *messageBoxController = [JKMessageBoxController messageBoxControllerWithTip:@"Please enter your login password"];
-    
-    __weak typeof(messageBoxController) weakVC = messageBoxController;
-    __weak typeof(self) weakself = self;
-    
-    messageBoxController.changeHandler = ^(UITextField *textField,NSRange range,NSString *string) {
-        
-        return YES;
-    };
-    
-    messageBoxController.textHandler = ^(NSString *text){
-        
-        AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
-        
-        if ([text isEqualToString:appDelegate.password]) {
-            
-            [[NSUserDefaults standardUserDefaults] removeObjectForKey:self.passwordKey];
-            weakself.password = nil;
-            weakself.index = 0;
-            weakself.input = @"";
-            for (JKDotView *dot in self.dotArray) {
-                dot.state = JKDotStateNormal;
-            }
-            
-            weakself.tipLabel.text = @"Please Set A New Password";
-            [weakVC dismissViewControllerAnimated:YES completion:^{
-                weakself.tipLabel.text = @"Please Set A New Password";
-                
-            }];
-            
-        } else {
-            
-            [weakVC warning:@"It's wrong,please try again"];
-            
-        }
-        
-        
-        
-        
-    };
-    
-    [self presentViewController:messageBoxController animated:YES completion:nil];
-}
-
-
-- (void)verifyPassword {
-    
-    self.index = 0;
-    for (JKDotView *dot in self.dotArray) {
-        dot.state = JKDotStateNormal;
-    }
-    
-    if (self.password) { // 验证
-        DebugLog(@"password: %@",self.password);
-        if ([self.password isEqualToString:self.input]) {
-            
-            [[NSUserDefaults standardUserDefaults] setObject:self.password forKey:self.passwordKey];
-            [[NSUserDefaults standardUserDefaults] synchronize];
-            
-            self.tipLabel.text = @"Please Input Your Password";
-            [self cancelButtonClick:nil];// 返回前一个页面
-            sleep(0.25);// 先回到前一个页面才做事情,0.25s为隐式动画持续时间
-            if (self.authoReturn) {
-                self.authoReturn(YES);
-            }
-            
-            
-        } else {
-            
-            self.tipLabel.text = @"The Password Doesn't Match,Please Try Again";
-        }
-        
-    } else { //设置
-        
-        self.password = self.input;
-        self.tipLabel.text = @"Please re-enter password to confirm";
-    }
-    self.input = @"";
-}
-
-
-@end

+ 0 - 31
RedAnt ERP Mobile/iSales-NPD/JKLock/JKMessageBoxController.h

@@ -1,31 +0,0 @@
-//
-//  JKAlertController.h
-//  Lock
-//
-//  Created by Jack on 2016/10/15.
-//  Copyright © 2016年 mini1. All rights reserved.
-//
-
-#import <UIKit/UIKit.h>
-
-typedef BOOL(^textChangeHandler)(UITextField *textField,NSRange changeRange,NSString*string);
-
-typedef void(^inputHandler)(NSString *text);
-
-@interface JKMessageBoxController : UIViewController
-
-@property (nonatomic,copy) textChangeHandler changeHandler;
-
-@property (nonatomic,copy) inputHandler textHandler;
-
-@property (nonatomic,copy) NSString *yesButtonTitle;
-
-@property (nonatomic,strong) UITextField *textFiled;///<default secureTextEntry = Yes
-
-+ (instancetype)messageBoxControllerWithTip:(NSString *)msg;
-
-+ (instancetype)messageBoxControllerWithTip:(NSString *)msg ContentSize:(CGSize)size;
-
-- (void)warning:(NSString *)msg;
-
-@end

+ 0 - 171
RedAnt ERP Mobile/iSales-NPD/JKLock/JKMessageBoxController.m

@@ -1,171 +0,0 @@
-//
-//  JKAlertController.m
-//  Lock
-//
-//  Created by Jack on 2016/10/15.
-//  Copyright © 2016年 mini1. All rights reserved.
-//
-
-#import "JKMessageBoxController.h"
-#import "AppDelegate.h"
-
-#define Button_Title_Normal_Color [UIColor colorWithRed:0.0 green:0.4 blue:0.8 alpha:1]
-#define Button_Title_Highlight_Color [UIColor colorWithRed:0.0 green:0.3 blue:0.8 alpha:1]
-
-
-@interface JKMessageBoxController ()<UITextFieldDelegate>
-
-@property (nonatomic,strong) UILabel *titleLabel;
-@property (nonatomic,strong) UIView *buttonBackground;
-@property (nonatomic,strong) UIButton *cancelButton;
-@property (nonatomic,strong) UIButton *yesButton;
-
-@end
-
-@implementation JKMessageBoxController
-
-+ (instancetype)messageBoxControllerWithTip:(NSString *)msg {
-    JKMessageBoxController *alertController = [[JKMessageBoxController alloc] init];
-
-    // 设置弹出视图时视图大小位置
-    alertController.modalPresentationStyle = UIModalPresentationFormSheet; // 只在iPad起作用
-    alertController.preferredContentSize = CGSizeMake(300, 130); // 只有在 UIModalPresentationFormSheet 的时候起作用
-    alertController.titleLabel.text = msg;
-    alertController.title = msg;
-    
-    return alertController;
-}
-
-+ (instancetype)messageBoxControllerWithTip:(NSString *)msg ContentSize:(CGSize)size{
-    JKMessageBoxController *alertController = [[JKMessageBoxController alloc] init];
-    
-    // 设置弹出视图时视图大小位置
-    alertController.modalPresentationStyle = UIModalPresentationFormSheet; // 只在iPad起作用
-    if (size.width <= 0 || size.height <= 0) {
-        size = CGSizeMake(300, 130);
-    }
-    alertController.preferredContentSize = size; // 只有在 UIModalPresentationFormSheet 的时候起作用
-    alertController.titleLabel.text = msg;
-    alertController.title = msg;
-    
-    return alertController;
-}
-
-- (void)warning:(NSString *)msg {
-    self.textFiled.text = @"";
-    self.titleLabel.text = msg;
-    self.titleLabel.textColor = [UIColor redColor];
-    
-    [self performSelector:@selector(resetTitleLabel) withObject:nil afterDelay:1];
-}
-
-- (void)resetTitleLabel {
-    self.titleLabel.text = self.title;
-    self.titleLabel.textColor = [UIColor blackColor];
-}
-
-- (UILabel *)titleLabel {
-    if (!_titleLabel) {
-        _titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 10, self.preferredContentSize.width - 20, 25)];
-        _titleLabel.font = [UIFont systemFontOfSize:14];
-        _titleLabel.textAlignment = NSTextAlignmentCenter;
-    }
-    return _titleLabel;
-}
-
-- (UITextField *)textFiled {
-    if (!_textFiled) {
-        _textFiled = [[UITextField alloc] initWithFrame:CGRectMake(10, CGRectGetMaxY(self.titleLabel.frame) + 10, self.preferredContentSize.width - 20, 25)];
-        _textFiled.font = [UIFont systemFontOfSize:13];
-        _textFiled.borderStyle = UITextBorderStyleRoundedRect;
-        _textFiled.secureTextEntry = YES;
-        _textFiled.delegate = self;
-    }
-    return _textFiled;
-}
-
-- (UIView *)buttonBackground {
-    if (!_buttonBackground) {
-        _buttonBackground = [[UIView alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(self.textFiled.frame) + 20, self.preferredContentSize.width,  self.preferredContentSize.height - CGRectGetMaxY(self.textFiled.frame) - 10)];
-        
-        [_buttonBackground addSubview:self.cancelButton];
-        [_buttonBackground addSubview:self.yesButton];
-        _buttonBackground.backgroundColor = [UIColor colorWithRed:0.6 green:0.6 blue:0.6 alpha:1];
-    }
-    return _buttonBackground;
-}
-
-- (UIButton *)cancelButton {
-    if (!_cancelButton) {
-        _cancelButton = [UIButton buttonWithType:UIButtonTypeCustom];
-        _cancelButton.frame = CGRectMake(0, 0.5, self.preferredContentSize.width / 2 - 0.25, CGRectGetHeight(self.buttonBackground.frame));
-        [_cancelButton setTitle:@"cancel" forState:UIControlStateNormal];
-        [_cancelButton setTitleColor:Button_Title_Normal_Color forState:UIControlStateNormal];
-        [_cancelButton setTitleColor:Button_Title_Highlight_Color forState:UIControlStateHighlighted];
-        _cancelButton.backgroundColor = [UIColor whiteColor];
-        _cancelButton.titleLabel.font = [UIFont systemFontOfSize:15.0];
-        _cancelButton.titleEdgeInsets = UIEdgeInsetsMake(-15, 0, 0, 0);
-        [_cancelButton addTarget:self action:@selector(cancelButtonClick:) forControlEvents:UIControlEventTouchUpInside];
-    }
-    return _cancelButton;
-}
-
-- (UIButton *)yesButton {
-    if (!_yesButton) {
-        _yesButton = [UIButton buttonWithType:UIButtonTypeCustom];
-        _yesButton.frame = CGRectMake(CGRectGetMaxX(self.cancelButton.frame) + 0.5, 0.5, self.preferredContentSize.width / 2 - 0.25, CGRectGetHeight(self.buttonBackground.frame));
-        NSString *title = self.yesButtonTitle == nil ? @"ok" : self.yesButtonTitle;
-        [_yesButton setTitle:title forState:UIControlStateNormal];
-        [_yesButton setTitleColor:Button_Title_Normal_Color forState:UIControlStateNormal];
-        [_yesButton setTitleColor:Button_Title_Highlight_Color forState:UIControlStateHighlighted];
-        _yesButton.backgroundColor = [UIColor whiteColor];
-        _yesButton.titleLabel.font = [UIFont systemFontOfSize:15.0];
-        _yesButton.titleEdgeInsets = UIEdgeInsetsMake(-15, 0, 0, 0);
-        [_yesButton addTarget:self action:@selector(yesButtonClick:) forControlEvents:UIControlEventTouchUpInside];
-    }
-    return _yesButton;
-}
-
-- (void)viewDidLoad {
-    [super viewDidLoad];
-    // Do any additional setup after loading the view.
- 
-    self.view.backgroundColor = [UIColor whiteColor];
-    
-    [self.view addSubview:self.titleLabel];
-    [self.view addSubview:self.textFiled];
-    [self.view addSubview:self.buttonBackground];
-}
-
-- (void)didReceiveMemoryWarning {
-    [super didReceiveMemoryWarning];
-    // Dispose of any resources that can be recreated.
-}
-
-- (void)cancelButtonClick:(UIButton *)sender {
-    if (self.navigationController) {
-        [self.navigationController popViewControllerAnimated:YES];
-    } else {
-        [self dismissViewControllerAnimated:YES completion:nil];
-    }
-}
-
-- (void)yesButtonClick:(UIButton *)sender {
-    
-    if (self.textHandler) {
-        self.textHandler(self.textFiled.text);
-    }
-    
-}
-
-- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
-    
-    if (self.changeHandler) {
-        return self.changeHandler(textField,range,string);
-    }
-    
-    return YES;
-}
-
-
-@end

+ 0 - 38
RedAnt ERP Mobile/iSales-NPD/JKTimer/JKTimerManager.h

@@ -1,38 +0,0 @@
-//
-//  JKTimer.h
-//  JKUtilDemo
-//
-//  Created by Jack on 7/1/16.
-//  Copyright © 2016 Emerys. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-
-@interface JKTimerManager : NSObject
-
-+ (instancetype)sharedTimerManager;
-
-/**
- *  启动一个timer,默认精度为0.1秒
- *
- *  @param name          timer的名称,作为唯一标识
- *  @param timerInterval 执行的时间间隔
- *  @param queue         timer将被放入的队列,也就是最终action执行的队列。传入nil将自动放到一个子线程队列中
- *  @param repeats       timer是否循环调用
- *  @param action        时间间隔到点时执行的block
- */
-- (void)scheduledDispatchTimerWithName:(NSString *)name timeInterval:(NSTimeInterval)timerInterval queue:(dispatch_queue_t)queue repeats:(BOOL)repeats action:(dispatch_block_t)action;
-
-/**
- *  撤销某个timer
- *
- *  @param name timer的名称,唯一标识
- */
-- (void)cancelTimerWithName:(NSString *)name;
-
-/**
- *  撤销所有timer 
- */
-- (void)cancelAllTimer;
-
-@end

+ 0 - 106
RedAnt ERP Mobile/iSales-NPD/JKTimer/JKTimerManager.m

@@ -1,106 +0,0 @@
-//
-//  JKTimer.m
-//  JKUtilDemo
-//
-//  Created by Jack on 7/1/16.
-//  Copyright © 2016 Emerys. All rights reserved.
-//
-
-#import "JKTimerManager.h"
-
-#define lockName(var) [NSString stringWithFormat:@"%@_canceller",var]
-#define timerLock(var) [[JKTimerManager sharedTimerManager].lockContainer objectForKey:lockName(var)]
-
-@interface JKTimerManager ()
-
-@property (nonatomic,strong) NSMutableDictionary *timerContainer;
-@property (nonatomic,strong) NSMutableDictionary *lockContainer;
-
-@end
-
-@implementation JKTimerManager
-
-+ (instancetype)sharedTimerManager {
-    static JKTimerManager *manager = nil;
-    static dispatch_once_t token;
-    dispatch_once(&token, ^{
-        manager = [[JKTimerManager alloc] init];
-    });
-    
-    return manager;
-}
-
-- (NSMutableDictionary *)timerContainer {
-    if (!_timerContainer) {
-        _timerContainer = [NSMutableDictionary dictionary];
-    }
-    return _timerContainer;
-}
-
-- (void)scheduledDispatchTimerWithName:(NSString *)name
-                          timeInterval:(NSTimeInterval)timerInterval
-                                 queue:(dispatch_queue_t)queue
-                               repeats:(BOOL)repeats
-                                action:(dispatch_block_t)action {
-    if (name == nil)
-        return;
-    if (queue == nil)
-        queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
-    
-    dispatch_source_t timer = [self.timerContainer objectForKey:name];
-    if (!timer) {
-        timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, queue);
-        dispatch_resume(timer);
-        [self.timerContainer setObject:timer forKey:name];
-    }
-    
-    NSLock *timer_lock = [[NSLock alloc] init];
-    [self.lockContainer setObject:timer_lock forKey:lockName(name)];
-    
-    dispatch_source_set_timer(timer, dispatch_time(DISPATCH_TIME_NOW, timerInterval * NSEC_PER_SEC), timerInterval * NSEC_PER_SEC, 0.1 * NSEC_PER_SEC);
-    __weak typeof(self) weakSelf = self;
-    
-    dispatch_source_set_event_handler(timer, ^{
-        
-        [timerLock(name) lock];
-        
-        if (timer && action) {
-            
-            action();
-            if (!repeats) {
-                [weakSelf cancelTimerWithName:name];
-            }
-            
-        }
-        
-        [timerLock(name) unlock];
-    });
-    
-}
-
-- (void)cancelTimerWithName:(NSString *)name {
-    
-    dispatch_source_t timer = [self.timerContainer objectForKey:name];
-    if (!timer) {
-        return;
-    }
-    
-    NSLock *timer_lock = timerLock(name);
-    [timer_lock lock];
-
-    [self.lockContainer removeObjectForKey:lockName(name)];
-    [self.timerContainer removeObjectForKey:name];
-    dispatch_source_cancel(timer);
-    timer = nil;
-    
-    [timer_lock unlock];
-    
-}
-
-- (void)cancelAllTimer {
-    for (NSString *name in self.timerContainer.allKeys) {
-        [self cancelTimerWithName:name];
-    }
-}
-
-@end

+ 0 - 19
RedAnt ERP Mobile/iSales-NPD/UIColor+HEX/UIColor+JK_HEX.h

@@ -1,19 +0,0 @@
-//
-//  UIColor+JK_HEX.h
-//  chemistry2048
-//
-//  Created by emerys on 16/4/19.
-//  Copyright © 2016年 Emerys. All rights reserved.
-//
-
-#import <UIKit/UIKit.h>
-
-@interface UIColor (JK_HEX)
-
-+ (instancetype)colorWithHEX:(NSInteger)hex;
-
-+ (instancetype)colorWithHEX:(NSInteger)hex alpha:(CGFloat)alpha;
-
-+ (instancetype)colorWithHEXString:(NSString *)hexString;
-
-@end

+ 0 - 37
RedAnt ERP Mobile/iSales-NPD/UIColor+HEX/UIColor+JK_HEX.m

@@ -1,37 +0,0 @@
-//
-//  UIColor+JK_HEX.m
-//  chemistry2048
-//
-//  Created by emerys on 16/4/19.
-//  Copyright © 2016年 Emerys. All rights reserved.
-//
-
-#import "UIColor+JK_HEX.h"
-
-@implementation UIColor (JK_HEX)
-
-+ (instancetype)colorWithHEX:(NSInteger)hex{
-    return [UIColor colorWithRed:((hex & 0xff0000) >> 16) / 255.0 green:((hex & 0xff00) >> 8) / 255.0 blue:(hex & 0xff) / 255.0 alpha:1];
-}
-
-+ (instancetype)colorWithHEX:(NSInteger)hex alpha:(CGFloat)alpha {
-    if (alpha > 1) {
-        alpha = 1 / alpha;
-    }
-    return [UIColor colorWithRed:((hex & 0xff0000) >> 16) / 255.0 green:((hex & 0xff00) >> 8) / 255.0 blue:(hex & 0xff) / 255.0 alpha:alpha];
-}
-
-+ (instancetype)colorWithHEXString:(NSString *)hexString{
-    if ([hexString hasPrefix:@"#"]) {
-        hexString = [hexString stringByReplacingOccurrencesOfString:@"#" withString:@"0x"];
-    }
-    
-    if (![hexString hasPrefix:@"0x"]) {
-        return nil;
-    }
-    
-    NSInteger hex = strtoul([hexString UTF8String],0,16);
-    return [self colorWithHEX:hex];
-}
-
-@end